From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 27 21:49:54 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3FDA1802; Sun, 27 Oct 2013 21:49:54 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2A86C2F43; Sun, 27 Oct 2013 21:49:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9RLnspE046154; Sun, 27 Oct 2013 21:49:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9RLnqnm046148; Sun, 27 Oct 2013 21:49:52 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201310272149.r9RLnqnm046148@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 27 Oct 2013 21:49:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257229 - in stable/9: lib/libc/stdio tools/regression/lib/libc/stdio X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2013 21:49:54 -0000 Author: jilles Date: Sun Oct 27 21:49:52 2013 New Revision: 257229 URL: http://svnweb.freebsd.org/changeset/base/257229 Log: MFC r243731,r255303: libc: Allow setting close-on-exec in fopen/freopen/ fdopen. This commit adds a new mode option 'e'. For freopen() with a non-NULL path argument and fopen(), the close-on-exec flag is set iff the 'e' mode option is specified. For freopen() with a NULL path argument and fdopen(), the close-on-exec flag is turned on if the 'e' mode option is specified and remains unchanged otherwise. Although the same behaviour for fopen() can be obtained by open(O_CLOEXEC) and fdopen(), this needlessly complicates the calling code. PR: kern/169320 Added: stable/9/tools/regression/lib/libc/stdio/test-fopen.c - copied unchanged from r255303, head/tools/regression/lib/libc/stdio/test-fopen.c stable/9/tools/regression/lib/libc/stdio/test-fopen.t - copied unchanged from r255303, head/tools/regression/lib/libc/stdio/test-fopen.t Modified: stable/9/lib/libc/stdio/fdopen.c stable/9/lib/libc/stdio/flags.c stable/9/lib/libc/stdio/fopen.3 stable/9/lib/libc/stdio/freopen.c Directory Properties: stable/9/lib/libc/ (props changed) stable/9/tools/regression/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdio/fdopen.c ============================================================================== --- stable/9/lib/libc/stdio/fdopen.c Sun Oct 27 21:39:16 2013 (r257228) +++ stable/9/lib/libc/stdio/fdopen.c Sun Oct 27 21:49:52 2013 (r257229) @@ -80,6 +80,12 @@ fdopen(fd, mode) if ((fp = __sfp()) == NULL) return (NULL); + + if ((oflags & O_CLOEXEC) && _fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { + fp->_flags = 0; + return (NULL); + } + fp->_flags = flags; /* * If opened for appending, but underlying descriptor does not have Modified: stable/9/lib/libc/stdio/flags.c ============================================================================== --- stable/9/lib/libc/stdio/flags.c Sun Oct 27 21:39:16 2013 (r257228) +++ stable/9/lib/libc/stdio/flags.c Sun Oct 27 21:49:52 2013 (r257229) @@ -53,7 +53,7 @@ __sflags(mode, optr) const char *mode; int *optr; { - int ret, m, o; + int ret, m, o, known; switch (*mode++) { @@ -80,28 +80,34 @@ __sflags(mode, optr) return (0); } - /* 'b' (binary) is ignored */ - if (*mode == 'b') - mode++; - - /* [rwa][b]\+ means read and write */ - if (*mode == '+') { - mode++; - ret = __SRW; - m = O_RDWR; - } - - /* 'b' (binary) can appear here, too -- and is ignored again */ - if (*mode == 'b') - mode++; - - /* 'x' means exclusive (fail if the file exists) */ - if (*mode == 'x') { - if (m == O_RDONLY) { - errno = EINVAL; - return (0); + do { + known = 1; + switch (*mode++) { + case 'b': + /* 'b' (binary) is ignored */ + break; + case '+': + /* [rwa][b]\+ means read and write */ + ret = __SRW; + m = O_RDWR; + break; + case 'x': + /* 'x' means exclusive (fail if the file exists) */ + o |= O_EXCL; + break; + case 'e': + /* set close-on-exec */ + o |= O_CLOEXEC; + break; + default: + known = 0; + break; } - o |= O_EXCL; + } while (known); + + if ((o & O_EXCL) != 0 && m == O_RDONLY) { + errno = EINVAL; + return (0); } *optr = m | o; Modified: stable/9/lib/libc/stdio/fopen.3 ============================================================================== --- stable/9/lib/libc/stdio/fopen.3 Sun Oct 27 21:39:16 2013 (r257228) +++ stable/9/lib/libc/stdio/fopen.3 Sun Oct 27 21:49:52 2013 (r257229) @@ -100,6 +100,14 @@ or causes the .Fn fopen call to fail if the file already exists. +An optional +.Dq Li e +following the above +causes the +.Fn fopen +call to set the +.Dv FD_CLOEXEC +flag on the underlying file descriptor. .Pp The .Fa mode @@ -149,6 +157,11 @@ of the stream must be compatible with th The .Dq Li x mode option is ignored. +If the +.Dq Li e +mode option is present, the +.Dv FD_CLOEXEC +flag is set, otherwise it remains unchanged. When the stream is closed via .Xr fclose 3 , .Fa fildes @@ -313,6 +326,10 @@ function conforms to .St -p1003.1-88 . The +.Dq Li e +mode option does not conform to any standard +but is also supported by glibc. +The .Fn fmemopen function conforms to Modified: stable/9/lib/libc/stdio/freopen.c ============================================================================== --- stable/9/lib/libc/stdio/freopen.c Sun Oct 27 21:39:16 2013 (r257228) +++ stable/9/lib/libc/stdio/freopen.c Sun Oct 27 21:49:52 2013 (r257229) @@ -118,6 +118,8 @@ freopen(file, mode, fp) (void) ftruncate(fp->_file, (off_t)0); if (!(oflags & O_APPEND)) (void) _sseek(fp, (fpos_t)0, SEEK_SET); + if (oflags & O_CLOEXEC) + (void) _fcntl(fp->_file, F_SETFD, FD_CLOEXEC); f = fp->_file; isopen = 0; wantfd = -1; @@ -194,7 +196,8 @@ finish: * assume stderr is always fd STDERR_FILENO, even if being freopen'd. */ if (wantfd >= 0) { - if (_dup2(f, wantfd) >= 0) { + if ((oflags & O_CLOEXEC ? _fcntl(f, F_DUP2FD_CLOEXEC, wantfd) : + _dup2(f, wantfd)) >= 0) { (void)_close(f); f = wantfd; } else Copied: stable/9/tools/regression/lib/libc/stdio/test-fopen.c (from r255303, head/tools/regression/lib/libc/stdio/test-fopen.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/lib/libc/stdio/test-fopen.c Sun Oct 27 21:49:52 2013 (r257229, copy of r255303, head/tools/regression/lib/libc/stdio/test-fopen.c) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2013 Jilles Tjoelker + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +/* + * O_ACCMODE is currently defined incorrectly. This is what it should be. + * Various code depends on the incorrect value. + */ +#define CORRECT_O_ACCMODE (O_ACCMODE | O_EXEC) + +static int testnum = 1; + +static void +runtest(const char *fname, const char *mode) +{ + FILE *fp; + int fd, flags, wantedflags; + + fp = fopen(fname, mode); + if (fp == NULL) { + printf("not ok %d - fopen(\"%s\", \"%s\") failed\n", + testnum++, fname, mode); + printf("not ok %d - FD_CLOEXEC # SKIP\n", + testnum++); + return; + } + fd = fileno(fp); + if (fd < 0) + printf("not ok %d - fileno() failed\n", testnum++); + else + printf("ok %d - fopen(\"%s\", \"%s\") and fileno() succeeded\n", + testnum++, fname, mode); + if (fcntl(fd, F_GETFD) == (strchr(mode, 'e') != NULL ? FD_CLOEXEC : 0)) + printf("ok %d - FD_CLOEXEC flag correct\n", testnum++); + else + printf("not ok %d - FD_CLOEXEC flag incorrect\n", testnum++); + flags = fcntl(fd, F_GETFL); + if (strchr(mode, '+')) + wantedflags = O_RDWR | (*mode == 'a' ? O_APPEND : 0); + else if (*mode == 'r') + wantedflags = O_RDONLY; + else if (*mode == 'w') + wantedflags = O_WRONLY; + else if (*mode == 'a') + wantedflags = O_WRONLY | O_APPEND; + else + wantedflags = -1; + if (wantedflags == -1) + printf("not ok %d - unrecognized mode\n", testnum++); + else if ((flags & (CORRECT_O_ACCMODE | O_APPEND)) == wantedflags) + printf("ok %d - correct access mode\n", testnum++); + else + printf("not ok %d - incorrect access mode\n", testnum++); + fclose(fp); +} + +/* + * Test program for fopen(). + */ +int +main(int argc, char *argv[]) +{ + printf("1..45\n"); + runtest("/dev/null", "r"); + runtest("/dev/null", "r+"); + runtest("/dev/null", "w"); + runtest("/dev/null", "w+"); + runtest("/dev/null", "a"); + runtest("/dev/null", "a+"); + runtest("/dev/null", "re"); + runtest("/dev/null", "r+e"); + runtest("/dev/null", "we"); + runtest("/dev/null", "w+e"); + runtest("/dev/null", "ae"); + runtest("/dev/null", "a+e"); + runtest("/dev/null", "re+"); + runtest("/dev/null", "we+"); + runtest("/dev/null", "ae+"); + + return 0; +} + +/* vim:ts=8:cin:sw=8 + * */ Copied: stable/9/tools/regression/lib/libc/stdio/test-fopen.t (from r255303, head/tools/regression/lib/libc/stdio/test-fopen.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/lib/libc/stdio/test-fopen.t Sun Oct 27 21:49:52 2013 (r257229, copy of r255303, head/tools/regression/lib/libc/stdio/test-fopen.t) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 27 22:18:28 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 32275742; Sun, 27 Oct 2013 22:18:28 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 057552121; Sun, 27 Oct 2013 22:18:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9RMIRH5056807; Sun, 27 Oct 2013 22:18:27 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9RMIRV4056803; Sun, 27 Oct 2013 22:18:27 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201310272218.r9RMIRV4056803@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 27 Oct 2013 22:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257232 - stable/9/tools/regression/lib/libc/stdio X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2013 22:18:28 -0000 Author: jilles Date: Sun Oct 27 22:18:27 2013 New Revision: 257232 URL: http://svnweb.freebsd.org/changeset/base/257232 Log: MFC r255301: libc/stdio: Provide proper TAP output for fmemopen/ open_memstream/open_wmemstream. A *.t file should provide Test Anything Protocol output so that it can be run using the Perl "prove" tool. Modified: stable/9/tools/regression/lib/libc/stdio/test-fmemopen.t stable/9/tools/regression/lib/libc/stdio/test-open_memstream.t stable/9/tools/regression/lib/libc/stdio/test-open_wmemstream.t Directory Properties: stable/9/tools/regression/lib/libc/ (props changed) Modified: stable/9/tools/regression/lib/libc/stdio/test-fmemopen.t ============================================================================== --- stable/9/tools/regression/lib/libc/stdio/test-fmemopen.t Sun Oct 27 22:15:50 2013 (r257231) +++ stable/9/tools/regression/lib/libc/stdio/test-fmemopen.t Sun Oct 27 22:18:27 2013 (r257232) @@ -7,4 +7,9 @@ executable=`basename $0 .t` make $executable 2>&1 > /dev/null -exec ./$executable +echo 1..1 +if ./$executable; then + echo ok 1 - $executable successful +else + echo not ok 1 - $executable failed +fi Modified: stable/9/tools/regression/lib/libc/stdio/test-open_memstream.t ============================================================================== --- stable/9/tools/regression/lib/libc/stdio/test-open_memstream.t Sun Oct 27 22:15:50 2013 (r257231) +++ stable/9/tools/regression/lib/libc/stdio/test-open_memstream.t Sun Oct 27 22:18:27 2013 (r257232) @@ -7,4 +7,9 @@ executable=`basename $0 .t` make $executable 2>&1 > /dev/null -exec ./$executable +echo 1..1 +if ./$executable; then + echo ok 1 - $executable successful +else + echo not ok 1 - $executable failed +fi Modified: stable/9/tools/regression/lib/libc/stdio/test-open_wmemstream.t ============================================================================== --- stable/9/tools/regression/lib/libc/stdio/test-open_wmemstream.t Sun Oct 27 22:15:50 2013 (r257231) +++ stable/9/tools/regression/lib/libc/stdio/test-open_wmemstream.t Sun Oct 27 22:18:27 2013 (r257232) @@ -7,4 +7,9 @@ executable=`basename $0 .t` make $executable 2>&1 > /dev/null -exec ./$executable +echo 1..1 +if ./$executable; then + echo ok 1 - $executable successful +else + echo not ok 1 - $executable failed +fi From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 28 14:27:36 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3405BC33; Mon, 28 Oct 2013 14:27:36 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 20711231B; Mon, 28 Oct 2013 14:27:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9SERZBx088866; Mon, 28 Oct 2013 14:27:35 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9SERZhP088865; Mon, 28 Oct 2013 14:27:35 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201310281427.r9SERZhP088865@svn.freebsd.org> From: Will Andrews Date: Mon, 28 Oct 2013 14:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257253 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 14:27:36 -0000 Author: will Date: Mon Oct 28 14:27:35 2013 New Revision: 257253 URL: http://svnweb.freebsd.org/changeset/base/257253 Log: MFC r248653: ZFS: Fix a panic while unmounting a busy filesystem. This particular scenario was easily reproduced using a NFS export. When the first 'zfs unmount' occurred, it returned EBUSY via this path, while vflush() had flushed references on the filesystem's root vnode, which in turn caused its v_interlock to be destroyed. The next time 'zfs unmount' was called, vflush() tried to obtain this lock, which caused this panic. Since vflush() on FreeBSD is a definitive call, there is no need to check vfsp->vfs_count after it completes. Simply #ifdef sun this check. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Oct 28 14:00:06 2013 (r257252) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Oct 28 14:27:35 2013 (r257253) @@ -1988,6 +1988,7 @@ zfs_umount(vfs_t *vfsp, int fflag) return (ret); } +#ifdef sun if (!(fflag & MS_FORCE)) { /* * Check the number of active vnodes in the file system. @@ -2008,6 +2009,7 @@ zfs_umount(vfs_t *vfsp, int fflag) return (SET_ERROR(EBUSY)); } } +#endif VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0); os = zfsvfs->z_os; From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 28 19:46:02 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8CB7EB2A; Mon, 28 Oct 2013 19:46:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 77C3C28D4; Mon, 28 Oct 2013 19:46:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9SJk23E008505; Mon, 28 Oct 2013 19:46:02 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9SJk2ss008503; Mon, 28 Oct 2013 19:46:02 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201310281946.r9SJk2ss008503@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 28 Oct 2013 19:46:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257267 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 19:46:02 -0000 Author: pfg Date: Mon Oct 28 19:46:01 2013 New Revision: 257267 URL: http://svnweb.freebsd.org/changeset/base/257267 Log: MFC r255338: ext2fs: temporarily disable htree directory index. In addition to our implementation not having workarounds for hash collisions, it appears we also have a compatibility problem. For now disable the htree code until we are able to re-examine both issues. PR: kern/183230 Modified: stable/9/sys/fs/ext2fs/ext2_htree.c stable/9/sys/fs/ext2fs/ext2_lookup.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_htree.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_htree.c Mon Oct 28 19:30:09 2013 (r257266) +++ stable/9/sys/fs/ext2fs/ext2_htree.c Mon Oct 28 19:46:01 2013 (r257267) @@ -89,10 +89,12 @@ static int ext2_htree_writebuf(struct ex int ext2_htree_has_idx(struct inode *ip) { +#ifdef EXT2FS_HTREE if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) && ip->i_flags & EXT4_INDEX) return (1); else +#endif return (0); } Modified: stable/9/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_lookup.c Mon Oct 28 19:30:09 2013 (r257266) +++ stable/9/sys/fs/ext2fs/ext2_lookup.c Mon Oct 28 19:46:01 2013 (r257267) @@ -884,6 +884,7 @@ ext2_direnter(struct inode *ip, struct v bcopy(cnp->cn_nameptr, newdir.e2d_name, (unsigned)cnp->cn_namelen + 1); newentrysize = EXT2_DIR_REC_LEN(newdir.e2d_namlen); +#ifdef EXT2FS_HTREE if (ext2_htree_has_idx(dp)) { error = ext2_htree_add_entry(dvp, &newdir, cnp); if (error) { @@ -904,6 +905,7 @@ ext2_direnter(struct inode *ip, struct v return ext2_htree_create_index(dvp, cnp, &newdir); } } +#endif /* EXT2FS_HTREE */ if (dp->i_count == 0) { /* From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 29 07:48:37 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6D9CECC2; Tue, 29 Oct 2013 07:48:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5AFCE20C9; Tue, 29 Oct 2013 07:48:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T7mbF3055225; Tue, 29 Oct 2013 07:48:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T7mb4v055224; Tue, 29 Oct 2013 07:48:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310290748.r9T7mb4v055224@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 29 Oct 2013 07:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257312 - stable/9/sys/dev/drm2/i915 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 07:48:37 -0000 Author: kib Date: Tue Oct 29 07:48:36 2013 New Revision: 257312 URL: http://svnweb.freebsd.org/changeset/base/257312 Log: MFC r256848: Use plain register read for waiting of the reset completion notification, to avoid gt_lock recursion. Modified: stable/9/sys/dev/drm2/i915/i915_drv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- stable/9/sys/dev/drm2/i915/i915_drv.c Tue Oct 29 07:35:19 2013 (r257311) +++ stable/9/sys/dev/drm2/i915/i915_drv.c Tue Oct 29 07:48:36 2013 (r257312) @@ -685,7 +685,7 @@ gen6_do_reset(struct drm_device *dev, u8 /* Spin waiting for the device to ack the reset request */ ret = _intel_wait_for(dev, - (I915_READ(GEN6_GDRST) & GEN6_GRDOM_FULL) == 0, + (I915_READ_NOTRACE(GEN6_GDRST) & GEN6_GRDOM_FULL) == 0, 500, 1, "915rst"); /* If reset with a user forcewake, try to restore, otherwise turn it off */ From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 29 09:57:01 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1735782C; Tue, 29 Oct 2013 09:57:01 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EB4EE2830; Tue, 29 Oct 2013 09:57:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T9v0c0002797; Tue, 29 Oct 2013 09:57:00 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T9v0Ws002796; Tue, 29 Oct 2013 09:57:00 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201310290957.r9T9v0Ws002796@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Tue, 29 Oct 2013 09:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257323 - stable/9/sys/netgraph X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 09:57:01 -0000 Author: melifaro Date: Tue Oct 29 09:57:00 2013 New Revision: 257323 URL: http://svnweb.freebsd.org/changeset/base/257323 Log: Merge r256550. Improve locking model used to protect netgraph topology: use rwlocks instead of mutexes on node traversal. Reviewed by: glebius Tested by: Eugene Grosbein Sponsored by: Yandex LLC Modified: stable/9/sys/netgraph/ng_base.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netgraph/ng_base.c ============================================================================== --- stable/9/sys/netgraph/ng_base.c Tue Oct 29 09:52:15 2013 (r257322) +++ stable/9/sys/netgraph/ng_base.c Tue Oct 29 09:57:00 2013 (r257323) @@ -74,7 +74,12 @@ MODULE_VERSION(netgraph, NG_ABI_VERSION); /* Mutex to protect topology events. */ -static struct mtx ng_topo_mtx; +static struct rwlock ng_topo_lock; +#define TOPOLOGY_RLOCK() rw_rlock(&ng_topo_lock) +#define TOPOLOGY_RUNLOCK() rw_runlock(&ng_topo_lock) +#define TOPOLOGY_WLOCK() rw_wlock(&ng_topo_lock) +#define TOPOLOGY_WUNLOCK() rw_wunlock(&ng_topo_lock) +#define TOPOLOGY_NOTOWNED() rw_assert(&ng_topo_lock, RA_UNLOCKED) #ifdef NETGRAPH_DEBUG static struct mtx ng_nodelist_mtx; /* protects global node/hook lists */ @@ -1162,7 +1167,7 @@ ng_destroy_hook(hook_p hook) * Protect divorce process with mutex, to avoid races on * simultaneous disconnect. */ - mtx_lock(&ng_topo_mtx); + TOPOLOGY_WLOCK(); hook->hk_flags |= HK_INVALID; @@ -1182,17 +1187,17 @@ ng_destroy_hook(hook_p hook) * If it's already divorced from a node, * just free it. */ - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); } else { - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); ng_rmhook_self(peer); /* Send it a surprise */ } NG_HOOK_UNREF(peer); /* account for peer link */ NG_HOOK_UNREF(hook); /* account for peer link */ } else - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); - mtx_assert(&ng_topo_mtx, MA_NOTOWNED); + TOPOLOGY_NOTOWNED(); /* * Remove the hook from the node's list to avoid possible recursion @@ -1233,9 +1238,9 @@ ng_bypass(hook_p hook1, hook_p hook2) TRAP_ERROR(); return (EINVAL); } - mtx_lock(&ng_topo_mtx); + TOPOLOGY_WLOCK(); if (NG_HOOK_NOT_VALID(hook1) || NG_HOOK_NOT_VALID(hook2)) { - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); return (EINVAL); } hook1->hk_peer->hk_peer = hook2->hk_peer; @@ -1243,7 +1248,7 @@ ng_bypass(hook_p hook1, hook_p hook2) hook1->hk_peer = &ng_deadhook; hook2->hk_peer = &ng_deadhook; - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); NG_HOOK_UNREF(hook1); NG_HOOK_UNREF(hook2); @@ -1440,15 +1445,15 @@ ng_con_part2(node_p node, item_p item, h /* * Acquire topo mutex to avoid race with ng_destroy_hook(). */ - mtx_lock(&ng_topo_mtx); + TOPOLOGY_RLOCK(); peer = hook->hk_peer; if (peer == &ng_deadhook) { - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_RUNLOCK(); printf("failed in ng_con_part2(B)\n"); ng_destroy_hook(hook); ERROUT(ENOENT); } - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_RUNLOCK(); if ((error = ng_send_fn2(peer->hk_node, peer, item, &ng_con_part3, NULL, 0, NG_REUSE_ITEM))) { @@ -1793,14 +1798,14 @@ ng_path2noderef(node_p here, const char /* We have a segment, so look for a hook by that name */ hook = ng_findhook(node, segment); - mtx_lock(&ng_topo_mtx); + TOPOLOGY_WLOCK(); /* Can't get there from here... */ if (hook == NULL || NG_HOOK_PEER(hook) == NULL || NG_HOOK_NOT_VALID(hook) || NG_HOOK_NOT_VALID(NG_HOOK_PEER(hook))) { TRAP_ERROR(); NG_NODE_UNREF(node); - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); return (ENOENT); } @@ -1817,7 +1822,7 @@ ng_path2noderef(node_p here, const char NG_NODE_UNREF(oldnode); /* XXX another race */ if (NG_NODE_NOT_VALID(node)) { NG_NODE_UNREF(node); /* XXX more races */ - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); TRAP_ERROR(); return (ENXIO); } @@ -1830,11 +1835,11 @@ ng_path2noderef(node_p here, const char } else *lasthook = NULL; } - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); *destp = node; return (0); } - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_WUNLOCK(); } } @@ -3202,8 +3207,7 @@ ngb_mod_event(module_t mod, int event, v rw_init(&ng_typelist_lock, "netgraph types"); rw_init(&ng_idhash_lock, "netgraph idhash"); rw_init(&ng_namehash_lock, "netgraph namehash"); - mtx_init(&ng_topo_mtx, "netgraph topology mutex", NULL, - MTX_DEF); + rw_init(&ng_topo_lock, "netgraph topology mutex"); #ifdef NETGRAPH_DEBUG mtx_init(&ng_nodelist_mtx, "netgraph nodelist mutex", NULL, MTX_DEF); @@ -3579,13 +3583,13 @@ ng_address_hook(node_p here, item_p item * that the peer is still connected (even if invalid,) we know * that the peer node is present, though maybe invalid. */ - mtx_lock(&ng_topo_mtx); + TOPOLOGY_RLOCK(); if ((hook == NULL) || NG_HOOK_NOT_VALID(hook) || NG_HOOK_NOT_VALID(peer = NG_HOOK_PEER(hook)) || NG_NODE_NOT_VALID(peernode = NG_PEER_NODE(hook))) { NG_FREE_ITEM(item); TRAP_ERROR(); - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_RUNLOCK(); return (ENETDOWN); } @@ -3598,7 +3602,7 @@ ng_address_hook(node_p here, item_p item NGI_SET_NODE(item, peernode); SET_RETADDR(item, here, retaddr); - mtx_unlock(&ng_topo_mtx); + TOPOLOGY_RUNLOCK(); return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 29 18:45:48 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A05F16BD; Tue, 29 Oct 2013 18:45:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8B98E2D14; Tue, 29 Oct 2013 18:45:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TIjmbT085999; Tue, 29 Oct 2013 18:45:48 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TIjmne085998; Tue, 29 Oct 2013 18:45:48 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201310291845.r9TIjmne085998@svn.freebsd.org> From: Bryan Drewery Date: Tue, 29 Oct 2013 18:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257355 - stable/9/share/man/man7 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 18:45:48 -0000 Author: bdrewery (ports committer) Date: Tue Oct 29 18:45:48 2013 New Revision: 257355 URL: http://svnweb.freebsd.org/changeset/base/257355 Log: MFC r257151: Document /var/cache/pkg into hier(7) which pkg(8) uses. Approved by: bapt Modified: stable/9/share/man/man7/hier.7 Directory Properties: stable/9/share/man/man7/ (props changed) Modified: stable/9/share/man/man7/hier.7 ============================================================================== --- stable/9/share/man/man7/hier.7 Tue Oct 29 18:37:38 2013 (r257354) +++ stable/9/share/man/man7/hier.7 Tue Oct 29 18:45:48 2013 (r257355) @@ -32,7 +32,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 21, 2010 +.Dd October 23, 2010 .Dt HIER 7 .Os .Sh NAME @@ -705,6 +705,14 @@ directory containing output spool files .Pp .It Pa backups/ miscellaneous backup files +.It Pa cache/ +miscellaneous cached files +.Bl -tag -width ".Pa pkg/" -compact +.It Pa pkg/ +cached packages for +.Xr pkg 8 +.El +.Pp .It Pa crash/ default directory to store kernel crash dumps; see .Xr crash 8 From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 29 18:47:07 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D350E93F; Tue, 29 Oct 2013 18:47:07 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BFFEB2D2B; Tue, 29 Oct 2013 18:47:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TIl7M4086282; Tue, 29 Oct 2013 18:47:07 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TIl7la086281; Tue, 29 Oct 2013 18:47:07 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201310291847.r9TIl7la086281@svn.freebsd.org> From: Bryan Drewery Date: Tue, 29 Oct 2013 18:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257357 - stable/9/share/man/man7 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 18:47:07 -0000 Author: bdrewery (ports committer) Date: Tue Oct 29 18:47:07 2013 New Revision: 257357 URL: http://svnweb.freebsd.org/changeset/base/257357 Log: Fix Dd from MFCing r257151 Modified: stable/9/share/man/man7/hier.7 Modified: stable/9/share/man/man7/hier.7 ============================================================================== --- stable/9/share/man/man7/hier.7 Tue Oct 29 18:46:41 2013 (r257356) +++ stable/9/share/man/man7/hier.7 Tue Oct 29 18:47:07 2013 (r257357) @@ -32,7 +32,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 23, 2010 +.Dd October 23, 2013 .Dt HIER 7 .Os .Sh NAME From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 30 06:18:55 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D0BD08C9; Wed, 30 Oct 2013 06:18:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ADFF6267B; Wed, 30 Oct 2013 06:18:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9U6ItVJ039133; Wed, 30 Oct 2013 06:18:55 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9U6Is0P039129; Wed, 30 Oct 2013 06:18:54 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201310300618.r9U6Is0P039129@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 30 Oct 2013 06:18:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257373 - stable/9/sys/dev/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 06:18:56 -0000 Author: hselasky Date: Wed Oct 30 06:18:54 2013 New Revision: 257373 URL: http://svnweb.freebsd.org/changeset/base/257373 Log: MFC r257206: Fix a deadlock when trying to power off a USB device. The deadlock happens because the code in question is trying to modify the parent USB port registers outside the USB explore thread. Modified: stable/9/sys/dev/usb/usb_dev.c stable/9/sys/dev/usb/usb_device.h stable/9/sys/dev/usb/usb_generic.c stable/9/sys/dev/usb/usb_hub.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb_dev.c ============================================================================== --- stable/9/sys/dev/usb/usb_dev.c Wed Oct 30 06:16:11 2013 (r257372) +++ stable/9/sys/dev/usb/usb_dev.c Wed Oct 30 06:18:54 2013 (r257373) @@ -1095,7 +1095,7 @@ usb_ioctl(struct cdev *dev, u_long cmd, /* Wait for re-enumeration, if any */ - while (f->udev->re_enumerate_wait != 0) { + while (f->udev->re_enumerate_wait != USB_RE_ENUM_DONE) { usb_unref_device(cpd, &refs); Modified: stable/9/sys/dev/usb/usb_device.h ============================================================================== --- stable/9/sys/dev/usb/usb_device.h Wed Oct 30 06:16:11 2013 (r257372) +++ stable/9/sys/dev/usb/usb_device.h Wed Oct 30 06:18:54 2013 (r257373) @@ -230,6 +230,9 @@ struct usb_device { uint8_t driver_added_refcount; /* our driver added generation count */ uint8_t power_mode; /* see USB_POWER_XXX */ uint8_t re_enumerate_wait; /* set if re-enum. is in progress */ +#define USB_RE_ENUM_DONE 0 +#define USB_RE_ENUM_START 1 +#define USB_RE_ENUM_PWR_OFF 2 uint8_t ifaces_max; /* number of interfaces present */ uint8_t endpoints_max; /* number of endpoints present */ Modified: stable/9/sys/dev/usb/usb_generic.c ============================================================================== --- stable/9/sys/dev/usb/usb_generic.c Wed Oct 30 06:16:11 2013 (r257372) +++ stable/9/sys/dev/usb/usb_generic.c Wed Oct 30 06:18:54 2013 (r257373) @@ -1749,16 +1749,11 @@ ugen_set_power_mode(struct usb_fifo *f, switch (mode) { case USB_POWER_MODE_OFF: - /* get the device unconfigured */ - err = ugen_set_config(f, USB_UNCONFIG_INDEX); - if (err) { - DPRINTFN(0, "Could not unconfigure " - "device (ignored)\n"); + if (udev->flags.usb_mode == USB_MODE_HOST && + udev->re_enumerate_wait == USB_RE_ENUM_DONE) { + udev->re_enumerate_wait = USB_RE_ENUM_PWR_OFF; } - - /* clear port enable */ - err = usbd_req_clear_port_feature(udev->parent_hub, - NULL, udev->port_no, UHF_PORT_ENABLE); + /* set power mode will wake up the explore thread */ break; case USB_POWER_MODE_ON: @@ -1806,9 +1801,9 @@ ugen_set_power_mode(struct usb_fifo *f, /* if we are powered off we need to re-enumerate first */ if (old_mode == USB_POWER_MODE_OFF) { - if (udev->flags.usb_mode == USB_MODE_HOST) { - if (udev->re_enumerate_wait == 0) - udev->re_enumerate_wait = 1; + if (udev->flags.usb_mode == USB_MODE_HOST && + udev->re_enumerate_wait == USB_RE_ENUM_DONE) { + udev->re_enumerate_wait = USB_RE_ENUM_START; } /* set power mode will wake up the explore thread */ } Modified: stable/9/sys/dev/usb/usb_hub.c ============================================================================== --- stable/9/sys/dev/usb/usb_hub.c Wed Oct 30 06:16:11 2013 (r257372) +++ stable/9/sys/dev/usb/usb_hub.c Wed Oct 30 06:18:54 2013 (r257373) @@ -242,7 +242,8 @@ uhub_explore_sub(struct uhub_softc *sc, uint8_t do_unlock; do_unlock = usbd_enum_lock(child); - if (child->re_enumerate_wait) { + switch (child->re_enumerate_wait) { + case USB_RE_ENUM_START: err = usbd_set_config_index(child, USB_UNCONFIG_INDEX); if (err != 0) { @@ -257,8 +258,33 @@ uhub_explore_sub(struct uhub_softc *sc, err = usb_probe_and_attach(child, USB_IFACE_INDEX_ANY); } - child->re_enumerate_wait = 0; + child->re_enumerate_wait = USB_RE_ENUM_DONE; err = 0; + break; + + case USB_RE_ENUM_PWR_OFF: + /* get the device unconfigured */ + err = usbd_set_config_index(child, + USB_UNCONFIG_INDEX); + if (err) { + DPRINTFN(0, "Could not unconfigure " + "device (ignored)\n"); + } + + /* clear port enable */ + err = usbd_req_clear_port_feature(child->parent_hub, + NULL, child->port_no, UHF_PORT_ENABLE); + if (err) { + DPRINTFN(0, "Could not disable port " + "(ignored)\n"); + } + child->re_enumerate_wait = USB_RE_ENUM_DONE; + err = 0; + break; + + default: + child->re_enumerate_wait = USB_RE_ENUM_DONE; + break; } if (do_unlock) usbd_enum_unlock(child); @@ -2073,7 +2099,7 @@ usb_peer_should_wakeup(struct usb_device return (((udev->power_mode == USB_POWER_MODE_ON) && (udev->flags.usb_mode == USB_MODE_HOST)) || (udev->driver_added_refcount != udev->bus->driver_added_refcount) || - (udev->re_enumerate_wait != 0) || + (udev->re_enumerate_wait != USB_RE_ENUM_DONE) || (udev->pwr_save.type_refs[UE_ISOCHRONOUS] != 0) || (udev->pwr_save.write_refs != 0) || ((udev->pwr_save.read_refs != 0) && @@ -2489,6 +2515,8 @@ usbd_set_power_mode(struct usb_device *u #if USB_HAVE_POWERD usb_bus_power_update(udev->bus); +#else + usb_needs_explore(udev->bus, 0 /* no probe */ ); #endif } @@ -2527,8 +2555,8 @@ usbd_filter_power_mode(struct usb_device void usbd_start_re_enumerate(struct usb_device *udev) { - if (udev->re_enumerate_wait == 0) { - udev->re_enumerate_wait = 1; + if (udev->re_enumerate_wait == USB_RE_ENUM_DONE) { + udev->re_enumerate_wait = USB_RE_ENUM_START; usb_needs_explore(udev->bus, 0); } } From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 30 16:08:28 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3143FF18; Wed, 30 Oct 2013 16:08:28 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0F1282D65; Wed, 30 Oct 2013 16:08:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9UG8RNN044248; Wed, 30 Oct 2013 16:08:27 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9UG8Rn5044246; Wed, 30 Oct 2013 16:08:27 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201310301608.r9UG8Rn5044246@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Wed, 30 Oct 2013 16:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257389 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 16:08:28 -0000 Author: melifaro Date: Wed Oct 30 16:08:27 2013 New Revision: 257389 URL: http://svnweb.freebsd.org/changeset/base/257389 Log: MFC r256624: Fix long-standing issue with incorrect radix mask calculation. Usual symptoms are messages like rn_delete: inconsistent annotation rn_addmask: mask impossibly already in tree routing daemon constantly deleting IPv6 default route or inability to flush/delete particular prefix in ipfw table. Changes: * Assume 32 bytes as maximum radix key length * Remove rn_init() * Statically allocate rn_ones/rn_zeroes * Make separate mask tree for each "normal" tree instead of system global one * Remove "optimization" on masks reusage and key zeroying * Change rn_addmask() arguments to accept tree pointer (no users in base) MFC changes: * keep rn_init() * create global mask tree, protected with mutex, for old rn_addmask users (currently 0 in base) * Add new rn_addmask_r() function (rn_addmask in head) with additional argument to accept tree pointer PR: kern/182851, kern/169206, kern/135476, kern/134531 Found by: Slawa Olhovchenkov Reviewed by: glebius (previous versions) Sponsored by: Yandex LLC Modified: stable/9/sys/net/radix.c stable/9/sys/net/radix.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/radix.c ============================================================================== --- stable/9/sys/net/radix.c Wed Oct 30 15:46:50 2013 (r257388) +++ stable/9/sys/net/radix.c Wed Oct 30 16:08:27 2013 (r257389) @@ -66,27 +66,27 @@ static struct radix_node *rn_search(void *, struct radix_node *), *rn_search_m(void *, struct radix_node *, void *); -static int max_keylen; -static struct radix_mask *rn_mkfreelist; -static struct radix_node_head *mask_rnhead; +static void rn_detachhead_internal(void **head); +static int rn_inithead_internal(void **head, int off); + +#define RADIX_MAX_KEY_LEN 32 + +static char rn_zeros[RADIX_MAX_KEY_LEN]; +static char rn_ones[RADIX_MAX_KEY_LEN] = { + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, +}; + /* - * Work area -- the following point to 3 buffers of size max_keylen, - * allocated in this order in a block of memory malloc'ed by rn_init. - * rn_zeros, rn_ones are set in rn_init and used in readonly afterwards. - * addmask_key is used in rn_addmask in rw mode and not thread-safe. + * XXX: Compat stuff for old rn_addmask() users */ -static char *rn_zeros, *rn_ones, *addmask_key; - -#define MKGet(m) { \ - if (rn_mkfreelist) { \ - m = rn_mkfreelist; \ - rn_mkfreelist = (m)->rm_mklist; \ - } else \ - R_Malloc(m, struct radix_mask *, sizeof (struct radix_mask)); } - -#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);} +static struct radix_node_head *mask_rnhead_compat; +#ifdef _KERNEL +static struct mtx mask_mtx; +#endif -#define rn_masktop (mask_rnhead->rnh_treetop) static int rn_lexobetter(void *m_arg, void *n_arg); static struct radix_mask * @@ -230,7 +230,8 @@ rn_lookup(v_arg, m_arg, head) caddr_t netmask = 0; if (m_arg) { - x = rn_addmask(m_arg, 1, head->rnh_treetop->rn_offset); + x = rn_addmask_r(m_arg, head->rnh_masks, 1, + head->rnh_treetop->rn_offset); if (x == 0) return (0); netmask = x->rn_key; @@ -489,53 +490,47 @@ on1: } struct radix_node * -rn_addmask(n_arg, search, skip) - int search, skip; - void *n_arg; +rn_addmask_r(void *arg, struct radix_node_head *maskhead, int search, int skip) { - caddr_t netmask = (caddr_t)n_arg; + caddr_t netmask = (caddr_t)arg; register struct radix_node *x; register caddr_t cp, cplim; register int b = 0, mlen, j; - int maskduplicated, m0, isnormal; + int maskduplicated, isnormal; struct radix_node *saved_x; - static int last_zeroed = 0; + char addmask_key[RADIX_MAX_KEY_LEN]; - if ((mlen = LEN(netmask)) > max_keylen) - mlen = max_keylen; + if ((mlen = LEN(netmask)) > RADIX_MAX_KEY_LEN) + mlen = RADIX_MAX_KEY_LEN; if (skip == 0) skip = 1; if (mlen <= skip) - return (mask_rnhead->rnh_nodes); + return (maskhead->rnh_nodes); + + bzero(addmask_key, RADIX_MAX_KEY_LEN); if (skip > 1) bcopy(rn_ones + 1, addmask_key + 1, skip - 1); - if ((m0 = mlen) > skip) - bcopy(netmask + skip, addmask_key + skip, mlen - skip); + bcopy(netmask + skip, addmask_key + skip, mlen - skip); /* * Trim trailing zeroes. */ for (cp = addmask_key + mlen; (cp > addmask_key) && cp[-1] == 0;) cp--; mlen = cp - addmask_key; - if (mlen <= skip) { - if (m0 >= last_zeroed) - last_zeroed = mlen; - return (mask_rnhead->rnh_nodes); - } - if (m0 < last_zeroed) - bzero(addmask_key + m0, last_zeroed - m0); - *addmask_key = last_zeroed = mlen; - x = rn_search(addmask_key, rn_masktop); + if (mlen <= skip) + return (maskhead->rnh_nodes); + *addmask_key = mlen; + x = rn_search(addmask_key, maskhead->rnh_treetop); if (bcmp(addmask_key, x->rn_key, mlen) != 0) x = 0; if (x || search) return (x); - R_Zalloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x)); + R_Zalloc(x, struct radix_node *, RADIX_MAX_KEY_LEN + 2 * sizeof (*x)); if ((saved_x = x) == 0) return (0); netmask = cp = (caddr_t)(x + 2); bcopy(addmask_key, cp, mlen); - x = rn_insert(cp, mask_rnhead, &maskduplicated, x); + x = rn_insert(cp, maskhead, &maskduplicated, x); if (maskduplicated) { log(LOG_ERR, "rn_addmask: mask impossibly already in tree"); Free(saved_x); @@ -568,6 +563,23 @@ rn_addmask(n_arg, search, skip) return (x); } +struct radix_node * +rn_addmask(void *n_arg, int search, int skip) +{ + struct radix_node *tt; + +#ifdef _KERNEL + mtx_lock(&mask_mtx); +#endif + tt = rn_addmask_r(&mask_rnhead_compat, n_arg, search, skip); + +#ifdef _KERNEL + mtx_unlock(&mask_mtx); +#endif + + return (tt); +} + static int /* XXX: arbitrary ordering for non-contiguous masks */ rn_lexobetter(m_arg, n_arg) void *m_arg, *n_arg; @@ -590,12 +602,12 @@ rn_new_radix_mask(tt, next) { register struct radix_mask *m; - MKGet(m); + R_Malloc(m, struct radix_mask *, sizeof (struct radix_mask)); if (m == 0) { - log(LOG_ERR, "Mask for route not entered\n"); + log(LOG_ERR, "Failed to allocate route mask\n"); return (0); } - bzero(m, sizeof *m); + bzero(m, sizeof(*m)); m->rm_bit = tt->rn_bit; m->rm_flags = tt->rn_flags; if (tt->rn_flags & RNF_NORMAL) @@ -629,7 +641,8 @@ rn_addroute(v_arg, n_arg, head, treenode * nodes and possibly save time in calculating indices. */ if (netmask) { - if ((x = rn_addmask(netmask, 0, top->rn_offset)) == 0) + x = rn_addmask_r(netmask, head->rnh_masks, 0, top->rn_offset); + if (x == NULL) return (0); b_leaf = x->rn_bit; b = -1 - x->rn_bit; @@ -808,7 +821,8 @@ rn_delete(v_arg, netmask_arg, head) * Delete our route from mask lists. */ if (netmask) { - if ((x = rn_addmask(netmask, 1, head_off)) == 0) + x = rn_addmask_r(netmask, head->rnh_masks, 1, head_off); + if (x == NULL) return (0); netmask = x->rn_key; while (tt->rn_mask != netmask) @@ -841,7 +855,7 @@ rn_delete(v_arg, netmask_arg, head) for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) if (m == saved_m) { *mp = m->rm_mklist; - MKFree(m); + Free(m); break; } if (m == 0) { @@ -932,7 +946,7 @@ on1: struct radix_mask *mm = m->rm_mklist; x->rn_mklist = 0; if (--(m->rm_refs) < 0) - MKFree(m); + Free(m); m = mm; } if (m) @@ -1128,10 +1142,8 @@ rn_walktree(h, f, w) * bits starting at 'off'. * Return 1 on success, 0 on error. */ -int -rn_inithead(head, off) - void **head; - int off; +static int +rn_inithead_internal(void **head, int off) { register struct radix_node_head *rnh; register struct radix_node *t, *tt, *ttt; @@ -1163,8 +1175,8 @@ rn_inithead(head, off) return (1); } -int -rn_detachhead(void **head) +static void +rn_detachhead_internal(void **head) { struct radix_node_head *rnh; @@ -1176,28 +1188,60 @@ rn_detachhead(void **head) Free(rnh); *head = NULL; +} + +int +rn_inithead(void **head, int off) +{ + struct radix_node_head *rnh; + + if (*head != NULL) + return (1); + + if (rn_inithead_internal(head, off) == 0) + return (0); + + rnh = (struct radix_node_head *)(*head); + + if (rn_inithead_internal((void **)&rnh->rnh_masks, 0) == 0) { + rn_detachhead_internal(head); + return (0); + } + + return (1); +} + +int +rn_detachhead(void **head) +{ + struct radix_node_head *rnh; + + KASSERT((head != NULL && *head != NULL), + ("%s: head already freed", __func__)); + + rnh = *head; + + rn_detachhead_internal((void **)&rnh->rnh_masks); + rn_detachhead_internal(head); return (1); } void rn_init(int maxk) { - char *cp, *cplim; - - max_keylen = maxk; - if (max_keylen == 0) { + if ((maxk <= 0) || (maxk > RADIX_MAX_KEY_LEN)) { log(LOG_ERR, - "rn_init: radix functions require max_keylen be set\n"); + "rn_init: max_keylen must be within 1..%d\n", + RADIX_MAX_KEY_LEN); return; } - R_Malloc(rn_zeros, char *, 3 * max_keylen); - if (rn_zeros == NULL) - panic("rn_init"); - bzero(rn_zeros, 3 * max_keylen); - rn_ones = cp = rn_zeros + max_keylen; - addmask_key = cplim = rn_ones + max_keylen; - while (cp < cplim) - *cp++ = -1; - if (rn_inithead((void **)(void *)&mask_rnhead, 0) == 0) + + /* + * XXX: Compat for old rn_addmask() users + */ + if (rn_inithead((void **)(void *)&mask_rnhead_compat, 0) == 0) panic("rn_init 2"); +#ifdef _KERNEL + mtx_init(&mask_mtx, "radix_mask", NULL, MTX_DEF); +#endif } Modified: stable/9/sys/net/radix.h ============================================================================== --- stable/9/sys/net/radix.h Wed Oct 30 15:46:50 2013 (r257388) +++ stable/9/sys/net/radix.h Wed Oct 30 16:08:27 2013 (r257389) @@ -136,6 +136,7 @@ struct radix_node_head { #ifdef _KERNEL struct rwlock rnh_lock; /* locks entire radix tree */ #endif + struct radix_node_head *rnh_masks; /* Storage for our masks */ }; #ifndef _KERNEL @@ -167,6 +168,7 @@ int rn_detachhead(void **); int rn_refines(void *, void *); struct radix_node *rn_addmask(void *, int, int), + *rn_addmask_r(void *, struct radix_node_head *, int, int), *rn_addroute (void *, void *, struct radix_node_head *, struct radix_node [2]), *rn_delete(void *, void *, struct radix_node_head *), From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 31 10:14:13 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 34512CA4; Thu, 31 Oct 2013 10:14:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 21E532F77; Thu, 31 Oct 2013 10:14:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VAECxo032289; Thu, 31 Oct 2013 10:14:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VAECgE032288; Thu, 31 Oct 2013 10:14:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310311014.r9VAECgE032288@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 31 Oct 2013 10:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257433 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 10:14:13 -0000 Author: kib Date: Thu Oct 31 10:14:12 2013 New Revision: 257433 URL: http://svnweb.freebsd.org/changeset/base/257433 Log: MFC r257221: Fix typo. Modified: stable/9/sys/kern/subr_param.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_param.c ============================================================================== --- stable/9/sys/kern/subr_param.c Thu Oct 31 10:12:25 2013 (r257432) +++ stable/9/sys/kern/subr_param.c Thu Oct 31 10:14:12 2013 (r257433) @@ -352,7 +352,7 @@ init_param2(long physpages) } /* - * Sysctl stringiying handler for kern.vm_guest. + * Sysctl stringifying handler for kern.vm_guest. */ static int sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS) From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 31 20:31:17 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3867A499; Thu, 31 Oct 2013 20:31:17 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 250012022; Thu, 31 Oct 2013 20:31:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VKVHor048537; Thu, 31 Oct 2013 20:31:17 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VKVHSS048536; Thu, 31 Oct 2013 20:31:17 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201310312031.r9VKVHSS048536@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 31 Oct 2013 20:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257470 - stable/9/sbin/hastd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 20:31:17 -0000 Author: trociny Date: Thu Oct 31 20:31:16 2013 New Revision: 257470 URL: http://svnweb.freebsd.org/changeset/base/257470 Log: MFC r257154: Merging local and remote bitmaps must be protected by hr_amp lock. This is believed to fix hastd crashes, which might occur during synchronization, triggered by the failed assertion: Assertion failed: (amp->am_memtab[ext] > 0), function activemap_write_complete, file activemap.c, line 351. Modified: stable/9/sbin/hastd/primary.c Directory Properties: stable/9/sbin/hastd/ (props changed) Modified: stable/9/sbin/hastd/primary.c ============================================================================== --- stable/9/sbin/hastd/primary.c Thu Oct 31 20:30:56 2013 (r257469) +++ stable/9/sbin/hastd/primary.c Thu Oct 31 20:31:16 2013 (r257470) @@ -781,6 +781,7 @@ init_remote(struct hast_resource *res, s free(map); goto close; } + mtx_lock(&res->hr_amp_lock); /* * Merge local and remote bitmaps. */ @@ -790,7 +791,6 @@ init_remote(struct hast_resource *res, s * Now that we merged bitmaps from both nodes, flush it to the * disk before we start to synchronize. */ - mtx_lock(&res->hr_amp_lock); (void)hast_activemap_flush(res); } nv_free(nvin); From owner-svn-src-stable-9@FreeBSD.ORG Fri Nov 1 06:56:29 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4114ED11; Fri, 1 Nov 2013 06:56:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2126B2320; Fri, 1 Nov 2013 06:56:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA16uS5l062960; Fri, 1 Nov 2013 06:56:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA16uSf5062959; Fri, 1 Nov 2013 06:56:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311010656.rA16uSf5062959@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Nov 2013 06:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257496 - stable/9/sys/x86/x86 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 06:56:29 -0000 Author: kib Date: Fri Nov 1 06:56:28 2013 New Revision: 257496 URL: http://svnweb.freebsd.org/changeset/base/257496 Log: MFC r257069: Add ddb 'show ioapic' and 'show all ioapics' commands. Modified: stable/9/sys/x86/x86/io_apic.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/x86/x86/io_apic.c ============================================================================== --- stable/9/sys/x86/x86/io_apic.c Fri Nov 1 06:33:17 2013 (r257495) +++ stable/9/sys/x86/x86/io_apic.c Fri Nov 1 06:56:28 2013 (r257496) @@ -922,3 +922,99 @@ DEFINE_CLASS_0(apic, apic_driver, apic_m static devclass_t apic_devclass; DRIVER_MODULE(apic, nexus, apic_driver, apic_devclass, 0, 0); + +#include "opt_ddb.h" + +#ifdef DDB +#include + +static const char * +ioapic_delivery_mode(uint32_t mode) +{ + + switch (mode) { + case IOART_DELFIXED: + return ("fixed"); + case IOART_DELLOPRI: + return ("lowestpri"); + case IOART_DELSMI: + return ("SMI"); + case IOART_DELRSV1: + return ("rsrvd1"); + case IOART_DELNMI: + return ("NMI"); + case IOART_DELINIT: + return ("INIT"); + case IOART_DELRSV2: + return ("rsrvd2"); + case IOART_DELEXINT: + return ("ExtINT"); + default: + return (""); + } +} + +static u_int +db_ioapic_read(volatile ioapic_t *apic, int reg) +{ + + apic->ioregsel = reg; + return (apic->iowin); +} + +static void +db_show_ioapic_one(volatile ioapic_t *io_addr) +{ + uint32_t r, lo, hi; + int mre, i; + + r = db_ioapic_read(io_addr, IOAPIC_VER); + mre = (r & IOART_VER_MAXREDIR) >> MAXREDIRSHIFT; + db_printf("Id 0x%08x Ver 0x%02x MRE %d\n", + db_ioapic_read(io_addr, IOAPIC_ID), r & IOART_VER_VERSION, mre); + for (i = 0; i < mre; i++) { + lo = db_ioapic_read(io_addr, IOAPIC_REDTBL_LO(i)); + hi = db_ioapic_read(io_addr, IOAPIC_REDTBL_HI(i)); + db_printf(" pin %d Dest %s/%x %smasked Trig %s RemoteIRR %d " + "Polarity %s Status %s DeliveryMode %s Vec %d\n", i, + (lo & IOART_DESTMOD) == IOART_DESTLOG ? "log" : "phy", + (hi & IOART_DEST) >> 24, + (lo & IOART_INTMASK) == IOART_INTMSET ? "" : "not", + (lo & IOART_TRGRMOD) == IOART_TRGRLVL ? "lvl" : "edge", + (lo & IOART_REM_IRR) == IOART_REM_IRR ? 1 : 0, + (lo & IOART_INTPOL) == IOART_INTALO ? "low" : "high", + (lo & IOART_DELIVS) == IOART_DELIVS ? "pend" : "idle", + ioapic_delivery_mode(lo & IOART_DELMOD), + (lo & IOART_INTVEC)); + } +} + +DB_SHOW_COMMAND(ioapic, db_show_ioapic) +{ + struct ioapic *ioapic; + int idx, i; + + if (!have_addr) { + db_printf("usage: show ioapic index\n"); + return; + } + + idx = (int)addr; + i = 0; + STAILQ_FOREACH(ioapic, &ioapic_list, io_next) { + if (idx == i) { + db_show_ioapic_one(ioapic->io_addr); + break; + } + i++; + } +} + +DB_SHOW_ALL_COMMAND(ioapics, db_show_all_ioapics) +{ + struct ioapic *ioapic; + + STAILQ_FOREACH(ioapic, &ioapic_list, io_next) + db_show_ioapic_one(ioapic->io_addr); +} +#endif From owner-svn-src-stable-9@FreeBSD.ORG Fri Nov 1 07:03:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E7E17F99; Fri, 1 Nov 2013 07:03:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D61312384; Fri, 1 Nov 2013 07:03:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA173igF066228; Fri, 1 Nov 2013 07:03:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA173i99066227; Fri, 1 Nov 2013 07:03:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311010703.rA173i99066227@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Nov 2013 07:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257497 - stable/9/sys/dev/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 07:03:45 -0000 Author: kib Date: Fri Nov 1 07:03:44 2013 New Revision: 257497 URL: http://svnweb.freebsd.org/changeset/base/257497 Log: MFC r257071: Add some definitions for the bits in root control and status PCIe cap registers. Modified: stable/9/sys/dev/pci/pcireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/pcireg.h ============================================================================== --- stable/9/sys/dev/pci/pcireg.h Fri Nov 1 06:56:28 2013 (r257496) +++ stable/9/sys/dev/pci/pcireg.h Fri Nov 1 07:03:44 2013 (r257497) @@ -752,8 +752,17 @@ #define PCIEM_SLOT_STA_EIS 0x0080 #define PCIEM_SLOT_STA_DLLSC 0x0100 #define PCIER_ROOT_CTL 0x1c +#define PCIEM_ROOT_CTL_SERR_CORR 0x0001 +#define PCIEM_ROOT_CTL_SERR_NONFATAL 0x0002 +#define PCIEM_ROOT_CTL_SERR_FATAL 0x0004 +#define PCIEM_ROOT_CTL_PME 0x0008 +#define PCIEM_ROOT_CTL_CRS_VIS 0x0010 #define PCIER_ROOT_CAP 0x1e +#define PCIEM_ROOT_CAP_CRS_VIS 0x0001 #define PCIER_ROOT_STA 0x20 +#define PCIEM_ROOT_STA_PME_REQID_MASK 0x0000ffff +#define PCIEM_ROOT_STA_PME_STATUS 0x00010000 +#define PCIEM_ROOT_STA_PME_PEND 0x00020000 #define PCIER_DEVICE_CAP2 0x24 #define PCIER_DEVICE_CTL2 0x28 #define PCIEM_CTL2_COMP_TIMEOUT_VAL 0x000f