From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 20 12:05:57 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 768D0106566B; Sun, 20 Mar 2011 12:05:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 660B58FC12; Sun, 20 Mar 2011 12:05:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2KC5vuA078180; Sun, 20 Mar 2011 12:05:57 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2KC5vSA078178; Sun, 20 Mar 2011 12:05:57 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201103201205.p2KC5vSA078178@svn.freebsd.org> From: Andriy Gapon Date: Sun, 20 Mar 2011 12:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219796 - stable/7/sys/amd64/conf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Mar 2011 12:05:57 -0000 Author: avg Date: Sun Mar 20 12:05:57 2011 New Revision: 219796 URL: http://svn.freebsd.org/changeset/base/219796 Log: MFC r219525: amd64/NOTES: use a greater number in KSTACK_PAGES example Modified: stable/7/sys/amd64/conf/NOTES Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/conf/NOTES ============================================================================== --- stable/7/sys/amd64/conf/NOTES Sun Mar 20 11:58:42 2011 (r219795) +++ stable/7/sys/amd64/conf/NOTES Sun Mar 20 12:05:57 2011 (r219796) @@ -658,7 +658,7 @@ options LINSYSFS # KSTACK_PAGES is the number of memory pages to assign to the kernel # stack of each thread. -options KSTACK_PAGES=3 +options KSTACK_PAGES=5 ##################################################################### From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 21 06:18:27 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 308E81065675; Mon, 21 Mar 2011 06:18:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 029BD8FC16; Mon, 21 Mar 2011 06:18:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2L6IQTT001826; Mon, 21 Mar 2011 06:18:26 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2L6IQuE001825; Mon, 21 Mar 2011 06:18:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201103210618.p2L6IQuE001825@svn.freebsd.org> From: Xin LI Date: Mon, 21 Mar 2011 06:18:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219812 - in stable: 7/tools/tools/nanobsd 7/tools/tools/nanobsd/Files/root 8/tools/tools/nanobsd/Files/root X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2011 06:18:27 -0000 Author: delphij Date: Mon Mar 21 06:18:26 2011 New Revision: 219812 URL: http://svn.freebsd.org/changeset/base/219812 Log: MFC r218816: Add a helper script that detects which partition we are on and update the other. Obtained from: FreeNAS Sponsored by: iXsystems, Inc. Added: stable/7/tools/tools/nanobsd/Files/root/update - copied unchanged from r218816, head/tools/tools/nanobsd/Files/root/update Modified: Directory Properties: stable/7/tools/tools/nanobsd/ (props changed) stable/7/tools/tools/nanobsd/FlashDevice.sub (props changed) stable/7/tools/tools/nanobsd/nanobsd.sh (props changed) Changes in other areas also in this revision: Added: stable/8/tools/tools/nanobsd/Files/root/update - copied unchanged from r218816, head/tools/tools/nanobsd/Files/root/update Modified: Directory Properties: stable/8/tools/tools/nanobsd/ (props changed) Copied: stable/7/tools/tools/nanobsd/Files/root/update (from r218816, head/tools/tools/nanobsd/Files/root/update) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/tools/tools/nanobsd/Files/root/update Mon Mar 21 06:18:26 2011 (r219812, copy of r218816, head/tools/tools/nanobsd/Files/root/update) @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright (c) 2011 iXsystems, Inc. +# 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$ +# +# Script to update a NanoBSD system. +# +# usage: +# ssh somewhere cat image.s1 | sh update +# + +set -e + +. /etc/nanobsd.conf + +if mount | grep ${NANO_DRIVE}s1 > /dev/null ; then + exec sh /root/updatep2 +else + exec sh /root/updatep1 +fi + From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 21 13:28:38 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E0581065676; Mon, 21 Mar 2011 13:28:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F3328FC26; Mon, 21 Mar 2011 13:28:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2LDScVi006314; Mon, 21 Mar 2011 13:28:38 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2LDScfY006312; Mon, 21 Mar 2011 13:28:38 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201103211328.p2LDScfY006312@svn.freebsd.org> From: Glen Barber Date: Mon, 21 Mar 2011 13:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219825 - stable/7/sbin/ifconfig X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2011 13:28:38 -0000 Author: gjb (doc committer) Date: Mon Mar 21 13:28:38 2011 New Revision: 219825 URL: http://svn.freebsd.org/changeset/base/219825 Log: MFC 219805: - Use 'list scan' in favor of 'scan', as 'scan' has a different purpose. Modified: stable/7/sbin/ifconfig/ifconfig.8 Directory Properties: stable/7/sbin/ifconfig/ (props changed) Modified: stable/7/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/7/sbin/ifconfig/ifconfig.8 Mon Mar 21 13:28:01 2011 (r219824) +++ stable/7/sbin/ifconfig/ifconfig.8 Mon Mar 21 13:28:38 2011 (r219825) @@ -1949,7 +1949,7 @@ Destroy the software network interface .Pp Scan for wireless networks using .Li ath0 : -.Dl # ifconfig ath0 scan +.Dl # ifconfig ath0 list scan .Sh DIAGNOSTICS Messages indicating the specified interface does not exist, the requested address is unknown, or the user is not privileged and From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 21 15:23:10 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 876BC1065687; Mon, 21 Mar 2011 15:23:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78A718FC1C; Mon, 21 Mar 2011 15:23:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2LFNAfv009957; Mon, 21 Mar 2011 15:23:10 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2LFNAHD009955; Mon, 21 Mar 2011 15:23:10 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201103211523.p2LFNAHD009955@svn.freebsd.org> From: Glen Barber Date: Mon, 21 Mar 2011 15:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219836 - stable/7/sbin/ifconfig X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2011 15:23:10 -0000 Author: gjb (doc committer) Date: Mon Mar 21 15:23:10 2011 New Revision: 219836 URL: http://svn.freebsd.org/changeset/base/219836 Log: MFC 219834: Bump date from previous commit. Modified: stable/7/sbin/ifconfig/ifconfig.8 Directory Properties: stable/7/sbin/ifconfig/ (props changed) Modified: stable/7/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/7/sbin/ifconfig/ifconfig.8 Mon Mar 21 15:22:48 2011 (r219835) +++ stable/7/sbin/ifconfig/ifconfig.8 Mon Mar 21 15:23:10 2011 (r219836) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd February 20, 2010 +.Dd March 20, 2011 .Dt IFCONFIG 8 .Os .Sh NAME From owner-svn-src-stable-7@FreeBSD.ORG Thu Mar 24 17:09:37 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0B931065672; Thu, 24 Mar 2011 17:09:37 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC3078FC12; Thu, 24 Mar 2011 17:09:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2OH9bQ0052051; Thu, 24 Mar 2011 17:09:37 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2OH9bMm052049; Thu, 24 Mar 2011 17:09:37 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201103241709.p2OH9bMm052049@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 24 Mar 2011 17:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219966 - stable/7/contrib/groff/tmac X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2011 17:09:38 -0000 Author: uqs Date: Thu Mar 24 17:09:37 2011 New Revision: 219966 URL: http://svn.freebsd.org/changeset/base/219966 Log: MFH r219209: Unbreak .Aq for non-ASCII output like -Tps or -Tutf8. PR: gnu/154822 Submitted by: Dominic Fandrey Modified: stable/7/contrib/groff/tmac/doc.tmac Directory Properties: stable/7/contrib/groff/ (props changed) Modified: stable/7/contrib/groff/tmac/doc.tmac ============================================================================== --- stable/7/contrib/groff/tmac/doc.tmac Thu Mar 24 17:09:24 2011 (r219965) +++ stable/7/contrib/groff/tmac/doc.tmac Thu Mar 24 17:09:37 2011 (r219966) @@ -1197,8 +1197,8 @@ . if !\n[doc-arg-limit] \ . ds doc-macro-name Aq . -. ds doc-quote-left \[la] -. ds doc-quote-right \[ra] +. ds doc-quote-left < +. ds doc-quote-right > . . doc-enclose-string \$@ .. From owner-svn-src-stable-7@FreeBSD.ORG Fri Mar 25 18:16:50 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B2051065679; Fri, 25 Mar 2011 18:16:50 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 398148FC15; Fri, 25 Mar 2011 18:16:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2PIGoPS089485; Fri, 25 Mar 2011 18:16:50 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2PIGo18089480; Fri, 25 Mar 2011 18:16:50 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201103251816.p2PIGo18089480@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 25 Mar 2011 18:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220003 - in stable/7/sys: ddb gdb kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2011 18:16:50 -0000 Author: mdf Date: Fri Mar 25 18:16:49 2011 New Revision: 220003 URL: http://svn.freebsd.org/changeset/base/220003 Log: MFC r218825. [The implementation change to kdb_sysctl_available() cannot be MFC'd as it requires a non-MFCable change (adding drains to sbuf)]. Modify kdb_trap() so that it re-calls the dbbe_trap function as long as the debugger back-end has changed. This means that switching from ddb to gdb no longer requires a "step" which can be dangerous on an already-crashed kernel. Also add a capability to get from the gdb back-end back to ddb, by typing ^C in the console window. While here, simplify kdb_sysctl_available() by using sbuf_new_for_sysctl(), and use strlcpy() instead of strncpy() since the strlcpy semantic is desired. Modified: stable/7/sys/ddb/db_command.c stable/7/sys/gdb/gdb_main.c stable/7/sys/gdb/gdb_packet.c stable/7/sys/kern/subr_kdb.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/ddb/db_command.c ============================================================================== --- stable/7/sys/ddb/db_command.c Fri Mar 25 18:16:36 2011 (r220002) +++ stable/7/sys/ddb/db_command.c Fri Mar 25 18:16:49 2011 (r220003) @@ -662,10 +662,16 @@ static void db_gdb(db_expr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4) { - if (kdb_dbbe_select("gdb") != 0) + if (kdb_dbbe_select("gdb") != 0) { db_printf("The remote GDB backend could not be selected.\n"); - else - db_printf("Step to enter the remote GDB backend.\n"); + return; + } + /* + * Mark that we are done in the debugger. kdb_trap() + * should re-enter with the new backend. + */ + db_cmd_loop_done = 1; + db_printf("(ctrl-c will return control to ddb)\n"); } static void Modified: stable/7/sys/gdb/gdb_main.c ============================================================================== --- stable/7/sys/gdb/gdb_main.c Fri Mar 25 18:16:36 2011 (r220002) +++ stable/7/sys/gdb/gdb_main.c Fri Mar 25 18:16:49 2011 (r220003) @@ -95,7 +95,17 @@ gdb_init(void) static int gdb_trap(int type, int code) { + jmp_buf jb; struct thread *thr_iter; + void *prev_jb; + + prev_jb = kdb_jmpbuf(jb); + if (setjmp(jb) != 0) { + printf("%s bailing, hopefully back to ddb!\n", __func__); + gdb_listening = 0; + (void)kdb_jmpbuf(prev_jb); + return (1); + } gdb_listening = 0; /* @@ -291,5 +301,6 @@ gdb_trap(int type, int code) break; } } + (void)kdb_jmpbuf(prev_jb); return (0); } Modified: stable/7/sys/gdb/gdb_packet.c ============================================================================== --- stable/7/sys/gdb/gdb_packet.c Fri Mar 25 18:16:36 2011 (r220002) +++ stable/7/sys/gdb/gdb_packet.c Fri Mar 25 18:16:49 2011 (r220003) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -60,6 +61,17 @@ gdb_getc(void) do c = gdb_cur->gdb_getc(); while (c == -1); + + if (c == CTRL('C')) { + printf("Received ^C; trying to switch back to ddb.\n"); + + if (kdb_dbbe_select("ddb") != 0) + printf("The ddb backend could not be selected.\n"); + else { + printf("using longjmp, hope it works!\n"); + kdb_reenter(); + } + } return (c); } Modified: stable/7/sys/kern/subr_kdb.c ============================================================================== --- stable/7/sys/kern/subr_kdb.c Fri Mar 25 18:16:36 2011 (r220002) +++ stable/7/sys/kern/subr_kdb.c Fri Mar 25 18:16:49 2011 (r220003) @@ -141,10 +141,9 @@ kdb_sysctl_current(SYSCTL_HANDLER_ARGS) char buf[16]; int error; - if (kdb_dbbe != NULL) { - strncpy(buf, kdb_dbbe->dbbe_name, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; - } else + if (kdb_dbbe != NULL) + strlcpy(buf, kdb_dbbe->dbbe_name, sizeof(buf)); + else *buf = '\0'; error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) @@ -491,13 +490,15 @@ kdb_thr_select(struct thread *thr) int kdb_trap(int type, int code, struct trapframe *tf) { + struct kdb_dbbe *be; register_t intr; #ifdef SMP int did_stop_cpus; #endif int handled; - if (kdb_dbbe == NULL || kdb_dbbe->dbbe_trap == NULL) + be = kdb_dbbe; + if (be == NULL || be->dbbe_trap == NULL) return (0); /* We reenter the debugger through kdb_reenter(). */ @@ -521,7 +522,15 @@ kdb_trap(int type, int code, struct trap makectx(tf, &kdb_pcb); kdb_thr_select(curthread); - handled = kdb_dbbe->dbbe_trap(type, code); + for (;;) { + handled = be->dbbe_trap(type, code); + if (be == kdb_dbbe) + break; + be = kdb_dbbe; + if (be == NULL || be->dbbe_trap == NULL) + break; + printf("Switching to %s back-end\n", be->dbbe_name); + } kdb_active--; From owner-svn-src-stable-7@FreeBSD.ORG Fri Mar 25 20:51:20 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C858A106566C; Fri, 25 Mar 2011 20:51:20 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B48058FC16; Fri, 25 Mar 2011 20:51:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2PKpKaJ093170; Fri, 25 Mar 2011 20:51:20 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2PKpKmX093162; Fri, 25 Mar 2011 20:51:20 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201103252051.p2PKpKmX093162@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 25 Mar 2011 20:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220008 - in stable/7: share/man/man9 sys/conf sys/kern sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2011 20:51:20 -0000 Author: mdf Date: Fri Mar 25 20:51:20 2011 New Revision: 220008 URL: http://svn.freebsd.org/changeset/base/220008 Log: MFC r192908 (introduced before the stable/8 split from CURRENT): fail(9) support: Add support for kernel fault injection using KFAIL_POINT_* macros and fail_point_* infrastructure. Add example fail point in vfs_bio.c to simulate VM buf pressure. MFC r192978: Fix style/grammar issues in fail(9) man page. MFC r216616: Move the fail_point_entry definition from fail.h to kern_fail.c, which allows putting the enumeration constants of fail point types with the text string that matches them. MFC r216620: Initialize fp_location for explicitly managed fail points, and push the parentheses around the location for simple fail points into the location string. This makes the print on fail point set more consistent between the two versions. Also fix up fail.h a little for style(9): only use one of sys/param.h and sys/types.h, and use the existing __XSTRING() macro instead of rolling our own. Also fix up a few tabs on changed and nearby lines. Lastly, since KFAIL_POINT_{BEGIN,END} are not meant for use outside this file, just eliminate the macros entirely. Added: stable/7/share/man/man9/fail.9 - copied, changed from r192908, head/share/man/man9/fail.9 stable/7/sys/kern/kern_fail.c - copied, changed from r192908, head/sys/kern/kern_fail.c stable/7/sys/sys/fail.h - copied, changed from r192908, head/sys/sys/fail.h Modified: stable/7/share/man/man9/Makefile stable/7/sys/conf/files stable/7/sys/kern/vfs_bio.c stable/7/sys/sys/queue.h Directory Properties: stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man9/Makefile ============================================================================== --- stable/7/share/man/man9/Makefile Fri Mar 25 20:19:15 2011 (r220007) +++ stable/7/share/man/man9/Makefile Fri Mar 25 20:51:20 2011 (r220008) @@ -97,6 +97,7 @@ MAN= accept_filter.9 \ DRIVER_MODULE.9 \ EVENTHANDLER.9 \ extattr.9 \ + fail.9 \ fetch.9 \ firmware.9 \ g_access.9 \ Copied and modified: stable/7/share/man/man9/fail.9 (from r192908, head/share/man/man9/fail.9) ============================================================================== --- head/share/man/man9/fail.9 Wed May 27 16:36:54 2009 (r192908, copy source) +++ stable/7/share/man/man9/fail.9 Fri Mar 25 20:51:20 2011 (r220008) @@ -48,9 +48,11 @@ .Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label" .Sh DESCRIPTION Fail points are used to add code points where errors may be injected -in a user controlled fashion. Fail points provide a convenient wrapper -around user provided error injection code, providing a -.Xr sysctl 9 MIB , and a parser for that MIB that describes how the error +in a user controlled fashion. +Fail points provide a convenient wrapper around user-provided error +injection code, providing a +.Xr sysctl 9 +MIB, and a parser for that MIB that describes how the error injection code should fire. .Pp The base fail point macro is @@ -64,16 +66,19 @@ their own fail point trees), and .Fa name is the name of the MIB in that tree, and .Fa code -is the error injection code. The +is the error injection code. +The .Fa code argument does not require braces, but it is considered good style to -use braces for any multi-line code arguments. Inside the +use braces for any multi-line code arguments. +Inside the .Fa code argument, the evaluation of .Sy RETURN_VALUE is derived from the .Fn return -value set in the sysctl MIB. See +value set in the sysctl MIB. +See .Sx SYSCTL SETTINGS below. .Pp @@ -99,14 +104,14 @@ is the equivalent of .Sh SYSCTL VARIABLES The .Fn KFAIL_POINT_* -macros add sysctl MIBs where specified. Many base kernel MIBs can be -found in the +macros add sysctl MIBs where specified. +Many base kernel MIBs can be found in the .Sy debug.fail_point tree (referenced in code by .Sy DEBUG_FP ). .Pp -The sysctl setting recognizes the following grammar: +The sysctl variable may be set using the following grammar: .Pp :: ( "->" )* @@ -135,27 +140,30 @@ Sleep the specified number of millisecon .It Sy panic Panic .It Sy break -Break into the debugger. +Break into the debugger, or trap if there is no debugger support .It Sy print Print that the fail point executed .El .Pp The % and * modifiers prior to control when - is executed. The % form (e.g. "1.2%") can be used to -specify a probability that will execute. The * form -(e.g. "5*") can be used to specify the number of times should -be executed before this is disabled. Only the last probability -and the last count are used if multiple are specified, i.e. "1.2%2%" -is the same as "2%". When both a probability and a count are -specified, the probability is evaluated before the count, i.e. "2%5*" -means "2% of the time, but only execute it 5 times total". -.Pp -The operator -> can be used to express cascading terms. If you specify -->, it means that if doesn't 'execute', -is evaluated. For the purpose of this operator, the return() and -print() operators are the only types that cascade. A return() term -only cascades if the code executes, and a print() term only cascades -when passed a non-zero argument. + is executed. +The % form (e.g. "1.2%") can be used to specify a +probability that will execute. +The * form (e.g. "5*") can be used to specify the number of +times should be executed before this is disabled. +Only the last probability and the last count are used if multiple +are specified, i.e. "1.2%2%" is the same as "2%". +When both a probability and a count are specified, the probability +is evaluated before the count, i.e. "2%5*" means "2% of the time, +but only 5 times total". +.Pp +The operator -> can be used to express cascading terms. +If you specify ->, it means that if doesn't +'execute', is evaluated. +For the purpose of this operator, the return() and print() operators +are the only types that cascade. +A return() term only cascades if the code executes, and a print() +term only cascades when passed a non-zero argument. .Pp .Sh EXAMPLES .Bl -tag @@ -164,29 +172,32 @@ when passed a non-zero argument. .Fa code with RETURN_VALUE set to 5. .It Sy sysctl debug.fail_point.foobar="2%return(5)->5%return(22)" -2/100th of the time, execute +2/100ths of the time, execute .Fa code -with RETURN_VALUE set to 5. If that doesn't happen, 5% of the time -execute +with RETURN_VALUE set to 5. +If that doesn't happen, 5% of the time execute .Fa code with RETURN_VALUE set to 22. .It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)" -For 5 times, return 5. After that, 1/1000ths of the time, return 22. +For 5 times, return 5. +After that, 1/1000th of the time, return 22. .It Sy sysctl debug.fail_point.foobar="0.1%5*return(5)" -Return 5 for 1 in 1000 executions, but only execute 5 times total. +Return 5 for 1 in 1000 executions, but only 5 times total. .It Sy sysctl debug.fail_point.foobar="1%*sleep(50)" -1/100ths of the time, sleep 50ms. +1/100th of the time, sleep 50ms. .El .Pp .Sh CAVEATS It's easy to shoot yourself in the foot by setting fail points too -aggressively or setting too many in combination. For example, forcing +aggressively or setting too many in combination. +For example, forcing .Fn malloc to fail consistently is potentially harmful to uptime. .Pp The .Fn sleep -sysctl setting may not be appropriate in all situations. Currently, +sysctl setting may not be appropriate in all situations. +Currently, .Fn fail_point_eval does not verify whether the context is appropriate for calling .Fn msleep . Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Fri Mar 25 20:19:15 2011 (r220007) +++ stable/7/sys/conf/files Fri Mar 25 20:51:20 2011 (r220008) @@ -1618,6 +1618,7 @@ kern/kern_environment.c standard kern/kern_event.c standard kern/kern_exec.c standard kern/kern_exit.c standard +kern/kern_fail.c standard kern/kern_fork.c standard kern/kern_idle.c standard kern/kern_intr.c standard Copied and modified: stable/7/sys/kern/kern_fail.c (from r192908, head/sys/kern/kern_fail.c) ============================================================================== --- head/sys/kern/kern_fail.c Wed May 27 16:36:54 2009 (r192908, copy source) +++ stable/7/sys/kern/kern_fail.c Fri Mar 25 20:51:20 2011 (r220008) @@ -76,6 +76,43 @@ MTX_SYSINIT(g_fp_mtx, &g_fp_mtx, "fail p #define FP_LOCK() mtx_lock(&g_fp_mtx) #define FP_UNLOCK() mtx_unlock(&g_fp_mtx) +/** + * Failpoint types. + * Don't change these without changing fail_type_strings in fail.c. + * @ingroup failpoint_private + */ +enum fail_point_t { + FAIL_POINT_OFF, /**< don't fail */ + FAIL_POINT_PANIC, /**< panic */ + FAIL_POINT_RETURN, /**< return an errorcode */ + FAIL_POINT_BREAK, /**< break into the debugger */ + FAIL_POINT_PRINT, /**< print a message */ + FAIL_POINT_SLEEP, /**< sleep for some msecs */ + FAIL_POINT_INVALID, /**< placeholder */ +}; + +static const char *fail_type_strings[] = { + "off", + "panic", + "return", + "break", + "print", + "sleep", +}; + +/** + * Internal structure tracking a single term of a complete failpoint. + * @ingroup failpoint_private + */ +struct fail_point_entry { + enum fail_point_t fe_type; /**< type of entry */ + int fe_arg; /**< argument to type (e.g. return value) */ + int fe_prob; /**< likelihood of firing in millionths */ + int fe_count; /**< number of times to fire, 0 means always */ + + TAILQ_ENTRY(fail_point_entry) fe_entries; /**< next entry in fail point */ +}; + static inline void fail_point_sleep(struct fail_point *fp, struct fail_point_entry *ent, int msecs, enum fail_point_return_code *pret) @@ -102,15 +139,6 @@ enum { PROB_DIGITS = 6, /* number of zero's in above number */ }; -static const char *fail_type_strings[] = { - "off", - "panic", - "return", - "break", - "print", - "sleep", -}; - static char *parse_fail_point(struct fail_point_entries *, char *); static char *parse_term(struct fail_point_entries *, char *); static char *parse_number(int *out_units, int *out_decimal, char *); @@ -149,6 +177,7 @@ fail_point_init(struct fail_point *fp, c va_end(ap); } fp->fp_name = name; + fp->fp_location = ""; fp->fp_flags |= FAIL_POINT_DYNAMIC_NAME; fp->fp_sleep_fn = NULL; fp->fp_sleep_arg = NULL; @@ -344,10 +373,10 @@ fail_point_set(struct fail_point *fp, ch end: #ifdef IWARNING if (error) - IWARNING("Failed to set %s (%s) to %s", + IWARNING("Failed to set %s %s to %s", fp->fp_name, fp->fp_location, buf); else - INOTICE("Set %s (%s) to %s", + INOTICE("Set %s %s to %s", fp->fp_name, fp->fp_location, buf); #endif /* IWARNING */ Modified: stable/7/sys/kern/vfs_bio.c ============================================================================== --- stable/7/sys/kern/vfs_bio.c Fri Mar 25 20:19:15 2011 (r220007) +++ stable/7/sys/kern/vfs_bio.c Fri Mar 25 20:51:20 2011 (r220008) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1180,6 +1181,15 @@ buf_dirty_count_severe(void) return(numdirtybuffers >= hidirtybuffers); } +static __noinline int +buf_vm_page_count_severe(void) +{ + + KFAIL_POINT_CODE(DEBUG_FP, buf_pressure, return 1); + + return vm_page_count_severe(); +} + /* * brelse: * @@ -1252,7 +1262,7 @@ brelse(struct buf *bp) */ if (bp->b_flags & B_DELWRI) bp->b_flags &= ~B_RELBUF; - else if (vm_page_count_severe()) { + else if (buf_vm_page_count_severe()) { /* * XXX This lock may not be necessary since BKGRDINPROG * cannot be set while we hold the buf lock, it can only be @@ -1522,7 +1532,7 @@ bqrelse(struct buf *bp) * cleared if it is already pending. */ BO_LOCK(bp->b_bufobj); - if (!vm_page_count_severe() || bp->b_vflags & BV_BKGRDINPROG) { + if (!buf_vm_page_count_severe() || bp->b_vflags & BV_BKGRDINPROG) { BO_UNLOCK(bp->b_bufobj); bp->b_qindex = QUEUE_CLEAN; TAILQ_INSERT_TAIL(&bufqueues[QUEUE_CLEAN], bp, @@ -1593,7 +1603,7 @@ vfs_vmio_release(struct buf *bp) vm_page_free(m); } else if (bp->b_flags & B_DIRECT) { vm_page_try_to_free(m); - } else if (vm_page_count_severe()) { + } else if (buf_vm_page_count_severe()) { vm_page_try_to_cache(m); } } Copied and modified: stable/7/sys/sys/fail.h (from r192908, head/sys/sys/fail.h) ============================================================================== --- head/sys/sys/fail.h Wed May 27 16:36:54 2009 (r192908, copy source) +++ stable/7/sys/sys/fail.h Fri Mar 25 20:51:20 2011 (r220008) @@ -32,29 +32,12 @@ #ifndef _SYS_FAIL_H_ #define _SYS_FAIL_H_ -#include - -#include #include +#include +#include #include #include - -/** - * Failpoint types. - * Don't change these without changing fail_type_strings in fail.c. - * @ingroup failpoint_private - */ -enum fail_point_t { - FAIL_POINT_OFF, /**< don't fail */ - FAIL_POINT_PANIC, /**< panic */ - FAIL_POINT_RETURN, /**< return an errorcode */ - FAIL_POINT_BREAK, /**< break into the debugger */ - FAIL_POINT_PRINT, /**< print a message */ - FAIL_POINT_SLEEP, /**< sleep for some msecs */ - FAIL_POINT_INVALID, /**< placeholder */ -}; - /** * Failpoint return codes, used internally. * @ingroup failpoint_private @@ -65,6 +48,7 @@ enum fail_point_return_code { FAIL_POINT_RC_QUEUED, /**< sleep_fn will be called */ }; +struct fail_point_entry; TAILQ_HEAD(fail_point_entries, fail_point_entry); /** * Internal failpoint structure, tracking all the current details of the @@ -84,18 +68,7 @@ struct fail_point { #define FAIL_POINT_DYNAMIC_NAME 0x01 /**< Must free name on destroy */ -/** - * Internal structure tracking a single term of a complete failpoint. - * @ingroup failpoint_private - */ -struct fail_point_entry { - enum fail_point_t fe_type; /**< type of entry */ - int fe_arg; /**< argument to type (e.g. return value) */ - int fe_prob; /**< likelihood of firing in millionths */ - int fe_count; /**< number of times to fire, 0 means always */ - - TAILQ_ENTRY(fail_point_entry) fe_entries; /**< next entry in fail point */ -}; +__BEGIN_DECLS /* Private failpoint eval function -- use fail_point_eval() instead. */ enum fail_point_return_code fail_point_eval_nontrivial(struct fail_point *, @@ -152,11 +125,11 @@ fail_point_eval(struct fail_point *fp, i return (fail_point_eval_nontrivial(fp, ret)); } +__END_DECLS + /* Declare a fail_point and its sysctl in a function. */ -#define _FAIL_POINT_NAME(name) _fail_point_##name -#define _STRINGIFY_HELPER(x) #x -#define _STRINGIFY(x) _STRINGIFY_HELPER(x) -#define _FAIL_POINT_LOCATION() __FILE__ ":" _STRINGIFY(__LINE__) +#define _FAIL_POINT_NAME(name) _fail_point_##name +#define _FAIL_POINT_LOCATION() "(" __FILE__ ":" __XSTRING(__LINE__) ")" /** * Instantiate a failpoint which returns "value" from the function when triggered. @@ -202,59 +175,49 @@ fail_point_eval(struct fail_point *fp, i /** * Instantiate a failpoint which runs arbitrary code when triggered. * @param parent The parent sysctl under which to locate the sysctl - * @param name The name of the failpoint in the sysctl tree (and printouts) + * @param name The name of the failpoint in the sysctl tree + * (and printouts) * @param code The arbitrary code to run when triggered. Can reference - * "RETURN_VALUE" if desired to extract the specified user - * return-value when triggered + * "RETURN_VALUE" if desired to extract the specified + * user return-value when triggered. Note that this is + * implemented with a do-while loop so be careful of + * break and continue statements. */ #define KFAIL_POINT_CODE(parent, name, code) \ - KFAIL_POINT_START(parent, name) { \ +do { \ + int RETURN_VALUE; \ + static struct fail_point _FAIL_POINT_NAME(name) = { \ + #name, \ + _FAIL_POINT_LOCATION(), \ + TAILQ_HEAD_INITIALIZER(_FAIL_POINT_NAME(name).fp_entries), \ + 0, \ + NULL, NULL, \ + }; \ + SYSCTL_OID(parent, OID_AUTO, name, \ + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, \ + &_FAIL_POINT_NAME(name), 0, fail_point_sysctl, \ + "A", ""); \ + \ + if (__predict_false( \ + fail_point_eval(&_FAIL_POINT_NAME(name), &RETURN_VALUE))) { \ + \ code; \ - } FAIL_POINT_END + \ + } \ +} while (0) + /** * @} * (end group failpoint) */ -/** - * Internal macro to implement above #defines -- should not be used directly. - * @ingroup failpoint_private - */ -#define KFAIL_POINT_START(parent, name) \ - do { \ - int RETURN_VALUE; \ - static struct fail_point _FAIL_POINT_NAME(name) = { \ - #name, \ - _FAIL_POINT_LOCATION(), \ - TAILQ_HEAD_INITIALIZER( \ - _FAIL_POINT_NAME(name).fp_entries), \ - 0, \ - NULL, NULL, \ - }; \ - SYSCTL_OID(parent, OID_AUTO, name, \ - CTLTYPE_STRING | CTLFLAG_RW, \ - &_FAIL_POINT_NAME(name), 0, fail_point_sysctl, \ - "A", ""); \ - \ - if (__predict_false( \ - fail_point_eval(&_FAIL_POINT_NAME(name), \ - &RETURN_VALUE))) { - -/** - * Internal macro to implement above #defines -- should not be used directly. - * @ingroup failpoint_private - */ -#define FAIL_POINT_END \ - } \ - } while (0) - #ifdef _KERNEL int fail_point_sysctl(SYSCTL_HANDLER_ARGS); /* The fail point sysctl tree. */ SYSCTL_DECL(_debug_fail_point); +#define DEBUG_FP _debug_fail_point #endif -#define DEBUG_FP _debug_fail_point #endif /* _SYS_FAIL_H_ */ Modified: stable/7/sys/sys/queue.h ============================================================================== --- stable/7/sys/sys/queue.h Fri Mar 25 20:19:15 2011 (r220007) +++ stable/7/sys/sys/queue.h Fri Mar 25 20:51:20 2011 (r220008) @@ -313,6 +313,20 @@ struct { \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) +#define STAILQ_SWAP(head1, head2, type) do { \ + struct type *swap_first = STAILQ_FIRST(head1); \ + struct type **swap_last = (head1)->stqh_last; \ + STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_FIRST(head2) = swap_first; \ + (head2)->stqh_last = swap_last; \ + if (STAILQ_EMPTY(head1)) \ + (head1)->stqh_last = &STAILQ_FIRST(head1); \ + if (STAILQ_EMPTY(head2)) \ + (head2)->stqh_last = &STAILQ_FIRST(head2); \ +} while (0) + + /* * List declarations. */ @@ -417,6 +431,16 @@ struct { \ TRASHIT(*oldprev); \ } while (0) +#define LIST_SWAP(head1, head2, type, field) do { \ + struct type *swap_tmp = LIST_FIRST((head1)); \ + LIST_FIRST((head1)) = LIST_FIRST((head2)); \ + LIST_FIRST((head2)) = swap_tmp; \ + if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ + swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ + if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ + swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ +} while (0) + /* * Tail queue declarations. */ @@ -586,6 +610,22 @@ struct { \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) +#define TAILQ_SWAP(head1, head2, type, field) do { \ + struct type *swap_first = (head1)->tqh_first; \ + struct type **swap_last = (head1)->tqh_last; \ + (head1)->tqh_first = (head2)->tqh_first; \ + (head1)->tqh_last = (head2)->tqh_last; \ + (head2)->tqh_first = swap_first; \ + (head2)->tqh_last = swap_last; \ + if ((swap_first = (head1)->tqh_first) != NULL) \ + swap_first->field.tqe_prev = &(head1)->tqh_first; \ + else \ + (head1)->tqh_last = &(head1)->tqh_first; \ + if ((swap_first = (head2)->tqh_first) != NULL) \ + swap_first->field.tqe_prev = &(head2)->tqh_first; \ + else \ + (head2)->tqh_last = &(head2)->tqh_first; \ +} while (0) #ifdef _KERNEL From owner-svn-src-stable-7@FreeBSD.ORG Fri Mar 25 22:00:43 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6938110656E5; Fri, 25 Mar 2011 22:00:43 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 577958FC18; Fri, 25 Mar 2011 22:00:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2PM0hhb094758; Fri, 25 Mar 2011 22:00:43 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2PM0hJ2094756; Fri, 25 Mar 2011 22:00:43 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201103252200.p2PM0hJ2094756@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 25 Mar 2011 22:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220010 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2011 22:00:43 -0000 Author: mdf Date: Fri Mar 25 22:00:43 2011 New Revision: 220010 URL: http://svn.freebsd.org/changeset/base/220010 Log: MFC r216058 and r216059: r216058: Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate the code. r216059: Slightly modify the logic in sysctl_find_oid to reduce the indentation. There should be no functional change. Modified: stable/7/sys/kern/kern_sysctl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_sysctl.c ============================================================================== --- stable/7/sys/kern/kern_sysctl.c Fri Mar 25 20:53:02 2011 (r220009) +++ stable/7/sys/kern/kern_sysctl.c Fri Mar 25 22:00:43 2011 (r220010) @@ -673,7 +673,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) if (oid->oid_handler) break; - lsp2 = (struct sysctl_oid_list *)oid->oid_arg1; + lsp2 = SYSCTL_CHILDREN(oid); break; } lsp = lsp2; @@ -704,7 +704,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_ if (oidp->oid_handler) /* We really should call the handler here...*/ return (0); - lsp = (struct sysctl_oid_list *)oidp->oid_arg1; + lsp = SYSCTL_CHILDREN(oidp); if (!sysctl_sysctl_next_ls(lsp, 0, 0, next+1, len, level+1, oidpp)) return (0); @@ -719,7 +719,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_ return (0); if (oidp->oid_handler) return (0); - lsp = (struct sysctl_oid_list *)oidp->oid_arg1; + lsp = SYSCTL_CHILDREN(oidp); if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, next+1, len, level+1, oidpp)) return (0); @@ -731,7 +731,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_ if (oidp->oid_handler) continue; - lsp = (struct sysctl_oid_list *)oidp->oid_arg1; + lsp = SYSCTL_CHILDREN(oidp); if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, next+1, len, level+1, oidpp)) return (0); @@ -809,7 +809,7 @@ name2oid(char *name, int *oid, int *len, if (oidp->oid_handler) break; - lsp = (struct sysctl_oid_list *)oidp->oid_arg1; + lsp = SYSCTL_CHILDREN(oidp); oidp = SLIST_FIRST(lsp); name = p+1; for (p = name; *p && *p != '.'; p++) @@ -1311,37 +1311,39 @@ int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int *nindx, struct sysctl_req *req) { + struct sysctl_oid_list *lsp; struct sysctl_oid *oid; int indx; SYSCTL_ASSERT_LOCKED(); - oid = SLIST_FIRST(&sysctl__children); + lsp = &sysctl__children; indx = 0; - while (oid && indx < CTL_MAXNAME) { - if (oid->oid_number == name[indx]) { - indx++; - if (oid->oid_kind & CTLFLAG_NOLOCK) - req->lock = REQ_UNLOCKED; - if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) { - if (oid->oid_handler != NULL || - indx == namelen) { - *noid = oid; - if (nindx != NULL) - *nindx = indx; - return (0); - } - oid = SLIST_FIRST( - (struct sysctl_oid_list *)oid->oid_arg1); - } else if (indx == namelen) { + while (indx < CTL_MAXNAME) { + SLIST_FOREACH(oid, lsp, oid_link) { + if (oid->oid_number == name[indx]) + break; + } + if (oid == NULL) + return (ENOENT); + + indx++; + if (oid->oid_kind & CTLFLAG_NOLOCK) + req->lock = REQ_UNLOCKED; + if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) { + if (oid->oid_handler != NULL || indx == namelen) { *noid = oid; if (nindx != NULL) *nindx = indx; return (0); - } else { - return (ENOTDIR); } + lsp = SYSCTL_CHILDREN(oid); + } else if (indx == namelen) { + *noid = oid; + if (nindx != NULL) + *nindx = indx; + return (0); } else { - oid = SLIST_NEXT(oid, oid_link); + return (ENOTDIR); } } return (ENOENT); From owner-svn-src-stable-7@FreeBSD.ORG Fri Mar 25 22:11:55 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E76CF1065708; Fri, 25 Mar 2011 22:11:54 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D606F8FC2B; Fri, 25 Mar 2011 22:11:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2PMBs8F095090; Fri, 25 Mar 2011 22:11:54 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2PMBs1V095087; Fri, 25 Mar 2011 22:11:54 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201103252211.p2PMBs1V095087@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 25 Mar 2011 22:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220012 - in stable/7/sys: kern sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2011 22:11:55 -0000 Author: mdf Date: Fri Mar 25 22:11:54 2011 New Revision: 220012 URL: http://svn.freebsd.org/changeset/base/220012 Log: MFC r216060. This differs from the original commit in that it preserves the KBI size of struct sysctl_oid. Also, on stable/8 the compiler thinks that 'len' in sysctl_sysctl_name2oid() is used uninitialized. Do not hold the sysctl lock across a call to the handler. This fixes a general LOR issue where the sysctl lock had no good place in the hierarchy. One specific instance is #284 on http://sources.zabbadoz.net/freebsd/lor.html . Modified: stable/7/sys/kern/kern_sysctl.c stable/7/sys/sys/sysctl.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_sysctl.c ============================================================================== --- stable/7/sys/kern/kern_sysctl.c Fri Mar 25 22:11:39 2011 (r220011) +++ stable/7/sys/kern/kern_sysctl.c Fri Mar 25 22:11:54 2011 (r220012) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include "opt_mac.h" #include +#include #include #include #include @@ -83,13 +84,12 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysct static struct sx sysctllock; static struct sx sysctlmemlock; -#define SYSCTL_SLOCK() sx_slock(&sysctllock) -#define SYSCTL_SUNLOCK() sx_sunlock(&sysctllock) #define SYSCTL_XLOCK() sx_xlock(&sysctllock) #define SYSCTL_XUNLOCK() sx_xunlock(&sysctllock) #define SYSCTL_ASSERT_XLOCKED() sx_assert(&sysctllock, SA_XLOCKED) -#define SYSCTL_ASSERT_LOCKED() sx_assert(&sysctllock, SA_LOCKED) #define SYSCTL_INIT() sx_init(&sysctllock, "sysctl lock") +#define SYSCTL_SLEEP(ch, wmesg, timo) \ + sx_sleep(ch, &sysctllock, 0, wmesg, timo) static int sysctl_root(SYSCTL_HANDLER_ARGS); @@ -103,7 +103,7 @@ sysctl_find_oidname(const char *name, st { struct sysctl_oid *oidp; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_XLOCKED(); SLIST_FOREACH(oidp, list, oid_link) { if (strcmp(oidp->oid_name, name) == 0) { return (oidp); @@ -310,7 +310,7 @@ sysctl_ctx_entry_find(struct sysctl_ctx_ { struct sysctl_ctx_entry *e; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_XLOCKED(); if (clist == NULL || oidp == NULL) return(NULL); TAILQ_FOREACH(e, clist, link) { @@ -406,6 +406,16 @@ sysctl_remove_oid_locked(struct sysctl_o } sysctl_unregister_oid(oidp); if (del) { + /* + * Wait for all threads running the handler to drain. + * This preserves the previous behavior when the + * sysctl lock was held across a handler invocation, + * and is necessary for module unload correctness. + */ + while (oidp->oid_running > 0) { + oidp->oid_kind |= CTLFLAG_DYING; + SYSCTL_SLEEP(&oidp->oid_running, "oidrm", 0); + } if (oidp->oid_descr) free((void *)(uintptr_t)(const void *)oidp->oid_descr, M_SYSCTLOID); free((void *)(uintptr_t)(const void *)oidp->oid_name, @@ -578,7 +588,7 @@ sysctl_sysctl_debug_dump_node(struct sys int k; struct sysctl_oid *oidp; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_XLOCKED(); SLIST_FOREACH(oidp, l, oid_link) { for (k=0; ktd, PRIV_SYSCTL_DEBUG); if (error) return (error); + SYSCTL_XLOCK(); sysctl_sysctl_debug_dump_node(&sysctl__children, 0); + SYSCTL_XUNLOCK(); return (ENOENT); } @@ -637,7 +649,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) struct sysctl_oid_list *lsp = &sysctl__children, *lsp2; char buf[10]; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_XLOCK(); while (namelen) { if (!lsp) { snprintf(buf,sizeof(buf),"%d",*name); @@ -646,7 +658,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) if (!error) error = SYSCTL_OUT(req, buf, strlen(buf)); if (error) - return (error); + goto out; namelen--; name++; continue; @@ -662,7 +674,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, oid->oid_name, strlen(oid->oid_name)); if (error) - return (error); + goto out; namelen--; name++; @@ -678,7 +690,10 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) } lsp = lsp2; } - return (SYSCTL_OUT(req, "", 1)); + error = SYSCTL_OUT(req, "", 1); + out: + SYSCTL_XUNLOCK(); + return (error); } static SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD, sysctl_sysctl_name, ""); @@ -689,7 +704,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_ { struct sysctl_oid *oidp; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_XLOCKED(); *len = level; SLIST_FOREACH(oidp, lsp, oid_link) { *next = oidp->oid_number; @@ -753,7 +768,9 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) struct sysctl_oid_list *lsp = &sysctl__children; int newoid[CTL_MAXNAME]; + SYSCTL_XLOCK(); i = sysctl_sysctl_next_ls(lsp, name, namelen, newoid, &j, 1, &oid); + SYSCTL_XUNLOCK(); if (i) return (ENOENT); error = SYSCTL_OUT(req, newoid, j * sizeof (int)); @@ -770,7 +787,7 @@ name2oid(char *name, int *oid, int *len, struct sysctl_oid_list *lsp = &sysctl__children; char *p; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_XLOCKED(); if (!*name) return (ENOENT); @@ -828,8 +845,6 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR int error, oid[CTL_MAXNAME], len; struct sysctl_oid *op = 0; - SYSCTL_ASSERT_LOCKED(); - if (!req->newlen) return (ENOENT); if (req->newlen >= MAXPATHLEN) /* XXX arbitrary, undocumented */ @@ -844,8 +859,10 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR } p [req->newlen] = '\0'; - + len = 0; + SYSCTL_XLOCK(); error = name2oid(p, oid, &len, &op); + SYSCTL_XUNLOCK(); free(p, M_SYSCTL); @@ -865,16 +882,21 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS struct sysctl_oid *oid; int error; + SYSCTL_XLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) - return (error); + goto out; - if (!oid->oid_fmt) - return (ENOENT); + if (oid->oid_fmt == NULL) { + error = ENOENT; + goto out; + } error = SYSCTL_OUT(req, &oid->oid_kind, sizeof(oid->oid_kind)); if (error) - return (error); + goto out; error = SYSCTL_OUT(req, oid->oid_fmt, strlen(oid->oid_fmt) + 1); + out: + SYSCTL_XUNLOCK(); return (error); } @@ -888,13 +910,18 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_AR struct sysctl_oid *oid; int error; + SYSCTL_XLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) - return (error); + goto out; - if (!oid->oid_descr) - return (ENOENT); + if (oid->oid_descr == NULL) { + error = ENOENT; + goto out; + } error = SYSCTL_OUT(req, oid->oid_descr, strlen(oid->oid_descr) + 1); + out: + SYSCTL_XUNLOCK(); return (error); } @@ -1174,9 +1201,9 @@ kernel_sysctl(struct thread *td, int *na req.newfunc = sysctl_new_kernel; req.lock = REQ_LOCKED; - SYSCTL_SLOCK(); + SYSCTL_XLOCK(); error = sysctl_root(0, name, namelen, &req); - SYSCTL_SUNLOCK(); + SYSCTL_XUNLOCK(); if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); @@ -1315,7 +1342,7 @@ sysctl_find_oid(int *name, u_int namelen struct sysctl_oid *oid; int indx; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_XLOCKED(); lsp = &sysctl__children; indx = 0; while (indx < CTL_MAXNAME) { @@ -1334,6 +1361,8 @@ sysctl_find_oid(int *name, u_int namelen *noid = oid; if (nindx != NULL) *nindx = indx; + KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0, + ("%s found DYING node %p", __func__, oid)); return (0); } lsp = SYSCTL_CHILDREN(oid); @@ -1341,6 +1370,8 @@ sysctl_find_oid(int *name, u_int namelen *noid = oid; if (nindx != NULL) *nindx = indx; + KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0, + ("%s found DYING node %p", __func__, oid)); return (0); } else { return (ENOTDIR); @@ -1360,7 +1391,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS) struct sysctl_oid *oid; int error, indx, lvl; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_XLOCKED(); error = sysctl_find_oid(arg1, arg2, &oid, &indx, req); if (error) @@ -1416,12 +1447,21 @@ sysctl_root(SYSCTL_HANDLER_ARGS) if (error != 0) return (error); #endif + oid->oid_running++; + SYSCTL_XUNLOCK(); + if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_lock(&Giant); error = oid->oid_handler(oid, arg1, arg2, req); if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_unlock(&Giant); + KFAIL_POINT_ERROR(_debug_fail_point, sysctl_running, error); + + SYSCTL_XLOCK(); + oid->oid_running--; + if (oid->oid_running == 0 && (oid->oid_kind & CTLFLAG_DYING) != 0) + wakeup(&oid->oid_running); return (error); } @@ -1520,9 +1560,9 @@ userland_sysctl(struct thread *td, int * for (;;) { req.oldidx = 0; req.newidx = 0; - SYSCTL_SLOCK(); + SYSCTL_XLOCK(); error = sysctl_root(0, name, namelen, &req); - SYSCTL_SUNLOCK(); + SYSCTL_XUNLOCK(); if (error != EAGAIN) break; uio_yield(); Modified: stable/7/sys/sys/sysctl.h ============================================================================== --- stable/7/sys/sys/sysctl.h Fri Mar 25 22:11:39 2011 (r220011) +++ stable/7/sys/sys/sysctl.h Fri Mar 25 22:11:54 2011 (r220012) @@ -86,6 +86,7 @@ struct ctlname { #define CTLFLAG_TUN 0x00080000 /* Tunable variable */ #define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */ #define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN) +#define CTLFLAG_DYING 0x00010000 /* oid is being removed */ /* * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1. @@ -164,6 +165,7 @@ struct sysctl_oid { int (*oid_handler)(SYSCTL_HANDLER_ARGS); const char *oid_fmt; int oid_refcnt; + u_int oid_running; const char *oid_descr; }; @@ -219,7 +221,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ static struct sysctl_oid sysctl__##parent##_##name = { \ &sysctl_##parent##_children, { 0 }, \ - nbr, kind, a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ + nbr, kind, a1, a2, #name, handler, fmt, 0, 0, __DESCR(descr) }; \ DATA_SET(sysctl_set, sysctl__##parent##_##name) #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ From owner-svn-src-stable-7@FreeBSD.ORG Fri Mar 25 22:17:25 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3741F106564A; Fri, 25 Mar 2011 22:17:25 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26C138FC08; Fri, 25 Mar 2011 22:17:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2PMHPM4095257; Fri, 25 Mar 2011 22:17:25 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2PMHPQD095255; Fri, 25 Mar 2011 22:17:25 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201103252217.p2PMHPQD095255@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 25 Mar 2011 22:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220013 - stable/7/sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2011 22:17:25 -0000 Author: mdf Date: Fri Mar 25 22:17:24 2011 New Revision: 220013 URL: http://svn.freebsd.org/changeset/base/220013 Log: Fix r220012 (MFC of r216060); the KBI of sysctl_oid was *supposed* to be preserved, but I was hasty. Modified: stable/7/sys/sys/sysctl.h Modified: stable/7/sys/sys/sysctl.h ============================================================================== --- stable/7/sys/sys/sysctl.h Fri Mar 25 22:11:54 2011 (r220012) +++ stable/7/sys/sys/sysctl.h Fri Mar 25 22:17:24 2011 (r220013) @@ -164,8 +164,8 @@ struct sysctl_oid { const char *oid_name; int (*oid_handler)(SYSCTL_HANDLER_ARGS); const char *oid_fmt; - int oid_refcnt; - u_int oid_running; + int16_t oid_refcnt; + uint16_t oid_running; const char *oid_descr; }; From owner-svn-src-stable-7@FreeBSD.ORG Sat Mar 26 21:32:10 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4DFF1065672; Sat, 26 Mar 2011 21:32:10 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 951618FC08; Sat, 26 Mar 2011 21:32:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2QLWADE037084; Sat, 26 Mar 2011 21:32:10 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2QLWAEJ037081; Sat, 26 Mar 2011 21:32:10 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201103262132.p2QLWAEJ037081@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 26 Mar 2011 21:32:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220045 - stable/7/sys/dev/vte X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Mar 2011 21:32:10 -0000 Author: yongari Date: Sat Mar 26 21:32:10 2011 New Revision: 220045 URL: http://svn.freebsd.org/changeset/base/220045 Log: MFC r219787: Correct broadcast frame handling. Setting bit6 of MCR0 register enables broadcast filtering. Make sure to clear the bit to receive broadcast frames. While I'm here rename the bit definition to reflect reality. Reported by: brad@OpenBSD Modified: stable/7/sys/dev/vte/if_vte.c stable/7/sys/dev/vte/if_vtereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vte/if_vte.c ============================================================================== --- stable/7/sys/dev/vte/if_vte.c Sat Mar 26 21:29:39 2011 (r220044) +++ stable/7/sys/dev/vte/if_vte.c Sat Mar 26 21:32:10 2011 (r220045) @@ -1963,9 +1963,10 @@ vte_rxfilter(struct vte_softc *sc) } mcr = CSR_READ_2(sc, VTE_MCR0); - mcr &= ~(MCR0_PROMISC | MCR0_BROADCAST | MCR0_MULTICAST); + mcr &= ~(MCR0_PROMISC | MCR0_MULTICAST); + mcr |= MCR0_BROADCAST_DIS; if ((ifp->if_flags & IFF_BROADCAST) != 0) - mcr |= MCR0_BROADCAST; + mcr &= ~MCR0_BROADCAST_DIS; if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) { if ((ifp->if_flags & IFF_PROMISC) != 0) mcr |= MCR0_PROMISC; Modified: stable/7/sys/dev/vte/if_vtereg.h ============================================================================== --- stable/7/sys/dev/vte/if_vtereg.h Sat Mar 26 21:29:39 2011 (r220044) +++ stable/7/sys/dev/vte/if_vtereg.h Sat Mar 26 21:32:10 2011 (r220045) @@ -48,7 +48,7 @@ #define MCR0_ACCPT_LONG_PKT 0x0008 #define MCR0_ACCPT_DRIBBLE 0x0010 #define MCR0_PROMISC 0x0020 -#define MCR0_BROADCAST 0x0040 +#define MCR0_BROADCAST_DIS 0x0040 #define MCR0_RX_EARLY_INTR 0x0080 #define MCR0_MULTICAST 0x0100 #define MCR0_FC_ENB 0x0200