From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 00:29:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 213E4896; Sun, 23 Dec 2012 00:29:15 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx1.freebsd.org (Postfix) with ESMTP id 722288FC0A; Sun, 23 Dec 2012 00:29:14 +0000 (UTC) Received: by mail-vb0-f50.google.com with SMTP id fr13so6391513vbb.23 for ; Sat, 22 Dec 2012 16:29:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=b/UpEzbkNc5vb5e7obAI0wXI6I3d6P5dEh0akz1Bqm0=; b=yAPibNdt8AF7Twom2j/MCJmSSzuqoNeKP/L+TPB6g6f4dcr1NXfl6scZ/BVhLEAng6 Owsax8MNEeskaiCxD3qruOD/vyRrVmKm0T4/xicgTGGAI+ixld5b/zdwxifZeMeReyjU FPw7nDZxFDWLHr3oOy+OfIiuZd67Y49xif/3FL/PlRu9fxZKuL+PI9yqZ+ETkOKZEPfj O27YHe0qT2l8hCXlpZdjaDZ7wm1T/9T9mWr9H49a30wl0NUZHdN/qhFDwb4NqKP0qWBX C9QoD63FMQ6GckLn1AK2Ok5vhT/fHFp3m4LtrLB0sb8DkuUNtJjBEvsWVNYRGUu/8EBK F8kg== MIME-Version: 1.0 Received: by 10.52.90.241 with SMTP id bz17mr23282318vdb.40.1356222547990; Sat, 22 Dec 2012 16:29:07 -0800 (PST) Received: by 10.58.161.83 with HTTP; Sat, 22 Dec 2012 16:29:07 -0800 (PST) In-Reply-To: <201212192010.qBJKA0lb075959@svn.freebsd.org> References: <201212192010.qBJKA0lb075959@svn.freebsd.org> Date: Sat, 22 Dec 2012 19:29:07 -0500 Message-ID: Subject: Re: svn commit: r244445 - in head/sys: kern sys tools From: Ryan Stone To: Jeff Roberson Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 00:29:15 -0000 This appears to have broken the build on arm. I see the following build failure building an arm LINT kernel: cc1: warnings being treated as errors In file included from /usr/home/rstone/freebsd/head_2/sys/arn/arm/trap.c:900: /usr/home/rstone/freebsd/head_2/sys/arm/arm/../../kern/subr_syscall.c: In function 'syscallenter': /usr/home/rstone/freebsd/head_2/sys/arm/arm/../../kern/subr_syscall.c:80: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] /usr/home/rstone/freebsd/head_2/sys/arm/arm/../../kern/subr_syscall.c:154: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 00:54:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88DBBBE5; Sun, 23 Dec 2012 00:54:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 449798FC0C; Sun, 23 Dec 2012 00:54:12 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:84e5:2627:88f9:e626] (unknown [IPv6:2001:7b8:3a7:0:84e5:2627:88f9:e626]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D215B5C5A; Sun, 23 Dec 2012 01:54:10 +0100 (CET) Message-ID: <50D65630.8010901@FreeBSD.org> Date: Sun, 23 Dec 2012 01:54:08 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20121128 Thunderbird/18.0 MIME-Version: 1.0 To: Brooks Davis Subject: Re: svn commit: r244401 - in head: contrib/libc-vis include lib/libc/gen References: <201212181637.qBIGbP7e084145@svn.freebsd.org> In-Reply-To: <201212181637.qBIGbP7e084145@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 00:54:12 -0000 On 2012-12-18 17:37, Brooks Davis wrote: > Author: brooks > Date: Tue Dec 18 16:37:24 2012 > New Revision: 244401 > URL: http://svnweb.freebsd.org/changeset/base/244401 > > Log: > Replace our implementation of the vis(3) and unvis(3) APIs with > NetBSD's. This output size limited versions of vis and unvis functions > as well as a set of vis variants that allow arbitrary characters to be > specified for encoding. This seems to break bootstrapping in some scenarios, in "stage 4.2: building libraries"; for example, with a test run with gcc on ref10-amd64.f.o I got this: gcc -O2 -pipe -I/scratch2/tmp/dim/head/lib/libc/include -I/scratch2/tmp/dim/head/lib/libc/../../include -I/scratch2/tmp/dim/head/lib/libc/amd64 -DNLS -D__DBINTERFACE_PRIVATE -I/scratch2/tmp/dim/head/lib/libc/../../contrib/gdtoa -DINET6 -I/scratch2/tmp/dim/obj/scratch2/tmp/dim/head/lib/libc -I/scratch2/tmp/dim/head/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/scratch2/tmp/dim/head/lib/libc/../../contrib/jemalloc/include -I/scratch2/tmp/dim/head/lib/libc/../../contrib/tzcode/stdtime -I/scratch2/tmp/dim/head/lib/libc/stdtime -I/scratch2/tmp/dim/head/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/scratch2/tmp/dim/head/lib/libc/rpc -DYP -DNS_CACHING -D_FREEFALL_CONFIG -DSYMBOL_VERSIONING -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -c /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/vis.c -o vis.o /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/unvis.c: In function 'unvis': /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/unvis.c:237: error: 'VIS_NOESCAPE' undeclared (first use in this function) /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/unvis.c:237: error: (Each undeclared identifier is reported only once /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/unvis.c:237: error: for each function it appears in.) /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/unvis.c:241: error: 'VIS_HTTP1808' undeclared (first use in this function) /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/unvis.c:245: error: 'VIS_HTTP1866' undeclared (first use in this function) /scratch2/tmp/dim/head/lib/libc/../../contrib/libc-vis/unvis.c:249: error: 'VIS_MIMESTYLE' undeclared (first use in this function) There should most likely be an explicit -I option to point the compiler at the correct vis.h header during the early stages, otherwise it will pick up /usr/include/vis.h, which does not have several of these new VIS_XXX defines. From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 03:24:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDB43CE3; Sun, 23 Dec 2012 03:24:09 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ia0-f169.google.com (mail-ia0-f169.google.com [209.85.210.169]) by mx1.freebsd.org (Postfix) with ESMTP id 624018FC13; Sun, 23 Dec 2012 03:24:09 +0000 (UTC) Received: by mail-ia0-f169.google.com with SMTP id r4so5119142iaj.14 for ; Sat, 22 Dec 2012 19:24:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=UFZV67bLqhTLJi6jOvONpZ+EHCI5diVUzKL6YH20T2k=; b=IJv0bSGHNhblTS6dzCpTV/Pu3kcBY2lSYrbpup43QTtVkvxHJNy1PsTPX015xc5V2t cvVqP0cfE2ykfBMT2KVjHzbHfxL/Kdx+w+oocjZJmYoEbzor0FwwhUaGODDmJza1wy5U uzFPG7IjkJT8nn+rg3Mb4EDqe+sFH5xpjsUKMpnja/8nzsMiW06PmlnTblVrDfY/Q+IG HdZKPfov1QTeJpwA8/TTNzFa9u79Y+W3LW4rHVQXk497VPgPD1vOiT8PP3s0nP9kBMi0 WK5aZ687/bQaxLXoQXvcN+xHMWNEudEIE4OWCAfX7NeOMIyB83g3DSqBDCZfmqUfchM+ 9n9A== MIME-Version: 1.0 Received: by 10.50.187.225 with SMTP id fv1mr12416883igc.96.1356233042870; Sat, 22 Dec 2012 19:24:02 -0800 (PST) Received: by 10.42.56.83 with HTTP; Sat, 22 Dec 2012 19:24:02 -0800 (PST) In-Reply-To: <201212222334.qBMNYT1Y077396@svn.freebsd.org> References: <201212222334.qBMNYT1Y077396@svn.freebsd.org> Date: Sat, 22 Dec 2012 22:24:02 -0500 Message-ID: Subject: Re: svn commit: r244605 - head/usr.sbin/gssd From: Benjamin Kaduk To: Rick Macklem Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 03:24:09 -0000 Hi Rick, Thanks for all this -- it's good stuff to have. On Sat, Dec 22, 2012 at 6:34 PM, Rick Macklem wrote: > Author: rmacklem > Date: Sat Dec 22 23:34:28 2012 > New Revision: 244605 > URL: http://svnweb.freebsd.org/changeset/base/244605 > > Log: > Document the new gssd daemon options added by r244604. > This is a content change. > > MFC after: 2 weeks > > Modified: > head/usr.sbin/gssd/gssd.8 > > Modified: head/usr.sbin/gssd/gssd.8 > > ============================================================================== > --- head/usr.sbin/gssd/gssd.8 Sat Dec 22 23:21:17 2012 (r244604) > +++ head/usr.sbin/gssd/gssd.8 Sat Dec 22 23:34:28 2012 (r244605) > @@ -46,6 +49,29 @@ Run in debug mode. > In this mode, > .Nm > will not fork when it starts. > +.It Fl s Ar dir-list > +Look for an appropriate credential cache file in this list of directories. > +The list should be full pathnames from root, separated by ':' characters. > +Usually this list will simply be "/tmp". > +Without this option, the > +.Nm > +daemon assumes that the credential cache file is called /tmp/krb5cc_, > +where is the effective uid for the RPC caller. > +.It Fl c Ar file-substring > +Set a file-substring for the credential cache file names. > +Only files with this substring embedded in their names will be > +selected as candidates when the > +.Fl s > +has been specified. > This grammar seems a bit fishy ("when the -s has been specified"); "when -s has been specified" or "when a search directory has been specified with -s" would probably be better. > +If not specified, it defaults to "krb5cc_". > +.It Fl r Ar preferred-realm > +Set a preferred Kerberos realm for the search of the directory list for > "Directory list" sounds like there are multiple directories involved, perhaps "directory listing" is better? > +a credentials cache file. > +When set, files with TGT credentials for this realm will be selected over > +other credential files. > +This option is only meaningful when the > +.Fl s > +option has been specified. > There is something of a movement among the doc types to remove "redundant" words, making this "when -s has been specified", but others (some quite senior) do not approve of this "useless churn". Might not be worth changing now, but for new content, something to consider. Let me know if I should make the patch. -Ben Kaduk From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 10:21:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4B7203E3; Sun, 23 Dec 2012 10:21:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1657D8FC12; Sun, 23 Dec 2012 10:21:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNAL1jn071532; Sun, 23 Dec 2012 10:21:01 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNAL1Fr071531; Sun, 23 Dec 2012 10:21:01 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212231021.qBNAL1Fr071531@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 23 Dec 2012 10:21:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244607 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 10:21:02 -0000 Author: hselasky Date: Sun Dec 23 10:21:01 2012 New Revision: 244607 URL: http://svnweb.freebsd.org/changeset/base/244607 Log: Fix regression issue after r244503. MFC after: 1 week Modified: head/sys/dev/usb/usb_msctest.c Modified: head/sys/dev/usb/usb_msctest.c ============================================================================== --- head/sys/dev/usb/usb_msctest.c Sun Dec 23 00:03:28 2012 (r244606) +++ head/sys/dev/usb/usb_msctest.c Sun Dec 23 10:21:01 2012 (r244607) @@ -83,7 +83,7 @@ enum { DIR_NONE, }; -#define SCSI_MAX_LEN 0x100 +#define SCSI_MAX_LEN MAX(0x100, BULK_SIZE) #define SCSI_INQ_LEN 0x24 #define SCSI_SENSE_LEN 0xFF @@ -150,6 +150,7 @@ struct bbb_transfer { usb_size_t data_rem; /* bytes */ usb_timeout_t data_timeout; /* ms */ usb_frlength_t actlen; /* bytes */ + usb_frlength_t buffer_size; /* bytes */ uint8_t cmd_len; /* bytes */ uint8_t dir; @@ -192,7 +193,7 @@ static const struct usb_config bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = MAX(SCSI_MAX_LEN, BULK_SIZE), + .bufsize = SCSI_MAX_LEN, .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, .callback = &bbb_data_read_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ @@ -211,7 +212,7 @@ static const struct usb_config bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = BULK_SIZE, + .bufsize = SCSI_MAX_LEN, .flags = {.ext_buffer = 1,.proxy_buffer = 1,}, .callback = &bbb_data_write_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ @@ -553,6 +554,8 @@ bbb_attach(struct usb_device *udev, uint /* store pointer to DMA buffers */ sc->buffer = usbd_xfer_get_frame_buffer( sc->xfer[ST_DATA_RD], 0); + sc->buffer_size = + usbd_xfer_max_len(sc->xfer[ST_DATA_RD]); sc->cbw = usbd_xfer_get_frame_buffer( sc->xfer[ST_COMMAND], 0); sc->csw = usbd_xfer_get_frame_buffer( @@ -833,8 +836,8 @@ usb_msc_eject(struct usb_device *udev, u * TCTMobile needs DIR_IN flag. To get it, we * supply a dummy data with the command. */ - err = bbb_command_start(sc, DIR_IN, 0, &sc->buffer, - sizeof(sc->buffer), &scsi_tct_eject, + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + sc->buffer_size, &scsi_tct_eject, sizeof(scsi_tct_eject), USB_MS_HZ); break; default: From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 11:22:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F26EDD0A; Sun, 23 Dec 2012 11:22:18 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D58FD8FC12; Sun, 23 Dec 2012 11:22:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNBMI4i081428; Sun, 23 Dec 2012 11:22:18 GMT (envelope-from matthew@svn.freebsd.org) Received: (from matthew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNBMIXb081427; Sun, 23 Dec 2012 11:22:18 GMT (envelope-from matthew@svn.freebsd.org) Message-Id: <201212231122.qBNBMIXb081427@svn.freebsd.org> From: Matthew Seaman Date: Sun, 23 Dec 2012 11:22:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244608 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 11:22:19 -0000 Author: matthew (ports committer) Date: Sun Dec 23 11:22:18 2012 New Revision: 244608 URL: http://svnweb.freebsd.org/changeset/base/244608 Log: Third time's the charm. pkg -N output needs to go to stderr. Approved by: bapt MFC after: 2 weeks Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Sun Dec 23 10:21:01 2012 (r244607) +++ head/usr.sbin/pkg/pkg.c Sun Dec 23 11:22:18 2012 (r244608) @@ -457,10 +457,8 @@ main(__unused int argc, char *argv[]) * a system is configured to use pkg, don't bootstrap pkg * when that argument is given as argv[1]. */ - if ( argv[1] != NULL && strcmp(argv[1], "-N") == 0) { - printf("%s", "pkg is not installed\n"); - exit(EXIT_FAILURE); - } + if ( argv[1] != NULL && strcmp(argv[1], "-N") == 0) + errx(EXIT_FAILURE, "pkg is not installed\n"); /* * Do not ask for confirmation if either of stdin or stdout is From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 11:52:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE58E12A; Sun, 23 Dec 2012 11:52:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9175D8FC14; Sun, 23 Dec 2012 11:52:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNBqYg6085593; Sun, 23 Dec 2012 11:52:34 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNBqYgT085592; Sun, 23 Dec 2012 11:52:34 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231152.qBNBqYgT085592@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 11:52:34 +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: r244609 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 11:52:34 -0000 Author: avg Date: Sun Dec 23 11:52:33 2012 New Revision: 244609 URL: http://svnweb.freebsd.org/changeset/base/244609 Log: MFC r243272,243499: assert_vop_locked should treat LK_EXCLOTHER as the not locked case Modified: stable/9/sys/kern/vfs_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Sun Dec 23 11:22:18 2012 (r244608) +++ stable/9/sys/kern/vfs_subr.c Sun Dec 23 11:52:33 2012 (r244609) @@ -3970,9 +3970,13 @@ assert_vi_unlocked(struct vnode *vp, con void assert_vop_locked(struct vnode *vp, const char *str) { + int locked; - if (!IGNORE_LOCK(vp) && VOP_ISLOCKED(vp) == 0) - vfs_badlock("is not locked but should be", str, vp); + if (!IGNORE_LOCK(vp)) { + locked = VOP_ISLOCKED(vp); + if (locked == 0 || locked == LK_EXCLOTHER) + vfs_badlock("is not locked but should be", str, vp); + } } void From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 11:52:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 20E9F12E; Sun, 23 Dec 2012 11:52:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 071408FC12; Sun, 23 Dec 2012 11:52:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNBqk3U085652; Sun, 23 Dec 2012 11:52:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNBqkQA085651; Sun, 23 Dec 2012 11:52:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231152.qBNBqkQA085651@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 11:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244610 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 11:52:47 -0000 Author: avg Date: Sun Dec 23 11:52:46 2012 New Revision: 244610 URL: http://svnweb.freebsd.org/changeset/base/244610 Log: MFC r243272,243499: assert_vop_locked should treat LK_EXCLOTHER as the not locked case Modified: stable/8/sys/kern/vfs_subr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/vfs_subr.c ============================================================================== --- stable/8/sys/kern/vfs_subr.c Sun Dec 23 11:52:33 2012 (r244609) +++ stable/8/sys/kern/vfs_subr.c Sun Dec 23 11:52:46 2012 (r244610) @@ -3832,9 +3832,13 @@ assert_vi_unlocked(struct vnode *vp, con void assert_vop_locked(struct vnode *vp, const char *str) { + int locked; - if (!IGNORE_LOCK(vp) && VOP_ISLOCKED(vp) == 0) - vfs_badlock("is not locked but should be", str, vp); + if (!IGNORE_LOCK(vp)) { + locked = VOP_ISLOCKED(vp); + if (locked == 0 || locked == LK_EXCLOTHER) + vfs_badlock("is not locked but should be", str, vp); + } } void From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 11:56:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0872418; Sun, 23 Dec 2012 11:56:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B25738FC12; Sun, 23 Dec 2012 11:56:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNBu8uV086184; Sun, 23 Dec 2012 11:56:08 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNBu8Gw086183; Sun, 23 Dec 2012 11:56:08 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231156.qBNBu8Gw086183@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 11:56:08 +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: r244611 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 11:56:08 -0000 Author: avg Date: Sun Dec 23 11:56:08 2012 New Revision: 244611 URL: http://svnweb.freebsd.org/changeset/base/244611 Log: MFC r243497: zfs: create devices/geoms from zvols after receiveing them PR: kern/167066 Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.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_ioctl.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Dec 23 11:52:46 2012 (r244610) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Dec 23 11:56:08 2012 (r244611) @@ -3817,6 +3817,12 @@ zfs_ioc_recv(zfs_cmd_t *zc) error = 1; } #endif + +#ifdef __FreeBSD__ + if (error == 0) + zvol_create_minors(tofs); +#endif + /* * On error, restore the original props. */ From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 11:56:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 29B8A57A; Sun, 23 Dec 2012 11:56:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0CD858FC13; Sun, 23 Dec 2012 11:56:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNBuS17086261; Sun, 23 Dec 2012 11:56:28 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNBuSUx086260; Sun, 23 Dec 2012 11:56:28 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231156.qBNBuSUx086260@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 11:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244612 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 11:56:29 -0000 Author: avg Date: Sun Dec 23 11:56:28 2012 New Revision: 244612 URL: http://svnweb.freebsd.org/changeset/base/244612 Log: MFC r243497: zfs: create devices/geoms from zvols after receiveing them PR: kern/167066 Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Dec 23 11:56:08 2012 (r244611) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Dec 23 11:56:28 2012 (r244612) @@ -3817,6 +3817,12 @@ zfs_ioc_recv(zfs_cmd_t *zc) error = 1; } #endif + +#ifdef __FreeBSD__ + if (error == 0) + zvol_create_minors(tofs); +#endif + /* * On error, restore the original props. */ From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 11:58:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9624D6F3; Sun, 23 Dec 2012 11:58:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 79ACA8FC0C; Sun, 23 Dec 2012 11:58:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNBw9DK086542; Sun, 23 Dec 2012 11:58:09 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNBw9QP086541; Sun, 23 Dec 2012 11:58:09 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231158.qBNBw9QP086541@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 11:58:09 +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: r244613 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 11:58:09 -0000 Author: avg Date: Sun Dec 23 11:58:08 2012 New Revision: 244613 URL: http://svnweb.freebsd.org/changeset/base/244613 Log: MFC r243519: zfs_fhtovp: there is no reason to amend lock flags with LK_RETRY here 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 Sun Dec 23 11:56:28 2012 (r244612) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Dec 23 11:58:08 2012 (r244613) @@ -2136,7 +2136,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int VN_HOLD(*vpp); } ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, flags | LK_RETRY); + err = zfs_vnode_lock(*vpp, flags); if (err != 0) *vpp = NULL; return (err); From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:06:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD5D8ED5; Sun, 23 Dec 2012 12:06:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A128C8FC14; Sun, 23 Dec 2012 12:06:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNC6098088308; Sun, 23 Dec 2012 12:06:00 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNC60Eg088307; Sun, 23 Dec 2012 12:06:00 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231206.qBNC60Eg088307@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:06: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: r244614 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:06:00 -0000 Author: avg Date: Sun Dec 23 12:06:00 2012 New Revision: 244614 URL: http://svnweb.freebsd.org/changeset/base/244614 Log: MFC r243760: acpi_cpu: change cpu_disable_idle to be a per-cpu flag Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Sun Dec 23 11:58:08 2012 (r244613) +++ stable/9/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:06:00 2012 (r244614) @@ -90,6 +90,7 @@ struct acpi_cpu_softc { struct sysctl_oid *cpu_sysctl_tree; int cpu_cx_lowest; int cpu_cx_lowest_lim; + int cpu_disable_idle; /* Disable entry to idle function */ char cpu_cx_supported[64]; int cpu_rid; }; @@ -137,9 +138,6 @@ static uint32_t cpu_smi_cmd; /* Value static uint8_t cpu_cst_cnt; /* Indicate we are _CST aware. */ static int cpu_quirks; /* Indicate any hardware bugs. */ -/* Runtime state. */ -static int cpu_disable_idle; /* Disable entry to idle function */ - /* Values for sysctl. */ static struct sysctl_ctx_list cpu_sysctl_ctx; static struct sysctl_oid *cpu_sysctl_tree; @@ -418,6 +416,39 @@ acpi_cpu_postattach(void *unused __unuse SYSINIT(acpi_cpu, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, acpi_cpu_postattach, NULL); +static void +disable_idle(struct acpi_cpu_softc *sc) +{ + cpuset_t cpuset; + + CPU_SETOF(sc->cpu_pcpu->pc_cpuid, &cpuset); + sc->cpu_disable_idle = TRUE; + + /* + * Ensure that the CPU is not in idle state or in acpi_cpu_idle(). + * Note that this code depends on the fact that the rendezvous IPI + * can not penetrate context where interrupts are disabled and acpi_cpu_idle + * is called and executed in such a context with interrupts being re-enabled + * right before return. + */ + smp_rendezvous_cpus(cpuset, smp_no_rendevous_barrier, NULL, + smp_no_rendevous_barrier, NULL); +} + +static void +enable_idle(struct acpi_cpu_softc *sc) +{ + + sc->cpu_disable_idle = FALSE; +} + +static int +is_idle_disabled(struct acpi_cpu_softc *sc) +{ + + return (sc->cpu_disable_idle); +} + /* * Disable any entry to the idle function during suspend and re-enable it * during resume. @@ -430,7 +461,7 @@ acpi_cpu_suspend(device_t dev) error = bus_generic_suspend(dev); if (error) return (error); - cpu_disable_idle = TRUE; + disable_idle(device_get_softc(dev)); return (0); } @@ -438,7 +469,7 @@ static int acpi_cpu_resume(device_t dev) { - cpu_disable_idle = FALSE; + enable_idle(device_get_softc(dev)); return (bus_generic_resume(dev)); } @@ -572,12 +603,14 @@ acpi_cpu_shutdown(device_t dev) bus_generic_shutdown(dev); /* - * Disable any entry to the idle function. There is a small race where - * an idle thread have passed this check but not gone to sleep. This - * is ok since device_shutdown() does not free the softc, otherwise - * we'd have to be sure all threads were evicted before returning. + * Disable any entry to the idle function. + */ + disable_idle(device_get_softc(dev)); + + /* + * CPU devices are not truely detached and remain referenced, + * so their resources are not freed. */ - cpu_disable_idle = TRUE; return_VALUE (0); } @@ -860,7 +893,10 @@ acpi_cpu_startup(void *arg) /* Take over idling from cpu_idle_default(). */ cpu_cx_lowest_lim = 0; - cpu_disable_idle = FALSE; + for (i = 0; i < cpu_ndevices; i++) { + sc = device_get_softc(cpu_devices[i]); + enable_idle(sc); + } cpu_idle_hook = acpi_cpu_idle; } @@ -926,12 +962,6 @@ acpi_cpu_idle() uint32_t start_time, end_time; int bm_active, cx_next_idx, i; - /* If disabled, return immediately. */ - if (cpu_disable_idle) { - ACPI_ENABLE_IRQS(); - return; - } - /* * Look up our CPU id to get our softc. If it's NULL, we'll use C1 * since there is no ACPI processor object for this CPU. This occurs @@ -943,6 +973,12 @@ acpi_cpu_idle() return; } + /* If disabled, return immediately. */ + if (is_idle_disabled(sc)) { + ACPI_ENABLE_IRQS(); + return; + } + /* Find the lowest state that has small enough latency. */ cx_next_idx = 0; if (cpu_disable_deep_sleep) From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:06:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1353B8; Sun, 23 Dec 2012 12:06:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C701D8FC0C; Sun, 23 Dec 2012 12:06:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNC6Chf088391; Sun, 23 Dec 2012 12:06:12 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNC6CBI088390; Sun, 23 Dec 2012 12:06:12 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231206.qBNC6CBI088390@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244615 - stable/8/sys/dev/acpica X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:06:13 -0000 Author: avg Date: Sun Dec 23 12:06:12 2012 New Revision: 244615 URL: http://svnweb.freebsd.org/changeset/base/244615 Log: MFC r243760: acpi_cpu: change cpu_disable_idle to be a per-cpu flag Modified: stable/8/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/acpica/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:06:00 2012 (r244614) +++ stable/8/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:06:12 2012 (r244615) @@ -87,6 +87,7 @@ struct acpi_cpu_softc { struct sysctl_oid *cpu_sysctl_tree; int cpu_cx_lowest; int cpu_cx_lowest_lim; + int cpu_disable_idle; /* Disable entry to idle function */ char cpu_cx_supported[64]; int cpu_rid; }; @@ -134,9 +135,6 @@ static uint32_t cpu_smi_cmd; /* Value static uint8_t cpu_cst_cnt; /* Indicate we are _CST aware. */ static int cpu_quirks; /* Indicate any hardware bugs. */ -/* Runtime state. */ -static int cpu_disable_idle; /* Disable entry to idle function */ - /* Values for sysctl. */ static struct sysctl_ctx_list cpu_sysctl_ctx; static struct sysctl_oid *cpu_sysctl_tree; @@ -415,6 +413,39 @@ acpi_cpu_postattach(void *unused __unuse SYSINIT(acpi_cpu, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, acpi_cpu_postattach, NULL); +static void +disable_idle(struct acpi_cpu_softc *sc) +{ + cpuset_t cpuset; + + CPU_SETOF(sc->cpu_pcpu->pc_cpuid, &cpuset); + sc->cpu_disable_idle = TRUE; + + /* + * Ensure that the CPU is not in idle state or in acpi_cpu_idle(). + * Note that this code depends on the fact that the rendezvous IPI + * can not penetrate context where interrupts are disabled and acpi_cpu_idle + * is called and executed in such a context with interrupts being re-enabled + * right before return. + */ + smp_rendezvous_cpus(cpuset, smp_no_rendevous_barrier, NULL, + smp_no_rendevous_barrier, NULL); +} + +static void +enable_idle(struct acpi_cpu_softc *sc) +{ + + sc->cpu_disable_idle = FALSE; +} + +static int +is_idle_disabled(struct acpi_cpu_softc *sc) +{ + + return (sc->cpu_disable_idle); +} + /* * Disable any entry to the idle function during suspend and re-enable it * during resume. @@ -427,7 +458,7 @@ acpi_cpu_suspend(device_t dev) error = bus_generic_suspend(dev); if (error) return (error); - cpu_disable_idle = TRUE; + disable_idle(device_get_softc(dev)); return (0); } @@ -435,7 +466,7 @@ static int acpi_cpu_resume(device_t dev) { - cpu_disable_idle = FALSE; + enable_idle(device_get_softc(dev)); return (bus_generic_resume(dev)); } @@ -561,12 +592,14 @@ acpi_cpu_shutdown(device_t dev) bus_generic_shutdown(dev); /* - * Disable any entry to the idle function. There is a small race where - * an idle thread have passed this check but not gone to sleep. This - * is ok since device_shutdown() does not free the softc, otherwise - * we'd have to be sure all threads were evicted before returning. + * Disable any entry to the idle function. + */ + disable_idle(device_get_softc(dev)); + + /* + * CPU devices are not truely detached and remain referenced, + * so their resources are not freed. */ - cpu_disable_idle = TRUE; return_VALUE (0); } @@ -847,7 +880,10 @@ acpi_cpu_startup(void *arg) /* Take over idling from cpu_idle_default(). */ cpu_cx_lowest_lim = 0; - cpu_disable_idle = FALSE; + for (i = 0; i < cpu_ndevices; i++) { + sc = device_get_softc(cpu_devices[i]); + enable_idle(sc); + } cpu_idle_hook = acpi_cpu_idle; } @@ -917,12 +953,6 @@ acpi_cpu_idle() uint32_t start_time, end_time; int bm_active, cx_next_idx, i; - /* If disabled, return immediately. */ - if (cpu_disable_idle) { - ACPI_ENABLE_IRQS(); - return; - } - /* * Look up our CPU id to get our softc. If it's NULL, we'll use C1 * since there is no ACPI processor object for this CPU. This occurs @@ -934,6 +964,12 @@ acpi_cpu_idle() return; } + /* If disabled, return immediately. */ + if (is_idle_disabled(sc)) { + ACPI_ENABLE_IRQS(); + return; + } + /* Find the lowest state that has small enough latency. */ cx_next_idx = 0; for (i = sc->cpu_cx_lowest; i >= 0; i--) { From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:07:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1782D310; Sun, 23 Dec 2012 12:07:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D6B5A8FC0A; Sun, 23 Dec 2012 12:07:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNC7gRO088772; Sun, 23 Dec 2012 12:07:42 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNC7gAB088771; Sun, 23 Dec 2012 12:07:42 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231207.qBNC7gAB088771@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:07:42 +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: r244616 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:07:43 -0000 Author: avg Date: Sun Dec 23 12:07:42 2012 New Revision: 244616 URL: http://svnweb.freebsd.org/changeset/base/244616 Log: MFC r243761: acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:06:12 2012 (r244615) +++ stable/9/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:07:42 2012 (r244616) @@ -973,9 +973,9 @@ acpi_cpu_idle() return; } - /* If disabled, return immediately. */ + /* If disabled, take the safe path. */ if (is_idle_disabled(sc)) { - ACPI_ENABLE_IRQS(); + acpi_cpu_c1(); return; } @@ -1081,23 +1081,31 @@ acpi_cpu_idle() /* * Re-evaluate the _CST object when we are notified that it changed. - * - * XXX Re-evaluation disabled until locking is done. */ static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context) { struct acpi_cpu_softc *sc = (struct acpi_cpu_softc *)context; - + if (notify != ACPI_NOTIFY_CX_STATES) return; + /* + * C-state data for target CPU is going to be in flux while we execute + * acpi_cpu_cx_cst, so disable entering acpi_cpu_idle. + * Also, it may happen that multiple ACPI taskqueues may concurrently + * execute notifications for the same CPU. ACPI_SERIAL is used to + * protect against that. + */ + ACPI_SERIAL_BEGIN(cpu); + disable_idle(sc); + /* Update the list of Cx states. */ acpi_cpu_cx_cst(sc); acpi_cpu_cx_list(sc); - - ACPI_SERIAL_BEGIN(cpu); acpi_cpu_set_cx_lowest(sc); + + enable_idle(sc); ACPI_SERIAL_END(cpu); acpi_UserNotify("PROCESSOR", sc->cpu_handle, notify); From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:07:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF24845E; Sun, 23 Dec 2012 12:07:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7987E8FC12; Sun, 23 Dec 2012 12:07:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNC7rW5088837; Sun, 23 Dec 2012 12:07:53 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNC7rPm088836; Sun, 23 Dec 2012 12:07:53 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231207.qBNC7rPm088836@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244617 - stable/8/sys/dev/acpica X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:07:53 -0000 Author: avg Date: Sun Dec 23 12:07:52 2012 New Revision: 244617 URL: http://svnweb.freebsd.org/changeset/base/244617 Log: MFC r243761: acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data Modified: stable/8/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/acpica/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:07:42 2012 (r244616) +++ stable/8/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:07:52 2012 (r244617) @@ -964,9 +964,9 @@ acpi_cpu_idle() return; } - /* If disabled, return immediately. */ + /* If disabled, take the safe path. */ if (is_idle_disabled(sc)) { - ACPI_ENABLE_IRQS(); + acpi_cpu_c1(); return; } @@ -1067,23 +1067,31 @@ acpi_cpu_idle() /* * Re-evaluate the _CST object when we are notified that it changed. - * - * XXX Re-evaluation disabled until locking is done. */ static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context) { struct acpi_cpu_softc *sc = (struct acpi_cpu_softc *)context; - + if (notify != ACPI_NOTIFY_CX_STATES) return; + /* + * C-state data for target CPU is going to be in flux while we execute + * acpi_cpu_cx_cst, so disable entering acpi_cpu_idle. + * Also, it may happen that multiple ACPI taskqueues may concurrently + * execute notifications for the same CPU. ACPI_SERIAL is used to + * protect against that. + */ + ACPI_SERIAL_BEGIN(cpu); + disable_idle(sc); + /* Update the list of Cx states. */ acpi_cpu_cx_cst(sc); acpi_cpu_cx_list(sc); - - ACPI_SERIAL_BEGIN(cpu); acpi_cpu_set_cx_lowest(sc); + + enable_idle(sc); ACPI_SERIAL_END(cpu); acpi_UserNotify("PROCESSOR", sc->cpu_handle, notify); From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:09:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51354608; Sun, 23 Dec 2012 12:09:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 365A98FC14; Sun, 23 Dec 2012 12:09:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNC9g2D089219; Sun, 23 Dec 2012 12:09:42 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNC9gkK089218; Sun, 23 Dec 2012 12:09:42 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231209.qBNC9gkK089218@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:09:42 +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: r244618 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:09:42 -0000 Author: avg Date: Sun Dec 23 12:09:41 2012 New Revision: 244618 URL: http://svnweb.freebsd.org/changeset/base/244618 Log: MFC r243404: acpi_cpu: use fixed resource ids for cx state i/o resources Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:07:52 2012 (r244617) +++ stable/9/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:09:41 2012 (r244618) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -68,6 +69,7 @@ struct acpi_cx { uint32_t trans_lat; /* Transition latency (usec). */ uint32_t power; /* Power consumed (mW). */ int res_type; /* Resource type for p_lvlx. */ + int res_rid; /* Resource ID for p_lvlx. */ }; #define MAX_CX_STATES 8 @@ -92,7 +94,6 @@ struct acpi_cpu_softc { int cpu_cx_lowest_lim; int cpu_disable_idle; /* Disable entry to idle function */ char cpu_cx_supported[64]; - int cpu_rid; }; struct acpi_cpu_device { @@ -681,10 +682,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp gas.BitWidth = 8; if (AcpiGbl_FADT.C2Latency <= 100) { gas.Address = sc->cpu_p_blk + 4; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, + cx_ptr->res_rid = 0; + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { - sc->cpu_rid++; cx_ptr->type = ACPI_STATE_C2; cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency; cx_ptr++; @@ -698,10 +699,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp /* Validate and allocate resources for C3 (P_LVL3). */ if (AcpiGbl_FADT.C3Latency <= 1000 && !(cpu_quirks & CPU_QUIRK_NO_C3)) { gas.Address = sc->cpu_p_blk + 5; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, &gas, - &cx_ptr->p_lvlx, RF_SHAREABLE); + cx_ptr->res_rid = 1; + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, + &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { - sc->cpu_rid++; cx_ptr->type = ACPI_STATE_C3; cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency; cx_ptr++; @@ -803,19 +804,18 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s break; } -#ifdef notyet /* Free up any previous register. */ if (cx_ptr->p_lvlx != NULL) { - bus_release_resource(sc->cpu_dev, 0, 0, cx_ptr->p_lvlx); + bus_release_resource(sc->cpu_dev, cx_ptr->res_type, cx_ptr->res_rid, + cx_ptr->p_lvlx); cx_ptr->p_lvlx = NULL; } -#endif /* Allocate the control register for C2 or C3. */ - acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &sc->cpu_rid, + cx_ptr->res_rid = sc->cpu_cx_count; + acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &cx_ptr->res_rid, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx) { - sc->cpu_rid++; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: Got C%d - %d latency\n", device_get_unit(sc->cpu_dev), cx_ptr->type, From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:09:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6AF30713; Sun, 23 Dec 2012 12:09:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4F2B08FC0A; Sun, 23 Dec 2012 12:09:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNC9rbL089291; Sun, 23 Dec 2012 12:09:53 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNC9r97089290; Sun, 23 Dec 2012 12:09:53 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231209.qBNC9r97089290@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244619 - stable/8/sys/dev/acpica X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:09:53 -0000 Author: avg Date: Sun Dec 23 12:09:52 2012 New Revision: 244619 URL: http://svnweb.freebsd.org/changeset/base/244619 Log: MFC r243404: acpi_cpu: use fixed resource ids for cx state i/o resources Modified: stable/8/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/acpica/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:09:41 2012 (r244618) +++ stable/8/sys/dev/acpica/acpi_cpu.c Sun Dec 23 12:09:52 2012 (r244619) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -65,6 +66,7 @@ struct acpi_cx { uint32_t trans_lat; /* Transition latency (usec). */ uint32_t power; /* Power consumed (mW). */ int res_type; /* Resource type for p_lvlx. */ + int res_rid; /* Resource ID for p_lvlx. */ }; #define MAX_CX_STATES 8 @@ -89,7 +91,6 @@ struct acpi_cpu_softc { int cpu_cx_lowest_lim; int cpu_disable_idle; /* Disable entry to idle function */ char cpu_cx_supported[64]; - int cpu_rid; }; struct acpi_cpu_device { @@ -670,10 +671,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp gas.BitWidth = 8; if (AcpiGbl_FADT.C2Latency <= 100) { gas.Address = sc->cpu_p_blk + 4; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, + cx_ptr->res_rid = 0; + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { - sc->cpu_rid++; cx_ptr->type = ACPI_STATE_C2; cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency; cx_ptr++; @@ -687,10 +688,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp /* Validate and allocate resources for C3 (P_LVL3). */ if (AcpiGbl_FADT.C3Latency <= 1000 && !(cpu_quirks & CPU_QUIRK_NO_C3)) { gas.Address = sc->cpu_p_blk + 5; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, &gas, - &cx_ptr->p_lvlx, RF_SHAREABLE); + cx_ptr->res_rid = 1; + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, + &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { - sc->cpu_rid++; cx_ptr->type = ACPI_STATE_C3; cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency; cx_ptr++; @@ -790,19 +791,18 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s break; } -#ifdef notyet /* Free up any previous register. */ if (cx_ptr->p_lvlx != NULL) { - bus_release_resource(sc->cpu_dev, 0, 0, cx_ptr->p_lvlx); + bus_release_resource(sc->cpu_dev, cx_ptr->res_type, cx_ptr->res_rid, + cx_ptr->p_lvlx); cx_ptr->p_lvlx = NULL; } -#endif /* Allocate the control register for C2 or C3. */ - acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &sc->cpu_rid, + cx_ptr->res_rid = sc->cpu_cx_count; + acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &cx_ptr->res_rid, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx) { - sc->cpu_rid++; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: Got C%d - %d latency\n", device_get_unit(sc->cpu_dev), cx_ptr->type, From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:12:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 991168EE; Sun, 23 Dec 2012 12:12:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7BC498FC0A; Sun, 23 Dec 2012 12:12:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCCmfa089908; Sun, 23 Dec 2012 12:12:48 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCCmke089907; Sun, 23 Dec 2012 12:12:48 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231212.qBNCCmke089907@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:12: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: r244620 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:12:48 -0000 Author: avg Date: Sun Dec 23 12:12:47 2012 New Revision: 244620 URL: http://svnweb.freebsd.org/changeset/base/244620 Log: MFC r243762: gfs_file_inactive: replace bad code with ugly code Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.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/gfs.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sun Dec 23 12:09:52 2012 (r244619) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sun Dec 23 12:12:47 2012 (r244620) @@ -665,8 +665,10 @@ gfs_file_inactive(vnode_t *vp) ge = NULL; found: +#ifdef TODO if (vp->v_flag & V_XATTRDIR) VI_LOCK(fp->gfs_parent); +#endif VI_LOCK(vp); /* * Really remove this vnode @@ -687,16 +689,17 @@ found: if (fp->gfs_parent) { if (dp) gfs_dir_unlock(dp); - VI_LOCK(fp->gfs_parent); - fp->gfs_parent->v_usecount--; - VI_UNLOCK(fp->gfs_parent); + VOP_UNLOCK(vp, 0); + VN_RELE(fp->gfs_parent); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } else { ASSERT(vp->v_vfsp != NULL); VFS_RELE(vp->v_vfsp); } +#ifdef TODO if (vp->v_flag & V_XATTRDIR) VI_UNLOCK(fp->gfs_parent); - +#endif return (data); } From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:13:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14581A4C; Sun, 23 Dec 2012 12:13:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EBC978FC0A; Sun, 23 Dec 2012 12:13:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCD7BP090007; Sun, 23 Dec 2012 12:13:07 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCD7vd090006; Sun, 23 Dec 2012 12:13:07 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231213.qBNCD7vd090006@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244621 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:13:08 -0000 Author: avg Date: Sun Dec 23 12:13:07 2012 New Revision: 244621 URL: http://svnweb.freebsd.org/changeset/base/244621 Log: MFC r243762: gfs_file_inactive: replace bad code with ugly code PR: kern/151111 Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sun Dec 23 12:12:47 2012 (r244620) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sun Dec 23 12:13:07 2012 (r244621) @@ -665,8 +665,10 @@ gfs_file_inactive(vnode_t *vp) ge = NULL; found: +#ifdef TODO if (vp->v_flag & V_XATTRDIR) VI_LOCK(fp->gfs_parent); +#endif VI_LOCK(vp); /* * Really remove this vnode @@ -687,16 +689,17 @@ found: if (fp->gfs_parent) { if (dp) gfs_dir_unlock(dp); - VI_LOCK(fp->gfs_parent); - fp->gfs_parent->v_usecount--; - VI_UNLOCK(fp->gfs_parent); + VOP_UNLOCK(vp, 0); + VN_RELE(fp->gfs_parent); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } else { ASSERT(vp->v_vfsp != NULL); VFS_RELE(vp->v_vfsp); } +#ifdef TODO if (vp->v_flag & V_XATTRDIR) VI_UNLOCK(fp->gfs_parent); - +#endif return (data); } From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:16:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2BB21BC1; Sun, 23 Dec 2012 12:16:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0FA628FC12; Sun, 23 Dec 2012 12:16:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCGDks090527; Sun, 23 Dec 2012 12:16:13 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCGDoA090525; Sun, 23 Dec 2012 12:16:13 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231216.qBNCGDoA090525@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:16:13 +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: r244622 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:16:14 -0000 Author: avg Date: Sun Dec 23 12:16:13 2012 New Revision: 244622 URL: http://svnweb.freebsd.org/changeset/base/244622 Log: MFC r243502: zfs roopool: add support for multi-vdev configurations Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.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/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Dec 23 12:13:07 2012 (r244621) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Dec 23 12:16:13 2012 (r244622) @@ -3739,54 +3739,120 @@ out: #else -extern int -vdev_geom_read_pool_label(const char *name, nvlist_t **config); +extern int vdev_geom_read_pool_label(const char *name, nvlist_t ***configs, + uint64_t *count); static nvlist_t * spa_generate_rootconf(const char *name) { + nvlist_t **configs, **tops; nvlist_t *config; - nvlist_t *nvtop, *nvroot; + nvlist_t *best_cfg, *nvtop, *nvroot; + uint64_t *holes; + uint64_t best_txg; uint64_t nchildren; uint64_t pgid; + uint64_t count; + uint64_t i; + uint_t nholes; - if (vdev_geom_read_pool_label(name, &config) != 0) + if (vdev_geom_read_pool_label(name, &configs, &count) != 0) return (NULL); + ASSERT3U(count, !=, 0); + best_txg = 0; + for (i = 0; i < count; i++) { + uint64_t txg; + + VERIFY(nvlist_lookup_uint64(configs[i], ZPOOL_CONFIG_POOL_TXG, + &txg) == 0); + if (txg > best_txg) { + best_txg = txg; + best_cfg = configs[i]; + } + } + /* * Multi-vdev root pool configuration discovery is not supported yet. */ nchildren = 0; - nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, &nchildren); - if (nchildren != 1) { - nvlist_free(config); - return (NULL); + VERIFY(nvlist_lookup_uint64(best_cfg, ZPOOL_CONFIG_VDEV_CHILDREN, + &nchildren) == 0); + holes = NULL; + nvlist_lookup_uint64_array(best_cfg, ZPOOL_CONFIG_HOLE_ARRAY, + &holes, &nholes); + + tops = kmem_alloc(nchildren * sizeof(void *), KM_SLEEP | KM_ZERO); + for (i = 0; i < nchildren; i++) { + if (i >= count) + break; + if (configs[i] == NULL) + continue; + VERIFY(nvlist_lookup_nvlist(configs[i], ZPOOL_CONFIG_VDEV_TREE, + &nvtop) == 0); + nvlist_dup(nvtop, &tops[i], KM_SLEEP); + } + for (i = 0; holes != NULL && i < nholes; i++) { + if (i >= nchildren) + continue; + if (tops[holes[i]] != NULL) + continue; + nvlist_alloc(&tops[holes[i]], NV_UNIQUE_NAME, KM_SLEEP); + VERIFY(nvlist_add_string(tops[holes[i]], ZPOOL_CONFIG_TYPE, + VDEV_TYPE_HOLE) == 0); + VERIFY(nvlist_add_uint64(tops[holes[i]], ZPOOL_CONFIG_ID, + holes[i]) == 0); + VERIFY(nvlist_add_uint64(tops[holes[i]], ZPOOL_CONFIG_GUID, + 0) == 0); + } + for (i = 0; i < nchildren; i++) { + if (tops[i] != NULL) + continue; + nvlist_alloc(&tops[i], NV_UNIQUE_NAME, KM_SLEEP); + VERIFY(nvlist_add_string(tops[i], ZPOOL_CONFIG_TYPE, + VDEV_TYPE_MISSING) == 0); + VERIFY(nvlist_add_uint64(tops[i], ZPOOL_CONFIG_ID, + i) == 0); + VERIFY(nvlist_add_uint64(tops[i], ZPOOL_CONFIG_GUID, + 0) == 0); } /* - * Add this top-level vdev to the child array. + * Create pool config based on the best vdev config. */ - VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, - &nvtop) == 0); - VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, - &pgid) == 0); + nvlist_dup(best_cfg, &config, KM_SLEEP); /* * Put this pool's top-level vdevs into a root vdev. */ + VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, + &pgid) == 0); VERIFY(nvlist_alloc(&nvroot, NV_UNIQUE_NAME, KM_SLEEP) == 0); VERIFY(nvlist_add_string(nvroot, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT) == 0); VERIFY(nvlist_add_uint64(nvroot, ZPOOL_CONFIG_ID, 0ULL) == 0); VERIFY(nvlist_add_uint64(nvroot, ZPOOL_CONFIG_GUID, pgid) == 0); VERIFY(nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, - &nvtop, 1) == 0); + tops, nchildren) == 0); /* * Replace the existing vdev_tree with the new root vdev in * this pool's configuration (remove the old, add the new). */ VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, nvroot) == 0); + + /* + * Drop vdev config elements that should not be present at pool level. + */ + nvlist_remove(config, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64); + nvlist_remove(config, ZPOOL_CONFIG_TOP_GUID, DATA_TYPE_UINT64); + + for (i = 0; i < count; i++) + nvlist_free(configs[i]); + kmem_free(configs, count * sizeof(void *)); + for (i = 0; i < nchildren; i++) + nvlist_free(tops[i]); + kmem_free(tops, nchildren * sizeof(void *)); nvlist_free(nvroot); return (config); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Dec 23 12:13:07 2012 (r244621) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Dec 23 12:16:13 2012 (r244622) @@ -289,27 +289,74 @@ vdev_geom_read_config(struct g_consumer return (*config == NULL ? ENOENT : 0); } -static int -vdev_geom_check_config(nvlist_t *config, const char *name, uint64_t *best_txg) +static void +resize_configs(nvlist_t ***configs, uint64_t *count, uint64_t id) { - uint64_t vdev_guid; - uint64_t txg; + nvlist_t **new_configs; + uint64_t i; + + if (id < *count) + return; + new_configs = kmem_alloc((id + 1) * sizeof(nvlist_t *), + KM_SLEEP | KM_ZERO); + for (i = 0; i < *count; i++) + new_configs[i] = (*configs)[i]; + if (*configs != NULL) + kmem_free(*configs, *count * sizeof(void *)); + *configs = new_configs; + *count = id + 1; +} + +static void +process_vdev_config(nvlist_t ***configs, uint64_t *count, nvlist_t *cfg, + const char *name, uint64_t* known_pool_guid) +{ + nvlist_t *vdev_tree; + uint64_t pool_guid; + uint64_t vdev_guid, known_guid; + uint64_t id, txg, known_txg; char *pname; + int i; - if (nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &pname) != 0 || + if (nvlist_lookup_string(cfg, ZPOOL_CONFIG_POOL_NAME, &pname) != 0 || strcmp(pname, name) != 0) - return (ENOENT); + goto ignore; - ZFS_LOG(1, "found pool: %s", pname); + if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_GUID, &pool_guid) != 0) + goto ignore; - txg = 0; - nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg); - if (txg <= *best_txg) - return (ENOENT); - *best_txg = txg; - ZFS_LOG(1, "txg: %ju", (uintmax_t)*best_txg); + if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_TOP_GUID, &vdev_guid) != 0) + goto ignore; - return (0); + if (nvlist_lookup_nvlist(cfg, ZPOOL_CONFIG_VDEV_TREE, &vdev_tree) != 0) + goto ignore; + + if (nvlist_lookup_uint64(vdev_tree, ZPOOL_CONFIG_ID, &id) != 0) + goto ignore; + + VERIFY(nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_TXG, &txg) == 0); + + if (*known_pool_guid != 0) { + if (pool_guid != *known_pool_guid) + goto ignore; + } else + *known_pool_guid = pool_guid; + + resize_configs(configs, count, id); + + if ((*configs)[id] != NULL) { + VERIFY(nvlist_lookup_uint64((*configs)[id], + ZPOOL_CONFIG_POOL_TXG, &known_txg) == 0); + if (txg <= known_txg) + goto ignore; + nvlist_free((*configs)[id]); + } + + (*configs)[id] = cfg; + return; + +ignore: + nvlist_free(cfg); } static int @@ -336,14 +383,15 @@ vdev_geom_detach_taster(struct g_consume } int -vdev_geom_read_pool_label(const char *name, nvlist_t **config) +vdev_geom_read_pool_label(const char *name, + nvlist_t ***configs, uint64_t *count) { struct g_class *mp; struct g_geom *gp, *zgp; struct g_provider *pp; struct g_consumer *zcp; nvlist_t *vdev_cfg; - uint64_t best_txg; + uint64_t pool_guid; int error; DROP_GIANT(); @@ -354,8 +402,9 @@ vdev_geom_read_pool_label(const char *na zgp->orphan = vdev_geom_taste_orphan; zcp = g_new_consumer(zgp); - best_txg = 0; - *config = NULL; + *configs = NULL; + *count = 0; + pool_guid = 0; LIST_FOREACH(mp, &g_classes, class) { if (mp == &zfs_vdev_class) continue; @@ -375,14 +424,8 @@ vdev_geom_read_pool_label(const char *na continue; ZFS_LOG(1, "successfully read vdev config"); - error = vdev_geom_check_config(vdev_cfg, name, - &best_txg); - if (error != 0) { - nvlist_free(vdev_cfg); - continue; - } - nvlist_free(*config); - *config = vdev_cfg; + process_vdev_config(configs, count, + vdev_cfg, name, &pool_guid); } } } @@ -391,7 +434,8 @@ vdev_geom_read_pool_label(const char *na g_destroy_geom(zgp); g_topology_unlock(); PICKUP_GIANT(); - return (*config == NULL ? ENOENT : 0); + + return (*count > 0 ? 0 : ENOENT); } static uint64_t From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:16:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 45C4BBC2; Sun, 23 Dec 2012 12:16:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 294108FC13; Sun, 23 Dec 2012 12:16:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCGPc4090584; Sun, 23 Dec 2012 12:16:25 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCGO9J090582; Sun, 23 Dec 2012 12:16:24 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231216.qBNCGO9J090582@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244623 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:16:25 -0000 Author: avg Date: Sun Dec 23 12:16:24 2012 New Revision: 244623 URL: http://svnweb.freebsd.org/changeset/base/244623 Log: MFC r243502: zfs roopool: add support for multi-vdev configurations Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Dec 23 12:16:13 2012 (r244622) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Dec 23 12:16:24 2012 (r244623) @@ -3739,54 +3739,120 @@ out: #else -extern int -vdev_geom_read_pool_label(const char *name, nvlist_t **config); +extern int vdev_geom_read_pool_label(const char *name, nvlist_t ***configs, + uint64_t *count); static nvlist_t * spa_generate_rootconf(const char *name) { + nvlist_t **configs, **tops; nvlist_t *config; - nvlist_t *nvtop, *nvroot; + nvlist_t *best_cfg, *nvtop, *nvroot; + uint64_t *holes; + uint64_t best_txg; uint64_t nchildren; uint64_t pgid; + uint64_t count; + uint64_t i; + uint_t nholes; - if (vdev_geom_read_pool_label(name, &config) != 0) + if (vdev_geom_read_pool_label(name, &configs, &count) != 0) return (NULL); + ASSERT3U(count, !=, 0); + best_txg = 0; + for (i = 0; i < count; i++) { + uint64_t txg; + + VERIFY(nvlist_lookup_uint64(configs[i], ZPOOL_CONFIG_POOL_TXG, + &txg) == 0); + if (txg > best_txg) { + best_txg = txg; + best_cfg = configs[i]; + } + } + /* * Multi-vdev root pool configuration discovery is not supported yet. */ nchildren = 0; - nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, &nchildren); - if (nchildren != 1) { - nvlist_free(config); - return (NULL); + VERIFY(nvlist_lookup_uint64(best_cfg, ZPOOL_CONFIG_VDEV_CHILDREN, + &nchildren) == 0); + holes = NULL; + nvlist_lookup_uint64_array(best_cfg, ZPOOL_CONFIG_HOLE_ARRAY, + &holes, &nholes); + + tops = kmem_alloc(nchildren * sizeof(void *), KM_SLEEP | KM_ZERO); + for (i = 0; i < nchildren; i++) { + if (i >= count) + break; + if (configs[i] == NULL) + continue; + VERIFY(nvlist_lookup_nvlist(configs[i], ZPOOL_CONFIG_VDEV_TREE, + &nvtop) == 0); + nvlist_dup(nvtop, &tops[i], KM_SLEEP); + } + for (i = 0; holes != NULL && i < nholes; i++) { + if (i >= nchildren) + continue; + if (tops[holes[i]] != NULL) + continue; + nvlist_alloc(&tops[holes[i]], NV_UNIQUE_NAME, KM_SLEEP); + VERIFY(nvlist_add_string(tops[holes[i]], ZPOOL_CONFIG_TYPE, + VDEV_TYPE_HOLE) == 0); + VERIFY(nvlist_add_uint64(tops[holes[i]], ZPOOL_CONFIG_ID, + holes[i]) == 0); + VERIFY(nvlist_add_uint64(tops[holes[i]], ZPOOL_CONFIG_GUID, + 0) == 0); + } + for (i = 0; i < nchildren; i++) { + if (tops[i] != NULL) + continue; + nvlist_alloc(&tops[i], NV_UNIQUE_NAME, KM_SLEEP); + VERIFY(nvlist_add_string(tops[i], ZPOOL_CONFIG_TYPE, + VDEV_TYPE_MISSING) == 0); + VERIFY(nvlist_add_uint64(tops[i], ZPOOL_CONFIG_ID, + i) == 0); + VERIFY(nvlist_add_uint64(tops[i], ZPOOL_CONFIG_GUID, + 0) == 0); } /* - * Add this top-level vdev to the child array. + * Create pool config based on the best vdev config. */ - VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, - &nvtop) == 0); - VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, - &pgid) == 0); + nvlist_dup(best_cfg, &config, KM_SLEEP); /* * Put this pool's top-level vdevs into a root vdev. */ + VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, + &pgid) == 0); VERIFY(nvlist_alloc(&nvroot, NV_UNIQUE_NAME, KM_SLEEP) == 0); VERIFY(nvlist_add_string(nvroot, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT) == 0); VERIFY(nvlist_add_uint64(nvroot, ZPOOL_CONFIG_ID, 0ULL) == 0); VERIFY(nvlist_add_uint64(nvroot, ZPOOL_CONFIG_GUID, pgid) == 0); VERIFY(nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, - &nvtop, 1) == 0); + tops, nchildren) == 0); /* * Replace the existing vdev_tree with the new root vdev in * this pool's configuration (remove the old, add the new). */ VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, nvroot) == 0); + + /* + * Drop vdev config elements that should not be present at pool level. + */ + nvlist_remove(config, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64); + nvlist_remove(config, ZPOOL_CONFIG_TOP_GUID, DATA_TYPE_UINT64); + + for (i = 0; i < count; i++) + nvlist_free(configs[i]); + kmem_free(configs, count * sizeof(void *)); + for (i = 0; i < nchildren; i++) + nvlist_free(tops[i]); + kmem_free(tops, nchildren * sizeof(void *)); nvlist_free(nvroot); return (config); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Dec 23 12:16:13 2012 (r244622) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Dec 23 12:16:24 2012 (r244623) @@ -289,27 +289,74 @@ vdev_geom_read_config(struct g_consumer return (*config == NULL ? ENOENT : 0); } -static int -vdev_geom_check_config(nvlist_t *config, const char *name, uint64_t *best_txg) +static void +resize_configs(nvlist_t ***configs, uint64_t *count, uint64_t id) { - uint64_t vdev_guid; - uint64_t txg; + nvlist_t **new_configs; + uint64_t i; + + if (id < *count) + return; + new_configs = kmem_alloc((id + 1) * sizeof(nvlist_t *), + KM_SLEEP | KM_ZERO); + for (i = 0; i < *count; i++) + new_configs[i] = (*configs)[i]; + if (*configs != NULL) + kmem_free(*configs, *count * sizeof(void *)); + *configs = new_configs; + *count = id + 1; +} + +static void +process_vdev_config(nvlist_t ***configs, uint64_t *count, nvlist_t *cfg, + const char *name, uint64_t* known_pool_guid) +{ + nvlist_t *vdev_tree; + uint64_t pool_guid; + uint64_t vdev_guid, known_guid; + uint64_t id, txg, known_txg; char *pname; + int i; - if (nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &pname) != 0 || + if (nvlist_lookup_string(cfg, ZPOOL_CONFIG_POOL_NAME, &pname) != 0 || strcmp(pname, name) != 0) - return (ENOENT); + goto ignore; - ZFS_LOG(1, "found pool: %s", pname); + if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_GUID, &pool_guid) != 0) + goto ignore; - txg = 0; - nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg); - if (txg <= *best_txg) - return (ENOENT); - *best_txg = txg; - ZFS_LOG(1, "txg: %ju", (uintmax_t)*best_txg); + if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_TOP_GUID, &vdev_guid) != 0) + goto ignore; - return (0); + if (nvlist_lookup_nvlist(cfg, ZPOOL_CONFIG_VDEV_TREE, &vdev_tree) != 0) + goto ignore; + + if (nvlist_lookup_uint64(vdev_tree, ZPOOL_CONFIG_ID, &id) != 0) + goto ignore; + + VERIFY(nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_TXG, &txg) == 0); + + if (*known_pool_guid != 0) { + if (pool_guid != *known_pool_guid) + goto ignore; + } else + *known_pool_guid = pool_guid; + + resize_configs(configs, count, id); + + if ((*configs)[id] != NULL) { + VERIFY(nvlist_lookup_uint64((*configs)[id], + ZPOOL_CONFIG_POOL_TXG, &known_txg) == 0); + if (txg <= known_txg) + goto ignore; + nvlist_free((*configs)[id]); + } + + (*configs)[id] = cfg; + return; + +ignore: + nvlist_free(cfg); } static int @@ -336,14 +383,15 @@ vdev_geom_dettach_taster(struct g_consum } int -vdev_geom_read_pool_label(const char *name, nvlist_t **config) +vdev_geom_read_pool_label(const char *name, + nvlist_t ***configs, uint64_t *count) { struct g_class *mp; struct g_geom *gp, *zgp; struct g_provider *pp; struct g_consumer *zcp; nvlist_t *vdev_cfg; - uint64_t best_txg; + uint64_t pool_guid; int error; DROP_GIANT(); @@ -354,8 +402,9 @@ vdev_geom_read_pool_label(const char *na zgp->orphan = vdev_geom_taste_orphan; zcp = g_new_consumer(zgp); - best_txg = 0; - *config = NULL; + *configs = NULL; + *count = 0; + pool_guid = 0; LIST_FOREACH(mp, &g_classes, class) { if (mp == &zfs_vdev_class) continue; @@ -375,14 +424,8 @@ vdev_geom_read_pool_label(const char *na continue; ZFS_LOG(1, "successfully read vdev config"); - error = vdev_geom_check_config(vdev_cfg, name, - &best_txg); - if (error != 0) { - nvlist_free(vdev_cfg); - continue; - } - nvlist_free(*config); - *config = vdev_cfg; + process_vdev_config(configs, count, + vdev_cfg, name, &pool_guid); } } } @@ -391,7 +434,8 @@ vdev_geom_read_pool_label(const char *na g_destroy_geom(zgp); g_topology_unlock(); PICKUP_GIANT(); - return (*config == NULL ? ENOENT : 0); + + return (*count > 0 ? 0 : ENOENT); } static uint64_t From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:19:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B909F2F; Sun, 23 Dec 2012 12:19:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E2D348FC0A; Sun, 23 Dec 2012 12:19:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCJ7a0091004; Sun, 23 Dec 2012 12:19:07 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCJ78H091003; Sun, 23 Dec 2012 12:19:07 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231219.qBNCJ78H091003@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:19: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: r244624 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:19:08 -0000 Author: avg Date: Sun Dec 23 12:19:07 2012 New Revision: 244624 URL: http://svnweb.freebsd.org/changeset/base/244624 Log: MFC r242567: zfs_mount: drop vfs.zfs.rootpool.prefer_cached_config tunable 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 Sun Dec 23 12:16:24 2012 (r244623) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Dec 23 12:19:07 2012 (r244624) @@ -1656,24 +1656,12 @@ zfs_mount(vfs_t *vfsp) if ((vfsp->vfs_flag & MNT_ROOTFS) != 0 && (vfsp->vfs_flag & MNT_UPDATE) == 0) { char pname[MAXNAMELEN]; - spa_t *spa; - int prefer_cache; error = getpoolname(osname, pname); + if (error == 0) + error = spa_import_rootpool(pname); if (error) goto out; - - prefer_cache = 1; - TUNABLE_INT_FETCH("vfs.zfs.rootpool.prefer_cached_config", - &prefer_cache); - mutex_enter(&spa_namespace_lock); - spa = spa_lookup(pname); - mutex_exit(&spa_namespace_lock); - if (!prefer_cache || spa == NULL) { - error = spa_import_rootpool(pname); - if (error) - goto out; - } } DROP_GIANT(); error = zfs_domount(vfsp, osname); From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:19:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EEB56113; Sun, 23 Dec 2012 12:19:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D1C838FC0C; Sun, 23 Dec 2012 12:19:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCJMcD091068; Sun, 23 Dec 2012 12:19:22 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCJMfs091067; Sun, 23 Dec 2012 12:19:22 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231219.qBNCJMfs091067@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244625 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:19:23 -0000 Author: avg Date: Sun Dec 23 12:19:22 2012 New Revision: 244625 URL: http://svnweb.freebsd.org/changeset/base/244625 Log: MFC r242567: zfs_mount: drop vfs.zfs.rootpool.prefer_cached_config tunable Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Dec 23 12:19:07 2012 (r244624) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Dec 23 12:19:22 2012 (r244625) @@ -1652,24 +1652,12 @@ zfs_mount(vfs_t *vfsp) if ((vfsp->vfs_flag & MNT_ROOTFS) != 0 && (vfsp->vfs_flag & MNT_UPDATE) == 0) { char pname[MAXNAMELEN]; - spa_t *spa; - int prefer_cache; error = getpoolname(osname, pname); + if (error == 0) + error = spa_import_rootpool(pname); if (error) goto out; - - prefer_cache = 1; - TUNABLE_INT_FETCH("vfs.zfs.rootpool.prefer_cached_config", - &prefer_cache); - mutex_enter(&spa_namespace_lock); - spa = spa_lookup(pname); - mutex_exit(&spa_namespace_lock); - if (!prefer_cache || spa == NULL) { - error = spa_import_rootpool(pname); - if (error) - goto out; - } } DROP_GIANT(); error = zfs_domount(vfsp, osname); From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:46:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E3EA9A3; Sun, 23 Dec 2012 12:46:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4FA258FC0A; Sun, 23 Dec 2012 12:46:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCkTKA094710; Sun, 23 Dec 2012 12:46:29 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCkSqO094706; Sun, 23 Dec 2012 12:46:28 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231246.qBNCkSqO094706@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:46: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: r244626 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:46:29 -0000 Author: avg Date: Sun Dec 23 12:46:28 2012 New Revision: 244626 URL: http://svnweb.freebsd.org/changeset/base/244626 Log: MFC r243520,243521: zfs: overhaul zfs-vfs glue for vnode life-cycle management Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.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/sys/zfs_znode.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Sun Dec 23 12:19:22 2012 (r244625) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Sun Dec 23 12:46:28 2012 (r244626) @@ -207,8 +207,6 @@ typedef struct znode { list_node_t z_link_node; /* all znodes in fs link */ sa_handle_t *z_sa_hdl; /* handle to sa data */ boolean_t z_is_sa; /* are we native sa? */ - /* FreeBSD-specific field. */ - struct task z_task; } znode_t; 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 Sun Dec 23 12:19:22 2012 (r244625) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Dec 23 12:46:28 2012 (r244626) @@ -1848,18 +1848,6 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea zfsvfs->z_unmounted = B_TRUE; rrw_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); - -#ifdef __FreeBSD__ - /* - * Some znodes might not be fully reclaimed, wait for them. - */ - mutex_enter(&zfsvfs->z_znodes_lock); - while (list_head(&zfsvfs->z_all_znodes) != NULL) { - msleep(zfsvfs, &zfsvfs->z_znodes_lock, 0, - "zteardown", 0); - } - mutex_exit(&zfsvfs->z_znodes_lock); -#endif } /* Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Dec 23 12:19:22 2012 (r244625) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Dec 23 12:46:28 2012 (r244626) @@ -4578,14 +4578,22 @@ zfs_inactive(vnode_t *vp, cred_t *cr, ca * The fs has been unmounted, or we did a * suspend/resume and this file no longer exists. */ - VI_LOCK(vp); - ASSERT(vp->v_count <= 1); - vp->v_count = 0; - VI_UNLOCK(vp); + rw_exit(&zfsvfs->z_teardown_inactive_lock); vrecycle(vp, curthread); + return; + } + + mutex_enter(&zp->z_lock); + if (zp->z_unlinked) { + /* + * Fast path to recycle a vnode of a removed file. + */ + mutex_exit(&zp->z_lock); rw_exit(&zfsvfs->z_teardown_inactive_lock); + vrecycle(vp, curthread); return; } + mutex_exit(&zp->z_lock); if (zp->z_atime_dirty && zp->z_unlinked == 0) { dmu_tx_t *tx = dmu_tx_create(zfsvfs->z_os); @@ -4604,8 +4612,6 @@ zfs_inactive(vnode_t *vp, cred_t *cr, ca dmu_tx_commit(tx); } } - - zfs_zinactive(zp); rw_exit(&zfsvfs->z_teardown_inactive_lock); } @@ -6121,28 +6127,6 @@ zfs_freebsd_inactive(ap) return (0); } -static void -zfs_reclaim_complete(void *arg, int pending) -{ - znode_t *zp = arg; - zfsvfs_t *zfsvfs = zp->z_zfsvfs; - - rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_READER); - if (zp->z_sa_hdl != NULL) { - ZFS_OBJ_HOLD_ENTER(zfsvfs, zp->z_id); - zfs_znode_dmu_fini(zp); - ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id); - } - zfs_znode_free(zp); - rw_exit(&zfsvfs->z_teardown_inactive_lock); - /* - * If the file system is being unmounted, there is a process waiting - * for us, wake it up. - */ - if (zfsvfs->z_unmounted) - wakeup_one(zfsvfs); -} - static int zfs_freebsd_reclaim(ap) struct vop_reclaim_args /* { @@ -6153,53 +6137,25 @@ zfs_freebsd_reclaim(ap) vnode_t *vp = ap->a_vp; znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; - boolean_t rlocked; - - rlocked = rw_tryenter(&zfsvfs->z_teardown_inactive_lock, RW_READER); ASSERT(zp != NULL); - /* - * Destroy the vm object and flush associated pages. - */ + /* Destroy the vm object and flush associated pages. */ vnode_destroy_vobject(vp); - mutex_enter(&zp->z_lock); - zp->z_vnode = NULL; - mutex_exit(&zp->z_lock); - - if (zp->z_unlinked) { - ; /* Do nothing. */ - } else if (!rlocked) { - TASK_INIT(&zp->z_task, 0, zfs_reclaim_complete, zp); - taskqueue_enqueue(taskqueue_thread, &zp->z_task); - } else if (zp->z_sa_hdl == NULL) { + /* + * z_teardown_inactive_lock protects from a race with + * zfs_znode_dmu_fini in zfsvfs_teardown during + * force unmount. + */ + rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_READER); + if (zp->z_sa_hdl == NULL) zfs_znode_free(zp); - } else /* if (!zp->z_unlinked && zp->z_dbuf != NULL) */ { - int locked; + else + zfs_zinactive(zp); + rw_exit(&zfsvfs->z_teardown_inactive_lock); - locked = MUTEX_HELD(ZFS_OBJ_MUTEX(zfsvfs, zp->z_id)) ? 2 : - ZFS_OBJ_HOLD_TRYENTER(zfsvfs, zp->z_id); - if (locked == 0) { - /* - * Lock can't be obtained due to deadlock possibility, - * so defer znode destruction. - */ - TASK_INIT(&zp->z_task, 0, zfs_reclaim_complete, zp); - taskqueue_enqueue(taskqueue_thread, &zp->z_task); - } else { - zfs_znode_dmu_fini(zp); - if (locked == 1) - ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id); - zfs_znode_free(zp); - } - } - VI_LOCK(vp); vp->v_data = NULL; - ASSERT(vp->v_holdcnt >= 1); - VI_UNLOCK(vp); - if (rlocked) - rw_exit(&zfsvfs->z_teardown_inactive_lock); return (0); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Dec 23 12:19:22 2012 (r244625) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Dec 23 12:46:28 2012 (r244626) @@ -1147,14 +1147,16 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_ dmu_object_info_t doi; dmu_buf_t *db; znode_t *zp; - int err; + vnode_t *vp; sa_handle_t *hdl; - int first = 1; - - *zpp = NULL; + struct thread *td; + int locked; + int err; + td = curthread; getnewvnode_reserve(1); again: + *zpp = NULL; ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num); err = sa_buf_hold(zfsvfs->z_os, obj_num, NULL, &db); @@ -1193,48 +1195,38 @@ again: if (zp->z_unlinked) { err = ENOENT; } else { - vnode_t *vp; - int dying = 0; - vp = ZTOV(zp); - if (vp == NULL) - dying = 1; - else { - VN_HOLD(vp); - if ((vp->v_iflag & VI_DOOMED) != 0) { - dying = 1; - /* - * Don't VN_RELE() vnode here, because - * it can call vn_lock() which creates - * LOR between vnode lock and znode - * lock. We will VN_RELE() the vnode - * after droping znode lock. - */ - } - } - if (dying) { - if (first) { - ZFS_LOG(1, "dying znode detected (zp=%p)", zp); - first = 0; - } - /* - * znode is dying so we can't reuse it, we must - * wait until destruction is completed. - */ - sa_buf_rele(db, NULL); - mutex_exit(&zp->z_lock); - ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); - if (vp != NULL) - VN_RELE(vp); - tsleep(zp, 0, "zcollide", 1); - goto again; - } *zpp = zp; err = 0; } sa_buf_rele(db, NULL); + + /* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */ + if (err == 0) + VN_HOLD(vp); + mutex_exit(&zp->z_lock); ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); + + if (err == 0) { + locked = VOP_ISLOCKED(vp); + VI_LOCK(vp); + if ((vp->v_iflag & VI_DOOMED) != 0 && + locked != LK_EXCLUSIVE) { + /* + * The vnode is doomed and this thread doesn't + * hold the exclusive lock on it, so the vnode + * must be being reclaimed by another thread. + * Otherwise the doomed vnode is being reclaimed + * by this thread and zfs_zget is called from + * ZIL internals. + */ + VI_UNLOCK(vp); + VN_RELE(vp); + goto again; + } + VI_UNLOCK(vp); + } getnewvnode_drop_reserve(); return (err); } @@ -1400,10 +1392,8 @@ zfs_znode_delete(znode_t *zp, dmu_tx_t * void zfs_zinactive(znode_t *zp) { - vnode_t *vp = ZTOV(zp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; uint64_t z_id = zp->z_id; - int vfslocked; ASSERT(zp->z_sa_hdl); @@ -1413,19 +1403,6 @@ zfs_zinactive(znode_t *zp) ZFS_OBJ_HOLD_ENTER(zfsvfs, z_id); mutex_enter(&zp->z_lock); - VI_LOCK(vp); - if (vp->v_count > 0) { - /* - * If the hold count is greater than zero, somebody has - * obtained a new reference on this znode while we were - * processing it here, so we are done. - */ - VI_UNLOCK(vp); - mutex_exit(&zp->z_lock); - ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - return; - } - VI_UNLOCK(vp); /* * If this was the last reference to a file with no links, @@ -1434,16 +1411,14 @@ zfs_zinactive(znode_t *zp) if (zp->z_unlinked) { mutex_exit(&zp->z_lock); ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - ASSERT(vp->v_count == 0); - vrecycle(vp, curthread); - vfslocked = VFS_LOCK_GIANT(zfsvfs->z_vfs); zfs_rmnode(zp); - VFS_UNLOCK_GIANT(vfslocked); return; } mutex_exit(&zp->z_lock); + zfs_znode_dmu_fini(zp); ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); + zfs_znode_free(zp); } void @@ -1451,8 +1426,8 @@ zfs_znode_free(znode_t *zp) { zfsvfs_t *zfsvfs = zp->z_zfsvfs; - ASSERT(ZTOV(zp) == NULL); ASSERT(zp->z_sa_hdl == NULL); + zp->z_vnode = NULL; mutex_enter(&zfsvfs->z_znodes_lock); POINTER_INVALIDATE(&zp->z_zfsvfs); list_remove(&zfsvfs->z_all_znodes, zp); From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 12:56:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 16AA3CE6; Sun, 23 Dec 2012 12:56:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EE9B48FC12; Sun, 23 Dec 2012 12:56:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBNCu4iI096002; Sun, 23 Dec 2012 12:56:04 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBNCu4xD096001; Sun, 23 Dec 2012 12:56:04 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231256.qBNCu4xD096001@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 12:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244627 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 12:56:05 -0000 Author: avg Date: Sun Dec 23 12:56:04 2012 New Revision: 244627 URL: http://svnweb.freebsd.org/changeset/base/244627 Log: lock.9: fix incorrect descriptions of LK_SHARED and LK_DOWNGRADE behavior Reviewed by: attilio MFC after: 5 days X-MFC after: r243900 Modified: head/share/man/man9/lock.9 Modified: head/share/man/man9/lock.9 ============================================================================== --- head/share/man/man9/lock.9 Sun Dec 23 12:46:28 2012 (r244626) +++ head/share/man/man9/lock.9 Sun Dec 23 12:56:04 2012 (r244627) @@ -148,7 +148,9 @@ Flags indicating what action is to be ta .Bl -tag -width ".Dv LK_CANRECURSE" .It Dv LK_SHARED Acquire a shared lock. -If an exclusive lock is currently held, it will be downgraded. +If an exclusive lock is currently held, +.Dv EDEADLK +will be returned. .It Dv LK_EXCLUSIVE Acquire an exclusive lock. If an exclusive lock is already held, and @@ -158,7 +160,8 @@ is not set, the system will .It Dv LK_DOWNGRADE Downgrade exclusive lock to a shared lock. Downgrading a shared lock is not permitted. -If an exclusive lock has been recursed, all references will be downgraded. +If an exclusive lock has been recursed, the system will +.Xr panic 9 . .It Dv LK_UPGRADE Upgrade a shared lock to an exclusive lock. If this call fails, the shared lock is lost. From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 13:04:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 773EFFB8; Sun, 23 Dec 2012 13:04:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5CE0D8FC0C; Sun, 23 Dec 2012 13:04:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBND45ax097321; Sun, 23 Dec 2012 13:04:05 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBND45mt097320; Sun, 23 Dec 2012 13:04:05 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212231304.qBND45mt097320@svn.freebsd.org> From: Andriy Gapon Date: Sun, 23 Dec 2012 13:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244629 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 13:04:05 -0000 Author: avg Date: Sun Dec 23 13:04:04 2012 New Revision: 244629 URL: http://svnweb.freebsd.org/changeset/base/244629 Log: UPDATING: add a note about the clang+zfs+i386 stack overflow issue Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Dec 23 13:04:00 2012 (r244628) +++ head/UPDATING Sun Dec 23 13:04:04 2012 (r244629) @@ -26,6 +26,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20121223: + After switching to Clang as the default compiler some users of ZFS + on i386 systems started to experience stack overflow kernel panics. + Please consider using 'options KSTACK_PAGES=4' in such configurations. + 20121222: GEOM_LABEL now mangles label names read from file system metadata. Mangling affect labels containing spaces, non-printable characters, From owner-svn-src-all@FreeBSD.ORG Sun Dec 23 13:04:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A6F7FB9; Sun, 23 Dec 2012 13:04:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F129D8FC13; Sun, 23 Dec 2012 13:04:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBND45CB097328; Sun, 23 Dec 2012 13:04:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBND401R097249; Sun, 23 Dec 2012 13:04:00 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201212231304.qBND401R097249@svn.freebsd.org> From: Dimitry Andric Date: Sun, 23 Dec 2012 13:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244628 - in head: contrib/llvm/include/llvm/MC contrib/llvm/lib/ExecutionEngine/RuntimeDyld contrib/llvm/lib/MC contrib/llvm/lib/Target/Mips contrib/llvm/lib/Target/Mips/InstPrinter co... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 13:04:06 -0000 Author: dim Date: Sun Dec 23 13:04:00 2012 New Revision: 244628 URL: http://svnweb.freebsd.org/changeset/base/244628 Log: Upgrade our copy of llvm/clang to 3.2 release. Release notes for llvm: http://llvm.org/releases/3.2/docs/ReleaseNotes.html Release notes for clang: http://llvm.org/releases/3.2/tools/clang/docs/ReleaseNotes.html MFC after: 2 weeks Modified: head/contrib/llvm/include/llvm/MC/MCExpr.h head/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp head/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp head/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h head/contrib/llvm/lib/MC/MCExpr.cpp head/contrib/llvm/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsBaseInfo.h head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp head/contrib/llvm/lib/Target/Mips/MipsISelLowering.cpp head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsJITInfo.cpp head/contrib/llvm/lib/Target/Mips/MipsJITInfo.h head/contrib/llvm/lib/Target/Mips/MipsMCInstLower.cpp head/contrib/llvm/lib/Transforms/Scalar/SROA.cpp head/contrib/llvm/tools/clang/include/clang/Sema/Scope.h head/contrib/llvm/tools/clang/lib/Basic/Version.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseStmt.cpp head/contrib/llvm/tools/clang/lib/Sema/IdentifierResolver.cpp head/lib/clang/include/clang/Basic/Version.inc head/usr.bin/clang/clang/clang.1 Directory Properties: head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) Modified: head/contrib/llvm/include/llvm/MC/MCExpr.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCExpr.h Sun Dec 23 12:56:04 2012 (r244627) +++ head/contrib/llvm/include/llvm/MC/MCExpr.h Sun Dec 23 13:04:00 2012 (r244628) @@ -197,7 +197,11 @@ public: VK_Mips_GOT_PAGE, VK_Mips_GOT_OFST, VK_Mips_HIGHER, - VK_Mips_HIGHEST + VK_Mips_HIGHEST, + VK_Mips_GOT_HI16, + VK_Mips_GOT_LO16, + VK_Mips_CALL_HI16, + VK_Mips_CALL_LO16 }; private: Modified: head/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp ============================================================================== --- head/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Sun Dec 23 12:56:04 2012 (r244627) +++ head/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Sun Dec 23 13:04:00 2012 (r244628) @@ -346,7 +346,7 @@ uint8_t *RuntimeDyldImpl::createStubFunc uint32_t *StubAddr = (uint32_t*)Addr; *StubAddr = 0xe51ff004; // ldr pc,