svn commit: r230476 - in stable/9/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common

2012-01-23 Thread Martin Matuska
Author: mm
Date: Mon Jan 23 08:29:58 2012
New Revision: 230476
URL: http://svn.freebsd.org/changeset/base/230476

Log:
  MFC r230402, r230404:
  Add accidentially removed copyright lines in r228103
  
  Reported by:  pjd

Modified:
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cMon Jan 23 
06:36:41 2012(r230475)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cMon Jan 23 
08:29:58 2012(r230476)
@@ -24,6 +24,7 @@
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
  * Copyright (c) 2011 Pawel Jakub Dawidek pa...@dawidek.net.
+ * All rights reserved.
  * Copyright (c) 2011 Martin Matuska m...@freebsd.org. All rights reserved.
  */
 

Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hMon Jan 
23 06:36:41 2012(r230475)
+++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hMon Jan 
23 08:29:58 2012(r230476)
@@ -22,6 +22,8 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2011 Pawel Jakub Dawidek pa...@dawidek.net.
+ * All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
  * All rights reserved.
  */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230477 - in stable/8/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common

2012-01-23 Thread Martin Matuska
Author: mm
Date: Mon Jan 23 08:30:17 2012
New Revision: 230477
URL: http://svn.freebsd.org/changeset/base/230477

Log:
  MFC r230402, r230404:
  Add accidentially removed copyright lines in r228103
  
  Reported by:  pjd

Modified:
  stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
Directory Properties:
  stable/8/cddl/contrib/opensolaris/   (props changed)

Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cMon Jan 23 
08:29:58 2012(r230476)
+++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cMon Jan 23 
08:30:17 2012(r230477)
@@ -24,6 +24,7 @@
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
  * Copyright (c) 2011 Pawel Jakub Dawidek pa...@dawidek.net.
+ * All rights reserved.
  * Copyright (c) 2011 Martin Matuska m...@freebsd.org. All rights reserved.
  */
 

Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hMon Jan 
23 08:29:58 2012(r230476)
+++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hMon Jan 
23 08:30:17 2012(r230477)
@@ -22,6 +22,8 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2011 Pawel Jakub Dawidek pa...@dawidek.net.
+ * All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
  * All rights reserved.
  */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230478 - head/lib/libfetch

2012-01-23 Thread Dag-Erling Smorgrav
Author: des
Date: Mon Jan 23 09:23:07 2012
New Revision: 230478
URL: http://svn.freebsd.org/changeset/base/230478

Log:
  Fix two nits in previous commit pointed out by pjd@.
  
  MFC after:3 weeks

Modified:
  head/lib/libfetch/common.c

Modified: head/lib/libfetch/common.c
==
--- head/lib/libfetch/common.c  Mon Jan 23 08:30:17 2012(r230477)
+++ head/lib/libfetch/common.c  Mon Jan 23 09:23:07 2012(r230478)
@@ -416,7 +416,6 @@ fetch_cache_data(conn_t *conn, char *src
if (conn-cache.size  nbytes) {
tmp = realloc(conn-cache.buf, nbytes);
if (tmp == NULL) {
-   errno = ENOMEM;
fetch_syserr();
return (-1);
}
@@ -481,7 +480,7 @@ fetch_read(conn_t *conn, char *buf, size
conn-cache.len -= total;
conn-cache.pos += total;
len -= total;
-   buf+= total;
+   buf += total;
}
 
while (len  0) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230354 - head/usr.sbin/makefs

2012-01-23 Thread Eitan Adler
On Sun, Jan 22, 2012 at 11:28 PM, Hiroki Sato h...@freebsd.org wrote:
 ea bug fix which could be upstreamed that would be great. On the other
 ea hand I would like to continue with my goal of making the non-contrib
 ea world compilable with CC=gcc46.
 ea
 ea Should I revert this commit?

  I don't think it is needed.  The makefs utility is a special case
  because it will probably diverge from the upstream to support
  FreeBSD-specific feature in the future (this is one of the reasons
  why it is not in contrib/).  It didn't happen so far, however.

Understood.

  By the way, does gcc46 no longer allow unused code?

gcc46 enables -Wunused-but-set-variable enabled with -Wextra. One
possible solution is to just disable the warning, but IMHO having
random unused variables just makes code harder to understand.

It also enables a few other stricter checks for C conformance.

 Generally speaking, I think it is enough to clean up unused code only when we
  actually change the code.

If these were style(9) or best practice cleanups - I'd agree.
However this was prompted by my specific goal of making the  userland
code compile with gcc46. It would be nice to see FreeBSD as compiler
agnostic as possible.

-- 
Eitan Adler
Source  Ports committer
X11, Bugbusting teams
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230354 - head/usr.sbin/makefs

2012-01-23 Thread Dimitry Andric

On 2012-01-23 05:28, Hiroki Sato wrote:
...

  I don't think it is needed.  The makefs utility is a special case
  because it will probably diverge from the upstream to support
  FreeBSD-specific feature in the future (this is one of the reasons
  why it is not in contrib/).  It didn't happen so far, however.

  By the way, does gcc46 no longer allow unused code?  Generally
  speaking, I think it is enough to clean up unused code only when we
  actually change the code.


The warnings are not about unused code, but about variables which are
assigned, but then never referenced anymore.  Sometimes this is just a
cosmetic issue, and the compiler will hopefully optimize out the
unreferenced variable(s).  In other situations there are real bugs.

In any case, gcc 4.5 and 4.6 just enable more warnings by default, and
when using -Wall; in particular the variable set but not used one.

This warning should really be suppressed when WARNS is set to a low
level, such as with makefs (it has WARNS?=2).

Attached diff makes it so, for gcc45 and gcc46.  It uses the same
approach as I added earlier for clang.  It can also be easily extended
to other warnings.
Index: share/mk/bsd.sys.mk
===
--- share/mk/bsd.sys.mk	(revision 230479)
+++ share/mk/bsd.sys.mk	(working copy)
@@ -74,7 +74,14 @@
 .   if defined(NO_WARRAY_BOUNDS)
 CWARNFLAGS	+=	-Wno-array-bounds
 .   endif
-.  endif
+.  endif # clang
+# Gcc 4.5 and 4.6 have more warnings enabled by default, and when using -Wall,
+# so if WARNS is set to low values, these have to be disabled explicitly. 
+.  if ${CC:T:Mgcc45} == gcc45 || ${CC:T:Mgcc45} == gcc46
+.   if ${WARNS} = 2
+CWARNFLAGS	+=	-Wno-unused-but-set-variable
+.   endif
+.  endif # gcc45 || gcc46
 . endif
 
 . if defined(FORMAT_AUDIT)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

Re: svn commit: r230354 - head/usr.sbin/makefs

2012-01-23 Thread Kostik Belousov
On Mon, Jan 23, 2012 at 01:25:04PM +0100, Dimitry Andric wrote:
 On 2012-01-23 05:28, Hiroki Sato wrote:
 ...
   I don't think it is needed.  The makefs utility is a special case
   because it will probably diverge from the upstream to support
   FreeBSD-specific feature in the future (this is one of the reasons
   why it is not in contrib/).  It didn't happen so far, however.
 
   By the way, does gcc46 no longer allow unused code?  Generally
   speaking, I think it is enough to clean up unused code only when we
   actually change the code.
 
 The warnings are not about unused code, but about variables which are
 assigned, but then never referenced anymore.  Sometimes this is just a
 cosmetic issue, and the compiler will hopefully optimize out the
 unreferenced variable(s).  In other situations there are real bugs.
 
 In any case, gcc 4.5 and 4.6 just enable more warnings by default, and
 when using -Wall; in particular the variable set but not used one.
 
 This warning should really be suppressed when WARNS is set to a low
 level, such as with makefs (it has WARNS?=2).
 
 Attached diff makes it so, for gcc45 and gcc46.  It uses the same
 approach as I added earlier for clang.  It can also be easily extended
 to other warnings.

There is a typo in the second or condition, should it be gcc46 both times ?

Anyway, the reason to answer this message is two ask the for seemingly
unreasonable approach of matching compiler type/version based on the
driver name. This completely precludes anybody from using gcc installed
not from the ports tree.

Could the tests performed based on the driver version information
instead of name ?


pgphXwGNGuNjj.pgp
Description: PGP signature


Re: svn commit: r230354 - head/usr.sbin/makefs

2012-01-23 Thread Dimitry Andric

On 2012-01-23 13:31, Kostik Belousov wrote:

On Mon, Jan 23, 2012 at 01:25:04PM +0100, Dimitry Andric wrote:

...

There is a typo in the second or condition, should it be gcc46 both times ?


Ah, sorry, that was a copy/paste error.



Anyway, the reason to answer this message is two ask the for seemingly
unreasonable approach of matching compiler type/version based on the
driver name. This completely precludes anybody from using gcc installed
not from the ports tree.


Yes, that is indeed the big problem with this approach.  Although I
think the number of people that hand-build gcc, and not use the ports
will be rather low.  :)



Could the tests performed based on the driver version information
instead of name ?


Probably, but then you would have to run ${CC} --version plus some
sed/awk'ing from bsd.sys.mk.  That could add quite some extra forking
during buildworld.

It may be easier to add a COMPILER_FLAVOR (just an example name) setting
in make.conf, which can be set independently of CC, CXX and so on, to
tell which specific variant of gcc, clang etc you want to use.

The processing of that setting could happen in either sys.mk or
bsd.sys.mk, or be separated out to a bsd.compiler.mk, for instance.

In each .mk file or Makefile that needs it, the ${CC:T:M:foo} == foo
comparisons can then be replaced with ${COMPILER_FLAVOR} == foo.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r226113 - head/sys/netinet

2012-01-23 Thread Lawrence Stewart

Hi Andre,

On 10/08/11 03:39, Andre Oppermann wrote:

Author: andre
Date: Fri Oct  7 16:39:03 2011
New Revision: 226113
URL: http://svn.freebsd.org/changeset/base/226113

Log:
   Prevent TCP sessions from stalling indefinitely in reassembly
   when reaching the zone limit of reassembly queue entries.


[snip]

Any reason this was not MFCed to stable/8 and stable/7 when you MFCed to 
stable/9? As far as I can tell, both r226113 and r228016 need to be 
MFCed to 8 and 7.


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


Re: svn commit: r230354 - head/usr.sbin/makefs

2012-01-23 Thread Kostik Belousov
On Mon, Jan 23, 2012 at 03:13:07PM +0100, Dimitry Andric wrote:
 On 2012-01-23 13:31, Kostik Belousov wrote:
 On Mon, Jan 23, 2012 at 01:25:04PM +0100, Dimitry Andric wrote:
 ...
 There is a typo in the second or condition, should it be gcc46 both times ?
 
 Ah, sorry, that was a copy/paste error.
 
 
 Anyway, the reason to answer this message is two ask the for seemingly
 unreasonable approach of matching compiler type/version based on the
 driver name. This completely precludes anybody from using gcc installed
 not from the ports tree.
 
 Yes, that is indeed the big problem with this approach.  Although I
 think the number of people that hand-build gcc, and not use the ports
 will be rather low.  :)
 
 
 Could the tests performed based on the driver version information
 instead of name ?
 
 Probably, but then you would have to run ${CC} --version plus some
 sed/awk'ing from bsd.sys.mk.  That could add quite some extra forking
 during buildworld.
 
 It may be easier to add a COMPILER_FLAVOR (just an example name) setting
 in make.conf, which can be set independently of CC, CXX and so on, to
 tell which specific variant of gcc, clang etc you want to use.
 
 The processing of that setting could happen in either sys.mk or
 bsd.sys.mk, or be separated out to a bsd.compiler.mk, for instance.
 
 In each .mk file or Makefile that needs it, the ${CC:T:M:foo} == foo
 comparisons can then be replaced with ${COMPILER_FLAVOR} == foo.

I agree that even such palliative measures are more useful and provides
better future-proof of the build system then current name matching.


pgpo3NMA6Nbj3.pgp
Description: PGP signature


svn commit: r230480 - head/sys/netgraph

2012-01-23 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 23 15:17:14 2012
New Revision: 230480
URL: http://svn.freebsd.org/changeset/base/230480

Log:
  Convert locks that protect name hash, ID hash and typelist from
  mutex(9) to rwlock(9) based locks.
  
  While here remove dropping lock when processing NGM_LISTNODES,
  and NGM_LISTTYPES generic commands. We don't need to drop it
  since memory allocation is done with M_NOWAIT.

Modified:
  head/sys/netgraph/ng_base.c

Modified: head/sys/netgraph/ng_base.c
==
--- head/sys/netgraph/ng_base.c Mon Jan 23 11:37:40 2012(r230479)
+++ head/sys/netgraph/ng_base.c Mon Jan 23 15:17:14 2012(r230480)
@@ -50,6 +50,7 @@
 #include sys/kernel.h
 #include sys/ktr.h
 #include sys/limits.h
+#include sys/lock.h
 #include sys/malloc.h
 #include sys/mbuf.h
 #include sys/queue.h
@@ -57,6 +58,7 @@
 #include sys/syslog.h
 #include sys/refcount.h
 #include sys/proc.h
+#include sys/rwlock.h
 #include sys/unistd.h
 #include sys/kthread.h
 #include sys/smp.h
@@ -163,19 +165,28 @@ static struct mtx ng_worklist_mtx;   /* 
 
 /* List of installed types */
 static LIST_HEAD(, ng_type) ng_typelist;
-static struct mtx  ng_typelist_mtx;
+static struct rwlock   ng_typelist_lock;
+#defineTYPELIST_RLOCK()rw_rlock(ng_typelist_lock)
+#defineTYPELIST_RUNLOCK()  rw_runlock(ng_typelist_lock)
+#defineTYPELIST_WLOCK()rw_wlock(ng_typelist_lock)
+#defineTYPELIST_WUNLOCK()  rw_wunlock(ng_typelist_lock)
 
 /* Hash related definitions */
 /* XXX Don't need to initialise them because it's a LIST */
 static VNET_DEFINE(LIST_HEAD(, ng_node), ng_ID_hash[NG_ID_HASH_SIZE]);
 #defineV_ng_ID_hashVNET(ng_ID_hash)
 
-static struct mtx  ng_idhash_mtx;
+static struct rwlock   ng_idhash_lock;
+#defineIDHASH_RLOCK()  rw_rlock(ng_idhash_lock)
+#defineIDHASH_RUNLOCK()rw_runlock(ng_idhash_lock)
+#defineIDHASH_WLOCK()  rw_wlock(ng_idhash_lock)
+#defineIDHASH_WUNLOCK()rw_wunlock(ng_idhash_lock)
+
 /* Method to find a node.. used twice so do it here */
 #define NG_IDHASH_FN(ID) ((ID) % (NG_ID_HASH_SIZE))
 #define NG_IDHASH_FIND(ID, node)   \
do {\
-   mtx_assert(ng_idhash_mtx, MA_OWNED);   \
+   rw_assert(ng_idhash_lock, RA_LOCKED);  \
LIST_FOREACH(node, V_ng_ID_hash[NG_IDHASH_FN(ID)], \
nd_idnodes) {   \
if (NG_NODE_IS_VALID(node)  \
@@ -188,7 +199,6 @@ static struct mtx   ng_idhash_mtx;
 static VNET_DEFINE(LIST_HEAD(, ng_node), ng_name_hash[NG_NAME_HASH_SIZE]);
 #defineV_ng_name_hash  VNET(ng_name_hash)
 
-static struct mtx  ng_namehash_mtx;
 #define NG_NAMEHASH(NAME, HASH)\
do {\
u_char  h = 0;  \
@@ -198,6 +208,11 @@ static struct mtx  ng_namehash_mtx;
(HASH) = h % (NG_NAME_HASH_SIZE);   \
} while (0)
 
+static struct rwlock   ng_namehash_lock;
+#defineNAMEHASH_RLOCK()rw_rlock(ng_namehash_lock)
+#defineNAMEHASH_RUNLOCK()  rw_runlock(ng_namehash_lock)
+#defineNAMEHASH_WLOCK()rw_wlock(ng_namehash_lock)
+#defineNAMEHASH_WUNLOCK()  rw_wunlock(ng_namehash_lock)
 
 /* Internal functions */
 static int ng_add_hook(node_p node, const char *name, hook_p * hookp);
@@ -650,12 +665,12 @@ ng_make_node_common(struct ng_type *type
LIST_INIT(node-nd_hooks);
 
/* Link us into the name hash. */
-   mtx_lock(ng_namehash_mtx);
+   NAMEHASH_WLOCK();
LIST_INSERT_HEAD(V_ng_name_hash[0], node, nd_nodes);
-   mtx_unlock(ng_namehash_mtx);
+   NAMEHASH_WUNLOCK();
 
/* get an ID and put us in the hash chain */
-   mtx_lock(ng_idhash_mtx);
+   IDHASH_WLOCK();
for (;;) { /* wrap protection, even if silly */
node_p node2 = NULL;
node-nd_ID = V_nextID++; /* 137/sec for 1 year before wrap */
@@ -668,7 +683,7 @@ ng_make_node_common(struct ng_type *type
}
LIST_INSERT_HEAD(V_ng_ID_hash[NG_IDHASH_FN(node-nd_ID)], node,
nd_idnodes);
-   mtx_unlock(ng_idhash_mtx);
+   IDHASH_WUNLOCK();
 
/* Done */
*nodepp = node;
@@ -780,14 +795,14 @@ ng_unref_node(node_p node)
 
if (refcount_release(node-nd_refs)) { /* we were the last */
 
-   mtx_lock(ng_namehash_mtx);
node-nd_type-refs--; /* XXX maybe should get types lock? */
+   NAMEHASH_WLOCK();
LIST_REMOVE(node, nd_nodes);
-   mtx_unlock(ng_namehash_mtx);
+ 

Re: svn commit: r230252 - head/sys/fs/tmpfs

2012-01-23 Thread Jaakko Heinonen
On 2012-01-22, Mikolaj Golub wrote:
 Also, may be we should allow remounting ro (and may be some othe options) for
 tmpfs?

Yes, the patch below does that. I suspect that flipping the MNT_RDONLY
flag may be enough for tmpfs but I am not sure.

  JH %%%
  JH Index: sys/fs/tmpfs/tmpfs_vfsops.c
  JH ===
  JH --- sys/fs/tmpfs/tmpfs_vfsops.c(revision 230328)
  JH +++ sys/fs/tmpfs/tmpfs_vfsops.c(working copy)
  JH @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = {
  JH  NULL
  JH  };
  JH  
  JH +static const char *tmpfs_updateopts[] = {
  JH +from, export, NULL
  JH +};
  JH +
  JH  /* 
 - */
  JH  
  JH  static int
  JH @@ -150,12 +154,10 @@ tmpfs_mount(struct mount *mp)
  JH  return (EINVAL);
  JH  
  JH  if (mp-mnt_flag  MNT_UPDATE) {
  JH -/*
  JH - * Only support update mounts for NFS export.
  JH - */
  JH -if (vfs_flagopt(mp-mnt_optnew, export, NULL, 0))
  JH -return (0);
  JH -return (EOPNOTSUPP);
  JH +/* Only support update mounts for certain options. */
  JH +if (vfs_filteropt(mp-mnt_optnew, tmpfs_updateopts) != 
 0)
  JH +return (EOPNOTSUPP);
  JH +return (0);
  JH  }
  JH  
  JH  vn_lock(mp-mnt_vnodecovered, LK_SHARED | LK_RETRY);
  JH %%%

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


svn commit: r230481 - in head: sys/netgraph usr.bin/netstat

2012-01-23 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 23 15:39:45 2012
New Revision: 230481
URL: http://svn.freebsd.org/changeset/base/230481

Log:
  In ng_socket(4) expose less kernel internals to userland. This commit
  breaks ABI, but makes probability of ABI breakage in future less.

Modified:
  head/sys/netgraph/ng_socket.c
  head/sys/netgraph/ng_socketvar.h
  head/usr.bin/netstat/netgraph.c

Modified: head/sys/netgraph/ng_socket.c
==
--- head/sys/netgraph/ng_socket.c   Mon Jan 23 15:17:14 2012
(r230480)
+++ head/sys/netgraph/ng_socket.c   Mon Jan 23 15:39:45 2012
(r230481)
@@ -162,6 +162,19 @@ static struct mtx  ngsocketlist_mtx;
 #define TRAP_ERROR
 #endif
 
+/* Per-node private data */
+struct ngsock {
+   struct ng_node  *node;  /* the associated netgraph node */
+   struct ngpcb*datasock;  /* optional data socket */
+   struct ngpcb*ctlsock;   /* optional control socket */
+   int flags;
+   int refs;
+   struct mtx  mtx;/* mtx to wait on */
+   int error;  /* place to store error */
+};
+
+#defineNGS_FLAG_NOLINGER   1   /* close with last hook */
+
 /***
Control sockets
 ***/
@@ -535,9 +548,7 @@ ng_attach_cntl(struct socket *so)
pcbp-sockdata = priv;
priv-refs++;
priv-node = node;
-
-   /* Store a hint for netstat(1). */
-   priv-node_id = priv-node-nd_ID;
+   pcbp-node_id = node-nd_ID;/* hint for netstat(1) */
 
/* Link the node and the private data. */
NG_NODE_SET_PRIVATE(priv-node, priv);
@@ -608,6 +619,7 @@ ng_detach_common(struct ngpcb *pcbp, int
panic(%s, __func__);
}
pcbp-sockdata = NULL;
+   pcbp-node_id = 0;
 
ng_socket_free_priv(priv);
}
@@ -698,6 +710,7 @@ ng_connect_data(struct sockaddr *nam, st
mtx_lock(priv-mtx);
priv-datasock = pcbp;
pcbp-sockdata = priv;
+   pcbp-node_id = priv-node-nd_ID;  /* hint for netstat(1) */
priv-refs++;
mtx_unlock(priv-mtx);
NG_FREE_ITEM(item); /* drop the reference to the node */

Modified: head/sys/netgraph/ng_socketvar.h
==
--- head/sys/netgraph/ng_socketvar.hMon Jan 23 15:17:14 2012
(r230480)
+++ head/sys/netgraph/ng_socketvar.hMon Jan 23 15:39:45 2012
(r230481)
@@ -50,20 +50,6 @@ struct ngpcb {
struct ngsock*sockdata; /* netgraph info */
LIST_ENTRY(ngpcb) socks;/* linked list of sockets */
int   type; /* NG_CONTROL or NG_DATA */
-};
-
-/* Per-node private data */
-struct ngsock {
-   struct ng_node  *node;  /* the associated netgraph node */
-   struct ngpcb*datasock;  /* optional data socket */
-   struct ngpcb*ctlsock;   /* optional control socket */
-   intflags;
-   intrefs;
-   struct mtx  mtx;/* mtx to wait on */
-   int error;  /* place to store error */
ng_ID_t node_id;/* a hint for netstat(1) to find the 
node */
 };
-#defineNGS_FLAG_NOLINGER   1   /* close with last hook */
-
 #endif /* _NETGRAPH_NG_SOCKETVAR_H_ */
-

Modified: head/usr.bin/netstat/netgraph.c
==
--- head/usr.bin/netstat/netgraph.c Mon Jan 23 15:17:14 2012
(r230480)
+++ head/usr.bin/netstat/netgraph.c Mon Jan 23 15:39:45 2012
(r230481)
@@ -67,7 +67,6 @@ netgraphprotopr(u_long off, const char *
 {
struct ngpcb *this, *next;
struct ngpcb ngpcb;
-   struct ngsock info;
struct socket sockb;
int debug = 1;
 
@@ -165,15 +164,10 @@ netgraphprotopr(u_long off, const char *
printf(%-5.5s %6u %6u ,
name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
 
-   /* Get ngsock structure */
-   if (ngpcb.sockdata == NULL) /* unconnected data socket */
-   goto finish;
-   kread((u_long)ngpcb.sockdata, (char *)info, sizeof(info));
-
/* Get info on associated node */
-   if (info.node_id == 0 || csock == -1)
+   if (ngpcb.node_id == 0 || csock == -1)
goto finish;
-   snprintf(path, sizeof(path), [%x]:, info.node_id);
+   snprintf(path, sizeof(path), [%x]:, ngpcb.node_id);
if (NgSendMsg(csock, path,
NGM_GENERIC_COOKIE, NGM_NODEINFO, NULL, 0)  0)
goto finish;
___

svn commit: r230482 - head/release

2012-01-23 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Jan 23 15:44:52 2012
New Revision: 230482
URL: http://svn.freebsd.org/changeset/base/230482

Log:
  Per popular demand, if installing from a graphics terminal, run the
  installer on a VTY with no kernel messages (VTY 2), show the installer
  log in real time on VTY 3, and spawn a shell on VTY 4.
  
  PR:   bin/161047, bin/161048
  MFC after:2 weeks

Modified:
  head/release/rc.local

Modified: head/release/rc.local
==
--- head/release/rc.local   Mon Jan 23 15:39:45 2012(r230481)
+++ head/release/rc.local   Mon Jan 23 15:44:52 2012(r230482)
@@ -10,8 +10,19 @@
 
 kbdcontrol -d /dev/null 21
 if [ $? -eq 0 ]; then
-   # Syscons: use xterm
+   # Syscons: use xterm, start interesting things on other VTYs
TERM=xterm
+
+   if [ $EXTERNAL_VTY_STARTED -ne 1 ]; then
+   vidcontrol -s 2 # Switch to a VTY with no kernel messages
+   # Init will clean these processes up if/when the system
+   # goes multiuser
+   touch /tmp/bsdinstall_log
+   tail -f /tmp/bsdinstall_log  /dev/ttyv2 
+   /usr/libexec/getty autologin ttyv3
+   EXTERNAL_VTY_STARTED=1
+   trap vidcontrol -s 1 EXIT
+   fi
 else
# Serial or other console
echo
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230483 - head/release

2012-01-23 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Jan 23 15:50:16 2012
New Revision: 230483
URL: http://svn.freebsd.org/changeset/base/230483

Log:
  Do a test in a better way. Editing files after testing them is never wise.

Modified:
  head/release/rc.local

Modified: head/release/rc.local
==
--- head/release/rc.local   Mon Jan 23 15:44:52 2012(r230482)
+++ head/release/rc.local   Mon Jan 23 15:50:16 2012(r230483)
@@ -13,7 +13,7 @@ if [ $? -eq 0 ]; then
# Syscons: use xterm, start interesting things on other VTYs
TERM=xterm
 
-   if [ $EXTERNAL_VTY_STARTED -ne 1 ]; then
+   if [ -z $EXTERNAL_VTY_STARTED ]; then
vidcontrol -s 2 # Switch to a VTY with no kernel messages
# Init will clean these processes up if/when the system
# goes multiuser
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r230482 - head/release

2012-01-23 Thread Ed Schouten
Hi Nathan,

* Nathan Whitehorn nwhiteh...@freebsd.org, 20120123 16:44:
   TERM=xterm

This code is also used on pc98, right? I think on pc98 we still need to
use TERM=cons25w, to support Japanese character sets and keyboard input.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpnnbTGmafLJ.pgp
Description: PGP signature


svn commit: r230484 - head/release

2012-01-23 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Jan 23 16:17:54 2012
New Revision: 230484
URL: http://svn.freebsd.org/changeset/base/230484

Log:
  Part of r230482 didn't actually work. Revert it for now. This means PR
  161047 isn't actually fixed.
  
  PR:   bin/161047

Modified:
  head/release/rc.local

Modified: head/release/rc.local
==
--- head/release/rc.local   Mon Jan 23 15:50:16 2012(r230483)
+++ head/release/rc.local   Mon Jan 23 16:17:54 2012(r230484)
@@ -14,14 +14,12 @@ if [ $? -eq 0 ]; then
TERM=xterm
 
if [ -z $EXTERNAL_VTY_STARTED ]; then
-   vidcontrol -s 2 # Switch to a VTY with no kernel messages
# Init will clean these processes up if/when the system
# goes multiuser
touch /tmp/bsdinstall_log
tail -f /tmp/bsdinstall_log  /dev/ttyv2 
/usr/libexec/getty autologin ttyv3
EXTERNAL_VTY_STARTED=1
-   trap vidcontrol -s 1 EXIT
fi
 else
# Serial or other console
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230485 - stable/9/sys/fs/pseudofs

2012-01-23 Thread Jaakko Heinonen
Author: jh
Date: Mon Jan 23 16:28:35 2012
New Revision: 230485
URL: http://svn.freebsd.org/changeset/base/230485

Log:
  MFC r229694:
  
  r222004 changed sbuf_finish() to not clear the buffer error status. As a
  consequence sbuf_len() will return -1 for buffers which had the error
  status set prior to sbuf_finish() call. This causes a problem in
  pfs_read() which purposely uses a fixed size sbuf to discard bytes which
  are not needed to fulfill the read request.
  
  Work around the problem by using the full buffer length when
  sbuf_finish() indicates an overflow. An overflowed sbuf with fixed size
  is always full.
  
  PR:   kern/163076

Modified:
  stable/9/sys/fs/pseudofs/pseudofs_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c
==
--- stable/9/sys/fs/pseudofs/pseudofs_vnops.c   Mon Jan 23 16:17:54 2012
(r230484)
+++ stable/9/sys/fs/pseudofs/pseudofs_vnops.c   Mon Jan 23 16:28:35 2012
(r230485)
@@ -630,14 +630,14 @@ pfs_read(struct vop_read_args *va)
if (uio-uio_offset  0 || uio-uio_resid  0 ||
(offset = uio-uio_offset) != uio-uio_offset ||
(resid = uio-uio_resid) != uio-uio_resid ||
-   (buflen = offset + resid + 1)  offset || buflen  INT_MAX) {
+   (buflen = offset + resid)  offset || buflen = INT_MAX) {
error = EINVAL;
goto ret;
}
-   if (buflen  MAXPHYS + 1)
-   buflen = MAXPHYS + 1;
+   if (buflen  MAXPHYS)
+   buflen = MAXPHYS;
 
-   sb = sbuf_new(sb, NULL, buflen, 0);
+   sb = sbuf_new(sb, NULL, buflen + 1, 0);
if (sb == NULL) {
error = EIO;
goto ret;
@@ -650,8 +650,14 @@ pfs_read(struct vop_read_args *va)
goto ret;
}
 
-   sbuf_finish(sb);
-   error = uiomove_frombuf(sbuf_data(sb), sbuf_len(sb), uio);
+   /*
+* XXX: If the buffer overflowed, sbuf_len() will not return
+* the data length. Then just use the full length because an
+* overflowed sbuf must be full.
+*/
+   if (sbuf_finish(sb) == 0)
+   buflen = sbuf_len(sb);
+   error = uiomove_frombuf(sbuf_data(sb), buflen, uio);
sbuf_delete(sb);
 ret:
vn_lock(vn, locked | LK_RETRY);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230486 - head/sys/kern

2012-01-23 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 23 16:31:46 2012
New Revision: 230486
URL: http://svn.freebsd.org/changeset/base/230486

Log:
  Convert panic()s to KASSERT()s. This is an optimisation for
  hashdestroy() since in absence of INVARIANTS a compiler
  will drop the entire for() cycle.

Modified:
  head/sys/kern/subr_hash.c

Modified: head/sys/kern/subr_hash.c
==
--- head/sys/kern/subr_hash.c   Mon Jan 23 16:28:35 2012(r230485)
+++ head/sys/kern/subr_hash.c   Mon Jan 23 16:31:46 2012(r230486)
@@ -52,9 +52,7 @@ hashinit_flags(int elements, struct mall
LIST_HEAD(generic, generic) *hashtbl;
int i;
 
-   if (elements = 0)
-   panic(hashinit: bad elements);
-
+   KASSERT(elements  0, (%s: bad elements, __func__));
/* Exactly one of HASH_WAITOK and HASH_NOWAIT must be set. */
KASSERT((flags  HASH_WAITOK) ^ (flags  HASH_NOWAIT),
(Bad flags (0x%x) passed to hashinit_flags, flags));
@@ -95,8 +93,7 @@ hashdestroy(void *vhashtbl, struct mallo
 
hashtbl = vhashtbl;
for (hp = hashtbl; hp = hashtbl[hashmask]; hp++)
-   if (!LIST_EMPTY(hp))
-   panic(hashdestroy: hash not empty);
+   KASSERT(LIST_EMPTY(hp), (%s: hash not empty, __func__));
free(hashtbl, type);
 }
 
@@ -115,8 +112,7 @@ phashinit(int elements, struct malloc_ty
LIST_HEAD(generic, generic) *hashtbl;
int i;
 
-   if (elements = 0)
-   panic(phashinit: bad elements);
+   KASSERT(elements  0, (%s: bad elements, __func__));
for (i = 1, hashsize = primes[1]; hashsize = elements;) {
i++;
if (i == NPRIMES)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230487 - head/sys/netgraph

2012-01-23 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 23 16:43:13 2012
New Revision: 230487
URL: http://svn.freebsd.org/changeset/base/230487

Log:
  Provide a findhook method for ng_socket(4). The node stores a
  hash with names of its hooks. It starts with size of 16, and
  grows when number of hooks reaches twice the current size. A
  failure to grow (memory is allocated with M_NOWAIT) isn't
  fatal, however.
  
  I used standard hash(9) function for the hash. With 25000
  hooks named in the mpd (ports/net/mpd5) manner of b%u, the
  distributions is the following: 72.1% entries consist of one
  element, 22.1% consist of two, 5.2% consist of three and
  0.6% of four.
  
  Speedup in a synthetic test that creates 25000 hooks and then
  runs through a long cyclce dereferencing them in a random order
  is over 25 times.

Modified:
  head/sys/netgraph/ng_socket.c

Modified: head/sys/netgraph/ng_socket.c
==
--- head/sys/netgraph/ng_socket.c   Mon Jan 23 16:31:46 2012
(r230486)
+++ head/sys/netgraph/ng_socket.c   Mon Jan 23 16:43:13 2012
(r230487)
@@ -51,6 +51,7 @@
 
 #include sys/param.h
 #include sys/domain.h
+#include sys/hash.h
 #include sys/kernel.h
 #include sys/linker.h
 #include sys/lock.h
@@ -112,6 +113,7 @@ static ng_rcvmsg_t  ngs_rcvmsg;
 static ng_shutdown_t   ngs_shutdown;
 static ng_newhook_tngs_newhook;
 static ng_connect_tngs_connect;
+static ng_findhook_t   ngs_findhook;
 static ng_rcvdata_tngs_rcvdata;
 static ng_disconnect_t ngs_disconnect;
 
@@ -137,6 +139,7 @@ static struct ng_type typestruct = {
.shutdown = ngs_shutdown,
.newhook =  ngs_newhook,
.connect =  ngs_connect,
+   .findhook = ngs_findhook,
.rcvdata =  ngs_rcvdata,
.disconnect =   ngs_disconnect,
 };
@@ -162,11 +165,19 @@ static struct mtx ngsocketlist_mtx;
 #define TRAP_ERROR
 #endif
 
+struct hookpriv {
+   LIST_ENTRY(hookpriv)next;
+   hook_p  hook;
+};
+LIST_HEAD(ngshash, hookpriv);
+
 /* Per-node private data */
 struct ngsock {
struct ng_node  *node;  /* the associated netgraph node */
struct ngpcb*datasock;  /* optional data socket */
struct ngpcb*ctlsock;   /* optional control socket */
+   struct ngshash  *hash;  /* hash for hook names */
+   u_long  hmask;  /* hash mask */
int flags;
int refs;
struct mtx  mtx;/* mtx to wait on */
@@ -537,8 +548,14 @@ ng_attach_cntl(struct socket *so)
return (error);
}
 
-   /* Allocate node private info */
+   /*
+* Allocate node private info and hash. We start
+* with 16 hash entries, however we may grow later
+* in ngs_newhook(). We can't predict how much hooks
+* does this node plan to have.
+*/
priv = malloc(sizeof(*priv), M_NETGRAPH_SOCK, M_WAITOK | M_ZERO);
+   priv-hash = hashinit(16, M_NETGRAPH_SOCK, priv-hmask);
 
/* Initialize mutex. */
mtx_init(priv-mtx, ng_socket, NULL, MTX_DEF);
@@ -643,6 +660,7 @@ ng_socket_free_priv(struct ngsock *priv)
 
if (priv-refs == 0) {
mtx_destroy(priv-mtx);
+   hashdestroy(priv-hash, M_NETGRAPH_SOCK, priv-hmask);
free(priv, M_NETGRAPH_SOCK);
return;
}
@@ -752,6 +770,35 @@ ngs_constructor(node_p nodep)
return (EINVAL);
 }
 
+static void
+ngs_rehash(node_p node)
+{
+   struct ngsock *priv = NG_NODE_PRIVATE(node);
+   struct ngshash *new;
+   struct hookpriv *hp;
+   hook_p hook;
+   uint32_t h;
+   u_long hmask;
+
+   new = hashinit_flags((priv-hmask + 1) * 2, M_NETGRAPH_SOCK, hmask,
+   HASH_NOWAIT);
+   if (new == NULL)
+   return;
+
+   LIST_FOREACH(hook, node-nd_hooks, hk_hooks) {
+   hp = NG_HOOK_PRIVATE(hook);
+#ifdef INVARIANTS
+   LIST_REMOVE(hp, next);
+#endif
+   h = hash32_str(NG_HOOK_NAME(hook), HASHINIT)  hmask;
+   LIST_INSERT_HEAD(new[h], hp, next);
+   }
+
+   hashdestroy(priv-hash, M_NETGRAPH_SOCK, priv-hmask);
+   priv-hash = new;
+   priv-hmask = hmask;
+}
+
 /*
  * We allow any hook to be connected to the node.
  * There is no per-hook private information though.
@@ -759,7 +806,20 @@ ngs_constructor(node_p nodep)
 static int
 ngs_newhook(node_p node, hook_p hook, const char *name)
 {
-   NG_HOOK_SET_PRIVATE(hook, NG_NODE_PRIVATE(node));
+   struct ngsock *const priv = NG_NODE_PRIVATE(node);
+   struct hookpriv *hp;
+   uint32_t h;
+
+   hp = malloc(sizeof(*hp), M_NETGRAPH_SOCK, M_NOWAIT);
+   if (hp == NULL)
+   return (ENOMEM);
+   if (node-nd_numhooks * 2  priv-hmask)
+   ngs_rehash(node);
+   hp-hook = hook;
+   h = hash32_str(name, HASHINIT)  priv-hmask;
+   

svn commit: r230488 - head/sys/dev/sound/pci/hda

2012-01-23 Thread Alexander Motin
Author: mav
Date: Mon Jan 23 17:05:11 2012
New Revision: 230488
URL: http://svn.freebsd.org/changeset/base/230488

Log:
  Realtek CODECs declare support for 32bit samples on S/PDIF input/output
  widgets. I am not sure if S/PDIF supports 32bit samples, but my Marantz
  SR4001 doesn't, producing only single clicks on playback start/stop.
  Because HDA controller requires 32bit alignment for all samples above 16bit,
  we can't handle this situation in regular way and have to set 32bit format
  in sound(4) for anything above 16bit. To workaround the problem, prefer
  to setup hardware to use 24/20bit samples when 32bit format requested. Add
  dev.pcm.X.play.32bit and dev.pcm.X.rec.32bit sysctls to control what format
  really use for 32bit samples.
  
  MFC after:2 months
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/dev/sound/pci/hda/hdaa.c

Modified: head/sys/dev/sound/pci/hda/hdaa.c
==
--- head/sys/dev/sound/pci/hda/hdaa.c   Mon Jan 23 16:43:13 2012
(r230487)
+++ head/sys/dev/sound/pci/hda/hdaa.c   Mon Jan 23 17:05:11 2012
(r230488)
@@ -4897,12 +4897,12 @@ hdaa_pcmchannel_setup(struct hdaa_chan *
ch-bit16 = 1;
else if (HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT(pcmcap))
ch-bit16 = 0;
-   if (HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(pcmcap))
-   ch-bit32 = 4;
-   else if (HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(pcmcap))
+   if (HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(pcmcap))
ch-bit32 = 3;
else if (HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT(pcmcap))
ch-bit32 = 2;
+   else if (HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(pcmcap))
+   ch-bit32 = 4;
if (!(devinfo-quirks  HDAA_QUIRK_FORCESTEREO)) {
ch-fmtlist[i++] = SND_FORMAT(AFMT_S16_LE, 1, 
0);
if (ch-bit32)
@@ -6444,6 +6444,36 @@ hdaa_chan_formula(struct hdaa_devinfo *d
 }
 
 static int
+hdaa_sysctl_32bit(SYSCTL_HANDLER_ARGS)
+{
+   struct hdaa_audio_as *as = (struct hdaa_audio_as *)oidp-oid_arg1;
+   struct hdaa_pcm_devinfo *pdevinfo = as-pdevinfo;
+   struct hdaa_devinfo *devinfo = pdevinfo-devinfo;
+   struct hdaa_chan *ch;
+   int error, val, i;
+   uint32_t pcmcap;
+
+   ch = devinfo-chans[as-chans[0]];
+   val = (ch-bit32 == 4) ? 32 : ((ch-bit32 == 3) ? 24 :
+   ((ch-bit32 == 2) ? 20 : 0));
+   error = sysctl_handle_int(oidp, val, 0, req);
+   if (error != 0 || req-newptr == NULL)
+   return (error);
+   pcmcap = ch-supp_pcm_size_rate;
+   if (val == 32  HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(pcmcap))
+   ch-bit32 = 4;
+   else if (val == 24  HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(pcmcap))
+   ch-bit32 = 3;
+   else if (val == 20  HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT(pcmcap))
+   ch-bit32 = 2;
+   else
+   return (EINVAL);
+   for (i = 1; i  as-num_chans; i++)
+   devinfo-chans[as-chans[i]].bit32 = ch-bit32;
+   return (0);
+}
+
+static int
 hdaa_pcm_probe(device_t dev)
 {
struct hdaa_pcm_devinfo *pdevinfo =
@@ -6500,6 +6530,7 @@ hdaa_pcm_attach(device_t dev)
(struct hdaa_pcm_devinfo *)device_get_ivars(dev);
struct hdaa_devinfo *devinfo = pdevinfo-devinfo;
struct hdaa_audio_as *as;
+   struct snddev_info *d;
char status[SND_STATUSLEN];
int i;
 
@@ -6576,17 +6607,28 @@ hdaa_pcm_attach(device_t dev)
 
pdevinfo-registered++;
 
+   d = device_get_softc(dev);
if (pdevinfo-playas = 0) {
as = devinfo-as[pdevinfo-playas];
for (i = 0; i  as-num_chans; i++)
pcm_addchan(dev, PCMDIR_PLAY, hdaa_channel_class,
devinfo-chans[as-chans[i]]);
+   SYSCTL_ADD_PROC(d-play_sysctl_ctx,
+   SYSCTL_CHILDREN(d-play_sysctl_tree), OID_AUTO,
+   32bit, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
+   as, sizeof(as), hdaa_sysctl_32bit, I,
+   Resolution of 32bit samples (20/24/32bit));
}
if (pdevinfo-recas = 0) {
as = devinfo-as[pdevinfo-recas];
for (i = 0; i  as-num_chans; i++)
pcm_addchan(dev, PCMDIR_REC, hdaa_channel_class,
devinfo-chans[as-chans[i]]);
+   SYSCTL_ADD_PROC(d-rec_sysctl_ctx,
+   SYSCTL_CHILDREN(d-rec_sysctl_tree), OID_AUTO,
+   32bit, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
+   as, sizeof(as), hdaa_sysctl_32bit, I,
+   Resolution of 32bit samples (20/24/32bit));

svn commit: r230489 - head/sys/kern

2012-01-23 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 23 17:09:23 2012
New Revision: 230489
URL: http://svn.freebsd.org/changeset/base/230489

Log:
  Apparently, both nfs clients do not use cache_enter_time()
  consistently, creating some namecache entries without NCF_TS flag.
  This causes panic due to failed assertion.
  
  As a temporal relief, remove the assert. Return epoch timestamp for
  the entries without timestamp if asked.
  
  While there, consolidate the code which returns timestamps, into a
  helper cache_out_ts().
  
  Discussed with:jhb
  MFC after: 2 weeks

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Mon Jan 23 17:05:11 2012(r230488)
+++ head/sys/kern/vfs_cache.c   Mon Jan 23 17:09:23 2012(r230489)
@@ -233,6 +233,24 @@ nc_get_name(struct namecache *ncp)
return (ncp_ts-nc_name);
 }
 
+static void
+cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp)
+{
+
+   if ((ncp-nc_flag  NCF_TS) == 0) {
+   if (tsp != NULL)
+   bzero(tsp, sizeof(*tsp));
+   if (ticksp != NULL)
+   *ticksp = 0;
+   return;
+   }
+
+   if (tsp != NULL)
+   *tsp = ((struct namecache_ts *)ncp)-nc_time;
+   if (ticksp != NULL)
+   *ticksp = ((struct namecache_ts *)ncp)-nc_ticks;
+}
+
 static int doingcache = 1; /* 1 = enable the cache */
 SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, doingcache, 0,
 VFS namecache enabled);
@@ -506,17 +524,7 @@ retry_wlocked:
dvp, cnp-cn_nameptr, *vpp);
SDT_PROBE(vfs, namecache, lookup, hit, dvp, ..,
*vpp, 0, 0);
-   if (tsp != NULL) {
-   KASSERT((ncp-nc_flag  NCF_TS) != 0,
-   (No NCF_TS));
-   *tsp = ((struct namecache_ts *)ncp)-nc_time;
-   }
-   if (ticksp != NULL) {
-   KASSERT((ncp-nc_flag  NCF_TS) != 0,
-   (No NCF_TS));
-   *ticksp = ((struct namecache_ts *)ncp)-
-   nc_ticks;
-   }
+   cache_out_ts(ncp, tsp, ticksp);
goto success;
}
}
@@ -563,14 +571,7 @@ retry_wlocked:
dvp, cnp-cn_nameptr, *vpp, ncp);
SDT_PROBE(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp),
*vpp, 0, 0);
-   if (tsp != NULL) {
-   KASSERT((ncp-nc_flag  NCF_TS) != 0, (No NCF_TS));
-   *tsp = ((struct namecache_ts *)ncp)-nc_time;
-   }
-   if (ticksp != NULL) {
-   KASSERT((ncp-nc_flag  NCF_TS) != 0, (No NCF_TS));
-   *ticksp = ((struct namecache_ts *)ncp)-nc_ticks;
-   }
+   cache_out_ts(ncp, tsp, ticksp);
goto success;
}
 
@@ -602,14 +603,7 @@ negative_success:
cnp-cn_flags |= ISWHITEOUT;
SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, nc_get_name(ncp),
0, 0, 0);
-   if (tsp != NULL) {
-   KASSERT((ncp-nc_flag  NCF_TS) != 0, (No NCF_TS));
-   *tsp = ((struct namecache_ts *)ncp)-nc_time;
-   }
-   if (ticksp != NULL) {
-   KASSERT((ncp-nc_flag  NCF_TS) != 0, (No NCF_TS));
-   *ticksp = ((struct namecache_ts *)ncp)-nc_ticks;
-   }
+   cache_out_ts(ncp, tsp, ticksp);
CACHE_WUNLOCK();
return (ENOENT);
 
@@ -797,8 +791,8 @@ cache_enter_time(dvp, vp, cnp, tsp)
n2-nc_nlen == cnp-cn_namelen 
!bcmp(nc_get_name(n2), cnp-cn_nameptr, n2-nc_nlen)) {
if (tsp != NULL) {
-   KASSERT((n2-nc_flag  NCF_TS) != 0,
-   (no NCF_TS));
+   if ((n2-nc_flag  NCF_TS) == 0)
+   continue;
n3 = (struct namecache_ts *)n2;
n3-nc_time =
((struct namecache_ts *)ncp)-nc_time;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r226113 - head/sys/netinet

2012-01-23 Thread Andre Oppermann

On 23.01.2012 15:24, Lawrence Stewart wrote:

Hi Andre,

On 10/08/11 03:39, Andre Oppermann wrote:

Author: andre
Date: Fri Oct 7 16:39:03 2011
New Revision: 226113
URL: http://svn.freebsd.org/changeset/base/226113

Log:
Prevent TCP sessions from stalling indefinitely in reassembly
when reaching the zone limit of reassembly queue entries.


[snip]

Any reason this was not MFCed to stable/8 and stable/7 when you MFCed to 
stable/9? As far as I can
tell, both r226113 and r228016 need to be MFCed to 8 and 7.


Thanks for the reminder.  Test build for MFC is under way, including your later
fixup.  I'll send it to you for review to make sure everything's correct.

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


Re: svn commit: r230252 - head/sys/fs/tmpfs

2012-01-23 Thread Mikolaj Golub

On Mon, 23 Jan 2012 17:34:57 +0200 Jaakko Heinonen wrote:

 JH On 2012-01-22, Mikolaj Golub wrote:
  Also, may be we should allow remounting ro (and may be some othe options) 
  for
  tmpfs?

 JH Yes, the patch below does that. I suspect that flipping the MNT_RDONLY
 JH flag may be enough for tmpfs but I am not sure.

I see two issues with this patch:

1) 'mount -u -o rw /mnt' does not upgrade to rw, although it returns success.

2) if you have a file open for write, after remounting ro you still can write
to the file. The expected behaviour: remount fails with EBUSY if force option
is not specified; after remounting with force writing to the fail fails with 
EIO.

I think when remounting ro you should call vflush(), something like below:

flags = WRITECLOSE;
if (mp-mnt_flag  MNT_FORCE)
flags |= FORCECLOSE;
error = vflush(mp, 0, flags, curthread);
if (error != 0)
return (error);
MNT_ILOCK(mp);
mp-mnt_flag |= MNT_RDONLY;
MNT_IUNLOCK(mp);

and when upgrading to rw reset MNT_RDONLY flag:

MNT_ILOCK(mp);
mp-mnt_flag = ~MNT_RDONLY;
MNT_IUNLOCK(mp);

I have no idea if something else is needed for tmpfs.

   JH %%%
   JH Index: sys/fs/tmpfs/tmpfs_vfsops.c
   JH ===
   JH --- sys/fs/tmpfs/tmpfs_vfsops.c(revision 230328)
   JH +++ sys/fs/tmpfs/tmpfs_vfsops.c(working copy)
   JH @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = {
   JH  NULL
   JH  };
   JH  
   JH +static const char *tmpfs_updateopts[] = {
   JH +from, export, NULL
   JH +};
   JH +
   JH  /* 
  - */
   JH  
   JH  static int
   JH @@ -150,12 +154,10 @@ tmpfs_mount(struct mount *mp)
   JH  return (EINVAL);
   JH  
   JH  if (mp-mnt_flag  MNT_UPDATE) {
   JH -/*
   JH - * Only support update mounts for NFS export.
   JH - */
   JH -if (vfs_flagopt(mp-mnt_optnew, export, NULL, 0))
   JH -return (0);
   JH -return (EOPNOTSUPP);
   JH +/* Only support update mounts for certain options. */
   JH +if (vfs_filteropt(mp-mnt_optnew, tmpfs_updateopts) 
  != 0)
   JH +return (EOPNOTSUPP);
   JH +return (0);
   JH  }
   JH  
   JH  vn_lock(mp-mnt_vnodecovered, LK_SHARED | LK_RETRY);
   JH %%%

 JH -- 
 JH Jaakko

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


Re: svn commit: r228424 - in head/sys: kern sys

2012-01-23 Thread Florian Smeets
On 11.12.11 22:02, Andriy Gapon wrote:
 Author: avg
 Date: Sun Dec 11 21:02:01 2011
 New Revision: 228424
 URL: http://svn.freebsd.org/changeset/base/228424
 
 Log:
   panic: add a switch and infrastructure for stopping other CPUs in SMP case
   

Hi,

Attilio asked me to verify that this commit does not introduce a
performance regression.

The box used to run these tests was a 40 Core 32GB Xeon box (HTT was
turned off, so 40 real hardware cores). As benchmark pgbench/PostgreSQL
were used, a snapshot of PostgreSQL 9.2 from 16.01.2012 was used as they
did a lot of scaling work in 9.2 which improved the numbers quite a lot
vs. 9.1. The initial benchmarks were run with a scaling factor of 100
which creates a database work set of ~1.5GB. Max throughput was achieved
at 20 Clients.

x 228423-20
+ 228424-20
+--+
|   x  +   |
|x  x   x  +*  +  +  xxx  * ++ ++ x|
| |___A__M_|   |
||___AM_|  |
+--+
N   Min   MaxMedian   AvgStddev
x  10 111073.26 115016.79 113113.49 112745.69 1169.2132
+  10 112583.56 114454.33 113668.08 113343.31 661.31761
No difference proven at 95.0% confidence

At 40 threads the results varied between 43000 - 76500 across reboots.
Attilio suspects that this can be caused by the kernel memory layout
changing under the woods creating cache effects difficult to control,
therefor the scaling factor was reduced to 10 (~150MB work set) and the
numbers got deterministic across reboot.

x 228423-40-sf10
+ 228424-40-sf10
* 228424-40-sf10-cl
+--+
|x  x  x  *** * *+  x **+  *+ * * ** + +  +|
|   |__A__||
||__MA||
||__A__M___|   |
+--+
N   Min   MaxMedian   AvgStddev
x  10 192489.43 196045.39 194138.34 194149.19 986.61561
+  10 194093.35 198864.83 196129.36 196214.69 1545.8783
Difference at 95.0% confidence
2065.5 +/- 1218.43
1.06387% +/- 0.627572%
(Student's t, pooled s = 1296.76)
*  10 194288.28 197083.85 195955.26 195733.15 1012.3529
Difference at 95.0% confidence
1583.96 +/- 939.189
0.815847% +/- 0.483746%
(Student's t, pooled s = 999.567)

The 228424-40-sf10-cl results are with a patch from Attilio [1] which he
will followup on.

If anybody wants to look at the raw numbers they are available at [2].

There are results for pbzip2 runs here [3] also, the numbers are real
time from /usr/bin/time.

Cheers,
Florian

[1] http://people.freebsd.org/~attilio/cachelineunshare.patch
[2] http://tb.smeets.im/~flo/stop-sched/pgsql/
[3] http://tb.smeets.im/~flo/stop-sched/pbzip2/



signature.asc
Description: OpenPGP digital signature


svn commit: r230493 - head/sys/dev/ath

2012-01-23 Thread Adrian Chadd
Author: adrian
Date: Tue Jan 24 06:12:48 2012
New Revision: 230493
URL: http://svn.freebsd.org/changeset/base/230493

Log:
  Fix up some style(9) indenting and reorganise some of the hal methods.
  
  There should be no functional change due to this commit.

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

Modified: head/sys/dev/ath/if_athvar.h
==
--- head/sys/dev/ath/if_athvar.hTue Jan 24 06:07:05 2012
(r230492)
+++ head/sys/dev/ath/if_athvar.hTue Jan 24 06:12:48 2012
(r230493)
@@ -874,11 +874,14 @@ void  ath_intr(void *);
 #defineath_hal_settpcts(_ah, _tpcts) \
ath_hal_setcapability(_ah, HAL_CAP_TPC_CTS, 0, _tpcts, NULL)
 #defineath_hal_hasintmit(_ah) \
-   (ath_hal_getcapability(_ah, HAL_CAP_INTMIT, HAL_CAP_INTMIT_PRESENT, 
NULL) == HAL_OK)
+   (ath_hal_getcapability(_ah, HAL_CAP_INTMIT, \
+   HAL_CAP_INTMIT_PRESENT, NULL) == HAL_OK)
 #defineath_hal_getintmit(_ah) \
-   (ath_hal_getcapability(_ah, HAL_CAP_INTMIT, HAL_CAP_INTMIT_ENABLE, 
NULL) == HAL_OK)
+   (ath_hal_getcapability(_ah, HAL_CAP_INTMIT, \
+   HAL_CAP_INTMIT_ENABLE, NULL) == HAL_OK)
 #defineath_hal_setintmit(_ah, _v) \
-   ath_hal_setcapability(_ah, HAL_CAP_INTMIT, HAL_CAP_INTMIT_ENABLE, _v, 
NULL)
+   ath_hal_setcapability(_ah, HAL_CAP_INTMIT, \
+   HAL_CAP_INTMIT_ENABLE, _v, NULL)
 #defineath_hal_getchannoise(_ah, _c) \
((*(_ah)-ah_getChanNoise)((_ah), (_c)))
 #defineath_hal_getrxchainmask(_ah, _prxchainmask) \
@@ -886,14 +889,16 @@ void  ath_intr(void *);
 #defineath_hal_gettxchainmask(_ah, _ptxchainmask) \
(ath_hal_getcapability(_ah, HAL_CAP_TX_CHAINMASK, 0, _ptxchainmask))
 #defineath_hal_split4ktrans(_ah) \
-   (ath_hal_getcapability(_ah, HAL_CAP_SPLIT_4KB_TRANS, 0, NULL) == HAL_OK)
+   (ath_hal_getcapability(_ah, HAL_CAP_SPLIT_4KB_TRANS, \
+   0, NULL) == HAL_OK)
 #defineath_hal_self_linked_final_rxdesc(_ah) \
-   (ath_hal_getcapability(_ah, HAL_CAP_RXDESC_SELFLINK, 0, NULL) == HAL_OK)
+   (ath_hal_getcapability(_ah, HAL_CAP_RXDESC_SELFLINK, \
+   0, NULL) == HAL_OK)
 #defineath_hal_gtxto_supported(_ah) \
(ath_hal_getcapability(_ah, HAL_CAP_GTXTO, 0, NULL) == HAL_OK)
 #defineath_hal_has_long_rxdesc_tsf(_ah) \
-   (ath_hal_getcapability(_ah, HAL_CAP_LONG_RXDESC_TSF, 0, NULL) == HAL_OK)
-
+   (ath_hal_getcapability(_ah, HAL_CAP_LONG_RXDESC_TSF, \
+   0, NULL) == HAL_OK)
 #defineath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \
((*(_ah)-ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq)))
 #defineath_hal_rxprocdesc(_ah, _ds, _dspa, _dsnext, _rs) \
@@ -945,6 +950,15 @@ void   ath_intr(void *);
 #defineath_hal_clr11n_aggr(_ah, _ds) \
((*(_ah)-ah_clr11nAggr)((_ah), (_ds)))
 
+#defineath_hal_gpioCfgOutput(_ah, _gpio, _type) \
+   ((*(_ah)-ah_gpioCfgOutput)((_ah), (_gpio), (_type)))
+#defineath_hal_gpioset(_ah, _gpio, _b) \
+   ((*(_ah)-ah_gpioSet)((_ah), (_gpio), (_b)))
+#defineath_hal_gpioget(_ah, _gpio) \
+   ((*(_ah)-ah_gpioGet)((_ah), (_gpio)))
+#defineath_hal_gpiosetintr(_ah, _gpio, _b) \
+   ((*(_ah)-ah_gpioSetIntr)((_ah), (_gpio), (_b)))
+
 /*
  * This is badly-named; you need to set the correct parameters
  * to begin to receive useful radar events; and even then
@@ -956,21 +970,13 @@ void  ath_intr(void *);
 #defineath_hal_getdfsthresh(_ah, _param) \
((*(_ah)-ah_getDfsThresh)((_ah), (_param)))
 #defineath_hal_procradarevent(_ah, _rxs, _fulltsf, _buf, _event) \
-   ((*(_ah)-ah_procRadarEvent)((_ah), (_rxs), (_fulltsf), (_buf), 
(_event)))
+   ((*(_ah)-ah_procRadarEvent)((_ah), (_rxs), (_fulltsf), \
+   (_buf), (_event)))
 #defineath_hal_is_fast_clock_enabled(_ah) \
((*(_ah)-ah_isFastClockEnabled)((_ah)))
-
-#define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \
-((*(_ah)-ah_gpioCfgOutput)((_ah), (_gpio), (_type)))
-#define ath_hal_gpioset(_ah, _gpio, _b) \
-((*(_ah)-ah_gpioSet)((_ah), (_gpio), (_b)))
-#define ath_hal_gpioget(_ah, _gpio) \
-((*(_ah)-ah_gpioGet)((_ah), (_gpio)))
-#define ath_hal_gpiosetintr(_ah, _gpio, _b) \
-((*(_ah)-ah_gpioSetIntr)((_ah), (_gpio), (_b)))
-#define ath_hal_radar_wait(_ah, _chan) \
+#defineath_hal_radar_wait(_ah, _chan) \
((*(_ah)-ah_radarWait)((_ah), (_chan)))
-#define ath_hal_get_chan_ext_busy(_ah) \
+#defineath_hal_get_chan_ext_busy(_ah) \
((*(_ah)-ah_get11nExtBusy)((_ah)))
 
 #endif /* _DEV_ATH_ATHVAR_H */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r230494 - head/sys/netinet6

2012-01-23 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Jan 24 06:21:38 2012
New Revision: 230494
URL: http://svn.freebsd.org/changeset/base/230494

Log:
  Remove unnecessary line break.
  
  MFC after:3 days

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Tue Jan 24 06:12:48 2012(r230493)
+++ head/sys/netinet6/in6.c Tue Jan 24 06:21:38 2012(r230494)
@@ -1387,8 +1387,7 @@ in6_purgeaddr(struct ifaddr *ifa)
mltaddr.sin6_family = AF_INET6;
mltaddr.sin6_addr = in6addr_linklocal_allnodes;
 
-   if ((error = in6_setscope(mltaddr.sin6_addr, ifp, NULL)) !=
-   0)
+   if ((error = in6_setscope(mltaddr.sin6_addr, ifp, NULL)) != 0)
goto cleanup; 
 
rt = rtalloc1((struct sockaddr *)mltaddr, 0, 0UL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org