Re: svn commit: r244077 - head/sys/amd64/amd64

2012-12-10 Thread Robert Watson


On Mon, 10 Dec 2012, Konstantin Belousov wrote:


Author: kib
Date: Mon Dec 10 05:14:34 2012
New Revision: 244077
URL: http://svnweb.freebsd.org/changeset/base/244077

Log:
 Add amd64-specific ddb command show pte.  The command displays the
 hierarchy of the page table entries which map the specified address.

 Reviewed by:   alc (previous version)
 Sponsored by:  The FreeBSD Foundation
 MFC after: 1 week


Ah, very nice indeed -- I'd actually like to see similar MD page table dumping 
routines for other architectures, especially MIPS with its software-defined 
page tables.


Robert
___
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: r243668 - in head/sys: kern sys

2012-12-10 Thread Alan Cox
On 12/09/2012 16:42, Andre Oppermann wrote:
 On 09.12.2012 21:35, Alan Cox wrote:
 Andre,

 I believe that this change did not actually correct the overflow
 problem.  See below for an explanation.

 On 11/29/2012 01:30, Andre Oppermann wrote:
 Author: andre
 Date: Thu Nov 29 07:30:42 2012
 New Revision: 243668
 URL: http://svnweb.freebsd.org/changeset/base/243668

 Log:
Using a long is the wrong type to represent the realmem and
 maxmbufmem
variable as they may overflow on i386/PAE and i386 with  2GB RAM.

Use 64bit quad_t instead.  It has broader kernel infrastructure
 support
with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available
 types.

Pointed out by:alc, bde

 Modified:
head/sys/kern/subr_param.c
head/sys/sys/mbuf.h

 Modified: head/sys/kern/subr_param.c
 ==

 --- head/sys/kern/subr_param.cThu Nov 29 06:26:42 2012(r243667)
 +++ head/sys/kern/subr_param.cThu Nov 29 07:30:42 2012(r243668)
 @@ -93,7 +93,7 @@ intncallout;/* maximum # of timer ev
   intnbuf;
   intngroups_max;/* max # groups per process */
   intnswbuf;
 -longmaxmbufmem;/* max mbuf memory */
 +quad_tmaxmbufmem;/* max mbuf memory */
   pid_tpid_max = PID_MAX;
   longmaxswzone;/* max swmeta KVA storage */
   longmaxbcache;/* max buffer cache KVA storage */
 @@ -271,7 +271,7 @@ init_param1(void)
   void
   init_param2(long physpages)
   {
 -long realmem;
 +quad_t realmem;

   /* Base parameters */
   maxusers = MAXUSERS;
 @@ -332,10 +332,10 @@ init_param2(long physpages)
* available kernel memory (physical or kmem).
* At most it can be 3/4 of available kernel memory.
*/
 -realmem = lmin(physpages * PAGE_SIZE,
 +realmem = qmin(physpages * PAGE_SIZE,
   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);


 physpages is a signed long.  Suppose it is 1,000,000.  On i386/PAE,
 the product of 1,000,000 and PAGE_SIZE will be a negative number.
 Likewise, quad_t is a signed type.  So, the negative product of
 1,000,000 and PAGE_SIZE will be sign extended to a 64-bit signed value
 when it is passed to qmin(), and qmin() will return a negative number.

 Thank you taking a second look it.

 To be honest I got a bit confused on which automatic type expansion
 applies here.

 qmax() is defined as this in libkern.h:
 static __inline quad_t qmax(quad_t a, quad_t b) { return (a  b ? a :
 b); }

 Wouldn't physpages be expanded to quad_t?  Hmm, no, only the result of
 the
 computation, which happens in long space, is passed on.  This is a
 function,
 not a macro.  Dang...

 This change will force the computation to be in quad_t space:

 -   realmem = qmin(physpages * PAGE_SIZE,
 +   realmem = qmin((quad_t)physpages * PAGE_SIZE,
 VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);

 VM_[MAX|MIN]_KERNEL_ADDRESS is safe as it is of the unsigned vm_offset_t
 type.



This change looks ok.  As Bruce mentioned, can you also change the
indentation of the next line to match style(9) before you commit the change?

Alan

___
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: r244080 - head/sys/kern

2012-12-10 Thread Andre Oppermann
Author: andre
Date: Mon Dec 10 12:19:03 2012
New Revision: 244080
URL: http://svnweb.freebsd.org/changeset/base/244080

Log:
  Prevent long type overflow of realmem calculation on ILP32 by forcing
  calculation to be in quad_t space.  Fix style issue with second parameter
  to qmin().
  
  Reported by:  alc
  Reviewed by:  bde, alc

Modified:
  head/sys/kern/subr_param.c

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Mon Dec 10 11:26:18 2012(r244079)
+++ head/sys/kern/subr_param.c  Mon Dec 10 12:19:03 2012(r244080)
@@ -332,8 +332,8 @@ init_param2(long physpages)
 * available kernel memory (physical or kmem).
 * At most it can be 3/4 of available kernel memory.
 */
-   realmem = qmin(physpages * PAGE_SIZE,
-   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
+   realmem = qmin((quad_t)physpages * PAGE_SIZE,
+   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
maxmbufmem = realmem / 2;
TUNABLE_QUAD_FETCH(kern.maxmbufmem, maxmbufmem);
if (maxmbufmem  (realmem / 4) * 3)
___
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: r244082 - head/share/man/man4

2012-12-10 Thread Gleb Smirnoff
Author: glebius
Date: Mon Dec 10 13:08:14 2012
New Revision: 244082
URL: http://svnweb.freebsd.org/changeset/base/244082

Log:
  NGM_NETFLOW_SHOW reports IPv6 flows as well.
  
  Submitted by: Dmitry Luhtionov dmitryluhtionov gmail.com

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

Modified: head/share/man/man4/ng_netflow.4
==
--- head/share/man/man4/ng_netflow.4Mon Dec 10 12:47:33 2012
(r244081)
+++ head/share/man/man4/ng_netflow.4Mon Dec 10 13:08:14 2012
(r244082)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd Nov 2, 2012
+.Dd December 10, 2012
 .Dt NG_NETFLOW 4
 .Os
 .Sh NAME
@@ -254,9 +254,6 @@ It is called from
 .Xr flowctl 8 ,
 not directly from
 .Xr ngctl 8 .
-See also
-.Sx BUGS
-section.
 .It Dv NGM_NETFLOW_V9INFO Pq Ic v9info
 Returns some NetFlow v9 related values in a
 .Bd -literal -offset 4n
@@ -349,7 +346,6 @@ written by
 Cache snapshot obtained via
 .Dv NGM_NETFLOW_SHOW
 command may lack some percentage of entries under severe load.
-IPv6 flows are not shown.
 .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: r244089 - head/sys/boot/forth

2012-12-10 Thread Devin Teske
Author: dteske
Date: Mon Dec 10 15:29:56 2012
New Revision: 244089
URL: http://svnweb.freebsd.org/changeset/base/244089

Log:
  Add support for comma-separated values (whitespace-separated still supported).
  
  PR:   conf/121064
  Submitted by: koitsu
  Reviewed by:  jh

Modified:
  head/sys/boot/forth/support.4th

Modified: head/sys/boot/forth/support.4th
==
--- head/sys/boot/forth/support.4th Mon Dec 10 14:37:18 2012
(r244088)
+++ head/sys/boot/forth/support.4th Mon Dec 10 15:29:56 2012
(r244089)
@@ -207,20 +207,20 @@ create last_module_option sizeof module.
dup 0= if 2drop 2drop false exit then
begin
begin
-   swap dup c@ dup 32 = over 9 = or
-   over 10 = or over 13 = or swap drop
+   swap dup c@ dup 32 = over 9 = or over 10 = or
+   over 13 = or over 44 = or swap drop
while 1+ swap 1- repeat
swap 2 pick 1- over 
while
2over 2over drop over compare-insensitive 0= if
2 pick over = if 2drop 2drop true exit then
2 pick tuck - -rot + swap over c@ dup 32 =
-   over 9 = or over 10 = or over 13 = or
+   over 9 = or over 10 = or over 13 = or over 44 = or
swap drop if 2drop 2drop true exit then
then begin
-   swap dup c@
-   dup 32 = over 9 = or over 10 = or over 13 = or
-   swap drop if false else true then 2 pick 0 and
+   swap dup c@ dup 32 = over 9 = or over 10 = or
+   over 13 = or over 44 = or swap drop
+   if false else true then 2 pick 0 and
while 1+ swap 1- repeat
swap
repeat
___
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: r244090 - head/sys/net

2012-12-10 Thread Guy Helmer
Author: ghelmer
Date: Mon Dec 10 16:14:44 2012
New Revision: 244090
URL: http://svnweb.freebsd.org/changeset/base/244090

Log:
  Changes to resolve races in bpfread() and catchpacket() that, at worst,
  cause kernel panics.
  
  Add a flag to the bpf descriptor to indicate whether the hold buffer
  is in use. In bpfread(), set the hold buffer in use flag before
  dropping the descriptor lock during the call to bpf_uiomove().
  Everywhere else the hold buffer is used or changed, wait while
  the hold buffer is in use by bpfread(). Add a KASSERT in bpfread()
  after re-acquiring the descriptor lock to assist uncovering any
  additional hold buffer races.

Modified:
  head/sys/net/bpf.c
  head/sys/net/bpf.h
  head/sys/net/bpf_buffer.c
  head/sys/net/bpfdesc.h

Modified: head/sys/net/bpf.c
==
--- head/sys/net/bpf.c  Mon Dec 10 15:29:56 2012(r244089)
+++ head/sys/net/bpf.c  Mon Dec 10 16:14:44 2012(r244090)
@@ -819,6 +819,7 @@ bpfopen(struct cdev *dev, int flags, int
 * particular buffer method.
 */
bpf_buffer_init(d);
+   d-bd_hbuf_in_use = 0;
d-bd_bufmode = BPF_BUFMODE_BUFFER;
d-bd_sig = SIGIO;
d-bd_direction = BPF_D_INOUT;
@@ -872,6 +873,9 @@ bpfread(struct cdev *dev, struct uio *ui
callout_stop(d-bd_callout);
timed_out = (d-bd_state == BPF_TIMED_OUT);
d-bd_state = BPF_IDLE;
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET|PCATCH, bd_hbuf, 0);
/*
 * If the hold buffer is empty, then do a timed sleep, which
 * ends when the timeout expires or when enough packets
@@ -940,27 +944,27 @@ bpfread(struct cdev *dev, struct uio *ui
/*
 * At this point, we know we have something in the hold slot.
 */
+   d-bd_hbuf_in_use = 1;
BPFD_UNLOCK(d);
 
/*
 * Move data from hold buffer into user space.
 * We know the entire buffer is transferred since
 * we checked above that the read buffer is bpf_bufsize bytes.
-*
-* XXXRW: More synchronization needed here: what if a second thread
-* issues a read on the same fd at the same time?  Don't want this
-* getting invalidated.
+*
+* We do not have to worry about simultaneous reads because
+* we waited for sole access to the hold buffer above.
 */
error = bpf_uiomove(d, d-bd_hbuf, d-bd_hlen, uio);
 
BPFD_LOCK(d);
-   if (d-bd_hbuf != NULL) {
-   /* Free the hold buffer only if it is still valid. */
-   d-bd_fbuf = d-bd_hbuf;
-   d-bd_hbuf = NULL;
-   d-bd_hlen = 0;
-   bpf_buf_reclaimed(d);
-   }
+   KASSERT(d-bd_hbuf != NULL, (bpfread: lost bd_hbuf));
+   d-bd_fbuf = d-bd_hbuf;
+   d-bd_hbuf = NULL;
+   d-bd_hlen = 0;
+   bpf_buf_reclaimed(d);
+   d-bd_hbuf_in_use = 0;
+   wakeup(d-bd_hbuf_in_use);
BPFD_UNLOCK(d);
 
return (error);
@@ -1114,6 +1118,9 @@ reset_d(struct bpf_d *d)
 
BPFD_LOCK_ASSERT(d);
 
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock, PRINET,
+   bd_hbuf, 0);
if ((d-bd_hbuf != NULL) 
(d-bd_bufmode != BPF_BUFMODE_ZBUF || bpf_canfreebuf(d))) {
/* Free the hold buffer. */
@@ -1254,6 +1261,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 
BPFD_LOCK(d);
n = d-bd_slen;
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET, bd_hbuf, 0);
if (d-bd_hbuf)
n += d-bd_hlen;
BPFD_UNLOCK(d);
@@ -1967,6 +1977,9 @@ filt_bpfread(struct knote *kn, long hint
ready = bpf_ready(d);
if (ready) {
kn-kn_data = d-bd_slen;
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET, bd_hbuf, 0);
if (d-bd_hbuf)
kn-kn_data += d-bd_hlen;
} else if (d-bd_rtout  0  d-bd_state == BPF_IDLE) {
@@ -2299,6 +2312,9 @@ catchpacket(struct bpf_d *d, u_char *pkt
 * spot to do it.
 */
if (d-bd_fbuf == NULL  bpf_canfreebuf(d)) {
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET, bd_hbuf, 0);
d-bd_fbuf = d-bd_hbuf;
d-bd_hbuf = NULL;
d-bd_hlen = 0;
@@ -2341,6 +2357,9 @@ catchpacket(struct bpf_d *d, u_char *pkt
++d-bd_dcount;
return;
}
+   while (d-bd_hbuf_in_use)
+ 

svn commit: r244091 - head/lib/libc/locale

2012-12-10 Thread Brooks Davis
Author: brooks
Date: Mon Dec 10 17:34:33 2012
New Revision: 244091
URL: http://svnweb.freebsd.org/changeset/base/244091

Log:
  Improve style(9) compliance of function declarations.

Modified:
  head/lib/libc/locale/setrunelocale.c

Modified: head/lib/libc/locale/setrunelocale.c
==
--- head/lib/libc/locale/setrunelocale.cMon Dec 10 16:14:44 2012
(r244090)
+++ head/lib/libc/locale/setrunelocale.cMon Dec 10 17:34:33 2012
(r244091)
@@ -73,9 +73,11 @@ static int   __setrunelocale(struct xloca
 #define __collate_chain_pri_table (table-__collate_chain_pri_table)
 
 
-static void destruct_ctype(void *v)
+static void
+destruct_ctype(void *v)
 {
struct xlocale_ctype *l = v;
+
if (strcmp(l-runes-__encoding, EUC) == 0)
free(l-runes-__variable);
if (_DefaultRuneLocale != l-runes) 
@@ -83,13 +85,17 @@ static void destruct_ctype(void *v)
free(l);
 }
 
-const _RuneLocale *__getCurrentRuneLocale(void)
+const _RuneLocale *
+__getCurrentRuneLocale(void)
 {
+
return XLOCALE_CTYPE(__get_locale())-runes;
 }
 
-static void free_runes(_RuneLocale *rl)
+static void
+free_runes(_RuneLocale *rl)
 {
+
/* FIXME: The EUC check here is a hideous abstraction violation. */
if ((rl != _DefaultRuneLocale)  (rl)) {
if (strcmp(rl-__encoding, EUC) == 0) {
@@ -191,7 +197,8 @@ __wrap_setrunelocale(const char *locale)
 
 #ifndef __NO_TLS
 void
-__set_thread_rune_locale(locale_t loc) {
+__set_thread_rune_locale(locale_t loc)
+{
 
if (loc == NULL) {
_ThreadRuneLocale = _DefaultRuneLocale;
@@ -205,6 +212,7 @@ void *
 __ctype_load(const char *locale, locale_t unused)
 {
struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1);
+
l-header.header.destructor = destruct_ctype;
if (__setrunelocale(l, locale))
{
___
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: r244092 - head/lib/libc/gen

2012-12-10 Thread Jilles Tjoelker
Author: jilles
Date: Mon Dec 10 17:56:51 2012
New Revision: 244092
URL: http://svnweb.freebsd.org/changeset/base/244092

Log:
  libc: Make various internal file descriptors close-on-exec.
  
  These are obtained via fopen().

Modified:
  head/lib/libc/gen/fmtmsg.c
  head/lib/libc/gen/getcap.c
  head/lib/libc/gen/getgrent.c
  head/lib/libc/gen/getnetgrent.c
  head/lib/libc/gen/getttyent.c
  head/lib/libc/gen/getusershell.c
  head/lib/libc/gen/getutxent.c

Modified: head/lib/libc/gen/fmtmsg.c
==
--- head/lib/libc/gen/fmtmsg.c  Mon Dec 10 17:34:33 2012(r244091)
+++ head/lib/libc/gen/fmtmsg.c  Mon Dec 10 17:56:51 2012(r244092)
@@ -83,7 +83,7 @@ def:
if (output == NULL)
return (MM_NOCON);
if (*output != '\0') {
-   if ((fp = fopen(/dev/console, a)) == NULL) {
+   if ((fp = fopen(/dev/console, ae)) == NULL) {
free(output);
return (MM_NOCON);
}

Modified: head/lib/libc/gen/getcap.c
==
--- head/lib/libc/gen/getcap.c  Mon Dec 10 17:34:33 2012(r244091)
+++ head/lib/libc/gen/getcap.c  Mon Dec 10 17:56:51 2012(r244092)
@@ -654,7 +654,7 @@ cgetnext(char **bp, char **db_array)
if (dbp == NULL)
dbp = db_array;
 
-   if (pfp == NULL  (pfp = fopen(*dbp, r)) == NULL) {
+   if (pfp == NULL  (pfp = fopen(*dbp, re)) == NULL) {
(void)cgetclose();
return (-1);
}
@@ -679,7 +679,7 @@ cgetnext(char **bp, char **db_array)
(void)cgetclose();
return (0);
} else if ((pfp =
-   fopen(*dbp, r)) == NULL) {
+   fopen(*dbp, re)) == NULL) {
(void)cgetclose();
return (-1);
} else

Modified: head/lib/libc/gen/getgrent.c
==
--- head/lib/libc/gen/getgrent.cMon Dec 10 17:34:33 2012
(r244091)
+++ head/lib/libc/gen/getgrent.cMon Dec 10 17:56:51 2012
(r244092)
@@ -810,7 +810,7 @@ files_setgrent(void *retval, void *mdata
if (st-fp != NULL)
rewind(st-fp);
else if (stayopen)
-   st-fp = fopen(_PATH_GROUP, r);
+   st-fp = fopen(_PATH_GROUP, re);
break;
case ENDGRENT:
if (st-fp != NULL) {
@@ -861,7 +861,7 @@ files_group(void *retval, void *mdata, v
if (*errnop != 0)
return (NS_UNAVAIL);
if (st-fp == NULL 
-   ((st-fp = fopen(_PATH_GROUP, r)) == NULL)) {
+   ((st-fp = fopen(_PATH_GROUP, re)) == NULL)) {
*errnop = errno;
return (NS_UNAVAIL);
}
@@ -1251,7 +1251,7 @@ compat_setgrent(void *retval, void *mdat
if (st-fp != NULL)
rewind(st-fp);
else if (stayopen)
-   st-fp = fopen(_PATH_GROUP, r);
+   st-fp = fopen(_PATH_GROUP, re);
set_setent(dtab, mdata);
(void)_nsdispatch(NULL, dtab, NSDB_GROUP_COMPAT, setgrent,
compatsrc, 0);
@@ -1335,7 +1335,7 @@ compat_group(void *retval, void *mdata, 
if (*errnop != 0)
return (NS_UNAVAIL);
if (st-fp == NULL 
-   ((st-fp = fopen(_PATH_GROUP, r)) == NULL)) {
+   ((st-fp = fopen(_PATH_GROUP, re)) == NULL)) {
*errnop = errno;
rv = NS_UNAVAIL;
goto fin;

Modified: head/lib/libc/gen/getnetgrent.c
==
--- head/lib/libc/gen/getnetgrent.c Mon Dec 10 17:34:33 2012
(r244091)
+++ head/lib/libc/gen/getnetgrent.c Mon Dec 10 17:56:51 2012
(r244092)
@@ -173,7 +173,7 @@ setnetgrent(const char *group)
if (((stat(_PATH_NETGROUP, _yp_statp)  0) 
errno == ENOENT) || _yp_statp.st_size == 0)
_use_only_yp = _netgr_yp_enabled = 1;
-   if ((netf = fopen(_PATH_NETGROUP,r)) != NULL ||_use_only_yp){
+   if ((netf = fopen(_PATH_NETGROUP,re)) != NULL ||_use_only_yp){
/*
 * Icky: grab the first character of the netgroup file
 * and turn on NIS if it's a '+'. rewind the stream
@@ -197,7 +197,7 @@ setnetgrent(const char *group)
return;

svn commit: r244095 - head/sys/kern

2012-12-10 Thread Konstantin Belousov
Author: kib
Date: Mon Dec 10 20:44:09 2012
New Revision: 244095
URL: http://svnweb.freebsd.org/changeset/base/244095

Log:
  Do not yield while owning a mutex.  The Giant reacquire in the
  kern_yield() is problematic than.
  
  The owned mutex is the mount interlock, and it is in fact not needed
  to guarantee the stability of the mount list of active vnodes, so fix
  the the issue by only taking the mount interlock for MNT_REF and
  MNT_REL operations.
  
  While there, augment the unconditional yield by some amount of
  spinning [1].
  
  Reported and tested by:   pho
  Reviewed by:  attilio
  Submitted by: attilio [1]
  MFC after:3 days

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon Dec 10 20:10:20 2012(r244094)
+++ head/sys/kern/vfs_subr.cMon Dec 10 20:44:09 2012(r244095)
@@ -4717,9 +4717,8 @@ __mnt_vnode_next_active(struct vnode **m
 
if (should_yield())
kern_yield(PRI_UNCHANGED);
-   MNT_ILOCK(mp);
-restart:
mtx_lock(vnode_free_list_mtx);
+restart:
KASSERT((*mvp)-v_mount == mp, (marker vnode mount list mismatch));
vp = TAILQ_NEXT(*mvp, v_actfreelist);
while (vp != NULL) {
@@ -4728,8 +4727,11 @@ restart:
continue;
}
if (!VI_TRYLOCK(vp)) {
-   mtx_unlock(vnode_free_list_mtx);
-   kern_yield(PRI_UNCHANGED);
+   if (should_yield()) {
+   mtx_unlock(vnode_free_list_mtx);
+   kern_yield(PRI_UNCHANGED);
+   mtx_lock(vnode_free_list_mtx);
+   }
goto restart;
}
if (vp-v_mount == mp  vp-v_type != VMARKER 
@@ -4744,14 +4746,12 @@ restart:
if (vp == NULL) {
mtx_unlock(vnode_free_list_mtx);
__mnt_vnode_markerfree_active(mvp, mp);
-   /* MNT_IUNLOCK(mp); -- done in above function */
mtx_assert(MNT_MTX(mp), MA_NOTOWNED);
return (NULL);
}
TAILQ_REMOVE(mp-mnt_activevnodelist, *mvp, v_actfreelist);
TAILQ_INSERT_AFTER(mp-mnt_activevnodelist, vp, *mvp, v_actfreelist);
mtx_unlock(vnode_free_list_mtx);
-   MNT_IUNLOCK(mp);
ASSERT_VI_LOCKED(vp, active iter);
KASSERT((vp-v_iflag  VI_ACTIVE) != 0, (Non-active vp %p, vp));
return (vp);
@@ -4765,10 +4765,12 @@ __mnt_vnode_first_active(struct vnode **
*mvp = malloc(sizeof(struct vnode), M_VNODE_MARKER, M_WAITOK | M_ZERO);
MNT_ILOCK(mp);
MNT_REF(mp);
+   MNT_IUNLOCK(mp);
(*mvp)-v_type = VMARKER;
+   (*mvp)-v_mount = mp;
 
-restart:
mtx_lock(vnode_free_list_mtx);
+restart:
vp = TAILQ_FIRST(mp-mnt_activevnodelist);
while (vp != NULL) {
if (vp-v_type == VMARKER) {
@@ -4776,8 +4778,11 @@ restart:
continue;
}
if (!VI_TRYLOCK(vp)) {
-   mtx_unlock(vnode_free_list_mtx);
-   kern_yield(PRI_UNCHANGED);
+   if (should_yield()) {
+   mtx_unlock(vnode_free_list_mtx);
+   kern_yield(PRI_UNCHANGED);
+   mtx_lock(vnode_free_list_mtx);
+   }
goto restart;
}
if (vp-v_mount == mp  vp-v_type != VMARKER 
@@ -4791,16 +4796,15 @@ restart:
/* Check if we are done */
if (vp == NULL) {
mtx_unlock(vnode_free_list_mtx);
+   MNT_ILOCK(mp);
MNT_REL(mp);
MNT_IUNLOCK(mp);
free(*mvp, M_VNODE_MARKER);
*mvp = NULL;
return (NULL);
}
-   (*mvp)-v_mount = mp;
TAILQ_INSERT_AFTER(mp-mnt_activevnodelist, vp, *mvp, v_actfreelist);
mtx_unlock(vnode_free_list_mtx);
-   MNT_IUNLOCK(mp);
ASSERT_VI_LOCKED(vp, active iter first);
KASSERT((vp-v_iflag  VI_ACTIVE) != 0, (Non-active vp %p, vp));
return (vp);
@@ -4810,17 +4814,15 @@ void
 __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *mp)
 {
 
-   if (*mvp == NULL) {
-   MNT_IUNLOCK(mp);
+   if (*mvp == NULL)
return;
-   }
-
-   mtx_assert(MNT_MTX(mp), MA_OWNED);
 
KASSERT((*mvp)-v_mount == mp, (marker vnode mount list mismatch));
+
mtx_lock(vnode_free_list_mtx);
TAILQ_REMOVE(mp-mnt_activevnodelist, *mvp, v_actfreelist);
mtx_unlock(vnode_free_list_mtx);
+   MNT_ILOCK(mp);
MNT_REL(mp);
MNT_IUNLOCK(mp);
free(*mvp, M_VNODE_MARKER);
___

svn commit: r244096 - head/etc

2012-12-10 Thread Xin LI
Author: delphij
Date: Mon Dec 10 20:52:52 2012
New Revision: 244096
URL: http://svnweb.freebsd.org/changeset/base/244096

Log:
  Sync pf.os with OpenBSD:
  
  add a handful of linux signatures from p0fv2 and some other
  signatures from observation.
  
  MFC after:2 weeks

Modified:
  head/etc/pf.os

Modified: head/etc/pf.os
==
--- head/etc/pf.os  Mon Dec 10 20:44:09 2012(r244095)
+++ head/etc/pf.os  Mon Dec 10 20:52:52 2012(r244096)
@@ -1,5 +1,5 @@
 # $FreeBSD$
-# $OpenBSD: pf.os,v 1.25 2010/10/18 15:55:27 deraadt Exp $
+# $OpenBSD: pf.os,v 1.26 2012/08/03 12:25:16 jsg Exp $
 # passive OS fingerprinting
 # -
 #
@@ -226,7 +226,13 @@ S2:64:1:60:M*,S,T,N,W0:Linux:2.4::Linu
 S3:64:1:60:M*,S,T,N,W0:Linux:2.4:.18-21:Linux 2.4.18 and newer
 S4:64:1:60:M*,S,T,N,W0:Linux:2.4::Linux 2.4/2.6 = 2.6.7
 S4:64:1:60:M*,S,T,N,W0:Linux:2.6:.1-7:Linux 2.4/2.6 = 2.6.7
-S4:64:1:60:M*,S,T,N,W7:Linux:2.6:8:Linux 2.6.8 and newer (?)
+
+S4:64:1:60:M*,S,T,N,W5:Linux:2.6::Linux 2.6 (newer, 1)
+S4:64:1:60:M*,S,T,N,W6:Linux:2.6::Linux 2.6 (newer, 2)
+S4:64:1:60:M*,S,T,N,W7:Linux:2.6::Linux 2.6 (newer, 3)
+T4:64:1:60:M*,S,T,N,W7:Linux:2.6::Linux 2.6 (newer, 4)
+
+S10:64:1:60:M*,S,T,N,W4:   Linux:3.0::Linux 3.0
 
 S3:64:1:60:M*,S,T,N,W1:Linux:2.5::Linux 2.5 (sometimes 2.4)
 S4:64:1:60:M*,S,T,N,W1:Linux:2.5-2.6::Linux 2.5/2.6
@@ -429,6 +435,8 @@ S44:128:1:48:M*,N,N,S:  Windows:XP:SP1:
 32767:128:1:48:M*,N,N,S:   Windows:2000:SP4:Windows SP1, 2000 SP4
 32767:128:1:48:M*,N,N,S:   Windows:XP:SP1:Windows SP1, 2000 SP4
 
+8192:128:1:52:M*,N,W2,N,N,S:   Windows:Vista::Windows Vista/7
+
 # Odds, ends, mods:
 
 S52:128:1:48:M1260,N,N,S:  Windows:2000:cisco:Windows XP/2000 via 
Cisco
___
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: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread John Baldwin
On Friday, December 07, 2012 7:00:44 pm Carl Delsey wrote:
 On 12/07/12 10:08, John Baldwin wrote:
  On Thursday, December 06, 2012 5:33:32 pm Jim Harris wrote:
  Author: jimharris
  Date: Thu Dec  6 22:33:31 2012
  New Revision: 243960
  URL: http://svnweb.freebsd.org/changeset/base/243960
 
  Log:
 Add amd64 implementations for 8-byte bus_space routines.
 
 Submitted by:   Carl Delsey carl.r.del...@intel.com
 Discussed with: jhb, rwatson
 Reviewed by:jimharris
 MFC after:  1 week
 
  Modified:
 head/sys/amd64/include/bus.h
 head/sys/i386/include/bus.h
 head/sys/x86/include/bus.h
  Do we still want the link errors on i386?  Do you get a compile error now?
 
 You get a compile error now, since the function prototypes don't exist 
 for i386. That was the case in the old code too. The comments about 
 forcing a link error were incorrect or obsolete.

Ok, sounds good to me, thanks!

-- 
John Baldwin
___
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: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
  make sysctls kern.{bootfile,conftxt} read-only
  
  MFC after:1 month

Modified:
  head/sys/kern/kern_mib.c

Modified: head/sys/kern/kern_mib.c
==
--- head/sys/kern/kern_mib.cMon Dec 10 21:18:02 2012(r244097)
+++ head/sys/kern/kern_mib.cMon Dec 10 23:09:55 2012(r244098)
@@ -141,7 +141,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_
 
 char kernelname[MAXPATHLEN] = /kernel;   /* XXX bloat */
 
-SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
+SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RD,
 kernelname, sizeof kernelname, Name of kernel file booted);
 
 SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD|CTLFLAG_CAPRD,
@@ -377,15 +377,8 @@ SYSCTL_PROC(_kern, KERN_SECURELVL, secur
 /* Actual kernel configuration options. */
 extern char kernconfstring[];
 
-static int
-sysctl_kern_config(SYSCTL_HANDLER_ARGS)
-{
-   return (sysctl_handle_string(oidp, kernconfstring,
-   strlen(kernconfstring), req));
-}
-
-SYSCTL_PROC(_kern, OID_AUTO, conftxt, CTLTYPE_STRING|CTLFLAG_RW, 
-0, 0, sysctl_kern_config, , Kernel configuration file);
+SYSCTL_STRING(_kern, OID_AUTO, conftxt, CTLFLAG_RD, kernconfstring, 0,
+Kernel configuration file);
 #endif
 
 static 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


svn commit: r244099 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:11:26 2012
New Revision: 244099
URL: http://svnweb.freebsd.org/changeset/base/244099

Log:
  allow KASSERT to enter KDB.

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Mon Dec 10 23:09:55 2012
(r244098)
+++ head/sys/kern/kern_shutdown.c   Mon Dec 10 23:11:26 2012
(r244099)
@@ -542,6 +542,9 @@ shutdown_reset(void *junk, int howto)
 
 #ifdef INVARIANTS
 static int kassert_warn_only = 0;
+#ifdef KDB
+static int kassert_do_kdb = 0;
+#endif
 #ifdef KTR
 static int kassert_do_ktr = 0;
 #endif
@@ -558,6 +561,12 @@ SYSCTL_INT(_debug_kassert, OID_AUTO, war
 KASSERT triggers a panic (1) or just a warning (0));
 TUNABLE_INT(debug.kassert.warn_only, kassert_warn_only);
 
+#ifdef KDB
+SYSCTL_INT(_debug_kassert, OID_AUTO, do_kdb, CTLFLAG_RW | CTLFLAG_TUN,
+kassert_do_kdb, 0, KASSERT will enter the debugger);
+TUNABLE_INT(debug.kassert.do_kdb, kassert_do_kdb);
+#endif
+
 #ifdef KTR
 SYSCTL_UINT(_debug_kassert, OID_AUTO, do_ktr, CTLFLAG_RW | CTLFLAG_TUN,
 kassert_do_ktr, 0,
@@ -650,6 +659,11 @@ kassert_panic(const char *fmt, ...)
kdb_backtrace();
}
}
+#ifdef KDB
+   if (kassert_do_kdb) {
+   kdb_enter(KDB_WHY_KASSERT, buf);
+   }
+#endif
atomic_add_int(kassert_warnings, 1);
 }
 #endif
___
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: r244100 - head/sys/sys

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:12:51 2012
New Revision: 244100
URL: http://svnweb.freebsd.org/changeset/base/244100

Log:
  Add constant missed in r244099
  
  KDB entered due to KASSERT.

Modified:
  head/sys/sys/kdb.h

Modified: head/sys/sys/kdb.h
==
--- head/sys/sys/kdb.h  Mon Dec 10 23:11:26 2012(r244099)
+++ head/sys/sys/kdb.h  Mon Dec 10 23:12:51 2012(r244100)
@@ -97,6 +97,7 @@ int   kdb_trap(int, int, struct trapframe 
 extern const char * volatile kdb_why;
 #defineKDB_WHY_UNSET   NULL/* No reason set. */
 #defineKDB_WHY_PANIC   panic /* panic() was called. 
*/
+#defineKDB_WHY_KASSERT kassert   /* kassert failed. */
 #defineKDB_WHY_SYSCTL  sysctl/* Sysctl entered 
debugger. */
 #defineKDB_WHY_BOOTFLAGS   bootflags /* Boot flags were set. 
*/
 #defineKDB_WHY_WITNESS witness   /* Witness entered 
debugger. */
___
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: r244098 - head/sys/kern

2012-12-10 Thread Konstantin Belousov
On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:
 Author: alfred
 Date: Mon Dec 10 23:09:55 2012
 New Revision: 244098
 URL: http://svnweb.freebsd.org/changeset/base/244098
 
 Log:
   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.


pgpvXRIKCyHlg.pgp
Description: PGP signature


svn commit: r244101 - head/sys/sys

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:17:08 2012
New Revision: 244101
URL: http://svnweb.freebsd.org/changeset/base/244101

Log:
  Add CTLFLAG_STATS to sysctl flags
  
  In preparation for sysctl(8) growing the ability to only print
  out boot/run-time tunables we need a way to differentiate between
  RW sysctl nodes that tune a particular thing, or simply export
  a stat that we want to allow the sysadmin to reset to 0 (or some
  other value).
  
  To do so, we add the CTLFLAG_STATS which should be OR'd into the
  CTLFLAGs when exporting a writable/resettable statistic node via
  sysctl.

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Mon Dec 10 23:12:51 2012(r244100)
+++ head/sys/sys/sysctl.h   Mon Dec 10 23:17:08 2012(r244101)
@@ -90,6 +90,7 @@ struct ctlname {
 #defineCTLFLAG_DYING   0x0001  /* oid is being removed */
 #define CTLFLAG_CAPRD  0x8000  /* Can be read in capability mode */
 #define CTLFLAG_CAPWR  0x4000  /* Can be written in capability mode */
+#define CTLFLAG_STATS  0x2000  /* Statistics, not a tuneable */
 #define CTLFLAG_CAPRW  (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
 
 /*
___
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: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Niclas Zeising
On 12/06/12 23:33, Jim Harris wrote:
 Author: jimharris
 Date: Thu Dec  6 22:33:31 2012
 New Revision: 243960
 URL: http://svnweb.freebsd.org/changeset/base/243960
 
 Log:
   Add amd64 implementations for 8-byte bus_space routines.
   

 +#include sys/systm.h
  #include x86/bus.h
 +
 +#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
 + KASSERT((tag) == X86_BUS_SPACE_MEM, \
 + (%s: can only handle mem space, __func__))
 +
 +static __inline uint64_t
 +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
 +bus_size_t ofs)
 +{
 +
 + KASSERT_BUS_SPACE_MEM_ONLY(tag);
 +
 + return (*(volatile uint64_t *)(bsh + ofs));
 +}

Hi!
Can the include of sys/systm.h and the added KASSERTs please be hidden
under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
experimental xorg-dev tree
(http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
uses machine/bus.h on amd64 and i386 to be able to read/write to the pci
bus, and this change breaks the compile of devel/libpciaccess.
It is probably so that libpciaccess is wrong in using machine/bus.h
but I have no idea how to fix it.  If you have a better suggestion on
how to fix libpciaccess I am all ears.
Regards!
-- 
Niclas Zeising
___
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: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein

On 12/10/12 3:14 PM, Konstantin Belousov wrote:

On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:

Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.
My apologies, give me a few moments to double check this and I will back 
out.



-Alfred
___
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: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Niclas Zeising
On 12/11/12 00:32, Carl Delsey wrote:
 On 12/10/12 16:20, Niclas Zeising wrote:
 On 12/06/12 23:33, Jim Harris wrote:
 Author: jimharris
 Date: Thu Dec  6 22:33:31 2012
 New Revision: 243960
 URL: http://svnweb.freebsd.org/changeset/base/243960

 Log:
Add amd64 implementations for 8-byte bus_space routines.
+#include sys/systm.h
   #include x86/bus.h
 +
 +#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
 +KASSERT((tag) == X86_BUS_SPACE_MEM, \
 +(%s: can only handle mem space, __func__))
 +
 +static __inline uint64_t
 +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
 +bus_size_t ofs)
 +{
 +
 +KASSERT_BUS_SPACE_MEM_ONLY(tag);
 +
 +return (*(volatile uint64_t *)(bsh + ofs));
 +}
 Hi!
 Can the include of sys/systm.h and the added KASSERTs please be hidden
 under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
 experimental xorg-dev tree
 (http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
 uses machine/bus.h on amd64 and i386 to be able to read/write to the pci
 bus, and this change breaks the compile of devel/libpciaccess.
 It is probably so that libpciaccess is wrong in using machine/bus.h
 but I have no idea how to fix it.  If you have a better suggestion on
 how to fix libpciaccess I am all ears.
 Regards!
 Does libpciaccess make use of the bus_space_read/write_* routines in
 these files, or does it just use some constants and types from them?
 

libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
x86/bus.h.  It does not use the quad functions.
Regards!
-- 
Niclas Zeising
___
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: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein

On 12/10/12 3:38 PM, Alfred Perlstein wrote:

On 12/10/12 3:14 PM, Konstantin Belousov wrote:

On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:

Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.
My apologies, give me a few moments to double check this and I will 
back out.


So first off installkernel was not broken, the error is ignored by 
make, hence why I didn't see it.


Second off, this is pretty broken, the first time you installkernel it 
gets it right, the second time it just seems to set kern.bootfile to 
/boot/kernel.old/kernel no even though that's not really the boot kernel.


I will back out the change, but this just seems off.

If we are going to change kern.bootfile, then we ought to detect when 
it's no longer valid at all and just zero it.  or pretty much do 
something else.


-Alfred
___
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: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Carl Delsey

On 12/10/12 16:40, Niclas Zeising wrote:

On 12/11/12 00:32, Carl Delsey wrote:

On 12/10/12 16:20, Niclas Zeising wrote:

On 12/06/12 23:33, Jim Harris wrote:

Author: jimharris
Date: Thu Dec  6 22:33:31 2012
New Revision: 243960
URL: http://svnweb.freebsd.org/changeset/base/243960

Log:
Add amd64 implementations for 8-byte bus_space routines.
+#include sys/systm.h
   #include x86/bus.h
+
+#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
+KASSERT((tag) == X86_BUS_SPACE_MEM, \
+(%s: can only handle mem space, __func__))
+
+static __inline uint64_t
+bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
+bus_size_t ofs)
+{
+
+KASSERT_BUS_SPACE_MEM_ONLY(tag);
+
+return (*(volatile uint64_t *)(bsh + ofs));
+}

Hi!
Can the include of sys/systm.h and the added KASSERTs please be hidden
under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
experimental xorg-dev tree
(http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
uses machine/bus.h on amd64 and i386 to be able to read/write to the pci
bus, and this change breaks the compile of devel/libpciaccess.
It is probably so that libpciaccess is wrong in using machine/bus.h
but I have no idea how to fix it.  If you have a better suggestion on
how to fix libpciaccess I am all ears.
Regards!

Does libpciaccess make use of the bus_space_read/write_* routines in
these files, or does it just use some constants and types from them?


libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
x86/bus.h.  It does not use the quad functions.
Regards!
Ok. In that case I won't ifdef out the functions themselves, just the 
KASSERT in case libpciaccess expands in the future to 8 byte accesses 
:-)  I had another related change in the works. I'll add this change in.


Thanks,
Carl


___
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: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein

On 12/10/12 3:51 PM, Alfred Perlstein wrote:

On 12/10/12 3:38 PM, Alfred Perlstein wrote:

On 12/10/12 3:14 PM, Konstantin Belousov wrote:

On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:

Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.
My apologies, give me a few moments to double check this and I will 
back out.


So first off installkernel was not broken, the error is ignored by 
make, hence why I didn't see it.


Second off, this is pretty broken, the first time you installkernel 
it gets it right, the second time it just seems to set kern.bootfile 
to /boot/kernel.old/kernel no even though that's not really the boot 
kernel.


I will back out the change, but this just seems off.

If we are going to change kern.bootfile, then we ought to detect when 
it's no longer valid at all and just zero it.  or pretty much do 
something else.


-Alfred

and.. derp.  Florian explained how this works, how it doesn't rename 
kern.bootfile after the first rename of the kernel.


I'll be backing out the change now and adding some comments to the code 
shortly.

___
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: r244103 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 00:10:20 2012
New Revision: 244103
URL: http://svnweb.freebsd.org/changeset/base/244103

Log:
  back out half of 244098.
  
  kern.bootfile needs to be rw for installkernel.
  
  Pointed out by: kib, flo

Modified:
  head/sys/kern/kern_mib.c

Modified: head/sys/kern/kern_mib.c
==
--- head/sys/kern/kern_mib.cTue Dec 11 00:07:19 2012(r244102)
+++ head/sys/kern/kern_mib.cTue Dec 11 00:10:20 2012(r244103)
@@ -141,7 +141,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_
 
 char kernelname[MAXPATHLEN] = /kernel;   /* XXX bloat */
 
-SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RD,
+SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
 kernelname, sizeof kernelname, Name of kernel file booted);
 
 SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD|CTLFLAG_CAPRD,
___
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: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Niclas Zeising
On 12/11/12 00:54, Carl Delsey wrote:
 On 12/10/12 16:40, Niclas Zeising wrote:
 On 12/11/12 00:32, Carl Delsey wrote:
 On 12/10/12 16:20, Niclas Zeising wrote:
 On 12/06/12 23:33, Jim Harris wrote:
 Author: jimharris
 Date: Thu Dec  6 22:33:31 2012
 New Revision: 243960
 URL: http://svnweb.freebsd.org/changeset/base/243960

 Log:
 Add amd64 implementations for 8-byte bus_space routines.
 +#include sys/systm.h
#include x86/bus.h
 +
 +#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
 +KASSERT((tag) == X86_BUS_SPACE_MEM, \
 +(%s: can only handle mem space, __func__))
 +
 +static __inline uint64_t
 +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
 +bus_size_t ofs)
 +{
 +
 +KASSERT_BUS_SPACE_MEM_ONLY(tag);
 +
 +return (*(volatile uint64_t *)(bsh + ofs));
 +}
 Hi!
 Can the include of sys/systm.h and the added KASSERTs please be
 hidden
 under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
 experimental xorg-dev tree
 (http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
 uses machine/bus.h on amd64 and i386 to be able to read/write to the
 pci
 bus, and this change breaks the compile of devel/libpciaccess.
 It is probably so that libpciaccess is wrong in using machine/bus.h
 but I have no idea how to fix it.  If you have a better suggestion on
 how to fix libpciaccess I am all ears.
 Regards!
 Does libpciaccess make use of the bus_space_read/write_* routines in
 these files, or does it just use some constants and types from them?

 libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
 x86/bus.h.  It does not use the quad functions.
 Regards!
 Ok. In that case I won't ifdef out the functions themselves, just the
 KASSERT in case libpciaccess expands in the future to 8 byte accesses
 :-)  I had another related change in the works. I'll add this change in.

Sounds good to me, thank you very much!
Don't forget to ifdef the include o sys/systm.h as well as the KASSERTs.
Regards!
-- 
Niclas Zeising
___
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: r244104 - head/sbin/sysctl

2012-12-10 Thread Xin LI
Author: delphij
Date: Tue Dec 11 01:12:29 2012
New Revision: 244104
URL: http://svnweb.freebsd.org/changeset/base/244104

Log:
  In parse():
  
   - Only operate on copy, don't operate on source.
   - Eliminate home-rolled strsep().
   - Constify the parameter.
  
  MFC after:2 weeks

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Tue Dec 11 00:10:20 2012(r244103)
+++ head/sbin/sysctl/sysctl.c   Tue Dec 11 01:12:29 2012(r244104)
@@ -62,7 +62,7 @@ static intaflag, bflag, dflag, eflag, h
 static int Nflag, nflag, oflag, qflag, xflag, warncount;
 
 static int oidfmt(int *, int, char *, u_int *);
-static voidparse(char *);
+static voidparse(const char *);
 static int show_var(int *, int);
 static int sysctl_all(int *oid, int len);
 static int name2oid(char *, int *);
@@ -161,7 +161,7 @@ main(int argc, char **argv)
  * Set a new value if requested.
  */
 static void
-parse(char *string)
+parse(const char *string)
 {
int len, i, j;
void *newval = 0;
@@ -176,12 +176,11 @@ parse(char *string)
char *cp, *bufp, buf[BUFSIZ], *endptr, fmt[BUFSIZ];
u_int kind;
 
-   bufp = buf;
+   cp = buf;
if (snprintf(buf, BUFSIZ, %s, string) = BUFSIZ)
errx(1, oid too long: '%s', string);
-   if ((cp = strchr(string, '=')) != NULL) {
-   *strchr(buf, '=') = '\0';
-   *cp++ = '\0';
+   bufp = strsep(cp, =);
+   if (cp != NULL) {
while (isspace(*cp))
cp++;
newval = cp;
___
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: r244105 - in head/sys: kern sys

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 01:23:50 2012
New Revision: 244105
URL: http://svnweb.freebsd.org/changeset/base/244105

Log:
  Switch the hardwired WITNESS panics to kassert_panic.
  
  This is an ongoing effort to provide runtime debug information
  useful in the field that does not panic existing installations.
  
  This gives us the flexibility needed when shipping images to a
  potentially large audience with WITNESS enabled without worrying
  about formerly non-fatal LORs hurting a release.
  
  Sponsored by: iXsystems

Modified:
  head/sys/kern/kern_shutdown.c
  head/sys/kern/subr_witness.c
  head/sys/sys/systm.h

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Tue Dec 11 01:12:29 2012
(r244104)
+++ head/sys/kern/kern_shutdown.c   Tue Dec 11 01:23:50 2012
(r244105)
@@ -540,7 +540,7 @@ shutdown_reset(void *junk, int howto)
/* NOTREACHED */ /* assuming reset worked */
 }
 
-#ifdef INVARIANTS
+#if defined(WITNESS) || defined(INVARIANTS)
 static int kassert_warn_only = 0;
 #ifdef KDB
 static int kassert_do_kdb = 0;

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Dec 11 01:12:29 2012
(r244104)
+++ head/sys/kern/subr_witness.cTue Dec 11 01:23:50 2012
(r244105)
@@ -822,16 +822,16 @@ witness_init(struct lock_object *lock, c
class = LOCK_CLASS(lock);
if ((lock-lo_flags  LO_RECURSABLE) != 0 
(class-lc_flags  LC_RECURSABLE) == 0)
-   panic(%s: lock (%s) %s can not be recursable, __func__,
-   class-lc_name, lock-lo_name);
+   kassert_panic(%s: lock (%s) %s can not be recursable,
+   __func__, class-lc_name, lock-lo_name);
if ((lock-lo_flags  LO_SLEEPABLE) != 0 
(class-lc_flags  LC_SLEEPABLE) == 0)
-   panic(%s: lock (%s) %s can not be sleepable, __func__,
-   class-lc_name, lock-lo_name);
+   kassert_panic(%s: lock (%s) %s can not be sleepable,
+   __func__, class-lc_name, lock-lo_name);
if ((lock-lo_flags  LO_UPGRADABLE) != 0 
(class-lc_flags  LC_UPGRADABLE) == 0)
-   panic(%s: lock (%s) %s can not be upgradable, __func__,
-   class-lc_name, lock-lo_name);
+   kassert_panic(%s: lock (%s) %s can not be upgradable,
+   __func__, class-lc_name, lock-lo_name);
 
/*
 * If we shouldn't watch this lock, then just clear lo_witness.
@@ -847,7 +847,8 @@ witness_init(struct lock_object *lock, c
pending_locks[pending_cnt].wh_lock = lock;
pending_locks[pending_cnt++].wh_type = type;
if (pending_cnt  WITNESS_PENDLIST)
-   panic(%s: pending locks list is too small, bump it\n,
+   panic(%s: pending locks list is too small, 
+   increase WITNESS_PENDLIST\n,
__func__);
} else
lock-lo_witness = enroll(type, class);
@@ -1073,7 +1074,8 @@ witness_checkorder(struct lock_object *l
 * all spin locks.
 */
if (td-td_critnest != 0  !kdb_active)
-   panic(blockable sleep lock (%s) %s @ %s:%d,
+   kassert_panic(acquiring blockable sleep lock with 
+   spinlock or critical section held (%s) %s @ %s:%d,
class-lc_name, lock-lo_name,
fixup_filename(file), line);
 
@@ -1117,7 +1119,7 @@ witness_checkorder(struct lock_object *l
fixup_filename(file), line);
printf(while exclusively locked from %s:%d\n,
fixup_filename(lock1-li_file), lock1-li_line);
-   panic(share-excl);
+   kassert_panic(share-excl);
}
if ((lock1-li_flags  LI_EXCLUSIVE) == 0 
(flags  LOP_EXCLUSIVE) != 0) {
@@ -1126,7 +1128,7 @@ witness_checkorder(struct lock_object *l
fixup_filename(file), line);
printf(while share locked from %s:%d\n,
fixup_filename(lock1-li_file), lock1-li_line);
-   panic(excl-share);
+   kassert_panic(excl-share);
}
return;
}
@@ -1433,26 +1435,30 @@ witness_upgrade(struct lock_object *lock
class = LOCK_CLASS(lock);
if (witness_watch) {
if ((lock-lo_flags  LO_UPGRADABLE) == 0)
-   panic(upgrade of non-upgradable lock (%s) %s @ %s:%d,
+   kassert_panic(
+   upgrade of non-upgradable lock (%s) 

svn commit: r244106 - head/sbin/sysctl

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 01:28:06 2012
New Revision: 244106
URL: http://svnweb.freebsd.org/changeset/base/244106

Log:
  Allow sysctl to filter boot and runtime tunables.
  
  Add the following flags to sysctl:
   -W  - show only writable sysctls
   -T  - show only tuneable sysctls
  
  This can be used to create a /var/run/sysctl.boot to
  compare set tunables versus booted tunables.
  
  Sponsored by: iXsystems

Modified:
  head/sbin/sysctl/sysctl.8
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.8
==
--- head/sbin/sysctl/sysctl.8   Tue Dec 11 01:23:50 2012(r244105)
+++ head/sbin/sysctl/sysctl.8   Tue Dec 11 01:28:06 2012(r244106)
@@ -36,11 +36,11 @@
 .Nd get or set kernel state
 .Sh SYNOPSIS
 .Nm
-.Op Fl bdehiNnoqx
+.Op Fl bdehiNnoRTqx
 .Ar name Ns Op = Ns Ar value
 .Ar ...
 .Nm
-.Op Fl bdehNnoqx
+.Op Fl bdehNnoRTqx
 .Fl a
 .Sh DESCRIPTION
 The
@@ -121,6 +121,11 @@ sixteen bytes of the value.
 Suppress some warnings generated by
 .Nm
 to standard error.
+.It Fl T
+Display only variables that are setable via loader (CTLFLAG_TUN).
+.It Fl W
+Display only wriable variables that are not statistical.
+Useful for determining the set of runtime tunable sysctls.
 .It Fl X
 Equivalent to
 .Fl x a

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Tue Dec 11 01:23:50 2012(r244105)
+++ head/sbin/sysctl/sysctl.c   Tue Dec 11 01:28:06 2012(r244106)
@@ -59,7 +59,7 @@ static const char rcsid[] =
 #include unistd.h
 
 static int aflag, bflag, dflag, eflag, hflag, iflag;
-static int Nflag, nflag, oflag, qflag, xflag, warncount;
+static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag, warncount;
 
 static int oidfmt(int *, int, char *, u_int *);
 static voidparse(const char *);
@@ -74,8 +74,8 @@ usage(void)
 {
 
(void)fprintf(stderr, %s\n%s\n,
-   usage: sysctl [-bdehiNnoqx] name[=value] ...,
-  sysctl [-bdehNnoqx] -a);
+   usage: sysctl [-bdehiNnoqTWx] name[=value] ...,
+  sysctl [-bdehNnoqTWx] -a);
exit(1);
 }
 
@@ -88,7 +88,7 @@ main(int argc, char **argv)
setbuf(stdout,0);
setbuf(stderr,0);
 
-   while ((ch = getopt(argc, argv, AabdehiNnoqwxX)) != -1) {
+   while ((ch = getopt(argc, argv, AabdehiNnoqTwWxX)) != -1) {
switch (ch) {
case 'A':
/* compatibility */
@@ -124,10 +124,16 @@ main(int argc, char **argv)
case 'q':
qflag = 1;
break;
+   case 'T':
+   Tflag = 1;
+   break;
case 'w':
/* compatibility */
/* ignored */
break;
+   case 'W':
+   Wflag = 1;
+   break;
case 'X':
/* compatibility */
aflag = xflag = 1;
@@ -181,6 +187,11 @@ parse(const char *string)
errx(1, oid too long: '%s', string);
bufp = strsep(cp, =);
if (cp != NULL) {
+   /* Tflag just lists tunables, do not allow assignment */
+   if (Tflag || Wflag) {
+   warnx(Can't set variables when using -T or -W);
+   usage();
+   }
while (isspace(*cp))
cp++;
newval = cp;
@@ -602,6 +613,14 @@ show_var(int *oid, int nlen)
sign = ctl_sign[ctltype];
intlen = ctl_size[ctltype];
 
+   /* if Wflag then only list sysctls that are writeable and not stats. */
+   if (Wflag  ((kind  CTLFLAG_WR) == 0 || (kind  CTLFLAG_STATS) != 0))
+   return 1;
+
+   /* if Tflag then only list sysctls that are tuneables. */
+   if (Tflag  (kind  CTLFLAG_TUN) == 0)
+   return 1;
+
switch (ctltype) {
case CTLTYPE_STRING:
if (!nflag)
___
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: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Bruce Evans

On Tue, 11 Dec 2012, Niclas Zeising wrote:


On 12/11/12 00:54, Carl Delsey wrote:

On 12/10/12 16:40, Niclas Zeising wrote:

...
libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
x86/bus.h.  It does not use the quad functions.
Regards!

Ok. In that case I won't ifdef out the functions themselves, just the
KASSERT in case libpciaccess expands in the future to 8 byte accesses
:-)  I had another related change in the works. I'll add this change in.


Sounds good to me, thank you very much!
Don't forget to ifdef the include o sys/systm.h as well as the KASSERTs.


Including it at all is namespace pollution.

It is a bug for any kernel .c file to not include sys/systm.h always
and early in its includes, because other includes may have KASSERT()s
in them.  Not all includes that uses KASSERT() have the namespace
pollution, so adding it to some just breaks detection of the bug in
some cases.

The folowing headers in sys have the pollution: libkern.h, mbuf.h,
pmckern.h, refcount.h.  refcount.h only has the pollution if _KERNEL is
defined.  It handles the problem of polluting userland (though I think
userland should be rewarded by syntax errors if it uses refcount.h or
machine/bus.h) by supplying a dummy KASSERT() for the !_KERNEL case.

The following headers in sys use KASSERT(): buf.h, eventhandler.h,
lock.h, mbuf.h, mount.h, mutex.h, osd.h, proc.h, random.h, refcount.h.
Most of them are missing the pollution.

The pollution in libkern.h is circular: libkern.h includes systm.h, and
systm.h includes libkern.h.  systm.h's include of libkern.h and of many
other headers like machine/atomic.h and machine/cpufunc.h is standard
pollution -- direct includes of these are style bugs, and not including
systm.h always and early is a bug because it may break more than KASSERT()
(other headers may also use inlines in libkern.h etc.).  The circular
pollution in libkern.h is used because most files in libkern don't include
systm.h directly; they mostly only include libkern.h directly.

This and other pollution in mbuf.h is especially disgusting since
mbuf.h is one of few headers that I managed to finish the #include
de-pollution of in FreeBSD-3 or 2.

Bruce
___
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: r244109 - head/sys/dev/ath

2012-12-10 Thread Adrian Chadd
Author: adrian
Date: Tue Dec 11 04:19:51 2012
New Revision: 244109
URL: http://svnweb.freebsd.org/changeset/base/244109

Log:
  There's no need to use a TXQ pointer here; we specifically need the
  hardware queue ID when queuing to EDMA descriptors.
  
  This is a small part of trying to reduce the size of ath_buf entries.

Modified:
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cTue Dec 11 02:40:01 2012
(r244108)
+++ head/sys/dev/ath/if_ath_tx.cTue Dec 11 04:19:51 2012
(r244109)
@@ -372,7 +372,6 @@ ath_tx_chaindesclist(struct ath_softc *s
uint32_t segLenList[4];
int numTxMaps = 1;
int isFirstDesc = 1;
-   int qnum;
 
/*
 * XXX There's txdma and txdma_mgmt; the descriptor
@@ -426,18 +425,16 @@ ath_tx_chaindesclist(struct ath_softc *s
bf-bf_daddr + dd-dd_descsize * (dsp + 1));
 
/*
-* XXX this assumes that bfs_txq is the actual destination
-* hardware queue at this point.  It may not have been assigned,
-* it may actually be pointing to the multicast software
-* TXQ id.  These must be fixed!
+* XXX This assumes that bfs_txq is the actual destination
+* hardware queue at this point.  It may not have been
+* assigned, it may actually be pointing to the multicast
+* software TXQ id.  These must be fixed!
 */
-   qnum = bf-bf_state.bfs_txq-axq_qnum;
-
ath_hal_filltxdesc(ah, (struct ath_desc *) ds
, bufAddrList
, segLenList
, bf-bf_descid /* XXX desc id */
-   , qnum
+   , bf-bf_state.bfs_tx_queue
, isFirstDesc   /* first segment */
, i == bf-bf_nseg - 1  /* last segment */
, (struct ath_desc *) ds0   /* first descriptor */
@@ -478,7 +475,8 @@ ath_tx_chaindesclist(struct ath_softc *s
isFirstDesc = 0;
 #ifdef ATH_DEBUG
if (sc-sc_debug  ATH_DEBUG_XMIT)
-   ath_printtxbuf(sc, bf, qnum, 0, 0);
+   ath_printtxbuf(sc, bf, bf-bf_state.bfs_tx_queue,
+   0, 0);
 #endif
bf-bf_lastds = (struct ath_desc *) ds;
 
@@ -697,11 +695,11 @@ ath_tx_setds_11n(struct ath_softc *sc, s
  * during the beacon setup code.
  *
  * XXX TODO: since the AR9300 EDMA TX queue support wants the QCU ID
- * as part of the TX descriptor, bf_state.bfs_txq must be updated
+ * as part of the TX descriptor, bf_state.bfs_tx_queue must be updated
  * with the actual hardware txq, or all of this will fall apart.
  *
  * XXX It may not be a bad idea to just stuff the QCU ID into bf_state
- * and retire bfs_txq; then make sure the CABQ QCU ID is populated
+ * and retire bfs_tx_queue; then make sure the CABQ QCU ID is populated
  * correctly.
  */
 static void
@@ -1840,7 +1838,7 @@ ath_tx_start(struct ath_softc *sc, struc
 
/* Set local packet state, used to queue packets to hardware */
bf-bf_state.bfs_tid = tid;
-   bf-bf_state.bfs_txq = txq;
+   bf-bf_state.bfs_tx_queue = txq-axq_qnum;
bf-bf_state.bfs_pri = pri;
 
/*
@@ -1858,7 +1856,7 @@ ath_tx_start(struct ath_softc *sc, struc
 * queue, so the descriptor setup functions will
 * correctly initialise the descriptor 'qcuId' field.
 */
-   bf-bf_state.bfs_txq = sc-sc_cabq;
+   bf-bf_state.bfs_tx_queue = sc-sc_cabq-axq_qnum;
}
 
/* Do the generic frame setup */
@@ -2114,7 +2112,7 @@ ath_tx_raw_start(struct ath_softc *sc, s
 
/* Set local packet state, used to queue packets to hardware */
bf-bf_state.bfs_tid = WME_AC_TO_TID(pri);
-   bf-bf_state.bfs_txq = sc-sc_ac2q[pri];
+   bf-bf_state.bfs_tx_queue = sc-sc_ac2q[pri]-axq_qnum;
bf-bf_state.bfs_pri = pri;
 
/* XXX this should be done in ath_tx_setrate() */
@@ -2713,16 +2711,8 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s
 struct ath_txq *txq, struct ath_buf *bf)
 {
struct ath_tid *tid = an-an_tid[bf-bf_state.bfs_tid];
-// struct ath_txq *txq = bf-bf_state.bfs_txq;
struct ieee80211_tx_ampdu *tap;
 
-   if (txq != bf-bf_state.bfs_txq) {
-   device_printf(sc-sc_dev, %s: txq %d != bfs_txq %d!\n,
-   __func__,
-   txq-axq_qnum,
-   bf-bf_state.bfs_txq-axq_qnum);
-   }
-
ATH_TX_LOCK_ASSERT(sc);
 
tap = ath_tx_get_tx_tid(an, tid-tid);
@@ -2821,9 +2811,8 @@ ath_tx_swq(struct ath_softc *sc, struct 
 
/* Set local packet state, used 

svn commit: r244111 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 05:59:16 2012
New Revision: 244111
URL: http://svnweb.freebsd.org/changeset/base/244111

Log:
  Fix WITNESS when INVARIANT_SUPPORT is defined.
  
  This fixes tinderbox breakage from r244105.
  
  Pointed out by: adrian

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Dec 11 05:11:28 2012
(r244110)
+++ head/sys/kern/subr_witness.cTue Dec 11 05:59:16 2012
(r244111)
@@ -2263,6 +2263,7 @@ witness_assert(const struct lock_object 
else {
kassert_panic(Lock (%s) %s is not sleep or spin!,
class-lc_name, lock-lo_name);
+   return;
}
switch (flags) {
case LA_UNLOCKED:
___
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: r244112 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 07:08:14 2012
New Revision: 244112
URL: http://svnweb.freebsd.org/changeset/base/244112

Log:
  Cleanup more of the kassert_panic.
  
  fix compile warnings on !amd64 and NULL derefs that would happen
  if kassert_panic() would return.

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Dec 11 05:59:16 2012
(r244111)
+++ head/sys/kern/subr_witness.cTue Dec 11 07:08:14 2012
(r244112)
@@ -1446,10 +1446,12 @@ witness_upgrade(struct lock_object *lock
fixup_filename(file), line);
}
instance = find_instance(curthread-td_sleeplocks, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic(upgrade of unlocked lock (%s) %s @ %s:%d,
class-lc_name, lock-lo_name,
fixup_filename(file), line);
+   return;
+   }
if (witness_watch) {
if ((instance-li_flags  LI_EXCLUSIVE) != 0)
kassert_panic(
@@ -1490,10 +1492,12 @@ witness_downgrade(struct lock_object *lo
fixup_filename(file), line);
}
instance = find_instance(curthread-td_sleeplocks, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic(downgrade of unlocked lock (%s) %s @ %s:%d,
class-lc_name, lock-lo_name,
fixup_filename(file), line);
+   return;
+   }
if (witness_watch) {
if ((instance-li_flags  LI_EXCLUSIVE) == 0)
kassert_panic(
@@ -1544,11 +1548,13 @@ witness_unlock(struct lock_object *lock,
 * We have to make sure we flush these queues, so just search for
 * eventual register locks and remove them.
 */
-   if (witness_watch  0)
+   if (witness_watch  0) {
kassert_panic(lock (%s) %s not locked @ %s:%d, class-lc_name,
lock-lo_name, fixup_filename(file), line);
-   else
return;
+   } else {
+   return;
+   }
 found:
 
/* First, check for shared/exclusive mismatches. */
@@ -1761,11 +1767,13 @@ enroll(const char *description, struct l
return (NULL);
else
typelist = w_spin;
-   } else if ((lock_class-lc_flags  LC_SLEEPLOCK))
+   } else if ((lock_class-lc_flags  LC_SLEEPLOCK)) {
typelist = w_sleep;
-   else
+   } else {
kassert_panic(lock class %s is not sleep or spin,
lock_class-lc_name);
+   return (NULL);
+   }
 
mtx_lock_spin(w_mtx);
w = witness_hash_get(description);
@@ -1921,19 +1929,26 @@ adopt(struct witness *parent, struct wit
 static void
 itismychild(struct witness *parent, struct witness *child)
 {
+   int unlocked;
 
MPASS(child != NULL  parent != NULL);
if (witness_cold == 0)
mtx_assert(w_mtx, MA_OWNED);
 
if (!witness_lock_type_equal(parent, child)) {
-   if (witness_cold == 0)
+   if (witness_cold == 0) {
+   unlocked = 1;
mtx_unlock_spin(w_mtx);
+   } else {
+   unlocked = 0;
+   }
kassert_panic(
%s: parent \%s\ (%s) and child \%s\ (%s) are not 
the same lock type, __func__, parent-w_name,
parent-w_class-lc_name, child-w_name,
child-w_class-lc_name);
+   if (unlocked)
+   mtx_lock_spin(w_mtx);
}
adopt(parent, child);
 }
@@ -2203,9 +2218,11 @@ witness_save(struct lock_object *lock, c
lock_list = PCPU_GET(spinlocks);
}
instance = find_instance(lock_list, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic(%s: lock (%s) %s not locked, __func__,
class-lc_name, lock-lo_name);
+   return;
+   }
*filep = instance-li_file;
*linep = instance-li_line;
 }
@@ -2241,6 +2258,8 @@ witness_restore(struct lock_object *lock
class-lc_name, lock-lo_name);
lock-lo_witness-w_file = file;
lock-lo_witness-w_line = line;
+   if (instance == NULL)
+   return;
instance-li_file = file;
instance-li_line = line;
 }
@@ -2336,9 +2355,11 @@ witness_setflag(struct lock_object *lock
lock_list = PCPU_GET(spinlocks);
}
instance = find_instance(lock_list, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic(%s: lock (%s) %s not locked, __func__,