svn commit: r216835 - head/sys/dev/mwl

2010-12-31 Thread Bernhard Schmidt
Author: bschmidt
Date: Fri Dec 31 09:50:15 2010
New Revision: 216835
URL: http://svn.freebsd.org/changeset/base/216835

Log:
  The mwl's HAL manages an array of MWL_MBSS_MAX VAPs where the first 8 are
  supposed to be APs and the later 24 are pre-configured as STAs. A wrong
  condition during initialization is responsible for not configuring the last
  8 array members. This is results in being able to create more than 8,
  possible uninitialized, AP-VAPs.
  
  PR:   kern/153549
  Submitted by: Erik Fonnesbeck 
  MFC after:2 weeks

Modified:
  head/sys/dev/mwl/mwlhal.c

Modified: head/sys/dev/mwl/mwlhal.c
==
--- head/sys/dev/mwl/mwlhal.c   Fri Dec 31 02:19:38 2010(r216834)
+++ head/sys/dev/mwl/mwlhal.c   Fri Dec 31 09:50:15 2010(r216835)
@@ -279,7 +279,7 @@ mwl_hal_attach(device_t dev, uint16_t de
hvap->vap_type = MWL_HAL_STA;
hvap->bss_type = htole16(WL_MAC_TYPE_PRIMARY_CLIENT);
hvap->macid = i;
-   for (i++; i < MWL_MBSS_STA_MAX; i++) {
+   for (i++; i < MWL_MBSS_MAX; i++) {
hvap = &mh->mh_vaps[i];
hvap->vap_type = MWL_HAL_STA;
hvap->bss_type = htole16(WL_MAC_TYPE_SECONDARY_CLIENT);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216836 - head/share/misc

2010-12-31 Thread Gavin Atkinson
Author: gavin
Date: Fri Dec 31 11:55:39 2010
New Revision: 216836
URL: http://svn.freebsd.org/changeset/base/216836

Log:
  For committers listed as alumni, add the date that their commit bit was
  returned where this information is missing and easy to determine.  Move
  adrian@ back to the "Active committers" section.

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Dec 31 09:50:15 2010
(r216835)
+++ head/share/misc/committers-src.dot  Fri Dec 31 11:55:39 2010
(r216836)
@@ -28,31 +28,31 @@ node [color=grey62, style=filled, bgcolo
 
 # Alumni go here.. Try to keep things sorted.
 
-adrian [label="Adrian chadd\nadr...@freebsd.org\n2000/07/03\n2006/05/30"]
 alm [label="Andrew moore\n...@freebsd.org\n1993/06/12\n/??/??"]
 archie [label="Archie cobbs\narc...@freebsd.org\n1998/11/06\n2006/06/09"]
 asmodai [label="Jeroen ruigrok\nasmo...@freebsd.org\n1999/12/16\n2001/11/16"]
 cjc [label="Crist J. clark\n...@freebsd.org\n2001/06/01\n2006/12/29"]
-furuta [label="Atsushi furuta\nfur...@freebsd.org\n2000/06/21\n/??/??"]
+furuta [label="Atsushi furuta\nfur...@freebsd.org\n2000/06/21\n2003/03/08"]
 jtc [label="J.T. conklin\n...@freebsd.org\n1993/06/12\n/??/??"]
 keichii [label="Michael wu\nkeic...@freebsd.org\n2001/03/07\n2006/04/28"]
-mb [label="Maxim bolotin\...@freebsd.org\n2000/04/06\n/??/??"]
+mb [label="Maxim bolotin\...@freebsd.org\n2000/04/06\n2003/03/08"]
 nate [label="Nate willams\nn...@freebsd.org\n1993/06/12\n2003/12/15"]
 non [label="Noriaki mitsnaga\n...@freebsd.org\n2000/06/19\n2007/03/06"]
-rgrimes [label="Rod grimes\nrgri...@freebsd.org\n1993/06/12\n/??/??"]
-shafeeq [label="Shafeeq 
sinnamohideen\nshaf...@freebsd.org\n2000/06/19\n/??/??"]
+rgrimes [label="Rod grimes\nrgri...@freebsd.org\n1993/06/12\n2003/03/08"]
+shafeeq [label="Shafeeq 
sinnamohideen\nshaf...@freebsd.org\n2000/06/19\n2006/04/06"]
 sheldonh [label="Sheldon hearn\nsheld...@freebsd.org\n1999/06/14\n2006/05/13"]
 shin [label="Yoshinobu inoue\ns...@freebsd.org\n1999/07/29\n2003/03/08"]
 tmm [label="Thomas moestl\n...@freebsd.org\n2001/03/07\n2006/07/12"]
-toshi [label="Toshihiko arai\nto...@freebsd.org\n2000/07/06\n/??/??"]
+toshi [label="Toshihiko arai\nto...@freebsd.org\n2000/07/06\n2003/03/08"]
 tshiozak [label="Takuya 
shiozaki\ntshio...@freebsd.org\n2001/04/25\n2003/03/08"]
-uch [label="UCHIYAMA yasushi\n...@freebsd.org\n2000/06/21\n/??/??"]
+uch [label="UCHIYAMA yasushi\n...@freebsd.org\n2000/06/21\n2002/04/24"]
 
 node [color=lightblue2, style=filled, bgcolor=black];
 
 # Current src committers go here. Try to keep things sorted.
 
 ache [label="Andrey chernov\na...@freebsd.org\n1993/10/31"]
+adrian [label="Adrian chadd\nadr...@freebsd.org\n2000/07/03"]
 ae [label="Andrey V. elsukov\...@freebsd.org\n2010/06/03"]
 akiyama [label="Shunsuke akiyama\nakiy...@freebsd.org\n2000/06/19"]
 ambrisko [label="Doug ambrisko\nambri...@freebsd.org\n2001/12/19"]
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216840 - head/share/misc

2010-12-31 Thread Gavin Atkinson
Author: gavin
Date: Fri Dec 31 13:07:21 2010
New Revision: 216840
URL: http://svn.freebsd.org/changeset/base/216840

Log:
  Move alumni committers from the active section.

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Dec 31 12:59:17 2010
(r216839)
+++ head/share/misc/committers-src.dot  Fri Dec 31 13:07:21 2010
(r216840)
@@ -29,19 +29,41 @@ node [color=grey62, style=filled, bgcolo
 # Alumni go here.. Try to keep things sorted.
 
 alm [label="Andrew moore\n...@freebsd.org\n1993/06/12\n/??/??"]
+anholt [label="Eric anholt\nanh...@freebsd.org\n2002/04/22\n2008/08/07"]
 archie [label="Archie cobbs\narc...@freebsd.org\n1998/11/06\n2006/06/09"]
 asmodai [label="Jeroen ruigrok\nasmo...@freebsd.org\n1999/12/16\n2001/11/16"]
+benjsc [label="Benjamin close\nben...@freebsd.org\n2007/02/09\n2010/09/15"]
+bmah [label="Bruce A. mah\nb...@freebsd.org\n2002/01/29\n2009/09/13"]
+bmilekic [label="Bosko milekic\nbmile...@freebsd.org\n2000/09/21\n2008/11/10"]
 cjc [label="Crist J. clark\n...@freebsd.org\n2001/06/01\n2006/12/29"]
+dds [label="Diomidis spinellis\n...@freebsd.org\n2003/06/20\n2010/09/22"]
+dhartmei [label="Daniel 
hartmeier\ndhart...@freebsd.org\n2004/04/06\n2008/12/08"]
+dmlb [label="Duncan barclay\nd...@freebsd.org\n2001/12/14\n2008/11/10"]
+eik [label="Oliver eikemeier\n...@freebsd.org\n2004/05/20\n2008/11/10"]
 furuta [label="Atsushi furuta\nfur...@freebsd.org\n2000/06/21\n2003/03/08"]
+jake [label="Jake burkholder\nj...@freebsd.org\n2000/05/16\n2008/11/10"]
+jayanth [label="Jayanth 
vijayaraghavan\njaya...@freebsd.org\n2000/05/08\n2008/11/10"]
+jdp [label="John polstra\n...@freebsd.org\n/??/??\n2008/02/26"]
+jkh [label="Jordan K. hubbard\n...@freebsd.org\n1993/06/12\n2008/06/13"]
+joe [label="Josef karthauser\n...@freebsd.org\n1999/10/22\n2008/08/10"]
 jtc [label="J.T. conklin\n...@freebsd.org\n1993/06/12\n/??/??"]
 keichii [label="Michael wu\nkeic...@freebsd.org\n2001/03/07\n2006/04/28"]
+linimon [label="Mark linimon\nlini...@freebsd.org\n2006/09/30\n2008/05/04"]
 mb [label="Maxim bolotin\...@freebsd.org\n2000/04/06\n2003/03/08"]
+marks [label="Mark santcroos\nma...@freebsd.org\n2004/03/18\n2008/09/29"]
+murray [label="Murray stokely\nmur...@freebsd.org\n2000/04/05\n2010/07/25"]
 nate [label="Nate willams\nn...@freebsd.org\n1993/06/12\n2003/12/15"]
+njl [label="Nate lawson\n...@freebsd.org\n2002/08/07\n2008/02/16"]
 non [label="Noriaki mitsnaga\n...@freebsd.org\n2000/06/19\n2007/03/06"]
+onoe [label="Atsushi onoe\no...@freebsd.org\n2000/07/21\n2008/11/10"]
 rgrimes [label="Rod grimes\nrgri...@freebsd.org\n1993/06/12\n2003/03/08"]
+rink [label="Rink springer\nr...@freebsd.org\n2006/01/16\n2010/11/04"]
+rpaulo [label="Rui paulo\nrpa...@freebsd.org\n2007/09/25\n2010/12/03"]
 shafeeq [label="Shafeeq 
sinnamohideen\nshaf...@freebsd.org\n2000/06/19\n2006/04/06"]
 sheldonh [label="Sheldon hearn\nsheld...@freebsd.org\n1999/06/14\n2006/05/13"]
+shiba [label="Takeshi shibagaki\nsh...@freebsd.org\n2000/06/19\n2008/11/10"]
 shin [label="Yoshinobu inoue\ns...@freebsd.org\n1999/07/29\n2003/03/08"]
+snb [label="Nick barkas\n...@freebsd.org\n2009/05/05\n2010/11/04"]
 tmm [label="Thomas moestl\n...@freebsd.org\n2001/03/07\n2006/07/12"]
 toshi [label="Toshihiko arai\nto...@freebsd.org\n2000/07/06\n2003/03/08"]
 tshiozak [label="Takuya 
shiozaki\ntshio...@freebsd.org\n2001/04/25\n2003/03/08"]
@@ -60,14 +82,10 @@ anchie [label="Ana kukec\nanc...@freebsd
 andre [label="Andre oppermann\nan...@freebsd.org\n2003/11/12"]
 andreast [label="Andreas tobler\nandre...@freebsd.org\n2010/09/05"]
 andrew [label="Andrew turner\nand...@freebsd.org\n2010/07/19"]
-anholt [label="Eric anholt\nanh...@freebsd.org\n2002/04/22"]
 antoine [label="Antoine brodin\nanto...@freebsd.org\n2008/02/03"]
 ariff [label="Ariff abdullah\nar...@freebsd.org\n2005/11/14"]
 avg [label="Andriy gapon\n...@freebsd.org\n2009/02/18"]
-benjsc [label="Benjamin close\nben...@freebsd.org\n2007/02/09"]
 benno [label="Benno rice\nbe...@freebsd.org\n2000/11/02"]
-bmah [label="Bruce A. mah\nb...@freebsd.org\n2002/01/29"]
-bmilekic [label="Bosko milekic\nbmile...@freebsd.org\n/??/??"]
 bms [label="Bruce M simpson\n...@freebsd.org\n2003/08/06"]
 brian [label="Brian somers\nbr...@freebsd.org\n1996/12/16"]
 brooks [label="Brooks davis\nbro...@freebsd.org\n2001/06/21"]
@@ -81,17 +99,13 @@ cokane [label="Coleman kane\ncok...@free
 cperciva [label="Colin percival\ncperc...@freebsd.org\n2004/01/20"]
 csjp [label="Christian S.J. peron\nc...@freebsd.org\n2004/05/04"]
 davidxu [label="David xu\ndavi...@freebsd.org\n2002/09/02"]
-dds [label="Diomidis spinellis\n...@freebsd.org\n2003/06/20"]
 delphij [label="Xin li\ndelp...@freebsd.org\n2004/09/14"]
 des [label="Dag-Erling smorgrav\n...@freebsd.org\n1998/04/03"]
 dg [label="David greenman\...@freebsd.org\n1993/06/14"]
-dhartmei [label="Dan

Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Pawel Jakub Dawidek
On Fri, Dec 31, 2010 at 01:27:04AM +, Alexander Best wrote:
> On Thu Dec 30 10, Pawel Jakub Dawidek wrote:
> > Author: pjd
> > Date: Thu Dec 30 18:06:31 2010
> > New Revision: 216823
> > URL: http://svn.freebsd.org/changeset/base/216823
> > 
> > Log:
> >   For compatibility with Linux and Solaris add poweroff(8).
> 
> any thoughts on adding a 'shutdown -c' switch for compatibility reasons?
> right now the only way to revert a scheduled shutdown is to send a sigterm.
> 'shutdown -c' would provide an easier way and in addition to that using
> 'shutdown -c reason', admins could issue a notice to users why a scheduled
> shutdown was aborted.
> 
> this is the explanation for the -c option from the linux shutdown(8) manual:
> 
> "-c
> Cancel an already running shutdown. With this option it is of course not
> possible to give the time argument, but you can enter a explanatory 
> message
> on the command line that will be sent to all users."

I'm not against such a change:)

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
p...@freebsd.org   http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!


pgpHxlh6LGZSg.pgp
Description: PGP signature


Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Jilles Tjoelker
On Thu, Dec 30, 2010 at 06:06:31PM +, Pawel Jakub Dawidek wrote:
> Author: pjd
> Date: Thu Dec 30 18:06:31 2010
> New Revision: 216823
> URL: http://svn.freebsd.org/changeset/base/216823

> Log:
>   For compatibility with Linux and Solaris add poweroff(8).

>   It is implemented as a hard link to shutdown(8) and it is equivalent of:

>   # shutdown -p now

If we go that way, then for consistency reboot(8) and halt(8) should
also be equivalent to calling shutdown -r now and shutdown -h now
respectively, unless conflicting options are given. Linux has a -f
option for what's currently reboot's and halt's default action, and
fastboot(8)/fasthalt(8) could also retain the current behaviour.

I would be in favour of this change.

-- 
Jilles Tjoelker
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216836 - head/share/misc

2010-12-31 Thread Gary Jennejohn
On Fri, 31 Dec 2010 11:55:39 + (UTC)
Gavin Atkinson  wrote:

> Author: gavin
> Date: Fri Dec 31 11:55:39 2010
> New Revision: 216836
> URL: http://svn.freebsd.org/changeset/base/216836
> 
> Log:
>   For committers listed as alumni, add the date that their commit bit was
>   returned where this information is missing and easy to determine.  Move
>   adrian@ back to the "Active committers" section.
> 

Hmm, I (gj@) should be in there somewhere, since I was a src committer
from about 1995 until about 2007 or so.  Can't find myself :(

For that matter, I'm not in committers-ports.dot either, although I am
still active as a ports committer.

Ah well, just administrative trivia.

-- 
Gary Jennejohn
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216836 - head/share/misc

2010-12-31 Thread Bjoern A. Zeeb

On Fri, 31 Dec 2010, Gary Jennejohn wrote:


On Fri, 31 Dec 2010 11:55:39 + (UTC)
Gavin Atkinson  wrote:


Author: gavin
Date: Fri Dec 31 11:55:39 2010
New Revision: 216836
URL: http://svn.freebsd.org/changeset/base/216836

Log:
  For committers listed as alumni, add the date that their commit bit was
  returned where this information is missing and easy to determine.  Move
  adrian@ back to the "Active committers" section.



Hmm, I (gj@) should be in there somewhere, since I was a src committer
from about 1995 until about 2007 or so.  Can't find myself :(


http://www.freebsd.org/cgi/cvsweb.cgi/CVSROOT-src/access.diff?r1=1.766;r2=1.767

You should be able to fix that yourself.


For that matter, I'm not in committers-ports.dot either, although I am
still active as a ports committer.


You should be able to fix that yourself.

If in doubt, with all the SVN, ask a src committer for review.

--
Bjoern A. Zeeb You have to have visions!
 Going to jail sucks --  All my daemons like it!
  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Erik Trulsson
On Fri, Dec 31, 2010 at 03:43:08PM +0100, Jilles Tjoelker wrote:
> On Thu, Dec 30, 2010 at 06:06:31PM +, Pawel Jakub Dawidek wrote:
> > Author: pjd
> > Date: Thu Dec 30 18:06:31 2010
> > New Revision: 216823
> > URL: http://svn.freebsd.org/changeset/base/216823
> 
> > Log:
> >   For compatibility with Linux and Solaris add poweroff(8).
> 
> >   It is implemented as a hard link to shutdown(8) and it is equivalent of:
> 
> > # shutdown -p now
> 
> If we go that way, then for consistency reboot(8) and halt(8) should
> also be equivalent to calling shutdown -r now and shutdown -h now
> respectively, unless conflicting options are given. Linux has a -f
> option for what's currently reboot's and halt's default action, and
> fastboot(8)/fasthalt(8) could also retain the current behaviour.
> 
> I would be in favour of this change.

I would not be in favour of such a change.  Adding a new command that
did not previously exist in FreeBSD (e.g.  poweroff(8)) is one thing,
and is unlikely to break anything or confuse anybody.

Changing the meaning of a command that is already present in FreeBSD is
something else, which is far more likely to cause problems.  Such
changes should generally be avoided unless there is some really good
reason to do it, and I don't think such a reason exists in this case.


-- 

Erik Trulsson
ertr1...@student.uu.se
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216843 - head/sys/i386/xen

2010-12-31 Thread Colin Percival
Author: cperciva
Date: Fri Dec 31 17:39:31 2010
New Revision: 216843
URL: http://svn.freebsd.org/changeset/base/216843

Log:
  Make i386_set_ldt work on i386/XEN, step 1/5.
  
  Lock the vm page queue mutex around calls to pte_store.  As with many other
  uses of the vm page queue mutex in i386/xen/pmap.c, this is bogus and needs
  to be replaced at some future date by a spin lock dedicated to protecting
  the queue of pending xen page mapping hypervisor calls.  (But for now, bogus
  locking is better than a panic.)
  
  MFC after:3 days

Modified:
  head/sys/i386/xen/pmap.c

Modified: head/sys/i386/xen/pmap.c
==
--- head/sys/i386/xen/pmap.cFri Dec 31 15:16:18 2010(r216842)
+++ head/sys/i386/xen/pmap.cFri Dec 31 17:39:31 2010(r216843)
@@ -3647,7 +3647,9 @@ pmap_map_readonly(pmap_t pmap, vm_offset
for (i = 0; i < npages; i++) {
pt_entry_t *pte;
pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE));
+   vm_page_lock_queues();
pte_store(pte, xpmap_mtop(*pte & ~(PG_RW|PG_M)));
+   vm_page_unlock_queues();
PMAP_MARK_PRIV(xpmap_mtop(*pte));
pmap_pte_release(pte);
}
@@ -3661,7 +3663,9 @@ pmap_map_readwrite(pmap_t pmap, vm_offse
pt_entry_t *pte;
pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE));
PMAP_MARK_UNPRIV(xpmap_mtop(*pte));
+   vm_page_lock_queues();
pte_store(pte, xpmap_mtop(*pte) | (PG_RW|PG_M));
+   vm_page_unlock_queues();
pmap_pte_release(pte);
}
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216844 - head/sys/i386/include

2010-12-31 Thread Colin Percival
Author: cperciva
Date: Fri Dec 31 17:39:58 2010
New Revision: 216844
URL: http://svn.freebsd.org/changeset/base/216844

Log:
  Make i386_set_ldt work on i386/XEN, step 2/5.
  
  Don't map physical to machine page numbers in pte_load_store, since it uses
  PT_SET_VA (which takes a physical page number and converts it to a machine
  page number).
  
  MFC after:3 days

Modified:
  head/sys/i386/include/pmap.h

Modified: head/sys/i386/include/pmap.h
==
--- head/sys/i386/include/pmap.hFri Dec 31 17:39:31 2010
(r216843)
+++ head/sys/i386/include/pmap.hFri Dec 31 17:39:58 2010
(r216844)
@@ -253,7 +253,6 @@ pte_load_store(pt_entry_t *ptep, pt_entr
 {
pt_entry_t r;
 
-   v = xpmap_ptom(v);
r = *ptep;
PT_SET_VA(ptep, v, TRUE);
return (r);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216845 - head/sys/i386/i386

2010-12-31 Thread Colin Percival
Author: cperciva
Date: Fri Dec 31 17:40:30 2010
New Revision: 216845
URL: http://svn.freebsd.org/changeset/base/216845

Log:
  Make i386_set_ldt work on i386/XEN, step 3/5.
  
  Synchronize reality with comment: The user_ldt_alloc function is supposed to
  return with dt_lock held.  Due to broken locking in i386/xen/pmap.c, we drop
  dt_lock during the call to pmap_map_readonly and then pick it up again; this
  can be removed once the Xen pmap locking is fixed.
  
  MFC after:3 days

Modified:
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri Dec 31 17:39:58 2010
(r216844)
+++ head/sys/i386/i386/sys_machdep.cFri Dec 31 17:40:30 2010
(r216845)
@@ -450,6 +450,7 @@ user_ldt_alloc(struct mdproc *mdp, int l
 new_ldt->ldt_refcnt = 1; 
 new_ldt->ldt_active = 0; 
  
+   mtx_lock_spin(&dt_lock);
 if ((pldt = mdp->md_ldt)) { 
 if (len > pldt->ldt_len) 
 len = pldt->ldt_len; 
@@ -458,8 +459,10 @@ user_ldt_alloc(struct mdproc *mdp, int l
 } else { 
 bcopy(ldt, new_ldt->ldt_base, PAGE_SIZE); 
 } 
+mtx_unlock_spin(&dt_lock);  /* XXX kill once pmap locking fixed. */
 pmap_map_readonly(kernel_pmap, (vm_offset_t)new_ldt->ldt_base, 
   new_ldt->ldt_len*sizeof(union descriptor)); 
+mtx_lock_spin(&dt_lock);  /* XXX kill once pmap locking fixed. */
 return (new_ldt);
 } 
 #else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216846 - head/sys/i386/i386

2010-12-31 Thread Colin Percival
Author: cperciva
Date: Fri Dec 31 17:41:14 2010
New Revision: 216846
URL: http://svn.freebsd.org/changeset/base/216846

Log:
  Make i386_set_ldt work on i386/XEN, step 4/5.
  
  Use xen_update_descriptor to update the LDT rather than bcopy.  Under Xen,
  pages used for holding LDTs must be read-only, so we can't make the change
  ourselves.
  
  Ths obvious alternative of "remap the page read-write, make the change, then
  map it read-only again" doesn't work since Xen won't allow an LDT page to be
  remapped as R/W.  An arguably better solution is used by NetBSD: They don't
  modify LDTs in-place at all, but instead copy the entire LDT, modify the new
  version, then atomically swap.
  
  MFC after:3 days

Modified:
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri Dec 31 17:40:30 2010
(r216845)
+++ head/sys/i386/i386/sys_machdep.cFri Dec 31 17:41:14 2010
(r216846)
@@ -761,10 +761,14 @@ i386_set_ldt_data(struct thread *td, int
 
mtx_assert(&dt_lock, MA_OWNED);
 
-   /* Fill in range */
-   bcopy(descs,
-   &((union descriptor *)(pldt->ldt_base))[start],
-   num * sizeof(union descriptor));
+   while (num) {
+   xen_update_descriptor(
+   &((union descriptor *)(pldt->ldt_base))[start],
+   descs);
+   num--;
+   start++;
+   descs++;
+   }
return (0);
 }
 #else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216847 - in head/sys/i386: i386 include

2010-12-31 Thread Colin Percival
Author: cperciva
Date: Fri Dec 31 17:42:25 2010
New Revision: 216847
URL: http://svn.freebsd.org/changeset/base/216847

Log:
  Make i386_set_ldt work on i386/XEN, step 5/5.
  
  When cleaning up a thread, reset its LDT to the default LDT.
  
  Note: Casting the LDT pointer to an int and storing it in pc_currentldt is
  wildly bogus, but is harmless since pc_currentldt is a write-only variable.
  
  MFC after:3 days

Modified:
  head/sys/i386/i386/sys_machdep.c
  head/sys/i386/include/segments.h

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri Dec 31 17:41:14 2010
(r216846)
+++ head/sys/i386/i386/sys_machdep.cFri Dec 31 17:42:25 2010
(r216847)
@@ -523,8 +523,13 @@ user_ldt_free(struct thread *td)
}
 
if (td == PCPU_GET(curthread)) {
+#ifdef XEN
+   i386_reset_ldt(&default_proc_ldt);
+   PCPU_SET(currentldt, (int)&default_proc_ldt);
+#else
lldt(_default_ldt);
PCPU_SET(currentldt, _default_ldt);
+#endif
}
 
mdp->md_ldt = NULL;

Modified: head/sys/i386/include/segments.h
==
--- head/sys/i386/include/segments.hFri Dec 31 17:41:14 2010
(r216846)
+++ head/sys/i386/include/segments.hFri Dec 31 17:42:25 2010
(r216847)
@@ -257,6 +257,7 @@ struct region_descriptor {
 #ifdef _KERNEL
 extern int _default_ldt;
 #ifdef XEN
+extern struct proc_ldt default_proc_ldt;
 extern union descriptor *gdt;
 extern union descriptor *ldt;
 #else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216848 - in head: . sys/sys

2010-12-31 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec 31 18:07:16 2010
New Revision: 216848
URL: http://svn.freebsd.org/changeset/base/216848

Log:
  Happy New Year 2011.
  
  Approved by:  core (kib)

Modified:
  head/COPYRIGHT
  head/sys/sys/copyright.h

Modified: head/COPYRIGHT
==
--- head/COPYRIGHT  Fri Dec 31 17:42:25 2010(r216847)
+++ head/COPYRIGHT  Fri Dec 31 18:07:16 2010(r216848)
@@ -4,7 +4,7 @@
 The compilation of software known as FreeBSD is distributed under the
 following terms:
 
-Copyright (c) 1992-2010 The FreeBSD Project. All rights reserved.
+Copyright (c) 1992-2011 The FreeBSD Project. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: head/sys/sys/copyright.h
==
--- head/sys/sys/copyright.hFri Dec 31 17:42:25 2010(r216847)
+++ head/sys/sys/copyright.hFri Dec 31 18:07:16 2010(r216848)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 1992-2010 The FreeBSD Project. All rights reserved.
+ * Copyright (C) 1992-2011 The FreeBSD Project. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
 
 /* FreeBSD */
 #define COPYRIGHT_FreeBSD \
-   "Copyright (c) 1992-2010 The FreeBSD Project.\n"
+   "Copyright (c) 1992-2011 The FreeBSD Project.\n"
 
 /* Foundation */
 #defineTRADEMARK_Foundation \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216851 - in head: bin/sh tools/regression/bin/sh/errors

2010-12-31 Thread Jilles Tjoelker
Author: jilles
Date: Fri Dec 31 18:20:17 2010
New Revision: 216851
URL: http://svn.freebsd.org/changeset/base/216851

Log:
  sh: Check if dup2 for redirection from/to a file succeeds.
  
  A failure (e.g. caused by ulimit -n being set very low) is a redirection
  error.
  
  Example:
ulimit -n 9; exec 9<.

Added:
  head/tools/regression/bin/sh/errors/redirection-error7.0   (contents, props 
changed)
Modified:
  head/bin/sh/redir.c

Modified: head/bin/sh/redir.c
==
--- head/bin/sh/redir.c Fri Dec 31 18:16:44 2010(r216850)
+++ head/bin/sh/redir.c Fri Dec 31 18:20:17 2010(r216851)
@@ -155,6 +155,7 @@ openredirect(union node *redir, char mem
int fd = redir->nfile.fd;
char *fname;
int f;
+   int e;
 
/*
 * We suppress interrupts so that we won't leave open file
@@ -173,7 +174,11 @@ openredirect(union node *redir, char mem
error("cannot open %s: %s", fname, strerror(errno));
 movefd:
if (f != fd) {
-   dup2(f, fd);
+   if (dup2(f, fd) == -1) {
+   e = errno;
+   close(f);
+   error("%d: %s", fd, strerror(e));
+   }
close(f);
}
break;

Added: head/tools/regression/bin/sh/errors/redirection-error7.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/errors/redirection-error7.0Fri Dec 31 
18:20:17 2010(r216851)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+! dummy=$(
+   exec 3>&1 >&2 2>&3
+   ulimit -n 9
+   exec 9<.
+) && [ -n "$dummy" ]
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Alexander Best
On Fri Dec 31 10, Erik Trulsson wrote:
> On Fri, Dec 31, 2010 at 03:43:08PM +0100, Jilles Tjoelker wrote:
> > On Thu, Dec 30, 2010 at 06:06:31PM +, Pawel Jakub Dawidek wrote:
> > > Author: pjd
> > > Date: Thu Dec 30 18:06:31 2010
> > > New Revision: 216823
> > > URL: http://svn.freebsd.org/changeset/base/216823
> > 
> > > Log:
> > >   For compatibility with Linux and Solaris add poweroff(8).
> > 
> > >   It is implemented as a hard link to shutdown(8) and it is equivalent of:
> > 
> > >   # shutdown -p now
> > 
> > If we go that way, then for consistency reboot(8) and halt(8) should
> > also be equivalent to calling shutdown -r now and shutdown -h now
> > respectively, unless conflicting options are given. Linux has a -f
> > option for what's currently reboot's and halt's default action, and
> > fastboot(8)/fasthalt(8) could also retain the current behaviour.
> > 
> > I would be in favour of this change.
> 
> I would not be in favour of such a change.  Adding a new command that
> did not previously exist in FreeBSD (e.g.  poweroff(8)) is one thing,
> and is unlikely to break anything or confuse anybody.
> 
> Changing the meaning of a command that is already present in FreeBSD is
> something else, which is far more likely to cause problems.  Such
> changes should generally be avoided unless there is some really good
> reason to do it, and I don't think such a reason exists in this case.

of course you have a point there. on the other hand one can argue that the
current behavior is non-intuitive. most of the time users want to reboot or
halt a system nicely including execution of the rc.shutdown scripts. the
names "reboot" and "halt" suggest that these commands do exactly what i
described beforehand: to reboot or halt the system regularly.
in fact reboot and halt will not execute certain scripts and thus it is
recomended to use "shutdown -r now" or "shutdown -h now". why should
executables for a regular reboot and halt *not exist*, while executables
for a non-regular reboot and halt *do exist*?

even more: there are 2 executables for a non-reguar reboot and 2 for a
non-regular halt (reboot/fastboot and halt/fasthalt).

another thought: running 'reboot' instead of 'shutdown -r now' *can* cause
harm to the system, because an important rc.shutdown script wasn't executed.
however running 'shutdown -r now' in single-user mode e.g. will cause a few
sterr warnings; however it *cannot* cause any harm.

so if the semantics for reboot and halt get changed, nothing bad can happen
except for a few people wondering why suddenly reboot and halt execute
rc.shutdown scripts in single user mode and produce warnings.

so i vote for the following:
change 'reboot' to execute 'shutdown -r now'.
change 'halt' to execute 'shutdown -h now'.

fastboot and fasthalt should keep their current semantical behavior and would
need to become exectables rather than hardlinks to reboot/halt.

just my 0.02$.

cheers.
alex

> 
> 
> -- 
> 
> Erik Trulsson
> ertr1...@student.uu.se

-- 
a13x
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216855 - head/sys/net

2010-12-31 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec 31 21:06:52 2010
New Revision: 216855
URL: http://svn.freebsd.org/changeset/base/216855

Log:
  Move the increment operation under the lock and split the condition
  variable into two so that we can see on which one we are waiting.
  This might also more properly propagate the update of the
  flowclean_cycles flag and avoid "hangs" people were seeing.
  
  Suggested by: rwatson [1]
  Sponsored by: ISPsystem [1]
  Reviewed by:  julian [1]
  Updated by:   Mikolaj Golub (to.my.trociny gmail.com)
  Tested by:Mikolaj Golub (to.my.trociny gmail.com)
  MFC After:1 week
  
  [1] Early 2010, initial version.

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cFri Dec 31 20:39:27 2010(r216854)
+++ head/sys/net/flowtable.cFri Dec 31 21:06:52 2010(r216855)
@@ -195,7 +195,8 @@ static VNET_DEFINE(uma_zone_t, flow_ipv6
 #defineV_flow_ipv6_zoneVNET(flow_ipv6_zone)
 
 
-static struct cv   flowclean_cv;
+static struct cv   flowclean_f_cv;
+static struct cv   flowclean_c_cv;
 static struct mtx  flowclean_lock;
 static uint32_tflowclean_cycles;
 static uint32_tflowclean_freq;
@@ -951,7 +952,7 @@ flow_full(struct flowtable *ft)
if ((ft->ft_flags & FL_HASH_ALL) == 0)
ft->ft_udp_idle = ft->ft_fin_wait_idle =
ft->ft_syn_idle = ft->ft_tcp_idle = 5;
-   cv_broadcast(&flowclean_cv);
+   cv_broadcast(&flowclean_c_cv);
} else if (!full && ft->ft_full) {
flowclean_freq = 20*hz;
if ((ft->ft_flags & FL_HASH_ALL) == 0)
@@ -1560,14 +1561,14 @@ flowtable_cleaner(void)
}
VNET_LIST_RUNLOCK();
 
-   flowclean_cycles++;
/*
 * The 10 second interval between cleaning checks
 * is arbitrary
 */
mtx_lock(&flowclean_lock);
-   cv_broadcast(&flowclean_cv);
-   cv_timedwait(&flowclean_cv, &flowclean_lock, flowclean_freq);
+   flowclean_cycles++;
+   cv_broadcast(&flowclean_f_cv);
+   cv_timedwait(&flowclean_c_cv, &flowclean_lock, flowclean_freq);
mtx_unlock(&flowclean_lock);
}
 }
@@ -1580,8 +1581,8 @@ flowtable_flush(void *unused __unused)
mtx_lock(&flowclean_lock);
start = flowclean_cycles;
while (start == flowclean_cycles) {
-   cv_broadcast(&flowclean_cv);
-   cv_wait(&flowclean_cv, &flowclean_lock);
+   cv_broadcast(&flowclean_c_cv);
+   cv_wait(&flowclean_f_cv, &flowclean_lock);
}
mtx_unlock(&flowclean_lock);
 }
@@ -1613,7 +1614,8 @@ static void
 flowtable_init(const void *unused __unused)
 {
 
-   cv_init(&flowclean_cv, "flowcleanwait");
+   cv_init(&flowclean_c_cv, "c_flowcleanwait");
+   cv_init(&flowclean_f_cv, "f_flowcleanwait");
mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF);
EVENTHANDLER_REGISTER(ifnet_departure_event, flowtable_flush, NULL,
EVENTHANDLER_PRI_ANY);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216856 - head/sys/net

2010-12-31 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec 31 21:20:32 2010
New Revision: 216856
URL: http://svn.freebsd.org/changeset/base/216856

Log:
  Print the vnet pointer under DDB when iterating over flowtables of each
  virtual network stack instance.
  
  Sponsored by: ISPsystem [1]
  Reviewed by:  julian [1]
  MFC after:1 week
  
  [1] Early 2010.

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cFri Dec 31 21:06:52 2010(r216855)
+++ head/sys/net/flowtable.cFri Dec 31 21:20:32 2010(r216856)
@@ -1809,6 +1809,9 @@ DB_SHOW_COMMAND(flowtables, db_show_flow
 
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
+#ifdef VIMAGE
+   db_printf("vnet %p\n", vnet_iter);
+#endif
flowtable_show_vnet();
CURVNET_RESTORE();
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216857 - head/sys/netinet

2010-12-31 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec 31 21:47:11 2010
New Revision: 216857
URL: http://svn.freebsd.org/changeset/base/216857

Log:
  Try to catch a possible divide-by-zero as early as possible if "mtu" is 0
  (also test for negative MTUs if checking it anyway).
  An MTU of 0 is arguably a bug elsewhere, but this at least gives us some
  more debugging hints.
  
  Sponsored by: ISPsystem (Early 2010)
  MFC after:1 week

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cFri Dec 31 21:20:32 2010
(r216856)
+++ head/sys/netinet/ip_output.cFri Dec 31 21:47:11 2010
(r216857)
@@ -323,6 +323,9 @@ again:
} else {
mtu = ifp->if_mtu;
}
+   /* Catch a possible divide by zero later. */
+   KASSERT(mtu > 0, ("%s: mtu %d <= 0, rte=%p (rt_flags=0x%08x) ifp=%p",
+   __func__, mtu, rte, (rte != NULL) ? rte->rt_flags : 0, ifp));
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
m->m_flags |= M_MCAST;
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216858 - head/share/man/man4

2010-12-31 Thread Pyun YongHyeon
Author: yongari
Date: Fri Dec 31 21:52:51 2010
New Revision: 216858
URL: http://svn.freebsd.org/changeset/base/216858

Log:
  Remove duplicated "perfect"
  
  Pointed out by:   pluknet

Modified:
  head/share/man/man4/vte.4

Modified: head/share/man/man4/vte.4
==
--- head/share/man/man4/vte.4   Fri Dec 31 21:47:11 2010(r216857)
+++ head/share/man/man4/vte.4   Fri Dec 31 21:52:51 2010(r216858)
@@ -58,7 +58,7 @@ hash filter, VLAN over-size frame and fo
 The
 .Nm
 device driver uses three station addresses out of four as perfect
-perfect multicast filter.
+multicast filter.
 .Pp
 The
 .Nm
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216859 - head/sys/net

2010-12-31 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec 31 21:57:54 2010
New Revision: 216859
URL: http://svn.freebsd.org/changeset/base/216859

Log:
  Use NULL rather than 0 to invalidate a pointer.
  
  Rather than duplicating the LLE_FREE_LOCKED() macro code in LLE_FREE(),
  call it directly (like we do for the RT_* macros).
  
  Sponsored by: ISPsystem [1]
  Reviewed by:  julian [1]
  MFC After:1 week
  
  [1] Early 2010.

Modified:
  head/sys/net/if_llatbl.h

Modified: head/sys/net/if_llatbl.h
==
--- head/sys/net/if_llatbl.hFri Dec 31 21:52:51 2010(r216858)
+++ head/sys/net/if_llatbl.hFri Dec 31 21:57:54 2010(r216859)
@@ -116,19 +116,12 @@ struct llentry {
LLE_WUNLOCK(lle);   \
}   \
/* guard against invalid refs */\
-   lle = 0;\
+   lle = NULL; \
 } while (0)
 
 #defineLLE_FREE(lle) do {  \
LLE_WLOCK(lle); \
-   if ((lle)->lle_refcnt <= 1) \
-   (lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\
-   else {  \
-   (lle)->lle_refcnt--;\
-   LLE_WUNLOCK(lle);   \
-   }   \
-   /* guard against invalid refs */\
-   lle = NULL; \
+   LLE_FREE_LOCKED(lle);   \
 } while (0)
 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Warner Losh

On 12/31/2010 07:43, Jilles Tjoelker wrote:

On Thu, Dec 30, 2010 at 06:06:31PM +, Pawel Jakub Dawidek wrote:

Author: pjd
Date: Thu Dec 30 18:06:31 2010
New Revision: 216823
URL: http://svn.freebsd.org/changeset/base/216823
Log:
   For compatibility with Linux and Solaris add poweroff(8).
   It is implemented as a hard link to shutdown(8) and it is equivalent of:
# shutdown -p now

If we go that way, then for consistency reboot(8) and halt(8) should
also be equivalent to calling shutdown -r now and shutdown -h now
respectively, unless conflicting options are given. Linux has a -f
option for what's currently reboot's and halt's default action, and
fastboot(8)/fasthalt(8) could also retain the current behaviour.

I would be in favour of this change.
I'm not sure I'd go this far.  I really *LIKE* that halt/reboot is the 
low-level interface that shutdown -r now calls.  I'm not sure that 
moving away from this would be a good idea.  It cuts out many levels of 
indirection that can be useful in many instances.


Warner
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216860 - head/sys/dev/msk

2010-12-31 Thread Pyun YongHyeon
Author: yongari
Date: Fri Dec 31 22:18:41 2010
New Revision: 216860
URL: http://svn.freebsd.org/changeset/base/216860

Log:
  Fix endianness bug introduced in r205091.
  After controller updates control word in a RX LE, driver converts
  it to host byte order. The checksum value in the control word is
  stored in big endian form by controller. r205091 didn't account for
  the host byte order conversion such that the checksum value was
  incorrectly interpreted on big endian architectures which in turn
  made all TCP/UDP frames dropped. Make RX checksum offload work
  on any architectures by swapping the checksum value.
  
  Reported by:  Sreekanth M. ( kanthms <> netlogicmicro dot com )
  Tested by:Sreekanth M. ( kanthms <> netlogicmicro dot com )

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Fri Dec 31 21:57:54 2010(r216859)
+++ head/sys/dev/msk/if_msk.c   Fri Dec 31 22:18:41 2010(r216860)
@@ -3070,7 +3070,7 @@ msk_rxcsum(struct msk_if_softc *sc_if, u
default:
return;
}
-   csum = ntohs(sc_if->msk_csum & 0x);
+   csum = bswap16(sc_if->msk_csum & 0x);
/* Checksum fixup for IP options. */
len = hlen - sizeof(struct ip);
if (len > 0) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Erik Trulsson
On Fri, Dec 31, 2010 at 07:00:58PM +, Alexander Best wrote:

[snip]

> another thought: running 'reboot' instead of 'shutdown -r now' *can* cause
> harm to the system, because an important rc.shutdown script wasn't executed.
> however running 'shutdown -r now' in single-user mode e.g. will cause a few
> sterr warnings; however it *cannot* cause any harm.

Oh, yes, it can! (And I have been burnt by it once, after which I got
very careful about not using 'shutdown -r now' from single user mode.)

Take a look at /etc/rc.d/mixer
At shutdown it saves the current state of the soundcard mixer values
into a file and at start it restores the mixer values from that file.
If you boot into single user mode the start function will of course not
be executed leaving the mixer values at their default values.  If you
then use 'shutdown' these default values are what will be saved,
overwriting whatever values had been saved before, while if you had
instead had used 'reboot' the old saved values would have been left
untouched.
If you never change the mixer values from their defaukt you won't notice
anything, but otherwise it might take a while to figure out why the
sound is at the 'wrong' volume.

This is one example I have found where bad things can happen if you use
'shutdown' when you should have used 'reboot'.  I am fairly sure that
there are other instances that I just haven't run into (yet.)




-- 

Erik Trulsson
ertr1...@student.uu.se
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216861 - head/sys/kern

2010-12-31 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec 31 22:49:13 2010
New Revision: 216861
URL: http://svn.freebsd.org/changeset/base/216861

Log:
  Mfp4 CH177924:
  
  Add and export constants of array sizes of jail parameters as compiled into
  the kernel.
  This is the least intrusive way to allow kvm to read the (sparse) arrays
  independent of the options the kernel was compiled with.
  
  Reviewed by:  jhb (originally)
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Sponsored by: CK Software GmbH

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Fri Dec 31 22:18:41 2010(r216860)
+++ head/sys/kern/kern_jail.c   Fri Dec 31 22:49:13 2010(r216861)
@@ -140,7 +140,9 @@ static int prison_restrict_ip6(struct pr
 #definePD_LIST_XLOCKED 0x10
 
 /*
- * Parameter names corresponding to PR_* flag values
+ * Parameter names corresponding to PR_* flag values.  Size values are for kvm
+ * as we cannot figure out the size of a sparse array, or an array without a
+ * terminating entry.
  */
 static char *pr_flag_names[] = {
[0] = "persist",
@@ -151,6 +153,7 @@ static char *pr_flag_names[] = {
[8] = "ip6.saddrsel",
 #endif
 };
+const size_t pr_flag_names_size = sizeof(pr_flag_names);
 
 static char *pr_flag_nonames[] = {
[0] = "nopersist",
@@ -161,6 +164,7 @@ static char *pr_flag_nonames[] = {
[8] = "ip6.nosaddrsel",
 #endif
 };
+const size_t pr_flag_nonames_size = sizeof(pr_flag_nonames);
 
 struct jailsys_flags {
const char  *name;
@@ -178,6 +182,7 @@ struct jailsys_flags {
{ "ip6", PR_IP6_USER | PR_IP6_DISABLE, PR_IP6_USER },
 #endif
 };
+const size_t pr_flag_jailsys_size = sizeof(pr_flag_jailsys);
 
 static char *pr_allow_names[] = {
"allow.set_hostname",
@@ -188,6 +193,7 @@ static char *pr_allow_names[] = {
"allow.quotas",
"allow.socket_af",
 };
+const size_t pr_allow_names_size = sizeof(pr_allow_names);
 
 static char *pr_allow_nonames[] = {
"allow.noset_hostname",
@@ -198,6 +204,7 @@ static char *pr_allow_nonames[] = {
"allow.noquotas",
"allow.nosocket_af",
 };
+const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames);
 
 #defineJAIL_DEFAULT_ALLOW  PR_ALLOW_SET_HOSTNAME
 #defineJAIL_DEFAULT_ENFORCE_STATFS 2
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Alexander Best
On Fri Dec 31 10, Erik Trulsson wrote:
> On Fri, Dec 31, 2010 at 07:00:58PM +, Alexander Best wrote:
> 
> [snip]
> 
> > another thought: running 'reboot' instead of 'shutdown -r now' *can* cause
> > harm to the system, because an important rc.shutdown script wasn't executed.
> > however running 'shutdown -r now' in single-user mode e.g. will cause a few
> > sterr warnings; however it *cannot* cause any harm.
> 
> Oh, yes, it can! (And I have been burnt by it once, after which I got
> very careful about not using 'shutdown -r now' from single user mode.)
> 
> Take a look at /etc/rc.d/mixer
> At shutdown it saves the current state of the soundcard mixer values
> into a file and at start it restores the mixer values from that file.
> If you boot into single user mode the start function will of course not
> be executed leaving the mixer values at their default values.  If you
> then use 'shutdown' these default values are what will be saved,
> overwriting whatever values had been saved before, while if you had
> instead had used 'reboot' the old saved values would have been left
> untouched.
> If you never change the mixer values from their defaukt you won't notice
> anything, but otherwise it might take a while to figure out why the
> sound is at the 'wrong' volume.
> 
> This is one example I have found where bad things can happen if you use
> 'shutdown' when you should have used 'reboot'.  I am fairly sure that
> there are other instances that I just haven't run into (yet.)

that's a very good argument and in fact i remember to have also once been
bitten by the 'mixer' case.

so after a some more thoughts: just leave it the way it is. it would be nice
to have two commands which would do 'shutdown -r now' and 'shutdown -h now',
but i can't think of a name: slowboot/slowhalt? ;)

cheers.
alex

> 
> 
> 
> 
> -- 
> 
> Erik Trulsson
> ertr1...@student.uu.se

-- 
a13x
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216862 - head/sys/mips/mips

2010-12-31 Thread Juli Mallett
Author: jmallett
Date: Sat Jan  1 00:20:14 2011
New Revision: 216862
URL: http://svn.freebsd.org/changeset/base/216862

Log:
  o) When trying to determine whether the pcpu pointer is a managed address, 
check
 not just that it is greater than the minimal kernel virtual address, but 
also
 that it is less than the maximal kernel virtual address.  On n64 kernels, 
the
 pcpup comes out of a direct-mapped address that, with an unsigned compare, 
is
 rather greater than the minimal kernel virtual address.
  o) Turn the panic if interrupts are disabled in cpu_idle into a KASSERT since 
on
 other architectures it's behind INVARIANTS anyway.
  o) Add a check that not all interrupts are masked, too.
  o) Add cpu_idleclock() and cpu_activeclock() use to cpu_idle as is done on 
other
 architectures.

Modified:
  head/sys/mips/mips/machdep.c

Modified: head/sys/mips/mips/machdep.c
==
--- head/sys/mips/mips/machdep.cFri Dec 31 22:49:13 2010
(r216861)
+++ head/sys/mips/mips/machdep.cSat Jan  1 00:20:14 2011
(r216862)
@@ -426,8 +426,10 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
pcpu->pc_next_asid = 1;
pcpu->pc_asid_generation = 1;
 #ifdef SMP
-   if ((vm_offset_t)pcpup >= VM_MIN_KERNEL_ADDRESS)
+   if ((vm_offset_t)pcpup >= VM_MIN_KERNEL_ADDRESS &&
+   (vm_offset_t)pcpup <= VM_MAX_KERNEL_ADDRESS) {
mips_pcpu_tlb_init(pcpu);
+   }
 #endif
 }
 
@@ -483,10 +485,20 @@ spinlock_exit(void)
 void
 cpu_idle(int busy)
 {
-   if (mips_rd_status() & MIPS_SR_INT_IE)
-   __asm __volatile ("wait");
-   else
-   panic("ints disabled in idleproc!");
+   KASSERT((mips_rd_status() & MIPS_SR_INT_IE) != 0,
+   ("interrupts disabled in idle process."));
+   KASSERT((mips_rd_status() & MIPS_INT_MASK) != 0,
+   ("all interrupts masked in idle process."));
+
+   if (!busy) {
+   critical_enter();
+   cpu_idleclock();
+   }
+   __asm __volatile ("wait");
+   if (!busy) {
+   cpu_activeclock();
+   critical_exit();
+   }
 }
 
 int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216823 - head/sbin/shutdown

2010-12-31 Thread Jilles Tjoelker
On Fri, Dec 31, 2010 at 11:31:14PM +0100, Erik Trulsson wrote:
> On Fri, Dec 31, 2010 at 07:00:58PM +, Alexander Best wrote:
> > another thought: running 'reboot' instead of 'shutdown -r now' *can* cause
> > harm to the system, because an important rc.shutdown script wasn't executed.
> > however running 'shutdown -r now' in single-user mode e.g. will cause a few
> > sterr warnings; however it *cannot* cause any harm.

> Oh, yes, it can! (And I have been burnt by it once, after which I got
> very careful about not using 'shutdown -r now' from single user mode.)

> Take a look at /etc/rc.d/mixer
> At shutdown it saves the current state of the soundcard mixer values
> into a file and at start it restores the mixer values from that file.
> If you boot into single user mode the start function will of course not
> be executed leaving the mixer values at their default values.  If you
> then use 'shutdown' these default values are what will be saved,
> overwriting whatever values had been saved before, while if you had
> instead had used 'reboot' the old saved values would have been left
> untouched.
> If you never change the mixer values from their defaukt you won't notice
> anything, but otherwise it might take a while to figure out why the
> sound is at the 'wrong' volume.

> This is one example I have found where bad things can happen if you use
> 'shutdown' when you should have used 'reboot'.  I am fairly sure that
> there are other instances that I just haven't run into (yet.)

Yes, but I consider this a bug in either init or the rc system. The
problem already exists if shutdown is used from single-user.
Ctrl+Alt+Del also signals init, causing proper shutdown from multi-user
but mixer value loss from single-user.

If it is a bug in init, init should not run rc.shutdown when it has not
run any /etc/rc things, in the assumption that rc.shutdown shuts down
the things that /etc/rc has started. Furthermore, this seems reasonable
because rc.shutdown is also run when the system goes from multi-user to
single-user; it seems strange to run it another time when the system
goes down from single-user.

If it is a bug in /etc/rc.d/mixer, /etc/rc.d/mixer should somehow track
if it has been started, and ignore any stops if not. This seems less
general than changing init.

If it is a bug in /etc/rc, it should do the above tracking somehow for
all scripts.

-- 
Jilles Tjoelker
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"