Re: svn commit: r243714 - in head/sys/dev: ixgbe netmap

2012-12-01 Thread Jack Vogel
On Sat, Dec 1, 2012 at 12:40 AM, Andre Oppermann  wrote:

> On 30.11.2012 23:19, Jack F Vogel wrote:
>
>> Author: jfv
>> Date: Fri Nov 30 22:19:18 2012
>> New Revision: 243714
>> URL: 
>> http://svnweb.freebsd.org/**changeset/base/243714
>>
>> Log:
>>First of a series of 11 patches leading to new ixgbe version 2.5.0
>>This removes the header split and supporting code from the driver.
>>
>
> You did this because the datasheet says the header split feature is
> not supported and using it gives unpredictable results?
>

I'm not sure what the datasheet says, but yes there is a hardware issue
on some of the 10G adapters if using header split. I have left the code in
in a disabled state for a long time, thinking it would be there as example
code, but I think it best to remove it and simplify the code at this point.
Oh, and yes, results have always been mixed with the feature in my
experience anyway.

Regards,

Jack
___
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: r243714 - in head/sys/dev: ixgbe netmap

2012-12-01 Thread Andre Oppermann

On 01.12.2012 10:48, Jack Vogel wrote:



On Sat, Dec 1, 2012 at 12:40 AM, Andre Oppermann mailto:an...@freebsd.org>> wrote:

On 30.11.2012 23:19, Jack F Vogel wrote:

Author: jfv
Date: Fri Nov 30 22:19:18 2012
New Revision: 243714
URL: http://svnweb.freebsd.org/__changeset/base/243714


Log:
First of a series of 11 patches leading to new ixgbe version 2.5.0
This removes the header split and supporting code from the driver.


You did this because the datasheet says the header split feature is
not supported and using it gives unpredictable results?


I'm not sure what the datasheet says, but yes there is a hardware issue
on some of the 10G adapters if using header split. I have left the code in
in a disabled state for a long time, thinking it would be there as example
code, but I think it best to remove it and simplify the code at this point.


It says so in section 7.1.10 Header Splitting:
 Note: Header Splitting mode might cause unpredictable behavior and should not
 be used with the 82599. For more information, see the product specification
 update errata on this subject.


Oh, and yes, results have always been mixed with the feature in my
experience anyway.


I can imagine.  Considering how we work with the packet through the stack
and in the socket buffers there isn't much benefit from header splitting.

--
Andre

___
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: r243750 - in head/contrib/openbsm: . bin bin/audit bin/auditd bin/auditdistd bin/auditfilterd bin/auditreduce bin/praudit bsm compat config etc libauditd libbsm m4 man modules modules/a...

2012-12-01 Thread Robert Watson
Author: rwatson
Date: Sat Dec  1 11:58:08 2012
New Revision: 243750
URL: http://svnweb.freebsd.org/changeset/base/243750

Log:
  Merge OpenBSM 1.2-alpha2 from vendor branch to FreeBSD 10-CURRENT; the
  primary new feature is auditdistd.
  
  Obtained from:TrustedBSD Project
  Sponsored by: The FreeBSD Foundation (auditdistd)

Added:
  head/contrib/openbsm/bin/auditdistd/
 - copied from r243735, vendor/openbsm/dist/bin/auditdistd/
  head/contrib/openbsm/compat/closefrom.h
 - copied unchanged from r243735, vendor/openbsm/dist/compat/closefrom.h
  head/contrib/openbsm/compat/compat.h
 - copied unchanged from r243735, vendor/openbsm/dist/compat/compat.h
  head/contrib/openbsm/compat/endian_enc.h
 - copied unchanged from r243735, vendor/openbsm/dist/compat/endian_enc.h
  head/contrib/openbsm/compat/flopen.h
 - copied unchanged from r243735, vendor/openbsm/dist/compat/flopen.h
  head/contrib/openbsm/compat/pidfile.h
 - copied unchanged from r243735, vendor/openbsm/dist/compat/pidfile.h
  head/contrib/openbsm/compat/vis.h
 - copied unchanged from r243735, vendor/openbsm/dist/compat/vis.h
  head/contrib/openbsm/config/ylwrap
 - copied unchanged from r243735, vendor/openbsm/dist/config/ylwrap
  head/contrib/openbsm/m4/
 - copied from r243735, vendor/openbsm/dist/m4/
Modified:
  head/contrib/openbsm/CREDITS
  head/contrib/openbsm/INSTALL
  head/contrib/openbsm/LICENSE
  head/contrib/openbsm/Makefile.am
  head/contrib/openbsm/Makefile.in
  head/contrib/openbsm/NEWS
  head/contrib/openbsm/README
  head/contrib/openbsm/TODO
  head/contrib/openbsm/VERSION
  head/contrib/openbsm/aclocal.m4
  head/contrib/openbsm/autogen.sh
  head/contrib/openbsm/bin/Makefile.am
  head/contrib/openbsm/bin/Makefile.in
  head/contrib/openbsm/bin/audit/Makefile.am
  head/contrib/openbsm/bin/audit/Makefile.in
  head/contrib/openbsm/bin/audit/audit.8
  head/contrib/openbsm/bin/auditd/Makefile.am
  head/contrib/openbsm/bin/auditd/Makefile.in
  head/contrib/openbsm/bin/auditd/auditd.8
  head/contrib/openbsm/bin/auditd/auditd.c
  head/contrib/openbsm/bin/auditfilterd/Makefile.am
  head/contrib/openbsm/bin/auditfilterd/Makefile.in
  head/contrib/openbsm/bin/auditreduce/Makefile.am
  head/contrib/openbsm/bin/auditreduce/Makefile.in
  head/contrib/openbsm/bin/auditreduce/auditreduce.1
  head/contrib/openbsm/bin/praudit/Makefile.am
  head/contrib/openbsm/bin/praudit/Makefile.in
  head/contrib/openbsm/bin/praudit/praudit.1
  head/contrib/openbsm/bin/praudit/praudit.c
  head/contrib/openbsm/bsm/Makefile.am
  head/contrib/openbsm/bsm/Makefile.in
  head/contrib/openbsm/bsm/auditd_lib.h
  head/contrib/openbsm/bsm/libbsm.h
  head/contrib/openbsm/compat/endian.h
  head/contrib/openbsm/config/config.h
  head/contrib/openbsm/config/config.h.in
  head/contrib/openbsm/config/ltmain.sh
  head/contrib/openbsm/configure
  head/contrib/openbsm/configure.ac
  head/contrib/openbsm/etc/audit_control
  head/contrib/openbsm/etc/audit_event
  head/contrib/openbsm/libauditd/Makefile.am
  head/contrib/openbsm/libauditd/Makefile.in
  head/contrib/openbsm/libauditd/auditd_lib.c
  head/contrib/openbsm/libbsm/Makefile.am
  head/contrib/openbsm/libbsm/Makefile.in
  head/contrib/openbsm/libbsm/au_control.3
  head/contrib/openbsm/libbsm/au_fcntl_cmd.3
  head/contrib/openbsm/libbsm/au_io.3
  head/contrib/openbsm/libbsm/audit_submit.3
  head/contrib/openbsm/libbsm/bsm_audit.c
  head/contrib/openbsm/libbsm/bsm_class.c
  head/contrib/openbsm/libbsm/bsm_control.c
  head/contrib/openbsm/libbsm/bsm_errno.c
  head/contrib/openbsm/libbsm/bsm_io.c
  head/contrib/openbsm/libbsm/bsm_token.c
  head/contrib/openbsm/libbsm/bsm_user.c
  head/contrib/openbsm/libbsm/bsm_wrappers.c
  head/contrib/openbsm/man/Makefile.am
  head/contrib/openbsm/man/Makefile.in
  head/contrib/openbsm/man/audit.log.5
  head/contrib/openbsm/man/audit_control.5
  head/contrib/openbsm/man/auditon.2
  head/contrib/openbsm/man/getaudit.2
  head/contrib/openbsm/man/setaudit.2
  head/contrib/openbsm/modules/Makefile.am
  head/contrib/openbsm/modules/Makefile.in
  head/contrib/openbsm/modules/auditfilter_noop/Makefile.am
  head/contrib/openbsm/modules/auditfilter_noop/Makefile.in
  head/contrib/openbsm/sys/Makefile.am
  head/contrib/openbsm/sys/Makefile.in
  head/contrib/openbsm/sys/bsm/Makefile.am
  head/contrib/openbsm/sys/bsm/Makefile.in
  head/contrib/openbsm/sys/bsm/audit_errno.h
  head/contrib/openbsm/sys/bsm/audit_internal.h
  head/contrib/openbsm/sys/bsm/audit_kevents.h
  head/contrib/openbsm/test/Makefile.am
  head/contrib/openbsm/test/Makefile.in
  head/contrib/openbsm/test/bsm/Makefile.am
  head/contrib/openbsm/test/bsm/Makefile.in
  head/contrib/openbsm/tools/Makefile.am
  head/contrib/openbsm/tools/Makefile.in
Directory Properties:
  head/contrib/openbsm/   (props changed)

Modified: head/contrib/openbsm/CREDITS
==
--- head/contrib/openbsm/CREDITSSat Dec  1 11:12:04 2012
(r243749)

svn commit: r243751 - in head/sys: bsm security/audit

2012-12-01 Thread Robert Watson
Author: rwatson
Date: Sat Dec  1 13:46:37 2012
New Revision: 243751
URL: http://svnweb.freebsd.org/changeset/base/243751

Log:
  Merge OpenBSM 1.2-alpha2 changes from contrib/openbsm to
  src/sys/{bsm,security/audit}.  There are a few tweaks to help with the
  FreeBSD build environment that will be merged back to OpenBSM.  No
  significant functional changes appear on the kernel side.
  
  Obtained from:TrustedBSD Project
  Sponsored by: The FreeBSD Foundation (auditdistd)

Modified:
  head/sys/bsm/audit_errno.h
  head/sys/bsm/audit_internal.h
  head/sys/bsm/audit_record.h
  head/sys/security/audit/audit_bsm_errno.c
  head/sys/security/audit/audit_bsm_token.c

Modified: head/sys/bsm/audit_errno.h
==
--- head/sys/bsm/audit_errno.h  Sat Dec  1 11:58:08 2012(r243750)
+++ head/sys/bsm/audit_errno.h  Sat Dec  1 13:46:37 2012(r243751)
@@ -26,7 +26,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE. 
  *
- * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#5
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#7
  * $FreeBSD$
  */
 

Modified: head/sys/bsm/audit_internal.h
==
--- head/sys/bsm/audit_internal.h   Sat Dec  1 11:58:08 2012
(r243750)
+++ head/sys/bsm/audit_internal.h   Sat Dec  1 13:46:37 2012
(r243751)
@@ -15,7 +15,7 @@
  * 2.  Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
  * its contributors may be used to endorse or promote products derived
  * from this software without specific prior written permission.
  *
@@ -30,7 +30,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#5
+ * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#6
  * $FreeBSD$
  */
 

Modified: head/sys/bsm/audit_record.h
==
--- head/sys/bsm/audit_record.h Sat Dec  1 11:58:08 2012(r243750)
+++ head/sys/bsm/audit_record.h Sat Dec  1 13:46:37 2012(r243751)
@@ -234,6 +234,7 @@ token_t *au_to_ipc_perm(struct ipc_perm 
 token_t*au_to_iport(uint16_t iport);
 token_t*au_to_opaque(const char *data, uint16_t bytes);
 token_t*au_to_path(const char *path);
+token_t*au_to_privset(char *privtypestr, char *privstr);
 token_t*au_to_process(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);
 token_t*au_to_process32(au_id_t auid, uid_t euid, gid_t egid, uid_t 
ruid,
@@ -279,6 +280,7 @@ token_t *au_to_exec_env(char **envp);
 token_t*au_to_text(const char *text);
 token_t*au_to_kevent(struct kevent *kev);
 token_t*au_to_trailer(int rec_size);
+token_t*au_to_upriv(char sorf, char *priv);
 token_t*au_to_zonename(const char *zonename);
 
 /*

Modified: head/sys/security/audit/audit_bsm_errno.c
==
--- head/sys/security/audit/audit_bsm_errno.c   Sat Dec  1 11:58:08 2012
(r243750)
+++ head/sys/security/audit/audit_bsm_errno.c   Sat Dec  1 13:46:37 2012
(r243751)
@@ -26,7 +26,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE. 
  *
- * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#18
+ * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#22
  */
 
 #include 
@@ -494,7 +494,7 @@ static const struct bsm_errno bsm_errnos
 #ifdef EPROCUNAVAIL
EPROCUNAVAIL,
 #else
-   ERRNO_NO_LOCAL_MAPPING
+   ERRNO_NO_LOCAL_MAPPING,
 #endif
ES("Bad procedure for program") },
{ BSM_ERRNO_EFTYPE,
@@ -666,7 +666,7 @@ static const struct bsm_errno bsm_errnos
 #endif
ES("Required key not available") },
{ BSM_ERRNO_EKEYEXPIRED,
-#ifdef EKEEXPIRED
+#ifdef EKEYEXPIRED
EKEYEXPIRED,
 #else
ERRNO_NO_LOCAL_MAPPING,
@@ -680,7 +680,7 @@ static const struct bsm_errno bsm_errnos
 #endif
ES("Key has been revoked") },
{ BSM_ERRNO_EKEYREJECTED,
-#ifdef EKEREJECTED
+#ifdef EKEYREJECTED
EKEYREJECTED,
 #else
ERRNO_NO_LOCAL_MAPPING,

Modified: head/sys/security/audit/audit_bsm_token.c
==
--- head/sys/security/audit/audit_bsm_token.c   Sat

svn commit: r243752 - in head: etc etc/defaults etc/mail etc/mtree etc/rc.d share/man/man4 usr.sbin usr.sbin/auditdistd

2012-12-01 Thread Robert Watson
Author: rwatson
Date: Sat Dec  1 15:11:46 2012
New Revision: 243752
URL: http://svnweb.freebsd.org/changeset/base/243752

Log:
  Merge a number of changes required to hook up OpenBSM 1.2-alpha2's
  auditdistd (distributed audit daemon) to the build:
  
  - Manual cross references
  - Makefile for auditdistd
  - rc.d script, rc.conf entrie
  - New group and user for auditdistd; associated aliases, etc.
  
  The audit trail distribution daemon provides reliable,
  cryptographically protected (and sandboxed) delivery of audit tails
  from live clients to audit server hosts in order to both allow
  centralised analysis, and improve resilience in the event of client
  compromises: clients are not permitted to change trail contents
  after submission.
  
  Submitted by: pjd
  Sponsored by: The FreeBSD Foundation (auditdistd)

Added:
  head/etc/rc.d/auditdistd   (contents, props changed)
  head/usr.sbin/auditdistd/
  head/usr.sbin/auditdistd/Makefile   (contents, props changed)
Modified:
  head/etc/defaults/rc.conf
  head/etc/ftpusers
  head/etc/mail/aliases
  head/etc/master.passwd
  head/etc/mtree/BSD.var.dist
  head/etc/rc.d/Makefile
  head/share/man/man4/audit.4
  head/usr.sbin/Makefile

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Sat Dec  1 13:46:37 2012(r243751)
+++ head/etc/defaults/rc.conf   Sat Dec  1 15:11:46 2012(r243752)
@@ -590,6 +590,9 @@ sendmail_rebuild_aliases="NO"   # Run newa
 auditd_enable="NO" # Run the audit daemon.
 auditd_program="/usr/sbin/auditd"  # Path to the audit daemon.
 auditd_flags=""# Which options to pass to the audit daemon.
+auditdistd_enable="NO" # Run the audit daemon.
+auditdistd_program="/usr/sbin/auditdistd"  # Path to the auditdistd daemon.
+auditdistd_flags=""# Which options to pass to the auditdistd daemon.
 cron_enable="YES"  # Run the periodic job daemon.
 cron_program="/usr/sbin/cron"  # Which cron executable to run (if enabled).
 cron_dst="YES" # Handle DST transitions intelligently (YES/NO)

Modified: head/etc/ftpusers
==
--- head/etc/ftpusers   Sat Dec  1 13:46:37 2012(r243751)
+++ head/etc/ftpusers   Sat Dec  1 15:11:46 2012(r243752)
@@ -19,6 +19,7 @@ _pflogd
 _dhcp
 uucp
 pop
+auditdistd
 www
 hast
 nobody

Modified: head/etc/mail/aliases
==
--- head/etc/mail/aliases   Sat Dec  1 13:46:37 2012(r243751)
+++ head/etc/mail/aliases   Sat Dec  1 15:11:46 2012(r243752)
@@ -26,6 +26,7 @@ postmaster: root
 # General redirections for pseudo accounts
 _dhcp: root
 _pflogd: root
+auditdistd:root
 bin:   root
 bind:  root
 daemon:root

Modified: head/etc/master.passwd
==
--- head/etc/master.passwd  Sat Dec  1 13:46:37 2012(r243751)
+++ head/etc/master.passwd  Sat Dec  1 15:11:46 2012(r243752)
@@ -20,6 +20,7 @@ _pflogd:*:64:64::0:0:pflogd privsep user
 _dhcp:*:65:65::0:0:dhcp programs:/var/empty:/usr/sbin/nologin
 uucp:*:66:66::0:0:UUCP 
pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico
 pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin
+auditdistd:*:78:77::0:0:Auditdistd unprivileged 
user:/var/empty:/usr/sbin/nologin
 www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
 hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
 nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin

Modified: head/etc/mtree/BSD.var.dist
==
--- head/etc/mtree/BSD.var.dist Sat Dec  1 13:46:37 2012(r243751)
+++ head/etc/mtree/BSD.var.dist Sat Dec  1 15:11:46 2012(r243752)
@@ -19,6 +19,10 @@
 /set gname=audit
 audit
 ..
+distuname=auditdistd gname=audit mode=0770
+..
+remote  uname=auditdistd gname=wheel mode=0700
+..
 /set gname=wheel
 backups
 ..

Modified: head/etc/rc.d/Makefile
==
--- head/etc/rc.d/Makefile  Sat Dec  1 13:46:37 2012(r243751)
+++ head/etc/rc.d/Makefile  Sat Dec  1 15:11:46 2012(r243752)
@@ -19,6 +19,7 @@ FILES=DAEMON \
atm2 \
atm3 \
auditd \
+   auditdistd \
bgfsck \
bluetooth \
bootparams \

Added: head/etc/rc.d/auditdistd
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/rc.d/auditdistdSat Dec  1 15:11:46 2012(r243752)
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: auditdistd
+# RE

svn commit: r243753 - head/lib/libc/stdio

2012-12-01 Thread Eitan Adler
Author: eadler
Date: Sat Dec  1 15:25:41 2012
New Revision: 243753
URL: http://svnweb.freebsd.org/changeset/base/243753

Log:
  The getline function returns the number of characters read, not
  written. Use clearer text for this.
  
  PR:   docs/174023
  Submitted by: Paul Procacci 
  Approved by:  bcr (mentor)
  MFC after:1 week

Modified:
  head/lib/libc/stdio/getline.3

Modified: head/lib/libc/stdio/getline.3
==
--- head/lib/libc/stdio/getline.3   Sat Dec  1 15:11:46 2012
(r243752)
+++ head/lib/libc/stdio/getline.3   Sat Dec  1 15:25:41 2012
(r243753)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 30, 2010
+.Dd November 30, 2012
 .Dt GETLINE 3
 .Os
 .Sh NAME
@@ -76,7 +76,7 @@ The
 .Fn getdelim
 and
 .Fn getline
-functions return the number of characters written, excluding the
+functions return the number of characters stored in the buffer, excluding the
 terminating
 .Dv NUL
 character.
___
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: r243758 - head/lib/libc/gen

2012-12-01 Thread Marcel Moolenaar
Author: marcel
Date: Sat Dec  1 17:44:06 2012
New Revision: 243758
URL: http://svnweb.freebsd.org/changeset/base/243758

Log:
  In globextend() when the pathv vector cannot be (re-)allocated, don't
  free and clear the gl_pathv pointer in the glob_t structure. Such
  breaks the invariant of the glob_t structure, as stated in the comment
  right in front of the globextend() function. If gl_pathv was non-NULL,
  then gl_pathc was > 0. Making gl_pathv a NULL pointer without also
  setting gl_pathc to 0 is wrong.
  
  Since we otherwise don't free the memory associated with a glob_t in
  error cases, it's unlikely that this change will cause a memory leak
  that wasn't already there to begin with. Callers of glob(3) must
  call globfree(3) irrespective of whether glob(3) returned an error
  or not.

Modified:
  head/lib/libc/gen/glob.c

Modified: head/lib/libc/gen/glob.c
==
--- head/lib/libc/gen/glob.cSat Dec  1 16:44:33 2012(r243757)
+++ head/lib/libc/gen/glob.cSat Dec  1 17:44:06 2012(r243758)
@@ -718,13 +718,8 @@ globextend(const Char *path, glob_t *pgl
pathv = pglob->gl_pathv ?
realloc((char *)pglob->gl_pathv, newsize) :
malloc(newsize);
-   if (pathv == NULL) {
-   if (pglob->gl_pathv) {
-   free(pglob->gl_pathv);
-   pglob->gl_pathv = NULL;
-   }
+   if (pathv == NULL)
return (GLOB_NOSPACE);
-   }
 
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
/* first time around -- clear initial gl_offs items */
___
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: r243759 - head/lib/libc/gen

2012-12-01 Thread Marcel Moolenaar
Author: marcel
Date: Sat Dec  1 17:50:39 2012
New Revision: 243759
URL: http://svnweb.freebsd.org/changeset/base/243759

Log:
  In globextend(), take advantage of the fact that realloc(NULL, size) is
  equivalent to malloc(size). This eliminates the conditional expression
  used for calling either realloc() or malloc() when realloc() will do
  all the time.

Modified:
  head/lib/libc/gen/glob.c

Modified: head/lib/libc/gen/glob.c
==
--- head/lib/libc/gen/glob.cSat Dec  1 17:44:06 2012(r243758)
+++ head/lib/libc/gen/glob.cSat Dec  1 17:50:39 2012(r243759)
@@ -715,9 +715,8 @@ globextend(const Char *path, glob_t *pgl
}
 
newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
-   pathv = pglob->gl_pathv ?
-   realloc((char *)pglob->gl_pathv, newsize) :
-   malloc(newsize);
+   /* realloc(NULL, newsize) is equivalent to malloc(newsize). */
+   pathv = realloc((void *)pglob->gl_pathv, newsize);
if (pathv == NULL)
return (GLOB_NOSPACE);
 
___
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: r243760 - head/sys/dev/acpica

2012-12-01 Thread Andriy Gapon
Author: avg
Date: Sat Dec  1 18:01:01 2012
New Revision: 243760
URL: http://svnweb.freebsd.org/changeset/base/243760

Log:
  acpi_cpu: change cpu_disable_idle to be a per-cpu flag...
  
  and make it safe to manipulate and check the flag
  
  With help from:   jhb
  Tested by:trociny, emaste, dumbbell
  MFC after:1 week

Modified:
  head/sys/dev/acpica/acpi_cpu.c

Modified: head/sys/dev/acpica/acpi_cpu.c
==
--- head/sys/dev/acpica/acpi_cpu.c  Sat Dec  1 17:50:39 2012
(r243759)
+++ head/sys/dev/acpica/acpi_cpu.c  Sat Dec  1 18:01:01 2012
(r243760)
@@ -92,6 +92,7 @@ struct acpi_cpu_softc {
 struct sysctl_oid  *cpu_sysctl_tree;
 int cpu_cx_lowest;
 int cpu_cx_lowest_lim;
+int cpu_disable_idle; /* Disable entry to idle 
function */
 charcpu_cx_supported[64];
 };
 
@@ -138,9 +139,6 @@ static uint32_t  cpu_smi_cmd;   /* Value 
 static uint8_t  cpu_cst_cnt;   /* Indicate we are _CST aware. */
 static int  cpu_quirks;/* Indicate any hardware bugs. */
 
-/* Runtime state. */
-static int  cpu_disable_idle; /* Disable entry to idle function */
-
 /* Values for sysctl. */
 static struct sysctl_ctx_list cpu_sysctl_ctx;
 static struct sysctl_oid *cpu_sysctl_tree;
@@ -419,6 +417,39 @@ acpi_cpu_postattach(void *unused __unuse
 SYSINIT(acpi_cpu, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE,
 acpi_cpu_postattach, NULL);
 
+static void
+disable_idle(struct acpi_cpu_softc *sc)
+{
+cpuset_t cpuset;
+
+CPU_SETOF(sc->cpu_pcpu->pc_cpuid, &cpuset);
+sc->cpu_disable_idle = TRUE;
+
+/*
+ * Ensure that the CPU is not in idle state or in acpi_cpu_idle().
+ * Note that this code depends on the fact that the rendezvous IPI
+ * can not penetrate context where interrupts are disabled and 
acpi_cpu_idle
+ * is called and executed in such a context with interrupts being 
re-enabled
+ * right before return.
+ */
+smp_rendezvous_cpus(cpuset, smp_no_rendevous_barrier, NULL,
+   smp_no_rendevous_barrier, NULL);
+}
+
+static void
+enable_idle(struct acpi_cpu_softc *sc)
+{
+
+sc->cpu_disable_idle = FALSE;
+}
+
+static int
+is_idle_disabled(struct acpi_cpu_softc *sc)
+{
+
+return (sc->cpu_disable_idle);
+}
+
 /*
  * Disable any entry to the idle function during suspend and re-enable it
  * during resume.
@@ -431,7 +462,7 @@ acpi_cpu_suspend(device_t dev)
 error = bus_generic_suspend(dev);
 if (error)
return (error);
-cpu_disable_idle = TRUE;
+disable_idle(device_get_softc(dev));
 return (0);
 }
 
@@ -439,7 +470,7 @@ static int
 acpi_cpu_resume(device_t dev)
 {
 
-cpu_disable_idle = FALSE;
+enable_idle(device_get_softc(dev));
 return (bus_generic_resume(dev));
 }
 
@@ -573,12 +604,14 @@ acpi_cpu_shutdown(device_t dev)
 bus_generic_shutdown(dev);
 
 /*
- * Disable any entry to the idle function.  There is a small race where
- * an idle thread have passed this check but not gone to sleep.  This
- * is ok since device_shutdown() does not free the softc, otherwise
- * we'd have to be sure all threads were evicted before returning.
+ * Disable any entry to the idle function.
+ */
+disable_idle(device_get_softc(dev));
+
+/*
+ * CPU devices are not truely detached and remain referenced,
+ * so their resources are not freed.
  */
-cpu_disable_idle = TRUE;
 
 return_VALUE (0);
 }
@@ -860,7 +893,10 @@ acpi_cpu_startup(void *arg)
 
 /* Take over idling from cpu_idle_default(). */
 cpu_cx_lowest_lim = 0;
-cpu_disable_idle = FALSE;
+for (i = 0; i < cpu_ndevices; i++) {
+   sc = device_get_softc(cpu_devices[i]);
+   enable_idle(sc);
+}
 cpu_idle_hook = acpi_cpu_idle;
 }
 
@@ -926,12 +962,6 @@ acpi_cpu_idle()
 uint32_t   start_time, end_time;
 intbm_active, cx_next_idx, i;
 
-/* If disabled, return immediately. */
-if (cpu_disable_idle) {
-   ACPI_ENABLE_IRQS();
-   return;
-}
-
 /*
  * Look up our CPU id to get our softc.  If it's NULL, we'll use C1
  * since there is no ACPI processor object for this CPU.  This occurs
@@ -943,6 +973,12 @@ acpi_cpu_idle()
return;
 }
 
+/* If disabled, return immediately. */
+if (is_idle_disabled(sc)) {
+   ACPI_ENABLE_IRQS();
+   return;
+}
+
 /* Find the lowest state that has small enough latency. */
 cx_next_idx = 0;
 if (cpu_disable_deep_sleep)
___
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: r243762 - head/sys/cddl/contrib/opensolaris/uts/common/fs

2012-12-01 Thread Andriy Gapon
Author: avg
Date: Sat Dec  1 18:12:55 2012
New Revision: 243762
URL: http://svnweb.freebsd.org/changeset/base/243762

Log:
  gfs_file_inactive: replace bad code with ugly code
  
  Also, make it explicit that V_XATTRDIR is not properly supported in gfs
  code yet.
  
  The bad code was plain incorrect: (a) it spoiled handling of v_usecount
  reaching zero and (b) it leaked v_holdcnt.
  
  The ugly code employs potentially unsafe locking tricks.
  
  Ideally we should separate vnode lifecycle and gfs node lifecycle.
  A gfs node should have its own reference count where its child nodes
  should be accounted.
  
  PR:   kern/15
  Reviewed by:  kib
  MFC after:13 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Sat Dec  1 
18:06:05 2012(r243761)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Sat Dec  1 
18:12:55 2012(r243762)
@@ -665,8 +665,10 @@ gfs_file_inactive(vnode_t *vp)
ge = NULL;
 
 found:
+#ifdef TODO
if (vp->v_flag & V_XATTRDIR)
VI_LOCK(fp->gfs_parent);
+#endif
VI_LOCK(vp);
/*
 * Really remove this vnode
@@ -687,16 +689,17 @@ found:
if (fp->gfs_parent) {
if (dp)
gfs_dir_unlock(dp);
-   VI_LOCK(fp->gfs_parent);
-   fp->gfs_parent->v_usecount--;
-   VI_UNLOCK(fp->gfs_parent);
+   VOP_UNLOCK(vp, 0);
+   VN_RELE(fp->gfs_parent);
+   vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
} else {
ASSERT(vp->v_vfsp != NULL);
VFS_RELE(vp->v_vfsp);
}
+#ifdef TODO
if (vp->v_flag & V_XATTRDIR)
VI_UNLOCK(fp->gfs_parent);
-
+#endif
return (data);
 }
 
___
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: r243761 - head/sys/dev/acpica

2012-12-01 Thread Andriy Gapon
Author: avg
Date: Sat Dec  1 18:06:05 2012
New Revision: 243761
URL: http://svnweb.freebsd.org/changeset/base/243761

Log:
  acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data
  
  ... to avoid any races or inconsistencies.
  This should fix a regression introduced in r243404.
  
  Also, remove a stale comment that has not been true for quite a while
  now.
  
  Pointyhat to: avg
  Teested by:   trociny, emaste, dumbbell (earlier version)
  MFC after: 1 week

Modified:
  head/sys/dev/acpica/acpi_cpu.c

Modified: head/sys/dev/acpica/acpi_cpu.c
==
--- head/sys/dev/acpica/acpi_cpu.c  Sat Dec  1 18:01:01 2012
(r243760)
+++ head/sys/dev/acpica/acpi_cpu.c  Sat Dec  1 18:06:05 2012
(r243761)
@@ -973,9 +973,9 @@ acpi_cpu_idle()
return;
 }
 
-/* If disabled, return immediately. */
+/* If disabled, take the safe path. */
 if (is_idle_disabled(sc)) {
-   ACPI_ENABLE_IRQS();
+   acpi_cpu_c1();
return;
 }
 
@@ -1081,23 +1081,31 @@ acpi_cpu_idle()
 
 /*
  * Re-evaluate the _CST object when we are notified that it changed.
- *
- * XXX Re-evaluation disabled until locking is done.
  */
 static void
 acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context)
 {
 struct acpi_cpu_softc *sc = (struct acpi_cpu_softc *)context;
-
+
 if (notify != ACPI_NOTIFY_CX_STATES)
return;
 
+/*
+ * C-state data for target CPU is going to be in flux while we execute
+ * acpi_cpu_cx_cst, so disable entering acpi_cpu_idle.
+ * Also, it may happen that multiple ACPI taskqueues may concurrently
+ * execute notifications for the same CPU.  ACPI_SERIAL is used to
+ * protect against that.
+ */
+ACPI_SERIAL_BEGIN(cpu);
+disable_idle(sc);
+
 /* Update the list of Cx states. */
 acpi_cpu_cx_cst(sc);
 acpi_cpu_cx_list(sc);
-
-ACPI_SERIAL_BEGIN(cpu);
 acpi_cpu_set_cx_lowest(sc);
+
+enable_idle(sc);
 ACPI_SERIAL_END(cpu);
 
 acpi_UserNotify("PROCESSOR", sc->cpu_handle, notify);
___
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: r243763 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2012-12-01 Thread Andriy Gapon
Author: avg
Date: Sat Dec  1 18:13:53 2012
New Revision: 243763
URL: http://svnweb.freebsd.org/changeset/base/243763

Log:
  zfs_getpages: make use of vm_page_readahead_finish
  
  Suggested by: kib
  MFC after:5 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 
 1 18:12:55 2012(r243762)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 
 1 18:13:53 2012(r243763)
@@ -5675,27 +5675,11 @@ zfs_getpages(struct vnode *vp, vm_page_t
VM_OBJECT_LOCK(object);
 
for (i = reqstart; i < reqstart + reqsize; i++) {
-   m[i]->valid = VM_PAGE_BITS_ALL;
+   if (!error)
+   m[i]->valid = VM_PAGE_BITS_ALL;
KASSERT(m[i]->dirty == 0, ("zfs_getpages: page %p is dirty", 
m[i]));
-   if (i != reqpage) {
-   if (!error) {
-   if (m[i]->oflags & VPO_WANTED) {
-   vm_page_lock(m[i]);
-   vm_page_activate(m[i]);
-   vm_page_unlock(m[i]);
-   } else {
-   vm_page_lock(m[i]);
-   vm_page_deactivate(m[i]);
-   vm_page_unlock(m[i]);
-   }
-   vm_page_wakeup(m[i]);
-   } else {
-   vm_page_lock(m[i]);
-   vm_page_free(m[i]);
-   vm_page_unlock(m[i]);
-   }
-   }
-
+   if (i != reqpage)
+   vm_page_readahead_finish(m[i]);
}
 
VM_OBJECT_UNLOCK(object);
___
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: r243764 - head/sys/x86/x86

2012-12-01 Thread Andriy Gapon
Author: avg
Date: Sat Dec  1 18:16:14 2012
New Revision: 243764
URL: http://svnweb.freebsd.org/changeset/base/243764

Log:
  ioapic_program_intpin: program high bits before low bits
  
  Programming the low bits has a side-effect if unmasking the pin if it is
  not disabled.  So if an interrupt was pending then it would be delivered
  with the correct new vector but to the incorrect old LAPIC.
  
  This fix could be made clearer by preserving the mask bit while
  programming the low bits and then explicitly resetting the mask bit
  after all the programming is done.
  
  Probability to trip over the fixed bug could be increased by bootverbose
  because printing of the interrupt information in ioapic_assign_cpu
  lengthened the time window during which an interrupt could arrive while
  a pin is masked.
  
  Reported by:  Andreas Longwitz 
  Tested by:Andreas Longwitz 
  MFC after:12 days

Modified:
  head/sys/x86/x86/io_apic.c

Modified: head/sys/x86/x86/io_apic.c
==
--- head/sys/x86/x86/io_apic.c  Sat Dec  1 18:13:53 2012(r243763)
+++ head/sys/x86/x86/io_apic.c  Sat Dec  1 18:16:14 2012(r243764)
@@ -311,12 +311,12 @@ ioapic_program_intpin(struct ioapic_ints
}
 
/* Write the values to the APIC. */
-   intpin->io_lowreg = low;
-   ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low);
value = ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin));
value &= ~IOART_DEST;
value |= high;
ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), value);
+   intpin->io_lowreg = low;
+   ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low);
 }
 
 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: r243779 - head/lib/libc/gen

2012-12-01 Thread Marcel Moolenaar
Author: marcel
Date: Sat Dec  1 21:26:46 2012
New Revision: 243779
URL: http://svnweb.freebsd.org/changeset/base/243779

Log:
  Protect against DoS attacks, such as being described in CVE-2010-2632.
  The changes were derived from what has been committed to NetBSD, with
  modifications. These are:
  1.  Preserve the existsing GLOB_LIMIT behaviour by including the number
  of matches to the set of parameters to limit.
  2.  Change some of the limits to avoid impacting normal use cases:
  GLOB_LIMIT_STRING - change from 65536 to ARG_MAX so that glob(3)
can still provide a full command line of expanded names.
  GLOB_LIMIT_STAT - change from 128 to 1024 for no other reason than
that 128 feels too low (it's not a limit that impacts the
behaviour of the test program listed in CVE-2010-2632).
  GLOB_LIMIT_PATH - change from 1024 to 65536 so that glob(3) can
still provide a fill command line of expanded names.
  3.  Protect against buffer overruns when we hit the GLOB_LIMIT_STAT or
  GLOB_LIMIT_READDIR limits. We append SEP and EOS to pathend in
  those cases. Return GLOB_ABORTED instead of GLOB_NOSPACE when we
  would otherwise overrun the buffer.
  
  This change also modifies the existing behaviour of glob(3) in case
  GLOB_LIMIT is specifies by limiting the *new* matches and not all
  matches. This is an important distinction when GLOB_APPEND is set or
  when the caller uses a non-zero gl_offs. Previously pre-existing
  matches or the value of gl_offs would be counted in the number of
  matches even though the man page states that glob(3) would return
  GLOB_NOSPACE when gl_matchc or more matches were found.
  
  The limits that cannot be circumvented are GLOB_LIMIT_STRING and
  GLOB_LIMIT_PATH all others can be crossed by simply calling glob(3)
  again and with GLOB_APPEND set.
  
  The entire description above applies only when GLOB_LIMIT has been
  specified of course. No limits apply when this flag isn't set!
  
  Obtained from: Juniper Networks, Inc

Modified:
  head/lib/libc/gen/glob.c

Modified: head/lib/libc/gen/glob.c
==
--- head/lib/libc/gen/glob.cSat Dec  1 19:24:27 2012(r243778)
+++ head/lib/libc/gen/glob.cSat Dec  1 21:26:46 2012(r243779)
@@ -94,6 +94,25 @@ __FBSDID("$FreeBSD$");
 
 #include "collate.h"
 
+/*
+ * glob(3) expansion limits. Stop the expansion if any of these limits
+ * is reached. This caps the runtime in the face of DoS attacks. See
+ * also CVE-2010-2632
+ */
+#defineGLOB_LIMIT_BRACE128 /* number of brace calls */
+#defineGLOB_LIMIT_PATH 65536   /* number of path elements */
+#defineGLOB_LIMIT_READDIR  16384   /* number of readdirs */
+#defineGLOB_LIMIT_STAT 1024/* number of stat system calls 
*/
+#defineGLOB_LIMIT_STRING   ARG_MAX /* maximum total size for paths 
*/
+
+struct glob_limit {
+   size_t  l_brace_cnt;
+   size_t  l_path_lim;
+   size_t  l_readdir_cnt;  
+   size_t  l_stat_cnt; 
+   size_t  l_string_cnt;
+};
+
 #defineDOLLAR  '$'
 #defineDOT '.'
 #defineEOS '\0'
@@ -153,15 +172,18 @@ static const Char *g_strchr(const Char *
 static Char*g_strcat(Char *, const Char *);
 #endif
 static int  g_stat(Char *, struct stat *, glob_t *);
-static int  glob0(const Char *, glob_t *, size_t *);
-static int  glob1(Char *, glob_t *, size_t *);
-static int  glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
-static int  glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t 
*);
-static int  globextend(const Char *, glob_t *, size_t *);
-static const Char *
+static int  glob0(const Char *, glob_t *, struct glob_limit *);
+static int  glob1(Char *, glob_t *, struct glob_limit *);
+static int  glob2(Char *, Char *, Char *, Char *, glob_t *,
+struct glob_limit *);
+static int  glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
+struct glob_limit *);
+static int  globextend(const Char *, glob_t *, struct glob_limit *);
+static const Char *
 globtilde(const Char *, Char *, size_t, glob_t *);
-static int  globexp1(const Char *, glob_t *, size_t *);
-static int  globexp2(const Char *, const Char *, glob_t *, int *, size_t 
*);
+static int  globexp1(const Char *, glob_t *, struct glob_limit *);
+static int  globexp2(const Char *, const Char *, glob_t *, int *,
+struct glob_limit *);
 static int  match(Char *, Char *, Char *);
 #ifdef DEBUG
 static void qprintf(const char *, Char *);
@@ -171,8 +193,8 @@ int
 glob(const char * __restrict pattern, int flags,
 int (*errfunc)(const char *, int), glob_t * __restrict pglob)
 {
+   struct glob_limit limit = { 0, 0, 0, 0, 0 };
const char *patnext;
-   size_t limit;
Char *bufnext, *bu

svn commit: r243780 - head/sys/dev/usb/controller

2012-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Dec  1 22:13:38 2012
New Revision: 243780
URL: http://svnweb.freebsd.org/changeset/base/243780

Log:
  - Add support for Etron EJ168 USB 3.0 Host Controllers.
  This brand of controllers expects that the number of
  contexts specified in the input slot context points
  to an active endpoint context, else it refuses to
  operate.
  
  - Ring the correct doorbell when streams mode is used.
  - Wrap one or two long lines.
  
  Tested by:Markus Pfeiffer (DragonFlyBSD)
  MFC after:1 week

Modified:
  head/sys/dev/usb/controller/xhci.c
  head/sys/dev/usb/controller/xhci.h

Modified: head/sys/dev/usb/controller/xhci.c
==
--- head/sys/dev/usb/controller/xhci.c  Sat Dec  1 21:26:46 2012
(r243779)
+++ head/sys/dev/usb/controller/xhci.c  Sat Dec  1 22:13:38 2012
(r243780)
@@ -2045,7 +2045,9 @@ xhci_configure_mask(struct usb_device *u
struct xhci_softc *sc = XHCI_BUS2SC(udev->bus);
struct usb_page_search buf_inp;
struct xhci_input_dev_ctx *pinp;
+   uint32_t temp;
uint8_t index;
+   uint8_t x;
 
index = udev->controller_slot_id;
 
@@ -2060,6 +2062,24 @@ xhci_configure_mask(struct usb_device *u
} else {
xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx0, 0);
xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx1, mask);
+
+   /* find most significant set bit */
+   for (x = 31; x != 1; x--) {
+   if (mask & (1 << x))
+   break;
+   }
+
+   /* adjust */
+   x--;
+
+   /* figure out maximum */
+   if (x > sc->sc_hw.devs[index].context_num) {
+   sc->sc_hw.devs[index].context_num = x;
+   temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0);
+   temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31);
+   temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1);
+   xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp);
+   }
}
return (0);
 }
@@ -2311,16 +2331,9 @@ xhci_configure_device(struct usb_device 
 
DPRINTF("Route=0x%08x\n", route);
 
-   temp = XHCI_SCTX_0_ROUTE_SET(route);
-
-   switch (sc->sc_hw.devs[index].state) {
-   case XHCI_ST_CONFIGURED:
-   temp |= XHCI_SCTX_0_CTX_NUM_SET(XHCI_MAX_ENDPOINTS - 1);
-   break;
-   default:
-   temp |= XHCI_SCTX_0_CTX_NUM_SET(1);
-   break;
-   }
+   temp = XHCI_SCTX_0_ROUTE_SET(route) |
+   XHCI_SCTX_0_CTX_NUM_SET(
+   sc->sc_hw.devs[index].context_num + 1);
 
switch (udev->speed) {
case USB_SPEED_LOW:
@@ -2464,8 +2477,9 @@ xhci_alloc_device_ext(struct usb_device 
 
if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ?
(2 * sizeof(struct xhci_input_dev_ctx)) :
-sizeof(struct xhci_input_dev_ctx), XHCI_PAGE_SIZE))
+   sizeof(struct xhci_input_dev_ctx), XHCI_PAGE_SIZE)) {
goto error;
+   }
 
pc = &sc->sc_hw.devs[index].endpoint_pc;
pg = &sc->sc_hw.devs[index].endpoint_pg;
@@ -2473,15 +2487,18 @@ xhci_alloc_device_ext(struct usb_device 
/* need to initialize the page cache */
pc->tag_parent = sc->sc_bus.dma_parent_tag;
 
-   if (usb_pc_alloc_mem(pc, pg, sizeof(struct xhci_dev_endpoint_trbs), 
XHCI_PAGE_SIZE))
+   if (usb_pc_alloc_mem(pc, pg,
+   sizeof(struct xhci_dev_endpoint_trbs), XHCI_PAGE_SIZE)) {
goto error;
+   }
 
/* initialise all endpoint LINK TRBs */
 
for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) {
 
/* lookup endpoint TRB ring */
-   usbd_get_page(pc, (uintptr_t)&((struct xhci_dev_endpoint_trbs 
*)0)->trb[i][0], &buf_ep);
+   usbd_get_page(pc, (uintptr_t)&
+   ((struct xhci_dev_endpoint_trbs *)0)->trb[i][0], &buf_ep);
 
/* get TRB pointer */
trb = buf_ep.buffer;
@@ -2568,8 +2585,10 @@ xhci_endpoint_doorbell(struct usb_xfer *
epno = XHCI_EPNO2EPID(epno);
index = xfer->xroot->udev->controller_slot_id;
 
-   if (xfer->xroot->udev->flags.self_suspended == 0)
-   XWRITE4(sc, door, XHCI_DOORBELL(index), epno | 
XHCI_DB_SID_SET(0));
+   if (xfer->xroot->udev->flags.self_suspended == 0) {
+   XWRITE4(sc, door, XHCI_DOORBELL(index),
+   epno | XHCI_DB_SID_SET(xfer->stream_id));
+   }
 }
 
 static void
@@ -3584,7 +3603,7 @@ xhci_configure_reset_endpoint(struct usb
 * endpoint context state diagram in the XHCI specification:
 */
 
-   xhci_configure_mask(udev, 1U << epno, 0);
+   xhci_configure_mask(udev, (1U << epno) | 1U, 0);
 
err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index);
 
@@ -3858,6 +3877,7 @@ xhci_device_re

svn commit: r243782 - in head/sys: fs/nfs fs/nfsclient nfs

2012-12-01 Thread Rick Macklem
Author: rmacklem
Date: Sun Dec  2 01:16:04 2012
New Revision: 243782
URL: http://svnweb.freebsd.org/changeset/base/243782

Log:
  Add an nfssvc() option to the kernel for the new NFS client
  which dumps out the actual options being used by an NFS mount.
  This will be used to implement a "-m" option for nfsstat(1).
  
  Reviewed by:  alfred
  MFC after:2 weeks

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/nfs/nfs_nfssvc.c
  head/sys/nfs/nfssvc.h

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Sun Dec  2 00:31:23 2012(r243781)
+++ head/sys/fs/nfs/nfs_var.h   Sun Dec  2 01:16:04 2012(r243782)
@@ -313,6 +313,7 @@ void nfsd_init(void);
 int nfsd_checkrootexp(struct nfsrv_descript *);
 
 /* nfs_clvfsops.c */
+void nfscl_retopts(struct nfsmount *, char *, size_t);
 
 /* nfs_commonport.c */
 int nfsrv_checksockseqnum(struct socket *, tcp_seq);

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Sun Dec  2 00:31:23 2012
(r243781)
+++ head/sys/fs/nfsclient/nfs_clport.c  Sun Dec  2 01:16:04 2012
(r243782)
@@ -1201,6 +1201,9 @@ nfssvc_nfscl(struct thread *td, struct n
struct nfscbd_args nfscbdarg;
struct nfsd_nfscbd_args nfscbdarg2;
int error;
+   struct nameidata nd;
+   struct nfscl_dumpmntopts dumpmntopts;
+   char *buf;
 
if (uap->flag & NFSSVC_CBADDSOCK) {
error = copyin(uap->argp, (caddr_t)&nfscbdarg, 
sizeof(nfscbdarg));
@@ -1233,6 +1236,28 @@ nfssvc_nfscl(struct thread *td, struct n
if (error)
return (error);
error = nfscbd_nfsd(td, &nfscbdarg2);
+   } else if (uap->flag & NFSSVC_DUMPMNTOPTS) {
+   error = copyin(uap->argp, &dumpmntopts, sizeof(dumpmntopts));
+   if (error == 0 && (dumpmntopts.ndmnt_blen < 256 ||
+   dumpmntopts.ndmnt_blen > 1024))
+   error = EINVAL;
+   if (error == 0)
+   error = nfsrv_lookupfilename(&nd,
+   dumpmntopts.ndmnt_fname, td);
+   if (error == 0 && strcmp(nd.ni_vp->v_mount->mnt_vfc->vfc_name,
+   "nfs") != 0) {
+   vput(nd.ni_vp);
+   error = EINVAL;
+   }
+   if (error == 0) {
+   buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK);
+   nfscl_retopts(VFSTONFS(nd.ni_vp->v_mount), buf,
+   dumpmntopts.ndmnt_blen);
+   vput(nd.ni_vp);
+   error = copyout(buf, dumpmntopts.ndmnt_buf,
+   dumpmntopts.ndmnt_blen);
+   free(buf, M_TEMP);
+   }
} else {
error = EINVAL;
}

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==
--- head/sys/fs/nfsclient/nfs_clvfsops.cSun Dec  2 00:31:23 2012
(r243781)
+++ head/sys/fs/nfsclient/nfs_clvfsops.cSun Dec  2 01:16:04 2012
(r243782)
@@ -1627,3 +1627,105 @@ nfs_getnlminfo(struct vnode *vp, uint8_t
}
 }
 
+/*
+ * This function prints out an option name, based on the conditional
+ * argument.
+ */
+static __inline void nfscl_printopt(struct nfsmount *nmp, int testval,
+char *opt, char **buf, size_t *blen)
+{
+   int len;
+
+   if (testval != 0 && *blen > strlen(opt)) {
+   len = snprintf(*buf, *blen, "%s", opt);
+   if (len != strlen(opt))
+   printf("EEK!!\n");
+   *buf += len;
+   *blen -= len;
+   }
+}
+
+/*
+ * This function printf out an options integer value.
+ */
+static __inline void nfscl_printoptval(struct nfsmount *nmp, int optval,
+char *opt, char **buf, size_t *blen)
+{
+   int len;
+
+   if (*blen > strlen(opt) + 1) {
+   /* Could result in truncated output string. */
+   len = snprintf(*buf, *blen, "%s=%d", opt, optval);
+   if (len < *blen) {
+   *buf += len;
+   *blen -= len;
+   }
+   }
+}
+
+/*
+ * Load the option flags and values into the buffer.
+ */
+void nfscl_retopts(struct nfsmount *nmp, char *buffer, size_t buflen)
+{
+   char *buf;
+   size_t blen;
+
+   buf = buffer;
+   blen = buflen;
+   nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV4) != 0, "nfsv4", &buf,
+   &blen);
+   nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV3) != 0, "nfsv3", &buf,
+   &blen);
+   nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0,
+   "nfs

svn commit: r243783 - head/usr.bin/nfsstat

2012-12-01 Thread Rick Macklem
Author: rmacklem
Date: Sun Dec  2 01:20:43 2012
New Revision: 243783
URL: http://svnweb.freebsd.org/changeset/base/243783

Log:
  Add a "-m" option to nfsstat, which dumps out the
  actual options used by all NFS mounts. Works for
  the new/default NFS client only.
  
  Reviewed by:  alfred
  MFC after:2 weeks

Modified:
  head/usr.bin/nfsstat/nfsstat.c

Modified: head/usr.bin/nfsstat/nfsstat.c
==
--- head/usr.bin/nfsstat/nfsstat.c  Sun Dec  2 01:16:04 2012
(r243782)
+++ head/usr.bin/nfsstat/nfsstat.c  Sun Dec  2 01:20:43 2012
(r243783)
@@ -107,14 +107,36 @@ main(int argc, char **argv)
int ch;
char *memf, *nlistf;
char errbuf[_POSIX2_LINE_MAX];
+   int mntlen, i;
+   char buf[1024];
+   struct statfs *mntbuf;
+   struct nfscl_dumpmntopts dumpmntopts;
 
interval = 0;
memf = nlistf = NULL;
-   while ((ch = getopt(argc, argv, "cesWM:N:ow:z")) != -1)
+   while ((ch = getopt(argc, argv, "cesWM:mN:ow:z")) != -1)
switch(ch) {
case 'M':
memf = optarg;
break;
+   case 'm':
+   /* Display mount options for NFS mount points. */
+   mntlen = getmntinfo(&mntbuf, MNT_NOWAIT);
+   for (i = 0; i < mntlen; i++) {
+   if (strcmp(mntbuf->f_fstypename, "nfs") == 0) {
+   dumpmntopts.ndmnt_fname =
+   mntbuf->f_mntonname;
+   dumpmntopts.ndmnt_buf = buf;
+   dumpmntopts.ndmnt_blen = sizeof(buf);
+   if (nfssvc(NFSSVC_DUMPMNTOPTS,
+   &dumpmntopts) >= 0)
+   printf("%s on %s\n%s\n",
+   mntbuf->f_mntfromname,
+   mntbuf->f_mntonname, buf);
+   }
+   mntbuf++;
+   }
+   exit(0);
case 'N':
nlistf = optarg;
break;
@@ -646,7 +668,7 @@ void
 usage(void)
 {
(void)fprintf(stderr,
-   "usage: nfsstat [-ceoszW] [-M core] [-N system] [-w wait]\n");
+   "usage: nfsstat [-cemoszW] [-M core] [-N system] [-w wait]\n");
exit(1);
 }
 
___
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: r243784 - head/usr.bin/nfsstat

2012-12-01 Thread Rick Macklem
Author: rmacklem
Date: Sun Dec  2 01:25:19 2012
New Revision: 243784
URL: http://svnweb.freebsd.org/changeset/base/243784

Log:
  Document the "-m" option added by r243783.
  This is a content change.
  
  Reviewed by:  alfred
  MFC after:2 weeks

Modified:
  head/usr.bin/nfsstat/nfsstat.1

Modified: head/usr.bin/nfsstat/nfsstat.1
==
--- head/usr.bin/nfsstat/nfsstat.1  Sun Dec  2 01:20:43 2012
(r243783)
+++ head/usr.bin/nfsstat/nfsstat.1  Sun Dec  2 01:25:19 2012
(r243784)
@@ -28,7 +28,7 @@
 .\" From: @(#)nfsstat.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 4, 2011
+.Dd November 14, 2012
 .Dt NFSSTAT 1
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 statistics
 .Sh SYNOPSIS
 .Nm
-.Op Fl ceoszW
+.Op Fl cemoszW
 .Op Fl M Ar core
 .Op Fl N Ar system
 .Op Fl w Ar wait
@@ -62,6 +62,12 @@ This option is incompatible with
 Extract values associated with the name list from the specified core
 instead of the default
 .Pa /dev/kmem .
+.It Fl m
+Report the mount options for all new NFS client mounts.
+This option overrides all others and
+.Nm
+will exit after completing the report.
+This option is only supported by the new NFS client.
 .It Fl N
 Extract the name list from the specified system instead of the default
 .Pa /boot/kernel/kernel .
___
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: r243785 - head/usr.sbin/nfsd

2012-12-01 Thread Alfred Perlstein
Author: alfred
Date: Sun Dec  2 05:57:53 2012
New Revision: 243785
URL: http://svnweb.freebsd.org/changeset/base/243785

Log:
  Document maxthreads and minthreads arguments

Modified:
  head/usr.sbin/nfsd/nfsd.8

Modified: head/usr.sbin/nfsd/nfsd.8
==
--- head/usr.sbin/nfsd/nfsd.8   Sun Dec  2 01:25:19 2012(r243784)
+++ head/usr.sbin/nfsd/nfsd.8   Sun Dec  2 05:57:53 2012(r243785)
@@ -41,6 +41,8 @@ server
 .Op Fl arduteo
 .Op Fl n Ar num_servers
 .Op Fl h Ar bindip
+.Op Fl maxthreads Ar max_threads
+.Op Fl minthreads Ar min_threads
 .Sh DESCRIPTION
 The
 .Nm
@@ -74,8 +76,17 @@ Unregister the
 service with
 .Xr rpcbind 8
 without creating any servers.
-.It Fl n
-Specifies how many servers to create.
+.It Fl n Ar threads
+Specifies how many servers to create.  This option is equivalent to specifying
+.Fl maxthreads
+and
+.Fl minthreads
+with their respective arguments to
+.Ar threads .
+.It Fl maxthreads Ar threads
+Specifies the maximum servers that will be kept around to service requests.
+.It Fl minthreads Ar threads
+Specifies the minimum servers that will be kept around to service requests.
 .It Fl h Ar bindip
 Specifies which IP address or hostname to bind to on the local host.
 This option is recommended when a host has multiple interfaces.
___
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: r243786 - head/sys/dev/ath

2012-12-01 Thread Adrian Chadd
Author: adrian
Date: Sun Dec  2 06:24:08 2012
New Revision: 243786
URL: http://svnweb.freebsd.org/changeset/base/243786

Log:
  Delete the per-TXQ locks and replace them with a single TX lock.
  
  I couldn't think of a way to maintain the hardware TXQ locks _and_ layer
  on top of that per-TXQ software queuing and any other kind of fine-grained
  locks (eg per-TID, or per-node locks.)
  
  So for now, to facilitate some further code refactoring and development
  as part of the final push to get software queue ps-poll and u-apsd handling
  into this driver, just do away with them entirely.
  
  I may eventually bring them back at some point, when it looks slightly more
  architectually cleaner to do so.  But as it stands at the present, it's
  not really buying us much:
  
  * in order to properly serialise things and not get bitten by scheduling
and locking interactions with things higher up in the stack, we need to
wrap the whole TX path in a long held lock.  Otherwise we can end up
being pre-empted during frame handling, resulting in some out of order
frame handling between sequence number allocation and encryption handling
(ie, the seqno and the CCMP IV get out of sequence);
  
  * .. so whilst that's the case, holding the lock for that long means that
we're acquiring and releasing the TXQ lock _inside_ that context;
  
  * And we also acquire it per-frame during frame completion, but we currently
can't hold the lock for the duration of the TX completion as we need
to call net80211 layer things with the locks _unheld_ to avoid LOR.
  
  * .. the other places were grab that lock are reset/flush, which don't happen
often.
  
  My eventual aim is to change the TX path so all rejected frame transmissions
  and all frame completions result in any ieee80211_free_node() calls to occur
  outside of the TX lock; then I can cut back on the amount of locking that
  goes on here.
  
  There may be some LORs that occur when ieee80211_free_node() is called when
  the TX queue path fails; I'll begin to address these in follow-up commits.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_beacon.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx_edma.c
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Sun Dec  2 05:57:53 2012(r243785)
+++ head/sys/dev/ath/if_ath.c   Sun Dec  2 06:24:08 2012(r243786)
@@ -1369,7 +1369,6 @@ ath_vap_delete(struct ieee80211vap *vap)
 * Reclaim any pending mcast frames for the vap.
 */
ath_tx_draintxq(sc, &avp->av_mcastq);
-   ATH_TXQ_LOCK_DESTROY(&avp->av_mcastq);
}
/*
 * Update bookkeeping.
@@ -2271,16 +2270,16 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T
/* Restart TX/RX as needed */
ath_txrx_start(sc);
 
-   /* XXX Restart TX completion and pending TX */
+   /* Restart TX completion and pending TX */
if (reset_type == ATH_RESET_NOLOSS) {
+   ATH_TX_LOCK(sc);
for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
if (ATH_TXQ_SETUP(sc, i)) {
-   ATH_TXQ_LOCK(&sc->sc_txq[i]);
ath_txq_restart_dma(sc, &sc->sc_txq[i]);
ath_txq_sched(sc, &sc->sc_txq[i]);
-   ATH_TXQ_UNLOCK(&sc->sc_txq[i]);
}
}
+   ATH_TX_UNLOCK(sc);
}
 
/*
@@ -2513,7 +2512,9 @@ ath_start_task(void *arg, int npending)
sc->sc_txstart_cnt++;
ATH_PCU_UNLOCK(sc);
 
+   ATH_TX_LOCK(sc);
ath_start(sc->sc_ifp);
+   ATH_TX_UNLOCK(sc);
 
ATH_PCU_LOCK(sc);
sc->sc_txstart_cnt--;
@@ -2534,6 +2535,8 @@ ath_start(struct ifnet *ifp)
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid)
return;
 
+   ATH_TX_LOCK_ASSERT(sc);
+
ATH_KTR(sc, ATH_KTR_TX, 0, "ath_start: called");
 
for (;;) {
@@ -2605,6 +2608,10 @@ ath_start(struct ifnet *ifp)
ath_returnbuf_head(sc, bf);
ath_txfrag_cleanup(sc, &frags, ni);
ATH_TXBUF_UNLOCK(sc);
+   /*
+* XXX todo, free the node outside of
+* the TX lock context!
+*/
if (ni != NULL)
ieee80211_free_node(ni);
continue;
@@ -2816,9 +2823,6 @@ void
 ath_txqmove(struct ath_txq *dst, struct ath_txq *src)
 {
 
-   ATH_TXQ_LOCK_ASSERT(dst);
-   ATH_TXQ_LOCK_ASSERT(src);
-
TAILQ_CONCAT(&dst->axq_q, &src->axq_q, bf_list);
dst->axq_link = src->axq_link;
src->axq_link = NULL;
@@ -3298,7

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

2012-12-01 Thread Adrian Chadd
Author: adrian
Date: Sun Dec  2 06:50:27 2012
New Revision: 243787
URL: http://svnweb.freebsd.org/changeset/base/243787

Log:
  Don't grab the PCU lock inside the TX lock.

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

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cSun Dec  2 06:24:08 2012
(r243786)
+++ head/sys/dev/ath/if_ath_tx.cSun Dec  2 06:50:27 2012
(r243787)
@@ -2275,12 +2275,12 @@ ath_raw_xmit(struct ieee80211_node *ni, 
 */
ath_tx_update_tim(sc, ni, 1);
 
+   ATH_TX_UNLOCK(sc);
+
ATH_PCU_LOCK(sc);
sc->sc_txstart_cnt--;
ATH_PCU_UNLOCK(sc);
 
-   ATH_TX_UNLOCK(sc);
-
return 0;
 bad2:
ATH_KTR(sc, ATH_KTR_TX, 3, "ath_raw_xmit: bad2: m=%p, params=%p, "
___
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"