From owner-svn-src-user@FreeBSD.ORG Sun Apr 7 10:52:29 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E12D2BAD; Sun, 7 Apr 2013 10:52:29 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D357B1CB; Sun, 7 Apr 2013 10:52:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r37AqTYQ013876; Sun, 7 Apr 2013 10:52:29 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r37AqT2U013873; Sun, 7 Apr 2013 10:52:29 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304071052.r37AqT2U013873@svn.freebsd.org> From: Peter Holm Date: Sun, 7 Apr 2013 10:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249227 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Apr 2013 10:52:29 -0000 Author: pho Date: Sun Apr 7 10:52:28 2013 New Revision: 249227 URL: http://svnweb.freebsd.org/changeset/base/249227 Log: Added three more NFS test scenarios. Added: user/pho/stress2/misc/nfs10.sh (contents, props changed) user/pho/stress2/misc/nfs11.sh (contents, props changed) user/pho/stress2/misc/nfs12.sh (contents, props changed) Added: user/pho/stress2/misc/nfs10.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/nfs10.sh Sun Apr 7 10:52:28 2013 (r249227) @@ -0,0 +1,71 @@ +#!/bin/sh + +# +# Copyright (c) 2013 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# nfsv4 test scenario +# Deadlock seen: http://people.freebsd.org/~pho/stress/log/nfs10.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +grep -q $mntpoint /etc/exports || { echo "$mntpoint missing from /etc/exports"; exit 0; } + +m2=${mntpoint}2 +[ -d $m2 ] || mkdir $m2 +mount | grep "on $m2 " | grep -q nfs && umount $m2 +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart + +mdconfig -a -t swap -s 2g -u $mdstart || exit 1 +bsdlabel -w md$mdstart auto + +newfs -U md${mdstart}$part > /dev/null + +mount /dev/md${mdstart}$part $mntpoint +chmod 777 $mntpoint + +mount -t nfs -o nfsv4 -o rw 127.0.0.1:$mntpoint $m2 + +export RUNDIR=$m2/stressX +export runRUNTIME=10m # Run tests for 10 minutes + +su $testuser -c "(cd ..; ./run.sh marcus.cfg)" & +sleep 300 +umount $m2 2>/dev/null # Test umount of active FS while here +wait + +while mount | grep "on $m2 " | grep -q nfs; do + umount $m2 +done + +while mount | grep "on $mntpoint " | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done +mdconfig -d -u $mdstart Added: user/pho/stress2/misc/nfs11.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/nfs11.sh Sun Apr 7 10:52:28 2013 (r249227) @@ -0,0 +1,67 @@ +#!/bin/sh + +# +# Copyright (c) 2013 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# nfsv4 test scenario + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +grep -q $mntpoint /etc/exports || { echo "$mntpoint missing from /etc/exports"; exit 0; } + +m2=${mntpoint}2 +[ -d $m2 ] || mkdir $m2 +mount | grep "on $m2 " | grep -q nfs && umount $m2 +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart + +mdconfig -a -t swap -s 2g -u $mdstart || exit 1 +bsdlabel -w md$mdstart auto + +newfs -U md${mdstart}$part > /dev/null + +mount /dev/md${mdstart}$part $mntpoint +chmod 777 $mntpoint + +mount -t nfs -o nfsv4 -o rw 127.0.0.1:$mntpoint $m2 + +export RUNDIR=$m2/stressX +export runRUNTIME=10m # Run tests for 10 minutes + +su $testuser -c "(cd ..; ./run.sh marcus.cfg)" + +while mount | grep "on $m2 " | grep -q nfs; do + umount $m2 +done + +while mount | grep "on $mntpoint " | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done +mdconfig -d -u $mdstart Added: user/pho/stress2/misc/nfs12.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/nfs12.sh Sun Apr 7 10:52:28 2013 (r249227) @@ -0,0 +1,156 @@ +#!/bin/sh + +# +# Copyright (c) 2013 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# "umount -f" test scenario (distill of nfs4.sh) +# "panic: vputx: missed vn_close" seen. +# Fixed in r248815 + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +grep -q $mntpoint /etc/exports || { echo "$mntpoint missing from /etc/exports"; exit 0; } + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/$0 > nfs12.c +cc -o nfs12 -Wall -Wextra -O2 -g nfs12.c +rm -f nfs12.c +cd $here + +mount | grep "on $mntpoint " | grep nfs > /dev/null && umount $mntpoint +version="-o nfsv3" # The default +[ $# -eq 1 ] && [ "$1" -eq 4 ] && version="-o nfsv4" +for i in `jot 10`; do + mount -t nfs $version -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:/tmp $mntpoint + sleep 2 + + (cd $mntpoint; /tmp/nfs12 > /dev/null 2>&1) & + sleep 2 + + while mount | grep "on $mntpoint " | grep -q nfs; do + umount -f $mntpoint + done + kill -9 $! > /dev/null 2>/dev/null && kill $! + wait +done + +rm -f /tmp/nfs12 +exit +EOF +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define INPUTFILE "/bin/date" +#define PARALLEL 5 + +int +tmmap(void) +{ + int i; + pid_t pid; + char file[128]; + int fdin, fdout; + char *src, *dst; + struct stat statbuf; + + pid = getpid(); + setproctitle("mmap"); + for (i = 0; i < 50000; i++) { + sprintf(file,"p%05d.%05d", pid, i); + + if ((fdin = open(INPUTFILE, O_RDONLY)) < 0) + err(1, INPUTFILE); + + if ((fdout = open(file, O_RDWR | O_CREAT | O_TRUNC, 0600)) < 0) + err(1, "%s", file); + + if (fstat(fdin, &statbuf) < 0) + err(1, "fstat error"); + + if (lseek(fdout, statbuf.st_size - 1, SEEK_SET) == -1) + err(1, "lseek error"); + + /* write a dummy byte at the last location */ + if (write(fdout, "", 1) != 1) + err(1, "write error"); + + if ((src = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fdin, 0)) == + (caddr_t) - 1) + err(1, "mmap error for input"); + + if ((dst = mmap(0, statbuf.st_size, PROT_READ | PROT_WRITE, + MAP_SHARED, fdout, 0)) == (caddr_t) - 1) + err(1, "mmap error for output"); + + memcpy(dst, src, statbuf.st_size); + + + if (munmap(src, statbuf.st_size) == -1) + err(1, "munmap"); + close(fdin); + + if (munmap(dst, statbuf.st_size) == -1) + err(1, "munmap"); + close(fdout); + + if (unlink(file) == -1) + err(3, "unlink(%s)", file); + } + + + _exit(0); +} + +int +main(void) +{ + int i; + + for (i = 0; i < PARALLEL; i++) { + if (fork() == 0) + tmmap(); + } + + for (i = 0; i < PARALLEL; i++) { + wait(NULL); + } + + return (0); +} From owner-svn-src-user@FreeBSD.ORG Sun Apr 7 10:55:39 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A74ACD70; Sun, 7 Apr 2013 10:55:39 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9B3821EA; Sun, 7 Apr 2013 10:55:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r37AtdAS014315; Sun, 7 Apr 2013 10:55:39 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r37Atd1g014314; Sun, 7 Apr 2013 10:55:39 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304071055.r37Atd1g014314@svn.freebsd.org> From: Peter Holm Date: Sun, 7 Apr 2013 10:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249228 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Apr 2013 10:55:39 -0000 Author: pho Date: Sun Apr 7 10:55:39 2013 New Revision: 249228 URL: http://svnweb.freebsd.org/changeset/base/249228 Log: Do not run the test as root. If umount fails, use "umount -f". Modified: user/pho/stress2/misc/nfs.sh Modified: user/pho/stress2/misc/nfs.sh ============================================================================== --- user/pho/stress2/misc/nfs.sh Sun Apr 7 10:52:28 2013 (r249227) +++ user/pho/stress2/misc/nfs.sh Sun Apr 7 10:55:39 2013 (r249228) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008-2011 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,8 +40,9 @@ mount -t nfs -o tcp -o retrycnt=3 -o int export RUNDIR=$mntpoint/stressX export runRUNTIME=10m # Run tests for 10 minutes -(cd ..; ./run.sh disk.cfg) +su $testuser -c "(cd ..; ./run.sh disk.cfg)" -while mount | grep "$mntpoint" | grep -q nfs; do - umount $mntpoint +umount $mntpoint +while mount | grep "$mntpoint " | grep -q nfs; do + umount -f $mntpoint done From owner-svn-src-user@FreeBSD.ORG Sun Apr 7 10:58:04 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8B7D3F40; Sun, 7 Apr 2013 10:58:04 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7F71A20C; Sun, 7 Apr 2013 10:58:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r37Aw4mu014567; Sun, 7 Apr 2013 10:58:04 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r37Aw4d3014566; Sun, 7 Apr 2013 10:58:04 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304071058.r37Aw4d3014566@svn.freebsd.org> From: Peter Holm Date: Sun, 7 Apr 2013 10:58:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249229 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Apr 2013 10:58:04 -0000 Author: pho Date: Sun Apr 7 10:58:04 2013 New Revision: 249229 URL: http://svnweb.freebsd.org/changeset/base/249229 Log: Fix typo. Modified: user/pho/stress2/misc/nfs2.sh Modified: user/pho/stress2/misc/nfs2.sh ============================================================================== --- user/pho/stress2/misc/nfs2.sh Sun Apr 7 10:55:39 2013 (r249228) +++ user/pho/stress2/misc/nfs2.sh Sun Apr 7 10:58:04 2013 (r249229) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008-2011 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -54,7 +54,7 @@ chmod 777 ${mntpoint}/stressX [ ! -d ${mntpoint}2 ] && mkdir ${mntpoint}2 chmod 777 ${mntpoint}2 -mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:$mntpoint $mntpoint2 +mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:$mntpoint ${mntpoint}2 export INODES=9999 # No inodes on a msdos fs export RUNDIR=${mntpoint}2/stressX From owner-svn-src-user@FreeBSD.ORG Sun Apr 7 11:04:33 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BE73B132; Sun, 7 Apr 2013 11:04:33 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AE2B023B; Sun, 7 Apr 2013 11:04:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r37B4XvV017033; Sun, 7 Apr 2013 11:04:33 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r37B4XIo017032; Sun, 7 Apr 2013 11:04:33 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304071104.r37B4XIo017032@svn.freebsd.org> From: Peter Holm Date: Sun, 7 Apr 2013 11:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249230 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Apr 2013 11:04:33 -0000 Author: pho Date: Sun Apr 7 11:04:33 2013 New Revision: 249230 URL: http://svnweb.freebsd.org/changeset/base/249230 Log: Do not run the tests as root. Modified: user/pho/stress2/misc/nfs3.sh Modified: user/pho/stress2/misc/nfs3.sh ============================================================================== --- user/pho/stress2/misc/nfs3.sh Sun Apr 7 10:58:04 2013 (r249229) +++ user/pho/stress2/misc/nfs3.sh Sun Apr 7 11:04:33 2013 (r249230) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -45,9 +45,7 @@ export RUNDIR=$mntpoint/nfs/stressX export runRUNTIME=1m rm -rf /tmp/stressX.control/* -cd .. -./run.sh -a & -cd - +su $testuser -c "(cd ..; ./run.sh -a > /dev/null 2>&1)" & sleep 50 while mount | grep -q $mntpoint; do From owner-svn-src-user@FreeBSD.ORG Sun Apr 7 11:05:38 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 92170249; Sun, 7 Apr 2013 11:05:38 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8616323F; Sun, 7 Apr 2013 11:05:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r37B5cFT017222; Sun, 7 Apr 2013 11:05:38 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r37B5cL7017221; Sun, 7 Apr 2013 11:05:38 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304071105.r37B5cL7017221@svn.freebsd.org> From: Peter Holm Date: Sun, 7 Apr 2013 11:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249231 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Apr 2013 11:05:38 -0000 Author: pho Date: Sun Apr 7 11:05:38 2013 New Revision: 249231 URL: http://svnweb.freebsd.org/changeset/base/249231 Log: Do not run tests as root. Modified: user/pho/stress2/misc/nfs4.sh Modified: user/pho/stress2/misc/nfs4.sh ============================================================================== --- user/pho/stress2/misc/nfs4.sh Sun Apr 7 11:04:33 2013 (r249230) +++ user/pho/stress2/misc/nfs4.sh Sun Apr 7 11:05:38 2013 (r249231) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ export RUNDIR=$mntpoint/nfs/stressX export runRUNTIME=3m rm -rf /tmp/stressX.control/* -(cd ..; ./run.sh all.cfg) & +su $testuser -c '(cd ..; ./run.sh all.cfg)' & sleep 60 while mount | grep -q $mntpoint; do From owner-svn-src-user@FreeBSD.ORG Mon Apr 8 19:51:50 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 772A02D3; Mon, 8 Apr 2013 19:51:50 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 67D37781; Mon, 8 Apr 2013 19:51:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r38Jpo8I000110; Mon, 8 Apr 2013 19:51:50 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r38JploR099988; Mon, 8 Apr 2013 19:51:47 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304081951.r38JploR099988@svn.freebsd.org> From: Attilio Rao Date: Mon, 8 Apr 2013 19:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249273 - in user/attilio/vmcontention: . bin/sh cddl/contrib/opensolaris/cmd/zdb etc/devd sbin/camcontrol share/man/man4 share/man/man9 sys/amd64/include sys/arm/at91 sys/arm/include s... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 19:51:50 -0000 Author: attilio Date: Mon Apr 8 19:51:46 2013 New Revision: 249273 URL: http://svnweb.freebsd.org/changeset/base/249273 Log: MFC Added: user/attilio/vmcontention/share/man/man9/counter.9 - copied unchanged from r249270, head/share/man/man9/counter.9 user/attilio/vmcontention/sys/amd64/include/counter.h - copied unchanged from r249270, head/sys/amd64/include/counter.h user/attilio/vmcontention/sys/arm/include/counter.h - copied unchanged from r249270, head/sys/arm/include/counter.h user/attilio/vmcontention/sys/i386/include/counter.h - copied unchanged from r249270, head/sys/i386/include/counter.h user/attilio/vmcontention/sys/ia64/include/counter.h - copied unchanged from r249270, head/sys/ia64/include/counter.h user/attilio/vmcontention/sys/kern/subr_counter.c - copied unchanged from r249270, head/sys/kern/subr_counter.c user/attilio/vmcontention/sys/mips/include/counter.h - copied unchanged from r249270, head/sys/mips/include/counter.h user/attilio/vmcontention/sys/pc98/include/counter.h - copied unchanged from r249270, head/sys/pc98/include/counter.h user/attilio/vmcontention/sys/powerpc/include/counter.h - copied unchanged from r249270, head/sys/powerpc/include/counter.h user/attilio/vmcontention/sys/sparc64/include/counter.h - copied unchanged from r249270, head/sys/sparc64/include/counter.h user/attilio/vmcontention/sys/sys/counter.h - copied unchanged from r249270, head/sys/sys/counter.h user/attilio/vmcontention/tools/regression/bin/sh/builtins/eval6.0 - copied unchanged from r249270, head/tools/regression/bin/sh/builtins/eval6.0 user/attilio/vmcontention/usr.sbin/mfiutil/mfi_bbu.c - copied unchanged from r249270, head/usr.sbin/mfiutil/mfi_bbu.c Deleted: user/attilio/vmcontention/sys/dev/ata/ata-queue.c user/attilio/vmcontention/sys/modules/ata/atadevel/ Modified: user/attilio/vmcontention/UPDATING user/attilio/vmcontention/bin/sh/nodes.c.pat user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zdb/zdb.c user/attilio/vmcontention/etc/devd/usb.conf user/attilio/vmcontention/sbin/camcontrol/camcontrol.8 user/attilio/vmcontention/sbin/camcontrol/camcontrol.c user/attilio/vmcontention/share/man/man4/mld.4 user/attilio/vmcontention/share/man/man9/Makefile user/attilio/vmcontention/share/man/man9/sbuf.9 user/attilio/vmcontention/share/man/man9/zone.9 user/attilio/vmcontention/sys/amd64/include/pcpu.h user/attilio/vmcontention/sys/arm/at91/at91_pio.c user/attilio/vmcontention/sys/arm/at91/at91_piovar.h user/attilio/vmcontention/sys/arm/include/pcpu.h user/attilio/vmcontention/sys/boot/ficl/arm/sysdep.h user/attilio/vmcontention/sys/boot/ficl/tools.c user/attilio/vmcontention/sys/cam/ata/ata_all.h user/attilio/vmcontention/sys/cam/ata/ata_da.c user/attilio/vmcontention/sys/cam/ata/ata_xpt.c user/attilio/vmcontention/sys/cam/cam_ccb.h user/attilio/vmcontention/sys/cam/cam_sim.h user/attilio/vmcontention/sys/cam/ctl/ctl.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c user/attilio/vmcontention/sys/conf/files user/attilio/vmcontention/sys/conf/options user/attilio/vmcontention/sys/contrib/ipfilter/netinet/ip_auth.c user/attilio/vmcontention/sys/dev/ata/ata-all.c user/attilio/vmcontention/sys/dev/ata/ata-all.h user/attilio/vmcontention/sys/dev/ata/ata-cbus.c user/attilio/vmcontention/sys/dev/ata/ata-isa.c user/attilio/vmcontention/sys/dev/ata/ata-lowlevel.c user/attilio/vmcontention/sys/dev/ata/ata-pci.c user/attilio/vmcontention/sys/dev/ata/ata-sata.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-acard.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-acerlabs.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-adaptec.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-ahci.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-amd.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-ati.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-cenatek.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-cypress.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-cyrix.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-fsl.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-highpoint.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-intel.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-ite.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-jmicron.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-marvell.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-micron.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-national.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-netcell.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-nvidia.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-promise.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-serverworks.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-siliconimage.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-sis.c user/attilio/vmcontention/sys/dev/ata/chipsets/ata-via.c user/attilio/vmcontention/sys/dev/drm2/drm_dp_iic_helper.c user/attilio/vmcontention/sys/dev/mfi/mfi_debug.c user/attilio/vmcontention/sys/dev/mfi/mfireg.h user/attilio/vmcontention/sys/dev/usb/controller/at91dci_atmelarm.c user/attilio/vmcontention/sys/dev/usb/serial/uftdi.c user/attilio/vmcontention/sys/dev/usb/usbdevs user/attilio/vmcontention/sys/fs/ext2fs/ext2_alloc.c user/attilio/vmcontention/sys/i386/include/pcpu.h user/attilio/vmcontention/sys/ia64/include/pcpu.h user/attilio/vmcontention/sys/kern/imgact_elf.c user/attilio/vmcontention/sys/kern/kern_descrip.c user/attilio/vmcontention/sys/kern/uipc_mqueue.c user/attilio/vmcontention/sys/kern/uipc_sem.c user/attilio/vmcontention/sys/kern/uipc_shm.c user/attilio/vmcontention/sys/kern/vfs_subr.c user/attilio/vmcontention/sys/mips/include/pcpu.h user/attilio/vmcontention/sys/modules/ata/atacard/Makefile user/attilio/vmcontention/sys/modules/ata/atacbus/Makefile user/attilio/vmcontention/sys/modules/ata/atacore/Makefile user/attilio/vmcontention/sys/modules/ata/ataisa/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataacard/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataacerlabs/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataadaptec/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataahci/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataamd/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataati/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atacenatek/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atacypress/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atacyrix/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atahighpoint/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataintel/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataite/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atajmicron/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atamarvell/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atamicron/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atanational/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atanetcell/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atanvidia/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atapromise/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/ataserverworks/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atasiliconimage/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atasis/Makefile user/attilio/vmcontention/sys/modules/ata/atapci/chipsets/atavia/Makefile user/attilio/vmcontention/sys/modules/cam/Makefile user/attilio/vmcontention/sys/modules/usb/umass/Makefile user/attilio/vmcontention/sys/modules/usb/urio/Makefile user/attilio/vmcontention/sys/modules/usb/usfs/Makefile user/attilio/vmcontention/sys/powerpc/include/pcpu.h user/attilio/vmcontention/sys/powerpc/powermac/ata_dbdma.c user/attilio/vmcontention/sys/powerpc/powermac/ata_kauai.c user/attilio/vmcontention/sys/powerpc/powermac/ata_macio.c user/attilio/vmcontention/sys/powerpc/psim/ata_iobus.c user/attilio/vmcontention/sys/rpc/svc_vc.c user/attilio/vmcontention/sys/sparc64/include/pcpu.h user/attilio/vmcontention/sys/sys/pcpu.h user/attilio/vmcontention/sys/sys/sysctl.h user/attilio/vmcontention/sys/ufs/ffs/ffs_softdep.c user/attilio/vmcontention/sys/ufs/ffs/ffs_vfsops.c user/attilio/vmcontention/sys/vm/uma.h user/attilio/vmcontention/sys/vm/uma_core.c user/attilio/vmcontention/sys/vm/uma_int.h user/attilio/vmcontention/sys/vm/vm_pager.c user/attilio/vmcontention/sys/vm/vm_radix.c user/attilio/vmcontention/usr.bin/calendar/calendar.1 user/attilio/vmcontention/usr.sbin/mfiutil/Makefile user/attilio/vmcontention/usr.sbin/mfiutil/mfi_show.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_volume.c user/attilio/vmcontention/usr.sbin/mfiutil/mfiutil.8 user/attilio/vmcontention/usr.sbin/mfiutil/mfiutil.c user/attilio/vmcontention/usr.sbin/mfiutil/mfiutil.h user/attilio/vmcontention/usr.sbin/rarpd/rarpd.c user/attilio/vmcontention/usr.sbin/watchdogd/watchdogd.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/share/man/man4/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) Modified: user/attilio/vmcontention/UPDATING ============================================================================== --- user/attilio/vmcontention/UPDATING Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/UPDATING Mon Apr 8 19:51:46 2013 (r249273) @@ -26,6 +26,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20130404: + Legacy ATA stack, disabled and replaced by new CAM-based one since + FreeBSD 9.0, completely removed from the sources. Kernel modules + atadisk and atapi*, user-level tools atacontrol and burncd are + removed. Kernel option `options ATA_CAM` is now permanently enabled + and removed. + +20130319: + SOCK_CLOEXEC and SOCK_NONBLOCK flags have been added to socket(2) + and socketpair(2). Software, in particular Kerberos, may + automatically detect and use these during building. The resulting + binaries will not work on older kernels. + 20130308: CTL_DISABLE has also been added to the sparc64 GENERIC (for further information, see the respective 20130304 entry). Modified: user/attilio/vmcontention/bin/sh/nodes.c.pat ============================================================================== --- user/attilio/vmcontention/bin/sh/nodes.c.pat Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/bin/sh/nodes.c.pat Mon Apr 8 19:51:46 2013 (r249273) @@ -58,7 +58,7 @@ static void calcsize(union node *); static void sizenodelist(struct nodelist *); static union node *copynode(union node *); static struct nodelist *copynodelist(struct nodelist *); -static char *nodesavestr(char *); +static char *nodesavestr(const char *); struct funcdef { @@ -147,9 +147,9 @@ copynodelist(struct nodelist *lp) static char * -nodesavestr(char *s) +nodesavestr(const char *s) { - char *p = s; + const char *p = s; char *q = funcstring; char *rtn = funcstring; Modified: user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Apr 8 19:51:46 2013 (r249273) @@ -21,10 +21,11 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #include +#include #include #include #include @@ -237,18 +238,18 @@ zdb_nicenum(uint64_t num, char *buf) nicenum(num, buf); } -const char dump_zap_stars[] = "****************************************"; -const int dump_zap_width = sizeof (dump_zap_stars) - 1; +const char histo_stars[] = "****************************************"; +const int histo_width = sizeof (histo_stars) - 1; static void -dump_zap_histogram(uint64_t histo[ZAP_HISTOGRAM_SIZE]) +dump_histogram(const uint64_t *histo, int size) { int i; - int minidx = ZAP_HISTOGRAM_SIZE - 1; + int minidx = size - 1; int maxidx = 0; uint64_t max = 0; - for (i = 0; i < ZAP_HISTOGRAM_SIZE; i++) { + for (i = 0; i < size; i++) { if (histo[i] > max) max = histo[i]; if (histo[i] > 0 && i > maxidx) @@ -257,12 +258,14 @@ dump_zap_histogram(uint64_t histo[ZAP_HI minidx = i; } - if (max < dump_zap_width) - max = dump_zap_width; + if (max < histo_width) + max = histo_width; - for (i = minidx; i <= maxidx; i++) - (void) printf("\t\t\t%u: %6llu %s\n", i, (u_longlong_t)histo[i], - &dump_zap_stars[(max - histo[i]) * dump_zap_width / max]); + for (i = minidx; i <= maxidx; i++) { + (void) printf("\t\t\t%3u: %6llu %s\n", + i, (u_longlong_t)histo[i], + &histo_stars[(max - histo[i]) * histo_width / max]); + } } static void @@ -313,19 +316,19 @@ dump_zap_stats(objset_t *os, uint64_t ob (u_longlong_t)zs.zs_salt); (void) printf("\t\tLeafs with 2^n pointers:\n"); - dump_zap_histogram(zs.zs_leafs_with_2n_pointers); + dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBlocks with n*5 entries:\n"); - dump_zap_histogram(zs.zs_blocks_with_n5_entries); + dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBlocks n/10 full:\n"); - dump_zap_histogram(zs.zs_blocks_n_tenths_full); + dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tEntries with n chunks:\n"); - dump_zap_histogram(zs.zs_entries_using_n_chunks); + dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBuckets with n entries:\n"); - dump_zap_histogram(zs.zs_buckets_with_n_entries); + dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE); } /*ARGSUSED*/ @@ -947,7 +950,7 @@ sprintf_blkptr_compact(char *blkbuf, con const dva_t *dva = bp->blk_dva; int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1; - if (dump_opt['b'] >= 5) { + if (dump_opt['b'] >= 6) { sprintf_blkptr(blkbuf, bp); return; } @@ -1986,11 +1989,13 @@ dump_one_dir(const char *dsname, void *a /* * Block statistics. */ +#define PSIZE_HISTO_SIZE (SPA_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1) typedef struct zdb_blkstats { - uint64_t zb_asize; - uint64_t zb_lsize; - uint64_t zb_psize; - uint64_t zb_count; + uint64_t zb_asize; + uint64_t zb_lsize; + uint64_t zb_psize; + uint64_t zb_count; + uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE]; } zdb_blkstats_t; /* @@ -2014,6 +2019,9 @@ typedef struct zdb_cb { zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; uint64_t zcb_dedup_asize; uint64_t zcb_dedup_blocks; + uint64_t zcb_start; + uint64_t zcb_lastprint; + uint64_t zcb_totalasize; uint64_t zcb_errors[256]; int zcb_readfails; int zcb_haderrors; @@ -2040,6 +2048,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t * zb->zb_lsize += BP_GET_LSIZE(bp); zb->zb_psize += BP_GET_PSIZE(bp); zb->zb_count++; + zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++; } if (dump_opt['L']) @@ -2126,7 +2135,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog zcb->zcb_readfails = 0; - if (dump_opt['b'] >= 4) { + if (dump_opt['b'] >= 5) { sprintf_blkptr(blkbuf, bp); (void) printf("objset %llu object %llu " "level %lld offset 0x%llx %s\n", @@ -2137,6 +2146,28 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog blkbuf); } + if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) && + gethrtime() > zcb->zcb_lastprint + NANOSEC) { + uint64_t now = gethrtime(); + char buf[10]; + uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize; + int kb_per_sec = + 1 + bytes / (1 + ((now - zcb->zcb_start) / 1000 / 1000)); + int sec_remaining = + (zcb->zcb_totalasize - bytes) / 1024 / kb_per_sec; + + zfs_nicenum(bytes, buf, sizeof (buf)); + (void) fprintf(stderr, + "\r%5s completed (%4dMB/s) " + "estimated time remaining: %uhr %02umin %02usec ", + buf, kb_per_sec / 1024, + sec_remaining / 60 / 60, + sec_remaining / 60 % 60, + sec_remaining % 60); + + zcb->zcb_lastprint = now; + } + return (0); } @@ -2268,7 +2299,7 @@ count_block_cb(void *arg, const blkptr_t { zdb_cb_t *zcb = arg; - if (dump_opt['b'] >= 4) { + if (dump_opt['b'] >= 5) { char blkbuf[BP_SPRINTF_LEN]; sprintf_blkptr(blkbuf, bp); (void) printf("[%s] %s\n", @@ -2287,7 +2318,7 @@ dump_block_stats(spa_t *spa) int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; int leaks = 0; - (void) printf("\nTraversing all blocks %s%s%s%s%s...\n", + (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", (dump_opt['c'] == 1) ? "metadata " : "", dump_opt['c'] ? "checksums " : "", @@ -2323,6 +2354,8 @@ dump_block_stats(spa_t *spa) if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; + zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa)); + zcb.zcb_start = zcb.zcb_lastprint = gethrtime(); zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); if (zcb.zcb_haderrors) { @@ -2450,6 +2483,14 @@ dump_block_stats(spa_t *spa) else (void) printf(" L%d %s\n", level, typename); + + if (dump_opt['b'] >= 4) { + (void) printf("psize " + "(in 512-byte sectors): " + "number of blocks\n"); + dump_histogram(zb->zb_psize_histogram, + PSIZE_HISTO_SIZE); + } } } } Modified: user/attilio/vmcontention/etc/devd/usb.conf ============================================================================== --- user/attilio/vmcontention/etc/devd/usb.conf Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/etc/devd/usb.conf Mon Apr 8 19:51:46 2013 (r249273) @@ -120,7 +120,23 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x03f0"; - match "product" "(0x2016|0x2116|0x2216|0x3016|0x3116|0x3216)"; + match "product" "(0x2016|0x2116|0x2216|0x3016|0x3116)"; + action "kldload -n uipaq"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x03f0"; + match "product" "0x311d"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x03f0"; + match "product" "0x3216"; action "kldload -n uipaq"; }; @@ -168,7 +184,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0403"; - match "product" "(0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed74|0xee18|0xeee8|0xeee9|0xeeea|0xeee b|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; + match "product" "(0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed74|0xee18|0xeee8|0xeee 9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; action "kldload -n uftdi"; }; @@ -280,7 +296,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0411"; - match "product" "(0x0116|0x0119)"; + match "product" "(0x00f4|0x0116|0x0119)"; action "kldload -n if_rum"; }; @@ -423,6 +439,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0489"; + match "product" "(0xe027|0xe02c|0xe036|0xe03c|0xe03d|0xe04e|0xe056|0xe057)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0499"; match "product" "(0x1000|0x1001|0x1002|0x1003|0x1004|0x1005|0x1006|0x1007|0x1008|0x1009|0x100a|0x100c|0x100d|0x100e|0x100f|0x1010|0x1011|0x1012|0x1013|0x1014|0x1015|0x1016|0x1017|0x1018|0x1019|0x101a|0x101b|0x101c|0x101d|0x101e|0x101f|0x1020|0x1021|0x1022|0x1023|0x1024|0x1025|0x1026|0x1027|0x1028|0x1029|0x102a|0x102b|0x102e|0x1030|0x1031|0x1032|0x1033|0x1034|0x1035|0x1036|0x1037|0x1038|0x1039|0x103a|0x103b|0x103c|0x103d|0x103e|0x103f|0x1040|0x1041|0x1042|0x1043|0x1044|0x1045|0x104e|0x104f|0x1050|0x1051|0x1052|0x1053|0x1054|0x1055|0x1056|0x1057|0x1058|0x1059|0x105a|0x105b|0x105c|0x105d|0x1503|0x2000|0x2001|0x2002|0x2003|0x5000|0x5001|0x5002|0x5003|0x5004|0x5005|0x5006|0x5007|0x5008|0x5009|0x500a|0x500b|0x500c|0x500d|0x500e|0x500f|0x7000|0x7010)"; action "kldload -n snd_uaudio"; @@ -559,6 +583,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x04ca"; + match "product" "(0x3005|0x3006|0x3008)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x04da"; match "product" "0x2500"; action "kldload -n uipaq"; @@ -800,7 +832,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0525"; - match "product" "0x1080"; + match "product" "(0x1080|0xa4a0)"; action "kldload -n udbp"; }; @@ -1103,6 +1135,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x065a"; + match "product" "(0xc000|0xc001)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x066b"; match "product" "(0x200c|0x2202)"; action "kldload -n if_aue"; @@ -1344,7 +1384,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0789"; - match "product" "(0x0162|0x0163|0x0164|0x0166|0x0168)"; + match "product" "(0x0162|0x0163|0x0164|0x0166|0x0168|0x0169)"; action "kldload -n if_run"; }; @@ -1800,6 +1840,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0930"; + match "product" "(0x0215|0x0219)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0930"; match "product" "(0x0700|0x0705|0x0706|0x0707|0x0708|0x0709|0x070a|0x070b)"; action "kldload -n uipaq"; }; @@ -2375,6 +2423,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0cf3"; + match "product" "(0x3002|0x3004|0x311d|0xe004|0xe019)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0d3a"; match "product" "0x0300"; action "kldload -n uftdi"; @@ -3224,15 +3280,39 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x13d3"; - match "product" "(0x3247|0x3262|0x3273|0x3284|0x3305)"; + match "product" "(0x3247|0x3262|0x3273|0x3284)"; + action "kldload -n if_run"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x13d3"; + match "product" "0x3304"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x13d3"; + match "product" "0x3305"; action "kldload -n if_run"; }; nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x13d3"; + match "product" "(0x3362|0x3375|0x3393)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1410"; - match "product" "(0x1100|0x1110|0x1120|0x1130|0x1400|0x1410|0x1420|0x1430|0x1450|0x2100|0x2110|0x2120|0x2130|0x2400|0x2410|0x2420|0x4100|0x4400|0x5010|0x5100|0x6000|0x6002|0x7042)"; + match "product" "(0x1100|0x1110|0x1120|0x1130|0x1400|0x1410|0x1420|0x1430|0x1450|0x2100|0x2110|0x2120|0x2130|0x2400|0x2410|0x2420|0x4100|0x4400|0x5010|0x5041|0x5100|0x6000|0x6002|0x7042)"; action "kldload -n u3g"; }; @@ -4040,7 +4120,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "0x1a00"; + match "product" "(0x1a00|0x1a02)"; action "kldload -n if_axe"; }; @@ -4096,7 +4176,23 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "(0x4001|0x4002|0x4003|0x400b|0x4102|0xabc1)"; + match "product" "(0x4001|0x4002|0x4003|0x400b|0x4102)"; + action "kldload -n if_aue"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x2001"; + match "product" "(0x7e12|0xa805)"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x2001"; + match "product" "0xabc1"; action "kldload -n if_aue"; }; @@ -4215,6 +4311,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x22b8"; + match "product" "0x710f"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x22de"; match "product" "0x6801"; action "kldload -n u3g"; @@ -4495,6 +4599,16 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0a5c"; + match "intclass" "0xff"; + match "intsubclass" "0x01"; + match "intprotocol" "0x01"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "intclass" "0x02"; match "intsubclass" "0x02"; match "intprotocol" "0x01"; @@ -4635,5 +4749,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2386 USB entries processed +# 2422 USB entries processed Modified: user/attilio/vmcontention/sbin/camcontrol/camcontrol.8 ============================================================================== --- user/attilio/vmcontention/sbin/camcontrol/camcontrol.8 Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/sbin/camcontrol/camcontrol.8 Mon Apr 8 19:51:46 2013 (r249273) @@ -1118,14 +1118,15 @@ usually takes just a few seconds. Freeze the security configuration of the specified device. .Pp After command completion any other commands that update the device lock mode -shall be command aborted. Frozen mode is disabled by power-off or hardware reset. +shall be command aborted. +Frozen mode is disabled by power-off or hardware reset. .It Fl h Ar pwd .Pp Enhanced erase the device using the given password for the selected user. .Pp .Em WARNING! WARNING! WARNING! .Pp -Issuing an enhanced secure erase will +Issuing an enhanced secure erase will .Em ERASE ALL user data on the device and may take several hours to complete. .Pp @@ -1378,7 +1379,7 @@ camcontrol security ada0 .Pp Report security support and settings for ada0 .Bd -literal -offset indent -camcontrol security ada0 -u user -s MyPass +camcontrol security ada0 -u user -s MyPass .Ed .Pp Enable security on device ada0 with the password MyPass Modified: user/attilio/vmcontention/sbin/camcontrol/camcontrol.c ============================================================================== --- user/attilio/vmcontention/sbin/camcontrol/camcontrol.c Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/sbin/camcontrol/camcontrol.c Mon Apr 8 19:51:46 2013 (r249273) @@ -1734,7 +1734,7 @@ enum { ATA_SECURITY_ACTION_ERASE, ATA_SECURITY_ACTION_ERASE_ENHANCED, ATA_SECURITY_ACTION_SET_PASSWORD -} atasecurity_action; +}; static void atasecurity_print_time(u_int16_t tw) Modified: user/attilio/vmcontention/share/man/man4/mld.4 ============================================================================== --- user/attilio/vmcontention/share/man/man4/mld.4 Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/share/man/man4/mld.4 Mon Apr 8 19:51:46 2013 (r249273) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2009 +.Dd April 8, 2013 .Dt MLD 4 .Os .Sh NAME @@ -68,11 +68,6 @@ to the protocol. .Sh SYSCTL VARIABLES .Bl -tag -width indent .\" -.It net.inet6.mld.stats -This opaque read-only variable exposes the stack-wide MLDv2 -protocol statistics to -.Xr netstat 1 . -.\" .It net.inet6.mld.ifinfo This opaque read-only variable exposes the per-link MLDv2 status to .Xr ifmcstat 8 . @@ -94,11 +89,12 @@ This sysctl is normally enabled by defau .\" .El .Sh SEE ALSO -.Xr ifmcstat 8 , +.Xr netstat 1 , +.Xr sourcefilter 3 , +.Xr icmp6 4 , .Xr inet 4 , .Xr multicast 4 , -.Xr netstat 1 , -.Xr sourcefilter 3 +.Xr ifmcstat 8 .Sh HISTORY The .Nm Modified: user/attilio/vmcontention/share/man/man9/Makefile ============================================================================== --- user/attilio/vmcontention/share/man/man9/Makefile Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/share/man/man9/Makefile Mon Apr 8 19:51:46 2013 (r249273) @@ -51,6 +51,7 @@ MAN= accept_filter.9 \ config_intrhook.9 \ contigmalloc.9 \ copy.9 \ + counter.9 \ cr_cansee.9 \ critical_enter.9 \ cr_seeothergids.9 \ @@ -569,6 +570,14 @@ MLINKS+=copy.9 copyin.9 \ copy.9 copyout.9 \ copy.9 copyout_nofault.9 \ copy.9 copystr.9 +MLINKS+=counter.9 counter_u64_alloc.9 \ + counter.9 counter_u64_free.9 \ + counter.9 counter_u64_add.9 \ + counter.9 counter_enter.9 \ + counter.9 counter_exit.9 \ + counter.9 counter_u64_add_protected.9 \ + counter.9 counter_u64_fetch.9 \ + counter.9 counter_u64_zero.9 MLINKS+=critical_enter.9 critical.9 \ critical_enter.9 critical_exit.9 MLINKS+=crypto.9 crypto_dispatch.9 \ Copied: user/attilio/vmcontention/share/man/man9/counter.9 (from r249270, head/share/man/man9/counter.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/share/man/man9/counter.9 Mon Apr 8 19:51:46 2013 (r249273, copy of r249270, head/share/man/man9/counter.9) @@ -0,0 +1,200 @@ +.\"- +.\" Copyright (c) 2013 Gleb Smirnoff +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 3, 2013 +.Dt COUNTER 9 +.Os +.Sh NAME +.Nm counter +.Nd "SMP-friendly kernel counter implementation" +.Sh SYNOPSIS +.In sys/types.h +.In sys/counter.h +.Ft counter_u64_t +.Fn counter_u64_alloc "int wait" +.Ft void +.Fn counter_u64_free "counter_u64_t c" +.Ft void +.Fn counter_u64_add "counter_u64_t c" "int64_t v" +.Ft void +.Fn counter_enter +.Ft void +.Fn counter_exit +.Ft void +.Fn counter_u64_add_protected "counter_u64_t c" "int64_t v" +.Ft uint64_t +.Fn counter_u64_fetch "counter_u64_t c" +.Ft void +.Fn counter_u64_zero "counter_u64_t c" +.In sys/sysctl.h +.Fn SYSCTL_COUNTER_U64 parent nbr name access ptr val descr +.Fn SYSCTL_ADD_COUNTER_U64 ctx parent nbr name access ptr descr +.Sh DESCRIPTION +.Nm +is a generic facility to create counters +that can be utilized for any purpose (such as collecting statistical +data). +A +.Nm +is guaranteed to be lossless when several kernel threads do simultaneous +updates. +However, +.Nm +does not block the calling thread, +also no +.Xr atomic 9 +operations are used for the update, therefore the counters +can be used in any non-interrupt context. +Moreover, +.Nm +has special optimisations for SMP environments, making +.Nm +update faster than simple arithmetic on the global variable. +Thus +.Nm +is considered suitable for accounting in the performance-critical +code pathes. +.Bl -tag -width indent +.It Fn counter_u64_alloc how +Allocate a new 64-bit unsigned counter. +The +.Fa wait +argument is the +.Xr malloc 9 +wait flag, should be either +.Va M_NOWAIT +or +.Va M_WAITOK . +If +.Va M_WAITOK +is specified the operation may fail. +.It Fn counter_u64_free c +Free the previously allocated counter +.Fa c . +.It Fn counter_u64_add c v +Add +.Fa v +to +.Fa c . +The KPI does not guarantee any protection from wraparound. +.It Fn counter_enter +Enter mode that would allow to safely update several counters via +.Fn counter_u64_add_protected . +On some machines this expands to +.Xr critical 9 +section, while on other is a nop. +See +.Sx IMPLEMENTATION DETAILS . +.It Fn counter_exit +Exit mode for updating several counters. +.It Fn counter_u64_add_protected c v +Same as +.Fn counter_u64_add , +but should be preceded by +.Fn counter_enter . +.It Fn counter_u64_fetch c +Take a snapshot of counter +.Fa c . +The data obtained is not guaranteed to reflect the real cumulative +value for any moment. +.It Fn counter_u64_zero c +Clear the counter +.Fa c +and set it to zero. +.It Fn SYSCTL_COUNTER_U64 parent nbr name access ptr val descr +Declare a static +.Xr sysctl +oid that would represent a +.Nm . +The +.Fa ptr +argument should be a pointer to allocated +.Vt counter_u64_t . +A read of the oid returns value obtained through +.Fn counter_u64_fetch . +Any write to the oid zeroes it. +.It Fn SYSCTL_ADD_COUNTER_U64 ctx parent nbr name access ptr descr +Create a +.Xr sysctl +oid that would represent a +.Nm . +The +.Fa ptr +argument should be a pointer to allocated +.Vt counter_u64_t . +A read of the oid returns value obtained through +.Fn counter_u64_fetch . +Any write to the oid zeroes it. +.El +.Sh IMPLEMENTATION DETAILS +On all architectures +.Nm +is implemented using per-CPU data fields that are specially aligned +in memory, to avoid inter-CPU bus traffic due to shared use +of the variables between CPUs. +These are allocated using +.Va UMA_ZONE_PCPU +.Xr uma 9 +zone. +The update operation only touches the field that is private to current CPU. +Fetch operation loops through all per-CPU fields and obtains a snapshot +sum of all fields. +.Pp +On amd64 a +.Nm counter +update is implemented as a single instruction without lock semantics, +operating on the private data for the current CPU, +which is safe against preemption and interrupts. +.Pp +On i386 architecture, when machine supports the cmpxchg8 instruction, +this instruction is used. +The multi-instruction sequence provides the same guarantees as the +amd64 single-instruction implementation. +.Pp +On some architectures updating a counter require a +.Xr critical 9 +section. +.Sh SEE ALSO +.Xr atomic 9 , +.Xr critical 9 , +.Xr locking 9 , +.Xr malloc 9 , +.Xr sysctl 9 , +.Xr uma 9 +.Sh HISTORY +The +.Nm +facility first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +facility was written by +.An Gleb Smirnoff +and +.An Konstantin Belousov . Modified: user/attilio/vmcontention/share/man/man9/sbuf.9 ============================================================================== --- user/attilio/vmcontention/share/man/man9/sbuf.9 Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/share/man/man9/sbuf.9 Mon Apr 8 19:51:46 2013 (r249273) @@ -94,7 +94,7 @@ .Fn sbuf_finish "struct sbuf *s" .Ft char * .Fn sbuf_data "struct sbuf *s" -.Ft int +.Ft ssize_t .Fn sbuf_len "struct sbuf *s" .Ft int .Fn sbuf_done "struct sbuf *s" Modified: user/attilio/vmcontention/share/man/man9/zone.9 ============================================================================== --- user/attilio/vmcontention/share/man/man9/zone.9 Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/share/man/man9/zone.9 Mon Apr 8 19:51:46 2013 (r249273) @@ -153,6 +153,23 @@ See .Fn uma_find_refcnt . .It Dv UMA_ZONE_NODUMP Pages belonging to the zone will not be included into mini-dumps. +.It Dv UMA_ZONE_PCPU +An allocation from zone would have +.Va mp_ncpu +shadow copies, that are privately assigned to CPUs. +A CPU can address its private copy using base allocation address plus +multiple of current CPU id and +.Fn sizeof "struct pcpu" : +.Bd -literal -offset indent +foo_zone = uma_zcreate(..., UMA_ZONE_PCPU); + ... +foo_base = uma_zalloc(foo_zone, ...); + ... +critical_enter(); +foo_pcpu = (foo_t *)zpcpu_get(foo_base); +/* do something with foo_pcpu */ +critical_exit(); +.Ed .It Dv UMA_ZONE_OFFPAGE By default book-keeping of items within a slab is done in the slab page itself. This flag explicitly tells subsystem that book-keeping structure should be Copied: user/attilio/vmcontention/sys/amd64/include/counter.h (from r249270, head/sys/amd64/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/sys/amd64/include/counter.h Mon Apr 8 19:51:46 2013 (r249273, copy of r249270, head/sys/amd64/include/counter.h) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include + +extern struct pcpu __pcpu[1]; + +#define counter_enter() do {} while (0) +#define counter_exit() do {} while (0) + +#define counter_u64_add_protected(c, i) counter_u64_add(c, i) + +static inline void +counter_u64_add(counter_u64_t c, int64_t inc) +{ + + __asm __volatile("addq\t%1,%%gs:(%0)" + : + : "r" ((char *)c - (char *)&__pcpu[0]), "r" (inc) + : "memory", "cc"); +} + +#endif /* ! __MACHINE_COUNTER_H__ */ Modified: user/attilio/vmcontention/sys/amd64/include/pcpu.h ============================================================================== --- user/attilio/vmcontention/sys/amd64/include/pcpu.h Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/sys/amd64/include/pcpu.h Mon Apr 8 19:51:46 2013 (r249273) @@ -77,7 +77,9 @@ /* Pointer to the CPU TSS descriptor */ \ struct system_segment_descriptor *pc_tss; \ u_int pc_cmci_mask /* MCx banks for CMCI */ \ - PCPU_XEN_FIELDS + PCPU_XEN_FIELDS; \ + char __pad[293] /* be divisor of PAGE_SIZE \ + after cache alignment */ #ifdef _KERNEL Modified: user/attilio/vmcontention/sys/arm/at91/at91_pio.c ============================================================================== --- user/attilio/vmcontention/sys/arm/at91/at91_pio.c Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/sys/arm/at91/at91_pio.c Mon Apr 8 19:51:46 2013 (r249273) @@ -554,12 +554,12 @@ at91_pio_gpio_clear(uint32_t pio, uint32 PIO[PIO_CODR / 4] = data_mask; } -uint8_t +uint32_t at91_pio_gpio_get(uint32_t pio, uint32_t data_mask) { uint32_t *PIO = (uint32_t *)(AT91_BASE + pio); - return ((PIO[PIO_PDSR / 4] & data_mask)); + return (PIO[PIO_PDSR / 4] & data_mask); } void Modified: user/attilio/vmcontention/sys/arm/at91/at91_piovar.h ============================================================================== --- user/attilio/vmcontention/sys/arm/at91/at91_piovar.h Mon Apr 8 19:50:15 2013 (r249272) +++ user/attilio/vmcontention/sys/arm/at91/at91_piovar.h Mon Apr 8 19:51:46 2013 (r249273) @@ -39,7 +39,7 @@ void at91_pio_gpio_output(uint32_t pio, void at91_pio_gpio_high_z(uint32_t pio, uint32_t high_z_mask, int enable); void at91_pio_gpio_set(uint32_t pio, uint32_t data_mask); void at91_pio_gpio_clear(uint32_t pio, uint32_t data_mask); -uint8_t at91_pio_gpio_get(uint32_t pio, uint32_t data_mask); +uint32_t at91_pio_gpio_get(uint32_t pio, uint32_t data_mask); void at91_pio_gpio_set_deglitch(uint32_t pio, uint32_t data_mask, int use_deglitch); void at91_pio_gpio_set_interrupt(uint32_t pio, uint32_t data_mask, Copied: user/attilio/vmcontention/sys/arm/include/counter.h (from r249270, head/sys/arm/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/sys/arm/include/counter.h Mon Apr 8 19:51:46 2013 (r249273, copy of r249270, head/sys/arm/include/counter.h) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include +#ifdef INVARIANTS +#include +#endif + +#define counter_enter() critical_enter() +#define counter_exit() critical_exit() + +#define counter_u64_add_protected(c, inc) do { \ + CRITICAL_ASSERT(curthread); \ + *(uint64_t *)zpcpu_get(c) += (inc); \ +} while (0) + +static inline void +counter_u64_add(counter_u64_t c, int64_t inc) +{ + + counter_enter(); + counter_u64_add_protected(c, inc); + counter_exit(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Apr 8 19:56:18 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 699BD58F; Mon, 8 Apr 2013 19:56:18 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 59C9F7BD; Mon, 8 Apr 2013 19:56:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r38JuIY8000875; Mon, 8 Apr 2013 19:56:18 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r38JuF2r000853; Mon, 8 Apr 2013 19:56:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304081956.r38JuF2r000853@svn.freebsd.org> From: Attilio Rao Date: Mon, 8 Apr 2013 19:56:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249275 - in user/attilio/vmobj-readlock: . bin/sh cddl/contrib/opensolaris/cmd/zdb etc/devd sbin/camcontrol share/man/man4 share/man/man9 sys/amd64/include sys/arm/at91 sys/arm/include... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 19:56:18 -0000 Author: attilio Date: Mon Apr 8 19:56:14 2013 New Revision: 249275 URL: http://svnweb.freebsd.org/changeset/base/249275 Log: MFC Added: user/attilio/vmobj-readlock/share/man/man9/counter.9 - copied unchanged from r249273, user/attilio/vmcontention/share/man/man9/counter.9 user/attilio/vmobj-readlock/sys/amd64/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/amd64/include/counter.h user/attilio/vmobj-readlock/sys/arm/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/arm/include/counter.h user/attilio/vmobj-readlock/sys/i386/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/i386/include/counter.h user/attilio/vmobj-readlock/sys/ia64/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/ia64/include/counter.h user/attilio/vmobj-readlock/sys/kern/subr_counter.c - copied unchanged from r249273, user/attilio/vmcontention/sys/kern/subr_counter.c user/attilio/vmobj-readlock/sys/mips/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/mips/include/counter.h user/attilio/vmobj-readlock/sys/pc98/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/pc98/include/counter.h user/attilio/vmobj-readlock/sys/powerpc/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/powerpc/include/counter.h user/attilio/vmobj-readlock/sys/sparc64/include/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/sparc64/include/counter.h user/attilio/vmobj-readlock/sys/sys/counter.h - copied unchanged from r249273, user/attilio/vmcontention/sys/sys/counter.h user/attilio/vmobj-readlock/tools/regression/bin/sh/builtins/eval6.0 - copied unchanged from r249273, user/attilio/vmcontention/tools/regression/bin/sh/builtins/eval6.0 user/attilio/vmobj-readlock/usr.sbin/mfiutil/mfi_bbu.c - copied unchanged from r249273, user/attilio/vmcontention/usr.sbin/mfiutil/mfi_bbu.c Deleted: user/attilio/vmobj-readlock/sys/dev/ata/ata-queue.c user/attilio/vmobj-readlock/sys/modules/ata/atadevel/ Modified: user/attilio/vmobj-readlock/UPDATING user/attilio/vmobj-readlock/bin/sh/nodes.c.pat user/attilio/vmobj-readlock/cddl/contrib/opensolaris/cmd/zdb/zdb.c user/attilio/vmobj-readlock/etc/devd/usb.conf user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.8 user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.c user/attilio/vmobj-readlock/share/man/man4/mld.4 user/attilio/vmobj-readlock/share/man/man9/Makefile user/attilio/vmobj-readlock/share/man/man9/sbuf.9 user/attilio/vmobj-readlock/share/man/man9/zone.9 user/attilio/vmobj-readlock/sys/amd64/include/pcpu.h user/attilio/vmobj-readlock/sys/arm/at91/at91_pio.c user/attilio/vmobj-readlock/sys/arm/at91/at91_piovar.h user/attilio/vmobj-readlock/sys/arm/include/pcpu.h user/attilio/vmobj-readlock/sys/boot/ficl/arm/sysdep.h user/attilio/vmobj-readlock/sys/boot/ficl/tools.c user/attilio/vmobj-readlock/sys/cam/ata/ata_all.h user/attilio/vmobj-readlock/sys/cam/ata/ata_da.c user/attilio/vmobj-readlock/sys/cam/ata/ata_xpt.c user/attilio/vmobj-readlock/sys/cam/cam_ccb.h user/attilio/vmobj-readlock/sys/cam/cam_sim.h user/attilio/vmobj-readlock/sys/cam/ctl/ctl.c user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c user/attilio/vmobj-readlock/sys/conf/files user/attilio/vmobj-readlock/sys/conf/options user/attilio/vmobj-readlock/sys/contrib/ipfilter/netinet/ip_auth.c user/attilio/vmobj-readlock/sys/dev/ata/ata-all.c user/attilio/vmobj-readlock/sys/dev/ata/ata-all.h user/attilio/vmobj-readlock/sys/dev/ata/ata-cbus.c user/attilio/vmobj-readlock/sys/dev/ata/ata-isa.c user/attilio/vmobj-readlock/sys/dev/ata/ata-lowlevel.c user/attilio/vmobj-readlock/sys/dev/ata/ata-pci.c user/attilio/vmobj-readlock/sys/dev/ata/ata-sata.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-acard.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-acerlabs.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-adaptec.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-ahci.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-amd.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-ati.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-cenatek.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-cypress.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-cyrix.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-fsl.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-highpoint.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-intel.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-ite.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-jmicron.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-marvell.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-micron.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-national.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-netcell.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-nvidia.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-promise.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-serverworks.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-siliconimage.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-sis.c user/attilio/vmobj-readlock/sys/dev/ata/chipsets/ata-via.c user/attilio/vmobj-readlock/sys/dev/drm2/drm_dp_iic_helper.c user/attilio/vmobj-readlock/sys/dev/mfi/mfi_debug.c user/attilio/vmobj-readlock/sys/dev/mfi/mfireg.h user/attilio/vmobj-readlock/sys/dev/usb/controller/at91dci_atmelarm.c user/attilio/vmobj-readlock/sys/dev/usb/serial/uftdi.c user/attilio/vmobj-readlock/sys/dev/usb/usbdevs user/attilio/vmobj-readlock/sys/fs/ext2fs/ext2_alloc.c user/attilio/vmobj-readlock/sys/i386/include/pcpu.h user/attilio/vmobj-readlock/sys/ia64/include/pcpu.h user/attilio/vmobj-readlock/sys/kern/imgact_elf.c user/attilio/vmobj-readlock/sys/kern/kern_descrip.c user/attilio/vmobj-readlock/sys/kern/uipc_mqueue.c user/attilio/vmobj-readlock/sys/kern/uipc_sem.c user/attilio/vmobj-readlock/sys/kern/uipc_shm.c user/attilio/vmobj-readlock/sys/kern/vfs_subr.c user/attilio/vmobj-readlock/sys/mips/include/pcpu.h user/attilio/vmobj-readlock/sys/modules/ata/atacard/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atacbus/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atacore/Makefile user/attilio/vmobj-readlock/sys/modules/ata/ataisa/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataacard/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataacerlabs/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataadaptec/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataahci/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataamd/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataati/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atacenatek/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atacypress/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atacyrix/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atahighpoint/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataintel/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataite/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atajmicron/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atamarvell/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atamicron/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atanational/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atanetcell/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atanvidia/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atapromise/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/ataserverworks/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atasiliconimage/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atasis/Makefile user/attilio/vmobj-readlock/sys/modules/ata/atapci/chipsets/atavia/Makefile user/attilio/vmobj-readlock/sys/modules/cam/Makefile user/attilio/vmobj-readlock/sys/modules/usb/umass/Makefile user/attilio/vmobj-readlock/sys/modules/usb/urio/Makefile user/attilio/vmobj-readlock/sys/modules/usb/usfs/Makefile user/attilio/vmobj-readlock/sys/powerpc/include/pcpu.h user/attilio/vmobj-readlock/sys/powerpc/powermac/ata_dbdma.c user/attilio/vmobj-readlock/sys/powerpc/powermac/ata_kauai.c user/attilio/vmobj-readlock/sys/powerpc/powermac/ata_macio.c user/attilio/vmobj-readlock/sys/powerpc/psim/ata_iobus.c user/attilio/vmobj-readlock/sys/rpc/svc_vc.c user/attilio/vmobj-readlock/sys/sparc64/include/pcpu.h user/attilio/vmobj-readlock/sys/sys/pcpu.h user/attilio/vmobj-readlock/sys/sys/sysctl.h user/attilio/vmobj-readlock/sys/ufs/ffs/ffs_softdep.c user/attilio/vmobj-readlock/sys/ufs/ffs/ffs_vfsops.c user/attilio/vmobj-readlock/sys/vm/uma.h user/attilio/vmobj-readlock/sys/vm/uma_core.c user/attilio/vmobj-readlock/sys/vm/uma_int.h user/attilio/vmobj-readlock/sys/vm/vm_pager.c user/attilio/vmobj-readlock/sys/vm/vm_radix.c user/attilio/vmobj-readlock/usr.bin/calendar/calendar.1 user/attilio/vmobj-readlock/usr.sbin/mfiutil/Makefile user/attilio/vmobj-readlock/usr.sbin/mfiutil/mfi_show.c user/attilio/vmobj-readlock/usr.sbin/mfiutil/mfi_volume.c user/attilio/vmobj-readlock/usr.sbin/mfiutil/mfiutil.8 user/attilio/vmobj-readlock/usr.sbin/mfiutil/mfiutil.c user/attilio/vmobj-readlock/usr.sbin/mfiutil/mfiutil.h user/attilio/vmobj-readlock/usr.sbin/rarpd/rarpd.c user/attilio/vmobj-readlock/usr.sbin/watchdogd/watchdogd.c Directory Properties: user/attilio/vmobj-readlock/ (props changed) user/attilio/vmobj-readlock/cddl/ (props changed) user/attilio/vmobj-readlock/cddl/contrib/opensolaris/ (props changed) user/attilio/vmobj-readlock/sbin/ (props changed) user/attilio/vmobj-readlock/share/man/man4/ (props changed) user/attilio/vmobj-readlock/sys/ (props changed) user/attilio/vmobj-readlock/sys/boot/ (props changed) user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmobj-readlock/sys/conf/ (props changed) user/attilio/vmobj-readlock/usr.bin/calendar/ (props changed) Modified: user/attilio/vmobj-readlock/UPDATING ============================================================================== --- user/attilio/vmobj-readlock/UPDATING Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/UPDATING Mon Apr 8 19:56:14 2013 (r249275) @@ -26,6 +26,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20130404: + Legacy ATA stack, disabled and replaced by new CAM-based one since + FreeBSD 9.0, completely removed from the sources. Kernel modules + atadisk and atapi*, user-level tools atacontrol and burncd are + removed. Kernel option `options ATA_CAM` is now permanently enabled + and removed. + +20130319: + SOCK_CLOEXEC and SOCK_NONBLOCK flags have been added to socket(2) + and socketpair(2). Software, in particular Kerberos, may + automatically detect and use these during building. The resulting + binaries will not work on older kernels. + 20130308: CTL_DISABLE has also been added to the sparc64 GENERIC (for further information, see the respective 20130304 entry). Modified: user/attilio/vmobj-readlock/bin/sh/nodes.c.pat ============================================================================== --- user/attilio/vmobj-readlock/bin/sh/nodes.c.pat Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/bin/sh/nodes.c.pat Mon Apr 8 19:56:14 2013 (r249275) @@ -58,7 +58,7 @@ static void calcsize(union node *); static void sizenodelist(struct nodelist *); static union node *copynode(union node *); static struct nodelist *copynodelist(struct nodelist *); -static char *nodesavestr(char *); +static char *nodesavestr(const char *); struct funcdef { @@ -147,9 +147,9 @@ copynodelist(struct nodelist *lp) static char * -nodesavestr(char *s) +nodesavestr(const char *s) { - char *p = s; + const char *p = s; char *q = funcstring; char *rtn = funcstring; Modified: user/attilio/vmobj-readlock/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- user/attilio/vmobj-readlock/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Apr 8 19:56:14 2013 (r249275) @@ -21,10 +21,11 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #include +#include #include #include #include @@ -237,18 +238,18 @@ zdb_nicenum(uint64_t num, char *buf) nicenum(num, buf); } -const char dump_zap_stars[] = "****************************************"; -const int dump_zap_width = sizeof (dump_zap_stars) - 1; +const char histo_stars[] = "****************************************"; +const int histo_width = sizeof (histo_stars) - 1; static void -dump_zap_histogram(uint64_t histo[ZAP_HISTOGRAM_SIZE]) +dump_histogram(const uint64_t *histo, int size) { int i; - int minidx = ZAP_HISTOGRAM_SIZE - 1; + int minidx = size - 1; int maxidx = 0; uint64_t max = 0; - for (i = 0; i < ZAP_HISTOGRAM_SIZE; i++) { + for (i = 0; i < size; i++) { if (histo[i] > max) max = histo[i]; if (histo[i] > 0 && i > maxidx) @@ -257,12 +258,14 @@ dump_zap_histogram(uint64_t histo[ZAP_HI minidx = i; } - if (max < dump_zap_width) - max = dump_zap_width; + if (max < histo_width) + max = histo_width; - for (i = minidx; i <= maxidx; i++) - (void) printf("\t\t\t%u: %6llu %s\n", i, (u_longlong_t)histo[i], - &dump_zap_stars[(max - histo[i]) * dump_zap_width / max]); + for (i = minidx; i <= maxidx; i++) { + (void) printf("\t\t\t%3u: %6llu %s\n", + i, (u_longlong_t)histo[i], + &histo_stars[(max - histo[i]) * histo_width / max]); + } } static void @@ -313,19 +316,19 @@ dump_zap_stats(objset_t *os, uint64_t ob (u_longlong_t)zs.zs_salt); (void) printf("\t\tLeafs with 2^n pointers:\n"); - dump_zap_histogram(zs.zs_leafs_with_2n_pointers); + dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBlocks with n*5 entries:\n"); - dump_zap_histogram(zs.zs_blocks_with_n5_entries); + dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBlocks n/10 full:\n"); - dump_zap_histogram(zs.zs_blocks_n_tenths_full); + dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tEntries with n chunks:\n"); - dump_zap_histogram(zs.zs_entries_using_n_chunks); + dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE); (void) printf("\t\tBuckets with n entries:\n"); - dump_zap_histogram(zs.zs_buckets_with_n_entries); + dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE); } /*ARGSUSED*/ @@ -947,7 +950,7 @@ sprintf_blkptr_compact(char *blkbuf, con const dva_t *dva = bp->blk_dva; int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1; - if (dump_opt['b'] >= 5) { + if (dump_opt['b'] >= 6) { sprintf_blkptr(blkbuf, bp); return; } @@ -1986,11 +1989,13 @@ dump_one_dir(const char *dsname, void *a /* * Block statistics. */ +#define PSIZE_HISTO_SIZE (SPA_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1) typedef struct zdb_blkstats { - uint64_t zb_asize; - uint64_t zb_lsize; - uint64_t zb_psize; - uint64_t zb_count; + uint64_t zb_asize; + uint64_t zb_lsize; + uint64_t zb_psize; + uint64_t zb_count; + uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE]; } zdb_blkstats_t; /* @@ -2014,6 +2019,9 @@ typedef struct zdb_cb { zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1]; uint64_t zcb_dedup_asize; uint64_t zcb_dedup_blocks; + uint64_t zcb_start; + uint64_t zcb_lastprint; + uint64_t zcb_totalasize; uint64_t zcb_errors[256]; int zcb_readfails; int zcb_haderrors; @@ -2040,6 +2048,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t * zb->zb_lsize += BP_GET_LSIZE(bp); zb->zb_psize += BP_GET_PSIZE(bp); zb->zb_count++; + zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++; } if (dump_opt['L']) @@ -2126,7 +2135,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog zcb->zcb_readfails = 0; - if (dump_opt['b'] >= 4) { + if (dump_opt['b'] >= 5) { sprintf_blkptr(blkbuf, bp); (void) printf("objset %llu object %llu " "level %lld offset 0x%llx %s\n", @@ -2137,6 +2146,28 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog blkbuf); } + if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) && + gethrtime() > zcb->zcb_lastprint + NANOSEC) { + uint64_t now = gethrtime(); + char buf[10]; + uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize; + int kb_per_sec = + 1 + bytes / (1 + ((now - zcb->zcb_start) / 1000 / 1000)); + int sec_remaining = + (zcb->zcb_totalasize - bytes) / 1024 / kb_per_sec; + + zfs_nicenum(bytes, buf, sizeof (buf)); + (void) fprintf(stderr, + "\r%5s completed (%4dMB/s) " + "estimated time remaining: %uhr %02umin %02usec ", + buf, kb_per_sec / 1024, + sec_remaining / 60 / 60, + sec_remaining / 60 % 60, + sec_remaining % 60); + + zcb->zcb_lastprint = now; + } + return (0); } @@ -2268,7 +2299,7 @@ count_block_cb(void *arg, const blkptr_t { zdb_cb_t *zcb = arg; - if (dump_opt['b'] >= 4) { + if (dump_opt['b'] >= 5) { char blkbuf[BP_SPRINTF_LEN]; sprintf_blkptr(blkbuf, bp); (void) printf("[%s] %s\n", @@ -2287,7 +2318,7 @@ dump_block_stats(spa_t *spa) int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; int leaks = 0; - (void) printf("\nTraversing all blocks %s%s%s%s%s...\n", + (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", (dump_opt['c'] == 1) ? "metadata " : "", dump_opt['c'] ? "checksums " : "", @@ -2323,6 +2354,8 @@ dump_block_stats(spa_t *spa) if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; + zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa)); + zcb.zcb_start = zcb.zcb_lastprint = gethrtime(); zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); if (zcb.zcb_haderrors) { @@ -2450,6 +2483,14 @@ dump_block_stats(spa_t *spa) else (void) printf(" L%d %s\n", level, typename); + + if (dump_opt['b'] >= 4) { + (void) printf("psize " + "(in 512-byte sectors): " + "number of blocks\n"); + dump_histogram(zb->zb_psize_histogram, + PSIZE_HISTO_SIZE); + } } } } Modified: user/attilio/vmobj-readlock/etc/devd/usb.conf ============================================================================== --- user/attilio/vmobj-readlock/etc/devd/usb.conf Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/etc/devd/usb.conf Mon Apr 8 19:56:14 2013 (r249275) @@ -120,7 +120,23 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x03f0"; - match "product" "(0x2016|0x2116|0x2216|0x3016|0x3116|0x3216)"; + match "product" "(0x2016|0x2116|0x2216|0x3016|0x3116)"; + action "kldload -n uipaq"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x03f0"; + match "product" "0x311d"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x03f0"; + match "product" "0x3216"; action "kldload -n uipaq"; }; @@ -168,7 +184,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0403"; - match "product" "(0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed74|0xee18|0xeee8|0xeee9|0xeeea|0xeee b|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; + match "product" "(0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed74|0xee18|0xeee8|0xeee 9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; action "kldload -n uftdi"; }; @@ -280,7 +296,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0411"; - match "product" "(0x0116|0x0119)"; + match "product" "(0x00f4|0x0116|0x0119)"; action "kldload -n if_rum"; }; @@ -423,6 +439,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0489"; + match "product" "(0xe027|0xe02c|0xe036|0xe03c|0xe03d|0xe04e|0xe056|0xe057)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0499"; match "product" "(0x1000|0x1001|0x1002|0x1003|0x1004|0x1005|0x1006|0x1007|0x1008|0x1009|0x100a|0x100c|0x100d|0x100e|0x100f|0x1010|0x1011|0x1012|0x1013|0x1014|0x1015|0x1016|0x1017|0x1018|0x1019|0x101a|0x101b|0x101c|0x101d|0x101e|0x101f|0x1020|0x1021|0x1022|0x1023|0x1024|0x1025|0x1026|0x1027|0x1028|0x1029|0x102a|0x102b|0x102e|0x1030|0x1031|0x1032|0x1033|0x1034|0x1035|0x1036|0x1037|0x1038|0x1039|0x103a|0x103b|0x103c|0x103d|0x103e|0x103f|0x1040|0x1041|0x1042|0x1043|0x1044|0x1045|0x104e|0x104f|0x1050|0x1051|0x1052|0x1053|0x1054|0x1055|0x1056|0x1057|0x1058|0x1059|0x105a|0x105b|0x105c|0x105d|0x1503|0x2000|0x2001|0x2002|0x2003|0x5000|0x5001|0x5002|0x5003|0x5004|0x5005|0x5006|0x5007|0x5008|0x5009|0x500a|0x500b|0x500c|0x500d|0x500e|0x500f|0x7000|0x7010)"; action "kldload -n snd_uaudio"; @@ -559,6 +583,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x04ca"; + match "product" "(0x3005|0x3006|0x3008)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x04da"; match "product" "0x2500"; action "kldload -n uipaq"; @@ -800,7 +832,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0525"; - match "product" "0x1080"; + match "product" "(0x1080|0xa4a0)"; action "kldload -n udbp"; }; @@ -1103,6 +1135,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x065a"; + match "product" "(0xc000|0xc001)"; + action "kldload -n uftdi"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x066b"; match "product" "(0x200c|0x2202)"; action "kldload -n if_aue"; @@ -1344,7 +1384,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0789"; - match "product" "(0x0162|0x0163|0x0164|0x0166|0x0168)"; + match "product" "(0x0162|0x0163|0x0164|0x0166|0x0168|0x0169)"; action "kldload -n if_run"; }; @@ -1800,6 +1840,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0930"; + match "product" "(0x0215|0x0219)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0930"; match "product" "(0x0700|0x0705|0x0706|0x0707|0x0708|0x0709|0x070a|0x070b)"; action "kldload -n uipaq"; }; @@ -2375,6 +2423,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0cf3"; + match "product" "(0x3002|0x3004|0x311d|0xe004|0xe019)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0d3a"; match "product" "0x0300"; action "kldload -n uftdi"; @@ -3224,15 +3280,39 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x13d3"; - match "product" "(0x3247|0x3262|0x3273|0x3284|0x3305)"; + match "product" "(0x3247|0x3262|0x3273|0x3284)"; + action "kldload -n if_run"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x13d3"; + match "product" "0x3304"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x13d3"; + match "product" "0x3305"; action "kldload -n if_run"; }; nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x13d3"; + match "product" "(0x3362|0x3375|0x3393)"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1410"; - match "product" "(0x1100|0x1110|0x1120|0x1130|0x1400|0x1410|0x1420|0x1430|0x1450|0x2100|0x2110|0x2120|0x2130|0x2400|0x2410|0x2420|0x4100|0x4400|0x5010|0x5100|0x6000|0x6002|0x7042)"; + match "product" "(0x1100|0x1110|0x1120|0x1130|0x1400|0x1410|0x1420|0x1430|0x1450|0x2100|0x2110|0x2120|0x2130|0x2400|0x2410|0x2420|0x4100|0x4400|0x5010|0x5041|0x5100|0x6000|0x6002|0x7042)"; action "kldload -n u3g"; }; @@ -4040,7 +4120,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "0x1a00"; + match "product" "(0x1a00|0x1a02)"; action "kldload -n if_axe"; }; @@ -4096,7 +4176,23 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "(0x4001|0x4002|0x4003|0x400b|0x4102|0xabc1)"; + match "product" "(0x4001|0x4002|0x4003|0x400b|0x4102)"; + action "kldload -n if_aue"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x2001"; + match "product" "(0x7e12|0xa805)"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x2001"; + match "product" "0xabc1"; action "kldload -n if_aue"; }; @@ -4215,6 +4311,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x22b8"; + match "product" "0x710f"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x22de"; match "product" "0x6801"; action "kldload -n u3g"; @@ -4495,6 +4599,16 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0a5c"; + match "intclass" "0xff"; + match "intsubclass" "0x01"; + match "intprotocol" "0x01"; + action "kldload -n ng_ubt"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "intclass" "0x02"; match "intsubclass" "0x02"; match "intprotocol" "0x01"; @@ -4635,5 +4749,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2386 USB entries processed +# 2422 USB entries processed Modified: user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.8 ============================================================================== --- user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.8 Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.8 Mon Apr 8 19:56:14 2013 (r249275) @@ -1118,14 +1118,15 @@ usually takes just a few seconds. Freeze the security configuration of the specified device. .Pp After command completion any other commands that update the device lock mode -shall be command aborted. Frozen mode is disabled by power-off or hardware reset. +shall be command aborted. +Frozen mode is disabled by power-off or hardware reset. .It Fl h Ar pwd .Pp Enhanced erase the device using the given password for the selected user. .Pp .Em WARNING! WARNING! WARNING! .Pp -Issuing an enhanced secure erase will +Issuing an enhanced secure erase will .Em ERASE ALL user data on the device and may take several hours to complete. .Pp @@ -1378,7 +1379,7 @@ camcontrol security ada0 .Pp Report security support and settings for ada0 .Bd -literal -offset indent -camcontrol security ada0 -u user -s MyPass +camcontrol security ada0 -u user -s MyPass .Ed .Pp Enable security on device ada0 with the password MyPass Modified: user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.c ============================================================================== --- user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.c Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/sbin/camcontrol/camcontrol.c Mon Apr 8 19:56:14 2013 (r249275) @@ -1734,7 +1734,7 @@ enum { ATA_SECURITY_ACTION_ERASE, ATA_SECURITY_ACTION_ERASE_ENHANCED, ATA_SECURITY_ACTION_SET_PASSWORD -} atasecurity_action; +}; static void atasecurity_print_time(u_int16_t tw) Modified: user/attilio/vmobj-readlock/share/man/man4/mld.4 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man4/mld.4 Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/share/man/man4/mld.4 Mon Apr 8 19:56:14 2013 (r249275) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2009 +.Dd April 8, 2013 .Dt MLD 4 .Os .Sh NAME @@ -68,11 +68,6 @@ to the protocol. .Sh SYSCTL VARIABLES .Bl -tag -width indent .\" -.It net.inet6.mld.stats -This opaque read-only variable exposes the stack-wide MLDv2 -protocol statistics to -.Xr netstat 1 . -.\" .It net.inet6.mld.ifinfo This opaque read-only variable exposes the per-link MLDv2 status to .Xr ifmcstat 8 . @@ -94,11 +89,12 @@ This sysctl is normally enabled by defau .\" .El .Sh SEE ALSO -.Xr ifmcstat 8 , +.Xr netstat 1 , +.Xr sourcefilter 3 , +.Xr icmp6 4 , .Xr inet 4 , .Xr multicast 4 , -.Xr netstat 1 , -.Xr sourcefilter 3 +.Xr ifmcstat 8 .Sh HISTORY The .Nm Modified: user/attilio/vmobj-readlock/share/man/man9/Makefile ============================================================================== --- user/attilio/vmobj-readlock/share/man/man9/Makefile Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/share/man/man9/Makefile Mon Apr 8 19:56:14 2013 (r249275) @@ -51,6 +51,7 @@ MAN= accept_filter.9 \ config_intrhook.9 \ contigmalloc.9 \ copy.9 \ + counter.9 \ cr_cansee.9 \ critical_enter.9 \ cr_seeothergids.9 \ @@ -569,6 +570,14 @@ MLINKS+=copy.9 copyin.9 \ copy.9 copyout.9 \ copy.9 copyout_nofault.9 \ copy.9 copystr.9 +MLINKS+=counter.9 counter_u64_alloc.9 \ + counter.9 counter_u64_free.9 \ + counter.9 counter_u64_add.9 \ + counter.9 counter_enter.9 \ + counter.9 counter_exit.9 \ + counter.9 counter_u64_add_protected.9 \ + counter.9 counter_u64_fetch.9 \ + counter.9 counter_u64_zero.9 MLINKS+=critical_enter.9 critical.9 \ critical_enter.9 critical_exit.9 MLINKS+=crypto.9 crypto_dispatch.9 \ Copied: user/attilio/vmobj-readlock/share/man/man9/counter.9 (from r249273, user/attilio/vmcontention/share/man/man9/counter.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmobj-readlock/share/man/man9/counter.9 Mon Apr 8 19:56:14 2013 (r249275, copy of r249273, user/attilio/vmcontention/share/man/man9/counter.9) @@ -0,0 +1,200 @@ +.\"- +.\" Copyright (c) 2013 Gleb Smirnoff +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 3, 2013 +.Dt COUNTER 9 +.Os +.Sh NAME +.Nm counter +.Nd "SMP-friendly kernel counter implementation" +.Sh SYNOPSIS +.In sys/types.h +.In sys/counter.h +.Ft counter_u64_t +.Fn counter_u64_alloc "int wait" +.Ft void +.Fn counter_u64_free "counter_u64_t c" +.Ft void +.Fn counter_u64_add "counter_u64_t c" "int64_t v" +.Ft void +.Fn counter_enter +.Ft void +.Fn counter_exit +.Ft void +.Fn counter_u64_add_protected "counter_u64_t c" "int64_t v" +.Ft uint64_t +.Fn counter_u64_fetch "counter_u64_t c" +.Ft void +.Fn counter_u64_zero "counter_u64_t c" +.In sys/sysctl.h +.Fn SYSCTL_COUNTER_U64 parent nbr name access ptr val descr +.Fn SYSCTL_ADD_COUNTER_U64 ctx parent nbr name access ptr descr +.Sh DESCRIPTION +.Nm +is a generic facility to create counters +that can be utilized for any purpose (such as collecting statistical +data). +A +.Nm +is guaranteed to be lossless when several kernel threads do simultaneous +updates. +However, +.Nm +does not block the calling thread, +also no +.Xr atomic 9 +operations are used for the update, therefore the counters +can be used in any non-interrupt context. +Moreover, +.Nm +has special optimisations for SMP environments, making +.Nm +update faster than simple arithmetic on the global variable. +Thus +.Nm +is considered suitable for accounting in the performance-critical +code pathes. +.Bl -tag -width indent +.It Fn counter_u64_alloc how +Allocate a new 64-bit unsigned counter. +The +.Fa wait +argument is the +.Xr malloc 9 +wait flag, should be either +.Va M_NOWAIT +or +.Va M_WAITOK . +If +.Va M_WAITOK +is specified the operation may fail. +.It Fn counter_u64_free c +Free the previously allocated counter +.Fa c . +.It Fn counter_u64_add c v +Add +.Fa v +to +.Fa c . +The KPI does not guarantee any protection from wraparound. +.It Fn counter_enter +Enter mode that would allow to safely update several counters via +.Fn counter_u64_add_protected . +On some machines this expands to +.Xr critical 9 +section, while on other is a nop. +See +.Sx IMPLEMENTATION DETAILS . +.It Fn counter_exit +Exit mode for updating several counters. +.It Fn counter_u64_add_protected c v +Same as +.Fn counter_u64_add , +but should be preceded by +.Fn counter_enter . +.It Fn counter_u64_fetch c +Take a snapshot of counter +.Fa c . +The data obtained is not guaranteed to reflect the real cumulative +value for any moment. +.It Fn counter_u64_zero c +Clear the counter +.Fa c +and set it to zero. +.It Fn SYSCTL_COUNTER_U64 parent nbr name access ptr val descr +Declare a static +.Xr sysctl +oid that would represent a +.Nm . +The +.Fa ptr +argument should be a pointer to allocated +.Vt counter_u64_t . +A read of the oid returns value obtained through +.Fn counter_u64_fetch . +Any write to the oid zeroes it. +.It Fn SYSCTL_ADD_COUNTER_U64 ctx parent nbr name access ptr descr +Create a +.Xr sysctl +oid that would represent a +.Nm . +The +.Fa ptr +argument should be a pointer to allocated +.Vt counter_u64_t . +A read of the oid returns value obtained through +.Fn counter_u64_fetch . +Any write to the oid zeroes it. +.El +.Sh IMPLEMENTATION DETAILS +On all architectures +.Nm +is implemented using per-CPU data fields that are specially aligned +in memory, to avoid inter-CPU bus traffic due to shared use +of the variables between CPUs. +These are allocated using +.Va UMA_ZONE_PCPU +.Xr uma 9 +zone. +The update operation only touches the field that is private to current CPU. +Fetch operation loops through all per-CPU fields and obtains a snapshot +sum of all fields. +.Pp +On amd64 a +.Nm counter +update is implemented as a single instruction without lock semantics, +operating on the private data for the current CPU, +which is safe against preemption and interrupts. +.Pp +On i386 architecture, when machine supports the cmpxchg8 instruction, +this instruction is used. +The multi-instruction sequence provides the same guarantees as the +amd64 single-instruction implementation. +.Pp +On some architectures updating a counter require a +.Xr critical 9 +section. +.Sh SEE ALSO +.Xr atomic 9 , +.Xr critical 9 , +.Xr locking 9 , +.Xr malloc 9 , +.Xr sysctl 9 , +.Xr uma 9 +.Sh HISTORY +The +.Nm +facility first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +facility was written by +.An Gleb Smirnoff +and +.An Konstantin Belousov . Modified: user/attilio/vmobj-readlock/share/man/man9/sbuf.9 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man9/sbuf.9 Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/share/man/man9/sbuf.9 Mon Apr 8 19:56:14 2013 (r249275) @@ -94,7 +94,7 @@ .Fn sbuf_finish "struct sbuf *s" .Ft char * .Fn sbuf_data "struct sbuf *s" -.Ft int +.Ft ssize_t .Fn sbuf_len "struct sbuf *s" .Ft int .Fn sbuf_done "struct sbuf *s" Modified: user/attilio/vmobj-readlock/share/man/man9/zone.9 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man9/zone.9 Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/share/man/man9/zone.9 Mon Apr 8 19:56:14 2013 (r249275) @@ -153,6 +153,23 @@ See .Fn uma_find_refcnt . .It Dv UMA_ZONE_NODUMP Pages belonging to the zone will not be included into mini-dumps. +.It Dv UMA_ZONE_PCPU +An allocation from zone would have +.Va mp_ncpu +shadow copies, that are privately assigned to CPUs. +A CPU can address its private copy using base allocation address plus +multiple of current CPU id and +.Fn sizeof "struct pcpu" : +.Bd -literal -offset indent +foo_zone = uma_zcreate(..., UMA_ZONE_PCPU); + ... +foo_base = uma_zalloc(foo_zone, ...); + ... +critical_enter(); +foo_pcpu = (foo_t *)zpcpu_get(foo_base); +/* do something with foo_pcpu */ +critical_exit(); +.Ed .It Dv UMA_ZONE_OFFPAGE By default book-keeping of items within a slab is done in the slab page itself. This flag explicitly tells subsystem that book-keeping structure should be Copied: user/attilio/vmobj-readlock/sys/amd64/include/counter.h (from r249273, user/attilio/vmcontention/sys/amd64/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmobj-readlock/sys/amd64/include/counter.h Mon Apr 8 19:56:14 2013 (r249275, copy of r249273, user/attilio/vmcontention/sys/amd64/include/counter.h) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include + +extern struct pcpu __pcpu[1]; + +#define counter_enter() do {} while (0) +#define counter_exit() do {} while (0) + +#define counter_u64_add_protected(c, i) counter_u64_add(c, i) + +static inline void +counter_u64_add(counter_u64_t c, int64_t inc) +{ + + __asm __volatile("addq\t%1,%%gs:(%0)" + : + : "r" ((char *)c - (char *)&__pcpu[0]), "r" (inc) + : "memory", "cc"); +} + +#endif /* ! __MACHINE_COUNTER_H__ */ Modified: user/attilio/vmobj-readlock/sys/amd64/include/pcpu.h ============================================================================== --- user/attilio/vmobj-readlock/sys/amd64/include/pcpu.h Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/sys/amd64/include/pcpu.h Mon Apr 8 19:56:14 2013 (r249275) @@ -77,7 +77,9 @@ /* Pointer to the CPU TSS descriptor */ \ struct system_segment_descriptor *pc_tss; \ u_int pc_cmci_mask /* MCx banks for CMCI */ \ - PCPU_XEN_FIELDS + PCPU_XEN_FIELDS; \ + char __pad[293] /* be divisor of PAGE_SIZE \ + after cache alignment */ #ifdef _KERNEL Modified: user/attilio/vmobj-readlock/sys/arm/at91/at91_pio.c ============================================================================== --- user/attilio/vmobj-readlock/sys/arm/at91/at91_pio.c Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/sys/arm/at91/at91_pio.c Mon Apr 8 19:56:14 2013 (r249275) @@ -554,12 +554,12 @@ at91_pio_gpio_clear(uint32_t pio, uint32 PIO[PIO_CODR / 4] = data_mask; } -uint8_t +uint32_t at91_pio_gpio_get(uint32_t pio, uint32_t data_mask) { uint32_t *PIO = (uint32_t *)(AT91_BASE + pio); - return ((PIO[PIO_PDSR / 4] & data_mask)); + return (PIO[PIO_PDSR / 4] & data_mask); } void Modified: user/attilio/vmobj-readlock/sys/arm/at91/at91_piovar.h ============================================================================== --- user/attilio/vmobj-readlock/sys/arm/at91/at91_piovar.h Mon Apr 8 19:53:02 2013 (r249274) +++ user/attilio/vmobj-readlock/sys/arm/at91/at91_piovar.h Mon Apr 8 19:56:14 2013 (r249275) @@ -39,7 +39,7 @@ void at91_pio_gpio_output(uint32_t pio, void at91_pio_gpio_high_z(uint32_t pio, uint32_t high_z_mask, int enable); void at91_pio_gpio_set(uint32_t pio, uint32_t data_mask); void at91_pio_gpio_clear(uint32_t pio, uint32_t data_mask); -uint8_t at91_pio_gpio_get(uint32_t pio, uint32_t data_mask); +uint32_t at91_pio_gpio_get(uint32_t pio, uint32_t data_mask); void at91_pio_gpio_set_deglitch(uint32_t pio, uint32_t data_mask, int use_deglitch); void at91_pio_gpio_set_interrupt(uint32_t pio, uint32_t data_mask, Copied: user/attilio/vmobj-readlock/sys/arm/include/counter.h (from r249273, user/attilio/vmcontention/sys/arm/include/counter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmobj-readlock/sys/arm/include/counter.h Mon Apr 8 19:56:14 2013 (r249275, copy of r249273, user/attilio/vmcontention/sys/arm/include/counter.h) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __MACHINE_COUNTER_H__ +#define __MACHINE_COUNTER_H__ + +#include +#ifdef INVARIANTS +#include +#endif + +#define counter_enter() critical_enter() +#define counter_exit() critical_exit() + +#define counter_u64_add_protected(c, inc) do { \ + CRITICAL_ASSERT(curthread); \ + *(uint64_t *)zpcpu_get(c) += (inc); \ +} while (0) + +static inline void +counter_u64_add(counter_u64_t c, int64_t inc) +{ + + counter_enter(); + counter_u64_add_protected(c, inc); + counter_exit(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Apr 8 20:11:05 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6CF3DD94; Mon, 8 Apr 2013 20:11:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5FA37890; Mon, 8 Apr 2013 20:11:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r38KB5iv006453; Mon, 8 Apr 2013 20:11:05 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r38KB3BO006443; Mon, 8 Apr 2013 20:11:03 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304082011.r38KB3BO006443@svn.freebsd.org> From: Attilio Rao Date: Mon, 8 Apr 2013 20:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249279 - in user/attilio/vmcontention: sys/kern sys/netinet sys/vm usr.bin/netstat X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 20:11:05 -0000 Author: attilio Date: Mon Apr 8 20:11:03 2013 New Revision: 249279 URL: http://svnweb.freebsd.org/changeset/base/249279 Log: MFC Modified: user/attilio/vmcontention/sys/kern/imgact_elf.c user/attilio/vmcontention/sys/kern/kern_proc.c user/attilio/vmcontention/sys/kern/sys_process.c user/attilio/vmcontention/sys/netinet/ip_input.c user/attilio/vmcontention/sys/netinet/ip_var.h user/attilio/vmcontention/sys/netinet/tcp_input.c user/attilio/vmcontention/sys/netinet/tcp_var.h user/attilio/vmcontention/sys/vm/vm_page.h user/attilio/vmcontention/sys/vm/vm_pageout.c user/attilio/vmcontention/usr.bin/netstat/inet.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/sys/ (props changed) Modified: user/attilio/vmcontention/sys/kern/imgact_elf.c ============================================================================== --- user/attilio/vmcontention/sys/kern/imgact_elf.c Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/kern/imgact_elf.c Mon Apr 8 20:11:03 2013 (r249279) @@ -1277,15 +1277,15 @@ each_writable_segment(td, func, closure) continue; /* Ignore memory-mapped devices and such things. */ - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); while ((backing_object = object->backing_object) != NULL) { - VM_OBJECT_WLOCK(backing_object); - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RLOCK(backing_object); + VM_OBJECT_RUNLOCK(object); object = backing_object; } ignore_entry = object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && object->type != OBJT_VNODE; - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); if (ignore_entry) continue; Modified: user/attilio/vmcontention/sys/kern/kern_proc.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_proc.c Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/kern/kern_proc.c Mon Apr 8 20:11:03 2013 (r249279) @@ -1995,7 +1995,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A kve->kve_private_resident = 0; obj = entry->object.vm_object; if (obj != NULL) { - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); if (obj->shadow_count == 1) kve->kve_private_resident = obj->resident_page_count; @@ -2010,9 +2010,9 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; } @@ -2072,11 +2072,11 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A break; } if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); kve->kve_ref_count = obj->ref_count; kve->kve_shadow_count = obj->shadow_count; - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { vn_fullpath(curthread, vp, &fullpath, &freepath); @@ -2162,7 +2162,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_private_resident = 0; obj = entry->object.vm_object; if (obj != NULL) { - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); if (obj->shadow_count == 1) kve->kve_private_resident = obj->resident_page_count; @@ -2183,9 +2183,9 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; } @@ -2247,11 +2247,11 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR break; } if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); kve->kve_ref_count = obj->ref_count; kve->kve_shadow_count = obj->shadow_count; - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { vn_fullpath(curthread, vp, &fullpath, &freepath); Modified: user/attilio/vmcontention/sys/kern/sys_process.c ============================================================================== --- user/attilio/vmcontention/sys/kern/sys_process.c Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/kern/sys_process.c Mon Apr 8 20:11:03 2013 (r249279) @@ -382,7 +382,7 @@ ptrace_vm_entry(struct thread *td, struc obj = entry->object.vm_object; if (obj != NULL) - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); } while (0); vm_map_unlock_read(map); @@ -395,9 +395,9 @@ ptrace_vm_entry(struct thread *td, struc lobj = obj; for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; pve->pve_offset += tobj->backing_object_offset; } @@ -405,8 +405,8 @@ ptrace_vm_entry(struct thread *td, struc if (vp != NULL) vref(vp); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(lobj); + VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { freepath = NULL; Modified: user/attilio/vmcontention/sys/netinet/ip_input.c ============================================================================== --- user/attilio/vmcontention/sys/netinet/ip_input.c Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/netinet/ip_input.c Mon Apr 8 20:11:03 2013 (r249279) @@ -153,11 +153,6 @@ VNET_DEFINE(struct in_ifaddrhead, in_ifa VNET_DEFINE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); /* inet addr hash table */ VNET_DEFINE(u_long, in_ifaddrhmask); /* mask for hash table */ -VNET_DEFINE(struct ipstat, ipstat); -SYSCTL_VNET_STRUCT(_net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW, - &VNET_NAME(ipstat), ipstat, - "IP statistics (struct ipstat, netinet/ip_var.h)"); - static VNET_DEFINE(uma_zone_t, ipq_zone); static VNET_DEFINE(TAILQ_HEAD(ipqhead, ipq), ipq[IPREASS_NHASH]); static struct mtx ipqlock; @@ -213,24 +208,89 @@ SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, static void ip_freef(struct ipqhead *, struct ipq *); /* + * IP statistics are stored in struct ipstat_p, which is + * an "array" of counter(9)s. Although it isn't a real + * array, we treat it as array to reduce code bloat. + */ +VNET_DEFINE(struct ipstat_p, ipstatp); + +static void +vnet_ipstatp_init(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_ipstatp; + i < sizeof(V_ipstatp) / sizeof(counter_u64_t); + i++, c++) { + *c = counter_u64_alloc(M_WAITOK); + counter_u64_zero(*c); + } +} +VNET_SYSINIT(vnet_ipstatp_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_ipstatp_init, NULL); + +#ifdef VIMAGE +static void +vnet_ipstatp_uninit(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_ipstatp; + i < sizeof(V_ipstatp) / sizeof(counter_u64_t); + i++, c++) + counter_u64_free(*c); +} +VNET_SYSUNINIT(vnet_ipstatp_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_ipstatp_uninit, NULL); +#endif /* VIMAGE */ + +static int +ipstat_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct ipstat ipstat; + counter_u64_t *c; + uint64_t *v; + int i; + + for (i = 0, c = (counter_u64_t *)&V_ipstatp, v = (uint64_t *)&ipstat; + i < sizeof(V_ipstatp) / sizeof(counter_u64_t); + i++, c++, v++) { + *v = counter_u64_fetch(*c); + /* + * Old interface allowed to rewrite 'struct ipstat', and + * netstat(1) used it to zero the structure. To keep + * compatibility with old netstat(1) we will zero out + * statistics on every write attempt, however we no longer + * support writing arbitrary fake values to the statistics. + */ + if (req->newptr) + counter_u64_zero(*c); + } + + return (SYSCTL_OUT(req, &ipstat, sizeof(ipstat))); +} +SYSCTL_VNET_PROC(_net_inet_ip, IPCTL_STATS, stats, CTLTYPE_OPAQUE | CTLFLAG_RW, + NULL, 0, ipstat_sysctl, "I", + "IP statistics (struct ipstat, netinet/ip_var.h)"); + +/* * Kernel module interface for updating ipstat. The argument is an index - * into ipstat treated as an array of u_long. While this encodes the general - * layout of ipstat into the caller, it doesn't encode its location, so that - * future changes to add, for example, per-CPU stats support won't cause - * binary compatibility problems for kernel modules. + * into ipstat treated as an array. */ void kmod_ipstat_inc(int statnum) { - (*((u_long *)&V_ipstat + statnum))++; + counter_u64_add((counter_u64_t )&V_ipstatp + statnum, 1); } void kmod_ipstat_dec(int statnum) { - (*((u_long *)&V_ipstat + statnum))--; + counter_u64_add((counter_u64_t )&V_ipstatp + statnum, -1); } static int Modified: user/attilio/vmcontention/sys/netinet/ip_var.h ============================================================================== --- user/attilio/vmcontention/sys/netinet/ip_var.h Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/netinet/ip_var.h Mon Apr 8 20:11:03 2013 (r249279) @@ -97,59 +97,95 @@ struct ip_moptions { }; struct ipstat { - u_long ips_total; /* total packets received */ - u_long ips_badsum; /* checksum bad */ - u_long ips_tooshort; /* packet too short */ - u_long ips_toosmall; /* not enough data */ - u_long ips_badhlen; /* ip header length < data size */ - u_long ips_badlen; /* ip length < ip header length */ - u_long ips_fragments; /* fragments received */ - u_long ips_fragdropped; /* frags dropped (dups, out of space) */ - u_long ips_fragtimeout; /* fragments timed out */ - u_long ips_forward; /* packets forwarded */ - u_long ips_fastforward; /* packets fast forwarded */ - u_long ips_cantforward; /* packets rcvd for unreachable dest */ - u_long ips_redirectsent; /* packets forwarded on same net */ - u_long ips_noproto; /* unknown or unsupported protocol */ - u_long ips_delivered; /* datagrams delivered to upper level*/ - u_long ips_localout; /* total ip packets generated here */ - u_long ips_odropped; /* lost packets due to nobufs, etc. */ - u_long ips_reassembled; /* total packets reassembled ok */ - u_long ips_fragmented; /* datagrams successfully fragmented */ - u_long ips_ofragments; /* output fragments created */ - u_long ips_cantfrag; /* don't fragment flag was set, etc. */ - u_long ips_badoptions; /* error in option processing */ - u_long ips_noroute; /* packets discarded due to no route */ - u_long ips_badvers; /* ip version != 4 */ - u_long ips_rawout; /* total raw ip packets generated */ - u_long ips_toolong; /* ip length > max ip packet size */ - u_long ips_notmember; /* multicasts for unregistered grps */ - u_long ips_nogif; /* no match gif found */ - u_long ips_badaddr; /* invalid address on header */ + uint64_t ips_total; /* total packets received */ + uint64_t ips_badsum; /* checksum bad */ + uint64_t ips_tooshort; /* packet too short */ + uint64_t ips_toosmall; /* not enough data */ + uint64_t ips_badhlen; /* ip header length < data size */ + uint64_t ips_badlen; /* ip length < ip header length */ + uint64_t ips_fragments; /* fragments received */ + uint64_t ips_fragdropped; /* frags dropped (dups, out of space) */ + uint64_t ips_fragtimeout; /* fragments timed out */ + uint64_t ips_forward; /* packets forwarded */ + uint64_t ips_fastforward; /* packets fast forwarded */ + uint64_t ips_cantforward; /* packets rcvd for unreachable dest */ + uint64_t ips_redirectsent; /* packets forwarded on same net */ + uint64_t ips_noproto; /* unknown or unsupported protocol */ + uint64_t ips_delivered; /* datagrams delivered to upper level*/ + uint64_t ips_localout; /* total ip packets generated here */ + uint64_t ips_odropped; /* lost packets due to nobufs, etc. */ + uint64_t ips_reassembled; /* total packets reassembled ok */ + uint64_t ips_fragmented; /* datagrams successfully fragmented */ + uint64_t ips_ofragments; /* output fragments created */ + uint64_t ips_cantfrag; /* don't fragment flag was set, etc. */ + uint64_t ips_badoptions; /* error in option processing */ + uint64_t ips_noroute; /* packets discarded due to no route */ + uint64_t ips_badvers; /* ip version != 4 */ + uint64_t ips_rawout; /* total raw ip packets generated */ + uint64_t ips_toolong; /* ip length > max ip packet size */ + uint64_t ips_notmember; /* multicasts for unregistered grps */ + uint64_t ips_nogif; /* no match gif found */ + uint64_t ips_badaddr; /* invalid address on header */ }; #ifdef _KERNEL +#include #include +/* Should match 'struct ipstat' above. */ +struct ipstat_p { + counter_u64_t ips_total; + counter_u64_t ips_badsum; + counter_u64_t ips_tooshort; + counter_u64_t ips_toosmall; + counter_u64_t ips_badhlen; + counter_u64_t ips_badlen; + counter_u64_t ips_fragments; + counter_u64_t ips_fragdropped; + counter_u64_t ips_fragtimeout; + counter_u64_t ips_forward; + counter_u64_t ips_fastforward; + counter_u64_t ips_cantforward; + counter_u64_t ips_redirectsent; + counter_u64_t ips_noproto; + counter_u64_t ips_delivered; + counter_u64_t ips_localout; + counter_u64_t ips_odropped; + counter_u64_t ips_reassembled; + counter_u64_t ips_fragmented; + counter_u64_t ips_ofragments; + counter_u64_t ips_cantfrag; + counter_u64_t ips_badoptions; + counter_u64_t ips_noroute; + counter_u64_t ips_badvers; + counter_u64_t ips_rawout; + counter_u64_t ips_toolong; + counter_u64_t ips_notmember; + counter_u64_t ips_nogif; + counter_u64_t ips_badaddr; +}; +VNET_DECLARE(struct ipstat_p, ipstatp); +#define V_ipstatp VNET(ipstatp) + /* * In-kernel consumers can use these accessor macros directly to update * stats. */ -#define IPSTAT_ADD(name, val) V_ipstat.name += (val) -#define IPSTAT_SUB(name, val) V_ipstat.name -= (val) +#define IPSTAT_ADD(name, val) counter_u64_add(V_ipstatp.name, (val)) +#define IPSTAT_SUB(name, val) counter_u64_subtract(V_ipstatp.name, (val)) #define IPSTAT_INC(name) IPSTAT_ADD(name, 1) -#define IPSTAT_DEC(name) IPSTAT_SUB(name, 1) +#define IPSTAT_DEC(name) IPSTAT_ADD(name, -1) /* * Kernel module consumers must use this accessor macro. */ void kmod_ipstat_inc(int statnum); #define KMOD_IPSTAT_INC(name) \ - kmod_ipstat_inc(offsetof(struct ipstat, name) / sizeof(u_long)) + kmod_ipstat_inc(offsetof(struct ipstat_p, name) / sizeof(counter_u64_t)) void kmod_ipstat_dec(int statnum); #define KMOD_IPSTAT_DEC(name) \ - kmod_ipstat_dec(offsetof(struct ipstat, name) / sizeof(u_long)) + kmod_ipstat_dec(offsetof(struct ipstat_p, name) / sizeof(counter_u64_t)) /* flags passed to ip_output as last parameter */ #define IP_FORWARDING 0x1 /* most of ip header exists */ @@ -176,7 +212,6 @@ struct inpcb; struct route; struct sockopt; -VNET_DECLARE(struct ipstat, ipstat); VNET_DECLARE(u_short, ip_id); /* ip packet ctr, for ids */ VNET_DECLARE(int, ip_defttl); /* default IP ttl */ VNET_DECLARE(int, ipforwarding); /* ip forwarding */ @@ -192,7 +227,6 @@ VNET_DECLARE(int, rsvp_on); VNET_DECLARE(int, drop_redirect); extern struct pr_usrreqs rip_usrreqs; -#define V_ipstat VNET(ipstat) #define V_ip_id VNET(ip_id) #define V_ip_defttl VNET(ip_defttl) #define V_ipforwarding VNET(ipforwarding) Modified: user/attilio/vmcontention/sys/netinet/tcp_input.c ============================================================================== --- user/attilio/vmcontention/sys/netinet/tcp_input.c Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/netinet/tcp_input.c Mon Apr 8 20:11:03 2013 (r249279) @@ -120,11 +120,6 @@ __FBSDID("$FreeBSD$"); const int tcprexmtthresh = 3; -VNET_DEFINE(struct tcpstat, tcpstat); -SYSCTL_VNET_STRUCT(_net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RW, - &VNET_NAME(tcpstat), tcpstat, - "TCP statistics (struct tcpstat, netinet/tcp_var.h)"); - int tcp_log_in_vain = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_RW, &tcp_log_in_vain, 0, @@ -245,17 +240,76 @@ static void inline hhook_run_tcp_est_in( struct tcphdr *th, struct tcpopt *to); /* + * TCP statistics are stored in struct tcpstat_p, which is + * an "array" of counter(9)s. Although it isn't a real + * array, we treat it as array to reduce code bloat. + */ +VNET_DEFINE(struct tcpstat_p, tcpstatp); + +static void +vnet_tcpstatp_init(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_tcpstatp; + i < sizeof(V_tcpstatp) / sizeof(counter_u64_t); + i++, c++) { + *c = counter_u64_alloc(M_WAITOK); + counter_u64_zero(*c); + } +} +VNET_SYSINIT(vnet_tcpstatp_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_tcpstatp_init, NULL); + +#ifdef VIMAGE +static void +vnet_tcpstatp_uninit(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_tcpstatp; + i < sizeof(V_tcpstatp) / sizeof(counter_u64_t); + i++, c++) + counter_u64_free(*c); +} +VNET_SYSUNINIT(vnet_tcpstatp_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_ipstatp_uninit, NULL); +#endif /* VIMAGE */ + +static int +tcpstat_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct tcpstat tcpstat; + counter_u64_t *c; + uint64_t *v; + int i; + + for (i = 0, c = (counter_u64_t *)&V_tcpstatp, v = (uint64_t *)&tcpstat; + i < sizeof(V_tcpstatp) / sizeof(counter_u64_t); + i++, c++, v++) { + *v = counter_u64_fetch(*c); + if (req->newptr) + counter_u64_zero(*c); + } + + return (SYSCTL_OUT(req, &tcpstat, sizeof(tcpstat))); +} + +SYSCTL_VNET_PROC(_net_inet_tcp, TCPCTL_STATS, stats, CTLTYPE_OPAQUE | + CTLFLAG_RW, NULL, 0, tcpstat_sysctl, "I", + "TCP statistics (struct tcpstat, netinet/tcp_var.h)"); + +/* * Kernel module interface for updating tcpstat. The argument is an index - * into tcpstat treated as an array of u_long. While this encodes the - * general layout of tcpstat into the caller, it doesn't encode its location, - * so that future changes to add, for example, per-CPU stats support won't - * cause binary compatibility problems for kernel modules. + * into tcpstat treated as an array. */ void kmod_tcpstat_inc(int statnum) { - (*((u_long *)&V_tcpstat + statnum))++; + counter_u64_add((counter_u64_t )&V_tcpstatp + statnum, 1); } /* Modified: user/attilio/vmcontention/sys/netinet/tcp_var.h ============================================================================== --- user/attilio/vmcontention/sys/netinet/tcp_var.h Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/netinet/tcp_var.h Mon Apr 8 20:11:03 2013 (r249279) @@ -389,125 +389,233 @@ struct tcptw { * but that's inconvenient at the moment. */ struct tcpstat { - u_long tcps_connattempt; /* connections initiated */ - u_long tcps_accepts; /* connections accepted */ - u_long tcps_connects; /* connections established */ - u_long tcps_drops; /* connections dropped */ - u_long tcps_conndrops; /* embryonic connections dropped */ - u_long tcps_minmssdrops; /* average minmss too low drops */ - u_long tcps_closed; /* conn. closed (includes drops) */ - u_long tcps_segstimed; /* segs where we tried to get rtt */ - u_long tcps_rttupdated; /* times we succeeded */ - u_long tcps_delack; /* delayed acks sent */ - u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ - u_long tcps_rexmttimeo; /* retransmit timeouts */ - u_long tcps_persisttimeo; /* persist timeouts */ - u_long tcps_keeptimeo; /* keepalive timeouts */ - u_long tcps_keepprobe; /* keepalive probes sent */ - u_long tcps_keepdrops; /* connections dropped in keepalive */ - - u_long tcps_sndtotal; /* total packets sent */ - u_long tcps_sndpack; /* data packets sent */ - u_long tcps_sndbyte; /* data bytes sent */ - u_long tcps_sndrexmitpack; /* data packets retransmitted */ - u_long tcps_sndrexmitbyte; /* data bytes retransmitted */ - u_long tcps_sndrexmitbad; /* unnecessary packet retransmissions */ - u_long tcps_sndacks; /* ack-only packets sent */ - u_long tcps_sndprobe; /* window probes sent */ - u_long tcps_sndurg; /* packets sent with URG only */ - u_long tcps_sndwinup; /* window update-only packets sent */ - u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ - - u_long tcps_rcvtotal; /* total packets received */ - u_long tcps_rcvpack; /* packets received in sequence */ - u_long tcps_rcvbyte; /* bytes received in sequence */ - u_long tcps_rcvbadsum; /* packets received with ccksum errs */ - u_long tcps_rcvbadoff; /* packets received with bad offset */ - u_long tcps_rcvmemdrop; /* packets dropped for lack of memory */ - u_long tcps_rcvshort; /* packets received too short */ - u_long tcps_rcvduppack; /* duplicate-only packets received */ - u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ - u_long tcps_rcvpartduppack; /* packets with some duplicate data */ - u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ - u_long tcps_rcvoopack; /* out-of-order packets received */ - u_long tcps_rcvoobyte; /* out-of-order bytes received */ - u_long tcps_rcvpackafterwin; /* packets with data after window */ - u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */ - u_long tcps_rcvafterclose; /* packets rcvd after "close" */ - u_long tcps_rcvwinprobe; /* rcvd window probe packets */ - u_long tcps_rcvdupack; /* rcvd duplicate acks */ - u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */ - u_long tcps_rcvackpack; /* rcvd ack packets */ - u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ - u_long tcps_rcvwinupd; /* rcvd window update packets */ - u_long tcps_pawsdrop; /* segments dropped due to PAWS */ - u_long tcps_predack; /* times hdr predict ok for acks */ - u_long tcps_preddat; /* times hdr predict ok for data pkts */ - u_long tcps_pcbcachemiss; - u_long tcps_cachedrtt; /* times cached RTT in route updated */ - u_long tcps_cachedrttvar; /* times cached rttvar updated */ - u_long tcps_cachedssthresh; /* times cached ssthresh updated */ - u_long tcps_usedrtt; /* times RTT initialized from route */ - u_long tcps_usedrttvar; /* times RTTVAR initialized from rt */ - u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/ - u_long tcps_persistdrop; /* timeout in persist state */ - u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */ - u_long tcps_mturesent; /* resends due to MTU discovery */ - u_long tcps_listendrop; /* listen queue overflows */ - u_long tcps_badrst; /* ignored RSTs in the window */ - - u_long tcps_sc_added; /* entry added to syncache */ - u_long tcps_sc_retransmitted; /* syncache entry was retransmitted */ - u_long tcps_sc_dupsyn; /* duplicate SYN packet */ - u_long tcps_sc_dropped; /* could not reply to packet */ - u_long tcps_sc_completed; /* successful extraction of entry */ - u_long tcps_sc_bucketoverflow; /* syncache per-bucket limit hit */ - u_long tcps_sc_cacheoverflow; /* syncache cache limit hit */ - u_long tcps_sc_reset; /* RST removed entry from syncache */ - u_long tcps_sc_stale; /* timed out or listen socket gone */ - u_long tcps_sc_aborted; /* syncache entry aborted */ - u_long tcps_sc_badack; /* removed due to bad ACK */ - u_long tcps_sc_unreach; /* ICMP unreachable received */ - u_long tcps_sc_zonefail; /* zalloc() failed */ - u_long tcps_sc_sendcookie; /* SYN cookie sent */ - u_long tcps_sc_recvcookie; /* SYN cookie received */ + uint64_t tcps_connattempt; /* connections initiated */ + uint64_t tcps_accepts; /* connections accepted */ + uint64_t tcps_connects; /* connections established */ + uint64_t tcps_drops; /* connections dropped */ + uint64_t tcps_conndrops; /* embryonic connections dropped */ + uint64_t tcps_minmssdrops; /* average minmss too low drops */ + uint64_t tcps_closed; /* conn. closed (includes drops) */ + uint64_t tcps_segstimed; /* segs where we tried to get rtt */ + uint64_t tcps_rttupdated; /* times we succeeded */ + uint64_t tcps_delack; /* delayed acks sent */ + uint64_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + uint64_t tcps_rexmttimeo; /* retransmit timeouts */ + uint64_t tcps_persisttimeo; /* persist timeouts */ + uint64_t tcps_keeptimeo; /* keepalive timeouts */ + uint64_t tcps_keepprobe; /* keepalive probes sent */ + uint64_t tcps_keepdrops; /* connections dropped in keepalive */ + + uint64_t tcps_sndtotal; /* total packets sent */ + uint64_t tcps_sndpack; /* data packets sent */ + uint64_t tcps_sndbyte; /* data bytes sent */ + uint64_t tcps_sndrexmitpack; /* data packets retransmitted */ + uint64_t tcps_sndrexmitbyte; /* data bytes retransmitted */ + uint64_t tcps_sndrexmitbad; /* unnecessary packet retransmissions */ + uint64_t tcps_sndacks; /* ack-only packets sent */ + uint64_t tcps_sndprobe; /* window probes sent */ + uint64_t tcps_sndurg; /* packets sent with URG only */ + uint64_t tcps_sndwinup; /* window update-only packets sent */ + uint64_t tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + uint64_t tcps_rcvtotal; /* total packets received */ + uint64_t tcps_rcvpack; /* packets received in sequence */ + uint64_t tcps_rcvbyte; /* bytes received in sequence */ + uint64_t tcps_rcvbadsum; /* packets received with ccksum errs */ + uint64_t tcps_rcvbadoff; /* packets received with bad offset */ + uint64_t tcps_rcvmemdrop; /* packets dropped for lack of memory */ + uint64_t tcps_rcvshort; /* packets received too short */ + uint64_t tcps_rcvduppack; /* duplicate-only packets received */ + uint64_t tcps_rcvdupbyte; /* duplicate-only bytes received */ + uint64_t tcps_rcvpartduppack; /* packets with some duplicate data */ + uint64_t tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + uint64_t tcps_rcvoopack; /* out-of-order packets received */ + uint64_t tcps_rcvoobyte; /* out-of-order bytes received */ + uint64_t tcps_rcvpackafterwin; /* packets with data after window */ + uint64_t tcps_rcvbyteafterwin; /* bytes rcvd after window */ + uint64_t tcps_rcvafterclose; /* packets rcvd after "close" */ + uint64_t tcps_rcvwinprobe; /* rcvd window probe packets */ + uint64_t tcps_rcvdupack; /* rcvd duplicate acks */ + uint64_t tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + uint64_t tcps_rcvackpack; /* rcvd ack packets */ + uint64_t tcps_rcvackbyte; /* bytes acked by rcvd acks */ + uint64_t tcps_rcvwinupd; /* rcvd window update packets */ + uint64_t tcps_pawsdrop; /* segments dropped due to PAWS */ + uint64_t tcps_predack; /* times hdr predict ok for acks */ + uint64_t tcps_preddat; /* times hdr predict ok for data pkts */ + uint64_t tcps_pcbcachemiss; + uint64_t tcps_cachedrtt; /* times cached RTT in route updated */ + uint64_t tcps_cachedrttvar; /* times cached rttvar updated */ + uint64_t tcps_cachedssthresh; /* times cached ssthresh updated */ + uint64_t tcps_usedrtt; /* times RTT initialized from route */ + uint64_t tcps_usedrttvar; /* times RTTVAR initialized from rt */ + uint64_t tcps_usedssthresh; /* times ssthresh initialized from rt*/ + uint64_t tcps_persistdrop; /* timeout in persist state */ + uint64_t tcps_badsyn; /* bogus SYN, e.g. premature ACK */ + uint64_t tcps_mturesent; /* resends due to MTU discovery */ + uint64_t tcps_listendrop; /* listen queue overflows */ + uint64_t tcps_badrst; /* ignored RSTs in the window */ + + uint64_t tcps_sc_added; /* entry added to syncache */ + uint64_t tcps_sc_retransmitted; /* syncache entry was retransmitted */ + uint64_t tcps_sc_dupsyn; /* duplicate SYN packet */ + uint64_t tcps_sc_dropped; /* could not reply to packet */ + uint64_t tcps_sc_completed; /* successful extraction of entry */ + uint64_t tcps_sc_bucketoverflow;/* syncache per-bucket limit hit */ + uint64_t tcps_sc_cacheoverflow; /* syncache cache limit hit */ + uint64_t tcps_sc_reset; /* RST removed entry from syncache */ + uint64_t tcps_sc_stale; /* timed out or listen socket gone */ + uint64_t tcps_sc_aborted; /* syncache entry aborted */ + uint64_t tcps_sc_badack; /* removed due to bad ACK */ + uint64_t tcps_sc_unreach; /* ICMP unreachable received */ + uint64_t tcps_sc_zonefail; /* zalloc() failed */ + uint64_t tcps_sc_sendcookie; /* SYN cookie sent */ + uint64_t tcps_sc_recvcookie; /* SYN cookie received */ - u_long tcps_hc_added; /* entry added to hostcache */ - u_long tcps_hc_bucketoverflow; /* hostcache per bucket limit hit */ + uint64_t tcps_hc_added; /* entry added to hostcache */ + uint64_t tcps_hc_bucketoverflow;/* hostcache per bucket limit hit */ - u_long tcps_finwait2_drops; /* Drop FIN_WAIT_2 connection after time limit */ + uint64_t tcps_finwait2_drops; /* Drop FIN_WAIT_2 connection after time limit */ /* SACK related stats */ - u_long tcps_sack_recovery_episode; /* SACK recovery episodes */ - u_long tcps_sack_rexmits; /* SACK rexmit segments */ - u_long tcps_sack_rexmit_bytes; /* SACK rexmit bytes */ - u_long tcps_sack_rcv_blocks; /* SACK blocks (options) received */ - u_long tcps_sack_send_blocks; /* SACK blocks (options) sent */ - u_long tcps_sack_sboverflow; /* times scoreboard overflowed */ + uint64_t tcps_sack_recovery_episode; /* SACK recovery episodes */ + uint64_t tcps_sack_rexmits; /* SACK rexmit segments */ + uint64_t tcps_sack_rexmit_bytes; /* SACK rexmit bytes */ + uint64_t tcps_sack_rcv_blocks; /* SACK blocks (options) received */ + uint64_t tcps_sack_send_blocks; /* SACK blocks (options) sent */ + uint64_t tcps_sack_sboverflow; /* times scoreboard overflowed */ /* ECN related stats */ - u_long tcps_ecn_ce; /* ECN Congestion Experienced */ - u_long tcps_ecn_ect0; /* ECN Capable Transport */ - u_long tcps_ecn_ect1; /* ECN Capable Transport */ - u_long tcps_ecn_shs; /* ECN successful handshakes */ - u_long tcps_ecn_rcwnd; /* # times ECN reduced the cwnd */ + uint64_t tcps_ecn_ce; /* ECN Congestion Experienced */ + uint64_t tcps_ecn_ect0; /* ECN Capable Transport */ + uint64_t tcps_ecn_ect1; /* ECN Capable Transport */ + uint64_t tcps_ecn_shs; /* ECN successful handshakes */ + uint64_t tcps_ecn_rcwnd; /* # times ECN reduced the cwnd */ /* TCP_SIGNATURE related stats */ - u_long tcps_sig_rcvgoodsig; /* Total matching signature received */ - u_long tcps_sig_rcvbadsig; /* Total bad signature received */ - u_long tcps_sig_err_buildsig; /* Mismatching signature received */ - u_long tcps_sig_err_sigopt; /* No signature expected by socket */ - u_long tcps_sig_err_nosigopt; /* No signature provided by segment */ + uint64_t tcps_sig_rcvgoodsig; /* Total matching signature received */ + uint64_t tcps_sig_rcvbadsig; /* Total bad signature received */ + uint64_t tcps_sig_err_buildsig; /* Mismatching signature received */ + uint64_t tcps_sig_err_sigopt; /* No signature expected by socket */ + uint64_t tcps_sig_err_nosigopt; /* No signature provided by segment */ - u_long _pad[12]; /* 6 UTO, 6 TBD */ + uint64_t _pad[12]; /* 6 UTO, 6 TBD */ }; #ifdef _KERNEL + +#include + +/* Should match 'struct tcpstat' above. */ +struct tcpstat_p { + counter_u64_t tcps_connattempt; + counter_u64_t tcps_accepts; + counter_u64_t tcps_connects; + counter_u64_t tcps_drops; + counter_u64_t tcps_conndrops; + counter_u64_t tcps_minmssdrops; + counter_u64_t tcps_closed; + counter_u64_t tcps_segstimed; + counter_u64_t tcps_rttupdated; + counter_u64_t tcps_delack; + counter_u64_t tcps_timeoutdrop; + counter_u64_t tcps_rexmttimeo; + counter_u64_t tcps_persisttimeo; + counter_u64_t tcps_keeptimeo; + counter_u64_t tcps_keepprobe; + counter_u64_t tcps_keepdrops; + counter_u64_t tcps_sndtotal; + counter_u64_t tcps_sndpack; + counter_u64_t tcps_sndbyte; + counter_u64_t tcps_sndrexmitpack; + counter_u64_t tcps_sndrexmitbyte; + counter_u64_t tcps_sndrexmitbad; + counter_u64_t tcps_sndacks; + counter_u64_t tcps_sndprobe; + counter_u64_t tcps_sndurg; + counter_u64_t tcps_sndwinup; + counter_u64_t tcps_sndctrl; + counter_u64_t tcps_rcvtotal; + counter_u64_t tcps_rcvpack; + counter_u64_t tcps_rcvbyte; + counter_u64_t tcps_rcvbadsum; + counter_u64_t tcps_rcvbadoff; + counter_u64_t tcps_rcvmemdrop; + counter_u64_t tcps_rcvshort; + counter_u64_t tcps_rcvduppack; + counter_u64_t tcps_rcvdupbyte; + counter_u64_t tcps_rcvpartduppack; + counter_u64_t tcps_rcvpartdupbyte; + counter_u64_t tcps_rcvoopack; + counter_u64_t tcps_rcvoobyte; + counter_u64_t tcps_rcvpackafterwin; + counter_u64_t tcps_rcvbyteafterwin; + counter_u64_t tcps_rcvafterclose; + counter_u64_t tcps_rcvwinprobe; + counter_u64_t tcps_rcvdupack; + counter_u64_t tcps_rcvacktoomuch; + counter_u64_t tcps_rcvackpack; + counter_u64_t tcps_rcvackbyte; + counter_u64_t tcps_rcvwinupd; + counter_u64_t tcps_pawsdrop; + counter_u64_t tcps_predack; + counter_u64_t tcps_preddat; + counter_u64_t tcps_pcbcachemiss; + counter_u64_t tcps_cachedrtt; + counter_u64_t tcps_cachedrttvar; + counter_u64_t tcps_cachedssthresh; + counter_u64_t tcps_usedrtt; + counter_u64_t tcps_usedrttvar; + counter_u64_t tcps_usedssthresh; + counter_u64_t tcps_persistdrop; + counter_u64_t tcps_badsyn; + counter_u64_t tcps_mturesent; + counter_u64_t tcps_listendrop; + counter_u64_t tcps_badrst; + counter_u64_t tcps_sc_added; + counter_u64_t tcps_sc_retransmitted; + counter_u64_t tcps_sc_dupsyn; + counter_u64_t tcps_sc_dropped; + counter_u64_t tcps_sc_completed; + counter_u64_t tcps_sc_bucketoverflow; + counter_u64_t tcps_sc_cacheoverflow; + counter_u64_t tcps_sc_reset; + counter_u64_t tcps_sc_stale; + counter_u64_t tcps_sc_aborted; + counter_u64_t tcps_sc_badack; + counter_u64_t tcps_sc_unreach; + counter_u64_t tcps_sc_zonefail; + counter_u64_t tcps_sc_sendcookie; + counter_u64_t tcps_sc_recvcookie; + counter_u64_t tcps_hc_added; + counter_u64_t tcps_hc_bucketoverflow; + counter_u64_t tcps_finwait2_drops; + counter_u64_t tcps_sack_recovery_episode; + counter_u64_t tcps_sack_rexmits; + counter_u64_t tcps_sack_rexmit_bytes; + counter_u64_t tcps_sack_rcv_blocks; + counter_u64_t tcps_sack_send_blocks; + counter_u64_t tcps_sack_sboverflow; + counter_u64_t tcps_ecn_ce; + counter_u64_t tcps_ecn_ect0; + counter_u64_t tcps_ecn_ect1; + counter_u64_t tcps_ecn_shs; + counter_u64_t tcps_ecn_rcwnd; + counter_u64_t tcps_sig_rcvgoodsig; + counter_u64_t tcps_sig_rcvbadsig; + counter_u64_t tcps_sig_err_buildsig; + counter_u64_t tcps_sig_err_sigopt; + counter_u64_t tcps_sig_err_nosigopt; +}; + +VNET_DECLARE(struct tcpstat_p, tcpstatp); /* tcp statistics */ +#define V_tcpstatp VNET(tcpstatp) + /* * In-kernel consumers can use these accessor macros directly to update * stats. */ -#define TCPSTAT_ADD(name, val) V_tcpstat.name += (val) +#define TCPSTAT_ADD(name, val) counter_u64_add(V_tcpstatp.name, (val)) #define TCPSTAT_INC(name) TCPSTAT_ADD(name, 1) /* @@ -515,7 +623,8 @@ struct tcpstat { */ void kmod_tcpstat_inc(int statnum); #define KMOD_TCPSTAT_INC(name) \ - kmod_tcpstat_inc(offsetof(struct tcpstat, name) / sizeof(u_long)) + kmod_tcpstat_inc(offsetof(struct tcpstat_p, name) / \ + sizeof(counter_u64_t)) /* * TCP specific helper hook point identifiers. @@ -605,7 +714,6 @@ MALLOC_DECLARE(M_TCPLOG); VNET_DECLARE(struct inpcbhead, tcb); /* queue of active tcpcb's */ VNET_DECLARE(struct inpcbinfo, tcbinfo); -VNET_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */ extern int tcp_log_in_vain; VNET_DECLARE(int, tcp_mssdflt); /* XXX */ VNET_DECLARE(int, tcp_minmss); @@ -619,7 +727,6 @@ VNET_DECLARE(int, tcp_do_rfc3465); VNET_DECLARE(int, tcp_abc_l_var); #define V_tcb VNET(tcb) #define V_tcbinfo VNET(tcbinfo) -#define V_tcpstat VNET(tcpstat) #define V_tcp_mssdflt VNET(tcp_mssdflt) #define V_tcp_minmss VNET(tcp_minmss) #define V_tcp_delack_enabled VNET(tcp_delack_enabled) Modified: user/attilio/vmcontention/sys/vm/vm_page.h ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_page.h Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/vm/vm_page.h Mon Apr 8 20:11:03 2013 (r249279) @@ -143,7 +143,7 @@ struct vm_page { uint8_t aflags; /* access is atomic */ uint8_t oflags; /* page VPO_* flags (O) */ uint16_t flags; /* page PG_* flags (P) */ - u_char act_count; /* page usage count (O) */ + u_char act_count; /* page usage count (P) */ u_char busy; /* page busy count (O) */ /* NOTE that these must support one bit per DEV_BSIZE in a page!!! */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ Modified: user/attilio/vmcontention/sys/vm/vm_pageout.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_pageout.c Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/sys/vm/vm_pageout.c Mon Apr 8 20:11:03 2013 (r249279) @@ -1015,9 +1015,9 @@ vm_pageout_scan(int pass) } else if ((m->aflags & PGA_REFERENCED) == 0 && (actcount = pmap_ts_referenced(m)) != 0) { vm_page_activate(m); - vm_page_unlock(m); - m->act_count += actcount + ACT_ADVANCE; VM_OBJECT_WUNLOCK(object); + m->act_count += actcount + ACT_ADVANCE; + vm_page_unlock(m); goto relock_queues; } @@ -1031,9 +1031,9 @@ vm_pageout_scan(int pass) vm_page_aflag_clear(m, PGA_REFERENCED); actcount = pmap_ts_referenced(m); vm_page_activate(m); - vm_page_unlock(m); - m->act_count += actcount + ACT_ADVANCE + 1; VM_OBJECT_WUNLOCK(object); + m->act_count += actcount + ACT_ADVANCE + 1; + vm_page_unlock(m); goto relock_queues; } Modified: user/attilio/vmcontention/usr.bin/netstat/inet.c ============================================================================== --- user/attilio/vmcontention/usr.bin/netstat/inet.c Mon Apr 8 20:02:27 2013 (r249278) +++ user/attilio/vmcontention/usr.bin/netstat/inet.c Mon Apr 8 20:11:03 2013 (r249279) @@ -608,115 +608,121 @@ tcp_stats(u_long off, const char *name, printf ("%s:\n", name); -#define p(f, m) if (tcpstat.f || sflag <= 1) \ - printf(m, tcpstat.f, plural(tcpstat.f)) -#define p1a(f, m) if (tcpstat.f || sflag <= 1) \ - printf(m, tcpstat.f) -#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ - printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2)) -#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ - printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2) -#define p3(f, m) if (tcpstat.f || sflag <= 1) \ - printf(m, tcpstat.f, pluralies(tcpstat.f)) +#define p(f, m) if (tcpstat.f || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f, plural(tcpstat.f)) - p(tcps_sndtotal, "\t%lu packet%s sent\n"); - p2(tcps_sndpack,tcps_sndbyte, "\t\t%lu data packet%s (%lu byte%s)\n"); +#define p1a(f, m) if (tcpstat.f || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f) + +#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \ + (uintmax_t )tcpstat.f2, plural(tcpstat.f2)) + +#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \ + (uintmax_t )tcpstat.f2) + +#define p3(f, m) if (tcpstat.f || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f, pluralies(tcpstat.f)) + + p(tcps_sndtotal, "\t%ju packet%s sent\n"); + p2(tcps_sndpack,tcps_sndbyte, "\t\t%ju data packet%s (%ju byte%s)\n"); p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, - "\t\t%lu data packet%s (%lu byte%s) retransmitted\n"); + "\t\t%ju data packet%s (%ju byte%s) retransmitted\n"); p(tcps_sndrexmitbad, - "\t\t%lu data packet%s unnecessarily retransmitted\n"); - p(tcps_mturesent, "\t\t%lu resend%s initiated by MTU discovery\n"); + "\t\t%ju data packet%s unnecessarily retransmitted\n"); + p(tcps_mturesent, "\t\t%ju resend%s initiated by MTU discovery\n"); p2a(tcps_sndacks, tcps_delack, - "\t\t%lu ack-only packet%s (%lu delayed)\n"); - p(tcps_sndurg, "\t\t%lu URG only packet%s\n"); - p(tcps_sndprobe, "\t\t%lu window probe packet%s\n"); - p(tcps_sndwinup, "\t\t%lu window update packet%s\n"); - p(tcps_sndctrl, "\t\t%lu control packet%s\n"); - p(tcps_rcvtotal, "\t%lu packet%s received\n"); + "\t\t%ju ack-only packet%s (%ju delayed)\n"); + p(tcps_sndurg, "\t\t%ju URG only packet%s\n"); + p(tcps_sndprobe, "\t\t%ju window probe packet%s\n"); + p(tcps_sndwinup, "\t\t%ju window update packet%s\n"); + p(tcps_sndctrl, "\t\t%ju control packet%s\n"); + p(tcps_rcvtotal, "\t%ju packet%s received\n"); p2(tcps_rcvackpack, tcps_rcvackbyte, - "\t\t%lu ack%s (for %lu byte%s)\n"); - p(tcps_rcvdupack, "\t\t%lu duplicate ack%s\n"); - p(tcps_rcvacktoomuch, "\t\t%lu ack%s for unsent data\n"); + "\t\t%ju ack%s (for %ju byte%s)\n"); + p(tcps_rcvdupack, "\t\t%ju duplicate ack%s\n"); + p(tcps_rcvacktoomuch, "\t\t%ju ack%s for unsent data\n"); p2(tcps_rcvpack, tcps_rcvbyte, - "\t\t%lu packet%s (%lu byte%s) received in-sequence\n"); + "\t\t%ju packet%s (%ju byte%s) received in-sequence\n"); p2(tcps_rcvduppack, tcps_rcvdupbyte, - "\t\t%lu completely duplicate packet%s (%lu byte%s)\n"); - p(tcps_pawsdrop, "\t\t%lu old duplicate packet%s\n"); + "\t\t%ju completely duplicate packet%s (%ju byte%s)\n"); + p(tcps_pawsdrop, "\t\t%ju old duplicate packet%s\n"); p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, - "\t\t%lu packet%s with some dup. data (%lu byte%s duped)\n"); + "\t\t%ju packet%s with some dup. data (%ju byte%s duped)\n"); p2(tcps_rcvoopack, tcps_rcvoobyte, - "\t\t%lu out-of-order packet%s (%lu byte%s)\n"); + "\t\t%ju out-of-order packet%s (%ju byte%s)\n"); p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, - "\t\t%lu packet%s (%lu byte%s) of data after window\n"); - p(tcps_rcvwinprobe, "\t\t%lu window probe%s\n"); - p(tcps_rcvwinupd, "\t\t%lu window update packet%s\n"); - p(tcps_rcvafterclose, "\t\t%lu packet%s received after close\n"); - p(tcps_rcvbadsum, "\t\t%lu discarded for bad checksum%s\n"); - p(tcps_rcvbadoff, "\t\t%lu discarded for bad header offset field%s\n"); - p1a(tcps_rcvshort, "\t\t%lu discarded because packet too short\n"); - p1a(tcps_rcvmemdrop, "\t\t%lu discarded due to memory problems\n"); - p(tcps_connattempt, "\t%lu connection request%s\n"); - p(tcps_accepts, "\t%lu connection accept%s\n"); - p(tcps_badsyn, "\t%lu bad connection attempt%s\n"); - p(tcps_listendrop, "\t%lu listen queue overflow%s\n"); - p(tcps_badrst, "\t%lu ignored RSTs in the window%s\n"); - p(tcps_connects, "\t%lu connection%s established (including accepts)\n"); + "\t\t%ju packet%s (%ju byte%s) of data after window\n"); + p(tcps_rcvwinprobe, "\t\t%ju window probe%s\n"); + p(tcps_rcvwinupd, "\t\t%ju window update packet%s\n"); + p(tcps_rcvafterclose, "\t\t%ju packet%s received after close\n"); + p(tcps_rcvbadsum, "\t\t%ju discarded for bad checksum%s\n"); + p(tcps_rcvbadoff, "\t\t%ju discarded for bad header offset field%s\n"); + p1a(tcps_rcvshort, "\t\t%ju discarded because packet too short\n"); + p1a(tcps_rcvmemdrop, "\t\t%ju discarded due to memory problems\n"); + p(tcps_connattempt, "\t%ju connection request%s\n"); + p(tcps_accepts, "\t%ju connection accept%s\n"); + p(tcps_badsyn, "\t%ju bad connection attempt%s\n"); + p(tcps_listendrop, "\t%ju listen queue overflow%s\n"); + p(tcps_badrst, "\t%ju ignored RSTs in the window%s\n"); + p(tcps_connects, "\t%ju connection%s established (including accepts)\n"); p2(tcps_closed, tcps_drops, - "\t%lu connection%s closed (including %lu drop%s)\n"); - p(tcps_cachedrtt, "\t\t%lu connection%s updated cached RTT on close\n"); + "\t%ju connection%s closed (including %ju drop%s)\n"); + p(tcps_cachedrtt, "\t\t%ju connection%s updated cached RTT on close\n"); p(tcps_cachedrttvar, - "\t\t%lu connection%s updated cached RTT variance on close\n"); + "\t\t%ju connection%s updated cached RTT variance on close\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Apr 8 20:14:42 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B8B7DF2F; Mon, 8 Apr 2013 20:14:42 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AB9978B4; Mon, 8 Apr 2013 20:14:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r38KEgoH006959; Mon, 8 Apr 2013 20:14:42 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r38KEfIs006952; Mon, 8 Apr 2013 20:14:41 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304082014.r38KEfIs006952@svn.freebsd.org> From: Attilio Rao Date: Mon, 8 Apr 2013 20:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249280 - in user/attilio/vmobj-readlock: sys/netinet usr.bin/netstat X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 20:14:42 -0000 Author: attilio Date: Mon Apr 8 20:14:41 2013 New Revision: 249280 URL: http://svnweb.freebsd.org/changeset/base/249280 Log: MFC Modified: user/attilio/vmobj-readlock/sys/netinet/ip_input.c user/attilio/vmobj-readlock/sys/netinet/ip_var.h user/attilio/vmobj-readlock/sys/netinet/tcp_input.c user/attilio/vmobj-readlock/sys/netinet/tcp_var.h user/attilio/vmobj-readlock/usr.bin/netstat/inet.c Directory Properties: user/attilio/vmobj-readlock/ (props changed) user/attilio/vmobj-readlock/sys/ (props changed) Modified: user/attilio/vmobj-readlock/sys/netinet/ip_input.c ============================================================================== --- user/attilio/vmobj-readlock/sys/netinet/ip_input.c Mon Apr 8 20:11:03 2013 (r249279) +++ user/attilio/vmobj-readlock/sys/netinet/ip_input.c Mon Apr 8 20:14:41 2013 (r249280) @@ -153,11 +153,6 @@ VNET_DEFINE(struct in_ifaddrhead, in_ifa VNET_DEFINE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); /* inet addr hash table */ VNET_DEFINE(u_long, in_ifaddrhmask); /* mask for hash table */ -VNET_DEFINE(struct ipstat, ipstat); -SYSCTL_VNET_STRUCT(_net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW, - &VNET_NAME(ipstat), ipstat, - "IP statistics (struct ipstat, netinet/ip_var.h)"); - static VNET_DEFINE(uma_zone_t, ipq_zone); static VNET_DEFINE(TAILQ_HEAD(ipqhead, ipq), ipq[IPREASS_NHASH]); static struct mtx ipqlock; @@ -213,24 +208,89 @@ SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, static void ip_freef(struct ipqhead *, struct ipq *); /* + * IP statistics are stored in struct ipstat_p, which is + * an "array" of counter(9)s. Although it isn't a real + * array, we treat it as array to reduce code bloat. + */ +VNET_DEFINE(struct ipstat_p, ipstatp); + +static void +vnet_ipstatp_init(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_ipstatp; + i < sizeof(V_ipstatp) / sizeof(counter_u64_t); + i++, c++) { + *c = counter_u64_alloc(M_WAITOK); + counter_u64_zero(*c); + } +} +VNET_SYSINIT(vnet_ipstatp_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_ipstatp_init, NULL); + +#ifdef VIMAGE +static void +vnet_ipstatp_uninit(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_ipstatp; + i < sizeof(V_ipstatp) / sizeof(counter_u64_t); + i++, c++) + counter_u64_free(*c); +} +VNET_SYSUNINIT(vnet_ipstatp_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_ipstatp_uninit, NULL); +#endif /* VIMAGE */ + +static int +ipstat_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct ipstat ipstat; + counter_u64_t *c; + uint64_t *v; + int i; + + for (i = 0, c = (counter_u64_t *)&V_ipstatp, v = (uint64_t *)&ipstat; + i < sizeof(V_ipstatp) / sizeof(counter_u64_t); + i++, c++, v++) { + *v = counter_u64_fetch(*c); + /* + * Old interface allowed to rewrite 'struct ipstat', and + * netstat(1) used it to zero the structure. To keep + * compatibility with old netstat(1) we will zero out + * statistics on every write attempt, however we no longer + * support writing arbitrary fake values to the statistics. + */ + if (req->newptr) + counter_u64_zero(*c); + } + + return (SYSCTL_OUT(req, &ipstat, sizeof(ipstat))); +} +SYSCTL_VNET_PROC(_net_inet_ip, IPCTL_STATS, stats, CTLTYPE_OPAQUE | CTLFLAG_RW, + NULL, 0, ipstat_sysctl, "I", + "IP statistics (struct ipstat, netinet/ip_var.h)"); + +/* * Kernel module interface for updating ipstat. The argument is an index - * into ipstat treated as an array of u_long. While this encodes the general - * layout of ipstat into the caller, it doesn't encode its location, so that - * future changes to add, for example, per-CPU stats support won't cause - * binary compatibility problems for kernel modules. + * into ipstat treated as an array. */ void kmod_ipstat_inc(int statnum) { - (*((u_long *)&V_ipstat + statnum))++; + counter_u64_add((counter_u64_t )&V_ipstatp + statnum, 1); } void kmod_ipstat_dec(int statnum) { - (*((u_long *)&V_ipstat + statnum))--; + counter_u64_add((counter_u64_t )&V_ipstatp + statnum, -1); } static int Modified: user/attilio/vmobj-readlock/sys/netinet/ip_var.h ============================================================================== --- user/attilio/vmobj-readlock/sys/netinet/ip_var.h Mon Apr 8 20:11:03 2013 (r249279) +++ user/attilio/vmobj-readlock/sys/netinet/ip_var.h Mon Apr 8 20:14:41 2013 (r249280) @@ -97,59 +97,95 @@ struct ip_moptions { }; struct ipstat { - u_long ips_total; /* total packets received */ - u_long ips_badsum; /* checksum bad */ - u_long ips_tooshort; /* packet too short */ - u_long ips_toosmall; /* not enough data */ - u_long ips_badhlen; /* ip header length < data size */ - u_long ips_badlen; /* ip length < ip header length */ - u_long ips_fragments; /* fragments received */ - u_long ips_fragdropped; /* frags dropped (dups, out of space) */ - u_long ips_fragtimeout; /* fragments timed out */ - u_long ips_forward; /* packets forwarded */ - u_long ips_fastforward; /* packets fast forwarded */ - u_long ips_cantforward; /* packets rcvd for unreachable dest */ - u_long ips_redirectsent; /* packets forwarded on same net */ - u_long ips_noproto; /* unknown or unsupported protocol */ - u_long ips_delivered; /* datagrams delivered to upper level*/ - u_long ips_localout; /* total ip packets generated here */ - u_long ips_odropped; /* lost packets due to nobufs, etc. */ - u_long ips_reassembled; /* total packets reassembled ok */ - u_long ips_fragmented; /* datagrams successfully fragmented */ - u_long ips_ofragments; /* output fragments created */ - u_long ips_cantfrag; /* don't fragment flag was set, etc. */ - u_long ips_badoptions; /* error in option processing */ - u_long ips_noroute; /* packets discarded due to no route */ - u_long ips_badvers; /* ip version != 4 */ - u_long ips_rawout; /* total raw ip packets generated */ - u_long ips_toolong; /* ip length > max ip packet size */ - u_long ips_notmember; /* multicasts for unregistered grps */ - u_long ips_nogif; /* no match gif found */ - u_long ips_badaddr; /* invalid address on header */ + uint64_t ips_total; /* total packets received */ + uint64_t ips_badsum; /* checksum bad */ + uint64_t ips_tooshort; /* packet too short */ + uint64_t ips_toosmall; /* not enough data */ + uint64_t ips_badhlen; /* ip header length < data size */ + uint64_t ips_badlen; /* ip length < ip header length */ + uint64_t ips_fragments; /* fragments received */ + uint64_t ips_fragdropped; /* frags dropped (dups, out of space) */ + uint64_t ips_fragtimeout; /* fragments timed out */ + uint64_t ips_forward; /* packets forwarded */ + uint64_t ips_fastforward; /* packets fast forwarded */ + uint64_t ips_cantforward; /* packets rcvd for unreachable dest */ + uint64_t ips_redirectsent; /* packets forwarded on same net */ + uint64_t ips_noproto; /* unknown or unsupported protocol */ + uint64_t ips_delivered; /* datagrams delivered to upper level*/ + uint64_t ips_localout; /* total ip packets generated here */ + uint64_t ips_odropped; /* lost packets due to nobufs, etc. */ + uint64_t ips_reassembled; /* total packets reassembled ok */ + uint64_t ips_fragmented; /* datagrams successfully fragmented */ + uint64_t ips_ofragments; /* output fragments created */ + uint64_t ips_cantfrag; /* don't fragment flag was set, etc. */ + uint64_t ips_badoptions; /* error in option processing */ + uint64_t ips_noroute; /* packets discarded due to no route */ + uint64_t ips_badvers; /* ip version != 4 */ + uint64_t ips_rawout; /* total raw ip packets generated */ + uint64_t ips_toolong; /* ip length > max ip packet size */ + uint64_t ips_notmember; /* multicasts for unregistered grps */ + uint64_t ips_nogif; /* no match gif found */ + uint64_t ips_badaddr; /* invalid address on header */ }; #ifdef _KERNEL +#include #include +/* Should match 'struct ipstat' above. */ +struct ipstat_p { + counter_u64_t ips_total; + counter_u64_t ips_badsum; + counter_u64_t ips_tooshort; + counter_u64_t ips_toosmall; + counter_u64_t ips_badhlen; + counter_u64_t ips_badlen; + counter_u64_t ips_fragments; + counter_u64_t ips_fragdropped; + counter_u64_t ips_fragtimeout; + counter_u64_t ips_forward; + counter_u64_t ips_fastforward; + counter_u64_t ips_cantforward; + counter_u64_t ips_redirectsent; + counter_u64_t ips_noproto; + counter_u64_t ips_delivered; + counter_u64_t ips_localout; + counter_u64_t ips_odropped; + counter_u64_t ips_reassembled; + counter_u64_t ips_fragmented; + counter_u64_t ips_ofragments; + counter_u64_t ips_cantfrag; + counter_u64_t ips_badoptions; + counter_u64_t ips_noroute; + counter_u64_t ips_badvers; + counter_u64_t ips_rawout; + counter_u64_t ips_toolong; + counter_u64_t ips_notmember; + counter_u64_t ips_nogif; + counter_u64_t ips_badaddr; +}; +VNET_DECLARE(struct ipstat_p, ipstatp); +#define V_ipstatp VNET(ipstatp) + /* * In-kernel consumers can use these accessor macros directly to update * stats. */ -#define IPSTAT_ADD(name, val) V_ipstat.name += (val) -#define IPSTAT_SUB(name, val) V_ipstat.name -= (val) +#define IPSTAT_ADD(name, val) counter_u64_add(V_ipstatp.name, (val)) +#define IPSTAT_SUB(name, val) counter_u64_subtract(V_ipstatp.name, (val)) #define IPSTAT_INC(name) IPSTAT_ADD(name, 1) -#define IPSTAT_DEC(name) IPSTAT_SUB(name, 1) +#define IPSTAT_DEC(name) IPSTAT_ADD(name, -1) /* * Kernel module consumers must use this accessor macro. */ void kmod_ipstat_inc(int statnum); #define KMOD_IPSTAT_INC(name) \ - kmod_ipstat_inc(offsetof(struct ipstat, name) / sizeof(u_long)) + kmod_ipstat_inc(offsetof(struct ipstat_p, name) / sizeof(counter_u64_t)) void kmod_ipstat_dec(int statnum); #define KMOD_IPSTAT_DEC(name) \ - kmod_ipstat_dec(offsetof(struct ipstat, name) / sizeof(u_long)) + kmod_ipstat_dec(offsetof(struct ipstat_p, name) / sizeof(counter_u64_t)) /* flags passed to ip_output as last parameter */ #define IP_FORWARDING 0x1 /* most of ip header exists */ @@ -176,7 +212,6 @@ struct inpcb; struct route; struct sockopt; -VNET_DECLARE(struct ipstat, ipstat); VNET_DECLARE(u_short, ip_id); /* ip packet ctr, for ids */ VNET_DECLARE(int, ip_defttl); /* default IP ttl */ VNET_DECLARE(int, ipforwarding); /* ip forwarding */ @@ -192,7 +227,6 @@ VNET_DECLARE(int, rsvp_on); VNET_DECLARE(int, drop_redirect); extern struct pr_usrreqs rip_usrreqs; -#define V_ipstat VNET(ipstat) #define V_ip_id VNET(ip_id) #define V_ip_defttl VNET(ip_defttl) #define V_ipforwarding VNET(ipforwarding) Modified: user/attilio/vmobj-readlock/sys/netinet/tcp_input.c ============================================================================== --- user/attilio/vmobj-readlock/sys/netinet/tcp_input.c Mon Apr 8 20:11:03 2013 (r249279) +++ user/attilio/vmobj-readlock/sys/netinet/tcp_input.c Mon Apr 8 20:14:41 2013 (r249280) @@ -120,11 +120,6 @@ __FBSDID("$FreeBSD$"); const int tcprexmtthresh = 3; -VNET_DEFINE(struct tcpstat, tcpstat); -SYSCTL_VNET_STRUCT(_net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RW, - &VNET_NAME(tcpstat), tcpstat, - "TCP statistics (struct tcpstat, netinet/tcp_var.h)"); - int tcp_log_in_vain = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_RW, &tcp_log_in_vain, 0, @@ -245,17 +240,76 @@ static void inline hhook_run_tcp_est_in( struct tcphdr *th, struct tcpopt *to); /* + * TCP statistics are stored in struct tcpstat_p, which is + * an "array" of counter(9)s. Although it isn't a real + * array, we treat it as array to reduce code bloat. + */ +VNET_DEFINE(struct tcpstat_p, tcpstatp); + +static void +vnet_tcpstatp_init(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_tcpstatp; + i < sizeof(V_tcpstatp) / sizeof(counter_u64_t); + i++, c++) { + *c = counter_u64_alloc(M_WAITOK); + counter_u64_zero(*c); + } +} +VNET_SYSINIT(vnet_tcpstatp_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_tcpstatp_init, NULL); + +#ifdef VIMAGE +static void +vnet_tcpstatp_uninit(const void *unused) +{ + counter_u64_t *c; + int i; + + for (i = 0, c = (counter_u64_t *)&V_tcpstatp; + i < sizeof(V_tcpstatp) / sizeof(counter_u64_t); + i++, c++) + counter_u64_free(*c); +} +VNET_SYSUNINIT(vnet_tcpstatp_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_ipstatp_uninit, NULL); +#endif /* VIMAGE */ + +static int +tcpstat_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct tcpstat tcpstat; + counter_u64_t *c; + uint64_t *v; + int i; + + for (i = 0, c = (counter_u64_t *)&V_tcpstatp, v = (uint64_t *)&tcpstat; + i < sizeof(V_tcpstatp) / sizeof(counter_u64_t); + i++, c++, v++) { + *v = counter_u64_fetch(*c); + if (req->newptr) + counter_u64_zero(*c); + } + + return (SYSCTL_OUT(req, &tcpstat, sizeof(tcpstat))); +} + +SYSCTL_VNET_PROC(_net_inet_tcp, TCPCTL_STATS, stats, CTLTYPE_OPAQUE | + CTLFLAG_RW, NULL, 0, tcpstat_sysctl, "I", + "TCP statistics (struct tcpstat, netinet/tcp_var.h)"); + +/* * Kernel module interface for updating tcpstat. The argument is an index - * into tcpstat treated as an array of u_long. While this encodes the - * general layout of tcpstat into the caller, it doesn't encode its location, - * so that future changes to add, for example, per-CPU stats support won't - * cause binary compatibility problems for kernel modules. + * into tcpstat treated as an array. */ void kmod_tcpstat_inc(int statnum) { - (*((u_long *)&V_tcpstat + statnum))++; + counter_u64_add((counter_u64_t )&V_tcpstatp + statnum, 1); } /* Modified: user/attilio/vmobj-readlock/sys/netinet/tcp_var.h ============================================================================== --- user/attilio/vmobj-readlock/sys/netinet/tcp_var.h Mon Apr 8 20:11:03 2013 (r249279) +++ user/attilio/vmobj-readlock/sys/netinet/tcp_var.h Mon Apr 8 20:14:41 2013 (r249280) @@ -389,125 +389,233 @@ struct tcptw { * but that's inconvenient at the moment. */ struct tcpstat { - u_long tcps_connattempt; /* connections initiated */ - u_long tcps_accepts; /* connections accepted */ - u_long tcps_connects; /* connections established */ - u_long tcps_drops; /* connections dropped */ - u_long tcps_conndrops; /* embryonic connections dropped */ - u_long tcps_minmssdrops; /* average minmss too low drops */ - u_long tcps_closed; /* conn. closed (includes drops) */ - u_long tcps_segstimed; /* segs where we tried to get rtt */ - u_long tcps_rttupdated; /* times we succeeded */ - u_long tcps_delack; /* delayed acks sent */ - u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ - u_long tcps_rexmttimeo; /* retransmit timeouts */ - u_long tcps_persisttimeo; /* persist timeouts */ - u_long tcps_keeptimeo; /* keepalive timeouts */ - u_long tcps_keepprobe; /* keepalive probes sent */ - u_long tcps_keepdrops; /* connections dropped in keepalive */ - - u_long tcps_sndtotal; /* total packets sent */ - u_long tcps_sndpack; /* data packets sent */ - u_long tcps_sndbyte; /* data bytes sent */ - u_long tcps_sndrexmitpack; /* data packets retransmitted */ - u_long tcps_sndrexmitbyte; /* data bytes retransmitted */ - u_long tcps_sndrexmitbad; /* unnecessary packet retransmissions */ - u_long tcps_sndacks; /* ack-only packets sent */ - u_long tcps_sndprobe; /* window probes sent */ - u_long tcps_sndurg; /* packets sent with URG only */ - u_long tcps_sndwinup; /* window update-only packets sent */ - u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ - - u_long tcps_rcvtotal; /* total packets received */ - u_long tcps_rcvpack; /* packets received in sequence */ - u_long tcps_rcvbyte; /* bytes received in sequence */ - u_long tcps_rcvbadsum; /* packets received with ccksum errs */ - u_long tcps_rcvbadoff; /* packets received with bad offset */ - u_long tcps_rcvmemdrop; /* packets dropped for lack of memory */ - u_long tcps_rcvshort; /* packets received too short */ - u_long tcps_rcvduppack; /* duplicate-only packets received */ - u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ - u_long tcps_rcvpartduppack; /* packets with some duplicate data */ - u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ - u_long tcps_rcvoopack; /* out-of-order packets received */ - u_long tcps_rcvoobyte; /* out-of-order bytes received */ - u_long tcps_rcvpackafterwin; /* packets with data after window */ - u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */ - u_long tcps_rcvafterclose; /* packets rcvd after "close" */ - u_long tcps_rcvwinprobe; /* rcvd window probe packets */ - u_long tcps_rcvdupack; /* rcvd duplicate acks */ - u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */ - u_long tcps_rcvackpack; /* rcvd ack packets */ - u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ - u_long tcps_rcvwinupd; /* rcvd window update packets */ - u_long tcps_pawsdrop; /* segments dropped due to PAWS */ - u_long tcps_predack; /* times hdr predict ok for acks */ - u_long tcps_preddat; /* times hdr predict ok for data pkts */ - u_long tcps_pcbcachemiss; - u_long tcps_cachedrtt; /* times cached RTT in route updated */ - u_long tcps_cachedrttvar; /* times cached rttvar updated */ - u_long tcps_cachedssthresh; /* times cached ssthresh updated */ - u_long tcps_usedrtt; /* times RTT initialized from route */ - u_long tcps_usedrttvar; /* times RTTVAR initialized from rt */ - u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/ - u_long tcps_persistdrop; /* timeout in persist state */ - u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */ - u_long tcps_mturesent; /* resends due to MTU discovery */ - u_long tcps_listendrop; /* listen queue overflows */ - u_long tcps_badrst; /* ignored RSTs in the window */ - - u_long tcps_sc_added; /* entry added to syncache */ - u_long tcps_sc_retransmitted; /* syncache entry was retransmitted */ - u_long tcps_sc_dupsyn; /* duplicate SYN packet */ - u_long tcps_sc_dropped; /* could not reply to packet */ - u_long tcps_sc_completed; /* successful extraction of entry */ - u_long tcps_sc_bucketoverflow; /* syncache per-bucket limit hit */ - u_long tcps_sc_cacheoverflow; /* syncache cache limit hit */ - u_long tcps_sc_reset; /* RST removed entry from syncache */ - u_long tcps_sc_stale; /* timed out or listen socket gone */ - u_long tcps_sc_aborted; /* syncache entry aborted */ - u_long tcps_sc_badack; /* removed due to bad ACK */ - u_long tcps_sc_unreach; /* ICMP unreachable received */ - u_long tcps_sc_zonefail; /* zalloc() failed */ - u_long tcps_sc_sendcookie; /* SYN cookie sent */ - u_long tcps_sc_recvcookie; /* SYN cookie received */ + uint64_t tcps_connattempt; /* connections initiated */ + uint64_t tcps_accepts; /* connections accepted */ + uint64_t tcps_connects; /* connections established */ + uint64_t tcps_drops; /* connections dropped */ + uint64_t tcps_conndrops; /* embryonic connections dropped */ + uint64_t tcps_minmssdrops; /* average minmss too low drops */ + uint64_t tcps_closed; /* conn. closed (includes drops) */ + uint64_t tcps_segstimed; /* segs where we tried to get rtt */ + uint64_t tcps_rttupdated; /* times we succeeded */ + uint64_t tcps_delack; /* delayed acks sent */ + uint64_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + uint64_t tcps_rexmttimeo; /* retransmit timeouts */ + uint64_t tcps_persisttimeo; /* persist timeouts */ + uint64_t tcps_keeptimeo; /* keepalive timeouts */ + uint64_t tcps_keepprobe; /* keepalive probes sent */ + uint64_t tcps_keepdrops; /* connections dropped in keepalive */ + + uint64_t tcps_sndtotal; /* total packets sent */ + uint64_t tcps_sndpack; /* data packets sent */ + uint64_t tcps_sndbyte; /* data bytes sent */ + uint64_t tcps_sndrexmitpack; /* data packets retransmitted */ + uint64_t tcps_sndrexmitbyte; /* data bytes retransmitted */ + uint64_t tcps_sndrexmitbad; /* unnecessary packet retransmissions */ + uint64_t tcps_sndacks; /* ack-only packets sent */ + uint64_t tcps_sndprobe; /* window probes sent */ + uint64_t tcps_sndurg; /* packets sent with URG only */ + uint64_t tcps_sndwinup; /* window update-only packets sent */ + uint64_t tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + uint64_t tcps_rcvtotal; /* total packets received */ + uint64_t tcps_rcvpack; /* packets received in sequence */ + uint64_t tcps_rcvbyte; /* bytes received in sequence */ + uint64_t tcps_rcvbadsum; /* packets received with ccksum errs */ + uint64_t tcps_rcvbadoff; /* packets received with bad offset */ + uint64_t tcps_rcvmemdrop; /* packets dropped for lack of memory */ + uint64_t tcps_rcvshort; /* packets received too short */ + uint64_t tcps_rcvduppack; /* duplicate-only packets received */ + uint64_t tcps_rcvdupbyte; /* duplicate-only bytes received */ + uint64_t tcps_rcvpartduppack; /* packets with some duplicate data */ + uint64_t tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + uint64_t tcps_rcvoopack; /* out-of-order packets received */ + uint64_t tcps_rcvoobyte; /* out-of-order bytes received */ + uint64_t tcps_rcvpackafterwin; /* packets with data after window */ + uint64_t tcps_rcvbyteafterwin; /* bytes rcvd after window */ + uint64_t tcps_rcvafterclose; /* packets rcvd after "close" */ + uint64_t tcps_rcvwinprobe; /* rcvd window probe packets */ + uint64_t tcps_rcvdupack; /* rcvd duplicate acks */ + uint64_t tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + uint64_t tcps_rcvackpack; /* rcvd ack packets */ + uint64_t tcps_rcvackbyte; /* bytes acked by rcvd acks */ + uint64_t tcps_rcvwinupd; /* rcvd window update packets */ + uint64_t tcps_pawsdrop; /* segments dropped due to PAWS */ + uint64_t tcps_predack; /* times hdr predict ok for acks */ + uint64_t tcps_preddat; /* times hdr predict ok for data pkts */ + uint64_t tcps_pcbcachemiss; + uint64_t tcps_cachedrtt; /* times cached RTT in route updated */ + uint64_t tcps_cachedrttvar; /* times cached rttvar updated */ + uint64_t tcps_cachedssthresh; /* times cached ssthresh updated */ + uint64_t tcps_usedrtt; /* times RTT initialized from route */ + uint64_t tcps_usedrttvar; /* times RTTVAR initialized from rt */ + uint64_t tcps_usedssthresh; /* times ssthresh initialized from rt*/ + uint64_t tcps_persistdrop; /* timeout in persist state */ + uint64_t tcps_badsyn; /* bogus SYN, e.g. premature ACK */ + uint64_t tcps_mturesent; /* resends due to MTU discovery */ + uint64_t tcps_listendrop; /* listen queue overflows */ + uint64_t tcps_badrst; /* ignored RSTs in the window */ + + uint64_t tcps_sc_added; /* entry added to syncache */ + uint64_t tcps_sc_retransmitted; /* syncache entry was retransmitted */ + uint64_t tcps_sc_dupsyn; /* duplicate SYN packet */ + uint64_t tcps_sc_dropped; /* could not reply to packet */ + uint64_t tcps_sc_completed; /* successful extraction of entry */ + uint64_t tcps_sc_bucketoverflow;/* syncache per-bucket limit hit */ + uint64_t tcps_sc_cacheoverflow; /* syncache cache limit hit */ + uint64_t tcps_sc_reset; /* RST removed entry from syncache */ + uint64_t tcps_sc_stale; /* timed out or listen socket gone */ + uint64_t tcps_sc_aborted; /* syncache entry aborted */ + uint64_t tcps_sc_badack; /* removed due to bad ACK */ + uint64_t tcps_sc_unreach; /* ICMP unreachable received */ + uint64_t tcps_sc_zonefail; /* zalloc() failed */ + uint64_t tcps_sc_sendcookie; /* SYN cookie sent */ + uint64_t tcps_sc_recvcookie; /* SYN cookie received */ - u_long tcps_hc_added; /* entry added to hostcache */ - u_long tcps_hc_bucketoverflow; /* hostcache per bucket limit hit */ + uint64_t tcps_hc_added; /* entry added to hostcache */ + uint64_t tcps_hc_bucketoverflow;/* hostcache per bucket limit hit */ - u_long tcps_finwait2_drops; /* Drop FIN_WAIT_2 connection after time limit */ + uint64_t tcps_finwait2_drops; /* Drop FIN_WAIT_2 connection after time limit */ /* SACK related stats */ - u_long tcps_sack_recovery_episode; /* SACK recovery episodes */ - u_long tcps_sack_rexmits; /* SACK rexmit segments */ - u_long tcps_sack_rexmit_bytes; /* SACK rexmit bytes */ - u_long tcps_sack_rcv_blocks; /* SACK blocks (options) received */ - u_long tcps_sack_send_blocks; /* SACK blocks (options) sent */ - u_long tcps_sack_sboverflow; /* times scoreboard overflowed */ + uint64_t tcps_sack_recovery_episode; /* SACK recovery episodes */ + uint64_t tcps_sack_rexmits; /* SACK rexmit segments */ + uint64_t tcps_sack_rexmit_bytes; /* SACK rexmit bytes */ + uint64_t tcps_sack_rcv_blocks; /* SACK blocks (options) received */ + uint64_t tcps_sack_send_blocks; /* SACK blocks (options) sent */ + uint64_t tcps_sack_sboverflow; /* times scoreboard overflowed */ /* ECN related stats */ - u_long tcps_ecn_ce; /* ECN Congestion Experienced */ - u_long tcps_ecn_ect0; /* ECN Capable Transport */ - u_long tcps_ecn_ect1; /* ECN Capable Transport */ - u_long tcps_ecn_shs; /* ECN successful handshakes */ - u_long tcps_ecn_rcwnd; /* # times ECN reduced the cwnd */ + uint64_t tcps_ecn_ce; /* ECN Congestion Experienced */ + uint64_t tcps_ecn_ect0; /* ECN Capable Transport */ + uint64_t tcps_ecn_ect1; /* ECN Capable Transport */ + uint64_t tcps_ecn_shs; /* ECN successful handshakes */ + uint64_t tcps_ecn_rcwnd; /* # times ECN reduced the cwnd */ /* TCP_SIGNATURE related stats */ - u_long tcps_sig_rcvgoodsig; /* Total matching signature received */ - u_long tcps_sig_rcvbadsig; /* Total bad signature received */ - u_long tcps_sig_err_buildsig; /* Mismatching signature received */ - u_long tcps_sig_err_sigopt; /* No signature expected by socket */ - u_long tcps_sig_err_nosigopt; /* No signature provided by segment */ + uint64_t tcps_sig_rcvgoodsig; /* Total matching signature received */ + uint64_t tcps_sig_rcvbadsig; /* Total bad signature received */ + uint64_t tcps_sig_err_buildsig; /* Mismatching signature received */ + uint64_t tcps_sig_err_sigopt; /* No signature expected by socket */ + uint64_t tcps_sig_err_nosigopt; /* No signature provided by segment */ - u_long _pad[12]; /* 6 UTO, 6 TBD */ + uint64_t _pad[12]; /* 6 UTO, 6 TBD */ }; #ifdef _KERNEL + +#include + +/* Should match 'struct tcpstat' above. */ +struct tcpstat_p { + counter_u64_t tcps_connattempt; + counter_u64_t tcps_accepts; + counter_u64_t tcps_connects; + counter_u64_t tcps_drops; + counter_u64_t tcps_conndrops; + counter_u64_t tcps_minmssdrops; + counter_u64_t tcps_closed; + counter_u64_t tcps_segstimed; + counter_u64_t tcps_rttupdated; + counter_u64_t tcps_delack; + counter_u64_t tcps_timeoutdrop; + counter_u64_t tcps_rexmttimeo; + counter_u64_t tcps_persisttimeo; + counter_u64_t tcps_keeptimeo; + counter_u64_t tcps_keepprobe; + counter_u64_t tcps_keepdrops; + counter_u64_t tcps_sndtotal; + counter_u64_t tcps_sndpack; + counter_u64_t tcps_sndbyte; + counter_u64_t tcps_sndrexmitpack; + counter_u64_t tcps_sndrexmitbyte; + counter_u64_t tcps_sndrexmitbad; + counter_u64_t tcps_sndacks; + counter_u64_t tcps_sndprobe; + counter_u64_t tcps_sndurg; + counter_u64_t tcps_sndwinup; + counter_u64_t tcps_sndctrl; + counter_u64_t tcps_rcvtotal; + counter_u64_t tcps_rcvpack; + counter_u64_t tcps_rcvbyte; + counter_u64_t tcps_rcvbadsum; + counter_u64_t tcps_rcvbadoff; + counter_u64_t tcps_rcvmemdrop; + counter_u64_t tcps_rcvshort; + counter_u64_t tcps_rcvduppack; + counter_u64_t tcps_rcvdupbyte; + counter_u64_t tcps_rcvpartduppack; + counter_u64_t tcps_rcvpartdupbyte; + counter_u64_t tcps_rcvoopack; + counter_u64_t tcps_rcvoobyte; + counter_u64_t tcps_rcvpackafterwin; + counter_u64_t tcps_rcvbyteafterwin; + counter_u64_t tcps_rcvafterclose; + counter_u64_t tcps_rcvwinprobe; + counter_u64_t tcps_rcvdupack; + counter_u64_t tcps_rcvacktoomuch; + counter_u64_t tcps_rcvackpack; + counter_u64_t tcps_rcvackbyte; + counter_u64_t tcps_rcvwinupd; + counter_u64_t tcps_pawsdrop; + counter_u64_t tcps_predack; + counter_u64_t tcps_preddat; + counter_u64_t tcps_pcbcachemiss; + counter_u64_t tcps_cachedrtt; + counter_u64_t tcps_cachedrttvar; + counter_u64_t tcps_cachedssthresh; + counter_u64_t tcps_usedrtt; + counter_u64_t tcps_usedrttvar; + counter_u64_t tcps_usedssthresh; + counter_u64_t tcps_persistdrop; + counter_u64_t tcps_badsyn; + counter_u64_t tcps_mturesent; + counter_u64_t tcps_listendrop; + counter_u64_t tcps_badrst; + counter_u64_t tcps_sc_added; + counter_u64_t tcps_sc_retransmitted; + counter_u64_t tcps_sc_dupsyn; + counter_u64_t tcps_sc_dropped; + counter_u64_t tcps_sc_completed; + counter_u64_t tcps_sc_bucketoverflow; + counter_u64_t tcps_sc_cacheoverflow; + counter_u64_t tcps_sc_reset; + counter_u64_t tcps_sc_stale; + counter_u64_t tcps_sc_aborted; + counter_u64_t tcps_sc_badack; + counter_u64_t tcps_sc_unreach; + counter_u64_t tcps_sc_zonefail; + counter_u64_t tcps_sc_sendcookie; + counter_u64_t tcps_sc_recvcookie; + counter_u64_t tcps_hc_added; + counter_u64_t tcps_hc_bucketoverflow; + counter_u64_t tcps_finwait2_drops; + counter_u64_t tcps_sack_recovery_episode; + counter_u64_t tcps_sack_rexmits; + counter_u64_t tcps_sack_rexmit_bytes; + counter_u64_t tcps_sack_rcv_blocks; + counter_u64_t tcps_sack_send_blocks; + counter_u64_t tcps_sack_sboverflow; + counter_u64_t tcps_ecn_ce; + counter_u64_t tcps_ecn_ect0; + counter_u64_t tcps_ecn_ect1; + counter_u64_t tcps_ecn_shs; + counter_u64_t tcps_ecn_rcwnd; + counter_u64_t tcps_sig_rcvgoodsig; + counter_u64_t tcps_sig_rcvbadsig; + counter_u64_t tcps_sig_err_buildsig; + counter_u64_t tcps_sig_err_sigopt; + counter_u64_t tcps_sig_err_nosigopt; +}; + +VNET_DECLARE(struct tcpstat_p, tcpstatp); /* tcp statistics */ +#define V_tcpstatp VNET(tcpstatp) + /* * In-kernel consumers can use these accessor macros directly to update * stats. */ -#define TCPSTAT_ADD(name, val) V_tcpstat.name += (val) +#define TCPSTAT_ADD(name, val) counter_u64_add(V_tcpstatp.name, (val)) #define TCPSTAT_INC(name) TCPSTAT_ADD(name, 1) /* @@ -515,7 +623,8 @@ struct tcpstat { */ void kmod_tcpstat_inc(int statnum); #define KMOD_TCPSTAT_INC(name) \ - kmod_tcpstat_inc(offsetof(struct tcpstat, name) / sizeof(u_long)) + kmod_tcpstat_inc(offsetof(struct tcpstat_p, name) / \ + sizeof(counter_u64_t)) /* * TCP specific helper hook point identifiers. @@ -605,7 +714,6 @@ MALLOC_DECLARE(M_TCPLOG); VNET_DECLARE(struct inpcbhead, tcb); /* queue of active tcpcb's */ VNET_DECLARE(struct inpcbinfo, tcbinfo); -VNET_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */ extern int tcp_log_in_vain; VNET_DECLARE(int, tcp_mssdflt); /* XXX */ VNET_DECLARE(int, tcp_minmss); @@ -619,7 +727,6 @@ VNET_DECLARE(int, tcp_do_rfc3465); VNET_DECLARE(int, tcp_abc_l_var); #define V_tcb VNET(tcb) #define V_tcbinfo VNET(tcbinfo) -#define V_tcpstat VNET(tcpstat) #define V_tcp_mssdflt VNET(tcp_mssdflt) #define V_tcp_minmss VNET(tcp_minmss) #define V_tcp_delack_enabled VNET(tcp_delack_enabled) Modified: user/attilio/vmobj-readlock/usr.bin/netstat/inet.c ============================================================================== --- user/attilio/vmobj-readlock/usr.bin/netstat/inet.c Mon Apr 8 20:11:03 2013 (r249279) +++ user/attilio/vmobj-readlock/usr.bin/netstat/inet.c Mon Apr 8 20:14:41 2013 (r249280) @@ -608,115 +608,121 @@ tcp_stats(u_long off, const char *name, printf ("%s:\n", name); -#define p(f, m) if (tcpstat.f || sflag <= 1) \ - printf(m, tcpstat.f, plural(tcpstat.f)) -#define p1a(f, m) if (tcpstat.f || sflag <= 1) \ - printf(m, tcpstat.f) -#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ - printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2)) -#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ - printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2) -#define p3(f, m) if (tcpstat.f || sflag <= 1) \ - printf(m, tcpstat.f, pluralies(tcpstat.f)) +#define p(f, m) if (tcpstat.f || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f, plural(tcpstat.f)) - p(tcps_sndtotal, "\t%lu packet%s sent\n"); - p2(tcps_sndpack,tcps_sndbyte, "\t\t%lu data packet%s (%lu byte%s)\n"); +#define p1a(f, m) if (tcpstat.f || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f) + +#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \ + (uintmax_t )tcpstat.f2, plural(tcpstat.f2)) + +#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \ + (uintmax_t )tcpstat.f2) + +#define p3(f, m) if (tcpstat.f || sflag <= 1) \ + printf(m, (uintmax_t )tcpstat.f, pluralies(tcpstat.f)) + + p(tcps_sndtotal, "\t%ju packet%s sent\n"); + p2(tcps_sndpack,tcps_sndbyte, "\t\t%ju data packet%s (%ju byte%s)\n"); p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, - "\t\t%lu data packet%s (%lu byte%s) retransmitted\n"); + "\t\t%ju data packet%s (%ju byte%s) retransmitted\n"); p(tcps_sndrexmitbad, - "\t\t%lu data packet%s unnecessarily retransmitted\n"); - p(tcps_mturesent, "\t\t%lu resend%s initiated by MTU discovery\n"); + "\t\t%ju data packet%s unnecessarily retransmitted\n"); + p(tcps_mturesent, "\t\t%ju resend%s initiated by MTU discovery\n"); p2a(tcps_sndacks, tcps_delack, - "\t\t%lu ack-only packet%s (%lu delayed)\n"); - p(tcps_sndurg, "\t\t%lu URG only packet%s\n"); - p(tcps_sndprobe, "\t\t%lu window probe packet%s\n"); - p(tcps_sndwinup, "\t\t%lu window update packet%s\n"); - p(tcps_sndctrl, "\t\t%lu control packet%s\n"); - p(tcps_rcvtotal, "\t%lu packet%s received\n"); + "\t\t%ju ack-only packet%s (%ju delayed)\n"); + p(tcps_sndurg, "\t\t%ju URG only packet%s\n"); + p(tcps_sndprobe, "\t\t%ju window probe packet%s\n"); + p(tcps_sndwinup, "\t\t%ju window update packet%s\n"); + p(tcps_sndctrl, "\t\t%ju control packet%s\n"); + p(tcps_rcvtotal, "\t%ju packet%s received\n"); p2(tcps_rcvackpack, tcps_rcvackbyte, - "\t\t%lu ack%s (for %lu byte%s)\n"); - p(tcps_rcvdupack, "\t\t%lu duplicate ack%s\n"); - p(tcps_rcvacktoomuch, "\t\t%lu ack%s for unsent data\n"); + "\t\t%ju ack%s (for %ju byte%s)\n"); + p(tcps_rcvdupack, "\t\t%ju duplicate ack%s\n"); + p(tcps_rcvacktoomuch, "\t\t%ju ack%s for unsent data\n"); p2(tcps_rcvpack, tcps_rcvbyte, - "\t\t%lu packet%s (%lu byte%s) received in-sequence\n"); + "\t\t%ju packet%s (%ju byte%s) received in-sequence\n"); p2(tcps_rcvduppack, tcps_rcvdupbyte, - "\t\t%lu completely duplicate packet%s (%lu byte%s)\n"); - p(tcps_pawsdrop, "\t\t%lu old duplicate packet%s\n"); + "\t\t%ju completely duplicate packet%s (%ju byte%s)\n"); + p(tcps_pawsdrop, "\t\t%ju old duplicate packet%s\n"); p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, - "\t\t%lu packet%s with some dup. data (%lu byte%s duped)\n"); + "\t\t%ju packet%s with some dup. data (%ju byte%s duped)\n"); p2(tcps_rcvoopack, tcps_rcvoobyte, - "\t\t%lu out-of-order packet%s (%lu byte%s)\n"); + "\t\t%ju out-of-order packet%s (%ju byte%s)\n"); p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, - "\t\t%lu packet%s (%lu byte%s) of data after window\n"); - p(tcps_rcvwinprobe, "\t\t%lu window probe%s\n"); - p(tcps_rcvwinupd, "\t\t%lu window update packet%s\n"); - p(tcps_rcvafterclose, "\t\t%lu packet%s received after close\n"); - p(tcps_rcvbadsum, "\t\t%lu discarded for bad checksum%s\n"); - p(tcps_rcvbadoff, "\t\t%lu discarded for bad header offset field%s\n"); - p1a(tcps_rcvshort, "\t\t%lu discarded because packet too short\n"); - p1a(tcps_rcvmemdrop, "\t\t%lu discarded due to memory problems\n"); - p(tcps_connattempt, "\t%lu connection request%s\n"); - p(tcps_accepts, "\t%lu connection accept%s\n"); - p(tcps_badsyn, "\t%lu bad connection attempt%s\n"); - p(tcps_listendrop, "\t%lu listen queue overflow%s\n"); - p(tcps_badrst, "\t%lu ignored RSTs in the window%s\n"); - p(tcps_connects, "\t%lu connection%s established (including accepts)\n"); + "\t\t%ju packet%s (%ju byte%s) of data after window\n"); + p(tcps_rcvwinprobe, "\t\t%ju window probe%s\n"); + p(tcps_rcvwinupd, "\t\t%ju window update packet%s\n"); + p(tcps_rcvafterclose, "\t\t%ju packet%s received after close\n"); + p(tcps_rcvbadsum, "\t\t%ju discarded for bad checksum%s\n"); + p(tcps_rcvbadoff, "\t\t%ju discarded for bad header offset field%s\n"); + p1a(tcps_rcvshort, "\t\t%ju discarded because packet too short\n"); + p1a(tcps_rcvmemdrop, "\t\t%ju discarded due to memory problems\n"); + p(tcps_connattempt, "\t%ju connection request%s\n"); + p(tcps_accepts, "\t%ju connection accept%s\n"); + p(tcps_badsyn, "\t%ju bad connection attempt%s\n"); + p(tcps_listendrop, "\t%ju listen queue overflow%s\n"); + p(tcps_badrst, "\t%ju ignored RSTs in the window%s\n"); + p(tcps_connects, "\t%ju connection%s established (including accepts)\n"); p2(tcps_closed, tcps_drops, - "\t%lu connection%s closed (including %lu drop%s)\n"); - p(tcps_cachedrtt, "\t\t%lu connection%s updated cached RTT on close\n"); + "\t%ju connection%s closed (including %ju drop%s)\n"); + p(tcps_cachedrtt, "\t\t%ju connection%s updated cached RTT on close\n"); p(tcps_cachedrttvar, - "\t\t%lu connection%s updated cached RTT variance on close\n"); + "\t\t%ju connection%s updated cached RTT variance on close\n"); p(tcps_cachedssthresh, - "\t\t%lu connection%s updated cached ssthresh on close\n"); - p(tcps_conndrops, "\t%lu embryonic connection%s dropped\n"); + "\t\t%ju connection%s updated cached ssthresh on close\n"); + p(tcps_conndrops, "\t%ju embryonic connection%s dropped\n"); p2(tcps_rttupdated, tcps_segstimed, - "\t%lu segment%s updated rtt (of %lu attempt%s)\n"); - p(tcps_rexmttimeo, "\t%lu retransmit timeout%s\n"); - p(tcps_timeoutdrop, "\t\t%lu connection%s dropped by rexmit timeout\n"); - p(tcps_persisttimeo, "\t%lu persist timeout%s\n"); - p(tcps_persistdrop, "\t\t%lu connection%s dropped by persist timeout\n"); + "\t%ju segment%s updated rtt (of %ju attempt%s)\n"); + p(tcps_rexmttimeo, "\t%ju retransmit timeout%s\n"); + p(tcps_timeoutdrop, "\t\t%ju connection%s dropped by rexmit timeout\n"); + p(tcps_persisttimeo, "\t%ju persist timeout%s\n"); + p(tcps_persistdrop, "\t\t%ju connection%s dropped by persist timeout\n"); p(tcps_finwait2_drops, - "\t%lu Connection%s (fin_wait_2) dropped because of timeout\n"); - p(tcps_keeptimeo, "\t%lu keepalive timeout%s\n"); - p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n"); - p(tcps_keepdrops, "\t\t%lu connection%s dropped by keepalive\n"); - p(tcps_predack, "\t%lu correct ACK header prediction%s\n"); - p(tcps_preddat, "\t%lu correct data packet header prediction%s\n"); - - p3(tcps_sc_added, "\t%lu syncache entr%s added\n"); - p1a(tcps_sc_retransmitted, "\t\t%lu retransmitted\n"); - p1a(tcps_sc_dupsyn, "\t\t%lu dupsyn\n"); - p1a(tcps_sc_dropped, "\t\t%lu dropped\n"); - p1a(tcps_sc_completed, "\t\t%lu completed\n"); - p1a(tcps_sc_bucketoverflow, "\t\t%lu bucket overflow\n"); - p1a(tcps_sc_cacheoverflow, "\t\t%lu cache overflow\n"); - p1a(tcps_sc_reset, "\t\t%lu reset\n"); - p1a(tcps_sc_stale, "\t\t%lu stale\n"); - p1a(tcps_sc_aborted, "\t\t%lu aborted\n"); - p1a(tcps_sc_badack, "\t\t%lu badack\n"); - p1a(tcps_sc_unreach, "\t\t%lu unreach\n"); - p(tcps_sc_zonefail, "\t\t%lu zone failure%s\n"); - p(tcps_sc_sendcookie, "\t%lu cookie%s sent\n"); - p(tcps_sc_recvcookie, "\t%lu cookie%s received\n"); + "\t%ju Connection%s (fin_wait_2) dropped because of timeout\n"); + p(tcps_keeptimeo, "\t%ju keepalive timeout%s\n"); + p(tcps_keepprobe, "\t\t%ju keepalive probe%s sent\n"); + p(tcps_keepdrops, "\t\t%ju connection%s dropped by keepalive\n"); + p(tcps_predack, "\t%ju correct ACK header prediction%s\n"); + p(tcps_preddat, "\t%ju correct data packet header prediction%s\n"); + + p3(tcps_sc_added, "\t%ju syncache entr%s added\n"); + p1a(tcps_sc_retransmitted, "\t\t%ju retransmitted\n"); + p1a(tcps_sc_dupsyn, "\t\t%ju dupsyn\n"); + p1a(tcps_sc_dropped, "\t\t%ju dropped\n"); + p1a(tcps_sc_completed, "\t\t%ju completed\n"); + p1a(tcps_sc_bucketoverflow, "\t\t%ju bucket overflow\n"); + p1a(tcps_sc_cacheoverflow, "\t\t%ju cache overflow\n"); + p1a(tcps_sc_reset, "\t\t%ju reset\n"); + p1a(tcps_sc_stale, "\t\t%ju stale\n"); + p1a(tcps_sc_aborted, "\t\t%ju aborted\n"); + p1a(tcps_sc_badack, "\t\t%ju badack\n"); + p1a(tcps_sc_unreach, "\t\t%ju unreach\n"); + p(tcps_sc_zonefail, "\t\t%ju zone failure%s\n"); + p(tcps_sc_sendcookie, "\t%ju cookie%s sent\n"); + p(tcps_sc_recvcookie, "\t%ju cookie%s received\n"); - p3(tcps_hc_added, "\t%lu hostcache entr%s added\n"); - p1a(tcps_hc_bucketoverflow, "\t\t%lu bucket overflow\n"); + p3(tcps_hc_added, "\t%ju hostcache entr%s added\n"); + p1a(tcps_hc_bucketoverflow, "\t\t%ju bucket overflow\n"); - p(tcps_sack_recovery_episode, "\t%lu SACK recovery episode%s\n"); + p(tcps_sack_recovery_episode, "\t%ju SACK recovery episode%s\n"); p(tcps_sack_rexmits, - "\t%lu segment rexmit%s in SACK recovery episodes\n"); + "\t%ju segment rexmit%s in SACK recovery episodes\n"); p(tcps_sack_rexmit_bytes, - "\t%lu byte rexmit%s in SACK recovery episodes\n"); + "\t%ju byte rexmit%s in SACK recovery episodes\n"); p(tcps_sack_rcv_blocks, - "\t%lu SACK option%s (SACK blocks) received\n"); - p(tcps_sack_send_blocks, "\t%lu SACK option%s (SACK blocks) sent\n"); - p1a(tcps_sack_sboverflow, "\t%lu SACK scoreboard overflow\n"); - - p(tcps_ecn_ce, "\t%lu packet%s with ECN CE bit set\n"); - p(tcps_ecn_ect0, "\t%lu packet%s with ECN ECT(0) bit set\n"); - p(tcps_ecn_ect1, "\t%lu packet%s with ECN ECT(1) bit set\n"); - p(tcps_ecn_shs, "\t%lu successful ECN handshake%s\n"); - p(tcps_ecn_rcwnd, "\t%lu time%s ECN reduced the congestion window\n"); + "\t%ju SACK option%s (SACK blocks) received\n"); + p(tcps_sack_send_blocks, "\t%ju SACK option%s (SACK blocks) sent\n"); + p1a(tcps_sack_sboverflow, "\t%ju SACK scoreboard overflow\n"); + + p(tcps_ecn_ce, "\t%ju packet%s with ECN CE bit set\n"); + p(tcps_ecn_ect0, "\t%ju packet%s with ECN ECT(0) bit set\n"); + p(tcps_ecn_ect1, "\t%ju packet%s with ECN ECT(1) bit set\n"); + p(tcps_ecn_shs, "\t%ju successful ECN handshake%s\n"); + p(tcps_ecn_rcwnd, "\t%ju time%s ECN reduced the congestion window\n"); #undef p #undef p1a #undef p2 @@ -858,43 +864,43 @@ ip_stats(u_long off, const char *name, i printf("%s:\n", name); #define p(f, m) if (ipstat.f || sflag <= 1) \ - printf(m, ipstat.f, plural(ipstat.f)) + printf(m, (uintmax_t )ipstat.f, plural(ipstat.f)) #define p1a(f, m) if (ipstat.f || sflag <= 1) \ - printf(m, ipstat.f) + printf(m, (uintmax_t )ipstat.f) - p(ips_total, "\t%lu total packet%s received\n"); - p(ips_badsum, "\t%lu bad header checksum%s\n"); - p1a(ips_toosmall, "\t%lu with size smaller than minimum\n"); - p1a(ips_tooshort, "\t%lu with data size < data length\n"); - p1a(ips_toolong, "\t%lu with ip length > max ip packet size\n"); - p1a(ips_badhlen, "\t%lu with header length < data size\n"); - p1a(ips_badlen, "\t%lu with data length < header length\n"); - p1a(ips_badoptions, "\t%lu with bad options\n"); - p1a(ips_badvers, "\t%lu with incorrect version number\n"); - p(ips_fragments, "\t%lu fragment%s received\n"); - p(ips_fragdropped, "\t%lu fragment%s dropped (dup or out of space)\n"); - p(ips_fragtimeout, "\t%lu fragment%s dropped after timeout\n"); - p(ips_reassembled, "\t%lu packet%s reassembled ok\n"); - p(ips_delivered, "\t%lu packet%s for this host\n"); - p(ips_noproto, "\t%lu packet%s for unknown/unsupported protocol\n"); - p(ips_forward, "\t%lu packet%s forwarded"); - p(ips_fastforward, " (%lu packet%s fast forwarded)"); + p(ips_total, "\t%ju total packet%s received\n"); + p(ips_badsum, "\t%ju bad header checksum%s\n"); + p1a(ips_toosmall, "\t%ju with size smaller than minimum\n"); + p1a(ips_tooshort, "\t%ju with data size < data length\n"); + p1a(ips_toolong, "\t%ju with ip length > max ip packet size\n"); + p1a(ips_badhlen, "\t%ju with header length < data size\n"); + p1a(ips_badlen, "\t%ju with data length < header length\n"); + p1a(ips_badoptions, "\t%ju with bad options\n"); + p1a(ips_badvers, "\t%ju with incorrect version number\n"); + p(ips_fragments, "\t%ju fragment%s received\n"); + p(ips_fragdropped, "\t%ju fragment%s dropped (dup or out of space)\n"); + p(ips_fragtimeout, "\t%ju fragment%s dropped after timeout\n"); + p(ips_reassembled, "\t%ju packet%s reassembled ok\n"); + p(ips_delivered, "\t%ju packet%s for this host\n"); + p(ips_noproto, "\t%ju packet%s for unknown/unsupported protocol\n"); + p(ips_forward, "\t%ju packet%s forwarded"); + p(ips_fastforward, " (%ju packet%s fast forwarded)"); if (ipstat.ips_forward || sflag <= 1) putchar('\n'); - p(ips_cantforward, "\t%lu packet%s not forwardable\n"); + p(ips_cantforward, "\t%ju packet%s not forwardable\n"); p(ips_notmember, - "\t%lu packet%s received for unknown multicast group\n"); - p(ips_redirectsent, "\t%lu redirect%s sent\n"); - p(ips_localout, "\t%lu packet%s sent from this host\n"); - p(ips_rawout, "\t%lu packet%s sent with fabricated ip header\n"); + "\t%ju packet%s received for unknown multicast group\n"); + p(ips_redirectsent, "\t%ju redirect%s sent\n"); + p(ips_localout, "\t%ju packet%s sent from this host\n"); + p(ips_rawout, "\t%ju packet%s sent with fabricated ip header\n"); p(ips_odropped, - "\t%lu output packet%s dropped due to no bufs, etc.\n"); - p(ips_noroute, "\t%lu output packet%s discarded due to no route\n"); - p(ips_fragmented, "\t%lu output datagram%s fragmented\n"); - p(ips_ofragments, "\t%lu fragment%s created\n"); - p(ips_cantfrag, "\t%lu datagram%s that can't be fragmented\n"); - p(ips_nogif, "\t%lu tunneling packet%s that can't find gif\n"); - p(ips_badaddr, "\t%lu datagram%s with bad address in header\n"); + "\t%ju output packet%s dropped due to no bufs, etc.\n"); + p(ips_noroute, "\t%ju output packet%s discarded due to no route\n"); + p(ips_fragmented, "\t%ju output datagram%s fragmented\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Apr 8 21:51:31 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D338FA48; Mon, 8 Apr 2013 21:51:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C52BCE4D; Mon, 8 Apr 2013 21:51:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r38LpVBg036350; Mon, 8 Apr 2013 21:51:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r38LpU32036343; Mon, 8 Apr 2013 21:51:30 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304082151.r38LpU32036343@svn.freebsd.org> From: Attilio Rao Date: Mon, 8 Apr 2013 21:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249285 - in user/attilio/vmobj-readlock/sys: powerpc/aim powerpc/booke sparc64/sparc64 vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2013 21:51:31 -0000 Author: attilio Date: Mon Apr 8 21:51:30 2013 New Revision: 249285 URL: http://svnweb.freebsd.org/changeset/base/249285 Log: Make vm_fault_prefault() acquire only read locks for vm_object. Sponsored by: EMC / Isilon storage division Submitted by: alc Modified: user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea.c user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea64.c user/attilio/vmobj-readlock/sys/powerpc/booke/pmap.c user/attilio/vmobj-readlock/sys/sparc64/sparc64/pmap.c user/attilio/vmobj-readlock/sys/vm/vm_fault.c Modified: user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea.c ============================================================================== --- user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea.c Mon Apr 8 21:15:43 2013 (r249284) +++ user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea.c Mon Apr 8 21:51:30 2013 (r249285) @@ -1149,7 +1149,7 @@ moea_enter_locked(pmap_t pmap, vm_offset rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0) - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_LOCKED(m->object); /* XXX change the pvo head for fake pages */ if ((m->oflags & VPO_UNMANAGED) != 0) { Modified: user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea64.c Mon Apr 8 21:15:43 2013 (r249284) +++ user/attilio/vmobj-readlock/sys/powerpc/aim/mmu_oea64.c Mon Apr 8 21:51:30 2013 (r249285) @@ -1261,7 +1261,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_ } if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0) - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_LOCKED(m->object); /* XXX change the pvo head for fake pages */ if ((m->oflags & VPO_UNMANAGED) != 0) { Modified: user/attilio/vmobj-readlock/sys/powerpc/booke/pmap.c ============================================================================== --- user/attilio/vmobj-readlock/sys/powerpc/booke/pmap.c Mon Apr 8 21:15:43 2013 (r249284) +++ user/attilio/vmobj-readlock/sys/powerpc/booke/pmap.c Mon Apr 8 21:51:30 2013 (r249285) @@ -1564,7 +1564,7 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t ("mmu_booke_enter_locked: user pmap, non user va")); } if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0) - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_LOCKED(m->object); PMAP_LOCK_ASSERT(pmap, MA_OWNED); Modified: user/attilio/vmobj-readlock/sys/sparc64/sparc64/pmap.c ============================================================================== --- user/attilio/vmobj-readlock/sys/sparc64/sparc64/pmap.c Mon Apr 8 21:15:43 2013 (r249284) +++ user/attilio/vmobj-readlock/sys/sparc64/sparc64/pmap.c Mon Apr 8 21:51:30 2013 (r249285) @@ -1495,7 +1495,7 @@ pmap_enter_locked(pmap_t pm, vm_offset_t rw_assert(&tte_list_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pm, MA_OWNED); if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0) - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_LOCKED(m->object); PMAP_STATS_INC(pmap_nenter); pa = VM_PAGE_TO_PHYS(m); Modified: user/attilio/vmobj-readlock/sys/vm/vm_fault.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_fault.c Mon Apr 8 21:15:43 2013 (r249284) +++ user/attilio/vmobj-readlock/sys/vm/vm_fault.c Mon Apr 8 21:51:30 2013 (r249285) @@ -1046,28 +1046,28 @@ vm_fault_prefault(pmap_t pmap, vm_offset pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; lobject = object; - VM_OBJECT_WLOCK(lobject); + VM_OBJECT_RLOCK(lobject); while ((m = vm_page_lookup(lobject, pindex)) == NULL && lobject->type == OBJT_DEFAULT && (backing_object = lobject->backing_object) != NULL) { KASSERT((lobject->backing_object_offset & PAGE_MASK) == 0, ("vm_fault_prefault: unaligned object offset")); pindex += lobject->backing_object_offset >> PAGE_SHIFT; - VM_OBJECT_WLOCK(backing_object); - VM_OBJECT_WUNLOCK(lobject); + VM_OBJECT_RLOCK(backing_object); + VM_OBJECT_RUNLOCK(lobject); lobject = backing_object; } /* * give-up when a page is not in memory */ if (m == NULL) { - VM_OBJECT_WUNLOCK(lobject); + VM_OBJECT_RUNLOCK(lobject); break; } if (m->valid == VM_PAGE_BITS_ALL && (m->flags & PG_FICTITIOUS) == 0) pmap_enter_quick(pmap, addr, m, entry->protection); - VM_OBJECT_WUNLOCK(lobject); + VM_OBJECT_RUNLOCK(lobject); } } From owner-svn-src-user@FreeBSD.ORG Tue Apr 9 08:24:35 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1205EEE5; Tue, 9 Apr 2013 08:24:35 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 05361900; Tue, 9 Apr 2013 08:24:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r398OYgR023190; Tue, 9 Apr 2013 08:24:34 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r398OY7j023189; Tue, 9 Apr 2013 08:24:34 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304090824.r398OY7j023189@svn.freebsd.org> From: Peter Holm Date: Tue, 9 Apr 2013 08:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249295 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 08:24:35 -0000 Author: pho Date: Tue Apr 9 08:24:34 2013 New Revision: 249295 URL: http://svnweb.freebsd.org/changeset/base/249295 Log: Fix type and do not test as root. Modified: user/pho/stress2/misc/nfs5.sh Modified: user/pho/stress2/misc/nfs5.sh ============================================================================== --- user/pho/stress2/misc/nfs5.sh Tue Apr 9 07:11:22 2013 (r249294) +++ user/pho/stress2/misc/nfs5.sh Tue Apr 9 08:24:34 2013 (r249295) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008-2011 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,6 @@ # $FreeBSD$ # - . ../default.cfg [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 @@ -43,7 +42,7 @@ mdconfig -l | grep -q ${mdstart} && md mdconfig -a -t vnode -f $D -u $mdstart bsdlabel -w md${mdstart} auto -newfs -U md${mdstart}${part} +newfs -U md${mdstart}${part} > /dev/null mount /dev/md${mdstart}${part} $mntpoint mkdir ${mntpoint}/stressX @@ -52,11 +51,11 @@ chmod 777 ${mntpoint}/stressX [ ! -d ${mntpoint}2 ] && mkdir ${mntpoint}2 chmod 777 ${mntpoint}2 -mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:/$mntpoint $mntpoint2 +mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:/$mntpoint ${mntpoint}2 export RUNDIR=${mntpoint}2/stressX export runRUNTIME=4m -(cd ..; ./run.sh disk.cfg) & +su $testuser -c "(cd ..; ./run.sh disk.cfg > /dev/null 2>&1)" & sleep 60 umount -f $mntpoint > /dev/null 2>&1 From owner-svn-src-user@FreeBSD.ORG Tue Apr 9 08:25:32 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 46FC277; Tue, 9 Apr 2013 08:25:32 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3934090C; Tue, 9 Apr 2013 08:25:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r398PWVX023361; Tue, 9 Apr 2013 08:25:32 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r398PWYX023360; Tue, 9 Apr 2013 08:25:32 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304090825.r398PWYX023360@svn.freebsd.org> From: Peter Holm Date: Tue, 9 Apr 2013 08:25:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249296 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 08:25:32 -0000 Author: pho Date: Tue Apr 9 08:25:31 2013 New Revision: 249296 URL: http://svnweb.freebsd.org/changeset/base/249296 Log: Silence newfs and do not run as root. Modified: user/pho/stress2/misc/nfs6.sh Modified: user/pho/stress2/misc/nfs6.sh ============================================================================== --- user/pho/stress2/misc/nfs6.sh Tue Apr 9 08:24:34 2013 (r249295) +++ user/pho/stress2/misc/nfs6.sh Tue Apr 9 08:25:31 2013 (r249296) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008-2011 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -44,7 +44,7 @@ mdconfig -l | grep -q ${mdstart} && md mdconfig -a -t vnode -f $D -u $mdstart bsdlabel -w md${mdstart} auto -newfs -U md${mdstart}${part} +newfs -U md${mdstart}${part} > /dev/null mount /dev/md${mdstart}${part} $mntpoint mkdir ${mntpoint}/stressX @@ -57,7 +57,7 @@ mount -t nfs -o tcp -o retrycnt=3 -o int export RUNDIR=${mntpoint}2/stressX export runRUNTIME=4m -(cd ..; ./run.sh disk.cfg) & +su $testuser -c "(cd ..; ./run.sh disk.cfg > /dev/null 2>&1)" & sleep 60 for i in `jot 10`; do From owner-svn-src-user@FreeBSD.ORG Tue Apr 9 08:26:25 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 15AB71BC; Tue, 9 Apr 2013 08:26:25 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09584914; Tue, 9 Apr 2013 08:26:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r398QOoL023517; Tue, 9 Apr 2013 08:26:24 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r398QOWK023516; Tue, 9 Apr 2013 08:26:24 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304090826.r398QOWK023516@svn.freebsd.org> From: Peter Holm Date: Tue, 9 Apr 2013 08:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249297 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 08:26:25 -0000 Author: pho Date: Tue Apr 9 08:26:24 2013 New Revision: 249297 URL: http://svnweb.freebsd.org/changeset/base/249297 Log: Do not run tests as root. Modified: user/pho/stress2/misc/nfs7.sh Modified: user/pho/stress2/misc/nfs7.sh ============================================================================== --- user/pho/stress2/misc/nfs7.sh Tue Apr 9 08:25:31 2013 (r249296) +++ user/pho/stress2/misc/nfs7.sh Tue Apr 9 08:26:24 2013 (r249297) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2009 Peter Holm +# Copyright (c) 2009-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -37,17 +37,16 @@ [ ! -d $mntpoint ] && mkdir $mntpoint mount | grep "$mntpoint" | grep nfs > /dev/null && umount $mntpoint mount -t nfs -o nfsv3,tcp,nolockd -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:/tmp $mntpoint -rm -rf $mntpoint/stressX/* rm -rf /tmp/stressX.control export RUNDIR=$mntpoint/nfs/stressX -[ ! -d $RUNDIR ] && mkdir -p $RUNDIR +rm -rf $RUNDIR +mkdir -p $RUNDIR +chmod 777 $RUNDIR export runRUNTIME=10m rm -rf /tmp/stressX.control/* -cd .. -./run.sh marcus.cfg -cd - +su $testuser -c "(cd ..; ./run.sh marcus.cfg)" umount $mntpoint while mount | grep -q $mntpoint; do From owner-svn-src-user@FreeBSD.ORG Tue Apr 9 08:27:16 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2F20D2DB; Tue, 9 Apr 2013 08:27:16 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2088591A; Tue, 9 Apr 2013 08:27:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r398RGDG023662; Tue, 9 Apr 2013 08:27:16 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r398RGXk023661; Tue, 9 Apr 2013 08:27:16 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304090827.r398RGXk023661@svn.freebsd.org> From: Peter Holm Date: Tue, 9 Apr 2013 08:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249298 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 08:27:16 -0000 Author: pho Date: Tue Apr 9 08:27:15 2013 New Revision: 249298 URL: http://svnweb.freebsd.org/changeset/base/249298 Log: Remove empty line and commented out lines. Modified: user/pho/stress2/misc/nfsrename.sh Modified: user/pho/stress2/misc/nfsrename.sh ============================================================================== --- user/pho/stress2/misc/nfsrename.sh Tue Apr 9 08:26:24 2013 (r249297) +++ user/pho/stress2/misc/nfsrename.sh Tue Apr 9 08:27:15 2013 (r249298) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008-2011 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -45,11 +45,6 @@ cd $odir mount | grep "$mntpoint" | grep nfs > /dev/null && umount $mntpoint mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:/tmp $mntpoint - -#export RUNDIR=$mntpoint/stressX -#export runRUNTIME=2m -#(cd /home/pho/stress2; ./run.sh disk.cfg) & - for i in `jot 10`; do /tmp/nfsrename $mntpoint/nfsrename.$i & done From owner-svn-src-user@FreeBSD.ORG Tue Apr 9 08:29:27 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B473A404; Tue, 9 Apr 2013 08:29:27 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A6BCA926; Tue, 9 Apr 2013 08:29:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r398TRLo023965; Tue, 9 Apr 2013 08:29:27 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r398TR7j023964; Tue, 9 Apr 2013 08:29:27 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304090829.r398TR7j023964@svn.freebsd.org> From: Peter Holm Date: Tue, 9 Apr 2013 08:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249299 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 08:29:27 -0000 Author: pho Date: Tue Apr 9 08:29:27 2013 New Revision: 249299 URL: http://svnweb.freebsd.org/changeset/base/249299 Log: Do not run the tests as root. Modified: user/pho/stress2/misc/nfs9.sh Modified: user/pho/stress2/misc/nfs9.sh ============================================================================== --- user/pho/stress2/misc/nfs9.sh Tue Apr 9 08:27:15 2013 (r249298) +++ user/pho/stress2/misc/nfs9.sh Tue Apr 9 08:29:27 2013 (r249299) @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2008 Peter Holm +# Copyright (c) 2008-2013 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -41,17 +41,19 @@ [ ! -d $mntpoint ] && mkdir $mntpoint for i in `jot 10`; do - mount | grep "$mntpoint" | grep nfs > /dev/null && umount $mntpoint - mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:/tmp $mntpoint - rm -rf $mntpoint/stressX/* - rm -rf /tmp/stressX.control - - export RUNDIR=$mntpoint/nfs/stressX - [ ! -d $RUNDIR ] && mkdir -p $RUNDIR + mount | grep "on $mntpoint " | grep -q nfs && umount $mntpoint + mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft \ + -o rw 127.0.0.1:/tmp $mntpoint + + sleep .5 + export RUNDIR=$mntpoint/nfs9/stressX + rm -rf $RUNDIR + mkdir -p $RUNDIR + chmod 777 $RUNDIR export runRUNTIME=3m rm -rf /tmp/stressX.control/* - (cd ..; ./run.sh all.cfg) & + su $testuser -c '(cd ..; ./run.sh all.cfg) > /dev/null 2>&1' & sleep 60 while mount | grep -q $mntpoint; do @@ -60,3 +62,4 @@ for i in `jot 10`; do kill -9 $! done ../tools/killall.sh +rm -rf /tmp/nfs9 From owner-svn-src-user@FreeBSD.ORG Tue Apr 9 08:30:27 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 97BF452B; Tue, 9 Apr 2013 08:30:27 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8B2CE92F; Tue, 9 Apr 2013 08:30:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r398URkE025606; Tue, 9 Apr 2013 08:30:27 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r398URWN025605; Tue, 9 Apr 2013 08:30:27 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304090830.r398URWN025605@svn.freebsd.org> From: Peter Holm Date: Tue, 9 Apr 2013 08:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249300 - user/pho/stress2/testcases/syscall X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 08:30:27 -0000 Author: pho Date: Tue Apr 9 08:30:27 2013 New Revision: 249300 URL: http://svnweb.freebsd.org/changeset/base/249300 Log: Make sure that this test is not run as root. Modified: user/pho/stress2/testcases/syscall/syscall.c Modified: user/pho/stress2/testcases/syscall/syscall.c ============================================================================== --- user/pho/stress2/testcases/syscall/syscall.c Tue Apr 9 08:29:27 2013 (r249299) +++ user/pho/stress2/testcases/syscall/syscall.c Tue Apr 9 08:30:27 2013 (r249300) @@ -70,6 +70,8 @@ setup(int nb __unused) int i; struct rlimit rl; + if (geteuid() == 0) + _exit(1); /* Do not run as root */ umask(0); sprintf(path,"%s.%05d", getprogname(), getpid()); (void)mkdir(path, 0770); From owner-svn-src-user@FreeBSD.ORG Tue Apr 9 08:42:10 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D1339882; Tue, 9 Apr 2013 08:42:10 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AA3AD9A1; Tue, 9 Apr 2013 08:42:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r398gAZZ028933; Tue, 9 Apr 2013 08:42:10 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r398gANe028932; Tue, 9 Apr 2013 08:42:10 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201304090842.r398gANe028932@svn.freebsd.org> From: Peter Holm Date: Tue, 9 Apr 2013 08:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249301 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 08:42:10 -0000 Author: pho Date: Tue Apr 9 08:42:10 2013 New Revision: 249301 URL: http://svnweb.freebsd.org/changeset/base/249301 Log: Add a TCP test scenario. Added: user/pho/stress2/misc/tcp.sh (contents, props changed) Added: user/pho/stress2/misc/tcp.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/tcp.sh Tue Apr 9 08:42:10 2013 (r249301) @@ -0,0 +1,63 @@ +#!/bin/sh + +# +# Copyright (c) 2013 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# "panic: tcp_do_segment: TCPS_LISTEN" seen: +# http://people.freebsd.org/~pho/stress/log/tcp.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart + +mdconfig -a -t swap -s 1g -u $mdstart || exit 1 +bsdlabel -w md$mdstart auto +newfs -U md${mdstart}$part > /dev/null +mount /dev/md${mdstart}$part $mntpoint +chmod 777 $mntpoint + +rm -rf /tmp/stressX.control +export RUNDIR=$mntpoint/stressX +[ ! -d $RUNDIR ] && mkdir -p $RUNDIR +chmod 777 $RUNDIR +export runRUNTIME=15m +export tcpLOAD=100 +n=`su $testuser -c "limits | grep maxprocesses | awk '{print \\$NF}'"` +n=$((n / 2 - 10)) +export tcpINCARNATIONS=$n +export TESTPROGS=" ./testcases/tcp/tcp" + +su $testuser -c '(cd ..; ./testcases/run/run $TESTPROGS)' + +while mount | grep "on $mntpoint " | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done +mdconfig -d -u $mdstart From owner-svn-src-user@FreeBSD.ORG Wed Apr 10 06:21:40 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1818CA8B; Wed, 10 Apr 2013 06:21:40 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09A286C8; Wed, 10 Apr 2013 06:21:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3A6LeNb012144; Wed, 10 Apr 2013 06:21:40 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3A6LdbS012136; Wed, 10 Apr 2013 06:21:39 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201304100621.r3A6LdbS012136@svn.freebsd.org> From: Bryan Venteicher Date: Wed, 10 Apr 2013 06:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249325 - user/bryanv/vtnetmq/sys/dev/virtio/network X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2013 06:21:40 -0000 Author: bryanv Date: Wed Apr 10 06:21:39 2013 New Revision: 249325 URL: http://svnweb.freebsd.org/changeset/base/249325 Log: Commit development snapshot of the multiqueue driver This commit includes various (mostly minor) changes: - Support for instance specific and global tunables - Fix a swap argument bug that broke TSO - Initial support for the VIRTIO_NET_F_CTRL_MAC_ADDR feature - Shuffle some structure around to be more cache line friendly Modified: user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnet.c user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnetvar.h user/bryanv/vtnetmq/sys/dev/virtio/network/virtio_net.h Modified: user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnet.c Wed Apr 10 05:59:07 2013 (r249324) +++ user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnet.c Wed Apr 10 06:21:39 2013 (r249325) @@ -175,6 +175,7 @@ static void vtnet_init(void *); static void vtnet_free_ctrl_vq(struct vtnet_softc *); static void vtnet_exec_ctrl_cmd(struct vtnet_softc *, void *, struct sglist *, int, int); +static int vtnet_ctrl_mac_cmd(struct vtnet_softc *, uint8_t *); static int vtnet_ctrl_mq_cmd(struct vtnet_softc *, uint16_t); static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, int, int); static int vtnet_set_promisc(struct vtnet_softc *, int); @@ -214,6 +215,8 @@ static void vtnet_disable_rx_interrupts( static void vtnet_disable_tx_interrupts(struct vtnet_softc *); static void vtnet_disable_interrupts(struct vtnet_softc *); +static int vtnet_tunable_int(struct vtnet_softc *, const char *, int); + /* Tunables. */ static int vtnet_csum_disable = 0; TUNABLE_INT("hw.vtnet.csum_disable", &vtnet_csum_disable); @@ -222,10 +225,10 @@ TUNABLE_INT("hw.vtnet.tso_disable", &vtn static int vtnet_lro_disable = 0; TUNABLE_INT("hw.vtnet.lro_disable", &vtnet_lro_disable); static int vtnet_mq_disable = 0; -TUNABLE_INT("hw.vtnet.mq_dislabe", &vtnet_mq_disable); -static int vtnet_mq_max_queues = 0; -TUNABLE_INT("hw.vtnet.mq_max_queues", &vtnet_mq_max_queues); -static int vtnet_rx_process_limit = 256; +TUNABLE_INT("hw.vtnet.mq_disable", &vtnet_mq_disable); +static int vtnet_mq_max_pairs = 0; +TUNABLE_INT("hw.vtnet.mq_max_pairs", &vtnet_mq_max_pairs); +static int vtnet_rx_process_limit = 512; TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit); /* @@ -519,13 +522,15 @@ vtnet_negotiate_features(struct vtnet_so * TSO and LRO are only available when their corresponding checksum * offload feature is also negotiated. */ - if (vtnet_csum_disable) + if (vtnet_tunable_int(sc, "csum_disable", vtnet_csum_disable)) { mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM; - if (vtnet_csum_disable || vtnet_tso_disable) + mask |= VTNET_TSO_FEATURES | VTNET_LRO_FEATURES; + } + if (vtnet_tunable_int(sc, "tso_disable", vtnet_tso_disable)) mask |= VTNET_TSO_FEATURES; - if (vtnet_csum_disable || vtnet_lro_disable) + if (vtnet_tunable_int(sc, "lro_disable", vtnet_lro_disable)) mask |= VTNET_LRO_FEATURES; - if (vtnet_mq_disable) + if (vtnet_tunable_int(sc, "mq_disable", vtnet_mq_disable)) mask |= VIRTIO_NET_F_MQ; features = VTNET_FEATURES & ~mask; @@ -559,12 +564,17 @@ static void vtnet_setup_features(struct vtnet_softc *sc) { device_t dev; - int max_pairs; + int max_pairs, max; dev = sc->vtnet_dev; vtnet_negotiate_features(sc); + if (virtio_with_feature(dev, VIRTIO_NET_F_MAC)) { + /* This feature should always be negotiated. */ + sc->vtnet_flags |= VTNET_FLAG_MAC; + } + if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) { sc->vtnet_flags |= VTNET_FLAG_MRG_RXBUFS; sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf); @@ -578,6 +588,8 @@ vtnet_setup_features(struct vtnet_softc sc->vtnet_flags |= VTNET_FLAG_CTRL_RX; if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_VLAN)) sc->vtnet_flags |= VTNET_FLAG_VLAN_FILTER; + if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_MAC_ADDR)) + sc->vtnet_flags |= VTNET_FLAG_CTRL_MAC; } if (virtio_with_feature(dev, VIRTIO_NET_F_MQ) && @@ -592,16 +604,17 @@ vtnet_setup_features(struct vtnet_softc if (max_pairs > 1) { /* - * Limit the maximum number of queue pairs to the number - * of CPUs or the configured maximum. The actual number - * of queues that get used may be less. + * Limit the maximum number of queue pairs to the number of + * CPUs or the configured maximum. The actual number of + * queues that get used may be less. */ + max = vtnet_tunable_int(sc, "mq_max_pairs", vtnet_mq_max_pairs); + if (max > 0 && max_pairs > max) + max_pairs = max; if (max_pairs > mp_ncpus) max_pairs = mp_ncpus; if (max_pairs > VTNET_MAX_QUEUE_PAIRS) max_pairs = VTNET_MAX_QUEUE_PAIRS; - if (vtnet_mq_max_queues != 0) - max_pairs = vtnet_mq_max_queues; if (max_pairs > 1) sc->vtnet_flags |= VTNET_FLAG_MULTIQ; } @@ -622,7 +635,6 @@ vtnet_init_rxq(struct vtnet_softc *sc, i rxq->vtnrx_sc = sc; rxq->vtnrx_id = id; - rxq->vtnrx_process_limit = vtnet_rx_process_limit; TASK_INIT(&rxq->vtnrx_intrtask, 0, vtnet_rxq_tq_intr, rxq); rxq->vtnrx_tq = taskqueue_create(rxq->vtnrx_name, M_NOWAIT, @@ -708,10 +720,12 @@ vtnet_destroy_txq(struct vtnet_txq *txq) txq->vtntx_sc = NULL; txq->vtntx_id = -1; +#ifndef VTNET_LEGACY_TX if (txq->vtntx_br != NULL) { buf_ring_free(txq->vtntx_br, M_DEVBUF); txq->vtntx_br = NULL; } +#endif if (mtx_initialized(&txq->vtntx_mtx) != 0) mtx_destroy(&txq->vtntx_mtx); @@ -1035,35 +1049,15 @@ vtnet_ioctl(struct ifnet *ifp, u_long cm VTNET_CORE_LOCK(sc); mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if (mask & IFCAP_TXCSUM) { + if (mask & IFCAP_TXCSUM) ifp->if_capenable ^= IFCAP_TXCSUM; - if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist |= VTNET_CSUM_OFFLOAD; - else - ifp->if_hwassist &= ~VTNET_CSUM_OFFLOAD; - } - - if (mask & IFCAP_TXCSUM_IPV6) { + if (mask & IFCAP_TXCSUM_IPV6) ifp->if_capenable ^= IFCAP_TXCSUM_IPV6; - if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) - ifp->if_hwassist |= VTNET_CSUM_OFFLOAD_IPV6; - else - ifp->if_hwassist &= ~VTNET_CSUM_OFFLOAD_IPV6; - } - if (mask & IFCAP_TSO) { if (mask & IFCAP_TSO4) ifp->if_capenable ^= IFCAP_TSO4; if (mask & IFCAP_TSO6) ifp->if_capenable ^= IFCAP_TSO6; - /* - * Set if either is enabled. The CSUM_TSO_IPV6 flag is - * currently commented out. - */ - if (ifp->if_capenable & IFCAP_TSO) - ifp->if_hwassist |= CSUM_TSO; - else - ifp->if_hwassist &= ~CSUM_TSO; } if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO | @@ -1423,10 +1417,10 @@ vtnet_rxq_csum_by_offset(struct vtnet_rx } /* - * Use the offset to determine the appropriate CSUM_* flags. This - * is a bit dirty, but we can get by with it since the checksum - * offsets happen to be different. We assume the host host does - * not do IPv4 header checksum offloading. + * Use the offset to determine the appropriate CSUM_* flags. This is + * a bit dirty, but we can get by with it since the checksum offsets + * happen to be different. We assume the host host does not do IPv4 + * header checksum offloading. */ switch (hdr->csum_offset) { case offsetof(struct udphdr, uh_sum): @@ -1648,7 +1642,7 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, s m->m_flags |= M_FLOWID; /* - * BVM: FreeBSD does not have the UNNECESSARY and PARTIAL checksum + * BMV: FreeBSD does not have the UNNECESSARY and PARTIAL checksum * distinction that Linux does. Need to reevaluate if performing * offloading for the NEEDS_CSUM case is really appropriate. */ @@ -1686,7 +1680,7 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) hdr = &lhdr; deq = 0; - count = rxq->vtnrx_process_limit; + count = sc->vtnet_rx_process_limit; VTNET_RXQ_LOCK_ASSERT(rxq); @@ -1962,7 +1956,7 @@ vtnet_txq_offload(struct vtnet_txq *txq, sc = txq->vtntx_sc; flags = m->m_pkthdr.csum_flags; - error = vtnet_txq_offload_ctx(txq, m, &etype, &csum_start, &proto); + error = vtnet_txq_offload_ctx(txq, m, &etype, &proto, &csum_start); if (error) goto drop; @@ -2695,7 +2689,7 @@ vtnet_virtio_reinit(struct vtnet_softc * if (ifp->if_capabilities & _RXCSUM_IPV46) { /* * We require both IPv4 and IPv6 offloading to be enabled - * inorder to negotiated it: VirtIO does not distinguish + * in order to negotiated it: VirtIO does not distinguish * between the two. * * BMV: What about when INET and/or INET6 is not defined? @@ -2736,7 +2730,6 @@ vtnet_init_rx_filters(struct vtnet_softc vtnet_rx_filter_mac(sc); } - /* Restore filtered VLANs. */ if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) vtnet_rx_filter_vlan(sc); } @@ -2746,11 +2739,21 @@ vtnet_init_rx_queues(struct vtnet_softc { device_t dev; struct vtnet_rxq *rxq; - int i, clsize, error; + int i, limit, clsize, error; dev = sc->vtnet_dev; /* + * Assume the same limit is appropriate for all the Rx queues. + * We may later want to scale this by each virtqueue's size. + */ + limit = vtnet_tunable_int(sc, "rx_process_limit", + vtnet_rx_process_limit); + if (limit < 0) + limit = INT_MAX; + sc->vtnet_rx_process_limit = limit; + + /* * Use the new cluster size if one has been set (via a MTU * change). Otherwise, use the standard 2K clusters. * @@ -2974,6 +2977,32 @@ vtnet_exec_ctrl_cmd(struct vtnet_softc * } static int +vtnet_ctrl_mac_cmd(struct vtnet_softc *sc, uint8_t *hwaddr) +{ + struct virtio_net_ctrl_hdr hdr; + struct sglist_seg segs[3]; + struct sglist sg; + uint8_t ack; + int error; + + hdr.class = VIRTIO_NET_CTRL_MAC; + hdr.cmd = VIRTIO_NET_CTRL_MAC_ADDR_SET; + ack = VIRTIO_NET_ERR; + + sglist_init(&sg, 3, segs); + error = 0; + error |= sglist_append(&sg, &hdr, sizeof(struct virtio_net_ctrl_hdr)); + error |= sglist_append(&sg, hwaddr, ETHER_ADDR_LEN); + error |= sglist_append(&sg, &ack, sizeof(uint8_t)); + KASSERT(error == 0 && sg.sg_nseg == 3, + ("%s: error %d adding set MAC msg to sglist", __func__, error)); + + vtnet_exec_ctrl_cmd(sc, &ack, &sg, sg.sg_nseg - 1, 1); + + return (ack == VIRTIO_NET_OK ? 0 : EIO); +} + +static int vtnet_ctrl_mq_cmd(struct vtnet_softc *sc, uint16_t npairs) { struct sglist_seg segs[3]; @@ -2987,9 +3016,6 @@ vtnet_ctrl_mq_cmd(struct vtnet_softc *sc } s; int error; - if ((sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) == 0) - return (ENOTSUP); - s.hdr.class = VIRTIO_NET_CTRL_MQ; s.hdr.cmd = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET; s.mq.virtqueue_pairs = npairs; @@ -3204,12 +3230,10 @@ vtnet_rx_filter_mac(struct vtnet_softc * if_printf(ifp, "error setting host MAC filter table\n"); out: - if (promisc) - if (vtnet_set_promisc(sc, 1) != 0) - if_printf(ifp, "cannot enable promiscuous mode\n"); - if (allmulti) - if (vtnet_set_allmulti(sc, 1) != 0) - if_printf(ifp, "cannot enable all-multicast mode\n"); + if (promisc && vtnet_set_promisc(sc, 1) != 0) + if_printf(ifp, "cannot enable promiscuous mode\n"); + if (allmulti && vtnet_set_allmulti(sc, 1) != 0) + if_printf(ifp, "cannot enable all-multicast mode\n"); } static int @@ -3286,11 +3310,6 @@ vtnet_update_vlan_filter(struct vtnet_so VTNET_CORE_LOCK(sc); - /* - * Update the in-memory table. We must keep the table current with - * configured VLANs even if HW filtering is disabled, since it could - * be enabled later. - */ if (add) sc->vtnet_vlan_filter[idx] |= (1 << bit); else @@ -3407,8 +3426,14 @@ vtnet_set_hwaddr(struct vtnet_softc *sc) dev = sc->vtnet_dev; - virtio_write_device_config(dev, offsetof(struct virtio_net_config, mac), - sc->vtnet_hwaddr, ETHER_ADDR_LEN); + if (sc->vtnet_flags & VTNET_FLAG_CTRL_MAC) { + if (vtnet_ctrl_mac_cmd(sc, sc->vtnet_hwaddr) != 0) + device_printf(dev, "unable to set MAC address\n"); + } else if (sc->vtnet_flags & VTNET_FLAG_MAC) { + virtio_write_device_config(dev, + offsetof(struct virtio_net_config, mac), + sc->vtnet_hwaddr, ETHER_ADDR_LEN); + } } static void @@ -3418,7 +3443,7 @@ vtnet_get_hwaddr(struct vtnet_softc *sc) dev = sc->vtnet_dev; - if (virtio_with_feature(dev, VIRTIO_NET_F_MAC) == 0) { + if ((sc->vtnet_flags & VTNET_FLAG_MAC) == 0) { /* * Generate a random locally administered unicast address. * @@ -3707,3 +3732,15 @@ vtnet_disable_interrupts(struct vtnet_so vtnet_disable_rx_interrupts(sc); vtnet_disable_tx_interrupts(sc); } + +static int +vtnet_tunable_int(struct vtnet_softc *sc, const char *knob, int def) +{ + char path[64]; + + snprintf(path, sizeof(path), + "hw.vtnet.%d.%s", device_get_unit(sc->vtnet_dev), knob); + TUNABLE_INT_FETCH(path, &def); + + return (def); +} Modified: user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnetvar.h Wed Apr 10 05:59:07 2013 (r249324) +++ user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnetvar.h Wed Apr 10 06:21:39 2013 (r249325) @@ -100,7 +100,9 @@ struct vtnet_txq { struct mtx vtntx_mtx; struct vtnet_softc *vtntx_sc; struct virtqueue *vtntx_vq; +#ifndef VTNET_LEGACY_TX struct buf_ring *vtntx_br; +#endif int vtntx_id; int vtntx_watchdog; struct vtnet_txq_stats vtntx_stats; @@ -123,43 +125,45 @@ struct vtnet_txq { struct vtnet_softc { device_t vtnet_dev; struct ifnet *vtnet_ifp; - struct mtx vtnet_mtx; + struct vtnet_rxq *vtnet_rxqs; + struct vtnet_txq *vtnet_txqs; uint32_t vtnet_flags; #define VTNET_FLAG_SUSPENDED 0x0001 -#define VTNET_FLAG_CTRL_VQ 0x0002 -#define VTNET_FLAG_CTRL_RX 0x0004 -#define VTNET_FLAG_VLAN_FILTER 0x0008 -#define VTNET_FLAG_TSO_ECN 0x0010 -#define VTNET_FLAG_MRG_RXBUFS 0x0020 -#define VTNET_FLAG_LRO_NOMRG 0x0040 -#define VTNET_FLAG_MULTIQ 0x0080 - - struct vtnet_rxq *vtnet_rxqs; - struct vtnet_txq *vtnet_txqs; - struct virtqueue *vtnet_ctrl_vq; +#define VTNET_FLAG_MAC 0x0002 +#define VTNET_FLAG_CTRL_VQ 0x0004 +#define VTNET_FLAG_CTRL_RX 0x0008 +#define VTNET_FLAG_CTRL_MAC 0x0010 +#define VTNET_FLAG_VLAN_FILTER 0x0020 +#define VTNET_FLAG_TSO_ECN 0x0040 +#define VTNET_FLAG_MRG_RXBUFS 0x0080 +#define VTNET_FLAG_LRO_NOMRG 0x0100 +#define VTNET_FLAG_MULTIQ 0x0200 - int vtnet_hdr_size; int vtnet_link_active; + int vtnet_hdr_size; + int vtnet_rx_process_limit; int vtnet_rx_nmbufs; int vtnet_rx_clsize; int vtnet_rx_new_clsize; int vtnet_if_flags; int vtnet_act_vq_pairs; int vtnet_max_vq_pairs; - uint64_t vtnet_features; - - struct vtnet_statistics vtnet_stats; - struct callout vtnet_tick_ch; + struct virtqueue *vtnet_ctrl_vq; struct vtnet_mac_filter *vtnet_mac_filter; uint32_t *vtnet_vlan_filter; + + uint64_t vtnet_features; + struct vtnet_statistics vtnet_stats; + struct callout vtnet_tick_ch; struct ifmedia vtnet_media; eventhandler_tag vtnet_vlan_attach; eventhandler_tag vtnet_vlan_detach; - char vtnet_hwaddr[ETHER_ADDR_LEN]; + struct mtx vtnet_mtx; char vtnet_mtx_name[16]; + char vtnet_hwaddr[ETHER_ADDR_LEN]; }; /* @@ -181,8 +185,8 @@ struct vtnet_softc { #define VTNET_MEDIATYPE (IFM_ETHER | IFM_10G_T | IFM_FDX) /* - * Number of words to allocate for the VLAN shadow table. Each possible - * VLAN gets one bit. + * Number of words to allocate for the VLAN shadow table. There is one + * bit for each VLAN. */ #define VTNET_VLAN_FILTER_NWORDS (4096 / 32) @@ -263,7 +267,6 @@ CTASSERT(sizeof(struct vtnet_mac_filter) VIRTIO_NET_F_GUEST_TSO6 | \ VIRTIO_NET_F_GUEST_ECN | \ VIRTIO_NET_F_MRG_RXBUF | \ - VIRTIO_NET_F_MQ | \ VIRTIO_RING_F_INDIRECT_DESC) /* Modified: user/bryanv/vtnetmq/sys/dev/virtio/network/virtio_net.h ============================================================================== --- user/bryanv/vtnetmq/sys/dev/virtio/network/virtio_net.h Wed Apr 10 05:59:07 2013 (r249324) +++ user/bryanv/vtnetmq/sys/dev/virtio/network/virtio_net.h Wed Apr 10 06:21:39 2013 (r249325) @@ -51,7 +51,8 @@ #define VIRTIO_NET_F_CTRL_VLAN 0x80000 /* Control channel VLAN filtering */ #define VIRTIO_NET_F_CTRL_RX_EXTRA 0x100000 /* Extra RX mode control support */ #define VIRTIO_NET_F_GUEST_ANNOUNCE 0x200000 /* Announce device on network */ -#define VIRTIO_NET_F_MQ 0x400000 +#define VIRTIO_NET_F_MQ 0x400000 /* Device supports RFS */ +#define VIRTIO_NET_F_CTRL_MAC_ADDR 0x800000 /* Set MAC address */ #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ @@ -142,6 +143,10 @@ typedef uint8_t virtio_net_ctrl_ack; * first sg list contains unicast addresses, the second is for multicast. * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature * is available. + * + * The ADDR_SET command requests one out scatterlist, it contains a + * 6 bytes MAC address. This functionality is present if the + * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available. */ struct virtio_net_ctrl_mac { uint32_t entries; @@ -150,6 +155,7 @@ struct virtio_net_ctrl_mac { #define VIRTIO_NET_CTRL_MAC 1 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 +#define VIRTIO_NET_CTRL_MAC_ADDR_SET 1 /* * Control VLAN filtering From owner-svn-src-user@FreeBSD.ORG Thu Apr 11 14:02:19 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7633CC66; Thu, 11 Apr 2013 14:02:19 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 663FAD8D; Thu, 11 Apr 2013 14:02:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3BE2Jgr085924; Thu, 11 Apr 2013 14:02:19 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3BE2E8n085890; Thu, 11 Apr 2013 14:02:14 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304111402.r3BE2E8n085890@svn.freebsd.org> From: Attilio Rao Date: Thu, 11 Apr 2013 14:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249362 - in user/attilio/vmcontention: . cddl/contrib/opensolaris/lib/libzfs/common contrib/ldns contrib/ldns/ldns contrib/mtree gnu/usr.bin/groff/tmac include/protocols lib/libc/net l... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 14:02:19 -0000 Author: attilio Date: Thu Apr 11 14:02:14 2013 New Revision: 249362 URL: http://svnweb.freebsd.org/changeset/base/249362 Log: MFC Added: user/attilio/vmcontention/contrib/mtree/only.c - copied unchanged from r249361, head/contrib/mtree/only.c Modified: user/attilio/vmcontention/Makefile user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c user/attilio/vmcontention/contrib/ldns/README user/attilio/vmcontention/contrib/ldns/README.svn user/attilio/vmcontention/contrib/ldns/dnssec_sign.c user/attilio/vmcontention/contrib/ldns/dnssec_verify.c user/attilio/vmcontention/contrib/ldns/dnssec_zone.c user/attilio/vmcontention/contrib/ldns/ldns/dname.h user/attilio/vmcontention/contrib/ldns/parse.c user/attilio/vmcontention/contrib/ldns/rr.c user/attilio/vmcontention/contrib/ldns/util.c user/attilio/vmcontention/contrib/ldns/zone.c user/attilio/vmcontention/contrib/mtree/Makefile user/attilio/vmcontention/contrib/mtree/create.c user/attilio/vmcontention/contrib/mtree/extern.h user/attilio/vmcontention/contrib/mtree/mtree.8 user/attilio/vmcontention/contrib/mtree/mtree.c user/attilio/vmcontention/contrib/mtree/verify.c user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local user/attilio/vmcontention/include/protocols/timed.h user/attilio/vmcontention/lib/libc/net/sctp_sys_calls.c user/attilio/vmcontention/lib/libc/stdio/fwalk.c user/attilio/vmcontention/lib/libkvm/Makefile user/attilio/vmcontention/lib/libkvm/kvm.h user/attilio/vmcontention/lib/libkvm/kvm_getpcpu.3 user/attilio/vmcontention/lib/libkvm/kvm_pcpu.c user/attilio/vmcontention/lib/libthr/thread/thr_sig.c user/attilio/vmcontention/share/man/man4/ciss.4 user/attilio/vmcontention/sys/amd64/include/clock.h user/attilio/vmcontention/sys/amd64/vmm/intel/vmx.c user/attilio/vmcontention/sys/amd64/vmm/x86.c user/attilio/vmcontention/sys/cam/ata/ata_da.c user/attilio/vmcontention/sys/cam/scsi/scsi_all.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/attilio/vmcontention/sys/conf/NOTES user/attilio/vmcontention/sys/conf/options user/attilio/vmcontention/sys/dev/ahci/ahci.c user/attilio/vmcontention/sys/dev/ahci/ahci.h user/attilio/vmcontention/sys/dev/ath/if_ath_tx_edma.c user/attilio/vmcontention/sys/dev/ciss/ciss.c user/attilio/vmcontention/sys/dev/dpt/dpt.h user/attilio/vmcontention/sys/dev/dpt/dpt_scsi.c user/attilio/vmcontention/sys/dev/e1000/if_igb.c user/attilio/vmcontention/sys/dev/firewire/firewire.c user/attilio/vmcontention/sys/dev/pci/vga_pci.c user/attilio/vmcontention/sys/dev/usb/controller/xhci_pci.c user/attilio/vmcontention/sys/i386/include/counter.h user/attilio/vmcontention/sys/kern/uipc_socket.c user/attilio/vmcontention/sys/net/if.c user/attilio/vmcontention/sys/net/if_bridge.c user/attilio/vmcontention/sys/net/if_llatbl.c user/attilio/vmcontention/sys/net/if_llatbl.h user/attilio/vmcontention/sys/net/if_var.h user/attilio/vmcontention/sys/netinet/in_pcb.h user/attilio/vmcontention/sys/netinet/in_var.h user/attilio/vmcontention/sys/netinet/ip6.h user/attilio/vmcontention/sys/netinet/ip_id.c user/attilio/vmcontention/sys/netinet/ip_input.c user/attilio/vmcontention/sys/netinet/tcp_input.c user/attilio/vmcontention/sys/netinet/tcp_subr.c user/attilio/vmcontention/sys/netinet6/dest6.c user/attilio/vmcontention/sys/netinet6/frag6.c user/attilio/vmcontention/sys/netinet6/in6_gif.c user/attilio/vmcontention/sys/netinet6/in6_src.c user/attilio/vmcontention/sys/netinet6/ip6_forward.c user/attilio/vmcontention/sys/netinet6/ip6_input.c user/attilio/vmcontention/sys/netinet6/ip6_ipsec.c user/attilio/vmcontention/sys/netinet6/ip6_mroute.c user/attilio/vmcontention/sys/netinet6/ip6_output.c user/attilio/vmcontention/sys/netinet6/raw_ip6.c user/attilio/vmcontention/sys/netinet6/route6.c user/attilio/vmcontention/sys/netipsec/ipsec_input.c user/attilio/vmcontention/sys/netipsec/ipsec_output.c user/attilio/vmcontention/sys/powerpc/include/counter.h user/attilio/vmcontention/sys/powerpc/include/pcpu.h user/attilio/vmcontention/sys/sys/socketvar.h user/attilio/vmcontention/sys/sys/syslog.h user/attilio/vmcontention/sys/sys/ttydefaults.h user/attilio/vmcontention/sys/vm/uma.h user/attilio/vmcontention/sys/vm/uma_core.c user/attilio/vmcontention/sys/vm/uma_dbg.c user/attilio/vmcontention/sys/vm/uma_int.h user/attilio/vmcontention/sys/vm/vm_map.c user/attilio/vmcontention/sys/x86/include/specialreg.h user/attilio/vmcontention/sys/x86/x86/tsc.c user/attilio/vmcontention/usr.bin/ctlstat/ctlstat.c user/attilio/vmcontention/usr.bin/fstat/fuser.1 user/attilio/vmcontention/usr.bin/netstat/inet.c user/attilio/vmcontention/usr.bin/netstat/main.c user/attilio/vmcontention/usr.bin/netstat/netstat.h user/attilio/vmcontention/usr.sbin/bhyve/bhyverun.c user/attilio/vmcontention/usr.sbin/bhyve/consport.c user/attilio/vmcontention/usr.sbin/bhyve/dbgport.c user/attilio/vmcontention/usr.sbin/bhyve/inout.c user/attilio/vmcontention/usr.sbin/bhyve/inout.h user/attilio/vmcontention/usr.sbin/bhyve/mem.c user/attilio/vmcontention/usr.sbin/bhyve/mem.h user/attilio/vmcontention/usr.sbin/bhyve/pci_emul.c user/attilio/vmcontention/usr.sbin/bhyve/pmtmr.c user/attilio/vmcontention/usr.sbin/ctladm/ctladm.c user/attilio/vmcontention/usr.sbin/nmtree/Makefile Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/ (props changed) user/attilio/vmcontention/contrib/ldns/ (props changed) user/attilio/vmcontention/contrib/mtree/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/share/man/man4/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/vmm/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/usr.sbin/bhyve/ (props changed) Modified: user/attilio/vmcontention/Makefile ============================================================================== --- user/attilio/vmcontention/Makefile Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/Makefile Thu Apr 11 14:02:14 2013 (r249362) @@ -361,7 +361,7 @@ MAKEFAIL=tee -a ${FAILFILE} MAKEFAIL=cat .endif -universe: universe_prologue +universe: universe_prologue upgrade_checks universe_prologue: @echo "--------------------------------------------------------------" @echo ">>> make universe started on ${STARTTIME}" @@ -371,7 +371,7 @@ universe_prologue: .endif .for target in ${TARGETS} universe: universe_${target} -.ORDER: universe_prologue universe_${target} universe_epilogue +.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue universe_${target}: universe_${target}_prologue universe_${target}_prologue: @echo ">> ${target} started on `LC_ALL=C date`" Modified: user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c ============================================================================== --- user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Thu Apr 11 14:02:14 2013 (r249362) @@ -72,7 +72,9 @@ zcmd_ioctl(int fd, int request, zfs_cmd_ if (zfs_ioctl_version == ZFS_IOCVER_UNDEF) zfs_ioctl_version = get_zfs_ioctl_version(); - if (zfs_ioctl_version == ZFS_IOCVER_DEADMAN) + if (zfs_ioctl_version == ZFS_IOCVER_LZC) + cflag = ZFS_CMD_COMPAT_LZC; + else if (zfs_ioctl_version == ZFS_IOCVER_DEADMAN) cflag = ZFS_CMD_COMPAT_DEADMAN; /* Modified: user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Apr 11 14:02:14 2013 (r249362) @@ -4203,6 +4203,17 @@ zfs_hold(zfs_handle_t *zhp, const char * ha.tag = tag; ha.recursive = recursive; (void) zfs_hold_one(zfs_handle_dup(zhp), &ha); + + if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) { + fnvlist_free(ha.nvl); + ret = ENOENT; + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, "cannot hold snapshot '%s@%s'"), + zhp->zfs_name, snapname); + (void) zfs_standard_error(hdl, ret, errbuf); + return (ret); + } + ret = lzc_hold(ha.nvl, cleanup_fd, &errors); fnvlist_free(ha.nvl); @@ -4304,12 +4315,25 @@ zfs_release(zfs_handle_t *zhp, const cha nvlist_t *errors; nvpair_t *elem; libzfs_handle_t *hdl = zhp->zfs_hdl; + char errbuf[1024]; ha.nvl = fnvlist_alloc(); ha.snapname = snapname; ha.tag = tag; ha.recursive = recursive; (void) zfs_release_one(zfs_handle_dup(zhp), &ha); + + if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) { + fnvlist_free(ha.nvl); + ret = ENOENT; + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot release hold from snapshot '%s@%s'"), + zhp->zfs_name, snapname); + (void) zfs_standard_error(hdl, ret, errbuf); + return (ret); + } + ret = lzc_release(ha.nvl, &errors); fnvlist_free(ha.nvl); @@ -4318,8 +4342,6 @@ zfs_release(zfs_handle_t *zhp, const cha if (nvlist_next_nvpair(errors, NULL) == NULL) { /* no hold-specific errors */ - char errbuf[1024]; - (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot release")); switch (errno) { @@ -4336,8 +4358,6 @@ zfs_release(zfs_handle_t *zhp, const cha for (elem = nvlist_next_nvpair(errors, NULL); elem != NULL; elem = nvlist_next_nvpair(errors, elem)) { - char errbuf[1024]; - (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot release hold from snapshot '%s'"), Modified: user/attilio/vmcontention/contrib/ldns/README ============================================================================== --- user/attilio/vmcontention/contrib/ldns/README Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/README Thu Apr 11 14:02:14 2013 (r249362) @@ -22,6 +22,8 @@ compile on other systems like Solaris an REQUIREMENTS - OpenSSL (Optional, but needed for features like DNSSEC) + - OpenSSL >= 0.9.7f for DANE support + - OpenSSL >= 1.0.0 for ECDSA and GOST support - libpcap (Optional, but needed for examples/ldns-dpa) - (GNU) libtool (in OSX, that's glibtool, not libtool) - GNU make @@ -29,32 +31,10 @@ REQUIREMENTS INSTALLATION 1. Unpack the tarball 2. cd ldns- -3. ./configure -4. gmake (it needs gnu make to compile, on systems where GNU make is the - default you can just use 'make') -5. sudo gmake install -6. Optional. (cd examples; ./configure; gmake), make example programs included. -7. Optional. (cd drill; ./configure; gmake; gmake install), to build drill. - -You can configure and compile it in a separate build directory. - -* Examples -There are some examples and dns related tools in the examples/ directory. -These can be built with: -1. cd examples/ -2. ./configure [--with-ldns=] -3. gmake - -* Drill -Drill can be built with: -1. cd drill/ -2. ./configure [--with-ldns=] -3. gmake - -Note that you need to set LD_LIBRARY_PATH if you want to run the binaries -and you have not installed the library to a system directory. You can use -the make target all-static for the examples to run them if you don't want to -install the library. +3. ./configure --with-examples --with-drill + (optionally compile python bindings too with: --with-pyldns) +4. make +5. make install * Building from subversion repository @@ -84,6 +64,10 @@ We have received patches from the follow o Paul Wouters o Simon Vallet o Ondřej Surý + o Karel Slany + o Havard Eidnes + o Leo Baltus + o Dag-Erling Smørgrav INFORMATION FOR SPECIFIC OPERATING SYSTEMS Modified: user/attilio/vmcontention/contrib/ldns/README.svn ============================================================================== --- user/attilio/vmcontention/contrib/ldns/README.svn Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/README.svn Thu Apr 11 14:02:14 2013 (r249362) @@ -10,17 +10,14 @@ # the correct versions may need to be set. On those # systems, the 'autoreconf' line should be changed to: # AUTOMAKE=automake-1.10 ACLOCAL=aclocal-1.10 autoreconf -# (and these systems probably need gmake instead of make) # older versions of libtoolize do not support --install # so you might need to remove that (with newer versions # it is needed) libtoolize -c --install autoreconf --install -./configure +./configure --with-examples --with-drill # --with-pyldns make make doc # needs doxygen for the html pages -(cd examples && autoreconf && ./configure && make) -(cd drill && autoreconf && ./configure && make) (cd pcat && autoreconf && ./configure && make) (cd examples/nsd-test && autoreconf && ./configure && make) Modified: user/attilio/vmcontention/contrib/ldns/dnssec_sign.c ============================================================================== --- user/attilio/vmcontention/contrib/ldns/dnssec_sign.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/dnssec_sign.c Thu Apr 11 14:02:14 2013 (r249362) @@ -771,9 +771,6 @@ ldns_dnssec_zone_create_nsecs(ldns_dnsse } #ifdef HAVE_SSL -/* in dnssec_zone.c */ -extern int ldns_dname_compare_v(const void *a, const void *b); - static ldns_status ldns_dnssec_zone_create_nsec3s_mkmap(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, Modified: user/attilio/vmcontention/contrib/ldns/dnssec_verify.c ============================================================================== --- user/attilio/vmcontention/contrib/ldns/dnssec_verify.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/dnssec_verify.c Thu Apr 11 14:02:14 2013 (r249362) @@ -628,20 +628,6 @@ ldns_dnssec_trust_tree_print_sm_fmt(FILE } } -#if 0 -static void -ldns_dnssec_trust_tree_print_sm(FILE *out, - ldns_dnssec_trust_tree *tree, - size_t tabs, - bool extended, - uint8_t *sibmap, - size_t treedepth) -{ - ldns_dnssec_trust_tree_print_sm_fmt(out, ldns_output_format_default, - tree, tabs, extended, sibmap, treedepth); -} -#endif - void ldns_dnssec_trust_tree_print_fmt(FILE *out, const ldns_output_format *fmt, ldns_dnssec_trust_tree *tree, Modified: user/attilio/vmcontention/contrib/ldns/dnssec_zone.c ============================================================================== --- user/attilio/vmcontention/contrib/ldns/dnssec_zone.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/dnssec_zone.c Thu Apr 11 14:02:14 2013 (r249362) @@ -298,17 +298,6 @@ ldns_dnssec_rrsets_print_soa_fmt(FILE *o } } -#if 0 -static void -ldns_dnssec_rrsets_print_soa(FILE *out, - ldns_dnssec_rrsets *rrsets, - bool follow, - bool show_soa) -{ - ldns_dnssec_rrsets_print_soa_fmt(out, ldns_output_format_default, - rrsets, follow, show_soa); -} -#endif void ldns_dnssec_rrsets_print_fmt(FILE *out, const ldns_output_format *fmt, @@ -429,16 +418,6 @@ ldns_dnssec_name_set_name(ldns_dnssec_na } } -#if 0 -static ldns_rr * -ldns_dnssec_name_nsec(ldns_dnssec_name *rrset) -{ - if (rrset) { - return rrset->nsec; - } - return NULL; -} -#endif void ldns_dnssec_name_set_nsec(ldns_dnssec_name *rrset, ldns_rr *nsec) @@ -592,14 +571,6 @@ ldns_dnssec_name_print_soa_fmt(FILE *out } } -#if 0 -static void -ldns_dnssec_name_print_soa(FILE *out, ldns_dnssec_name *name, bool show_soa) -{ - ldns_dnssec_name_print_soa_fmt(out, ldns_output_format_default, - name, show_soa); -} -#endif void ldns_dnssec_name_print_fmt(FILE *out, const ldns_output_format *fmt, @@ -827,7 +798,7 @@ ldns_dnssec_zone_deep_free(ldns_dnssec_z } /* use for dname comparison in tree */ -static int +int ldns_dname_compare_v(const void *a, const void *b) { return ldns_dname_compare((ldns_rdf *)a, (ldns_rdf *)b); } Modified: user/attilio/vmcontention/contrib/ldns/ldns/dname.h ============================================================================== --- user/attilio/vmcontention/contrib/ldns/ldns/dname.h Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/ldns/dname.h Thu Apr 11 14:02:14 2013 (r249362) @@ -150,6 +150,7 @@ bool ldns_dname_is_subdomain(const ldns_ * \return -1 if dname1 comes before dname2, 1 if dname1 comes after dname2, and 0 if they are equal. */ int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2); +int ldns_dname_compare_v(const void *, const void *); /** * Checks whether the dname matches the given wildcard Modified: user/attilio/vmcontention/contrib/ldns/parse.c ============================================================================== --- user/attilio/vmcontention/contrib/ldns/parse.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/parse.c Thu Apr 11 14:02:14 2013 (r249362) @@ -340,20 +340,6 @@ tokenread: return (ssize_t)i; } -#if 0 -static void -ldns_bskipc(ldns_buffer *buffer, char c) -{ - while (c == (char) ldns_buffer_read_u8_at(buffer, ldns_buffer_position(buffer))) { - if (ldns_buffer_available_at(buffer, - buffer->_position + sizeof(char), sizeof(char))) { - buffer->_position += sizeof(char); - } else { - return; - } - } -} -#endif void ldns_bskipcs(ldns_buffer *buffer, const char *s) @@ -378,13 +364,6 @@ ldns_bskipcs(ldns_buffer *buffer, const } } -#if 0 -static void -ldns_fskipc(ATTR_UNUSED(FILE *fp), ATTR_UNUSED(char c)) -{ -} -#endif - void ldns_fskipcs(FILE *fp, const char *s) { Modified: user/attilio/vmcontention/contrib/ldns/rr.c ============================================================================== --- user/attilio/vmcontention/contrib/ldns/rr.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/rr.c Thu Apr 11 14:02:14 2013 (r249362) @@ -1394,25 +1394,6 @@ ldns_rr_list_clone(const ldns_rr_list *r return new_list; } -#if 0 -static int -qsort_rr_compare(const void *a, const void *b) -{ - const ldns_rr *rr1 = * (const ldns_rr **) a; - const ldns_rr *rr2 = * (const ldns_rr **) b; - - if (rr1 == NULL && rr2 == NULL) { - return 0; - } - if (rr1 == NULL) { - return -1; - } - if (rr2 == NULL) { - return 1; - } - return ldns_rr_compare(rr1, rr2); -} -#endif static int qsort_schwartz_rr_compare(const void *a, const void *b) Modified: user/attilio/vmcontention/contrib/ldns/util.c ============================================================================== --- user/attilio/vmcontention/contrib/ldns/util.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/util.c Thu Apr 11 14:02:14 2013 (r249362) @@ -25,46 +25,6 @@ #include #endif -#if 0 -/* put this here tmp. for debugging */ -static void -xprintf_rdf(ldns_rdf *rd) -{ - /* assume printable string */ - fprintf(stderr, "size\t:%u\n", (unsigned int)ldns_rdf_size(rd)); - fprintf(stderr, "type\t:%u\n", (unsigned int)ldns_rdf_get_type(rd)); - fprintf(stderr, "data\t:[%.*s]\n", (int)ldns_rdf_size(rd), - (char*)ldns_rdf_data(rd)); -} - -static void -xprintf_rr(ldns_rr *rr) -{ - /* assume printable string */ - uint16_t count, i; - - count = ldns_rr_rd_count(rr); - - for(i = 0; i < count; i++) { - fprintf(stderr, "print rd %u\n", (unsigned int) i); - xprintf_rdf(rr->_rdata_fields[i]); - } -} - -static void -xprintf_hex(uint8_t *data, size_t len) -{ - size_t i; - for (i = 0; i < len; i++) { - if (i > 0 && i % 20 == 0) { - printf("\t; %u - %u\n", (unsigned int) i - 19, (unsigned int) i); - } - printf("%02x ", (unsigned int) data[i]); - } - printf("\n"); -} -#endif - ldns_lookup_table * ldns_lookup_by_name(ldns_lookup_table *table, const char *name) { Modified: user/attilio/vmcontention/contrib/ldns/zone.c ============================================================================== --- user/attilio/vmcontention/contrib/ldns/zone.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/ldns/zone.c Thu Apr 11 14:02:14 2013 (r249362) @@ -56,105 +56,6 @@ ldns_zone_push_rr(ldns_zone *z, ldns_rr return ldns_rr_list_push_rr( ldns_zone_rrs(z), rr); } -#if 0 -/* return a clone of the given rr list, without the glue records - * rr list should be the complete zone - * if present, stripped records are added to the list *glue_records - */ -static ldns_rr_list * -ldns_zone_strip_glue_rrs(const ldns_rdf *zone_name, const ldns_rr_list *rrs, ldns_rr_list *glue_rrs) -{ - ldns_rr_list *new_list; - - /* when do we find glue? It means we find an IP address - * (AAAA/A) for a nameserver listed in the zone - * - * Alg used here: - * first find all the zonecuts (NS records) - * find all the AAAA or A records (can be done it the - * above loop). - * - * Check if the aaaa/a list are subdomains under the - * NS domains. - * If yes -> glue, if no -> not glue - */ - - ldns_rr_list *zone_cuts; - ldns_rr_list *addr; - ldns_rr *r, *ns, *a; - ldns_rdf *dname_a, *ns_owner; - uint16_t i,j; - - new_list = NULL; - zone_cuts = NULL; - addr = NULL; - - new_list = ldns_rr_list_new(); - if (!new_list) goto memory_error; - zone_cuts = ldns_rr_list_new(); - if (!zone_cuts) goto memory_error; - addr = ldns_rr_list_new(); - if (!addr) goto memory_error; - - for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - r = ldns_rr_list_rr(rrs, i); - if (ldns_rr_get_type(r) == LDNS_RR_TYPE_A || - ldns_rr_get_type(r) == LDNS_RR_TYPE_AAAA) { - /* possibly glue */ - if (!ldns_rr_list_push_rr(addr, r)) goto memory_error; - continue; - } - if (ldns_rr_get_type(r) == LDNS_RR_TYPE_NS) { - /* multiple zones will end up here - - * for now; not a problem - */ - /* don't add NS records for the current zone itself */ - if (ldns_rdf_compare(ldns_rr_owner(r), - zone_name) != 0) { - if (!ldns_rr_list_push_rr(zone_cuts, r)) goto memory_error; - } - continue; - } - } - - /* will sorting make it quicker ?? */ - for(i = 0; i < ldns_rr_list_rr_count(zone_cuts); i++) { - ns = ldns_rr_list_rr(zone_cuts, i); - ns_owner = ldns_rr_owner(ns); - for(j = 0; j < ldns_rr_list_rr_count(addr); j++) { - a = ldns_rr_list_rr(addr, j); - dname_a = ldns_rr_owner(a); - - if (ldns_dname_is_subdomain(dname_a, ns_owner)) { - /* GLUE! */ - if (glue_rrs) { - if (!ldns_rr_list_push_rr(glue_rrs, a)) goto memory_error; - } - break; - } else { - if (!ldns_rr_list_push_rr(new_list, a)) goto memory_error; - } - } - } - - ldns_rr_list_free(addr); - ldns_rr_list_free(zone_cuts); - - return new_list; - -memory_error: - if (new_list) { - ldns_rr_list_free(new_list); - } - if (zone_cuts) { - ldns_rr_list_free(zone_cuts); - } - if (addr) { - ldns_rr_list_free(addr); - } - return NULL; -} -#endif /* * Get the list of glue records in a zone @@ -401,22 +302,6 @@ ldns_zone_sort(ldns_zone *zone) ldns_rr_list_sort(zrr); } -#if 0 -/** - * ixfr function. Work on a ldns_zone and remove and add - * the rrs from the rrlist - * \param[in] z the zone to work on - * \param[in] del rr_list to remove from the zone - * \param[in] add rr_list to add to the zone - * \return Tja, wat zouden we eens returnen TODO - */ -void -ldns_zone_ixfr_del_add(ldns_zone *z, ldns_rr_list *del, ldns_rr_list *add) -{ - -} -#endif - void ldns_zone_free(ldns_zone *zone) { Modified: user/attilio/vmcontention/contrib/mtree/Makefile ============================================================================== --- user/attilio/vmcontention/contrib/mtree/Makefile Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/mtree/Makefile Thu Apr 11 14:02:14 2013 (r249362) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.33 2012/10/05 01:26:56 christos Exp $ +# $NetBSD: Makefile,v 1.34 2013/02/03 19:15:16 christos Exp $ # from: @(#)Makefile 8.2 (Berkeley) 4/27/95 .include @@ -8,7 +8,7 @@ PROG= mtree CPPFLAGS+= -DMTREE MAN= mtree.8 SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c specspec.c \ - verify.c getid.c pack_dev.c + verify.c getid.c pack_dev.c only.c .if (${HOSTPROG:U} == "") DPADD+= ${LIBUTIL} LDADD+= -lutil Modified: user/attilio/vmcontention/contrib/mtree/create.c ============================================================================== --- user/attilio/vmcontention/contrib/mtree/create.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/mtree/create.c Thu Apr 11 14:02:14 2013 (r249362) @@ -1,4 +1,4 @@ -/* $NetBSD: create.c,v 1.68 2012/12/20 16:43:16 christos Exp $ */ +/* $NetBSD: create.c,v 1.69 2013/02/03 19:15:17 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: create.c,v 1.68 2012/12/20 16:43:16 christos Exp $"); +__RCSID("$NetBSD: create.c,v 1.69 2013/02/03 19:15:17 christos Exp $"); #endif #endif /* not lint */ @@ -134,6 +134,10 @@ cwalk(void) fts_set(t, p, FTS_SKIP); continue; } + if (!find_only(p->fts_path)) { + fts_set(t, p, FTS_SKIP); + continue; + } switch(p->fts_info) { case FTS_D: if (!bflag) Modified: user/attilio/vmcontention/contrib/mtree/extern.h ============================================================================== --- user/attilio/vmcontention/contrib/mtree/extern.h Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/mtree/extern.h Thu Apr 11 14:02:14 2013 (r249362) @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.37 2012/12/20 16:43:16 christos Exp $ */ +/* $NetBSD: extern.h,v 1.38 2013/02/03 19:15:17 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -42,6 +42,7 @@ #include #include #include +#include #if HAVE_NETDB_H /* For MAXHOSTNAMELEN on some platforms. */ @@ -74,6 +75,8 @@ u_int parsetype(const char *); void read_excludes_file(const char *); const char *rlink(const char *); int verify(FILE *); +void load_only(const char *fname); +bool find_only(const char *path); extern int bflag, dflag, eflag, iflag, jflag, lflag, mflag, nflag, qflag, rflag, sflag, tflag, uflag; Modified: user/attilio/vmcontention/contrib/mtree/mtree.8 ============================================================================== --- user/attilio/vmcontention/contrib/mtree/mtree.8 Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/mtree/mtree.8 Thu Apr 11 14:02:14 2013 (r249362) @@ -1,4 +1,4 @@ -.\" $NetBSD: mtree.8,v 1.67 2012/12/20 20:31:01 wiz Exp $ +.\" $NetBSD: mtree.8,v 1.69 2013/02/03 19:16:06 christos Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -56,7 +56,7 @@ .\" .\" @(#)mtree.8 8.2 (Berkeley) 12/11/93 .\" -.Dd December 20, 2012 +.Dd February 3, 2013 .Dt MTREE 8 .Os .Sh NAME @@ -73,6 +73,7 @@ .Op Fl K Ar keywords .Op Fl k Ar keywords .Op Fl N Ar dbdir +.Op Fl O Ar onlyfile .Op Fl p Ar path .Op Fl R Ar keywords .Op Fl s Ar seed @@ -273,6 +274,8 @@ rather than using the results from the s and .Xr getgrnam 3 (and related) library calls. +.It Fl O Ar onlypaths +Only include files included in this list of pathnames. .It Fl P Don't follow symbolic links in the file hierarchy, instead consider the symbolic link itself in any comparisons. Modified: user/attilio/vmcontention/contrib/mtree/mtree.c ============================================================================== --- user/attilio/vmcontention/contrib/mtree/mtree.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/mtree/mtree.c Thu Apr 11 14:02:14 2013 (r249362) @@ -1,4 +1,4 @@ -/* $NetBSD: mtree.c,v 1.46 2012/12/20 19:09:25 christos Exp $ */ +/* $NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $ */ /*- * Copyright (c) 1989, 1990, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: mtree.c,v 1.46 2012/12/20 19:09:25 christos Exp $"); +__RCSID("$NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $"); #endif #endif /* not lint */ @@ -59,8 +59,8 @@ __RCSID("$NetBSD: mtree.c,v 1.46 2012/12 #include "extern.h" int ftsoptions = FTS_PHYSICAL; -int bflag, cflag, Cflag, dflag, Dflag, eflag, iflag, jflag, lflag, mflag, - nflag, qflag, rflag, sflag, tflag, uflag, Uflag, wflag; +int bflag, dflag, eflag, iflag, jflag, lflag, mflag, nflag, qflag, rflag, + sflag, tflag, uflag; char fullpath[MAXPATHLEN]; static struct { @@ -79,18 +79,20 @@ main(int argc, char **argv) { int ch, status; unsigned int i; + int cflag, Cflag, Dflag, Uflag, wflag; char *dir, *p; FILE *spec1, *spec2; setprogname(argv[0]); + cflag = Cflag = Dflag = Uflag = wflag = 0; dir = NULL; init_excludes(); spec1 = stdin; spec2 = NULL; while ((ch = getopt(argc, argv, - "bcCdDeE:f:F:I:ijk:K:lLmMnN:p:PqrR:s:StuUwWxX:")) + "bcCdDeE:f:F:I:ijk:K:lLmMnN:O:p:PqrR:s:StuUwWxX:")) != -1) { switch((char)ch) { case 'b': @@ -179,6 +181,9 @@ main(int argc, char **argv) "Unable to use user and group databases in `%s'", optarg); break; + case 'O': + load_only(optarg); + break; case 'p': dir = optarg; break; Copied: user/attilio/vmcontention/contrib/mtree/only.c (from r249361, head/contrib/mtree/only.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/contrib/mtree/only.c Thu Apr 11 14:02:14 2013 (r249362, copy of r249361, head/contrib/mtree/only.c) @@ -0,0 +1,152 @@ +/* $NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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 The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#if defined(__RCSID) && !defined(lint) +__RCSID("$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $"); +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "extern.h" + +struct hentry { + char *str; + uint32_t hash; + struct hentry *next; +}; + +static struct hentry *table[1024]; +static bool loaded; + +static uint32_t +hash_str(const char *str) +{ + const uint8_t *s = (const uint8_t *)str; + uint8_t c; + uint32_t hash = 0; + while ((c = *s++) != '\0') + hash = hash * 33 + c; /* "perl": k=33, r=r+r/32 */ + return hash + (hash >> 5); +} + +static bool +hash_find(const char *str, uint32_t *h) +{ + struct hentry *e; + *h = hash_str(str) % __arraycount(table); + + for (e = table[*h]; e; e = e->next) + if (e->hash == *h && strcmp(e->str, str) == 0) + return true; + return false; +} + +static void +hash_insert(char *str, uint32_t h) +{ + struct hentry *e; + + if ((e = malloc(sizeof(*e))) == NULL) + mtree_err("memory allocation error"); + + e->str = str; + e->hash = h; + e->next = table[h]; + table[h] = e; +} + +static void +fill(char *str) +{ + uint32_t h; + char *ptr = strrchr(str, '/'); + + if (ptr == NULL) + return; + + *ptr = '\0'; + if (!hash_find(str, &h)) { + char *x = strdup(str); + if (x == NULL) + mtree_err("memory allocation error"); + hash_insert(x, h); + fill(str); + } + *ptr = '/'; +} + +void +load_only(const char *fname) +{ + FILE *fp; + char *line; + size_t len, lineno; + + if ((fp = fopen(fname, "r")) == NULL) + err(1, "Cannot open `%s'", fname); + + while ((line = fparseln(fp, &len, &lineno, NULL, FPARSELN_UNESCALL))) { + uint32_t h; + if (hash_find(line, &h)) + err(1, "Duplicate entry %s", line); + hash_insert(line, h); + fill(line); + } + + fclose(fp); + loaded = true; +} + +bool +find_only(const char *path) +{ + uint32_t h; + + if (!loaded) + return true; + return hash_find(path, &h); +} Modified: user/attilio/vmcontention/contrib/mtree/verify.c ============================================================================== --- user/attilio/vmcontention/contrib/mtree/verify.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/contrib/mtree/verify.c Thu Apr 11 14:02:14 2013 (r249362) @@ -1,4 +1,4 @@ -/* $NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $ */ +/* $NetBSD: verify.c,v 1.44 2013/02/03 19:15:17 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $"); +__RCSID("$NetBSD: verify.c,v 1.44 2013/02/03 19:15:17 christos Exp $"); #endif #endif /* not lint */ @@ -95,6 +95,10 @@ vwalk(void) fts_set(t, p, FTS_SKIP); continue; } + if (!find_only(p->fts_path)) { + fts_set(t, p, FTS_SKIP); + continue; + } switch(p->fts_info) { case FTS_D: case FTS_SL: Modified: user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local Thu Apr 11 14:02:14 2013 (r249362) @@ -50,6 +50,7 @@ .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 .ds doc-operating-system-FreeBSD-8.3 8.3 +.ds doc-operating-system-FreeBSD-8.4 8.4 .ds doc-operating-system-FreeBSD-9.1 9.1 .ds doc-operating-system-FreeBSD-10.0 10.0 . Modified: user/attilio/vmcontention/include/protocols/timed.h ============================================================================== --- user/attilio/vmcontention/include/protocols/timed.h Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/include/protocols/timed.h Thu Apr 11 14:02:14 2013 (r249362) @@ -90,11 +90,13 @@ struct tsp { #define TSPTYPENUMBER 25 #ifdef TSPTYPES -const char *tsptype[TSPTYPENUMBER] = +static char const * const tsptype[] = { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP", "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT", "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ", "TEST", "SETDATE", "SETDATEREQ", "LOOP" }; +_Static_assert(sizeof(tsptype) / sizeof(const char *) == TSPTYPENUMBER, + "Size of tsptype does not match TSPTYPENUMBER"); #endif #endif /* !_TIMED_H_ */ Modified: user/attilio/vmcontention/lib/libc/net/sctp_sys_calls.c ============================================================================== --- user/attilio/vmcontention/lib/libc/net/sctp_sys_calls.c Thu Apr 11 13:05:38 2013 (r249361) +++ user/attilio/vmcontention/lib/libc/net/sctp_sys_calls.c Thu Apr 11 14:02:14 2013 (r249362) @@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #ifndef IN6_IS_ADDR_V4MAPPED #define IN6_IS_ADDR_V4MAPPED(a) \ ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ @@ -57,77 +55,8 @@ __FBSDID("$FreeBSD$"); (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) #endif - -#define SCTP_CONTROL_VEC_SIZE_SND 8192 #define SCTP_CONTROL_VEC_SIZE_RCV 16384 -#define SCTP_STACK_BUF_SIZE 2048 - -#ifdef SCTP_DEBUG_PRINT_ADDRESS - -#define SCTP_STRING_BUF_SZ 256 - -static void -SCTPPrintAnAddress(struct sockaddr *a) -{ - char stringToPrint[SCTP_STRING_BUF_SZ]; - u_short prt; - char *srcaddr, *txt; - - if (a == NULL) { - printf("NULL\n"); - return; - } - if (a->sa_family == AF_INET) { - srcaddr = (char *)&((struct sockaddr_in *)a)->sin_addr; - txt = "IPv4 Address: "; - prt = ntohs(((struct sockaddr_in *)a)->sin_port); - } else if (a->sa_family == AF_INET6) { - srcaddr = (char *)&((struct sockaddr_in6 *)a)->sin6_addr; - prt = ntohs(((struct sockaddr_in6 *)a)->sin6_port); - txt = "IPv6 Address: "; - } else if (a->sa_family == AF_LINK) { - int i; - char tbuf[SCTP_STRING_BUF_SZ]; - u_char adbuf[SCTP_STRING_BUF_SZ]; - struct sockaddr_dl *dl; - - dl = (struct sockaddr_dl *)a; - strncpy(tbuf, dl->sdl_data, dl->sdl_nlen); - tbuf[dl->sdl_nlen] = 0; - printf("Intf:%s (len:%d)Interface index:%d type:%x(%d) ll-len:%d ", - tbuf, - dl->sdl_nlen, - dl->sdl_index, - dl->sdl_type, - dl->sdl_type, - dl->sdl_alen - ); - memcpy(adbuf, LLADDR(dl), dl->sdl_alen); - for (i = 0; i < dl->sdl_alen; i++) { - printf("%2.2x", adbuf[i]); - if (i < (dl->sdl_alen - 1)) - printf(":"); - } - printf("\n"); - return; - } else { - return; - } - if (inet_ntop(a->sa_family, srcaddr, stringToPrint, sizeof(stringToPrint))) { - if (a->sa_family == AF_INET6) { - printf("%s%s:%d scope:%d\n", - txt, stringToPrint, prt, - ((struct sockaddr_in6 *)a)->sin6_scope_id); - } else { - printf("%s%s:%d\n", txt, stringToPrint, prt); - } - - } else { - printf("%s unprintable?\n", txt); - } -} -#endif /* SCTP_DEBUG_PRINT_ADDRESS */ static void in6_sin6_2_sin(struct sockaddr_in *sin, struct sockaddr_in6 *sin6) @@ -171,11 +100,10 @@ int sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt, sctp_assoc_t * id) { - char buf[SCTP_STACK_BUF_SIZE]; + char *buf; int i, ret, cnt, *aa; char *cpto; const struct sockaddr *at; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Apr 11 14:03:03 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8465DD86; Thu, 11 Apr 2013 14:03:03 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5E0AED96; Thu, 11 Apr 2013 14:03:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3BE33KO086087; Thu, 11 Apr 2013 14:03:03 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3BE33fr086086; Thu, 11 Apr 2013 14:03:03 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304111403.r3BE33fr086086@svn.freebsd.org> From: Attilio Rao Date: Thu, 11 Apr 2013 14:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249363 - user/attilio/jeff-numa X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 14:03:03 -0000 Author: attilio Date: Thu Apr 11 14:03:02 2013 New Revision: 249363 URL: http://svnweb.freebsd.org/changeset/base/249363 Log: Branch to import Jeff's patches about NUMA. Added: - copied from r249362, user/attilio/vmcontention/ Directory Properties: user/attilio/jeff-numa/ (props changed) From owner-svn-src-user@FreeBSD.ORG Thu Apr 11 14:45:44 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 90A0B4D5; Thu, 11 Apr 2013 14:45:44 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 691BCF3A; Thu, 11 Apr 2013 14:45:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3BEjiEi098477; Thu, 11 Apr 2013 14:45:44 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3BEjihA098476; Thu, 11 Apr 2013 14:45:44 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201304111445.r3BEjihA098476@svn.freebsd.org> From: Attilio Rao Date: Thu, 11 Apr 2013 14:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249364 - user/attilio/jeff-numa X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 14:45:44 -0000 Author: attilio Date: Thu Apr 11 14:45:43 2013 New Revision: 249364 URL: http://svnweb.freebsd.org/changeset/base/249364 Log: MFC Modified: Directory Properties: user/attilio/jeff-numa/ (props changed) From owner-svn-src-user@FreeBSD.ORG Thu Apr 11 15:55:54 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 990D2FD; Thu, 11 Apr 2013 15:55:54 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7BEB132B; Thu, 11 Apr 2013 15:55:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3BFtrvg019615; Thu, 11 Apr 2013 15:55:53 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3BFtq0g019604; Thu, 11 Apr 2013 15:55:52 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201304111555.r3BFtq0g019604@svn.freebsd.org> From: Andre Oppermann Date: Thu, 11 Apr 2013 15:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249365 - in user/andre/tcp-ao/sys: conf crypto crypto/cmac crypto/hmac crypto/rijndael X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 15:55:54 -0000 Author: andre Date: Thu Apr 11 15:55:52 2013 New Revision: 249365 URL: http://svnweb.freebsd.org/changeset/base/249365 Log: Adjust the HMAC and CMAC functions to the FreeBSD environment and include them into the kernel build in preparation for use in the TCP-AO code. Note that we do not have explicit_bzero() so the compiler may optimize away the bzero() to wipe out key storage on the stack before returning. Sponsored by: Juniper Networks Modified: user/andre/tcp-ao/sys/conf/files user/andre/tcp-ao/sys/crypto/cmac/cmac.c user/andre/tcp-ao/sys/crypto/cmac/cmac.h user/andre/tcp-ao/sys/crypto/hmac/hmac.c user/andre/tcp-ao/sys/crypto/hmac/hmac.h user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h user/andre/tcp-ao/sys/crypto/sha1.h Modified: user/andre/tcp-ao/sys/conf/files ============================================================================== --- user/andre/tcp-ao/sys/conf/files Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/conf/files Thu Apr 11 15:55:52 2013 (r249365) @@ -541,8 +541,8 @@ crypto/sha1.c optional carp | crypto | netgraph_mppc_encryption | sctp crypto/sha2/sha2.c optional crypto | geom_bde | ipsec | random | \ sctp | zfs -crypto/cmac/cmac.c optional crypto | netinet | netinet6 -crypto/hmac/hmac.c optional crypto | netinet | netinet6 +crypto/cmac/cmac.c optional inet | inet6 +crypto/hmac/hmac.c optional inet | inet6 ddb/db_access.c optional ddb ddb/db_break.c optional ddb ddb/db_capture.c optional ddb @@ -3116,6 +3116,7 @@ netinet/tcp_timer.c optional inet | ine netinet/tcp_timewait.c optional inet | inet6 netinet/tcp_usrreq.c optional inet | inet6 netinet/udp_usrreq.c optional inet | inet6 +netinet/tcp_ao.c optional inet | inet6 netinet/libalias/alias.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_db.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_mod.c optional libalias | netgraph_nat Modified: user/andre/tcp-ao/sys/crypto/cmac/cmac.c ============================================================================== --- user/andre/tcp-ao/sys/crypto/cmac/cmac.c Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/crypto/cmac/cmac.c Thu Apr 11 15:55:52 2013 (r249365) @@ -24,8 +24,10 @@ #include #include -#include -#include +#include +#include + +#define explicit_bzero(a, b) bzero(a, b) #define LSHIFT(v, r) do { \ int i; \ Modified: user/andre/tcp-ao/sys/crypto/cmac/cmac.h ============================================================================== --- user/andre/tcp-ao/sys/crypto/cmac/cmac.h Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/crypto/cmac/cmac.h Thu Apr 11 15:55:52 2013 (r249365) @@ -19,6 +19,10 @@ #ifndef _CMAC_H_ #define _CMAC_H_ +#ifndef _RIJNDAEL_H_ +#include +#endif + #define AES_CMAC_KEY_LENGTH 16 #define AES_CMAC_DIGEST_LENGTH 16 Modified: user/andre/tcp-ao/sys/crypto/hmac/hmac.c ============================================================================== --- user/andre/tcp-ao/sys/crypto/hmac/hmac.c Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/crypto/hmac/hmac.c Thu Apr 11 15:55:52 2013 (r249365) @@ -24,10 +24,12 @@ #include #include -#include +#include #include -#include -#include +#include +#include + +#define explicit_bzero(a, b) bzero(a, b) void HMAC_MD5_Init(HMAC_MD5_CTX *ctx, const u_int8_t *key, u_int key_len) @@ -144,9 +146,9 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, c int i; if (key_len > SHA256_BLOCK_LENGTH) { - SHA256Init(&ctx->ctx); - SHA256Update(&ctx->ctx, key, key_len); - SHA256Final(ctx->key, &ctx->ctx); + SHA256_Init(&ctx->ctx); + SHA256_Update(&ctx->ctx, key, key_len); + SHA256_Final(ctx->key, &ctx->ctx); ctx->key_len = SHA256_DIGEST_LENGTH; } else { bcopy(key, ctx->key, key_len); @@ -158,8 +160,8 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, c for (i = 0; i < SHA256_BLOCK_LENGTH; i++) k_ipad[i] ^= 0x36; - SHA256Init(&ctx->ctx); - SHA256Update(&ctx->ctx, k_ipad, SHA256_BLOCK_LENGTH); + SHA256_Init(&ctx->ctx); + SHA256_Update(&ctx->ctx, k_ipad, SHA256_BLOCK_LENGTH); explicit_bzero(k_ipad, sizeof k_ipad); } @@ -167,7 +169,7 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, c void HMAC_SHA256_Update(HMAC_SHA256_CTX *ctx, const u_int8_t *data, u_int len) { - SHA256Update(&ctx->ctx, data, len); + SHA256_Update(&ctx->ctx, data, len); } void @@ -176,17 +178,17 @@ HMAC_SHA256_Final(u_int8_t digest[SHA256 u_int8_t k_opad[SHA256_BLOCK_LENGTH]; int i; - SHA256Final(digest, &ctx->ctx); + SHA256_Final(digest, &ctx->ctx); bzero(k_opad, SHA256_BLOCK_LENGTH); bcopy(ctx->key, k_opad, ctx->key_len); for (i = 0; i < SHA256_BLOCK_LENGTH; i++) k_opad[i] ^= 0x5c; - SHA256Init(&ctx->ctx); - SHA256Update(&ctx->ctx, k_opad, SHA256_BLOCK_LENGTH); - SHA256Update(&ctx->ctx, digest, SHA256_DIGEST_LENGTH); - SHA256Final(digest, &ctx->ctx); + SHA256_Init(&ctx->ctx); + SHA256_Update(&ctx->ctx, k_opad, SHA256_BLOCK_LENGTH); + SHA256_Update(&ctx->ctx, digest, SHA256_DIGEST_LENGTH); + SHA256_Final(digest, &ctx->ctx); explicit_bzero(k_opad, sizeof k_opad); } Modified: user/andre/tcp-ao/sys/crypto/hmac/hmac.h ============================================================================== --- user/andre/tcp-ao/sys/crypto/hmac/hmac.h Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/crypto/hmac/hmac.h Thu Apr 11 15:55:52 2013 (r249365) @@ -19,6 +19,10 @@ #ifndef _HMAC_H_ #define _HMAC_H_ +#include +#include +#include + typedef struct _HMAC_MD5_CTX { MD5_CTX ctx; u_int8_t key[MD5_BLOCK_LENGTH]; @@ -32,7 +36,7 @@ typedef struct _HMAC_SHA1_CTX { } HMAC_SHA1_CTX; typedef struct _HMAC_SHA256_CTX { - SHA2_CTX ctx; + SHA256_CTX ctx; u_int8_t key[SHA256_BLOCK_LENGTH]; u_int key_len; } HMAC_SHA256_CTX; Modified: user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c ============================================================================== --- user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c Thu Apr 11 15:55:52 2013 (r249365) @@ -45,6 +45,13 @@ rijndael_set_key(rijndael_ctx *ctx, cons } void +rijndael_set_key_enc_only(rijndael_ctx *ctx, const u_char *key, int bits) +{ + + ctx->Nr = rijndaelKeySetupEnc(ctx->ek, key, bits); +} + +void rijndael_decrypt(const rijndael_ctx *ctx, const u_char *src, u_char *dst) { Modified: user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h ============================================================================== --- user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h Thu Apr 11 15:55:52 2013 (r249365) @@ -42,6 +42,7 @@ typedef struct { } rijndael_ctx; void rijndael_set_key(rijndael_ctx *, const u_char *, int); +void rijndael_set_key_enc_only(rijndael_ctx *, const u_char *, int); void rijndael_decrypt(const rijndael_ctx *, const u_char *, u_char *); void rijndael_encrypt(const rijndael_ctx *, const u_char *, u_char *); Modified: user/andre/tcp-ao/sys/crypto/sha1.h ============================================================================== --- user/andre/tcp-ao/sys/crypto/sha1.h Thu Apr 11 14:45:43 2013 (r249364) +++ user/andre/tcp-ao/sys/crypto/sha1.h Thu Apr 11 15:55:52 2013 (r249365) @@ -68,5 +68,7 @@ typedef struct sha1_ctxt SHA1_CTX; #endif /* _KERNEL */ #define SHA1_RESULTLEN (160/8) +#define SHA1_BLOCK_LENGTH 64 +#define SHA1_DIGEST_LENGTH SHA1_RESULTLEN #endif /*_NETINET6_SHA1_H_*/ From owner-svn-src-user@FreeBSD.ORG Thu Apr 11 15:59:18 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E019E24D; Thu, 11 Apr 2013 15:59:18 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C2840366; Thu, 11 Apr 2013 15:59:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3BFxIA5020091; Thu, 11 Apr 2013 15:59:18 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3BFxI84020085; Thu, 11 Apr 2013 15:59:18 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201304111559.r3BFxI84020085@svn.freebsd.org> From: Andre Oppermann Date: Thu, 11 Apr 2013 15:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249366 - user/andre/tcp-ao/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 15:59:18 -0000 Author: andre Date: Thu Apr 11 15:59:18 2013 New Revision: 249366 URL: http://svnweb.freebsd.org/changeset/base/249366 Log: After the brainstorming and tryout phase make the new TCP-AO code compile and move it a first step towards becoming functional. Sponsored by: Juniper Networks Modified: user/andre/tcp-ao/sys/netinet/tcp_ao.c user/andre/tcp-ao/sys/netinet/tcp_ao.h user/andre/tcp-ao/sys/netinet/tcp_var.h Modified: user/andre/tcp-ao/sys/netinet/tcp_ao.c ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_ao.c Thu Apr 11 15:55:52 2013 (r249365) +++ user/andre/tcp-ao/sys/netinet/tcp_ao.c Thu Apr 11 15:59:18 2013 (r249366) @@ -51,27 +51,90 @@ * legacy tcp-md5 can be brought and integrated into the tcp-ao framework. */ +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#ifdef INET6 +#include +#include +#include +#include +#endif +#include +#include +#include +#include +#include +#include + /* * The code below is skeleton code and not functional yet. */ MALLOC_DEFINE(M_TCPAO, "tcp_ao", "TCP-AO peer and key structures"); +int tcp_ao_ctl(struct tcpcb *, struct tcp_ao_sopt *, int); + +struct tcp_ao_peer *tcp_ao_peer_find(struct tcp_ao_cb *, struct sockaddr *); +struct tcp_ao_peer *tcp_ao_peer_add(struct tcp_ao_cb *, struct sockaddr *); +int tcp_ao_peer_del(struct tcp_ao_cb *, struct tcp_ao_peer *); +void tcp_ao_peer_flush(struct tcp_ao_cb *); + +struct tcp_ao_key *tcp_ao_key_find(struct tcp_ao_peer *, uint8_t); +struct tcp_ao_key *tcp_ao_key_add(struct tcp_ao_peer *, struct tcp_ao_sopt *, uint8_t); +int tcp_ao_key_del(struct tcp_ao_peer *, uint8_t); +void tcp_ao_key_flush(struct tcp_ao_peer *); + +int tcp_ao_peer_clone(struct tcpcb *, struct tcpcb *, struct sockaddr *); +struct tcp_ao_cb *tcp_ao_cb_alloc(void); +void tcp_ao_cb_free(struct tcpcb *); + int tcp_ao_ctl(struct tcpcb *tp, struct tcp_ao_sopt *tao, int tao_len) { struct tcp_ao_cb *c; struct tcp_ao_peer *p; struct tcp_ao_key *k; - int error; + struct sockaddr *sa; + int error = EINVAL; + + sa = (struct sockaddr *)&tao->tao_peer; - switch (tao->tao_peer.sa_family) { + switch (tao->tao_peer.ss_family) { case AF_INET: - if (tao->tao_peer.sa_len != sizeof(struct sockaddr_in)) + if (sa->sa_len != sizeof(struct sockaddr_in)) error = EINVAL; break; case AF_INET6: - if (tao->tao_peer.sa_len != sizeof(struct sockaddr_in6)) + if (sa->sa_len != sizeof(struct sockaddr_in6)) error = EINVAL; break; default: @@ -86,8 +149,8 @@ tcp_ao_ctl(struct tcpcb *tp, struct tcp_ case TAO_CMD_ADD: switch (tao->tao_algo) { case TAO_ALGO_MD5SIG: - case TAO_ALGO_HMAC-SHA-1-96: - case TAO_ALGO_AES-128-CMAC-96: + case TAO_ALGO_HMAC_SHA_1_96: + case TAO_ALGO_AES_128_CMAC_96: break; default: error = EINVAL; @@ -95,7 +158,7 @@ tcp_ao_ctl(struct tcpcb *tp, struct tcp_ } /* Insert or overwrite */ - if ((p = tcp_ao_peer_add(c, tao)) == NULL) { + if ((p = tcp_ao_peer_add(c, sa)) == NULL) { error = EINVAL; break; } @@ -104,14 +167,14 @@ tcp_ao_ctl(struct tcpcb *tp, struct tcp_ error = EINVAL; break; } - if ((k = tcp_ao_key_add(p, tao, taolen - sizeof(*tao)) == NULL) { + if ((k = tcp_ao_key_add(p, tao, tao_len - sizeof(*tao))) == NULL) { error = EINVAL; } break; case TAO_CMD_DELIDX: /* Can't remove active index */ - if ((p = tcp_ao_peer_find(c, tao)) == NULL) { + if ((p = tcp_ao_peer_find(c, sa)) == NULL) { error = EINVAL; break; } @@ -129,7 +192,7 @@ tcp_ao_ctl(struct tcpcb *tp, struct tcp_ if (tp->t_state > TCPS_LISTEN) break; - if ((p = tcp_ao_peer_find(c, tao)) == NULL) { + if ((p = tcp_ao_peer_find(c, sa)) == NULL) { error = EINVAL; break; } @@ -157,29 +220,29 @@ tcp_ao_peer_find(struct tcp_ao_cb *tac, { struct tcp_ao_peer *p; - LIST_FOREACH(p, tac->tac_peers, tap_entry) { - if (p->tap_peer.sa_family == sa->sa_family && - !bcmp(p->tap_peer.sa_data, sa->sa_data, - min(p->tap_peer.sa.len, sa->sa_len))) + LIST_FOREACH(p, &tac->tac_peers, tap_entry) { + if (p->tap_peer.sa.sa_family == sa->sa_family && + !bcmp(p->tap_peer.sa.sa_data, sa->sa_data, + min(p->tap_peer.sa.sa_len, sa->sa_len))) return (p); } return (NULL); } struct tcp_ao_peer * -tcp_ao_peer_add(struct tcp_ao_cb *tac, struct tcp_ao_sopt *tao) +tcp_ao_peer_add(struct tcp_ao_cb *tac, struct sockaddr *sa) { struct tcp_ao_peer *p; - if ((p = tcp_ao_peer_find(tac, tao->tao_peer)) == NULL) { + if ((p = tcp_ao_peer_find(tac, sa)) == NULL) { if ((p = malloc(sizeof(*p), M_TCPAO, M_NOWAIT)) == NULL) return (p); p->tap_flags = 0; - bcopy(tao->tao_peer, p->tac_peer, tao->tao_peer.sa_len); - SLIST_INIT(&p->tak_keys); + bcopy(sa, &p->tap_peer, sa->sa_len); + SLIST_INIT(&p->tap_keys); } - LIST_INSERT_HEAD(&tap->tap_peers, p); + LIST_INSERT_HEAD(&tac->tac_peers, p, tap_entry); return (p); } @@ -188,7 +251,7 @@ tcp_ao_peer_del(struct tcp_ao_cb *tac, s { tcp_ao_key_flush(tap); - LIST_REMOVE(tap, tap_list); + LIST_REMOVE(tap, tap_entry); free(tap, M_TCPAO); return (0); } @@ -198,7 +261,7 @@ tcp_ao_peer_flush(struct tcp_ao_cb *tac) { struct tcp_ao_peer *p, *p2; - SLIST_FOREACH_SAFE(p, tac->tac_peers, entries, p2) { + LIST_FOREACH_SAFE(p, &tac->tac_peers, tap_entry, p2) { tcp_ao_key_flush(p); free(p, M_TCPAO); } @@ -218,12 +281,12 @@ tcp_ao_key_find(struct tcp_ao_peer *tap, } struct tcp_ao_key * -tcp_ao_key_add(struct tcp_ao_peer *tap, struct tcp_so_sopt *tao, uint8_t keylen) +tcp_ao_key_add(struct tcp_ao_peer *tap, struct tcp_ao_sopt *tao, uint8_t keylen) { struct tcp_ao_key *k; if ((k = tcp_ao_key_find(tap, tao->tao_keyidx)) != NULL) { - SLIST_REMOVE(&tap->tap_keys, k, entry, entry); + SLIST_REMOVE(&tap->tap_keys, k, tcp_ao_key, entry); free(k, M_TCPAO); } if ((k = malloc(sizeof(*k) + keylen, M_TCPAO, M_NOWAIT)) == NULL) @@ -231,22 +294,22 @@ tcp_ao_key_add(struct tcp_ao_peer *tap, k->keyidx = tao->tao_keyidx; k->keyflags = 0; - k->keyalgo = tao->tao_keyalgo; + k->keyalgo = tao->tao_algo; k->keylen = keylen; bcopy(tao->tao_key, k->key, k->keylen); - SLIST_INSERT_HEAD(&tap->tap_keys, k); + SLIST_INSERT_HEAD(&tap->tap_keys, k, entry); return (k); } int -struct tcp_ao_key_del(struct tcp_ao_peer *tap, uint8_t keyidx) +tcp_ao_key_del(struct tcp_ao_peer *tap, uint8_t keyidx) { struct tcp_ao_key *k, *k2; - SLIST_FOREACH_SAFE(k, &tap->tap_keys, entries, k2) { + SLIST_FOREACH_SAFE(k, &tap->tap_keys, entry, k2) { if (k->keyidx == keyidx) { - SLIST_REMOVE(&tap->tap_keys, entries, entries); + SLIST_REMOVE(&tap->tap_keys, k, tcp_ao_key, entry); free(k, M_TCPAO); return (0); } @@ -259,7 +322,7 @@ tcp_ao_key_flush(struct tcp_ao_peer *tap { struct tcp_ao_key *k, *k2; - SLIST_FOREACH_SAFE(k, &tap->tap_keys, entries, k2) + SLIST_FOREACH_SAFE(k, &tap->tap_keys, entry, k2) free(k, M_TCPAO); SLIST_INIT(&tap->tap_keys); } @@ -273,16 +336,20 @@ tcp_ao_peer_clone(struct tcpcb *tp1, str if ((p1 = tcp_ao_peer_find(tp1->t_ao, sa)) == NULL) return (0); - if (tcp_ao_cb_alloc(tp2) != 0) + if ((tp2->t_ao = tcp_ao_cb_alloc()) == NULL) return (ENOMEM); - bcopy(p1, p2, malloc(sizeof(*p2)); - SLIST_INIT(&p2->tak_keys); + if ((p2 = tcp_ao_peer_add(tp2->t_ao, sa)) == NULL) + return (ENOMEM); + + bcopy(p1, p2, sizeof(*p2)); + + SLIST_INIT(&p2->tap_keys); SLIST_FOREACH(k1, &p1->tap_keys, entry) { if ((k2 = malloc(sizeof(*k2) + k1->keylen, M_TCPAO, M_NOWAIT)) == NULL) return (ENOMEM); bcopy(k1, k2, k1->keylen); - SLIST_INSERT_HEAD(&p2->tap_keys, k2); + SLIST_INSERT_HEAD(&p2->tap_keys, k2, entry); } return (0); } @@ -323,19 +390,30 @@ tcp_ao_cb_free(struct tcpcb *tp) /* * Context for key derivation. */ -union tcp_ao_kdf_ctx { - struct ip4 { - struct in_addr src, dst; - uint16_t sport, dport; - uint32_t irs, iss; - } ip4_ctx; - struct ip6 { - struct in6_addr src, dst; - uint16_t sport, dport; - uint32_t irs, iss; - } ip6_ctx; +struct tcp_ao_kdf_ctx { + union { + struct ip4 { + struct in_addr src, dst; + uint16_t sport, dport; + uint32_t irs, iss; + } ip4; + struct ip6 { + struct in6_addr src, dst; + uint16_t sport, dport; + uint32_t irs, iss; + } ip6; + } tuple; int len; }; +#define ip4_ctx tuple.ip4 +#define ip6_ctx tuple.ip6 + +static int tcp_ao_kdf_hmac(struct tcp_ao_key *tak, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tctx); +static int tcp_ao_kdf_cmac(struct tcp_ao_key *tak, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tctx); +static int tcp_ao_kdf_md5(struct tcp_ao_key *tak, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tctx); /* * Key derivation for sessions and the derived master keys. @@ -344,70 +422,70 @@ union tcp_ao_kdf_ctx { * EINVAL = invalid input, typically insufficient length * other = key derivation failed */ -static int +int tcp_ao_kdf(struct in_conninfo *inc, struct tcphdr *th, uint8_t *out, - int outlen) + int outlen, struct tcp_ao_key *tak) { int error = 0; - struct tcp_ao_kdf_ctx tak; + struct tcp_ao_kdf_ctx ctx; /* Fill in context for traffic keys. */ switch (inc->inc_flags & INC_ISIPV6) { case 0: - tak.ip4_ctx.src = inc->ie_faddr; - tak.ip4_ctx.dst = inc->ie_laddr; - tak.ip4_ctx.irs = htonl(th->th_ack); - tak.ip4_ctx.iss = htonl(th->th_seq); - tak.len = sizeof(tak.ip4_ctx); + ctx.ip4_ctx.src = inc->inc_ie.ie_faddr; + ctx.ip4_ctx.dst = inc->inc_ie.ie_laddr; + ctx.ip4_ctx.irs = htonl(th->th_ack); + ctx.ip4_ctx.iss = htonl(th->th_seq); + ctx.len = sizeof(ctx.ip4_ctx); break; case INC_ISIPV6: - tak.ip6_ctx.src = inc->ie6_faddr; - tak.ip6_ctx.dst = inc->ie6_laddr; - tak.ip6_ctx.irs = htonl(th->th_ack); - tak.ip6_ctx.iss = htonl(th->th_seq); - tak.len = sizeof(tak.ip6_ctx); + ctx.ip6_ctx.src = inc->inc_ie.ie6_faddr; + ctx.ip6_ctx.dst = inc->inc_ie.ie6_laddr; + ctx.ip6_ctx.irs = htonl(th->th_ack); + ctx.ip6_ctx.iss = htonl(th->th_seq); + ctx.len = sizeof(ctx.ip6_ctx); break; default: error = EINVAL; goto out; } - switch (kdf) { - case TCP_AO_HMAC_SHA_1_96: - error = tcp_ao_kdf_hmac(key, keylen, out, outlen, &tak); + switch (tak->keyalgo) { + case TAO_ALGO_HMAC_SHA_1_96: + error = tcp_ao_kdf_hmac(tak, out, outlen, &ctx); break; - case TCP_AO_AES_128_CMAC_96: - error = tcp_ao_kdf_cmac(key, keylen, out, outlen, &tak); + case TAO_ALGO_AES_128_CMAC_96: + error = tcp_ao_kdf_cmac(tak, out, outlen, &ctx); break; - case TCP_AO_TCPMD5: - error = tcp_ao_kdf_cmac(key, keylen, out, outlen, &tak); + case TAO_ALGO_MD5SIG: + error = tcp_ao_kdf_md5(tak, out, outlen, &ctx); break; default: error = EINVAL; } if (error) goto out; - +out: return (error); } static int -tcp_ao_kdf_hmac(uint8_t *key, int keylen , uint8_t *out, int outlen, - struct tcp_ao_kdf_ctx *tak) +tcp_ao_kdf_hmac(struct tcp_ao_key *tak, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tctx) { - HMAC_SHA_CTX ctx; + HMAC_SHA1_CTX ctx; uint8_t res[SHA1_DIGEST_LENGTH]; char *label = "TCP-AO"; int error = 0; uint8_t i; - for (i = 0; outlen > 0; outlen -= SHA1_DIGEST_LENGTH, i++) { - HMAC_SHA1_Init(&ctx, key, keylen); + for (i = 1; outlen > 0; outlen -= SHA1_DIGEST_LENGTH, i++) { + HMAC_SHA1_Init(&ctx, tak->key, tak->keylen); HMAC_SHA1_Update(&ctx, &i, sizeof(i)); HMAC_SHA1_Update(&ctx, label, sizeof(*label)); - if (tak != NULL) - HMAC_SHA1_Update(&ctx, tak, tak->len); + if (tctx != NULL) + HMAC_SHA1_Update(&ctx, (uint8_t *)tctx, tctx->len); HMAC_SHA1_Final(res, &ctx); bcopy(res, out, min(outlen, SHA1_DIGEST_LENGTH)); @@ -417,32 +495,34 @@ tcp_ao_kdf_hmac(uint8_t *key, int keylen } static int -tcp_ao_kdf_cmac(uint8_t *key, int keylen, uint8_t *out, int outlen, - struct tcp_ao_kdf_ctx *tak) +tcp_ao_kdf_cmac(struct tcp_ao_key *tak, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tctx) { AES_CMAC_CTX ctx; uint8_t res[AES_CMAC_DIGEST_LENGTH]; uint8_t zero[AES_CMAC_KEY_LENGTH]; + char *label = "TCP-AO"; int error = 0; + uint8_t i; - if (tak == NULL) { + if (tctx == NULL) { bzero(zero, sizeof(*zero)); AES_CMAC_Init(&ctx); AES_CMAC_SetKey(&ctx, zero); - AES_CMAC_Update(&ctx, key, keylen); + AES_CMAC_Update(&ctx, tak->key, tak->keylen); AES_CMAC_Final(res, &ctx); bcopy(res, out, min(outlen, AES_CMAC_DIGEST_LENGTH)); } - if (keylen != AES_CMAC_KEY_LENGTH) + if (tak->keylen != AES_CMAC_KEY_LENGTH) return (EINVAL); - for (i = 0; outlen > 0; outlen -= AES_CMAC_DIGEST_LENGTH, i++) { + for (i = 1; outlen > 0; outlen -= AES_CMAC_DIGEST_LENGTH, i++) { AES_CMAC_Init(&ctx); - AES_CMAC_SetKey(&ctx, key); + AES_CMAC_SetKey(&ctx, tak->key); AES_CMAC_Update(&ctx, &i, sizeof(i)); AES_CMAC_Update(&ctx, label, sizeof(*label)); - AES_CMAC_Update(&ctx, tak, tak->len); + AES_CMAC_Update(&ctx, (uint8_t *)tctx, tctx->len); AES_CMAC_Final(res, &ctx); bcopy(res, out, min(outlen, AES_CMAC_DIGEST_LENGTH)); @@ -452,10 +532,10 @@ tcp_ao_kdf_cmac(uint8_t *key, int keylen } static int -tcp_ao_kfd_md5(uint8_t *key, int keylen, uint8_t *out, int outlen, - struct tcp_ao_kdf_ctx *tak) +tcp_ao_kdf_md5(struct tcp_ao_key *tak, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tctx) { - /* XXX: No key derivation happens. */ + /* XXX: No key derivation is done. */ return (0); } @@ -478,7 +558,7 @@ struct tcp_ao_pseudo { struct tcp_ao_thopt tap_th; } tap_ip; struct tap_ip6 { - struct ip6_phdr tap_ph6; + struct ip6pseudo tap_ph6; struct tcp_ao_thopt tap_th; } tap_ip6; } tap; @@ -488,11 +568,20 @@ struct tcp_ao_pseudo { #define tap4 tap.tap_ip #define tap6 tap.tap_ip6 +#if 0 /* Convenient functions not yet in existence. */ ip_hdr2pseudo(struct ip *ip, struct ippseudo *ipp); ip6_hdr2pseudo(struct ip6_hdr *ip6, struct ip6pseudo *ipp6); ip_inc2pseudo(struct in_conninfo *inc, struct ippseudo *ipp); ip6_inc2pseudo(struct in_conninfo *inc, struct ip6pseudo *ipp6); +#endif + +static int tcp_ao_sha1(struct tcp_ao_cb *tac, struct tcp_ao_pseudo *ph, + struct mbuf *m, int moff, int mlen, uint8_t *hash); +static int tcp_ao_cmac(struct tcp_ao_cb *tac, struct tcp_ao_pseudo *ph, + struct mbuf *m, int moff, int mlen, uint8_t *hash); +static int tcp_ao_md5(struct tcp_ao_cb *tac, struct tcp_ao_pseudo *ph, + struct mbuf *m, int moff, int mlen, uint8_t *hash); /* * Computation the authentication hash and return the result of the hash @@ -501,33 +590,44 @@ ip6_inc2pseudo(struct in_conninfo *inc, * EAUTH = authentication failed * other = authentication failed */ -static int -tcp_ao_mac(struct tcpcb *tp, struct tcp_ao_key *tk, struct in_conninfo *inc, +int +tcp_ao_mac(struct tcpcb *tp, struct tcp_ao_cb *tac, struct in_conninfo *inc, struct tcphdr *th, struct tcpopt *to, struct mbuf *m) { int moff, mlen, thlen; struct tcp_ao_pseudo ph; struct tcp_ao_thopt *tho; - uint8_t hash[MAXHASHLEN]; + uint8_t hash[100]; + int error; /* * Set up the virtual sequence number extension that is part of * the authentication hash. */ if (tp != NULL) - ph.tap_sne = tp->t_ao->tao_sne; + ph.tap_sne = tp->t_ao->tac_sne; else ph.tap_sne = 0; /* Fill in pseudo headers. */ switch(inc->inc_flags & INC_ISIPV6) { case 0: - ip_inc2pseudo(inc, &ph.tap4.tap_ph4); + /* ip_inc2pseudo(inc, &ph.tap4.tap_ph4); */ + ph.tap4.tap_ph4.ippseudo_src = inc->inc_faddr; + ph.tap4.tap_ph4.ippseudo_dst = inc->inc_laddr; + ph.tap4.tap_ph4.ippseudo_pad = 0; + ph.tap4.tap_ph4.ippseudo_p = IPPROTO_TCP; + ph.tap4.tap_ph4.ippseudo_len = m->m_pkthdr.len; ph.tap_len += sizeof(ph.tap4.tap_ph4); tho = &ph.tap4.tap_th; break; case INC_ISIPV6: - ip6_hdr2pseudo(inc, &ph.tap6.tap_ph6); + /* ip6_hdr2pseudo(inc, &ph.tap6.tap_ph6); */ + ph.tap6.tap_ph6.ip6pseudo_src = inc->inc6_faddr; + ph.tap6.tap_ph6.ip6pseudo_dst = inc->inc6_laddr; + ph.tap6.tap_ph6.ip6pseudo_len = m->m_pkthdr.len; + ph.tap6.tap_ph6.ip6pseudo_pad = 0; + ph.tap6.tap_ph6.ip6pseudo_p = IPPROTO_TCP; ph.tap_len += sizeof(ph.tap6.tap_ph6); tho = &ph.tap6.tap_th; break; @@ -544,22 +644,22 @@ tcp_ao_mac(struct tcpcb *tp, struct tcp_ /* Zero out checksum and mac field and swap to network byte order. */ tho->th.th_sum = 0; - bzero(&tho->tho + (to->to_signature - (th + 1)), to->to_siglen); - tcp_fields_to_net(&tho); + bzero(tho->tho + (to->to_signature - (u_char *)(th + 1)), to->to_siglen); + /* tcp_fields_to_net(&tho); */ /* Set up the mbuf length fields. */ moff = thlen; mlen = m_length(m, NULL) - thlen; - switch(tk->algo) { - case TCP_AO_HMAC_SHA_1_96: - error = tcp_ao_sha1(tk->key, ph, m, moff, mlen, hash); + switch(tac->tac_algo) { + case TAO_ALGO_HMAC_SHA_1_96: + error = tcp_ao_sha1(tac, &ph, m, moff, mlen, hash); break; - case TCP_AO_AES_128_CMAC_96: - error = tcp_ao_cmac(tk->key, ph, m, moff, mlen, hash); + case TAO_ALGO_AES_128_CMAC_96: + error = tcp_ao_cmac(tac, &ph, m, moff, mlen, hash); break; - case TCP_AO_TCPMD5: - error = tcp_ao_md5(tk->key, ph, m, moff, mlen, hash); + case TAO_ALGO_MD5SIG: + error = tcp_ao_md5(tac, &ph, m, moff, mlen, hash); break; default: error = EINVAL; @@ -569,7 +669,7 @@ tcp_ao_mac(struct tcpcb *tp, struct tcp_ goto out; /* Compare result to segment signature. */ - if (bcmp(hash, to->to_signature, tk->tk_hashlen)); + if (bcmp(hash, to->to_signature, to->to_siglen)) error = EAUTH; out: @@ -585,21 +685,28 @@ out: /* * Compute RFC5925+RFC5926 compliant HMAC-SHA1 authentication MAC of * a tcp segment. - * XXX: HMAC_SHA1 doesn't exist yet. */ static int -tcp_ao_sha1(uint32_t key[static SHA1_BLOCK_LENGTH], struct pseudo *ph, - struct mbuf *m, int moff, int mlen, uint8_t hash[static SHA1_RESULTLEN]) +HMAC_SHA1_Update_x(void *ctx, void *data, u_int len) +{ + + HMAC_SHA1_Update(ctx, data, len); + return (0); +} + +static int +tcp_ao_sha1(struct tcp_ao_cb *tac, struct tcp_ao_pseudo *ph, struct mbuf *m, + int moff, int mlen, uint8_t *hash) { HMAC_SHA1_CTX ctx; int error = 0; - HMAC_SHA1_Init(&ctx, key, SHA1_BLOCK_LENGTH); + HMAC_SHA1_Init(&ctx, tac->tac_skey.hmac, SHA1_BLOCK_LENGTH); /* Pseudo header. */ - HMAC_SHA1_Update(&ctx, ph, ph->tap_len); + HMAC_SHA1_Update(&ctx, (uint8_t *)ph, ph->tap_len); - error = m_apply(m, moff, mlen, HMAC_SHA1_Update, &ctx); + error = m_apply(m, moff, mlen, HMAC_SHA1_Update_x, &ctx); if (error) goto out; @@ -614,18 +721,26 @@ out: * a tcp segment. */ static int -tcp_ao_cmac(uint32_t key[static AES_CMAC_KEY_LENGTH], struct pseudo *ph, - struct mbuf *m, int moff, int mlen, uint8_t hash[static AES_CMAC_DIGEST_LENGTH]) +AES_CMAC_Update_x(void *ctx, void *data, u_int len) +{ + + AES_CMAC_Update_x(ctx, data, len); + return (0); +} + +static int +tcp_ao_cmac(struct tcp_ao_cb *tac, struct tcp_ao_pseudo *ph, struct mbuf *m, + int moff, int mlen, uint8_t *hash) { AES_CMAC_CTX ctx; int error = 0; AES_CMAC_Init(&ctx); - AES_CMAC_SetKey(&ctx, key); + AES_CMAC_SetKey(&ctx, tac->tac_skey.cmac); - AES_CMAC_Update(&ctx, ph, ph->tap_len); + AES_CMAC_Update(&ctx, (uint8_t *)ph, ph->tap_len); - error = m_apply(m, moff, mlen, AES_CMAC_Update, &ctx); + error = m_apply(m, moff, mlen, AES_CMAC_Update_x, &ctx); if (error) goto out; @@ -641,27 +756,35 @@ out: * are not included. */ static int -tcp_ao_md5(uint32_t key[static MD5_BLOCK_LENGTH], struct pseudo *ph, - struct mbuf *m, int moff, int mlen, uint8_t hash[static MD5_DIGEST_LENGTH]) +MD5Update_x(void *ctx, void *data, u_int len) +{ + + MD5Update(ctx, data, len); + return (0); +} + +static int +tcp_ao_md5(struct tcp_ao_cb *tac, struct tcp_ao_pseudo *ph, struct mbuf *m, + int moff, int mlen, uint8_t hash[static MD5_DIGEST_LENGTH]) { MD5_CTX ctx; int error = 0, len; MD5Init(&ctx); - len = ph->tap_len - sizeof(*ph->tap_sne) - sizeof(struct tcp_ao_thopt); + len = ph->tap_len - sizeof(ph->tap_sne) - sizeof(struct tcp_ao_thopt); len += sizeof(struct tcphdr); - MD5Update(&ctx, &ph->tap, len; + MD5Update(&ctx, &ph->tap, len); - error = m_apply(m, moff, mlen, AES_CMAC_Update, &ctx); + error = m_apply(m, moff, mlen, MD5Update_x, &ctx); if (error) goto out; - MD5Update(&ctx, key, MD5_BLOCK_LENGTH); + MD5Update(&ctx, tac->tac_skey.md5, MD5_BLOCK_LENGTH); MD5Final(hash, &ctx); out: - bzero(%ctx, sizeof(ctx)); + bzero(&ctx, sizeof(ctx)); return (error); } Modified: user/andre/tcp-ao/sys/netinet/tcp_ao.h ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_ao.h Thu Apr 11 15:55:52 2013 (r249365) +++ user/andre/tcp-ao/sys/netinet/tcp_ao.h Thu Apr 11 15:59:18 2013 (r249366) @@ -64,6 +64,9 @@ * once stable. */ +#ifndef _TCP_AO_H_ +#define _TCP_AO_H_ + MALLOC_DECLARE(M_TCPAO); /* @@ -99,8 +102,8 @@ struct tcp_ao_sopt { * MAC and KDF pairs for the tao_algo field. */ #define TAO_ALGO_MD5SIG 1 /* legacy compatibility */ -#define TAO_ALGO_HMAC-SHA-1-96 2 /* RFC5926, Section 2.2 */ -#define TAO_ALGO_AES-128-CMAC-96 3 /* RFC5926, Section 2.2 */ +#define TAO_ALGO_HMAC_SHA_1_96 2 /* RFC5926, Section 2.2 */ +#define TAO_ALGO_AES_128_CMAC_96 3 /* RFC5926, Section 2.2 */ /* * In kernel storage of the key information. @@ -110,8 +113,9 @@ struct tcp_ao_cb { union { uint8_t md5[MD5_DIGEST_LENGTH]; uint8_t hmac[SHA1_DIGEST_LENGTH]; - uint8_t cmac[AES_CMAC_LENGTH]; + uint8_t cmac[AES_CMAC_DIGEST_LENGTH]; } tac_skey, tac_rkey; + uint32_t tac_sne; LIST_HEAD(tac_peer, tcp_ao_peer) tac_peers; }; @@ -119,9 +123,9 @@ struct tcp_ao_peer { LIST_ENTRY(tcp_ao_peer) tap_entry; uint16_t tap_flags; union { - sockaddr sa; - sockaddr_in sin4; - sockaddr_in6 sin6; + struct sockaddr sa; + struct sockaddr_in sin4; + struct sockaddr_in6 sin6; } tap_peer; uint8_t tap_activekey; SLIST_HEAD(tap_key, tcp_ao_key) tap_keys; @@ -136,3 +140,9 @@ struct tcp_ao_key { uint8_t key[]; /* after base64_decode */ }; +int tcp_ao_kdf(struct in_conninfo *, struct tcphdr *, uint8_t *, int, + struct tcp_ao_key *); +int tcp_ao_mac(struct tcpcb *, struct tcp_ao_cb *, struct in_conninfo *, + struct tcphdr *, struct tcpopt *, struct mbuf *); + +#endif Modified: user/andre/tcp-ao/sys/netinet/tcp_var.h ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_var.h Thu Apr 11 15:55:52 2013 (r249365) +++ user/andre/tcp-ao/sys/netinet/tcp_var.h Thu Apr 11 15:59:18 2013 (r249366) @@ -208,7 +208,7 @@ struct tcpcb { u_int t_keepintvl; /* interval between keepalives */ u_int t_keepcnt; /* number of keepalives before close */ - struct tcp_ao_inp *t_ao; /* TCP-AO control functions */ + struct tcp_ao_cb *t_ao; /* TCP-AO control functions */ uint32_t t_ispare[8]; /* 5 UTO, 3 TBD */ void *t_pspare2[3]; /* 3 TBD */ From owner-svn-src-user@FreeBSD.ORG Thu Apr 11 22:38:15 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E3FF8BEF; Thu, 11 Apr 2013 22:38:15 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wi0-x229.google.com (mail-wi0-x229.google.com [IPv6:2a00:1450:400c:c05::229]) by mx1.freebsd.org (Postfix) with ESMTP id 0A6021FBB; Thu, 11 Apr 2013 22:38:11 +0000 (UTC) Received: by mail-wi0-f169.google.com with SMTP id c10so1122038wiw.2 for ; Thu, 11 Apr 2013 15:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=tYsesWq0XGe7M/P2FUobQX37hKwfaFSIvWHHoWZn/cw=; b=h6YfOL4/O3x61QW64FkL+mzUbaCsXUyx4cvv195yCcyTbPPxAHuIV9Bkkqs1zfhUda Dg3kEh2Nhu/TUspv/bh8tYOqS6kh62UsD8nuaMOWYNOfSuI0FZWNhVHtLQjJPt+xbI5t 6b05pnederRcf6k/uYhWh+3QYtD3hGrqvWzAESnsedGPGvzaAIJoHNrVjBUE0C6VxigE Jh16q9We5FNRGXoWCQ4bn8cB85O7Wu4ayxXF5WxI8Sr+rTR+4q6i+OsskibkCgHa4Ixl HXktJSnalLWFQxrVwoMSpGgu7RoQ3g/FGQa29f3sXYHniemrzQ9XZit95LNRdQBVodfY 3ZZw== MIME-Version: 1.0 X-Received: by 10.194.88.138 with SMTP id bg10mr13831886wjb.13.1365719891133; Thu, 11 Apr 2013 15:38:11 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.121.136 with HTTP; Thu, 11 Apr 2013 15:38:11 -0700 (PDT) In-Reply-To: <201304111555.r3BFtq0g019604@svn.freebsd.org> References: <201304111555.r3BFtq0g019604@svn.freebsd.org> Date: Thu, 11 Apr 2013 15:38:11 -0700 X-Google-Sender-Auth: 2SQAhX_tga5TGZCP8ezfxg5OHfU Message-ID: Subject: Re: svn commit: r249365 - in user/andre/tcp-ao/sys: conf crypto crypto/cmac crypto/hmac crypto/rijndael From: Adrian Chadd To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 22:38:16 -0000 Are you planning on making TCP-AO compile time optional? Adrian On 11 April 2013 08:55, Andre Oppermann wrote: > Author: andre > Date: Thu Apr 11 15:55:52 2013 > New Revision: 249365 > URL: http://svnweb.freebsd.org/changeset/base/249365 > > Log: > Adjust the HMAC and CMAC functions to the FreeBSD environment > and include them into the kernel build in preparation for use > in the TCP-AO code. > > Note that we do not have explicit_bzero() so the compiler may > optimize away the bzero() to wipe out key storage on the stack > before returning. > > Sponsored by: Juniper Networks > > Modified: > user/andre/tcp-ao/sys/conf/files > user/andre/tcp-ao/sys/crypto/cmac/cmac.c > user/andre/tcp-ao/sys/crypto/cmac/cmac.h > user/andre/tcp-ao/sys/crypto/hmac/hmac.c > user/andre/tcp-ao/sys/crypto/hmac/hmac.h > user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c > user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h > user/andre/tcp-ao/sys/crypto/sha1.h > > Modified: user/andre/tcp-ao/sys/conf/files > ============================================================================== > --- user/andre/tcp-ao/sys/conf/files Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/conf/files Thu Apr 11 15:55:52 2013 (r249365) > @@ -541,8 +541,8 @@ crypto/sha1.c optional carp | crypto | > netgraph_mppc_encryption | sctp > crypto/sha2/sha2.c optional crypto | geom_bde | ipsec | random | \ > sctp | zfs > -crypto/cmac/cmac.c optional crypto | netinet | netinet6 > -crypto/hmac/hmac.c optional crypto | netinet | netinet6 > +crypto/cmac/cmac.c optional inet | inet6 > +crypto/hmac/hmac.c optional inet | inet6 > ddb/db_access.c optional ddb > ddb/db_break.c optional ddb > ddb/db_capture.c optional ddb > @@ -3116,6 +3116,7 @@ netinet/tcp_timer.c optional inet | ine > netinet/tcp_timewait.c optional inet | inet6 > netinet/tcp_usrreq.c optional inet | inet6 > netinet/udp_usrreq.c optional inet | inet6 > +netinet/tcp_ao.c optional inet | inet6 > netinet/libalias/alias.c optional libalias inet | netgraph_nat inet > netinet/libalias/alias_db.c optional libalias inet | netgraph_nat inet > netinet/libalias/alias_mod.c optional libalias | netgraph_nat > > Modified: user/andre/tcp-ao/sys/crypto/cmac/cmac.c > ============================================================================== > --- user/andre/tcp-ao/sys/crypto/cmac/cmac.c Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/crypto/cmac/cmac.c Thu Apr 11 15:55:52 2013 (r249365) > @@ -24,8 +24,10 @@ > #include > #include > > -#include > -#include > +#include > +#include > + > +#define explicit_bzero(a, b) bzero(a, b) > > #define LSHIFT(v, r) do { \ > int i; \ > > Modified: user/andre/tcp-ao/sys/crypto/cmac/cmac.h > ============================================================================== > --- user/andre/tcp-ao/sys/crypto/cmac/cmac.h Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/crypto/cmac/cmac.h Thu Apr 11 15:55:52 2013 (r249365) > @@ -19,6 +19,10 @@ > #ifndef _CMAC_H_ > #define _CMAC_H_ > > +#ifndef _RIJNDAEL_H_ > +#include > +#endif > + > #define AES_CMAC_KEY_LENGTH 16 > #define AES_CMAC_DIGEST_LENGTH 16 > > > Modified: user/andre/tcp-ao/sys/crypto/hmac/hmac.c > ============================================================================== > --- user/andre/tcp-ao/sys/crypto/hmac/hmac.c Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/crypto/hmac/hmac.c Thu Apr 11 15:55:52 2013 (r249365) > @@ -24,10 +24,12 @@ > #include > #include > > -#include > +#include > #include > -#include > -#include > +#include > +#include > + > +#define explicit_bzero(a, b) bzero(a, b) > > void > HMAC_MD5_Init(HMAC_MD5_CTX *ctx, const u_int8_t *key, u_int key_len) > @@ -144,9 +146,9 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, c > int i; > > if (key_len > SHA256_BLOCK_LENGTH) { > - SHA256Init(&ctx->ctx); > - SHA256Update(&ctx->ctx, key, key_len); > - SHA256Final(ctx->key, &ctx->ctx); > + SHA256_Init(&ctx->ctx); > + SHA256_Update(&ctx->ctx, key, key_len); > + SHA256_Final(ctx->key, &ctx->ctx); > ctx->key_len = SHA256_DIGEST_LENGTH; > } else { > bcopy(key, ctx->key, key_len); > @@ -158,8 +160,8 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, c > for (i = 0; i < SHA256_BLOCK_LENGTH; i++) > k_ipad[i] ^= 0x36; > > - SHA256Init(&ctx->ctx); > - SHA256Update(&ctx->ctx, k_ipad, SHA256_BLOCK_LENGTH); > + SHA256_Init(&ctx->ctx); > + SHA256_Update(&ctx->ctx, k_ipad, SHA256_BLOCK_LENGTH); > > explicit_bzero(k_ipad, sizeof k_ipad); > } > @@ -167,7 +169,7 @@ HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, c > void > HMAC_SHA256_Update(HMAC_SHA256_CTX *ctx, const u_int8_t *data, u_int len) > { > - SHA256Update(&ctx->ctx, data, len); > + SHA256_Update(&ctx->ctx, data, len); > } > > void > @@ -176,17 +178,17 @@ HMAC_SHA256_Final(u_int8_t digest[SHA256 > u_int8_t k_opad[SHA256_BLOCK_LENGTH]; > int i; > > - SHA256Final(digest, &ctx->ctx); > + SHA256_Final(digest, &ctx->ctx); > > bzero(k_opad, SHA256_BLOCK_LENGTH); > bcopy(ctx->key, k_opad, ctx->key_len); > for (i = 0; i < SHA256_BLOCK_LENGTH; i++) > k_opad[i] ^= 0x5c; > > - SHA256Init(&ctx->ctx); > - SHA256Update(&ctx->ctx, k_opad, SHA256_BLOCK_LENGTH); > - SHA256Update(&ctx->ctx, digest, SHA256_DIGEST_LENGTH); > - SHA256Final(digest, &ctx->ctx); > + SHA256_Init(&ctx->ctx); > + SHA256_Update(&ctx->ctx, k_opad, SHA256_BLOCK_LENGTH); > + SHA256_Update(&ctx->ctx, digest, SHA256_DIGEST_LENGTH); > + SHA256_Final(digest, &ctx->ctx); > > explicit_bzero(k_opad, sizeof k_opad); > } > > Modified: user/andre/tcp-ao/sys/crypto/hmac/hmac.h > ============================================================================== > --- user/andre/tcp-ao/sys/crypto/hmac/hmac.h Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/crypto/hmac/hmac.h Thu Apr 11 15:55:52 2013 (r249365) > @@ -19,6 +19,10 @@ > #ifndef _HMAC_H_ > #define _HMAC_H_ > > +#include > +#include > +#include > + > typedef struct _HMAC_MD5_CTX { > MD5_CTX ctx; > u_int8_t key[MD5_BLOCK_LENGTH]; > @@ -32,7 +36,7 @@ typedef struct _HMAC_SHA1_CTX { > } HMAC_SHA1_CTX; > > typedef struct _HMAC_SHA256_CTX { > - SHA2_CTX ctx; > + SHA256_CTX ctx; > u_int8_t key[SHA256_BLOCK_LENGTH]; > u_int key_len; > } HMAC_SHA256_CTX; > > Modified: user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c > ============================================================================== > --- user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/crypto/rijndael/rijndael-api.c Thu Apr 11 15:55:52 2013 (r249365) > @@ -45,6 +45,13 @@ rijndael_set_key(rijndael_ctx *ctx, cons > } > > void > +rijndael_set_key_enc_only(rijndael_ctx *ctx, const u_char *key, int bits) > +{ > + > + ctx->Nr = rijndaelKeySetupEnc(ctx->ek, key, bits); > +} > + > +void > rijndael_decrypt(const rijndael_ctx *ctx, const u_char *src, u_char *dst) > { > > > Modified: user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h > ============================================================================== > --- user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/crypto/rijndael/rijndael.h Thu Apr 11 15:55:52 2013 (r249365) > @@ -42,6 +42,7 @@ typedef struct { > } rijndael_ctx; > > void rijndael_set_key(rijndael_ctx *, const u_char *, int); > +void rijndael_set_key_enc_only(rijndael_ctx *, const u_char *, int); > void rijndael_decrypt(const rijndael_ctx *, const u_char *, u_char *); > void rijndael_encrypt(const rijndael_ctx *, const u_char *, u_char *); > > > Modified: user/andre/tcp-ao/sys/crypto/sha1.h > ============================================================================== > --- user/andre/tcp-ao/sys/crypto/sha1.h Thu Apr 11 14:45:43 2013 (r249364) > +++ user/andre/tcp-ao/sys/crypto/sha1.h Thu Apr 11 15:55:52 2013 (r249365) > @@ -68,5 +68,7 @@ typedef struct sha1_ctxt SHA1_CTX; > #endif /* _KERNEL */ > > #define SHA1_RESULTLEN (160/8) > +#define SHA1_BLOCK_LENGTH 64 > +#define SHA1_DIGEST_LENGTH SHA1_RESULTLEN > > #endif /*_NETINET6_SHA1_H_*/ From owner-svn-src-user@FreeBSD.ORG Fri Apr 12 06:12:49 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D771E828 for ; Fri, 12 Apr 2013 06:12:49 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 77218112A for ; Fri, 12 Apr 2013 06:12:49 +0000 (UTC) Received: (qmail 76116 invoked from network); 12 Apr 2013 07:19:47 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 12 Apr 2013 07:19:47 -0000 Message-ID: <5167A5DA.7050109@freebsd.org> Date: Fri, 12 Apr 2013 08:12:42 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r249365 - in user/andre/tcp-ao/sys: conf crypto crypto/cmac crypto/hmac crypto/rijndael References: <201304111555.r3BFtq0g019604@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2013 06:12:49 -0000 On 12.04.2013 00:38, Adrian Chadd wrote: > Are you planning on making TCP-AO compile time optional? I don't know yet. It's still some time until the code is fully functional and tested. At runtime it wont have any impact until an application installs the first key on a tcp socket. -- Andre From owner-svn-src-user@FreeBSD.ORG Fri Apr 12 07:04:02 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6E7ED199; Fri, 12 Apr 2013 07:04:02 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f45.google.com (mail-pb0-f45.google.com [209.85.160.45]) by mx1.freebsd.org (Postfix) with ESMTP id 3E69F1339; Fri, 12 Apr 2013 07:04:01 +0000 (UTC) Received: by mail-pb0-f45.google.com with SMTP id ro12so1262999pbb.18 for ; Fri, 12 Apr 2013 00:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=m2D8aghmooeYTCYCxld9YCQ0dcHbGric3354VRt61/o=; b=OKsAWzw9mw2P9zIunMnLOedDjYPbafYxRryY/WZFz4yo0mkVxkhMPxANKlSYD2/R3A GEF4xQoG5B7aXE/rZ/n+hXP+GWfQWx3QN+CKGImOONyAqeY56olNbhH1LLIJQ222hiRY ZStvD2Wm3kAQ+x8jUdC58t1wPNEnh7BP66L69tz72G8jG823Loy1IsI+FvKDRvD+bQJT BBTV2o6d7bZ49UGvmjHaZztoU9gTAXo6LYX6BlXXBjmwEUSI5FAR6XkVKSzDSIJ3D1Ie YA7b1QNDJyaZ4WQVVvpfzKY3VmqSwByxp2HN0c9aP2vZAehSmuaG3ibwQqaWazysDDuZ 2X4Q== MIME-Version: 1.0 X-Received: by 10.68.228.134 with SMTP id si6mr13307674pbc.24.1365750241256; Fri, 12 Apr 2013 00:04:01 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.70.81.97 with HTTP; Fri, 12 Apr 2013 00:04:00 -0700 (PDT) In-Reply-To: <5167A5DA.7050109@freebsd.org> References: <201304111555.r3BFtq0g019604@svn.freebsd.org> <5167A5DA.7050109@freebsd.org> Date: Fri, 12 Apr 2013 00:04:00 -0700 X-Google-Sender-Auth: CC1aigZrKLWmTwiWVF6X_k8ZpXc Message-ID: Subject: Re: svn commit: r249365 - in user/andre/tcp-ao/sys: conf crypto crypto/cmac crypto/hmac crypto/rijndael From: Adrian Chadd To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2013 07:04:02 -0000 On 11 April 2013 23:12, Andre Oppermann wrote: > I don't know yet. It's still some time until the code is > fully functional and tested. At runtime it wont have any > impact until an application installs the first key on a > tcp socket. I'm more worried about kernel size footprint with new features. I may not want this enabled on some of the tiny embedded platforms. Much like how I can't fit IPv6 into them at the present. :( Thanks, Adrian From owner-svn-src-user@FreeBSD.ORG Fri Apr 12 07:06:30 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3B6FF2CF for ; Fri, 12 Apr 2013 07:06:30 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id A61EB1348 for ; Fri, 12 Apr 2013 07:06:29 +0000 (UTC) Received: (qmail 76284 invoked from network); 12 Apr 2013 08:13:27 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 12 Apr 2013 08:13:27 -0000 Message-ID: <5167B26F.3020107@freebsd.org> Date: Fri, 12 Apr 2013 09:06:23 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r249365 - in user/andre/tcp-ao/sys: conf crypto crypto/cmac crypto/hmac crypto/rijndael References: <201304111555.r3BFtq0g019604@svn.freebsd.org> <5167A5DA.7050109@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2013 07:06:30 -0000 On 12.04.2013 09:04, Adrian Chadd wrote: > On 11 April 2013 23:12, Andre Oppermann wrote: > >> I don't know yet. It's still some time until the code is >> fully functional and tested. At runtime it wont have any >> impact until an application installs the first key on a >> tcp socket. > > I'm more worried about kernel size footprint with new features. It can easily be made a compile time option. > I may not want this enabled on some of the tiny embedded platforms. > Much like how I can't fit IPv6 into them at the present. :( Who needs IPv6 anyways? ;) -- Andre From owner-svn-src-user@FreeBSD.ORG Sat Apr 13 19:58:26 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 593DB646; Sat, 13 Apr 2013 19:58:26 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3ACF111C9; Sat, 13 Apr 2013 19:58:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3DJwPx9068969; Sat, 13 Apr 2013 19:58:25 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3DJwPMd068965; Sat, 13 Apr 2013 19:58:25 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201304131958.r3DJwPMd068965@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 13 Apr 2013 19:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249441 - in user/dchagin/lemul/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Apr 2013 19:58:26 -0000 Author: dchagin Date: Sat Apr 13 19:58:24 2013 New Revision: 249441 URL: http://svnweb.freebsd.org/changeset/base/249441 Log: Slightly rewrite the VDSO symbols lookup and relocation: - to be a less strictly when relocating symbols to allow adjust all of them; - split the LINUX_VDSO_SYM_DEFINE macro on two counterparts and declare the vdso symbol to allow direct use. Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c user/dchagin/lemul/sys/compat/linux/linux_vdso.c user/dchagin/lemul/sys/compat/linux/linux_vdso.h user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sat Apr 13 19:02:58 2013 (r249440) +++ user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sat Apr 13 19:58:24 2013 (r249441) @@ -225,9 +225,9 @@ struct linux32_ps_strings { u_int ps_nenvstr; /* the number of environment strings */ }; -LINUX_VDSO_SYM_DEFINE(linux32_sigcode); -LINUX_VDSO_SYM_DEFINE(linux32_rt_sigcode); -LINUX_VDSO_SYM_DEFINE(linux32_vsyscall); +LINUX_VDSO_SYM_INTPTR(linux32_sigcode); +LINUX_VDSO_SYM_INTPTR(linux32_rt_sigcode); +LINUX_VDSO_SYM_INTPTR(linux32_vsyscall); /* * If FreeBSD & Linux have a difference of opinion about what a trap @@ -270,9 +270,7 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY_32(pos, LINUX_AT_SYSINFO_EHDR, imgp->proc->p_sysent->sv_shared_page_base); - AUXARGS_ENTRY_32(pos, LINUX_AT_SYSINFO, - LINUX_VDSO_SYM_VALUE(linux32_vsyscall)); - + AUXARGS_ENTRY_32(pos, LINUX_AT_SYSINFO, linux32_vsyscall); AUXARGS_ENTRY_32(pos, LINUX_AT_HWCAP, cpu_feature); /* @@ -426,7 +424,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo * Build context to run handler in. */ regs->tf_rsp = PTROUT(fp); - regs->tf_rip = LINUX_VDSO_SYM_VALUE(linux32_rt_sigcode); + regs->tf_rip = linux32_rt_sigcode; regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; @@ -550,7 +548,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t * Build context to run handler in. */ regs->tf_rsp = PTROUT(fp); - regs->tf_rip = LINUX_VDSO_SYM_VALUE(linux32_sigcode); + regs->tf_rip = linux32_sigcode; regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; Modified: user/dchagin/lemul/sys/compat/linux/linux_vdso.c ============================================================================== --- user/dchagin/lemul/sys/compat/linux/linux_vdso.c Sat Apr 13 19:02:58 2013 (r249440) +++ user/dchagin/lemul/sys/compat/linux/linux_vdso.c Sat Apr 13 19:58:24 2013 (r249441) @@ -206,14 +206,7 @@ __elfN(linux_vdso_reloc)(struct sysentve if (sym->st_shndx == SHN_UNDEF || sym->st_shndx == SHN_ABS) continue; - - switch (ELF_ST_TYPE(sym->st_info)) { - case STT_OBJECT: - case STT_FUNC: - case STT_SECTION: - case STT_FILE: - sym->st_value += vdso_adjust; - } + sym->st_value += vdso_adjust; } } } @@ -239,11 +232,9 @@ __elfN(linux_vdso_lookup)(Elf_Ehdr *ehdr symcnt = shdr[__elfN(symtabindex)].sh_size / sizeof(*sym); for (i = 0; i < symcnt; ++i, ++sym) { - if (ELF_ST_TYPE(sym->st_info) != STT_FUNC) - continue; symname = strtab + sym->st_name; if (strncmp(vsym->symname, (char *)symname, vsym->size) == 0) { - vsym->value = (vm_offset_t)sym->st_value; + *vsym->ptr = (uintptr_t)sym->st_value; break; } } Modified: user/dchagin/lemul/sys/compat/linux/linux_vdso.h ============================================================================== --- user/dchagin/lemul/sys/compat/linux/linux_vdso.h Sat Apr 13 19:02:58 2013 (r249440) +++ user/dchagin/lemul/sys/compat/linux/linux_vdso.h Sat Apr 13 19:58:24 2013 (r249441) @@ -34,7 +34,7 @@ struct linux_vdso_sym { SLIST_ENTRY(linux_vdso_sym) sym; uint32_t size; - vm_offset_t value; + uintptr_t * ptr; char symname[]; }; @@ -44,16 +44,22 @@ void __elfN(linux_vdso_fixup)(struct sys void __elfN(linux_vdso_reloc)(struct sysentvec *, int); void __elfN(linux_vdso_sym_init)(struct linux_vdso_sym *); -#define LINUX_VDSO_SYM_DEFINE(name) \ -static struct linux_vdso_sym name = { \ - .symname = #name, \ - .size = sizeof(#name), \ - .value = 0 \ -}; \ -SYSINIT(__elfN(name ## _sym_init), SI_SUB_EXEC, \ - SI_ORDER_FIRST, __elfN(linux_vdso_sym_init), &name);\ -struct __hack +#define LINUX_VDSO_SYM_INTPTR(name) \ +uintptr_t name; \ +LINUX_VDSO_SYM_DEFINE(name) + +#define LINUX_VDSO_SYM_CHAR(name) \ +const char * name; \ +LINUX_VDSO_SYM_DEFINE(name) -#define LINUX_VDSO_SYM_VALUE(name) name.value \ +#define LINUX_VDSO_SYM_DEFINE(name) \ +static struct linux_vdso_sym name ## sym = { \ + .symname = #name, \ + .size = sizeof(#name), \ + .ptr = (uintptr_t *)&name \ +}; \ +SYSINIT(__elfN(name ## _sym_init), SI_SUB_EXEC, \ + SI_ORDER_FIRST, __elfN(linux_vdso_sym_init), &name ## sym); \ +struct __hack #endif /* _LINUX_VDSO_H_ */ Modified: user/dchagin/lemul/sys/i386/linux/linux_sysvec.c ============================================================================== --- user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Sat Apr 13 19:02:58 2013 (r249440) +++ user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Sat Apr 13 19:58:24 2013 (r249441) @@ -203,9 +203,9 @@ static int _bsd_to_linux_trapcode[] = { _bsd_to_linux_trapcode[(code)]: \ LINUX_T_UNKNOWN) -LINUX_VDSO_SYM_DEFINE(linux_sigcode); -LINUX_VDSO_SYM_DEFINE(linux_rt_sigcode); -LINUX_VDSO_SYM_DEFINE(linux_vsyscall); +LINUX_VDSO_SYM_INTPTR(linux_sigcode); +LINUX_VDSO_SYM_INTPTR(linux_rt_sigcode); +LINUX_VDSO_SYM_INTPTR(linux_vsyscall); /* * If FreeBSD & Linux have a difference of opinion about what a trap @@ -265,9 +265,7 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR, imgp->proc->p_sysent->sv_shared_page_base); - AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO, - LINUX_VDSO_SYM_VALUE(linux_vsyscall)); - + AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO, linux_vsyscall); AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); /* @@ -529,7 +527,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo * Build context to run handler in. */ regs->tf_esp = (int)fp; - regs->tf_eip = LINUX_VDSO_SYM_VALUE(linux_rt_sigcode); + regs->tf_eip = linux_rt_sigcode; regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; @@ -649,7 +647,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t * Build context to run handler in. */ regs->tf_esp = (int)fp; - regs->tf_eip = LINUX_VDSO_SYM_VALUE(linux_sigcode); + regs->tf_eip = linux_sigcode; regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; From owner-svn-src-user@FreeBSD.ORG Sat Apr 13 19:59:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D7BDC77E; Sat, 13 Apr 2013 19:59:55 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CAE1C11DB; Sat, 13 Apr 2013 19:59:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3DJxtnr069194; Sat, 13 Apr 2013 19:59:55 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3DJxtvf069191; Sat, 13 Apr 2013 19:59:55 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201304131959.r3DJxtvf069191@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 13 Apr 2013 19:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249442 - user/dchagin/lemul/sys/amd64/linux32 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Apr 2013 19:59:55 -0000 Author: dchagin Date: Sat Apr 13 19:59:54 2013 New Revision: 249442 URL: http://svnweb.freebsd.org/changeset/base/249442 Log: Put linux_platform into the vdso to avoid copying it onto the stack at every exec. Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_locore.s user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c user/dchagin/lemul/sys/amd64/linux32/linux32_vdso.lds.s Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_locore.s ============================================================================== --- user/dchagin/lemul/sys/amd64/linux32/linux32_locore.s Sat Apr 13 19:58:24 2013 (r249441) +++ user/dchagin/lemul/sys/amd64/linux32/linux32_locore.s Sat Apr 13 19:59:54 2013 (r249442) @@ -5,6 +5,12 @@ #include /* system call numbers */ +.data + + .globl linux_platform +linux_platform: + .asciz "i686" + .text .code32 Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sat Apr 13 19:58:24 2013 (r249441) +++ user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sat Apr 13 19:59:54 2013 (r249442) @@ -110,8 +110,6 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux m #define LINUX_SYS_linux_rt_sendsig 0 #define LINUX_SYS_linux_sendsig 0 -const char *linux_platform = "i686"; -static int linux_szplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; static char *linux_shared_page_mapping; @@ -228,6 +226,7 @@ struct linux32_ps_strings { LINUX_VDSO_SYM_INTPTR(linux32_sigcode); LINUX_VDSO_SYM_INTPTR(linux32_rt_sigcode); LINUX_VDSO_SYM_INTPTR(linux32_vsyscall); +LINUX_VDSO_SYM_CHAR(linux_platform); /* * If FreeBSD & Linux have a difference of opinion about what a trap @@ -256,11 +255,10 @@ elf_linux_fixup(register_t **stack_base, { Elf32_Auxargs *args; Elf32_Addr *base; - Elf32_Addr *pos, *uplatform; + Elf32_Addr *pos; struct linux32_ps_strings *arginfo; arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szplatform); KASSERT(curthread->td_proc == imgp->proc, ("unsafe elf_linux_fixup(), should be curproc")); @@ -295,7 +293,7 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); - AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); if (args->execfd != -1) AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY_32(pos, AT_NULL, 0); @@ -903,15 +901,8 @@ linux_copyout_strings(struct image_param * Also deal with signal trampoline code for this exec type. */ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - destp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform - - roundup((ARG_MAX - imgp->args->stringspace), - sizeof(char *)); - - /* - * Install LINUX_PLATFORM - */ - copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform), - linux_szplatform); + destp = (caddr_t)arginfo - SPARE_USRSPACE - + roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); /* * If we have a valid auxargs ptr, prepare some room @@ -1199,8 +1190,6 @@ linux_elf_modevent(module_t mod, int typ linux_proc_exec, NULL, 1000); linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - linux_szplatform = roundup(strlen(linux_platform) + 1, - sizeof(char *)); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); if (bootverbose) Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_vdso.lds.s ============================================================================== --- user/dchagin/lemul/sys/amd64/linux32/linux32_vdso.lds.s Sat Apr 13 19:58:24 2013 (r249441) +++ user/dchagin/lemul/sys/amd64/linux32/linux32_vdso.lds.s Sat Apr 13 19:59:54 2013 (r249442) @@ -60,6 +60,7 @@ VERSION linux32_vsyscall; linux32_sigcode; linux32_rt_sigcode; + linux_platform; local: *; }; } From owner-svn-src-user@FreeBSD.ORG Sat Apr 13 20:01:08 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1F1D88A1; Sat, 13 Apr 2013 20:01:08 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 11FF111E4; Sat, 13 Apr 2013 20:01:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3DK17Gq071208; Sat, 13 Apr 2013 20:01:07 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3DK17lu071206; Sat, 13 Apr 2013 20:01:07 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201304132001.r3DK17lu071206@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 13 Apr 2013 20:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r249443 - in user/dchagin/lemul/sys: amd64/linux32 i386/linux X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Apr 2013 20:01:08 -0000 Author: dchagin Date: Sat Apr 13 20:01:07 2013 New Revision: 249443 URL: http://svnweb.freebsd.org/changeset/base/249443 Log: Remove stale comment about a signal trampoline which moved to the shared page at r219609. Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sat Apr 13 19:59:54 2013 (r249442) +++ user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sat Apr 13 20:01:07 2013 (r249443) @@ -898,7 +898,6 @@ linux_copyout_strings(struct image_param /* * Calculate string base and vector table pointers. - * Also deal with signal trampoline code for this exec type. */ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; destp = (caddr_t)arginfo - SPARE_USRSPACE - Modified: user/dchagin/lemul/sys/i386/linux/linux_sysvec.c ============================================================================== --- user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Sat Apr 13 19:59:54 2013 (r249442) +++ user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Sat Apr 13 20:01:07 2013 (r249443) @@ -318,7 +318,6 @@ linux_copyout_strings(struct image_param /* * Calculate string base and vector table pointers. - * Also deal with signal trampoline code for this exec type. */ p = imgp->proc; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings;