From owner-svn-src-head@FreeBSD.ORG Sun May 2 00:44:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 35A211065672; Sun, 2 May 2010 00:44:01 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 9DB2C8FC0A; Sun, 2 May 2010 00:43:56 +0000 (UTC) Received: from [10.0.2.78] (ppp121-45-159-77.lns6.adl6.internode.on.net [121.45.159.77]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o420hgWv047886 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 2 May 2010 10:13:48 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <201005011636.o41GaFsK084343@svn.freebsd.org> Date: Sun, 2 May 2010 10:13:42 +0930 Content-Transfer-Encoding: 7bit Message-Id: <9624CC6A-EEB1-4492-9E62-7ACD0BF6F39C@gsoft.com.au> References: <201005011636.o41GaFsK084343@svn.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.1078) X-Spam-Score: 0.163 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207472 - in head/sys: conf dev/ath/ath_hal/ar5212 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 00:44:01 -0000 On 02/05/2010, at 2:06 AM, Warner Losh wrote: > Unfortunately, this condition is impossible to detect at runtime > without MIPS specific ifdefs. Rather than cast an overly-broad net > like Linux/OpenWRT dues (which enables this workaround all the time on > MIPS32 platforms), we put this option in the kernel for just the > affected machines. Sam didn't like this aspect of the patch when he > reviewed it, and I'd love to hear sane proposals on how to fix it :) Could you do TUNABLE_INT in the MIPS code and TUNABLE_INT_FETCH in ath_hal? -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-svn-src-head@FreeBSD.ORG Sun May 2 01:25:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 78AD6106566B; Sun, 2 May 2010 01:25:03 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 692768FC12; Sun, 2 May 2010 01:25:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o421P3HY004273; Sun, 2 May 2010 01:25:03 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o421P3NS004271; Sun, 2 May 2010 01:25:03 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005020125.o421P3NS004271@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 01:25:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207487 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 01:25:03 -0000 Author: alc Date: Sun May 2 01:25:03 2010 New Revision: 207487 URL: http://svn.freebsd.org/changeset/base/207487 Log: Correct an error of omission in r206819. If VMFS_TLB_ALIGNED_SPACE is specified to vm_map_find(), then retry the vm_map_findspace() if vm_map_insert() fails because the aligned space is already partly used. Reported by: Neel Natu Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat May 1 23:25:53 2010 (r207486) +++ head/sys/vm/vm_map.c Sun May 2 01:25:03 2010 (r207487) @@ -1412,7 +1412,11 @@ vm_map_find(vm_map_t map, vm_object_t ob } result = vm_map_insert(map, object, offset, start, start + length, prot, max, cow); - } while (result == KERN_NO_SPACE && find_space == VMFS_ALIGNED_SPACE); + } while (result == KERN_NO_SPACE && (find_space == VMFS_ALIGNED_SPACE +#ifdef VMFS_TLB_ALIGNED_SPACE + || find_space == VMFS_TLB_ALIGNED_SPACE +#endif + )); vm_map_unlock(map); return (result); } From owner-svn-src-head@FreeBSD.ORG Sun May 2 01:51:11 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A787106566B; Sun, 2 May 2010 01:51:11 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 4AABD8FC18; Sun, 2 May 2010 01:51:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o421li6n040425; Sat, 1 May 2010 19:47:45 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 01 May 2010 19:47:58 -0600 (MDT) Message-Id: <20100501.194758.49280345204940330.imp@bsdimp.com> To: doconnor@gsoft.com.au From: "M. Warner Losh" In-Reply-To: <9624CC6A-EEB1-4492-9E62-7ACD0BF6F39C@gsoft.com.au> References: <201005011636.o41GaFsK084343@svn.freebsd.org> <9624CC6A-EEB1-4492-9E62-7ACD0BF6F39C@gsoft.com.au> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r207472 - in head/sys: conf dev/ath/ath_hal/ar5212 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 01:51:11 -0000 In message: <9624CC6A-EEB1-4492-9E62-7ACD0BF6F39C@gsoft.com.au> "Daniel O'Connor" writes: : : On 02/05/2010, at 2:06 AM, Warner Losh wrote: : > Unfortunately, this condition is impossible to detect at runtime : > without MIPS specific ifdefs. Rather than cast an overly-broad net : > like Linux/OpenWRT dues (which enables this workaround all the time on : > MIPS32 platforms), we put this option in the kernel for just the : > affected machines. Sam didn't like this aspect of the patch when he : > reviewed it, and I'd love to hear sane proposals on how to fix it :) : : Could you do TUNABLE_INT in the MIPS code and TUNABLE_INT_FETCH in ath_hal? How is that better than a kernel option? The only place this would ever happen is atheros AR71xx SoC. It isn't like some of the Atheros 71xx SoCs would have it and some wouldn't. And besides, kenv has to be compiled into the kernel on MIPS these days... The only thing close to an idea I've had is to add: __weak int ath_needs_dma_war() { return 0; } and have this in the mips: int needs_ath_dma_war = 0; __weak int ath_needs_dma_war() { return needs_ath_dma_war; } and set it to 1 in the AR71xx CPU initialization. But that seemed kind of lame... Warner From owner-svn-src-head@FreeBSD.ORG Sun May 2 03:19:17 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2676D1065672; Sun, 2 May 2010 03:19:17 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 916038FC14; Sun, 2 May 2010 03:19:16 +0000 (UTC) Received: from [10.0.2.78] (ppp121-45-159-77.lns6.adl6.internode.on.net [121.45.159.77]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o423Iq1Y054159 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 2 May 2010 12:48:59 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <20100501.194758.49280345204940330.imp@bsdimp.com> Date: Sun, 2 May 2010 12:48:52 +0930 Content-Transfer-Encoding: quoted-printable Message-Id: <383911EE-5844-4673-BAA8-796DDEBC5D5C@gsoft.com.au> References: <201005011636.o41GaFsK084343@svn.freebsd.org> <9624CC6A-EEB1-4492-9E62-7ACD0BF6F39C@gsoft.com.au> <20100501.194758.49280345204940330.imp@bsdimp.com> To: "M. Warner Losh" X-Mailer: Apple Mail (2.1078) X-Spam-Score: 0.163 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r207472 - in head/sys: conf dev/ath/ath_hal/ar5212 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 03:19:17 -0000 On 02/05/2010, at 11:17 AM, M. Warner Losh wrote: > : Could you do TUNABLE_INT in the MIPS code and TUNABLE_INT_FETCH in = ath_hal? >=20 > How is that better than a kernel option? The only place this would > ever happen is atheros AR71xx SoC. It isn't like some of the Atheros > 71xx SoCs would have it and some wouldn't. OK. > And besides, kenv has to be compiled into the kernel on MIPS these > days... Ahh that makes a tunable fairly useless then :) > The only thing close to an idea I've had is to add: >=20 > __weak int > ath_needs_dma_war() > { > return 0; > } >=20 > and have this in the mips: >=20 > int needs_ath_dma_war =3D 0; > __weak int ath_needs_dma_war() > { > return needs_ath_dma_war; > } >=20 > and set it to 1 in the AR71xx CPU initialization. But that seemed > kind of lame... It does have the advantage of not requiring the user to do anything = which is nice even if it's clunky looking. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-svn-src-head@FreeBSD.ORG Sun May 2 04:16:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1E10106564A; Sun, 2 May 2010 04:16:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id A29A98FC1F; Sun, 2 May 2010 04:16:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o424Gd4U042018; Sun, 2 May 2010 04:16:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o424GdVQ042016; Sun, 2 May 2010 04:16:39 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201005020416.o424GdVQ042016@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 May 2010 04:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207490 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 04:16:39 -0000 Author: mav Date: Sun May 2 04:16:39 2010 New Revision: 207490 URL: http://svn.freebsd.org/changeset/base/207490 Log: Add xpt_schedule_dev_sendq() call, lost at r203108. It is not needed in usual operation, but required in some conditions to make queue running after being shrinked. MFC after: 3 days Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun May 2 03:28:29 2010 (r207489) +++ head/sys/cam/cam_xpt.c Sun May 2 04:16:39 2010 (r207490) @@ -4874,6 +4874,8 @@ camisr_runqueue(void *V_queue) if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 && (--dev->tag_delay_count == 0)) xpt_start_tags(ccb_h->path); + if (!device_is_send_queued(dev)) + xpt_schedule_dev_sendq(ccb_h->path->bus, dev); } if (ccb_h->status & CAM_RELEASE_SIMQ) { From owner-svn-src-head@FreeBSD.ORG Sun May 2 11:36:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 31936106566B; Sun, 2 May 2010 11:36:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 217DE8FC13; Sun, 2 May 2010 11:36:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42BaSAo045691; Sun, 2 May 2010 11:36:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42BaSKm045688; Sun, 2 May 2010 11:36:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201005021136.o42BaSKm045688@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 May 2010 11:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207498 - head/sbin/camcontrol X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 11:36:28 -0000 Author: mav Date: Sun May 2 11:36:27 2010 New Revision: 207498 URL: http://svn.freebsd.org/changeset/base/207498 Log: Add -d and -f arguments to `camcontrol cmd`, to execute DMA ATA commands. Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Sun May 2 06:34:13 2010 (r207497) +++ head/sbin/camcontrol/camcontrol.8 Sun May 2 11:36:27 2010 (r207498) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 20, 2010 +.Dd May 2, 2010 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -123,6 +123,8 @@ .Op generic args .Aq Fl a Ar cmd Op args .Aq Fl c Ar cmd Op args +.Op Fl d +.Op Fl f .Op Fl i Ar len Ar fmt .Bk -words .Op Fl o Ar len Ar fmt Op args @@ -530,6 +532,10 @@ lba_high_exp, features_exp, sector_count .It Fl c Ar cmd Op args This specifies the SCSI CDB. SCSI CDBs may be 6, 10, 12 or 16 bytes. +.It Fl d +Specifies DMA protocol to be used for ATA command. +.It Fl f +Specifies FPDMA (NCQ) protocol to be used for ATA command. .It Fl i Ar len Ar fmt This specifies the amount of data to read, and how it should be displayed. If the format is Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sun May 2 06:34:13 2010 (r207497) +++ head/sbin/camcontrol/camcontrol.c Sun May 2 11:36:27 2010 (r207498) @@ -123,7 +123,7 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC -static const char scsicmd_opts[] = "a:c:i:o:r"; +static const char scsicmd_opts[] = "a:c:dfi:o:r"; static const char readdefect_opts[] = "f:GP"; static const char negotiate_opts[] = "acD:M:O:qR:T:UW:"; #endif @@ -2184,6 +2184,8 @@ scsicmd(struct cam_device *device, int a int c, data_bytes = 0; int cdb_len = 0; int atacmd_len = 0; + int dmacmd = 0; + int fpdmacmd = 0; int need_res = 0; char *datastr = NULL, *tstr, *resstr = NULL; int error = 0; @@ -2246,6 +2248,12 @@ scsicmd(struct cam_device *device, int a */ optind += hook.got; break; + case 'd': + dmacmd = 1; + break; + case 'f': + fpdmacmd = 1; + break; case 'i': if (arglist & CAM_ARG_CMD_OUT) { warnx("command must either be " @@ -2422,6 +2430,10 @@ scsicmd(struct cam_device *device, int a bcopy(atacmd, &ccb->ataio.cmd.command, atacmd_len); if (need_res) ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; + if (dmacmd) + ccb->ataio.cmd.flags |= CAM_ATAIO_DMA; + if (fpdmacmd) + ccb->ataio.cmd.flags |= CAM_ATAIO_FPDMA; cam_fill_ataio(&ccb->ataio, /*retries*/ retry_count, @@ -4353,7 +4365,7 @@ usage(int verbose) " [-P pagectl][-e | -b][-d]\n" " camcontrol cmd [dev_id][generic args]\n" " <-a cmd [args] | -c cmd [args]>\n" -" [-i len fmt|-o len fmt [args]] [-r fmt]\n" +" [-d] [-f] [-i len fmt|-o len fmt [args]] [-r fmt]\n" " camcontrol debug [-I][-P][-T][-S][-X][-c]\n" " \n" " camcontrol tags [dev_id][generic args] [-N tags] [-q] [-v]\n" From owner-svn-src-head@FreeBSD.ORG Sun May 2 12:07:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4760106566C; Sun, 2 May 2010 12:07:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 928D78FC17; Sun, 2 May 2010 12:07:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42C7l0R052551; Sun, 2 May 2010 12:07:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42C7l1Y052542; Sun, 2 May 2010 12:07:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201005021207.o42C7l1Y052542@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 May 2010 12:07:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207499 - in head: sbin/camcontrol sys/cam sys/cam/ata sys/dev/ahci sys/dev/siis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 12:07:47 -0000 Author: mav Date: Sun May 2 12:07:47 2010 New Revision: 207499 URL: http://svn.freebsd.org/changeset/base/207499 Log: Make SATA XPT negotiate and enable some additional SATA features, such as: - device initiated power management (some devices support only this way); - Automatic Partial to Slumber Transition (more power saving); - DMA auto-activation (expected to slightly improve performance). More features could be added later, when hardware supports. Modified: head/sbin/camcontrol/camcontrol.c head/sys/cam/ata/ata_pmp.c head/sys/cam/ata/ata_xpt.c head/sys/cam/cam_ccb.h head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h head/sys/dev/siis/siis.c head/sys/dev/siis/siis.h Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sun May 2 11:36:27 2010 (r207498) +++ head/sbin/camcontrol/camcontrol.c Sun May 2 12:07:47 2010 (r207499) @@ -2855,6 +2855,10 @@ cts_print(struct cam_device *device, str fprintf(stdout, "%sNumber of tags: %d\n", pathstr, sata->tags); } + if ((sata->valid & CTS_SATA_VALID_CAPS) != 0) { + fprintf(stdout, "%sSATA capabilities: %08x\n", pathstr, + sata->caps); + } } if (cts->protocol == PROTO_SCSI) { struct ccb_trans_settings_scsi *scsi= Modified: head/sys/cam/ata/ata_pmp.c ============================================================================== --- head/sys/cam/ata/ata_pmp.c Sun May 2 11:36:27 2010 (r207498) +++ head/sys/cam/ata/ata_pmp.c Sun May 2 12:07:47 2010 (r207499) @@ -101,6 +101,7 @@ struct pmp_softc { int events; #define PMP_EV_RESET 1 #define PMP_EV_RESCAN 2 + u_int caps; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -457,6 +458,14 @@ pmpstart(struct cam_periph *periph, unio ata_pm_read_cmd(ataio, 2, 15); break; case PMP_STATE_PRECONFIG: + /* Get/update host SATA capabilities. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + xpt_action((union ccb *)&cts); + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + softc->caps = cts.xport_specific.sata.caps; cam_fill_ataio(ataio, pmp_retry_count, pmpdone, @@ -644,14 +653,16 @@ pmpdone(struct cam_periph *periph, union (done_ccb->ataio.res.lba_mid << 16) + (done_ccb->ataio.res.lba_low << 8) + done_ccb->ataio.res.sector_count; - if ((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) { + if (((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) || + (res & 0x600) != 0) { if (bootverbose) { printf("%s%d: port %d status: %08x\n", periph->periph_name, periph->unit_number, softc->pm_step, res); } - /* Report device speed. */ - if (xpt_create_path(&dpath, periph, + /* Report device speed if it is online. */ + if ((res & 0xf0f) == 0x103 && + xpt_create_path(&dpath, periph, xpt_path_path_id(periph->path), softc->pm_step, 0) == CAM_REQ_CMP) { bzero(&cts, sizeof(cts)); @@ -660,6 +671,9 @@ pmpdone(struct cam_periph *periph, union cts.type = CTS_TYPE_CURRENT_SETTINGS; cts.xport_specific.sata.revision = (res & 0x0f0) >> 4; cts.xport_specific.sata.valid = CTS_SATA_VALID_REVISION; + cts.xport_specific.sata.caps = softc->caps & + (CTS_SATA_CAPS_H_PMREQ | CTS_SATA_CAPS_H_DMAAA); + cts.xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; xpt_action((union ccb *)&cts); xpt_free_path(dpath); } Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Sun May 2 11:36:27 2010 (r207498) +++ head/sys/cam/ata/ata_xpt.c Sun May 2 12:07:47 2010 (r207499) @@ -88,6 +88,9 @@ typedef enum { PROBE_IDENTIFY, PROBE_SPINUP, PROBE_SETMODE, + PROBE_SETPM, + PROBE_SETAPST, + PROBE_SETDMAAA, PROBE_SET_MULTI, PROBE_INQUIRY, PROBE_FULL_INQUIRY, @@ -101,6 +104,9 @@ static char *probe_action_text[] = { "PROBE_IDENTIFY", "PROBE_SPINUP", "PROBE_SETMODE", + "PROBE_SETPM", + "PROBE_SETAPST", + "PROBE_SETDMAAA", "PROBE_SET_MULTI", "PROBE_INQUIRY", "PROBE_FULL_INQUIRY", @@ -132,6 +138,7 @@ typedef struct { uint32_t pm_prv; int restart; int spinup; + u_int caps; struct cam_periph *periph; } probe_softc; @@ -393,6 +400,45 @@ negotiate: ata_28bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode); break; } + case PROBE_SETPM: + cam_fill_ataio(ataio, + 1, + probedone, + CAM_DIR_NONE, + 0, + NULL, + 0, + 30*1000); + ata_28bit_cmd(ataio, ATA_SETFEATURES, + (softc->caps & CTS_SATA_CAPS_H_PMREQ) ? 0x10 : 0x90, + 0, 0x03); + break; + case PROBE_SETAPST: + cam_fill_ataio(ataio, + 1, + probedone, + CAM_DIR_NONE, + 0, + NULL, + 0, + 30*1000); + ata_28bit_cmd(ataio, ATA_SETFEATURES, + (softc->caps & CTS_SATA_CAPS_H_APST) ? 0x10 : 0x90, + 0, 0x07); + break; + case PROBE_SETDMAAA: + cam_fill_ataio(ataio, + 1, + probedone, + CAM_DIR_NONE, + 0, + NULL, + 0, + 30*1000); + ata_28bit_cmd(ataio, ATA_SETFEATURES, + (softc->caps & CTS_SATA_CAPS_H_DMAAA) ? 0x10 : 0x90, + 0, 0x02); + break; case PROBE_SET_MULTI: { u_int sectors, bytecount; @@ -685,6 +731,7 @@ probedone(struct cam_periph *periph, uni probe_softc *softc; struct cam_path *path; u_int32_t priority; + u_int caps; int found = 1; CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probedone\n")); @@ -879,6 +926,67 @@ noerror: xpt_schedule(periph, priority); return; case PROBE_SETMODE: + if (path->device->transport != XPORT_SATA) + goto notsata; + /* Set supported bits. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + xpt_action((union ccb *)&cts); + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + caps = cts.xport_specific.sata.caps & CTS_SATA_CAPS_H; + else + caps = 0; + if (ident_buf->satacapabilities != 0xffff) { + if (ident_buf->satacapabilities & ATA_SUPPORT_IFPWRMNGTRCV) + caps |= CTS_SATA_CAPS_D_PMREQ; + if (ident_buf->satacapabilities & ATA_SUPPORT_HAPST) + caps |= CTS_SATA_CAPS_D_APST; + } + /* Mask unwanted bits. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_USER_SETTINGS; + xpt_action((union ccb *)&cts); + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + caps &= cts.xport_specific.sata.caps; + /* Store result to SIM. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + cts.xport_specific.sata.caps = caps; + cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS; + xpt_action((union ccb *)&cts); + softc->caps = caps; + if (ident_buf->satasupport & ATA_SUPPORT_IFPWRMNGT) { + PROBE_SET_ACTION(softc, PROBE_SETPM); + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + } + /* FALLTHROUGH */ + case PROBE_SETPM: + if (ident_buf->satacapabilities != 0xffff && + ident_buf->satacapabilities & ATA_SUPPORT_DAPST) { + PROBE_SET_ACTION(softc, PROBE_SETAPST); + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + } + /* FALLTHROUGH */ + case PROBE_SETAPST: + if (ident_buf->satasupport & ATA_SUPPORT_AUTOACTIVATE) { + PROBE_SET_ACTION(softc, PROBE_SETDMAAA); + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + } + /* FALLTHROUGH */ + case PROBE_SETDMAAA: +notsata: if (path->device->protocol == PROTO_ATA) { PROBE_SET_ACTION(softc, PROBE_SET_MULTI); } else { @@ -964,6 +1072,35 @@ noerror: snprintf(ident_buf->revision, sizeof(ident_buf->revision), "%04x", softc->pm_prv); path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; + /* Set supported bits. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + xpt_action((union ccb *)&cts); + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + caps = cts.xport_specific.sata.caps & CTS_SATA_CAPS_H; + else + caps = 0; + /* All PMPs must support PM requests. */ + caps |= CTS_SATA_CAPS_D_PMREQ; + /* Mask unwanted bits. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_USER_SETTINGS; + xpt_action((union ccb *)&cts); + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + caps &= cts.xport_specific.sata.caps; + /* Store result to SIM. */ + bzero(&cts, sizeof(cts)); + xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); + cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + cts.xport_specific.sata.caps = caps; + cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS; + xpt_action((union ccb *)&cts); + softc->caps = caps; if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; xpt_acquire_device(path->device); Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Sun May 2 11:36:27 2010 (r207498) +++ head/sys/cam/cam_ccb.h Sun May 2 12:07:47 2010 (r207499) @@ -837,12 +837,21 @@ struct ccb_trans_settings_sata { #define CTS_SATA_VALID_PM 0x08 #define CTS_SATA_VALID_TAGS 0x10 #define CTS_SATA_VALID_ATAPI 0x20 +#define CTS_SATA_VALID_CAPS 0x40 int mode; /* Legacy PATA mode */ u_int bytecount; /* Length of PIO transaction */ int revision; /* SATA revision */ u_int pm_present; /* PM is present (XPT->SIM) */ u_int tags; /* Number of allowed tags */ u_int atapi; /* Length of ATAPI CDB */ + u_int caps; /* Device and host SATA caps. */ +#define CTS_SATA_CAPS_H 0x0000ffff +#define CTS_SATA_CAPS_H_PMREQ 0x00000001 +#define CTS_SATA_CAPS_H_APST 0x00000002 +#define CTS_SATA_CAPS_H_DMAAA 0x00000010 /* Auto-activation */ +#define CTS_SATA_CAPS_D 0xffff0000 +#define CTS_SATA_CAPS_D_PMREQ 0x00010000 +#define CTS_SATA_CAPS_D_APST 0x00020000 }; /* Get/Set transfer rate/width/disconnection/tag queueing settings */ Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun May 2 11:36:27 2010 (r207498) +++ head/sys/dev/ahci/ahci.c Sun May 2 12:07:47 2010 (r207499) @@ -111,6 +111,7 @@ static struct { #define AHCI_Q_EDGEIS 64 #define AHCI_Q_SATA2 128 #define AHCI_Q_NOBSYRES 256 +#define AHCI_Q_NOAA 512 } ahci_ids[] = { {0x43801002, 0x00, "ATI IXP600", 0}, {0x43901002, 0x00, "ATI IXP700", 0}, @@ -167,75 +168,75 @@ static struct { {0x614511ab, 0x00, "Marvell 88SX6145", AHCI_Q_NOFORCE|AHCI_Q_4CH|AHCI_Q_EDGEIS}, {0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_NOBSYRES}, {0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_SATA2|AHCI_Q_NOBSYRES}, - {0x044c10de, 0x00, "NVIDIA MCP65", 0}, - {0x044d10de, 0x00, "NVIDIA MCP65", 0}, - {0x044e10de, 0x00, "NVIDIA MCP65", 0}, - {0x044f10de, 0x00, "NVIDIA MCP65", 0}, - {0x045c10de, 0x00, "NVIDIA MCP65", 0}, - {0x045d10de, 0x00, "NVIDIA MCP65", 0}, - {0x045e10de, 0x00, "NVIDIA MCP65", 0}, - {0x045f10de, 0x00, "NVIDIA MCP65", 0}, - {0x055010de, 0x00, "NVIDIA MCP67", 0}, - {0x055110de, 0x00, "NVIDIA MCP67", 0}, - {0x055210de, 0x00, "NVIDIA MCP67", 0}, - {0x055310de, 0x00, "NVIDIA MCP67", 0}, - {0x055410de, 0x00, "NVIDIA MCP67", 0}, - {0x055510de, 0x00, "NVIDIA MCP67", 0}, - {0x055610de, 0x00, "NVIDIA MCP67", 0}, - {0x055710de, 0x00, "NVIDIA MCP67", 0}, - {0x055810de, 0x00, "NVIDIA MCP67", 0}, - {0x055910de, 0x00, "NVIDIA MCP67", 0}, - {0x055A10de, 0x00, "NVIDIA MCP67", 0}, - {0x055B10de, 0x00, "NVIDIA MCP67", 0}, - {0x058410de, 0x00, "NVIDIA MCP67", 0}, - {0x07f010de, 0x00, "NVIDIA MCP73", 0}, - {0x07f110de, 0x00, "NVIDIA MCP73", 0}, - {0x07f210de, 0x00, "NVIDIA MCP73", 0}, - {0x07f310de, 0x00, "NVIDIA MCP73", 0}, - {0x07f410de, 0x00, "NVIDIA MCP73", 0}, - {0x07f510de, 0x00, "NVIDIA MCP73", 0}, - {0x07f610de, 0x00, "NVIDIA MCP73", 0}, - {0x07f710de, 0x00, "NVIDIA MCP73", 0}, - {0x07f810de, 0x00, "NVIDIA MCP73", 0}, - {0x07f910de, 0x00, "NVIDIA MCP73", 0}, - {0x07fa10de, 0x00, "NVIDIA MCP73", 0}, - {0x07fb10de, 0x00, "NVIDIA MCP73", 0}, - {0x0ad010de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad110de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad210de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad310de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad410de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad510de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad610de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad710de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad810de, 0x00, "NVIDIA MCP77", 0}, - {0x0ad910de, 0x00, "NVIDIA MCP77", 0}, - {0x0ada10de, 0x00, "NVIDIA MCP77", 0}, - {0x0adb10de, 0x00, "NVIDIA MCP77", 0}, - {0x0ab410de, 0x00, "NVIDIA MCP79", 0}, - {0x0ab510de, 0x00, "NVIDIA MCP79", 0}, - {0x0ab610de, 0x00, "NVIDIA MCP79", 0}, - {0x0ab710de, 0x00, "NVIDIA MCP79", 0}, - {0x0ab810de, 0x00, "NVIDIA MCP79", 0}, - {0x0ab910de, 0x00, "NVIDIA MCP79", 0}, - {0x0aba10de, 0x00, "NVIDIA MCP79", 0}, - {0x0abb10de, 0x00, "NVIDIA MCP79", 0}, - {0x0abc10de, 0x00, "NVIDIA MCP79", 0}, - {0x0abd10de, 0x00, "NVIDIA MCP79", 0}, - {0x0abe10de, 0x00, "NVIDIA MCP79", 0}, - {0x0abf10de, 0x00, "NVIDIA MCP79", 0}, - {0x0d8410de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8510de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8610de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8710de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8810de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8910de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8a10de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8b10de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8c10de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8d10de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8e10de, 0x00, "NVIDIA MCP89", 0}, - {0x0d8f10de, 0x00, "NVIDIA MCP89", 0}, + {0x044c10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x044d10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x044e10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x044f10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x045c10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x045d10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x045e10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x045f10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, + {0x055010de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055110de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055210de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055310de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055410de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055510de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055610de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055710de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055810de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055910de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055A10de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x055B10de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x058410de, 0x00, "NVIDIA MCP67", AHCI_Q_NOAA}, + {0x07f010de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f110de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f210de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f310de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f410de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f510de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f610de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f710de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f810de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07f910de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07fa10de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x07fb10de, 0x00, "NVIDIA MCP73", AHCI_Q_NOAA}, + {0x0ad010de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad110de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad210de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad310de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad410de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad510de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad610de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad710de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad810de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ad910de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ada10de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0adb10de, 0x00, "NVIDIA MCP77", AHCI_Q_NOAA}, + {0x0ab410de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0ab510de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0ab610de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0ab710de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0ab810de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0ab910de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0aba10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0abb10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0abc10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0abd10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0abe10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0abf10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, + {0x0d8410de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8510de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8610de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8710de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8810de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8910de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8a10de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8b10de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8c10de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8d10de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8e10de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8f10de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, {0x33491106, 0x00, "VIA VT8251", 0}, {0x62871106, 0x00, "VIA VT8251", 0}, {0x11841039, 0x00, "SiS 966", 0}, @@ -860,7 +861,14 @@ ahci_ch_attach(device_t dev) ch->user[i].mode = 0; ch->user[i].bytecount = 8192; ch->user[i].tags = ch->numslots; + ch->user[i].caps = 0; ch->curr[i] = ch->user[i]; + if (ch->pm_level) { + ch->user[i].caps = CTS_SATA_CAPS_H_PMREQ | + CTS_SATA_CAPS_H_APST | + CTS_SATA_CAPS_D_PMREQ | CTS_SATA_CAPS_D_APST; + } + ch->user[i].caps |= CTS_SATA_CAPS_H_DMAAA; } rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -1960,7 +1968,8 @@ ahci_end_transaction(struct ahci_slot *s et != AHCI_ERR_TIMEOUT) ahci_rearm_timeout(dev); /* Start PM timer. */ - if (ch->numrslots == 0 && ch->pm_level > 3) { + if (ch->numrslots == 0 && ch->pm_level > 3 && + (ch->curr[ch->pm_present ? 15 : 0].caps & CTS_SATA_CAPS_D_PMREQ)) { callout_schedule(&ch->pm_timer, (ch->pm_level == 4) ? hz / 1000 : hz / 8); } @@ -2464,6 +2473,8 @@ ahciaction(struct cam_sim *sim, union cc ch->pm_present = cts->xport_specific.sata.pm_present; if (cts->xport_specific.sata.valid & CTS_SATA_VALID_ATAPI) d->atapi = cts->xport_specific.sata.atapi; + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + d->caps = cts->xport_specific.sata.caps; ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -2496,9 +2507,24 @@ ahciaction(struct cam_sim *sim, union cc cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; } + cts->xport_specific.sata.caps = d->caps & CTS_SATA_CAPS_D; + if (ch->pm_level) { + if (ch->caps & (AHCI_CAP_PSC | AHCI_CAP_SSC)) + cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_PMREQ; + if (ch->caps2 & AHCI_CAP2_APST) + cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_APST; + } + if ((ch->caps & AHCI_CAP_SNCQ) && + (ch->quirks & AHCI_Q_NOAA) == 0) + cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_DMAAA; + cts->xport_specific.sata.caps &= + ch->user[ccb->ccb_h.target_id].caps; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } else { cts->xport_specific.sata.revision = d->revision; cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; + cts->xport_specific.sata.caps = d->caps; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } cts->xport_specific.sata.mode = d->mode; cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE; Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Sun May 2 11:36:27 2010 (r207498) +++ head/sys/dev/ahci/ahci.h Sun May 2 12:07:47 2010 (r207499) @@ -372,6 +372,7 @@ struct ahci_device { u_int bytecount; u_int atapi; u_int tags; + u_int caps; }; /* structure describing an ATA channel */ Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Sun May 2 11:36:27 2010 (r207498) +++ head/sys/dev/siis/siis.c Sun May 2 12:07:47 2010 (r207499) @@ -448,6 +448,8 @@ siis_ch_attach(device_t dev) ch->user[i].bytecount = 8192; ch->user[i].tags = SIIS_MAX_SLOTS; ch->curr[i] = ch->user[i]; + if (ch->pm_level) + ch->user[i].caps = CTS_SATA_CAPS_H_PMREQ; } mtx_init(&ch->mtx, "SIIS channel lock", NULL, MTX_DEF); rid = ch->unit; @@ -1697,6 +1699,8 @@ siisaction(struct cam_sim *sim, union cc } if (cts->xport_specific.sata.valid & CTS_SATA_VALID_TAGS) d->atapi = cts->xport_specific.sata.atapi; + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + d->caps = cts->xport_specific.sata.caps; ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -1729,9 +1733,17 @@ siisaction(struct cam_sim *sim, union cc cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; } + cts->xport_specific.sata.caps = d->caps & CTS_SATA_CAPS_D; + if (ch->pm_level) + cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_PMREQ; + cts->xport_specific.sata.caps &= + ch->user[ccb->ccb_h.target_id].caps; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } else { cts->xport_specific.sata.revision = d->revision; cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; + cts->xport_specific.sata.caps = d->caps; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } cts->xport_specific.sata.mode = d->mode; cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE; Modified: head/sys/dev/siis/siis.h ============================================================================== --- head/sys/dev/siis/siis.h Sun May 2 11:36:27 2010 (r207498) +++ head/sys/dev/siis/siis.h Sun May 2 12:07:47 2010 (r207499) @@ -358,6 +358,7 @@ struct siis_device { u_int bytecount; u_int atapi; u_int tags; + u_int caps; }; /* structure describing an ATA channel */ From owner-svn-src-head@FreeBSD.ORG Sun May 2 12:08:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9DAC910657C4; Sun, 2 May 2010 12:08:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8DE388FC12; Sun, 2 May 2010 12:08:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42C8Fm5052687; Sun, 2 May 2010 12:08:15 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42C8FC2052685; Sun, 2 May 2010 12:08:15 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005021208.o42C8FC2052685@svn.freebsd.org> From: Marius Strobl Date: Sun, 2 May 2010 12:08:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207500 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 12:08:15 -0000 Author: marius Date: Sun May 2 12:08:15 2010 New Revision: 207500 URL: http://svn.freebsd.org/changeset/base/207500 Log: Add a hack for SPARC64 V CPUs, which set some undocumented bits in the first data word. Modified: head/sys/sparc64/sparc64/interrupt.S Modified: head/sys/sparc64/sparc64/interrupt.S ============================================================================== --- head/sys/sparc64/sparc64/interrupt.S Sun May 2 12:07:47 2010 (r207499) +++ head/sys/sparc64/sparc64/interrupt.S Sun May 2 12:08:15 2010 (r207500) @@ -83,8 +83,11 @@ ENTRY(intr_vector) * The 2nd word points to code to execute and the 3rd is an argument * to pass. Jump to it. */ - brnz,a,pt %g3, 1f - nop + brnz,pt %g3, 1f + /* + * NB: Zeus CPUs set some undocumented bits in the first data word. + */ + and %g3, IV_MAX - 1, %g3 jmpl %g4, %g0 nop /* NOTREACHED */ From owner-svn-src-head@FreeBSD.ORG Sun May 2 13:48:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C9DCD106566B; Sun, 2 May 2010 13:48:55 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 005FB8FC08; Sun, 2 May 2010 13:48:54 +0000 (UTC) Received: by fxm15 with SMTP id 15so1631223fxm.13 for ; Sun, 02 May 2010 06:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=ftwlmWyDgkr5lrnLX9G5gvrgLnNtHUSRTMNyrmneG6M=; b=e7StRirYPo0IvwQUJVna5hHE7H8YH5MvHt/cuDptC/AvbqKESYzWEF0KBkAnpSO5fP 0szabaFf/nSPi3QRGr2zZf9FlzpA/beQZA+Zc2ISpagARiSnPC7o45X1siUvV3j7FS0F lA8yGrsZF3xOlX0lHnwSm6wDSsUH6NOGmf8sA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=n0v1k/fX8eYxqbINYgDLfBEnsO59qBftLy7MHo91f1EiZsxarIbbPfnH9tCQVaG6a8 QhRvdFAy59U4f7hLWUGgxMWs2TvqS7gKdhj/GGbyEFMLu+suZe7GNO61JFiRhWJO03q1 Kkhiv6UYIN3NGOBPAoj6HDg/7CqSjvvSO/3eQ= MIME-Version: 1.0 Received: by 10.239.190.77 with SMTP id w13mr213090hbh.196.1272808130138; Sun, 02 May 2010 06:48:50 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.239.129.207 with HTTP; Sun, 2 May 2010 06:48:50 -0700 (PDT) In-Reply-To: <20100501151339.GZ2391@deviant.kiev.zoral.com.ua> References: <201005011446.o41EkIa6051907@svn.freebsd.org> <20100501151339.GZ2391@deviant.kiev.zoral.com.ua> Date: Sun, 2 May 2010 15:48:50 +0200 X-Google-Sender-Auth: Y9oHArtPe34prlKszpM9t6M0mjw Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207468 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 13:48:55 -0000 2010/5/1 Kostik Belousov : > On Sat, May 01, 2010 at 04:47:36PM +0200, Attilio Rao wrote: >> 2010/5/1 Konstantin Belousov : >> > Author: kib >> > Date: Sat May =C2=A01 14:46:17 2010 >> > New Revision: 207468 >> > URL: http://svn.freebsd.org/changeset/base/207468 >> > >> > Log: >> > =C2=A0Extract thread_lock()/ruxagg()/thread_unlock() fragment into uti= lity >> > =C2=A0function ruxagg_tlock(). >> > =C2=A0Convert the definition of kern_getrusage() to ANSI C. >> > >> >> I would have preferred a different naming for this, as the well known >> _locked version we have of many functions. > > But this is not the case there, because I did not renamed ruxagg(). > It would be ruxagg()->ruxagg_unlocked() and ruxagg_tlock()->ruxagg(). Yes, this is exactly what I wanted to happen. > My biggest question with the patch is I am not sure whether to apply > the same checks for tu in calctru() as it is done for tu in calcru1(). > Any suggestions ? I think that the checks may be present (the process-scope one is just an aggregate of the threads' one, thus the same conditions apply. > diff --git a/lib/libc/sys/getrusage.2 b/lib/libc/sys/getrusage.2 > index bdf5d45..423503f 100644 > --- a/lib/libc/sys/getrusage.2 > +++ b/lib/libc/sys/getrusage.2 > @@ -28,7 +28,7 @@ > =C2=A0.\" =C2=A0 =C2=A0 @(#)getrusage.2 =C2=A0 =C2=A0 =C2=A0 =C2=A08.1 (B= erkeley) 6/4/93 > =C2=A0.\" $FreeBSD$ > =C2=A0.\" > -.Dd June 4, 1993 > +.Dd May 1, 2010 > =C2=A0.Dt GETRUSAGE 2 > =C2=A0.Os > =C2=A0.Sh NAME > @@ -42,6 +42,7 @@ > =C2=A0.In sys/resource.h > =C2=A0.Fd "#define =C2=A0 RUSAGE_SELF =C2=A0 =C2=A0 =C2=A00" > =C2=A0.Fd "#define =C2=A0 RUSAGE_CHILDREN -1" > +.Fd "#define =C2=A0 RUSAGE_THREAD =C2=A0 1" > =C2=A0.Ft int > =C2=A0.Fn getrusage "int who" "struct rusage *rusage" > =C2=A0.Sh DESCRIPTION > @@ -49,11 +50,12 @@ The > =C2=A0.Fn getrusage > =C2=A0system call > =C2=A0returns information describing the resources utilized by the curren= t > -process, or all its terminated child processes. > +thread, the current process, or all its terminated child processes. > =C2=A0The > =C2=A0.Fa who > =C2=A0argument is either > -.Dv RUSAGE_SELF > +.Dv RUSAGE_THREAD , > +.Dv RUSAGE_SELF , > =C2=A0or > =C2=A0.Dv RUSAGE_CHILDREN . > =C2=A0The buffer to which > @@ -175,6 +177,10 @@ The > =C2=A0.Fn getrusage > =C2=A0system call appeared in > =C2=A0.Bx 4.2 . > +The > +.Dv RUSAGE_THREAD > +facility first appeared in > +.Fx 8.1 . > =C2=A0.Sh BUGS > =C2=A0There is no way to obtain information about a child process > =C2=A0that has not yet terminated. > diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c > index a3ed75d..8e7fdb6 100644 > --- a/sys/kern/kern_resource.c > +++ b/sys/kern/kern_resource.c > @@ -921,6 +921,31 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, str= uct timeval *up, > =C2=A0 =C2=A0 =C2=A0 =C2=A0sp->tv_usec =3D su % 1000000; > =C2=A0} > > +static void > +calctru(struct thread *td) > +{ > + =C2=A0 =C2=A0 =C2=A0 /* {user, system, interrupt, total} {ticks, usec}:= */ > + =C2=A0 =C2=A0 =C2=A0 u_int64_t ut, uu, st, su, it, tt, tu; > + > + =C2=A0 =C2=A0 =C2=A0 tu =3D cputick2usec(td->td_incruntime); > + =C2=A0 =C2=A0 =C2=A0 ut =3D td->td_uticks; > + =C2=A0 =C2=A0 =C2=A0 it =3D td->td_iticks; > + =C2=A0 =C2=A0 =C2=A0 st =3D td->td_sticks; > + > + =C2=A0 =C2=A0 =C2=A0 tt =3D ut + st + it; > + =C2=A0 =C2=A0 =C2=A0 if (tt =3D=3D 0) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Avoid divide by zer= o */ > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 st =3D 1; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tt =3D 1; > + =C2=A0 =C2=A0 =C2=A0 } > + =C2=A0 =C2=A0 =C2=A0 uu =3D td->td_ru.ru_utime.tv_usec + (ut * tu) / tt= ; > + =C2=A0 =C2=A0 =C2=A0 su =3D td->td_ru.ru_stime.tv_usec + (st * tu) / tt= ; > + =C2=A0 =C2=A0 =C2=A0 td->td_ru.ru_utime.tv_sec +=3D uu / 1000000; > + =C2=A0 =C2=A0 =C2=A0 td->td_ru.ru_utime.tv_usec =3D uu % 1000000; > + =C2=A0 =C2=A0 =C2=A0 td->td_ru.ru_stime.tv_sec +=3D su / 1000000; > + =C2=A0 =C2=A0 =C2=A0 td->td_ru.ru_stime.tv_usec =3D su % 1000000; > +} > + > =C2=A0#ifndef _SYS_SYSPROTO_H_ > =C2=A0struct getrusage_args { > =C2=A0 =C2=A0 =C2=A0 =C2=A0int =C2=A0 =C2=A0 who; The comment on the top of calctru() might be removed. > @@ -961,6 +986,13 @@ kern_getrusage(struct thread *td, int who, struct ru= sage *rup) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0calccru(p, &rup->r= u_utime, &rup->ru_stime); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; > > + =C2=A0 =C2=A0 =C2=A0 case RUSAGE_THREAD: > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PROC_SLOCK(p); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ruxagg_tlock(p, td); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PROC_SUNLOCK(p); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *rup =3D td->td_ru; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; > + > =C2=A0 =C2=A0 =C2=A0 =C2=A0default: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error =3D EINVAL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > @@ -1010,6 +1042,12 @@ ruxagg(struct rusage_ext *rux, struct thread *td) > =C2=A0 =C2=A0 =C2=A0 =C2=A0rux->rux_uticks +=3D td->td_uticks; > =C2=A0 =C2=A0 =C2=A0 =C2=A0rux->rux_sticks +=3D td->td_sticks; > =C2=A0 =C2=A0 =C2=A0 =C2=A0rux->rux_iticks +=3D td->td_iticks; > + > + =C2=A0 =C2=A0 =C2=A0 /* > + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Update thread rusage before ticks counters= cleaning. > + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ > + =C2=A0 =C2=A0 =C2=A0 calctru(td); > + > =C2=A0 =C2=A0 =C2=A0 =C2=A0td->td_incruntime =3D 0; > =C2=A0 =C2=A0 =C2=A0 =C2=A0td->td_uticks =3D 0; > =C2=A0 =C2=A0 =C2=A0 =C2=A0td->td_iticks =3D 0; The comment might be single-line and the extra white line after calctru() is not due. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Sun May 2 14:46:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F526106566B; Sun, 2 May 2010 14:46:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 105C68FC12; Sun, 2 May 2010 14:46:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42Ek5MH088718; Sun, 2 May 2010 14:46:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42Ek5jU088716; Sun, 2 May 2010 14:46:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201005021446.o42Ek5jU088716@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 May 2010 14:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207511 - head/sys/dev/ahci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 14:46:06 -0000 Author: mav Date: Sun May 2 14:46:05 2010 New Revision: 207511 URL: http://svn.freebsd.org/changeset/base/207511 Log: Enable PCI busmastering explicitly to be sure. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun May 2 13:53:08 2010 (r207510) +++ head/sys/dev/ahci/ahci.c Sun May 2 14:46:05 2010 (r207511) @@ -340,6 +340,7 @@ ahci_attach(device_t dev) rman_fini(&ctlr->sc_iomem); return (error); } + pci_enable_busmaster(dev); /* Reset controller */ if ((error = ahci_ctlr_reset(dev)) != 0) { bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); From owner-svn-src-head@FreeBSD.ORG Sun May 2 15:52:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 324391065672; Sun, 2 May 2010 15:52:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 8E0CD8FC0C; Sun, 2 May 2010 15:52:48 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o42FqiUd013282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 2 May 2010 18:52:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o42Fqi2o056410; Sun, 2 May 2010 18:52:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o42FqiwI056409; Sun, 2 May 2010 18:52:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 2 May 2010 18:52:44 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20100502155244.GB50864@deviant.kiev.zoral.com.ua> References: <201005011446.o41EkIa6051907@svn.freebsd.org> <20100501151339.GZ2391@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xgyAXRrhYN0wYx8y" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207468 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 15:52:49 -0000 --xgyAXRrhYN0wYx8y Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 02, 2010 at 03:48:50PM +0200, Attilio Rao wrote: > 2010/5/1 Kostik Belousov : > > On Sat, May 01, 2010 at 04:47:36PM +0200, Attilio Rao wrote: > >> 2010/5/1 Konstantin Belousov : > >> > Author: kib > >> > Date: Sat May =9A1 14:46:17 2010 > >> > New Revision: 207468 > >> > URL: http://svn.freebsd.org/changeset/base/207468 > >> > > >> > Log: > >> > =9AExtract thread_lock()/ruxagg()/thread_unlock() fragment into util= ity > >> > =9Afunction ruxagg_tlock(). > >> > =9AConvert the definition of kern_getrusage() to ANSI C. > >> > > >> > >> I would have preferred a different naming for this, as the well known > >> _locked version we have of many functions. > > > > But this is not the case there, because I did not renamed ruxagg(). > > It would be ruxagg()->ruxagg_unlocked() and ruxagg_tlock()->ruxagg(). >=20 > Yes, this is exactly what I wanted to happen. >=20 > > My biggest question with the patch is I am not sure whether to apply > > the same checks for tu in calctru() as it is done for tu in calcru1(). > > Any suggestions ? >=20 > I think that the checks may be present (the process-scope one is just > an aggregate of the threads' one, thus the same conditions apply. Ok, then the easiest way is to rewrite the patch. I removed your comments for previous version since they are no longer relevant. I have to add rusage_ext to struct thread, that would complicate the MFC. And, looking at the whole picture, I do not understand how do we handle the exiting threads. It seems that only user/system runtime is getting collected to the process rusage. The other values, like i/o counters, signals, ctx switches etc are thrown out. diff --git a/lib/libc/sys/getrusage.2 b/lib/libc/sys/getrusage.2 index bdf5d45..423503f 100644 --- a/lib/libc/sys/getrusage.2 +++ b/lib/libc/sys/getrusage.2 @@ -28,7 +28,7 @@ .\" @(#)getrusage.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 1, 2010 .Dt GETRUSAGE 2 .Os .Sh NAME @@ -42,6 +42,7 @@ .In sys/resource.h .Fd "#define RUSAGE_SELF 0" .Fd "#define RUSAGE_CHILDREN -1" +.Fd "#define RUSAGE_THREAD 1" .Ft int .Fn getrusage "int who" "struct rusage *rusage" .Sh DESCRIPTION @@ -49,11 +50,12 @@ The .Fn getrusage system call returns information describing the resources utilized by the current -process, or all its terminated child processes. +thread, the current process, or all its terminated child processes. The .Fa who argument is either -.Dv RUSAGE_SELF +.Dv RUSAGE_THREAD , +.Dv RUSAGE_SELF , or .Dv RUSAGE_CHILDREN . The buffer to which @@ -175,6 +177,10 @@ The .Fn getrusage system call appeared in .Bx 4.2 . +The +.Dv RUSAGE_THREAD +facility first appeared in +.Fx 8.1 . .Sh BUGS There is no way to obtain information about a child process that has not yet terminated. diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index a3ed75d..0bc78d0 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -76,7 +76,7 @@ static void calcru1(struct proc *p, struct rusage_ext *ru= xp, struct timeval *up, struct timeval *sp); static int donice(struct thread *td, struct proc *chgp, int n); static struct uidinfo *uilookup(uid_t uid); -static void ruxagg_tlock(struct proc *p, struct thread *td); +static void ruxagg(struct proc *p, struct thread *td); =20 /* * Resource controls and accounting. @@ -630,7 +630,7 @@ lim_cb(void *arg) return; PROC_SLOCK(p); FOREACH_THREAD_IN_PROC(p, td) { - ruxagg_tlock(p, td); + ruxagg(p, td); } PROC_SUNLOCK(p); if (p->p_rux.rux_runtime > p->p_cpulimit * cpu_tickrate()) { @@ -841,7 +841,7 @@ calcru(struct proc *p, struct timeval *up, struct timev= al *sp) FOREACH_THREAD_IN_PROC(p, td) { if (td->td_incruntime =3D=3D 0) continue; - ruxagg_tlock(p, td); + ruxagg(p, td); } calcru1(p, &p->p_rux, up, sp); } @@ -961,6 +961,16 @@ kern_getrusage(struct thread *td, int who, struct rusa= ge *rup) calccru(p, &rup->ru_utime, &rup->ru_stime); break; =20 + case RUSAGE_THREAD: + PROC_SLOCK(p); + ruxagg(p, td); + PROC_SUNLOCK(p); + thread_lock(td); + *rup =3D td->td_ru; + calcru1(p, &td->td_rux, &rup->ru_utime, &rup->ru_stime); + thread_unlock(td); + break; + default: error =3D EINVAL; } @@ -1001,7 +1011,7 @@ ruadd(struct rusage *ru, struct rusage_ext *rux, stru= ct rusage *ru2, * Aggregate tick counts into the proc's rusage_ext. */ void -ruxagg(struct rusage_ext *rux, struct thread *td) +ruxagg_locked(struct rusage_ext *rux, struct thread *td) { =20 THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -1010,18 +1020,19 @@ ruxagg(struct rusage_ext *rux, struct thread *td) rux->rux_uticks +=3D td->td_uticks; rux->rux_sticks +=3D td->td_sticks; rux->rux_iticks +=3D td->td_iticks; - td->td_incruntime =3D 0; - td->td_uticks =3D 0; - td->td_iticks =3D 0; - td->td_sticks =3D 0; } =20 static void -ruxagg_tlock(struct proc *p, struct thread *td) +ruxagg(struct proc *p, struct thread *td) { =20 thread_lock(td); - ruxagg(&p->p_rux, td); + ruxagg_locked(&p->p_rux, td); + ruxagg_locked(&td->td_rux, td); + td->td_incruntime =3D 0; + td->td_uticks =3D 0; + td->td_iticks =3D 0; + td->td_sticks =3D 0; thread_unlock(td); } =20 @@ -1039,7 +1050,7 @@ rufetch(struct proc *p, struct rusage *ru) *ru =3D p->p_ru; if (p->p_numthreads > 0) { FOREACH_THREAD_IN_PROC(p, td) { - ruxagg_tlock(p, td); + ruxagg(p, td); rucollect(ru, &td->td_ru); } } diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 9be4c2f..b32c584 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -432,7 +432,7 @@ thread_exit(void) PROC_UNLOCK(p); thread_lock(td); /* Save our tick information with both the thread and proc locked */ - ruxagg(&p->p_rux, td); + ruxagg_locked(&p->p_rux, td); PROC_SUNLOCK(p); td->td_state =3D TDS_INACTIVE; #ifdef WITNESS diff --git a/sys/sys/proc.h b/sys/sys/proc.h index fb31cfc..d2ff3df 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -173,6 +173,26 @@ struct kdtrace_thread; struct cpuset; =20 /* + * XXX: Does this belong in resource.h or resourcevar.h instead? + * Resource usage extension. The times in rusage structs in the kernel are + * never up to date. The actual times are kept as runtimes and tick counts + * (with control info in the "previous" times), and are converted when + * userland asks for rusage info. Backwards compatibility prevents putting + * this directly in the user-visible rusage struct. + * + * Locking: (cj) means (j) for p_rux and (c) for p_crux. + */ +struct rusage_ext { + u_int64_t rux_runtime; /* (cj) Real time. */ + u_int64_t rux_uticks; /* (cj) Statclock hits in user mode. */ + u_int64_t rux_sticks; /* (cj) Statclock hits in sys mode. */ + u_int64_t rux_iticks; /* (cj) Statclock hits in intr mode. */ + u_int64_t rux_uu; /* (c) Previous user time in usec. */ + u_int64_t rux_su; /* (c) Previous sys time in usec. */ + u_int64_t rux_tu; /* (c) Previous total time in usec. */ +}; + +/* * Kernel runnable context (thread). * This is what is put to sleep and reactivated. * Thread context. Processes may have multiple threads. @@ -219,7 +239,8 @@ struct thread { u_int td_estcpu; /* (t) estimated cpu utilization */ int td_slptick; /* (t) Time at sleep. */ int td_blktick; /* (t) Time spent blocked. */ - struct rusage td_ru; /* (t) rusage information */ + struct rusage td_ru; /* (t) rusage information. */ + struct rusage_ext td_rux; /* (t) Internal rusage information. */ uint64_t td_incruntime; /* (t) Cpu ticks to transfer to proc. */ uint64_t td_runtime; /* (t) How many cpu ticks we've run. */ u_int td_pticks; /* (t) Statclock hits for profiling */ @@ -426,26 +447,6 @@ do { \ #define TD_SET_CAN_RUN(td) (td)->td_state =3D TDS_CAN_RUN =20 /* - * XXX: Does this belong in resource.h or resourcevar.h instead? - * Resource usage extension. The times in rusage structs in the kernel are - * never up to date. The actual times are kept as runtimes and tick counts - * (with control info in the "previous" times), and are converted when - * userland asks for rusage info. Backwards compatibility prevents putting - * this directly in the user-visible rusage struct. - * - * Locking: (cj) means (j) for p_rux and (c) for p_crux. - */ -struct rusage_ext { - u_int64_t rux_runtime; /* (cj) Real time. */ - u_int64_t rux_uticks; /* (cj) Statclock hits in user mode. */ - u_int64_t rux_sticks; /* (cj) Statclock hits in sys mode. */ - u_int64_t rux_iticks; /* (cj) Statclock hits in intr mode. */ - u_int64_t rux_uu; /* (c) Previous user time in usec. */ - u_int64_t rux_su; /* (c) Previous sys time in usec. */ - u_int64_t rux_tu; /* (c) Previous total time in usec. */ -}; - -/* * Process structure. */ struct proc { diff --git a/sys/sys/resource.h b/sys/sys/resource.h index 9af96af..e703744 100644 --- a/sys/sys/resource.h +++ b/sys/sys/resource.h @@ -56,6 +56,7 @@ =20 #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN -1 +#define RUSAGE_THREAD 1 =20 struct rusage { struct timeval ru_utime; /* user time used */ diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index 21728aa..95a9b49 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -131,7 +131,7 @@ void rucollect(struct rusage *ru, struct rusage *ru2); void rufetch(struct proc *p, struct rusage *ru); void rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up, struct timeval *sp); -void ruxagg(struct rusage_ext *rux, struct thread *td); +void ruxagg_locked(struct rusage_ext *rux, struct thread *td); int suswintr(void *base, int word); struct uidinfo *uifind(uid_t uid); --xgyAXRrhYN0wYx8y Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkvdn8oACgkQC3+MBN1Mb4hJbQCg0sO2vR/sh5TiY5QKuw1h+MZU pU4AoL2eFRvvw3cSKzap4nWcRdt6AMVk =4slr -----END PGP SIGNATURE----- --xgyAXRrhYN0wYx8y-- From owner-svn-src-head@FreeBSD.ORG Sun May 2 16:44:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC281106566B; Sun, 2 May 2010 16:44:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CCCD58FC14; Sun, 2 May 2010 16:44:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42Gi6TB015410; Sun, 2 May 2010 16:44:06 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42Gi6fS015409; Sun, 2 May 2010 16:44:06 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005021644.o42Gi6fS015409@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 16:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207519 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 16:44:07 -0000 Author: alc Date: Sun May 2 16:44:06 2010 New Revision: 207519 URL: http://svn.freebsd.org/changeset/base/207519 Log: This change addresses the race condition that was introduced by the previous revision, r207450, to this file. Specifically, between dropping the page queues lock in vm_contig_launder() and reacquiring it in vm_contig_launder_page(), the page may be removed from the active or inactive queue. It could be wired, freed, cached, etc. None of which vm_contig_launder_page() is prepared for. Reviewed by: kib, kmacy Modified: head/sys/vm/vm_contig.c Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Sun May 2 16:40:18 2010 (r207518) +++ head/sys/vm/vm_contig.c Sun May 2 16:44:06 2010 (r207519) @@ -96,33 +96,33 @@ vm_contig_launder_page(vm_page_t m, vm_p vm_page_t m_tmp; struct vnode *vp; struct mount *mp; - int vfslocked, dirty; + int vfslocked; - vm_page_lock(m); - vm_page_lock_queues(); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); object = m->object; if (!VM_OBJECT_TRYLOCK(object) && !vm_pageout_fallback_object_lock(m, next)) { - VM_OBJECT_UNLOCK(object); - vm_page_unlock_queues(); vm_page_unlock(m); + VM_OBJECT_UNLOCK(object); return (EAGAIN); } if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { VM_OBJECT_UNLOCK(object); + vm_page_lock_queues(); return (EBUSY); } vm_page_test_dirty(m); if (m->dirty == 0 && m->hold_count == 0) pmap_remove_all(m); - if ((dirty = m->dirty) != 0) { - vm_page_unlock_queues(); + if (m->dirty != 0) { vm_page_unlock(m); if ((object->flags & OBJ_DEAD) != 0) { VM_OBJECT_UNLOCK(object); return (EAGAIN); } if (object->type == OBJT_VNODE) { + vm_page_unlock_queues(); vp = object->handle; vm_object_reference_locked(object); VM_OBJECT_UNLOCK(object); @@ -136,19 +136,20 @@ vm_contig_launder_page(vm_page_t m, vm_p VFS_UNLOCK_GIANT(vfslocked); vm_object_deallocate(object); vn_finished_write(mp); + vm_page_lock_queues(); return (0); } else if (object->type == OBJT_SWAP || object->type == OBJT_DEFAULT) { + vm_page_unlock_queues(); m_tmp = m; vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC); VM_OBJECT_UNLOCK(object); + vm_page_lock_queues(); return (0); } - } else if (m->hold_count == 0) - vm_page_cache(m); - - if (dirty == 0) { - vm_page_unlock_queues(); + } else { + if (m->hold_count == 0) + vm_page_cache(m); vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); @@ -167,11 +168,12 @@ vm_contig_launder(int queue) if ((m->flags & PG_MARKER) != 0) continue; + if (!vm_page_trylock(m)) + continue; KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); - vm_page_unlock_queues(); error = vm_contig_launder_page(m, &next); - vm_page_lock_queues(); + vm_page_lock_assert(m, MA_NOTOWNED); if (error == 0) return (TRUE); if (error == EBUSY) From owner-svn-src-head@FreeBSD.ORG Sun May 2 17:33:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0525D106566B; Sun, 2 May 2010 17:33:47 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E92E18FC22; Sun, 2 May 2010 17:33:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42HXkex026825; Sun, 2 May 2010 17:33:46 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42HXkpp026820; Sun, 2 May 2010 17:33:46 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005021733.o42HXkpp026820@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 17:33:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207530 - in head/sys: fs/tmpfs kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 17:33:47 -0000 Author: alc Date: Sun May 2 17:33:46 2010 New Revision: 207530 URL: http://svn.freebsd.org/changeset/base/207530 Log: It makes no sense for vm_page_sleep_if_busy()'s helper, vm_page_sleep(), to unconditionally set PG_REFERENCED on a page before sleeping. In many cases, it's perfectly ok for the page to disappear, i.e., be reclaimed by the page daemon, before the caller to vm_page_sleep() is reawakened. Instead, we now explicitly set PG_REFERENCED in those cases where having the page persist until the caller is awakened is clearly desirable. Note, however, that setting PG_REFERENCED on the page is still only a hint, and not a guarantee that the page should persist. Modified: head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/vfs_bio.c head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun May 2 16:55:13 2010 (r207529) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun May 2 17:33:46 2010 (r207530) @@ -516,8 +516,16 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob lookupvpg: if (((m = vm_page_lookup(vobj, idx)) != NULL) && vm_page_is_valid(m, offset, tlen)) { - if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) + if ((m->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking and sleeping so + * that the page daemon is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + vm_page_sleep(m, "tmfsmr"); goto lookupvpg; + } vm_page_busy(m); VM_OBJECT_UNLOCK(vobj); error = uiomove_fromphys(&m, offset, tlen, uio); @@ -526,8 +534,16 @@ lookupvpg: VM_OBJECT_UNLOCK(vobj); return (error); } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { - if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) + if ((m->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking and sleeping so + * that the page daemon is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + vm_page_sleep(m, "tmfsmr"); goto lookupvpg; + } vm_page_busy(m); VM_OBJECT_UNLOCK(vobj); sched_pin(); @@ -627,8 +643,16 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o lookupvpg: if (((vpg = vm_page_lookup(vobj, idx)) != NULL) && vm_page_is_valid(vpg, offset, tlen)) { - if (vm_page_sleep_if_busy(vpg, FALSE, "tmfsmw")) + if ((vpg->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking and sleeping so + * that the page daemon is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(vpg, PG_REFERENCED); + vm_page_sleep(vpg, "tmfsmw"); goto lookupvpg; + } vm_page_busy(vpg); vm_page_lock_queues(); vm_page_undirty(vpg); Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun May 2 16:55:13 2010 (r207529) +++ head/sys/kern/vfs_bio.c Sun May 2 17:33:46 2010 (r207530) @@ -3024,8 +3024,17 @@ allocbuf(struct buf *bp, int size) * vm_fault->getpages->cluster_read->allocbuf * */ - if (vm_page_sleep_if_busy(m, FALSE, "pgtblk")) + if ((m->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking + * and sleeping so that the page daemon + * is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + vm_page_sleep(m, "pgtblk"); continue; + } /* * We have a good page. Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun May 2 16:55:13 2010 (r207529) +++ head/sys/vm/vm_fault.c Sun May 2 17:33:46 2010 (r207530) @@ -338,6 +338,12 @@ RetryFault:; * to pmap it. */ if ((fs.m->oflags & VPO_BUSY) || fs.m->busy) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_flag_set(fs.m, PG_REFERENCED); vm_page_unlock_queues(); vm_page_unlock(fs.m); VM_OBJECT_UNLOCK(fs.object); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun May 2 16:55:13 2010 (r207529) +++ head/sys/vm/vm_page.c Sun May 2 17:33:46 2010 (r207530) @@ -599,7 +599,7 @@ vm_page_free_zero(vm_page_t m) /* * vm_page_sleep: * - * Sleep and release the page queues lock. + * Sleep and release the page and page queues locks. * * The object containing the given page must be locked. */ @@ -608,13 +608,10 @@ vm_page_sleep(vm_page_t m, const char *m { VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); - if (!mtx_owned(vm_page_lockptr(m))) - vm_page_lock(m); - if (!mtx_owned(&vm_page_queue_mtx)) - vm_page_lock_queues(); - vm_page_flag_set(m, PG_REFERENCED); - vm_page_unlock_queues(); - vm_page_unlock(m); + if (mtx_owned(&vm_page_queue_mtx)) + vm_page_unlock_queues(); + if (mtx_owned(vm_page_lockptr(m))) + vm_page_unlock(m); /* * It's possible that while we sleep, the page will get @@ -1896,7 +1893,17 @@ vm_page_grab(vm_object_t object, vm_pind VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); retrylookup: if ((m = vm_page_lookup(object, pindex)) != NULL) { - if (vm_page_sleep_if_busy(m, TRUE, "pgrbwt")) { + if ((m->oflags & VPO_BUSY) != 0 || m->busy != 0) { + if ((allocflags & VM_ALLOC_RETRY) != 0) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + } + vm_page_sleep(m, "pgrbwt"); if ((allocflags & VM_ALLOC_RETRY) == 0) return (NULL); goto retrylookup; From owner-svn-src-head@FreeBSD.ORG Sun May 2 18:09:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3C244106566B; Sun, 2 May 2010 18:09:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2CD158FC08; Sun, 2 May 2010 18:09:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42I9YNi034616; Sun, 2 May 2010 18:09:34 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42I9YEe034614; Sun, 2 May 2010 18:09:34 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005021809.o42I9YEe034614@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 18:09:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207531 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 18:09:34 -0000 Author: alc Date: Sun May 2 18:09:33 2010 New Revision: 207531 URL: http://svn.freebsd.org/changeset/base/207531 Log: Correct an error in r207410: Remove an unlock of a lock that is no longer held. Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun May 2 17:33:46 2010 (r207530) +++ head/sys/vm/vm_object.c Sun May 2 18:09:33 2010 (r207531) @@ -1454,7 +1454,6 @@ retry: * not be changed by this operation. */ if ((m->oflags & VPO_BUSY) || m->busy) { - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(new_object); m->oflags |= VPO_WANTED; msleep(m, VM_OBJECT_MTX(orig_object), PVM, "spltwt", 0); From owner-svn-src-head@FreeBSD.ORG Sun May 2 19:05:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1573C106566B; Sun, 2 May 2010 19:05:58 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E0A8D8FC18; Sun, 2 May 2010 19:05:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42J5vGU046984; Sun, 2 May 2010 19:05:57 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42J5veA046982; Sun, 2 May 2010 19:05:57 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005021905.o42J5veA046982@svn.freebsd.org> From: Marius Strobl Date: Sun, 2 May 2010 19:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207532 - head/sys/dev/quicc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 19:05:58 -0000 Author: marius Date: Sun May 2 19:05:57 2010 New Revision: 207532 URL: http://svn.freebsd.org/changeset/base/207532 Log: Remove a soft member which was never used. Approved by: marcel Modified: head/sys/dev/quicc/quicc_bfe.h Modified: head/sys/dev/quicc/quicc_bfe.h ============================================================================== --- head/sys/dev/quicc/quicc_bfe.h Sun May 2 18:09:33 2010 (r207531) +++ head/sys/dev/quicc/quicc_bfe.h Sun May 2 19:05:57 2010 (r207532) @@ -50,7 +50,6 @@ struct quicc_softc { u_int sc_clock; int sc_fastintr:1; - int sc_leaving:1; int sc_polled:1; }; From owner-svn-src-head@FreeBSD.ORG Sun May 2 19:07:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8F322106566B; Sun, 2 May 2010 19:07:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 7F2178FC1C; Sun, 2 May 2010 19:07:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42J7J21047314; Sun, 2 May 2010 19:07:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42J7JXq047311; Sun, 2 May 2010 19:07:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005021907.o42J7JXq047311@svn.freebsd.org> From: Marius Strobl Date: Sun, 2 May 2010 19:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207533 - in head/sys: dev/uart mips/cavium X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 19:07:19 -0000 Author: marius Date: Sun May 2 19:07:19 2010 New Revision: 207533 URL: http://svn.freebsd.org/changeset/base/207533 Log: Remove redundant checking of sc_leaving (uart_intr() already handles this). Approved by: marcel Modified: head/sys/dev/uart/uart_dev_ns8250.c head/sys/mips/cavium/uart_dev_oct16550.c Modified: head/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- head/sys/dev/uart/uart_dev_ns8250.c Sun May 2 19:05:57 2010 (r207532) +++ head/sys/dev/uart/uart_dev_ns8250.c Sun May 2 19:07:19 2010 (r207533) @@ -604,7 +604,7 @@ ns8250_bus_ipend(struct uart_softc *sc) if (ipend == 0) ns8250_clrint(bas); uart_unlock(sc->sc_hwmtx); - return ((sc->sc_leaving) ? 0 : ipend); + return (ipend); } static int Modified: head/sys/mips/cavium/uart_dev_oct16550.c ============================================================================== --- head/sys/mips/cavium/uart_dev_oct16550.c Sun May 2 19:05:57 2010 (r207532) +++ head/sys/mips/cavium/uart_dev_oct16550.c Sun May 2 19:07:19 2010 (r207533) @@ -644,12 +644,9 @@ oct16550_bus_ipend(struct uart_softc *sc if (ipend) octeon_led_run_wheel(&where1, 6 + device_get_unit(sc->sc_dev)); #endif - return ((sc->sc_leaving) ? 0 : ipend); + return (ipend); } - - - static int oct16550_bus_param (struct uart_softc *sc, int baudrate, int databits, int stopbits, int parity) From owner-svn-src-head@FreeBSD.ORG Sun May 2 19:10:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E2351065670; Sun, 2 May 2010 19:10:27 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 5EE8F8FC1F; Sun, 2 May 2010 19:10:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42JARdN048038; Sun, 2 May 2010 19:10:27 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42JARhV048036; Sun, 2 May 2010 19:10:27 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005021910.o42JARhV048036@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 19:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207534 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 19:10:27 -0000 Author: alc Date: Sun May 2 19:10:27 2010 New Revision: 207534 URL: http://svn.freebsd.org/changeset/base/207534 Log: Properly synchronize access to the page's hold_count in vfs_vmio_release(). Reviewed by: kib Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun May 2 19:07:19 2010 (r207533) +++ head/sys/kern/vfs_bio.c Sun May 2 19:10:27 2010 (r207534) @@ -1563,7 +1563,6 @@ vfs_vmio_release(struct buf *bp) vm_page_t m; VM_OBJECT_LOCK(bp->b_bufobj->bo_object); - vm_page_lock_queues(); for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; bp->b_pages[i] = NULL; @@ -1571,16 +1570,16 @@ vfs_vmio_release(struct buf *bp) * In order to keep page LRU ordering consistent, put * everything on the inactive queue. */ + vm_page_lock(m); + vm_page_lock_queues(); vm_page_unwire(m, 0); /* * We don't mess with busy pages, it is * the responsibility of the process that * busied the pages to deal with them. */ - if ((m->oflags & VPO_BUSY) || (m->busy != 0)) - continue; - - if (m->wire_count == 0) { + if ((m->oflags & VPO_BUSY) == 0 && m->busy == 0 && + m->wire_count == 0) { /* * Might as well free the page if we can and it has * no valid data. We also free the page if the @@ -1595,8 +1594,9 @@ vfs_vmio_release(struct buf *bp) vm_page_try_to_cache(m); } } + vm_page_unlock_queues(); + vm_page_unlock(m); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); pmap_qremove(trunc_page((vm_offset_t) bp->b_data), bp->b_npages); From owner-svn-src-head@FreeBSD.ORG Sun May 2 19:25:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86866106566B; Sun, 2 May 2010 19:25:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 76E768FC19; Sun, 2 May 2010 19:25:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42JPMVR051329; Sun, 2 May 2010 19:25:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42JPM2L051327; Sun, 2 May 2010 19:25:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005021925.o42JPM2L051327@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 2 May 2010 19:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207535 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 19:25:22 -0000 Author: kib Date: Sun May 2 19:25:22 2010 New Revision: 207535 URL: http://svn.freebsd.org/changeset/base/207535 Log: Lock the page around hold_count access. Reviewed by: alc Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sun May 2 19:10:27 2010 (r207534) +++ head/sys/kern/uipc_syscalls.c Sun May 2 19:25:22 2010 (r207535) @@ -2108,6 +2108,7 @@ retry_space: mbstat.sf_iocnt++; } if (error) { + vm_page_lock(pg); vm_page_lock_queues(); vm_page_unwire(pg, 0); /* @@ -2121,6 +2122,7 @@ retry_space: vm_page_free(pg); } vm_page_unlock_queues(); + vm_page_unlock(pg); VM_OBJECT_UNLOCK(obj); if (error == EAGAIN) error = 0; /* not a real error */ From owner-svn-src-head@FreeBSD.ORG Sun May 2 19:28:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94FEE1065742; Sun, 2 May 2010 19:28:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 81C6E8FC0C; Sun, 2 May 2010 19:28:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42JSVWm052050; Sun, 2 May 2010 19:28:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42JSVoY052041; Sun, 2 May 2010 19:28:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201005021928.o42JSVoY052041@svn.freebsd.org> From: Alexander Motin Date: Sun, 2 May 2010 19:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207536 - in head: share/man/man4 sys/arm/mv sys/conf sys/dev/mvs sys/modules sys/modules/mvs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 19:28:31 -0000 Author: mav Date: Sun May 2 19:28:30 2010 New Revision: 207536 URL: http://svn.freebsd.org/changeset/base/207536 Log: Import mvs(4) - Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA controllers driver for CAM ATA subsystem. This driver supports same hardware as atamarvell, ataadaptec and atamvsata drivers from ata(4), but provides many additional features, such as NCQ, PMP, etc. Added: head/share/man/man4/mvs.4 (contents, props changed) head/sys/dev/mvs/ head/sys/dev/mvs/mvs.c (contents, props changed) head/sys/dev/mvs/mvs.h (contents, props changed) head/sys/dev/mvs/mvs_if.m (contents, props changed) head/sys/dev/mvs/mvs_pci.c (contents, props changed) head/sys/dev/mvs/mvs_soc.c (contents, props changed) head/sys/modules/mvs/ head/sys/modules/mvs/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/arm/mv/files.mv head/sys/conf/NOTES head/sys/conf/files head/sys/conf/kmod.mk head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun May 2 19:25:22 2010 (r207535) +++ head/share/man/man4/Makefile Sun May 2 19:28:30 2010 (r207536) @@ -220,6 +220,7 @@ MAN= aac.4 \ msk.4 \ mtio.4 \ multicast.4 \ + mvs.4 \ mwl.4 \ mwlfw.4 \ mxge.4 \ Added: head/share/man/man4/mvs.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/mvs.4 Sun May 2 19:28:30 2010 (r207536) @@ -0,0 +1,176 @@ +.\" Copyright (c) 2009 Alexander Motin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 27, 2010 +.Dt MVS 4 +.Os +.Sh NAME +.Nm mvs +.Nd Marvell Serial ATA Host Controller driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pci" +.Cd "device scbus" +.Cd "device mvs" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +mvs_load="YES" +.Ed +.Pp +The following tunables are settable from the +.Xr loader 8 : +.Bl -ohang +.It Va hint.mvs. Ns Ar X Ns Va .msi +controls Message Signaled Interrupts (MSI) usage by the specified controller. +.It Va hint.mvs. Ns Ar X Ns Va .ccc +controls Command Completion Coalescing (CCC) usage by the specified controller. +Non-zero value enables CCC and defines maximum time (in us), request can wait +for interrupt. +CCC reduces number of context switches on systems with many parallel requests, +but it can decrease disk performance on some workloads due to additional +command latency. +.It Va hint.mvs. Ns Ar X Ns Va .cccc +defines number of completed commands for CCC, which trigger interrupt without +waiting for specified coalescing timeout. +.It Va hint.mvs. Ns Ar X Ns Va .pm_level +controls SATA interface Power Management for the specified channel, +allowing some power to be saved at the cost of additional command +latency. +Possible values: +.Bl -tag -compact +.It 0 +interface Power Management is disabled (default); +.It 1 +device is allowed to initiate PM state change, host is passive; +.It 4 +driver initiates PARTIAL PM state transition 1ms after port becomes idle; +.It 5 +driver initiates SLUMBER PM state transition 125ms after port becomes idle. +.El +.Pp +Note that interface Power Management is not compatible with +device presence detection. +A manual bus reset is needed on device hot-plug. +.It Va hint.mvs. Ns Ar X Ns Va .sata_rev +setting to nonzero value limits maximum SATA revision (speed). +Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. +.El +.Sh DESCRIPTION +This driver provides the +.Xr CAM 4 +subsystem with native access to the +.Tn SATA +ports of several generations (Gen-I/II/IIe) of Marvell SATA controllers. +Each SATA port found is represented to CAM as a separate bus with one +target, or, if HBA supports Port Multipliers (Gen-II/IIe), 16 targets. +Most of the bus-management details are handled by the SATA-specific +transport of CAM. +Connected ATA disks are handled by the ATA protocol disk peripheral driver +.Xr ada 4 . +ATAPI devices are handled by the SCSI protocol peripheral drivers +.Xr cd 4 , +.Xr da 4 , +.Xr sa 4 , +etc. +.Pp +Driver features include support for Serial ATA and ATAPI devices, +Port Multipliers (including FIS-based switching, when supported), +hardware command queues (up to 31 command per port), +Native Command Queuing, SATA interface Power Management, device hot-plug +and Message Signaled Interrupts. +.Pp +Same hardware is also supported by atamarvell and ataadaptec drivers from +.Xr ata 4 +subsystem. +If both drivers are loaded at the same time, this one will be +given precedence as the more functional of the two. +.Sh HARDWARE +The +.Nm +driver supports the following controllers: +.Bl -tag -compact +.It Gen-I (SATA 1.5Gbps): +.Bl -bullet -compact +.It +88SX5040 +.It +88SX5041 +.It +88SX5080 +.It +88SX5081 +.El +.It Gen-II (SATA 3Gbps, NCQ, PMP): +.Bl -bullet -compact +.It +88SX6040 +.It +88SX6041 (including Adaptec 1420SA) +.It +88SX6080 +.It +88SX6081 +.El +.It Gen-IIe (SATA 3Gbps, NCQ, PMP with FBS): +.Bl -bullet -compact +.It +88SX6042 +.It +88SX7042 (including Adaptec 1430SA) +.It +88F5182 SoC +.It +88F6281 SoC +.It +MV78100 SoC +.El +.El +Note, that this hardware supports command queueing and FIS-based switching +only for ATA DMA commands. ATAPI and non-DMA ATA commands executed one by one +for each port. +.Pp +.Sh SEE ALSO +.Xr ada 4 , +.Xr ata 4 , +.Xr cam 4 , +.Xr cd 4 , +.Xr da 4 , +.Xr sa 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 9.0 . +.Sh AUTHORS +.An Alexander Motin Aq mav@FreeBSD.org . Modified: head/sys/arm/mv/files.mv ============================================================================== --- head/sys/arm/mv/files.mv Sun May 2 19:25:22 2010 (r207535) +++ head/sys/arm/mv/files.mv Sun May 2 19:28:30 2010 (r207536) @@ -30,6 +30,7 @@ arm/mv/timer.c standard arm/mv/twsi.c optional iicbus dev/mge/if_mge.c optional mge +dev/mvs/mvs_soc.c optional mvs dev/uart/uart_bus_mbus.c optional uart dev/uart/uart_cpu_mv.c optional uart dev/uart/uart_dev_ns8250.c optional uart Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun May 2 19:25:22 2010 (r207535) +++ head/sys/conf/NOTES Sun May 2 19:28:30 2010 (r207536) @@ -1660,12 +1660,14 @@ device twe # 3ware ATA RAID # Serial ATA host controllers: # # ahci: Advanced Host Controller Interface (AHCI) compatible +# mvs: Marvell 88SX50XX/88SX60XX/88SX70XX/SoC controllers # siis: SiliconImage SiI3124/SiI3132/SiI3531 controllers # # These drivers are part of cam(4) subsystem. They supersede less featured # ata(4) subsystem drivers, supporting same hardware. device ahci +device mvs device siis # Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun May 2 19:25:22 2010 (r207535) +++ head/sys/conf/files Sun May 2 19:28:30 2010 (r207536) @@ -1293,6 +1293,9 @@ dev/mpt/mpt_pci.c optional mpt pci dev/mpt/mpt_raid.c optional mpt dev/mpt/mpt_user.c optional mpt dev/msk/if_msk.c optional msk inet +dev/mvs/mvs.c optional mvs +dev/mvs/mvs_if.m standard +dev/mvs/mvs_pci.c optional mvs pci dev/mwl/if_mwl.c optional mwl dev/mwl/if_mwl_pci.c optional mwl pci dev/mwl/mwlhal.c optional mwl Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Sun May 2 19:25:22 2010 (r207535) +++ head/sys/conf/kmod.mk Sun May 2 19:28:30 2010 (r207536) @@ -342,7 +342,7 @@ MFILES?= dev/acpica/acpi_if.m dev/acpi_s dev/agp/agp_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \ dev/iicbus/iicbb_if.m dev/iicbus/iicbus_if.m \ dev/mmc/mmcbr_if.m dev/mmc/mmcbus_if.m \ - dev/mii/miibus_if.m dev/ofw/ofw_bus_if.m \ + dev/mii/miibus_if.m dev/mvs/mvs_if.m dev/ofw/ofw_bus_if.m \ dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \ dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ Added: head/sys/dev/mvs/mvs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mvs/mvs.c Sun May 2 19:28:30 2010 (r207536) @@ -0,0 +1,2173 @@ +/*- + * Copyright (c) 2010 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mvs.h" + +#include +#include +#include +#include +#include + +/* local prototypes */ +static int mvs_ch_suspend(device_t dev); +static int mvs_ch_resume(device_t dev); +static void mvs_dmainit(device_t dev); +static void mvs_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); +static void mvs_dmafini(device_t dev); +static void mvs_slotsalloc(device_t dev); +static void mvs_slotsfree(device_t dev); +static void mvs_setup_edma_queues(device_t dev); +static void mvs_set_edma_mode(device_t dev, enum mvs_edma_mode mode); +static void mvs_ch_pm(void *arg); +static void mvs_ch_intr_locked(void *data); +static void mvs_ch_intr(void *data); +static void mvs_reset(device_t dev); +static void mvs_softreset(device_t dev, union ccb *ccb); + +static int mvs_sata_connect(struct mvs_channel *ch); +static int mvs_sata_phy_reset(device_t dev); +static int mvs_wait(device_t dev, u_int s, u_int c, int t); +static void mvs_tfd_read(device_t dev, union ccb *ccb); +static void mvs_tfd_write(device_t dev, union ccb *ccb); +static void mvs_legacy_intr(device_t dev); +static void mvs_crbq_intr(device_t dev); +static void mvs_begin_transaction(device_t dev, union ccb *ccb); +static void mvs_legacy_execute_transaction(struct mvs_slot *slot); +static void mvs_timeout(struct mvs_slot *slot); +static void mvs_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); +static void mvs_requeue_frozen(device_t dev); +static void mvs_execute_transaction(struct mvs_slot *slot); +static void mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et); + +static void mvs_issue_read_log(device_t dev); +static void mvs_process_read_log(device_t dev, union ccb *ccb); + +static void mvsaction(struct cam_sim *sim, union ccb *ccb); +static void mvspoll(struct cam_sim *sim); + +MALLOC_DEFINE(M_MVS, "MVS driver", "MVS driver data buffers"); + +static int +mvs_ch_probe(device_t dev) +{ + + device_set_desc_copy(dev, "Marvell SATA channel"); + return (0); +} + +static int +mvs_ch_attach(device_t dev) +{ + struct mvs_controller *ctlr = device_get_softc(device_get_parent(dev)); + struct mvs_channel *ch = device_get_softc(dev); + struct cam_devq *devq; + int rid, error, i, sata_rev = 0; + + ch->dev = dev; + ch->unit = (intptr_t)device_get_ivars(dev); + ch->quirks = ctlr->quirks; + mtx_init(&ch->mtx, "MVS channel lock", NULL, MTX_DEF); + resource_int_value(device_get_name(dev), + device_get_unit(dev), "pm_level", &ch->pm_level); + if (ch->pm_level > 3) + callout_init_mtx(&ch->pm_timer, &ch->mtx, 0); + resource_int_value(device_get_name(dev), + device_get_unit(dev), "sata_rev", &sata_rev); + for (i = 0; i < 16; i++) { + ch->user[i].revision = sata_rev; + ch->user[i].mode = 0; + ch->user[i].bytecount = (ch->quirks & MVS_Q_GENIIE) ? 8192 : 2048; + ch->user[i].tags = MVS_MAX_SLOTS; + ch->curr[i] = ch->user[i]; + if (ch->pm_level) { + ch->user[i].caps = CTS_SATA_CAPS_H_PMREQ | + CTS_SATA_CAPS_H_APST | + CTS_SATA_CAPS_D_PMREQ | CTS_SATA_CAPS_D_APST; + } + } + rid = ch->unit; + if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE))) + return (ENXIO); + mvs_dmainit(dev); + mvs_slotsalloc(dev); + mvs_ch_resume(dev); + mtx_lock(&ch->mtx); + rid = ATA_IRQ_RID; + if (!(ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &rid, RF_SHAREABLE | RF_ACTIVE))) { + device_printf(dev, "Unable to map interrupt\n"); + error = ENXIO; + goto err0; + } + if ((bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL, + mvs_ch_intr_locked, dev, &ch->ih))) { + device_printf(dev, "Unable to setup interrupt\n"); + error = ENXIO; + goto err1; + } + /* Create the device queue for our SIM. */ + devq = cam_simq_alloc(MVS_MAX_SLOTS - 1); + if (devq == NULL) { + device_printf(dev, "Unable to allocate simq\n"); + error = ENOMEM; + goto err1; + } + /* Construct SIM entry */ + ch->sim = cam_sim_alloc(mvsaction, mvspoll, "mvsch", ch, + device_get_unit(dev), &ch->mtx, + 2, (ch->quirks & MVS_Q_GENI) ? 0 : MVS_MAX_SLOTS - 1, + devq); + if (ch->sim == NULL) { + cam_simq_free(devq); + device_printf(dev, "unable to allocate sim\n"); + error = ENOMEM; + goto err1; + } + if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) { + device_printf(dev, "unable to register xpt bus\n"); + error = ENXIO; + goto err2; + } + if (xpt_create_path(&ch->path, /*periph*/NULL, cam_sim_path(ch->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + device_printf(dev, "unable to create path\n"); + error = ENXIO; + goto err3; + } + if (ch->pm_level > 3) { + callout_reset(&ch->pm_timer, + (ch->pm_level == 4) ? hz / 1000 : hz / 8, + mvs_ch_pm, dev); + } + mtx_unlock(&ch->mtx); + return (0); + +err3: + xpt_bus_deregister(cam_sim_path(ch->sim)); +err2: + cam_sim_free(ch->sim, /*free_devq*/TRUE); +err1: + bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); +err0: + bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); + mtx_unlock(&ch->mtx); + mtx_destroy(&ch->mtx); + return (error); +} + +static int +mvs_ch_detach(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + + mtx_lock(&ch->mtx); + xpt_async(AC_LOST_DEVICE, ch->path, NULL); + xpt_free_path(ch->path); + xpt_bus_deregister(cam_sim_path(ch->sim)); + cam_sim_free(ch->sim, /*free_devq*/TRUE); + mtx_unlock(&ch->mtx); + + if (ch->pm_level > 3) + callout_drain(&ch->pm_timer); + bus_teardown_intr(dev, ch->r_irq, ch->ih); + bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); + + mvs_ch_suspend(dev); + mvs_slotsfree(dev); + mvs_dmafini(dev); + + bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); + mtx_destroy(&ch->mtx); + return (0); +} + +static int +mvs_ch_suspend(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + + /* Stop EDMA */ + mvs_set_edma_mode(dev, MVS_EDMA_OFF); + /* Disable port interrupts. */ + ATA_OUTL(ch->r_mem, EDMA_IEM, 0); + return (0); +} + +static int +mvs_ch_resume(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + uint32_t reg; + + /* Disable port interrupts */ + ATA_OUTL(ch->r_mem, EDMA_IEM, 0); + /* Stop EDMA */ + ch->curr_mode = MVS_EDMA_UNKNOWN; + mvs_set_edma_mode(dev, MVS_EDMA_OFF); + /* Clear and configure FIS interrupts. */ + ATA_OUTL(ch->r_mem, SATA_FISIC, 0); + reg = ATA_INL(ch->r_mem, SATA_FISC); + reg |= SATA_FISC_FISWAIT4HOSTRDYEN_B1; + ATA_OUTL(ch->r_mem, SATA_FISC, reg); + reg = ATA_INL(ch->r_mem, SATA_FISIM); + reg |= SATA_FISC_FISWAIT4HOSTRDYEN_B1; + ATA_OUTL(ch->r_mem, SATA_FISC, reg); + /* Clear SATA error register. */ + ATA_OUTL(ch->r_mem, SATA_SE, 0xffffffff); + /* Clear any outstanding error interrupts. */ + ATA_OUTL(ch->r_mem, EDMA_IEC, 0); + /* Unmask all error interrupts */ + ATA_OUTL(ch->r_mem, EDMA_IEM, ~EDMA_IE_TRANSIENT); + return (0); +} + +struct mvs_dc_cb_args { + bus_addr_t maddr; + int error; +}; + +static void +mvs_dmainit(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + struct mvs_dc_cb_args dcba; + + /* EDMA command request area. */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), 1024, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, MVS_WORKRQ_SIZE, 1, MVS_WORKRQ_SIZE, + 0, NULL, NULL, &ch->dma.workrq_tag)) + goto error; + if (bus_dmamem_alloc(ch->dma.workrq_tag, (void **)&ch->dma.workrq, 0, + &ch->dma.workrq_map)) + goto error; + if (bus_dmamap_load(ch->dma.workrq_tag, ch->dma.workrq_map, ch->dma.workrq, + MVS_WORKRQ_SIZE, mvs_dmasetupc_cb, &dcba, 0) || dcba.error) { + bus_dmamem_free(ch->dma.workrq_tag, ch->dma.workrq, ch->dma.workrq_map); + goto error; + } + ch->dma.workrq_bus = dcba.maddr; + /* EDMA command response area. */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), 256, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, MVS_WORKRP_SIZE, 1, MVS_WORKRP_SIZE, + 0, NULL, NULL, &ch->dma.workrp_tag)) + goto error; + if (bus_dmamem_alloc(ch->dma.workrp_tag, (void **)&ch->dma.workrp, 0, + &ch->dma.workrp_map)) + goto error; + if (bus_dmamap_load(ch->dma.workrp_tag, ch->dma.workrp_map, ch->dma.workrp, + MVS_WORKRP_SIZE, mvs_dmasetupc_cb, &dcba, 0) || dcba.error) { + bus_dmamem_free(ch->dma.workrp_tag, ch->dma.workrp, ch->dma.workrp_map); + goto error; + } + ch->dma.workrp_bus = dcba.maddr; + /* Data area. */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), 2, MVS_EPRD_MAX, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, + MVS_SG_ENTRIES * PAGE_SIZE * MVS_MAX_SLOTS, + MVS_SG_ENTRIES, MVS_EPRD_MAX, + 0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag)) { + goto error; + } + return; + +error: + device_printf(dev, "WARNING - DMA initialization failed\n"); + mvs_dmafini(dev); +} + +static void +mvs_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct mvs_dc_cb_args *dcba = (struct mvs_dc_cb_args *)xsc; + + if (!(dcba->error = error)) + dcba->maddr = segs[0].ds_addr; +} + +static void +mvs_dmafini(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + + if (ch->dma.data_tag) { + bus_dma_tag_destroy(ch->dma.data_tag); + ch->dma.data_tag = NULL; + } + if (ch->dma.workrp_bus) { + bus_dmamap_unload(ch->dma.workrp_tag, ch->dma.workrp_map); + bus_dmamem_free(ch->dma.workrp_tag, ch->dma.workrp, ch->dma.workrp_map); + ch->dma.workrp_bus = 0; + ch->dma.workrp_map = NULL; + ch->dma.workrp = NULL; + } + if (ch->dma.workrp_tag) { + bus_dma_tag_destroy(ch->dma.workrp_tag); + ch->dma.workrp_tag = NULL; + } + if (ch->dma.workrq_bus) { + bus_dmamap_unload(ch->dma.workrq_tag, ch->dma.workrq_map); + bus_dmamem_free(ch->dma.workrq_tag, ch->dma.workrq, ch->dma.workrq_map); + ch->dma.workrq_bus = 0; + ch->dma.workrq_map = NULL; + ch->dma.workrq = NULL; + } + if (ch->dma.workrq_tag) { + bus_dma_tag_destroy(ch->dma.workrq_tag); + ch->dma.workrq_tag = NULL; + } +} + +static void +mvs_slotsalloc(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + int i; + + /* Alloc and setup command/dma slots */ + bzero(ch->slot, sizeof(ch->slot)); + for (i = 0; i < MVS_MAX_SLOTS; i++) { + struct mvs_slot *slot = &ch->slot[i]; + + slot->dev = dev; + slot->slot = i; + slot->state = MVS_SLOT_EMPTY; + slot->ccb = NULL; + callout_init_mtx(&slot->timeout, &ch->mtx, 0); + + if (bus_dmamap_create(ch->dma.data_tag, 0, &slot->dma.data_map)) + device_printf(ch->dev, "FAILURE - create data_map\n"); + } +} + +static void +mvs_slotsfree(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + int i; + + /* Free all dma slots */ + for (i = 0; i < MVS_MAX_SLOTS; i++) { + struct mvs_slot *slot = &ch->slot[i]; + + callout_drain(&slot->timeout); + if (slot->dma.data_map) { + bus_dmamap_destroy(ch->dma.data_tag, slot->dma.data_map); + slot->dma.data_map = NULL; + } + } +} + +static void +mvs_setup_edma_queues(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + uint64_t work; + + /* Requests queue. */ + work = ch->dma.workrq_bus; + ATA_OUTL(ch->r_mem, EDMA_REQQBAH, work >> 32); + ATA_OUTL(ch->r_mem, EDMA_REQQIP, work & 0xffffffff); + ATA_OUTL(ch->r_mem, EDMA_REQQOP, work & 0xffffffff); + bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, BUS_DMASYNC_PREWRITE); + /* Reponses queue. */ + bzero(ch->dma.workrp, 256); + work = ch->dma.workrp_bus; + ATA_OUTL(ch->r_mem, EDMA_RESQBAH, work >> 32); + ATA_OUTL(ch->r_mem, EDMA_RESQIP, work & 0xffffffff); + ATA_OUTL(ch->r_mem, EDMA_RESQOP, work & 0xffffffff); + bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, BUS_DMASYNC_PREREAD); + ch->out_idx = 0; + ch->in_idx = 0; +} + +static void +mvs_set_edma_mode(device_t dev, enum mvs_edma_mode mode) +{ + struct mvs_channel *ch = device_get_softc(dev); + int timeout; + uint32_t ecfg, fcfg, hc, ltm, unkn; + + if (mode == ch->curr_mode) + return; + /* If we are running, we should stop first. */ + if (ch->curr_mode != MVS_EDMA_OFF) { + ATA_OUTL(ch->r_mem, EDMA_CMD, EDMA_CMD_EDSEDMA); + timeout = 0; + while (ATA_INL(ch->r_mem, EDMA_CMD) & EDMA_CMD_EENEDMA) { + DELAY(1000); + if (timeout++ > 1000) { + device_printf(dev, "stopping EDMA engine failed\n"); + break; + } + }; + } + ch->curr_mode = mode; + ch->fbs_enabled = 0; + ch->fake_busy = 0; + /* Report mode to controller. Needed for correct CCC operation. */ + MVS_EDMA(device_get_parent(dev), dev, mode); + /* Configure new mode. */ + ecfg = EDMA_CFG_RESERVED | EDMA_CFG_RESERVED2 | EDMA_CFG_EHOSTQUEUECACHEEN; + if (ch->pm_present) { + ecfg |= EDMA_CFG_EMASKRXPM; + if (ch->quirks & MVS_Q_GENIIE) { + ecfg |= EDMA_CFG_EEDMAFBS; + ch->fbs_enabled = 1; + } + } + if (ch->quirks & MVS_Q_GENI) + ecfg |= EDMA_CFG_ERDBSZ; + else if (ch->quirks & MVS_Q_GENII) + ecfg |= EDMA_CFG_ERDBSZEXT | EDMA_CFG_EWRBUFFERLEN; + if (ch->quirks & MVS_Q_CT) + ecfg |= EDMA_CFG_ECUTTHROUGHEN; + if (mode != MVS_EDMA_OFF) + ecfg |= EDMA_CFG_EEARLYCOMPLETIONEN; + if (mode == MVS_EDMA_QUEUED) + ecfg |= EDMA_CFG_EQUE; + else if (mode == MVS_EDMA_NCQ) + ecfg |= EDMA_CFG_ESATANATVCMDQUE; + ATA_OUTL(ch->r_mem, EDMA_CFG, ecfg); + mvs_setup_edma_queues(dev); + if (ch->quirks & MVS_Q_GENIIE) { + /* Configure FBS-related registers */ + fcfg = ATA_INL(ch->r_mem, SATA_FISC); + ltm = ATA_INL(ch->r_mem, SATA_LTM); + hc = ATA_INL(ch->r_mem, EDMA_HC); + if (ch->fbs_enabled) { + fcfg |= SATA_FISC_FISDMAACTIVATESYNCRESP; + if (mode == MVS_EDMA_NCQ) { + fcfg &= ~SATA_FISC_FISWAIT4HOSTRDYEN_B0; + hc &= ~EDMA_IE_EDEVERR; + } else { + fcfg |= SATA_FISC_FISWAIT4HOSTRDYEN_B0; + hc |= EDMA_IE_EDEVERR; + } + ltm |= (1 << 8); + } else { + fcfg &= ~SATA_FISC_FISDMAACTIVATESYNCRESP; + fcfg &= ~SATA_FISC_FISWAIT4HOSTRDYEN_B0; + hc |= EDMA_IE_EDEVERR; + ltm &= ~(1 << 8); + } + ATA_OUTL(ch->r_mem, SATA_FISC, fcfg); + ATA_OUTL(ch->r_mem, SATA_LTM, ltm); + ATA_OUTL(ch->r_mem, EDMA_HC, hc); + /* This is some magic, required to handle several DRQs + * with basic DMA. */ + unkn = ATA_INL(ch->r_mem, EDMA_UNKN_RESD); + if (mode == MVS_EDMA_OFF) + unkn |= 1; + else + unkn &= ~1; + ATA_OUTL(ch->r_mem, EDMA_UNKN_RESD, unkn); + } + /* Run EDMA. */ + if (mode != MVS_EDMA_OFF) + ATA_OUTL(ch->r_mem, EDMA_CMD, EDMA_CMD_EENEDMA); +} + +devclass_t mvs_devclass; +devclass_t mvsch_devclass; +static device_method_t mvsch_methods[] = { + DEVMETHOD(device_probe, mvs_ch_probe), + DEVMETHOD(device_attach, mvs_ch_attach), + DEVMETHOD(device_detach, mvs_ch_detach), + DEVMETHOD(device_suspend, mvs_ch_suspend), + DEVMETHOD(device_resume, mvs_ch_resume), + { 0, 0 } +}; +static driver_t mvsch_driver = { + "mvsch", + mvsch_methods, + sizeof(struct mvs_channel) +}; +DRIVER_MODULE(mvsch, mvs, mvsch_driver, mvsch_devclass, 0, 0); +DRIVER_MODULE(mvsch, sata, mvsch_driver, mvsch_devclass, 0, 0); + +static void +mvs_phy_check_events(device_t dev, u_int32_t serr) +{ + struct mvs_channel *ch = device_get_softc(dev); + + if (ch->pm_level == 0) { + u_int32_t status = ATA_INL(ch->r_mem, SATA_SS); + union ccb *ccb; + + if (bootverbose) { + if (((status & SATA_SS_DET_MASK) == SATA_SS_DET_PHY_ONLINE) && + ((status & SATA_SS_SPD_MASK) != SATA_SS_SPD_NO_SPEED) && + ((status & SATA_SS_IPM_MASK) == SATA_SS_IPM_ACTIVE)) { + device_printf(dev, "CONNECT requested\n"); + } else + device_printf(dev, "DISCONNECT requested\n"); + } + mvs_reset(dev); + if ((ccb = xpt_alloc_ccb_nowait()) == NULL) + return; + if (xpt_create_path(&ccb->ccb_h.path, NULL, + cam_sim_path(ch->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + return; + } + xpt_rescan(ccb); + } +} + +static void +mvs_notify_events(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + struct cam_path *dpath; + uint32_t fis; + int d; + + /* Try to read PMP field from SDB FIS. Present only for Gen-IIe. */ + fis = ATA_INL(ch->r_mem, SATA_FISDW0); + if ((fis & 0x80ff) == 0x80a1) + d = (fis & 0x0f00) >> 8; + else + d = ch->pm_present ? 15 : 0; + if (bootverbose) + device_printf(dev, "SNTF %d\n", d); + if (xpt_create_path(&dpath, NULL, + xpt_path_path_id(ch->path), d, 0) == CAM_REQ_CMP) { + xpt_async(AC_SCSI_AEN, dpath, NULL); + xpt_free_path(dpath); + } +} + +static void +mvs_ch_intr_locked(void *data) +{ + struct mvs_intr_arg *arg = (struct mvs_intr_arg *)data; + device_t dev = (device_t)arg->arg; + struct mvs_channel *ch = device_get_softc(dev); + + mtx_lock(&ch->mtx); + mvs_ch_intr(data); + mtx_unlock(&ch->mtx); +} + +static void +mvs_ch_pm(void *arg) +{ + device_t dev = (device_t)arg; + struct mvs_channel *ch = device_get_softc(dev); + uint32_t work; + + if (ch->numrslots != 0) + return; + /* If we are idle - request power state transition. */ + work = ATA_INL(ch->r_mem, SATA_SC); + work &= ~SATA_SC_SPM_MASK; + if (ch->pm_level == 4) + work |= SATA_SC_SPM_PARTIAL; + else + work |= SATA_SC_SPM_SLUMBER; + ATA_OUTL(ch->r_mem, SATA_SC, work); +} + +static void +mvs_ch_pm_wake(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + uint32_t work; + int timeout = 0; + + work = ATA_INL(ch->r_mem, SATA_SS); + if (work & SATA_SS_IPM_ACTIVE) + return; + /* If we are not in active state - request power state transition. */ + work = ATA_INL(ch->r_mem, SATA_SC); + work &= ~SATA_SC_SPM_MASK; + work |= SATA_SC_SPM_ACTIVE; + ATA_OUTL(ch->r_mem, SATA_SC, work); + /* Wait for transition to happen. */ + while ((ATA_INL(ch->r_mem, SATA_SS) & SATA_SS_IPM_ACTIVE) == 0 && + timeout++ < 100) { + DELAY(100); + } +} + +static void +mvs_ch_intr(void *data) +{ + struct mvs_intr_arg *arg = (struct mvs_intr_arg *)data; + device_t dev = (device_t)arg->arg; + struct mvs_channel *ch = device_get_softc(dev); + uint32_t iec, serr = 0, fisic = 0; + enum mvs_err_type et; + int i, ccs, port = -1, selfdis = 0; + int edma = (ch->numtslots != 0 || ch->numdslots != 0); + +//device_printf(dev, "irq cause %02x EDMA %d IEC %08x\n", +// arg->cause, edma, ATA_INL(ch->r_mem, EDMA_IEC)); + /* New item in response queue. */ + if ((arg->cause & 2) && edma) + mvs_crbq_intr(dev); + /* Some error or special event. */ + if (arg->cause & 1) { + iec = ATA_INL(ch->r_mem, EDMA_IEC); +//device_printf(dev, "irq cause %02x EDMA %d IEC %08x\n", +// arg->cause, edma, iec); + if (iec & EDMA_IE_SERRINT) { + serr = ATA_INL(ch->r_mem, SATA_SE); + ATA_OUTL(ch->r_mem, SATA_SE, serr); +//device_printf(dev, "SERR %08x\n", serr); + } + /* EDMA self-disabled due to error. */ + if (iec & EDMA_IE_ESELFDIS) + selfdis = 1; + /* Transport interrupt. */ + if (iec & EDMA_IE_ETRANSINT) { + /* For Gen-I this bit means self-disable. */ + if (ch->quirks & MVS_Q_GENI) + selfdis = 1; + /* For Gen-II this bit means SDB-N. */ + else if (ch->quirks & MVS_Q_GENII) + fisic = SATA_FISC_FISWAIT4HOSTRDYEN_B1; + else /* For Gen-IIe - read FIS interrupt cause. */ + fisic = ATA_INL(ch->r_mem, SATA_FISIC); +//device_printf(dev, "FISIC %08x\n", fisic); + } + if (selfdis) + ch->curr_mode = MVS_EDMA_UNKNOWN; + ATA_OUTL(ch->r_mem, EDMA_IEC, ~iec); + /* Interface errors or Device error. */ + if (iec & (0xfc1e9000 | EDMA_IE_EDEVERR)) { + port = -1; + if (ch->numpslots != 0) { + ccs = 0; + } else { + if (ch->quirks & MVS_Q_GENIIE) + ccs = EDMA_S_EIOID(ATA_INL(ch->r_mem, EDMA_S)); + else + ccs = EDMA_S_EDEVQUETAG(ATA_INL(ch->r_mem, EDMA_S)); + /* Check if error is one-PMP-port-specific, */ + if (ch->fbs_enabled) { + /* Which ports were active. */ + for (i = 0; i < 16; i++) { + if (ch->numrslotspd[i] == 0) + continue; + if (port == -1) + port = i; + else if (port != i) { + port = -2; + break; + } + } + /* If several ports were active and EDMA still enabled - + * other ports are probably unaffected and may continue. + */ + if (port == -2 && !selfdis) { + uint16_t p = ATA_INL(ch->r_mem, SATA_SATAITC) >> 16; + port = ffs(p) - 1; + if (port != (fls(p) - 1)) + port = -2; + } + } + } +//device_printf(dev, "err slot %d port %d\n", ccs, port); + mvs_requeue_frozen(dev); + for (i = 0; i < MVS_MAX_SLOTS; i++) { + /* XXX: reqests in loading state. */ + if (((ch->rslots >> i) & 1) == 0) + continue; + if (port >= 0 && + ch->slot[i].ccb->ccb_h.target_id != port) + continue; + if (iec & EDMA_IE_EDEVERR) { /* Device error. */ + if (port != -2) { + if (ch->numtslots == 0) { + /* Untagged operation. */ + if (i == ccs) + et = MVS_ERR_TFE; + else + et = MVS_ERR_INNOCENT; + } else { + /* Tagged operation. */ + et = MVS_ERR_NCQ; + } + } else { + et = MVS_ERR_TFE; + ch->fatalerr = 1; + } + } else if (iec & 0xfc1e9000) { + if (ch->numtslots == 0 && i != ccs && port != -2) + et = MVS_ERR_INNOCENT; + else + et = MVS_ERR_SATA; + } else + et = MVS_ERR_INVALID; + mvs_end_transaction(&ch->slot[i], et); + } + } + /* Process SDB-N. */ + if (fisic & SATA_FISC_FISWAIT4HOSTRDYEN_B1) + mvs_notify_events(dev); + if (fisic) + ATA_OUTL(ch->r_mem, SATA_FISIC, ~fisic); + /* Process hot-plug. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun May 2 19:38:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19E7A1065672; Sun, 2 May 2010 19:38:18 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 07D528FC13; Sun, 2 May 2010 19:38:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42JcIl8054220; Sun, 2 May 2010 19:38:18 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42JcHPD054205; Sun, 2 May 2010 19:38:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005021938.o42JcHPD054205@svn.freebsd.org> From: Marius Strobl Date: Sun, 2 May 2010 19:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207537 - in head/sys: boot/sparc64/loader conf sparc64/include sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 19:38:18 -0000 Author: marius Date: Sun May 2 19:38:17 2010 New Revision: 207537 URL: http://svn.freebsd.org/changeset/base/207537 Log: Add support for SPARC64 V (and where it already makes sense for other HAL/Fujitsu) CPUs. For the most part this consists of fleshing out the MMU and cache handling, it doesn't add pmap optimizations possible with these CPU, yet, though. With these changes FreeBSD runs stable on Fujitsu Siemens PRIMEPOWER 250 and likely also other models based on SPARC64 V like 450, 650 and 850. Thanks go to Michael Moll for providing access to a PRIMEPOWER 250. Added: head/sys/sparc64/include/mcntl.h (contents, props changed) head/sys/sparc64/sparc64/zeus.c (contents, props changed) Modified: head/sys/boot/sparc64/loader/main.c head/sys/conf/files.sparc64 head/sys/sparc64/include/asi.h head/sys/sparc64/include/cache.h head/sys/sparc64/sparc64/cache.c head/sys/sparc64/sparc64/cheetah.c head/sys/sparc64/sparc64/identcpu.c head/sys/sparc64/sparc64/machdep.c head/sys/sparc64/sparc64/mp_locore.S head/sys/sparc64/sparc64/mp_machdep.c head/sys/sparc64/sparc64/pmap.c head/sys/sparc64/sparc64/tick.c Modified: head/sys/boot/sparc64/loader/main.c ============================================================================== --- head/sys/boot/sparc64/loader/main.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/boot/sparc64/loader/main.c Sun May 2 19:38:17 2010 (r207537) @@ -451,7 +451,8 @@ dtlb_va_to_pa_sun4u(vm_offset_t va) reg = dtlb_get_data_sun4u(i); wrpr(pstate, pstate, 0); reg >>= TD_PA_SHIFT; - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) return (reg & TD_PA_CH_MASK); return (reg & TD_PA_SF_MASK); } @@ -474,7 +475,8 @@ itlb_va_to_pa_sun4u(vm_offset_t va) reg = itlb_get_data_sun4u(i); wrpr(pstate, pstate, 0); reg >>= TD_PA_SHIFT; - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) return (reg & TD_PA_CH_MASK); return (reg & TD_PA_SF_MASK); } @@ -696,6 +698,7 @@ cpu_cpuid_prop_sun4u(void) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -720,6 +723,7 @@ cpu_get_mid_sun4u(void) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: Modified: head/sys/conf/files.sparc64 ============================================================================== --- head/sys/conf/files.sparc64 Sun May 2 19:28:30 2010 (r207536) +++ head/sys/conf/files.sparc64 Sun May 2 19:38:17 2010 (r207537) @@ -138,3 +138,4 @@ sparc64/sparc64/tsb.c standard sparc64/sparc64/uio_machdep.c standard sparc64/sparc64/upa.c optional creator sparc64/sparc64/vm_machdep.c standard +sparc64/sparc64/zeus.c standard Modified: head/sys/sparc64/include/asi.h ============================================================================== --- head/sys/sparc64/include/asi.h Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/include/asi.h Sun May 2 19:38:17 2010 (r207537) @@ -82,7 +82,10 @@ #define ASI_DCACHE_SNOOP_TAG 0x44 /* US-III Cu */ /* Named ASI_DCUCR on US-III, but is mostly identical except for added bits. */ -#define ASI_LSU_CTL_REG 0x45 +#define ASI_LSU_CTL_REG 0x45 /* US only */ + +#define ASI_MCNTL 0x45 /* SPARC64 only */ +#define AA_MCNTL 0x08 #define ASI_DCACHE_DATA 0x46 #define ASI_DCACHE_TAG 0x47 @@ -167,6 +170,8 @@ #define ASI_ICACHE_PRE_DECODE 0x6e /* US-I, II */ #define ASI_ICACHE_PRE_NEXT_FIELD 0x6f /* US-I, II */ +#define ASI_FLUSH_L1I 0x67 /* SPARC64 only */ + #define ASI_BLK_AUIP 0x70 #define ASI_BLK_AIUS 0x71 Modified: head/sys/sparc64/include/cache.h ============================================================================== --- head/sys/sparc64/include/cache.h Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/include/cache.h Sun May 2 19:38:17 2010 (r207537) @@ -113,6 +113,10 @@ extern cache_flush_t *cache_flush; extern dcache_page_inval_t *dcache_page_inval; extern icache_page_inval_t *icache_page_inval; +cache_flush_t zeus_cache_flush; +dcache_page_inval_t zeus_dcache_page_inval; +icache_page_inval_t zeus_icache_page_inval; + #endif /* KERNEL */ #endif /* !LOCORE */ Added: head/sys/sparc64/include/mcntl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sparc64/include/mcntl.h Sun May 2 19:38:17 2010 (r207537) @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2010 Marius Strobl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_MCNTL_H +#define _MACHINE_MCNTL_H + +/* + * Definitions for the SPARC64 V, VI, VII and VIIIfx Memory Control Register + */ +#define MCNTL_JPS1_TSBP (1UL << 8) + +#define MCNTL_RMD_SHIFT 12 +#define MCNTL_RMD_BITS 2 +#define MCNTL_RMD_MASK \ + (((1UL << MCNTL_RMD_BITS) - 1) << MCNTL_RMD_SHIFT) +#define MCNTL_RMD_FULL (0UL << MCNTL_RMD_SHIFT) +#define MCNTL_RMD_1024 (2UL << MCNTL_RMD_SHIFT) +#define MCNTL_RMD_512 (3UL << MCNTL_RMD_SHIFT) + +#define MCNTL_FW_FDTLB (1UL << 14) +#define MCNTL_FW_FITLB (1UL << 15) +#define MCNTL_NC_CACHE (1UL << 16) + +/* The following bits are valid for the SPARC64 VI, VII and VIIIfx only. */ +#define MCNTL_MPG_SDTLB (1UL << 6) +#define MCNTL_MPG_SITLB (1UL << 7) + +/* The following bits are valid for the SPARC64 VIIIfx only. */ +#define MCNTL_HPF_SHIFT 18 +#define MCNTL_HPF_BITS 2 +#define MCNTL_HPF_MASK \ + (((1UL << MCNTL_HPF_BITS) - 1) << MCNTL_HPF_SHIFT) +#define MCNTL_HPF_STRONG (0UL << MCNTL_HPF_SHIFT) +#define MCNTL_HPF_NOT (1UL << MCNTL_HPF_SHIFT) +#define MCNTL_HPF_WEAK (2UL << MCNTL_HPF_SHIFT) + +#endif /* _MACHINE_MCNTL_H */ Modified: head/sys/sparc64/sparc64/cache.c ============================================================================== --- head/sys/sparc64/sparc64/cache.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/cache.c Sun May 2 19:38:17 2010 (r207537) @@ -141,7 +141,12 @@ cache_init(struct pcpu *pcpu) if ((pcpu->pc_cache.dc_size & ~(1UL << (ffs(pcpu->pc_cache.dc_size) - 1))) != 0) panic("cache_init: D$ size not a power of 2"); - if (((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) / + /* + * For CPUs which don't support unaliasing in hardware ensure that + * the data cache doesn't have too many virtual colors. + */ + if (pcpu->pc_impl != CPU_IMPL_SPARC64V && + ((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS) panic("cache_init: too many D$ colors"); set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc; @@ -155,12 +160,21 @@ cache_init(struct pcpu *pcpu) icache_page_inval = cheetah_icache_page_inval; tlb_flush_nonlocked = cheetah_tlb_flush_nonlocked; tlb_flush_user = cheetah_tlb_flush_user; - } else { + } else if (pcpu->pc_impl == CPU_IMPL_SPARC64V) { + cache_enable = cheetah_cache_enable; + cache_flush = zeus_cache_flush; + dcache_page_inval = zeus_dcache_page_inval; + icache_page_inval = zeus_icache_page_inval; + tlb_flush_nonlocked = cheetah_tlb_flush_nonlocked; + tlb_flush_user = cheetah_tlb_flush_user; + } else if (pcpu->pc_impl >= CPU_IMPL_ULTRASPARCI && + pcpu->pc_impl < CPU_IMPL_ULTRASPARCIII) { cache_enable = spitfire_cache_enable; cache_flush = spitfire_cache_flush; dcache_page_inval = spitfire_dcache_page_inval; icache_page_inval = spitfire_icache_page_inval; tlb_flush_nonlocked = spitfire_tlb_flush_nonlocked; tlb_flush_user = spitfire_tlb_flush_user; - } + } else + panic("cache_init: unknown CPU"); } Modified: head/sys/sparc64/sparc64/cheetah.c ============================================================================== --- head/sys/sparc64/sparc64/cheetah.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/cheetah.c Sun May 2 19:38:17 2010 (r207537) @@ -39,11 +39,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -52,7 +54,8 @@ __FBSDID("$FreeBSD$"); #define CHEETAH_ICACHE_TAG_LOWER 0x30 /* - * CPU-specific initialization + * CPU-specific initialization - this is used for both the Sun Cheetah and + * later as well as the Fujitsu Zeus and later CPUs. */ void cheetah_init(u_int cpu_impl) @@ -75,6 +78,14 @@ cheetah_init(u_int cpu_impl) stxa(AA_IMMU_TSB_NEXT_REG, ASI_IMMU, 0); membar(Sync); + if (cpu_impl == CPU_IMPL_SPARC64V) { + /* Ensure MCNTL_JPS1_TSBP is 0. */ + val = ldxa(AA_MCNTL, ASI_MCNTL); + val &= ~MCNTL_JPS1_TSBP; + stxa(AA_MCNTL, ASI_MCNTL, val); + return; + } + /* * Configure the first large dTLB to hold 4MB pages (e.g. for direct * mappings) for all three contexts and ensure the second one is set @@ -207,7 +218,7 @@ cheetah_dcache_page_inval(vm_paddr_t spa * consistency is maintained by hardware. */ void -cheetah_icache_page_inval(vm_paddr_t pa) +cheetah_icache_page_inval(vm_paddr_t pa __unused) { } Modified: head/sys/sparc64/sparc64/identcpu.c ============================================================================== --- head/sys/sparc64/sparc64/identcpu.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/identcpu.c Sun May 2 19:38:17 2010 (r207537) @@ -41,7 +41,7 @@ cpu_identify(u_long vers, u_int freq, u_ switch (VER_MANUF(vers)) { case 0x04: - manus = "HAL"; + manus = "HAL/Fujitsu"; break; case 0x13: case 0x17: @@ -57,6 +57,27 @@ cpu_identify(u_long vers, u_int freq, u_ case CPU_IMPL_SPARC64: impls = "SPARC64"; break; + case CPU_IMPL_SPARC64II: + impls = "SPARC64-II"; + break; + case CPU_IMPL_SPARC64III: + impls = "SPARC64-III"; + break; + case CPU_IMPL_SPARC64IV: + impls = "SPARC64-IV"; + break; + case CPU_IMPL_SPARC64V: + impls = "SPARC64-V"; + break; + case CPU_IMPL_SPARC64VI: + impls = "SPARC64-VI"; + break; + case CPU_IMPL_SPARC64VII: + impls = "SPARC64-VII"; + break; + case CPU_IMPL_SPARC64VIIIfx: + impls = "SPARC64-VIIIfx"; + break; case CPU_IMPL_ULTRASPARCI: impls = "UltraSparc-I"; break; @@ -67,7 +88,6 @@ cpu_identify(u_long vers, u_int freq, u_ impls = "UltraSparc-IIi"; break; case CPU_IMPL_ULTRASPARCIIe: - /* V9 Manual says `UltraSparc-e'. I assume this is wrong. */ impls = "UltraSparc-IIe"; break; case CPU_IMPL_ULTRASPARCIII: Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/machdep.c Sun May 2 19:38:17 2010 (r207537) @@ -276,6 +276,7 @@ cpu_cpuid_prop(u_int cpu_impl) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -300,6 +301,7 @@ cpu_get_mid(u_int cpu_impl) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -343,7 +345,8 @@ sparc64_init(caddr_t mdp, u_long o1, u_l /* * Do CPU-specific initialization. */ - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) cheetah_init(cpu_impl); /* @@ -491,6 +494,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l if (cpu_use_vis) { switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: Modified: head/sys/sparc64/sparc64/mp_locore.S ============================================================================== --- head/sys/sparc64/sparc64/mp_locore.S Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/mp_locore.S Sun May 2 19:38:17 2010 (r207537) @@ -200,19 +200,25 @@ ENTRY(mp_startup) srlx %l1, VER_IMPL_SHIFT, %l1 sll %l1, VER_IMPL_SIZE, %l1 srl %l1, VER_IMPL_SIZE, %l1 + cmp %l1, CPU_IMPL_SPARC64V + bl %icc, 4f + nop + cmp %l1, CPU_IMPL_ULTRASPARCI + bl %icc, 2f + nop cmp %l1, CPU_IMPL_ULTRASPARCIII bl %icc, 3f nop - mov CPU_STICKSYNC, %l2 +2: mov CPU_STICKSYNC, %l2 membar #StoreLoad stw %l2, [%l0 + CSA_STATE] -2: ldx [%l0 + CSA_STICK], %l2 - brz %l2, 2b +3: ldx [%l0 + CSA_STICK], %l2 + brz %l2, 3b nop wr %l2, 0, %asr24 -3: call cpu_get_mid +4: call cpu_get_mid mov %l1, %o0 /* @@ -225,9 +231,9 @@ ENTRY(mp_startup) /* * Wait till its our turn to bootstrap. */ -4: lduw [%l0 + CSA_MID], %l1 +5: lduw [%l0 + CSA_MID], %l1 cmp %l1, %o0 - bne %xcc, 4b + bne %xcc, 5b nop add %l0, CSA_TTES, %l1 @@ -236,7 +242,7 @@ ENTRY(mp_startup) /* * Map the per-CPU pages. */ -5: sllx %l2, TTE_SHIFT, %l3 +6: sllx %l2, TTE_SHIFT, %l3 add %l1, %l3, %l3 ldx [%l3 + TTE_VPN], %l4 @@ -251,7 +257,7 @@ ENTRY(mp_startup) add %l2, 1, %l2 cmp %l2, PCPU_PAGES - bne %xcc, 5b + bne %xcc, 6b nop /* Modified: head/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/mp_machdep.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/mp_machdep.c Sun May 2 19:38:17 2010 (r207537) @@ -164,7 +164,8 @@ mp_init(u_int cpu_impl) if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || cpu_impl == CPU_IMPL_ULTRASPARCIIIip) isjbus = 1; - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) cpu_ipi_selected = cheetah_ipi_selected; else cpu_ipi_selected = spitfire_ipi_selected; @@ -315,7 +316,8 @@ ap_start(phandle_t node, u_int mid, u_in ; membar(StoreLoad); csa->csa_tick = rd(tick); - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) { + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { while (csa->csa_state != CPU_STICKSYNC) ; membar(StoreLoad); @@ -411,7 +413,8 @@ cpu_mp_bootstrap(struct pcpu *pc) csa = &cpu_start_args; /* Do CPU-specific initialization. */ - if (pc->pc_impl >= CPU_IMPL_ULTRASPARCIII) + if (pc->pc_impl == CPU_IMPL_SPARC64V || + pc->pc_impl >= CPU_IMPL_ULTRASPARCIII) cheetah_init(pc->pc_impl); /* * Enable the caches. Note that his may include applying workarounds. Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/pmap.c Sun May 2 19:38:17 2010 (r207537) @@ -528,7 +528,8 @@ pmap_bootstrap(u_int cpu_impl) tp->tte_data = ((translations[i].om_tte & ~((TD_SOFT2_MASK << TD_SOFT2_SHIFT) | - (cpu_impl < CPU_IMPL_ULTRASPARCIII ? + (cpu_impl >= CPU_IMPL_ULTRASPARCI && + cpu_impl < CPU_IMPL_ULTRASPARCIII ? (TD_DIAG_SF_MASK << TD_DIAG_SF_SHIFT) : (TD_RSVD_CH_MASK << TD_RSVD_CH_SHIFT)) | (TD_SOFT_MASK << TD_SOFT_SHIFT))) | TD_EXEC) + @@ -704,16 +705,16 @@ retry: if (va >= VM_MIN_DIRECT_ADDRESS) { tp = NULL; m = PHYS_TO_VM_PAGE(TLB_DIRECT_TO_PHYS(va)); - (void)vm_page_pa_tryrelock(pm, TLB_DIRECT_TO_PHYS(va), &pa); + (void)vm_page_pa_tryrelock(pm, TLB_DIRECT_TO_PHYS(va), + &pa); vm_page_hold(m); } else { tp = tsb_kvtotte(va); if ((tp->tte_data & TD_V) == 0) tp = NULL; } - } else { + } else tp = tsb_tte_lookup(pm, va); - } if (tp != NULL && ((tp->tte_data & TD_SW) || (prot & VM_PROT_WRITE) == 0)) { if (vm_page_pa_tryrelock(pm, TTE_GET_PA(tp), &pa)) Modified: head/sys/sparc64/sparc64/tick.c ============================================================================== --- head/sys/sparc64/sparc64/tick.c Sun May 2 19:28:30 2010 (r207536) +++ head/sys/sparc64/sparc64/tick.c Sun May 2 19:38:17 2010 (r207537) @@ -120,7 +120,8 @@ cpu_initclocks(void) */ } else { clock = PCPU_GET(clock); - intr_setup(PIL_TICK, PCPU_GET(impl) < CPU_IMPL_ULTRASPARCIII ? + intr_setup(PIL_TICK, PCPU_GET(impl) >= CPU_IMPL_ULTRASPARCI && + PCPU_GET(impl) < CPU_IMPL_ULTRASPARCIII ? tick_hardclock_bbwar : tick_hardclock, -1, NULL, NULL); set_cputicker(tick_cputicks, clock, 0); } @@ -325,7 +326,8 @@ void tick_clear(u_int cpu_impl) { - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) wrstick(0, 0); wrpr(tick, 0, 0); } @@ -334,7 +336,8 @@ void tick_stop(u_int cpu_impl) { - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) wrstickcmpr(1L << 63, 0); wrtickcmpr(1L << 63, 0); } Added: head/sys/sparc64/sparc64/zeus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sparc64/sparc64/zeus.c Sun May 2 19:38:17 2010 (r207537) @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2010 Marius Strobl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include + +/* + * Flush all lines from the level 1 caches. + */ +void +zeus_cache_flush(void) +{ + + stxa_sync(0, ASI_FLUSH_L1I, 0); +} + +/* + * Flush a physical page from the data cache. Data cache consistency is + * maintained by hardware. + */ +void +zeus_dcache_page_inval(vm_paddr_t spa __unused) +{ + +} + +/* + * Flush a physical page from the intsruction cache. Instruction cache + * consistency is maintained by hardware. + */ +void +zeus_icache_page_inval(vm_paddr_t pa __unused) +{ + +} From owner-svn-src-head@FreeBSD.ORG Sun May 2 20:24:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3D0FD106566C; Sun, 2 May 2010 20:24:26 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2D16B8FC1B; Sun, 2 May 2010 20:24:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42KOQC8064365; Sun, 2 May 2010 20:24:26 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42KOQno064363; Sun, 2 May 2010 20:24:26 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005022024.o42KOQno064363@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 20:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207539 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 20:24:27 -0000 Author: alc Date: Sun May 2 20:24:25 2010 New Revision: 207539 URL: http://svn.freebsd.org/changeset/base/207539 Log: Simplify vm_fault(). The introduction of the new page lock renders a bit of cleverness by vm_fault() to avoid repeatedly releasing and reacquiring the page queues lock pointless. Reviewed by: kib, kmacy Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun May 2 20:12:20 2010 (r207538) +++ head/sys/vm/vm_fault.c Sun May 2 20:24:25 2010 (r207539) @@ -215,7 +215,7 @@ vm_fault(vm_map_t map, vm_offset_t vaddr { vm_prot_t prot; int is_first_object_locked, result; - boolean_t are_queues_locked, growstack, wired; + boolean_t growstack, wired; int map_generation; vm_object_t next_object; vm_page_t marray[VM_FAULT_READ]; @@ -478,7 +478,6 @@ readrest: else firstpindex = fs.first_pindex - 2 * VM_FAULT_READ; - are_queues_locked = FALSE; /* * note: partially valid pages cannot be * included in the lookahead - NFS piecemeal @@ -495,17 +494,11 @@ readrest: if (mt->busy || (mt->oflags & VPO_BUSY)) continue; - if (!are_queues_locked) { - are_queues_locked = TRUE; - vm_page_lock(mt); - vm_page_lock_queues(); - } else { - vm_page_unlock_queues(); - vm_page_lock(mt); - vm_page_lock_queues(); - } + vm_page_lock(mt); + vm_page_lock_queues(); if (mt->hold_count || mt->wire_count) { + vm_page_unlock_queues(); vm_page_unlock(mt); continue; } @@ -515,10 +508,9 @@ readrest: } else { vm_page_cache(mt); } + vm_page_unlock_queues(); vm_page_unlock(mt); } - if (are_queues_locked) - vm_page_unlock_queues(); ahead += behind; behind = 0; } From owner-svn-src-head@FreeBSD.ORG Sun May 2 20:46:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 822AC1065670; Sun, 2 May 2010 20:46:17 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 7248F8FC16; Sun, 2 May 2010 20:46:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42KkHGi069180; Sun, 2 May 2010 20:46:17 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42KkHr4069178; Sun, 2 May 2010 20:46:17 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005022046.o42KkHr4069178@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 20:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207540 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 20:46:17 -0000 Author: alc Date: Sun May 2 20:46:17 2010 New Revision: 207540 URL: http://svn.freebsd.org/changeset/base/207540 Log: Defer the acquisition of the page and page queues locks in vm_pageout_object_deactivate_pages(). Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun May 2 20:24:25 2010 (r207539) +++ head/sys/vm/vm_pageout.c Sun May 2 20:46:17 2010 (r207540) @@ -540,6 +540,7 @@ vm_pageout_object_deactivate_pages(pmap, for (object = first_object;; object = backing_object) { if (pmap_resident_count(pmap) <= desired) goto unlock_return; + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); if (object->type == OBJT_PHYS || object->paging_in_progress) goto unlock_return; @@ -551,19 +552,18 @@ vm_pageout_object_deactivate_pages(pmap, */ p = TAILQ_FIRST(&object->memq); while (p != NULL) { - vm_page_lock(p); - vm_page_lock_queues(); - if (pmap_resident_count(pmap) <= desired) { - vm_page_unlock_queues(); - vm_page_unlock(p); + if (pmap_resident_count(pmap) <= desired) goto unlock_return; - } next = TAILQ_NEXT(p, listq); + if ((p->oflags & VPO_BUSY) != 0 || p->busy != 0) { + p = next; + continue; + } + vm_page_lock(p); + vm_page_lock_queues(); cnt.v_pdpages++; if (p->wire_count != 0 || p->hold_count != 0 || - p->busy != 0 || - (p->oflags & VPO_BUSY) || !pmap_page_exists_quick(pmap, p)) { vm_page_unlock_queues(); vm_page_unlock(p); From owner-svn-src-head@FreeBSD.ORG Sun May 2 21:05:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C1D2106566B; Sun, 2 May 2010 21:05:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1C2498FC1D; Sun, 2 May 2010 21:05:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42L4xcD073335; Sun, 2 May 2010 21:04:59 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42L4xXD073333; Sun, 2 May 2010 21:04:59 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005022104.o42L4xXD073333@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 21:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207541 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 21:05:00 -0000 Author: alc Date: Sun May 2 21:04:59 2010 New Revision: 207541 URL: http://svn.freebsd.org/changeset/base/207541 Log: Eliminate an assignment that was made redundant by r207410. Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun May 2 20:46:17 2010 (r207540) +++ head/sys/vm/vm_pageout.c Sun May 2 21:04:59 2010 (r207541) @@ -1370,8 +1370,6 @@ vm_pageout_page_stats() ("vm_pageout_page_stats: page %p isn't active", m)); next = TAILQ_NEXT(m, pageq); - object = m->object; - if ((m->flags & PG_MARKER) != 0) { m = next; continue; From owner-svn-src-head@FreeBSD.ORG Sun May 2 22:48:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 54482106566C; Sun, 2 May 2010 22:48:28 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 446B98FC1B; Sun, 2 May 2010 22:48:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42MmSFL096113; Sun, 2 May 2010 22:48:28 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42MmS0E096111; Sun, 2 May 2010 22:48:28 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201005022248.o42MmS0E096111@svn.freebsd.org> From: Matt Jacob Date: Sun, 2 May 2010 22:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207543 - head/sys/dev/mpt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 22:48:28 -0000 Author: mjacob Date: Sun May 2 22:48:27 2010 New Revision: 207543 URL: http://svn.freebsd.org/changeset/base/207543 Log: Print IR_RESYNC updates informatively. Obtained from: pluknet MFC after: 1 week Modified: head/sys/dev/mpt/mpt_cam.c Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Sun May 2 21:11:47 2010 (r207542) +++ head/sys/dev/mpt/mpt_cam.c Sun May 2 22:48:27 2010 (r207543) @@ -2575,6 +2575,10 @@ mpt_cam_event(struct mpt_softc *mpt, req CAMLOCK_2_MPTLOCK(mpt); break; } + case MPI_EVENT_IR_RESYNC_UPDATE: + mpt_prt(mpt, "IR resync update %d completed\n", + (data0 >> 16) & 0xff); + break; case MPI_EVENT_EVENT_CHANGE: case MPI_EVENT_INTEGRATED_RAID: case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: From owner-svn-src-head@FreeBSD.ORG Sun May 2 23:33:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CC8CF1065673; Sun, 2 May 2010 23:33:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BCC2E8FC12; Sun, 2 May 2010 23:33:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o42NXALZ006057; Sun, 2 May 2010 23:33:10 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o42NXAFO006055; Sun, 2 May 2010 23:33:10 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005022333.o42NXAFO006055@svn.freebsd.org> From: Alan Cox Date: Sun, 2 May 2010 23:33:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207544 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 23:33:10 -0000 Author: alc Date: Sun May 2 23:33:10 2010 New Revision: 207544 URL: http://svn.freebsd.org/changeset/base/207544 Log: Add page lock assertions where we access the page's hold_count. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun May 2 22:48:27 2010 (r207543) +++ head/sys/vm/vm_page.c Sun May 2 23:33:10 2010 (r207544) @@ -1657,6 +1657,7 @@ vm_page_try_to_cache(vm_page_t m) { mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if (m->dirty || m->hold_count || m->busy || m->wire_count || (m->oflags & VPO_BUSY) || (m->flags & PG_UNMANAGED)) { @@ -1680,6 +1681,7 @@ vm_page_try_to_free(vm_page_t m) { mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if (m->object != NULL) VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if (m->dirty || m->hold_count || m->busy || m->wire_count || @@ -1707,6 +1709,7 @@ vm_page_cache(vm_page_t m) vm_page_t root; mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); object = m->object; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); if ((m->flags & PG_UNMANAGED) || (m->oflags & VPO_BUSY) || m->busy || From owner-svn-src-head@FreeBSD.ORG Mon May 3 00:56:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C45A0106566B; Mon, 3 May 2010 00:56:26 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B3DBB8FC18; Mon, 3 May 2010 00:56:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o430uQ0A024168; Mon, 3 May 2010 00:56:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o430uQ8N024166; Mon, 3 May 2010 00:56:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005030056.o430uQ8N024166@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 3 May 2010 00:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207545 - head/sys/dev/sge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 00:56:26 -0000 Author: yongari Date: Mon May 3 00:56:26 2010 New Revision: 207545 URL: http://svn.freebsd.org/changeset/base/207545 Log: Fix wrong dma tag usage. Previously it used TX descriptor ring dma tag which should be TX mbuf dma tag. Reported by: xclin cs dot nctu dot edu dot tw > Modified: head/sys/dev/sge/if_sge.c Modified: head/sys/dev/sge/if_sge.c ============================================================================== --- head/sys/dev/sge/if_sge.c Sun May 2 23:33:10 2010 (r207544) +++ head/sys/dev/sge/if_sge.c Mon May 3 00:56:26 2010 (r207545) @@ -1421,7 +1421,7 @@ sge_encap(struct sge_softc *sc, struct m } *m_head = m; } - error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_tx_tag, map, + error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, map, *m_head, txsegs, &nsegs, 0); if (error != 0) { m_freem(*m_head); @@ -1430,10 +1430,11 @@ sge_encap(struct sge_softc *sc, struct m } /* Check descriptor overrun. */ if (sc->sge_cdata.sge_tx_cnt + nsegs >= SGE_TX_RING_CNT) { - bus_dmamap_unload(sc->sge_cdata.sge_tx_tag, map); + bus_dmamap_unload(sc->sge_cdata.sge_txmbuf_tag, map); return (ENOBUFS); } - bus_dmamap_sync(sc->sge_cdata.sge_tx_tag, map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sge_cdata.sge_txmbuf_tag, map, + BUS_DMASYNC_PREWRITE); cflags = 0; if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) From owner-svn-src-head@FreeBSD.ORG Mon May 3 05:41:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 815F6106564A; Mon, 3 May 2010 05:41:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 712108FC08; Mon, 3 May 2010 05:41:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o435fp1J086568; Mon, 3 May 2010 05:41:51 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o435fpou086565; Mon, 3 May 2010 05:41:51 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005030541.o435fpou086565@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 05:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207548 - in head/sys: kern net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 05:41:51 -0000 Author: alc Date: Mon May 3 05:41:50 2010 New Revision: 207548 URL: http://svn.freebsd.org/changeset/base/207548 Log: This is the first step in transitioning responsibility for synchronizing access to the page's wire_count from the page queues lock to the page lock. Submitted by: kmacy Modified: head/sys/kern/uipc_cow.c head/sys/kern/uipc_syscalls.c head/sys/net/bpf_zerocopy.c Modified: head/sys/kern/uipc_cow.c ============================================================================== --- head/sys/kern/uipc_cow.c Mon May 3 01:13:37 2010 (r207547) +++ head/sys/kern/uipc_cow.c Mon May 3 05:41:50 2010 (r207548) @@ -80,6 +80,7 @@ socow_iodone(void *addr, void *args) pp = sf_buf_page(sf); sf_buf_free(sf); /* remove COW mapping */ + vm_page_lock(pp); vm_page_lock_queues(); vm_page_cowclear(pp); vm_page_unwire(pp, 0); @@ -91,6 +92,7 @@ socow_iodone(void *addr, void *args) if (pp->wire_count == 0 && pp->object == NULL) vm_page_free(pp); vm_page_unlock_queues(); + vm_page_unlock(pp); socow_stats.iodone++; } @@ -149,6 +151,7 @@ socow_setup(struct mbuf *m0, struct uio */ sf = sf_buf_alloc(pp, SFB_CATCH); if (!sf) { + vm_page_lock(pp); vm_page_lock_queues(); vm_page_cowclear(pp); vm_page_unwire(pp, 0); @@ -160,6 +163,7 @@ socow_setup(struct mbuf *m0, struct uio if (pp->wire_count == 0 && pp->object == NULL) vm_page_free(pp); vm_page_unlock_queues(); + vm_page_unlock(pp); socow_stats.fail_sf_buf++; return(0); } Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Mon May 3 01:13:37 2010 (r207547) +++ head/sys/kern/uipc_syscalls.c Mon May 3 05:41:50 2010 (r207548) @@ -1715,6 +1715,7 @@ sf_buf_mext(void *addr, void *args) m = sf_buf_page(args); sf_buf_free(args); + vm_page_lock(m); vm_page_lock_queues(); vm_page_unwire(m, 0); /* @@ -1725,6 +1726,7 @@ sf_buf_mext(void *addr, void *args) if (m->wire_count == 0 && m->object == NULL) vm_page_free(m); vm_page_unlock_queues(); + vm_page_unlock(m); if (addr == NULL) return; sfs = addr; @@ -2136,6 +2138,7 @@ retry_space: if ((sf = sf_buf_alloc(pg, (mnw ? SFB_NOWAIT : SFB_CATCH))) == NULL) { mbstat.sf_allocfail++; + vm_page_lock(pg); vm_page_lock_queues(); vm_page_unwire(pg, 0); /* @@ -2144,6 +2147,7 @@ retry_space: if (pg->wire_count == 0 && pg->object == NULL) vm_page_free(pg); vm_page_unlock_queues(); + vm_page_unlock(pg); error = (mnw ? EAGAIN : EINTR); break; } Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Mon May 3 01:13:37 2010 (r207547) +++ head/sys/net/bpf_zerocopy.c Mon May 3 05:41:50 2010 (r207548) @@ -112,11 +112,13 @@ static void zbuf_page_free(vm_page_t pp) { + vm_page_lock(pp); vm_page_lock_queues(); vm_page_unwire(pp, 0); if (pp->wire_count == 0 && pp->object == NULL) vm_page_free(pp); vm_page_unlock_queues(); + vm_page_unlock(pp); } /* From owner-svn-src-head@FreeBSD.ORG Mon May 3 07:00:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 980E1106566C; Mon, 3 May 2010 07:00:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 887038FC19; Mon, 3 May 2010 07:00:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4370orW004042; Mon, 3 May 2010 07:00:50 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4370oIl004040; Mon, 3 May 2010 07:00:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005030700.o4370oIl004040@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 07:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207551 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 07:00:50 -0000 Author: alc Date: Mon May 3 07:00:50 2010 New Revision: 207551 URL: http://svn.freebsd.org/changeset/base/207551 Log: Assert that the page queues lock is held in vm_page_remove() and vm_page_unwire() only if the page is managed, i.e., pageable. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon May 3 06:26:52 2010 (r207550) +++ head/sys/vm/vm_page.c Mon May 3 07:00:50 2010 (r207551) @@ -790,6 +790,8 @@ vm_page_remove(vm_page_t m) vm_object_t object; vm_page_t root; + if ((m->flags & PG_UNMANAGED) == 0) + mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((object = m->object) == NULL) return; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); @@ -797,7 +799,6 @@ vm_page_remove(vm_page_t m) m->oflags &= ~VPO_BUSY; vm_page_flash(m); } - mtx_assert(&vm_page_queue_mtx, MA_OWNED); /* * Now remove from the object's list of backed pages. @@ -1586,7 +1587,8 @@ void vm_page_unwire(vm_page_t m, int activate) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if ((m->flags & PG_UNMANAGED) == 0) + mtx_assert(&vm_page_queue_mtx, MA_OWNED); if (m->flags & PG_FICTITIOUS) return; if (m->wire_count > 0) { From owner-svn-src-head@FreeBSD.ORG Mon May 3 07:08:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6EF521065670; Mon, 3 May 2010 07:08:16 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 5F46B8FC16; Mon, 3 May 2010 07:08:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4378G5e005694; Mon, 3 May 2010 07:08:16 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4378GV3005691; Mon, 3 May 2010 07:08:16 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005030708.o4378GV3005691@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 07:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207552 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 07:08:16 -0000 Author: alc Date: Mon May 3 07:08:16 2010 New Revision: 207552 URL: http://svn.freebsd.org/changeset/base/207552 Log: The pages allocated by kmem_alloc_attr() and kmem_malloc() are unmanaged. Consequently, neither the page lock nor the page queues lock is needed to unwire and free them. Modified: head/sys/vm/vm_contig.c head/sys/vm/vm_kern.c Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Mon May 3 07:00:50 2010 (r207551) +++ head/sys/vm/vm_contig.c Mon May 3 07:08:16 2010 (r207552) @@ -268,11 +268,7 @@ retry: i -= PAGE_SIZE; m = vm_page_lookup(object, OFF_TO_IDX(offset + i)); - vm_page_lock(m); - vm_page_lock_queues(); vm_page_free(m); - vm_page_unlock_queues(); - vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); vm_map_delete(map, addr, addr + size); Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Mon May 3 07:00:50 2010 (r207551) +++ head/sys/vm/vm_kern.c Mon May 3 07:08:16 2010 (r207552) @@ -380,12 +380,8 @@ retry: i -= PAGE_SIZE; m = vm_page_lookup(kmem_object, OFF_TO_IDX(offset + i)); - vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); vm_page_free(m); - vm_page_unlock_queues(); - vm_page_unlock(m); } VM_OBJECT_UNLOCK(kmem_object); vm_map_delete(map, addr, addr + size); From owner-svn-src-head@FreeBSD.ORG Mon May 3 07:32:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BE88E106566C; Mon, 3 May 2010 07:32:24 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id AE4338FC14; Mon, 3 May 2010 07:32:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o437WOJH011012; Mon, 3 May 2010 07:32:24 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o437WOvN011009; Mon, 3 May 2010 07:32:24 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005030732.o437WOvN011009@svn.freebsd.org> From: Martin Matuska Date: Mon, 3 May 2010 07:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207553 - head/lib/libpam/modules/pam_krb5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 07:32:24 -0000 Author: mm Date: Mon May 3 07:32:24 2010 New Revision: 207553 URL: http://svn.freebsd.org/changeset/base/207553 Log: Implement the no_user_check option to pam_krb5. This option is available in the Linux implementation of pam_krb5 and allows to authorize a user not known to the local system. Ccache is not used as we don't have a secure uid/gid for the cache file. Usable for authentication of external kerberos users (e.g Active Directory) via PAM from applications like Cyrus saslauthd, PHP or perl. PR: bin/146186 Submitted by: myself Approved by: deplhij (mentor) MFC after: 2 weeks Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.8 head/lib/libpam/modules/pam_krb5/pam_krb5.c Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.8 ============================================================================== --- head/lib/libpam/modules/pam_krb5/pam_krb5.8 Mon May 3 07:08:16 2010 (r207552) +++ head/lib/libpam/modules/pam_krb5/pam_krb5.8 Mon May 3 07:32:24 2010 (r207553) @@ -108,6 +108,10 @@ and .Ql %p , to designate the current process ID; can be used in .Ar name . +.It Cm no_user_check +Do not verify if a user exists on the local system. This option implies the +.Cm no_ccache +option because there is no secure local uid/gid for the cache file. .El .Ss Kerberos 5 Account Management Module The Kerberos 5 account management component Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c ============================================================================== --- head/lib/libpam/modules/pam_krb5/pam_krb5.c Mon May 3 07:08:16 2010 (r207552) +++ head/lib/libpam/modules/pam_krb5/pam_krb5.c Mon May 3 07:32:24 2010 (r207553) @@ -89,6 +89,7 @@ static void compat_free_data_contents(kr #define PAM_OPT_DEBUG "debug" #define PAM_OPT_FORWARDABLE "forwardable" #define PAM_OPT_NO_CCACHE "no_ccache" +#define PAM_OPT_NO_USER_CHECK "no_user_check" #define PAM_OPT_REUSE_CCACHE "reuse_ccache" /* @@ -194,6 +195,10 @@ pam_sm_authenticate(pam_handle_t *pamh, PAM_LOG("Got password"); + if (openpam_get_option(pamh, PAM_OPT_NO_USER_CHECK)) + PAM_LOG("Skipping local user check"); + else { + /* Verify the local user exists (AFTER getting the password) */ if (strchr(user, '@')) { /* get a local account name for this principal */ @@ -221,6 +226,7 @@ pam_sm_authenticate(pam_handle_t *pamh, } PAM_LOG("Done getpwnam()"); + } /* Get a TGT */ memset(&creds, 0, sizeof(krb5_creds)); @@ -366,7 +372,8 @@ pam_sm_setcred(pam_handle_t *pamh, int f return (PAM_SERVICE_ERR); /* If a persistent cache isn't desired, stop now. */ - if (openpam_get_option(pamh, PAM_OPT_NO_CCACHE)) + if (openpam_get_option(pamh, PAM_OPT_NO_CCACHE) || + openpam_get_option(pamh, PAM_OPT_NO_USER_CHECK)) return (PAM_SUCCESS); PAM_LOG("Establishing credentials"); From owner-svn-src-head@FreeBSD.ORG Mon May 3 07:32:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B909C1065678; Mon, 3 May 2010 07:32:51 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id A433B8FC1A; Mon, 3 May 2010 07:32:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o437WpJS011206; Mon, 3 May 2010 07:32:51 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o437WoqG011142; Mon, 3 May 2010 07:32:50 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <201005030732.o437WoqG011142@svn.freebsd.org> From: Maxim Sobolev Date: Mon, 3 May 2010 07:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207554 - in head/sys: arm/at91 arm/xscale/ixp425 dev/ae dev/an dev/ath dev/bwi dev/bwn dev/ce dev/cm dev/cp dev/cs dev/ctau dev/cx dev/cxgb dev/ed dev/ep dev/ex dev/fe dev/ie dev/iicbu... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 07:32:51 -0000 Author: sobomax Date: Mon May 3 07:32:50 2010 New Revision: 207554 URL: http://svn.freebsd.org/changeset/base/207554 Log: Add new tunable 'net.link.ifqmaxlen' to set default send interface queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. MFC after: 1 month Modified: head/sys/arm/at91/if_ate.c head/sys/arm/xscale/ixp425/if_npe.c head/sys/dev/ae/if_ae.c head/sys/dev/an/if_an.c head/sys/dev/ath/if_ath.c head/sys/dev/bwi/if_bwi.c head/sys/dev/bwn/if_bwn.c head/sys/dev/ce/if_ce.c head/sys/dev/cm/smc90cx6.c head/sys/dev/cp/if_cp.c head/sys/dev/cs/if_cs.c head/sys/dev/ctau/if_ct.c head/sys/dev/cx/if_cx.c head/sys/dev/cxgb/cxgb_main.c head/sys/dev/ed/if_ed.c head/sys/dev/ep/if_ep.c head/sys/dev/ex/if_ex.c head/sys/dev/fe/if_fe.c head/sys/dev/ie/if_ie.c head/sys/dev/iicbus/if_ic.c head/sys/dev/ipw/if_ipw.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwn/if_iwn.c head/sys/dev/le/lance.c head/sys/dev/malo/if_malo.c head/sys/dev/mwl/if_mwl.c head/sys/dev/my/if_my.c head/sys/dev/nxge/if_nxge.c head/sys/dev/pdq/pdq_ifsubr.c head/sys/dev/ppbus/if_plip.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/sbni/if_sbni.c head/sys/dev/smc/if_smc.c head/sys/dev/sn/if_sn.c head/sys/dev/snc/dp83932.c head/sys/dev/usb/net/uhso.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/vx/if_vx.c head/sys/dev/wi/if_wi.c head/sys/dev/wl/if_wl.c head/sys/dev/wpi/if_wpi.c head/sys/dev/xe/if_xe.c head/sys/mips/adm5120/if_admsw.c head/sys/mips/atheros/if_arge.c head/sys/net/if.c head/sys/net/if_ef.c head/sys/net/if_gif.c head/sys/net/if_gre.c head/sys/net/if_stf.c head/sys/net80211/ieee80211.c head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_fec.c head/sys/netgraph/ng_iface.c head/sys/netgraph/ng_tty.c head/sys/pci/if_rl.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/arm/at91/if_ate.c Mon May 3 07:32:50 2010 (r207554) @@ -272,8 +272,8 @@ ate_attach(device_t dev) ifp->if_ioctl = ateioctl; ifp->if_init = ateinit; ifp->if_baudrate = 10000000; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ifp->if_linkmib = &sc->mibdata; ifp->if_linkmiblen = sizeof(sc->mibdata); Modified: head/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/if_npe.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/arm/xscale/ixp425/if_npe.c Mon May 3 07:32:50 2010 (r207554) @@ -360,7 +360,7 @@ npe_attach(device_t dev) ifp->if_ioctl = npeioctl; ifp->if_init = npeinit; IFQ_SET_MAXLEN(&ifp->if_snd, sc->txdma.nbuf - 1); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ifp->if_linkmib = &sc->mibdata; ifp->if_linkmiblen = sizeof(sc->mibdata); Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ae/if_ae.c Mon May 3 07:32:50 2010 (r207554) @@ -378,7 +378,7 @@ ae_attach(device_t dev) ifp->if_init = ae_init; ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; ifp->if_hwassist = 0; - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) { Modified: head/sys/dev/an/if_an.c ============================================================================== --- head/sys/dev/an/if_an.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/an/if_an.c Mon May 3 07:32:50 2010 (r207554) @@ -767,8 +767,8 @@ an_attach(struct an_softc *sc, int flags ifp->if_start = an_start; ifp->if_init = an_init; ifp->if_baudrate = 10000000; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); bzero(sc->an_config.an_nodename, sizeof(sc->an_config.an_nodename)); Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ath/if_ath.c Mon May 3 07:32:50 2010 (r207554) @@ -562,8 +562,8 @@ ath_attach(u_int16_t devid, struct ath_s ifp->if_start = ath_start; ifp->if_ioctl = ath_ioctl; ifp->if_init = ath_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/bwi/if_bwi.c Mon May 3 07:32:50 2010 (r207554) @@ -461,8 +461,8 @@ bwi_attach(struct bwi_softc *sc) ifp->if_init = bwi_init; ifp->if_ioctl = bwi_ioctl; ifp->if_start = bwi_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); callout_init_mtx(&sc->sc_watchdog_timer, &sc->sc_mtx, 0); Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/bwn/if_bwn.c Mon May 3 07:32:50 2010 (r207554) @@ -1193,8 +1193,8 @@ bwn_attach_pre(struct bwn_softc *sc) ifp->if_init = bwn_init; ifp->if_ioctl = bwn_ioctl; ifp->if_start = bwn_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); return (0); Modified: head/sys/dev/ce/if_ce.c ============================================================================== --- head/sys/dev/ce/if_ce.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ce/if_ce.c Mon May 3 07:32:50 2010 (r207554) @@ -701,9 +701,9 @@ static int ce_attach (device_t dev) #endif continue; } - d->queue.ifq_maxlen = IFQ_MAXLEN; - d->hi_queue.ifq_maxlen = IFQ_MAXLEN; - d->rqueue.ifq_maxlen = IFQ_MAXLEN; + d->queue.ifq_maxlen = ifqmaxlen; + d->hi_queue.ifq_maxlen = ifqmaxlen; + d->rqueue.ifq_maxlen = ifqmaxlen; #if __FreeBSD_version >= 500000 mtx_init (&d->queue.ifq_mtx, "ce_queue", NULL, MTX_DEF); mtx_init (&d->hi_queue.ifq_mtx, "ce_queue_hi", NULL, MTX_DEF); @@ -732,7 +732,7 @@ static int ce_attach (device_t dev) d->ifp->if_ioctl = ce_sioctl; d->ifp->if_start = ce_ifstart; d->ifp->if_init = ce_initialize; - d->rqueue.ifq_maxlen = IFQ_MAXLEN; + d->rqueue.ifq_maxlen = ifqmaxlen; #if __FreeBSD_version >= 500000 mtx_init (&d->rqueue.ifq_mtx, "ce_rqueue", NULL, MTX_DEF); #endif Modified: head/sys/dev/cm/smc90cx6.c ============================================================================== --- head/sys/dev/cm/smc90cx6.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/cm/smc90cx6.c Mon May 3 07:32:50 2010 (r207554) @@ -189,7 +189,7 @@ cm_attach(dev) ifp->if_ioctl = cm_ioctl; ifp->if_init = cm_init; /* XXX IFQ_SET_READY(&ifp->if_snd); */ - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; arc_ifattach(ifp, linkaddress); Modified: head/sys/dev/cp/if_cp.c ============================================================================== --- head/sys/dev/cp/if_cp.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/cp/if_cp.c Mon May 3 07:32:50 2010 (r207554) @@ -505,8 +505,8 @@ static int cp_attach (device_t dev) NG_NODE_UNREF (d->node); continue; } - d->queue.ifq_maxlen = IFQ_MAXLEN; - d->hi_queue.ifq_maxlen = IFQ_MAXLEN; + d->queue.ifq_maxlen = ifqmaxlen; + d->hi_queue.ifq_maxlen = ifqmaxlen; mtx_init (&d->queue.ifq_mtx, "cp_queue", NULL, MTX_DEF); mtx_init (&d->hi_queue.ifq_mtx, "cp_queue_hi", NULL, MTX_DEF); #else /*NETGRAPH*/ Modified: head/sys/dev/cs/if_cs.c ============================================================================== --- head/sys/dev/cs/if_cs.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/cs/if_cs.c Mon May 3 07:32:50 2010 (r207554) @@ -500,7 +500,7 @@ cs_attach(device_t dev) ifp->if_start=cs_start; ifp->if_ioctl=cs_ioctl; ifp->if_init=cs_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ifp->if_flags=(IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); Modified: head/sys/dev/ctau/if_ct.c ============================================================================== --- head/sys/dev/ctau/if_ct.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ctau/if_ct.c Mon May 3 07:32:50 2010 (r207554) @@ -722,8 +722,8 @@ static int ct_attach (device_t dev) ct_bus_dma_mem_free (&d->dmamem); continue; } - d->queue.ifq_maxlen = IFQ_MAXLEN; - d->hi_queue.ifq_maxlen = IFQ_MAXLEN; + d->queue.ifq_maxlen = ifqmaxlen; + d->hi_queue.ifq_maxlen = ifqmaxlen; mtx_init (&d->queue.ifq_mtx, "ct_queue", NULL, MTX_DEF); mtx_init (&d->hi_queue.ifq_mtx, "ct_queue_hi", NULL, MTX_DEF); #else /*NETGRAPH*/ Modified: head/sys/dev/cx/if_cx.c ============================================================================== --- head/sys/dev/cx/if_cx.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/cx/if_cx.c Mon May 3 07:32:50 2010 (r207554) @@ -831,8 +831,8 @@ static int cx_attach (device_t dev) cx_bus_dma_mem_free (&d->dmamem); continue; } - d->lo_queue.ifq_maxlen = IFQ_MAXLEN; - d->hi_queue.ifq_maxlen = IFQ_MAXLEN; + d->lo_queue.ifq_maxlen = ifqmaxlen; + d->hi_queue.ifq_maxlen = ifqmaxlen; mtx_init (&d->lo_queue.ifq_mtx, "cx_queue_lo", NULL, MTX_DEF); mtx_init (&d->hi_queue.ifq_mtx, "cx_queue_hi", NULL, MTX_DEF); #else /*NETGRAPH*/ Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/cxgb/cxgb_main.c Mon May 3 07:32:50 2010 (r207554) @@ -1012,7 +1012,7 @@ cxgb_port_attach(device_t dev) ifp->if_ioctl = cxgb_ioctl; ifp->if_start = cxgb_start; - ifp->if_snd.ifq_drv_maxlen = cxgb_snd_queue_len; + ifp->if_snd.ifq_drv_maxlen = max(cxgb_snd_queue_len, ifqmaxlen); IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ed/if_ed.c Mon May 3 07:32:50 2010 (r207554) @@ -283,8 +283,8 @@ ed_attach(device_t dev) ifp->if_start = ed_start; ifp->if_ioctl = ed_ioctl; ifp->if_init = ed_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ifp->if_linkmib = &sc->mibdata; ifp->if_linkmiblen = sizeof sc->mibdata; Modified: head/sys/dev/ep/if_ep.c ============================================================================== --- head/sys/dev/ep/if_ep.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ep/if_ep.c Mon May 3 07:32:50 2010 (r207554) @@ -306,8 +306,8 @@ ep_attach(struct ep_softc *sc) ifp->if_start = epstart; ifp->if_ioctl = epioctl; ifp->if_init = epinit; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); callout_init_mtx(&sc->watchdog_timer, &sc->sc_mtx, 0); Modified: head/sys/dev/ex/if_ex.c ============================================================================== --- head/sys/dev/ex/if_ex.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ex/if_ex.c Mon May 3 07:32:50 2010 (r207554) @@ -237,7 +237,7 @@ ex_attach(device_t dev) ifp->if_start = ex_start; ifp->if_ioctl = ex_ioctl; ifp->if_init = ex_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ifmedia_init(&sc->ifmedia, 0, ex_ifmedia_upd, ex_ifmedia_sts); mtx_init(&sc->lock, device_get_nameunit(dev), MTX_NETWORK_LOCK, Modified: head/sys/dev/fe/if_fe.c ============================================================================== --- head/sys/dev/fe/if_fe.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/fe/if_fe.c Mon May 3 07:32:50 2010 (r207554) @@ -766,7 +766,7 @@ fe_attach (device_t dev) * Set fixed interface flags. */ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); #if FE_SINGLE_TRANSMISSION /* Override txb config to allocate minimum. */ Modified: head/sys/dev/ie/if_ie.c ============================================================================== --- head/sys/dev/ie/if_ie.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ie/if_ie.c Mon May 3 07:32:50 2010 (r207554) @@ -318,7 +318,7 @@ ie_attach(device_t dev) ifp->if_start = iestart; ifp->if_ioctl = ieioctl; ifp->if_init = ieinit; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ether_ifattach(ifp, sc->enaddr); Modified: head/sys/dev/iicbus/if_ic.c ============================================================================== --- head/sys/dev/iicbus/if_ic.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/iicbus/if_ic.c Mon May 3 07:32:50 2010 (r207554) @@ -181,7 +181,7 @@ icattach(device_t dev) ifp->if_output = icoutput; ifp->if_hdrlen = 0; ifp->if_addrlen = 0; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; ic_alloc_buffers(sc, ICMTU); Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ipw/if_ipw.c Mon May 3 07:32:50 2010 (r207554) @@ -289,8 +289,8 @@ ipw_attach(device_t dev) ifp->if_init = ipw_init; ifp->if_ioctl = ipw_ioctl; ifp->if_start = ipw_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/iwi/if_iwi.c Mon May 3 07:32:50 2010 (r207554) @@ -363,8 +363,8 @@ iwi_attach(device_t dev) ifp->if_init = iwi_init; ifp->if_ioctl = iwi_ioctl; ifp->if_start = iwi_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/iwn/if_iwn.c Mon May 3 07:32:50 2010 (r207554) @@ -627,8 +627,8 @@ iwn_attach(device_t dev) ifp->if_init = iwn_init; ifp->if_ioctl = iwn_ioctl; ifp->if_start = iwn_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ieee80211_ifattach(ic, macaddr); Modified: head/sys/dev/le/lance.c ============================================================================== --- head/sys/dev/le/lance.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/le/lance.c Mon May 3 07:32:50 2010 (r207554) @@ -133,8 +133,8 @@ lance_config(struct lance_softc *sc, con ifp->if_flags &= ~IFF_MULTICAST; #endif ifp->if_baudrate = IF_Mbps(10); - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); /* Initialize ifmedia structures. */ Modified: head/sys/dev/malo/if_malo.c ============================================================================== --- head/sys/dev/malo/if_malo.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/malo/if_malo.c Mon May 3 07:32:50 2010 (r207554) @@ -275,8 +275,8 @@ malo_attach(uint16_t devid, struct malo_ ifp->if_start = malo_start; ifp->if_ioctl = malo_ioctl; ifp->if_init = malo_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/mwl/if_mwl.c Mon May 3 07:32:50 2010 (r207554) @@ -404,8 +404,8 @@ mwl_attach(uint16_t devid, struct mwl_so ifp->if_start = mwl_start; ifp->if_ioctl = mwl_ioctl; ifp->if_init = mwl_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/my/if_my.c ============================================================================== --- head/sys/dev/my/if_my.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/my/if_my.c Mon May 3 07:32:50 2010 (r207554) @@ -902,8 +902,8 @@ my_attach(device_t dev) ifp->if_start = my_start; ifp->if_init = my_init; ifp->if_baudrate = 10000000; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); if (sc->my_info->my_did == MTD803ID) Modified: head/sys/dev/nxge/if_nxge.c ============================================================================== --- head/sys/dev/nxge/if_nxge.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/nxge/if_nxge.c Mon May 3 07:32:50 2010 (r207554) @@ -1190,7 +1190,7 @@ xge_interface_setup(device_t dev) ifnetp->if_start = xge_send; /* TODO: Check and assign optimal value */ - ifnetp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifnetp->if_snd.ifq_maxlen = ifqmaxlen; ifnetp->if_capabilities = IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM; Modified: head/sys/dev/pdq/pdq_ifsubr.c ============================================================================== --- head/sys/dev/pdq/pdq_ifsubr.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/pdq/pdq_ifsubr.c Mon May 3 07:32:50 2010 (r207554) @@ -471,7 +471,7 @@ pdq_ifattach(pdq_softc_t *sc, const pdq_ if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev)); ifp->if_softc = sc; ifp->if_init = pdq_ifinit; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_NOTRAILERS|IFF_MULTICAST; ifp->if_ioctl = pdq_ifioctl; Modified: head/sys/dev/ppbus/if_plip.c ============================================================================== --- head/sys/dev/ppbus/if_plip.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ppbus/if_plip.c Mon May 3 07:32:50 2010 (r207554) @@ -262,7 +262,7 @@ lp_attach(device_t dev) ifp->if_output = lpoutput; ifp->if_hdrlen = 0; ifp->if_addrlen = 0; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; if_attach(ifp); bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ral/rt2560.c Mon May 3 07:32:50 2010 (r207554) @@ -267,8 +267,8 @@ rt2560_attach(device_t dev, int id) ifp->if_init = rt2560_init; ifp->if_ioctl = rt2560_ioctl; ifp->if_start = rt2560_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/ral/rt2661.c Mon May 3 07:32:50 2010 (r207554) @@ -269,8 +269,8 @@ rt2661_attach(device_t dev, int id) ifp->if_init = rt2661_init; ifp->if_ioctl = rt2661_ioctl; ifp->if_start = rt2661_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/sbni/if_sbni.c ============================================================================== --- head/sys/dev/sbni/if_sbni.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/sbni/if_sbni.c Mon May 3 07:32:50 2010 (r207554) @@ -235,7 +235,7 @@ sbni_attach(struct sbni_softc *sc, int u ifp->if_init = sbni_init; ifp->if_start = sbni_start; ifp->if_ioctl = sbni_ioctl; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); /* report real baud rate */ csr0 = sbni_inb(sc, CSR0); Modified: head/sys/dev/smc/if_smc.c ============================================================================== --- head/sys/dev/smc/if_smc.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/smc/if_smc.c Mon May 3 07:32:50 2010 (r207554) @@ -347,7 +347,7 @@ smc_attach(device_t dev) ifp->if_init = smc_init; ifp->if_ioctl = smc_ioctl; ifp->if_start = smc_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = ifp->if_capenable = 0; Modified: head/sys/dev/sn/if_sn.c ============================================================================== --- head/sys/dev/sn/if_sn.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/sn/if_sn.c Mon May 3 07:32:50 2010 (r207554) @@ -207,8 +207,8 @@ sn_attach(device_t dev) ifp->if_ioctl = snioctl; ifp->if_init = sninit; ifp->if_baudrate = 10000000; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ether_ifattach(ifp, eaddr); Modified: head/sys/dev/snc/dp83932.c ============================================================================== --- head/sys/dev/snc/dp83932.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/snc/dp83932.c Mon May 3 07:32:50 2010 (r207554) @@ -177,7 +177,7 @@ sncconfig(sc, media, nmedia, defmedia, m ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_init = sncinit; ifp->if_mtu = ETHERMTU; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); /* Initialize media goo. */ ifmedia_init(&sc->sc_media, 0, snc_mediachange, Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/net/uhso.c Mon May 3 07:32:50 2010 (r207554) @@ -1471,8 +1471,8 @@ static int uhso_attach_ifnet(struct uhso ifp->if_output = uhso_if_output; ifp->if_flags = 0; ifp->if_softc = sc; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); if_attach(ifp); Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/net/usb_ethernet.c Mon May 3 07:32:50 2010 (r207554) @@ -214,8 +214,8 @@ ue_attach_post_task(struct usb_proc_msg ifp->if_ioctl = uether_ioctl; ifp->if_start = ue_start; ifp->if_init = ue_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ue->ue_ifp = ifp; Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/wlan/if_rum.c Mon May 3 07:32:50 2010 (r207554) @@ -478,8 +478,8 @@ rum_attach(device_t self) ifp->if_init = rum_init; ifp->if_ioctl = rum_ioctl; ifp->if_start = rum_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/wlan/if_run.c Mon May 3 07:32:50 2010 (r207554) @@ -609,8 +609,8 @@ run_attach(device_t self) ifp->if_init = run_init; ifp->if_ioctl = run_ioctl; ifp->if_start = run_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/wlan/if_uath.c Mon May 3 07:32:50 2010 (r207554) @@ -438,8 +438,8 @@ uath_attach(device_t dev) ifp->if_ioctl = uath_ioctl; ifp->if_start = uath_start; /* XXX UATH_TX_DATA_LIST_COUNT */ - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic = ifp->if_l2com; Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/wlan/if_upgt.c Mon May 3 07:32:50 2010 (r207554) @@ -331,7 +331,7 @@ upgt_attach(device_t dev) ifp->if_init = upgt_init; ifp->if_ioctl = upgt_ioctl; ifp->if_start = upgt_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); IFQ_SET_READY(&ifp->if_snd); ic = ifp->if_l2com; Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/wlan/if_ural.c Mon May 3 07:32:50 2010 (r207554) @@ -467,8 +467,8 @@ ural_attach(device_t self) ifp->if_init = ural_init; ifp->if_ioctl = ural_ioctl; ifp->if_start = ural_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/wlan/if_urtw.c Mon May 3 07:32:50 2010 (r207554) @@ -867,8 +867,8 @@ urtw_attach(device_t dev) ifp->if_ioctl = urtw_ioctl; ifp->if_start = urtw_start; /* XXX URTW_TX_DATA_LIST_COUNT */ - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic = ifp->if_l2com; Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/usb/wlan/if_zyd.c Mon May 3 07:32:50 2010 (r207554) @@ -381,7 +381,7 @@ zyd_attach(device_t dev) ifp->if_init = zyd_init; ifp->if_ioctl = zyd_ioctl; ifp->if_start = zyd_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); IFQ_SET_READY(&ifp->if_snd); ic = ifp->if_l2com; Modified: head/sys/dev/vx/if_vx.c ============================================================================== --- head/sys/dev/vx/if_vx.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/vx/if_vx.c Mon May 3 07:32:50 2010 (r207554) @@ -189,7 +189,7 @@ vx_attach(device_t dev) } ifp->if_mtu = ETHERMTU; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = vx_start; ifp->if_ioctl = vx_ioctl; Modified: head/sys/dev/wi/if_wi.c ============================================================================== --- head/sys/dev/wi/if_wi.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/wi/if_wi.c Mon May 3 07:32:50 2010 (r207554) @@ -333,8 +333,8 @@ wi_attach(device_t dev) ifp->if_ioctl = wi_ioctl; ifp->if_start = wi_start; ifp->if_init = wi_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; Modified: head/sys/dev/wl/if_wl.c ============================================================================== --- head/sys/dev/wl/if_wl.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/wl/if_wl.c Mon May 3 07:32:50 2010 (r207554) @@ -559,7 +559,7 @@ wlattach(device_t device) ifp->if_init = wlinit; ifp->if_start = wlstart; ifp->if_ioctl = wlioctl; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; /* no entries ifp->if_done ifp->if_reset Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/wpi/if_wpi.c Mon May 3 07:32:50 2010 (r207554) @@ -661,8 +661,8 @@ wpi_attach(device_t dev) ifp->if_init = wpi_init; ifp->if_ioctl = wpi_ioctl; ifp->if_start = wpi_start; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ieee80211_ifattach(ic, macaddr); Modified: head/sys/dev/xe/if_xe.c ============================================================================== --- head/sys/dev/xe/if_xe.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/dev/xe/if_xe.c Mon May 3 07:32:50 2010 (r207554) @@ -254,7 +254,7 @@ xe_attach(device_t dev) scp->ifp->if_ioctl = xe_ioctl; scp->ifp->if_init = xe_init; scp->ifp->if_baudrate = 100000000; - IFQ_SET_MAXLEN(&scp->ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&scp->ifp->if_snd, ifqmaxlen); /* Initialise the ifmedia structure */ ifmedia_init(scp->ifm, 0, xe_media_change, xe_media_status); Modified: head/sys/mips/adm5120/if_admsw.c ============================================================================== --- head/sys/mips/adm5120/if_admsw.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/mips/adm5120/if_admsw.c Mon May 3 07:32:50 2010 (r207554) @@ -540,8 +540,8 @@ admsw_attach(device_t dev) ifp->if_init = admsw_init; ifp->if_mtu = ETHERMTU; ifp->if_baudrate = IF_Mbps(100); - IFQ_SET_MAXLEN(&ifp->if_snd, max(ADMSW_NTXLDESC, IFQ_MAXLEN)); - ifp->if_snd.ifq_drv_maxlen = max(ADMSW_NTXLDESC, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&ifp->if_snd, max(ADMSW_NTXLDESC, ifqmaxlen)); + ifp->if_snd.ifq_drv_maxlen = max(ADMSW_NTXLDESC, ifqmaxlen); IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities |= IFCAP_VLAN_MTU; Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/mips/atheros/if_arge.c Mon May 3 07:32:50 2010 (r207554) @@ -312,8 +312,8 @@ arge_attach(device_t dev) sc->arge_if_flags = ifp->if_flags; /* XXX: add real size */ - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); ifp->if_capenable = ifp->if_capabilities; Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/net/if.c Mon May 3 07:32:50 2010 (r207554) @@ -104,6 +104,10 @@ struct ifindex_entry { SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers"); SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management"); +TUNABLE_INT("net.link.ifqmaxlen", &ifqmaxlen); +SYSCTL_UINT(_net_link, OID_AUTO, ifqmaxlen, CTLFLAG_RDTUN, + &ifqmaxlen, 0, "max send queue size"); + /* Log link state change events */ static int log_link_state_change = 1; Modified: head/sys/net/if_ef.c ============================================================================== --- head/sys/net/if_ef.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/net/if_ef.c Mon May 3 07:32:50 2010 (r207554) @@ -129,7 +129,7 @@ ef_attach(struct efnet *sc) ifp->if_start = ef_start; ifp->if_init = ef_init; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); /* * Attach the interface Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/net/if_gif.c Mon May 3 07:32:50 2010 (r207554) @@ -185,7 +185,7 @@ gif_clone_create(ifc, unit, params) GIF2IFP(sc)->if_ioctl = gif_ioctl; GIF2IFP(sc)->if_start = gif_start; GIF2IFP(sc)->if_output = gif_output; - GIF2IFP(sc)->if_snd.ifq_maxlen = IFQ_MAXLEN; + GIF2IFP(sc)->if_snd.ifq_maxlen = ifqmaxlen; if_attach(GIF2IFP(sc)); bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int32_t)); if (ng_gif_attach_p != NULL) Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/net/if_gre.c Mon May 3 07:32:50 2010 (r207554) @@ -184,7 +184,7 @@ gre_clone_create(ifc, unit, params) GRE2IFP(sc)->if_softc = sc; if_initname(GRE2IFP(sc), ifc->ifc_name, unit); - GRE2IFP(sc)->if_snd.ifq_maxlen = IFQ_MAXLEN; + GRE2IFP(sc)->if_snd.ifq_maxlen = ifqmaxlen; GRE2IFP(sc)->if_addrlen = 0; GRE2IFP(sc)->if_hdrlen = 24; /* IP + GRE */ GRE2IFP(sc)->if_mtu = GREMTU; Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/net/if_stf.c Mon May 3 07:32:50 2010 (r207554) @@ -252,7 +252,7 @@ stf_clone_create(struct if_clone *ifc, c ifp->if_mtu = IPV6_MMTU; ifp->if_ioctl = stf_ioctl; ifp->if_output = stf_output; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; if_attach(ifp); bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); return (0); Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/net80211/ieee80211.c Mon May 3 07:32:50 2010 (r207554) @@ -394,8 +394,8 @@ ieee80211_vap_setup(struct ieee80211com ifp->if_ioctl = ieee80211_ioctl; ifp->if_init = ieee80211_init; /* NB: input+output filled in by ether_ifattach */ - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); vap->iv_ifp = ifp; Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/netgraph/ng_eiface.c Mon May 3 07:32:50 2010 (r207554) @@ -369,7 +369,7 @@ ng_eiface_constructor(node_p node) ifp->if_output = ether_output; ifp->if_start = ng_eiface_start; ifp->if_ioctl = ng_eiface_ioctl; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST); /* Give this node the same name as the interface (if possible) */ Modified: head/sys/netgraph/ng_fec.c ============================================================================== --- head/sys/netgraph/ng_fec.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/netgraph/ng_fec.c Mon May 3 07:32:50 2010 (r207554) @@ -1227,7 +1227,7 @@ ng_fec_constructor(node_p node) ifp->if_start = ng_fec_start; ifp->if_ioctl = ng_fec_ioctl; ifp->if_init = ng_fec_init; - ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_mtu = NG_FEC_MTU_DEFAULT; ifp->if_flags = (IFF_SIMPLEX|IFF_BROADCAST|IFF_MULTICAST); ifp->if_addrlen = 0; /* XXX */ Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/netgraph/ng_iface.c Mon May 3 07:32:50 2010 (r207554) @@ -564,8 +564,8 @@ ng_iface_constructor(node_p node) ifp->if_addrlen = 0; /* XXX */ ifp->if_hdrlen = 0; /* XXX */ ifp->if_baudrate = 64000; /* XXX */ - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); /* Give this node the same name as the interface (if possible) */ Modified: head/sys/netgraph/ng_tty.c ============================================================================== --- head/sys/netgraph/ng_tty.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/netgraph/ng_tty.c Mon May 3 07:32:50 2010 (r207554) @@ -164,7 +164,7 @@ ngt_constructor(node_p node) sc->node = node; mtx_init(&sc->outq.ifq_mtx, "ng_tty node+queue", NULL, MTX_DEF); - IFQ_SET_MAXLEN(&sc->outq, IFQ_MAXLEN); + IFQ_SET_MAXLEN(&sc->outq, ifqmaxlen); return (0); } Modified: head/sys/pci/if_rl.c ============================================================================== --- head/sys/pci/if_rl.c Mon May 3 07:32:24 2010 (r207553) +++ head/sys/pci/if_rl.c Mon May 3 07:32:50 2010 (r207554) @@ -942,8 +942,8 @@ rl_attach(device_t dev) #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); /* From owner-svn-src-head@FreeBSD.ORG Mon May 3 07:39:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ADC29106566B; Mon, 3 May 2010 07:39:52 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9D93C8FC16; Mon, 3 May 2010 07:39:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o437dqbd012785; Mon, 3 May 2010 07:39:52 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o437dq0D012784; Mon, 3 May 2010 07:39:52 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005030739.o437dq0D012784@svn.freebsd.org> From: Martin Matuska Date: Mon, 3 May 2010 07:39:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207555 - head/lib/libpam/modules/pam_krb5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 07:39:52 -0000 Author: mm Date: Mon May 3 07:39:51 2010 New Revision: 207555 URL: http://svn.freebsd.org/changeset/base/207555 Log: Code indent according to style(9). PR: bin/146186 Submitted by: myself Approved by: delphij (mentor) MFC after: 2 weeks Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c ============================================================================== --- head/lib/libpam/modules/pam_krb5/pam_krb5.c Mon May 3 07:32:50 2010 (r207554) +++ head/lib/libpam/modules/pam_krb5/pam_krb5.c Mon May 3 07:39:51 2010 (r207555) @@ -199,33 +199,33 @@ pam_sm_authenticate(pam_handle_t *pamh, PAM_LOG("Skipping local user check"); else { - /* Verify the local user exists (AFTER getting the password) */ - if (strchr(user, '@')) { - /* get a local account name for this principal */ - krbret = krb5_aname_to_localname(pam_context, princ, - sizeof(luser), luser); - if (krbret != 0) { - PAM_VERBOSE_ERROR("Kerberos 5 error"); - PAM_LOG("Error krb5_aname_to_localname(): %s", - krb5_get_err_text(pam_context, krbret)); - retval = PAM_USER_UNKNOWN; - goto cleanup2; - } + /* Verify the local user exists (AFTER getting the password) */ + if (strchr(user, '@')) { + /* get a local account name for this principal */ + krbret = krb5_aname_to_localname(pam_context, princ, + sizeof(luser), luser); + if (krbret != 0) { + PAM_VERBOSE_ERROR("Kerberos 5 error"); + PAM_LOG("Error krb5_aname_to_localname(): %s", + krb5_get_err_text(pam_context, krbret)); + retval = PAM_USER_UNKNOWN; + goto cleanup2; + } - retval = pam_set_item(pamh, PAM_USER, luser); - if (retval != PAM_SUCCESS) - goto cleanup2; + retval = pam_set_item(pamh, PAM_USER, luser); + if (retval != PAM_SUCCESS) + goto cleanup2; - PAM_LOG("PAM_USER Redone"); - } + PAM_LOG("PAM_USER Redone"); + } - pwd = getpwnam(user); - if (pwd == NULL) { - retval = PAM_USER_UNKNOWN; - goto cleanup2; - } + pwd = getpwnam(user); + if (pwd == NULL) { + retval = PAM_USER_UNKNOWN; + goto cleanup2; + } - PAM_LOG("Done getpwnam()"); + PAM_LOG("Done getpwnam()"); } /* Get a TGT */ From owner-svn-src-head@FreeBSD.ORG Mon May 3 09:49:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C91EA1065676; Mon, 3 May 2010 09:49:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B89898FC20; Mon, 3 May 2010 09:49:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o439ngMq041366; Mon, 3 May 2010 09:49:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o439ngrZ041364; Mon, 3 May 2010 09:49:42 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201005030949.o439ngrZ041364@svn.freebsd.org> From: Xin LI Date: Mon, 3 May 2010 09:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207561 - head/lib/libpam/modules/pam_krb5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 09:49:42 -0000 Author: delphij Date: Mon May 3 09:49:42 2010 New Revision: 207561 URL: http://svn.freebsd.org/changeset/base/207561 Log: Bump .Dd date. Forgotten by: delphij Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.8 Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.8 ============================================================================== --- head/lib/libpam/modules/pam_krb5/pam_krb5.8 Mon May 3 09:46:47 2010 (r207560) +++ head/lib/libpam/modules/pam_krb5/pam_krb5.8 Mon May 3 09:49:42 2010 (r207561) @@ -1,7 +1,7 @@ .\" .\" $Id: pam_krb5.5,v 1.5 2000/01/05 00:59:56 fcusack Exp $ .\" $FreeBSD$ -.Dd January 15, 1999 +.Dd May 3, 2010 .Dt PAM_KRB5 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon May 3 14:19:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D897106566B; Mon, 3 May 2010 14:19:59 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 6D4788FC18; Mon, 3 May 2010 14:19:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43EJx49003479; Mon, 3 May 2010 14:19:59 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43EJwgV003478; Mon, 3 May 2010 14:19:58 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201005031419.o43EJwgV003478@svn.freebsd.org> From: Alexander Leidinger Date: Mon, 3 May 2010 14:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207569 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 14:19:59 -0000 Author: netchild Date: Mon May 3 14:19:58 2010 New Revision: 207569 URL: http://svn.freebsd.org/changeset/base/207569 Log: - #ifdef out the cliplist part, skype seems like using an uninitialized variable and can cause problems, without the cliplist handling it works without problems - improve the cliplist error handling - fix VIDIOCGTUNER and VIDIOCSMICROCODE (still no hardware available to test) Submitted by: J.R. Oldroyd X-MFC after: soon (together with all the v4l stuff) Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Mon May 3 12:43:17 2010 (r207568) +++ head/sys/compat/linux/linux_ioctl.c Mon May 3 14:19:58 2010 (r207569) @@ -2628,6 +2628,7 @@ bsd_to_linux_v4l_tuner(struct video_tune return (0); } +#ifdef COMPAT_LINUX_V4L_CLIPLIST static int linux_to_bsd_v4l_clip(struct l_video_clip *lvc, struct video_clip *vc) { @@ -2638,6 +2639,7 @@ linux_to_bsd_v4l_clip(struct l_video_cli vc->next = PTRIN(lvc->next); /* possible pointer size conversion */ return (0); } +#endif static int linux_to_bsd_v4l_window(struct l_video_window *lvw, struct video_window *vw) @@ -2698,6 +2700,7 @@ linux_to_bsd_v4l_code(struct l_video_cod return (0); } +#ifdef COMPAT_LINUX_V4L_CLIPLIST static int linux_v4l_clip_copy(void *lvc, struct video_clip **ppvc) { @@ -2772,15 +2775,18 @@ linux_v4l_cliplist_copy(struct l_video_w * example of cliplist use. */ plvc = PTRIN(lvw->clips); + vw->clips = NULL; ppvc = &(vw->clips); while (clipcount-- > 0) { - if (plvc == 0) + if (plvc == 0) { error = EFAULT; - if (!error) - error = linux_v4l_clip_copy(plvc, ppvc); - if (error) { - linux_v4l_cliplist_free(vw); break; + } else { + error = linux_v4l_clip_copy(plvc, ppvc); + if (error) { + linux_v4l_cliplist_free(vw); + break; + } } ppvc = &((*ppvc)->next); plvc = PTRIN(((struct l_video_clip *) plvc)->next); @@ -2795,6 +2801,7 @@ linux_v4l_cliplist_copy(struct l_video_w } return (error); } +#endif static int linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args) @@ -2818,6 +2825,12 @@ linux_ioctl_v4l(struct thread *td, struc case LINUX_VIDIOCGTUNER: if ((error = fget(td, args->fd, &fp)) != 0) return (error); + error = copyin((void *) args->arg, &l_vtun, sizeof(l_vtun)); + if (error) { + fdrop(fp, td); + return (error); + } + linux_to_bsd_v4l_tuner(&l_vtun, &vtun); error = fo_ioctl(fp, VIDIOCGTUNER, &vtun, td->td_ucred, td); if (!error) { bsd_to_linux_v4l_tuner(&vtun, &l_vtun); @@ -2836,7 +2849,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); } linux_to_bsd_v4l_tuner(&l_vtun, &vtun); - error = fo_ioctl(fp, VIDIOCSMICROCODE, &vtun, td->td_ucred, td); + error = fo_ioctl(fp, VIDIOCSTUNER, &vtun, td->td_ucred, td); fdrop(fp, td); return (error); @@ -2865,14 +2878,18 @@ linux_ioctl_v4l(struct thread *td, struc return (error); } linux_to_bsd_v4l_window(&l_vwin, &vwin); +#ifdef COMPAT_LINUX_V4L_CLIPLIST error = linux_v4l_cliplist_copy(&l_vwin, &vwin); if (error) { fdrop(fp, td); return (error); } +#endif error = fo_ioctl(fp, VIDIOCSWIN, &vwin, td->td_ucred, td); fdrop(fp, td); +#ifdef COMPAT_LINUX_V4L_CLIPLIST linux_v4l_cliplist_free(&vwin); +#endif return (error); case LINUX_VIDIOCGFBUF: @@ -2924,7 +2941,7 @@ linux_ioctl_v4l(struct thread *td, struc return (error); } linux_to_bsd_v4l_code(&l_vcode, &vcode); - error = fo_ioctl(fp, VIDIOCSTUNER, &vcode, td->td_ucred, td); + error = fo_ioctl(fp, VIDIOCSMICROCODE, &vcode, td->td_ucred, td); fdrop(fp, td); return (error); From owner-svn-src-head@FreeBSD.ORG Mon May 3 14:30:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8342C106566C; Mon, 3 May 2010 14:30:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 72F6C8FC12; Mon, 3 May 2010 14:30:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43EUnm4005863; Mon, 3 May 2010 14:30:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43EUnHB005861; Mon, 3 May 2010 14:30:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005031430.o43EUnHB005861@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 May 2010 14:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207570 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 14:30:49 -0000 Author: kib Date: Mon May 3 14:30:49 2010 New Revision: 207570 URL: http://svn.freebsd.org/changeset/base/207570 Log: Style and comment adjustements. Suggested and reviewed by: bde MFC after: 3 days Modified: head/sys/amd64/amd64/exception.S Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Mon May 3 14:19:58 2010 (r207569) +++ head/sys/amd64/amd64/exception.S Mon May 3 14:30:49 2010 (r207570) @@ -50,14 +50,14 @@ .bss .globl dtrace_invop_jump_addr .align 8 - .type dtrace_invop_jump_addr, @object - .size dtrace_invop_jump_addr, 8 + .type dtrace_invop_jump_addr,@object + .size dtrace_invop_jump_addr,8 dtrace_invop_jump_addr: .zero 8 .globl dtrace_invop_calltrap_addr .align 8 - .type dtrace_invop_calltrap_addr, @object - .size dtrace_invop_calltrap_addr, 8 + .type dtrace_invop_calltrap_addr,@object + .size dtrace_invop_calltrap_addr,8 dtrace_invop_calltrap_addr: .zero 8 #endif @@ -157,7 +157,6 @@ IDTVEC(align) * kernel from userland. Reenable interrupts if they were enabled * before the trap. This approximates SDT_SYS386TGT on the i386 port. */ - SUPERALIGN_TEXT .globl alltraps .type alltraps,@function @@ -211,16 +210,16 @@ alltraps_pushregs_no_rdi: * Set our jump address for the jump back in the event that * the breakpoint wasn't caused by DTrace at all. */ - movq $calltrap, dtrace_invop_calltrap_addr(%rip) + movq $calltrap,dtrace_invop_calltrap_addr(%rip) /* Jump to the code hooked in by DTrace. */ - movq dtrace_invop_jump_addr, %rax + movq dtrace_invop_jump_addr,%rax jmpq *dtrace_invop_jump_addr #endif .globl calltrap .type calltrap,@function calltrap: - movq %rsp, %rdi + movq %rsp,%rdi call trap MEXITCOUNT jmp doreti /* Handle any pending ASTs */ @@ -274,9 +273,11 @@ IDTVEC(dblfault) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs -1: movq %rsp, %rdi +1: + movq %rsp,%rdi call dblfault_handler -2: hlt +2: + hlt jmp 2b IDTVEC(page) @@ -369,7 +370,7 @@ IDTVEC(fast_syscall) movq %r15,TF_R15(%rsp) /* C preserved */ movl $TF_HASSEGS,TF_FLAGS(%rsp) FAKE_MCOUNT(TF_RIP(%rsp)) - movq %rsp, %rdi + movq %rsp,%rdi call syscall movq PCPU(CURPCB),%rax andq $~PCB_FULLCTX,PCB_FLAGS(%rax) @@ -456,7 +457,7 @@ nmi_fromuserspace: /* Note: this label is also used by ddb and gdb: */ nmi_calltrap: FAKE_MCOUNT(TF_RIP(%rsp)) - movq %rsp, %rdi + movq %rsp,%rdi call trap MEXITCOUNT #ifdef HWPMC_HOOKS @@ -555,9 +556,9 @@ nmi_restoreregs: iretq ENTRY(fork_trampoline) - movq %r12, %rdi /* function */ - movq %rbx, %rsi /* arg1 */ - movq %rsp, %rdx /* trapframe pointer */ + movq %r12,%rdi /* function */ + movq %rbx,%rsi /* arg1 */ + movq %rsp,%rdx /* trapframe pointer */ call fork_exit MEXITCOUNT jmp doreti /* Handle any ASTs */ @@ -628,7 +629,7 @@ doreti_ast: testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) je doreti_exit sti - movq %rsp, %rdi /* pass a pointer to the trapframe */ + movq %rsp,%rdi /* pass a pointer to the trapframe */ call ast jmp doreti_ast @@ -648,8 +649,8 @@ doreti_exit: * Do not reload segment registers for kernel. * Since we do not reload segments registers with sane * values on kernel entry, descriptors referenced by - * segments registers may be not valid. This is fatal - * for the usermode, but is innocent for the kernel. + * segments registers might be not valid. This is fatal + * for user mode, but is not a problem for the kernel. */ testb $SEL_RPL_MASK,TF_CS(%rsp) jz ld_regs @@ -662,14 +663,16 @@ do_segs: /* Restore %fs and fsbase */ movw TF_FS(%rsp),%ax .globl ld_fs -ld_fs: movw %ax,%fs +ld_fs: + movw %ax,%fs cmpw $KUF32SEL,%ax jne 1f movl $MSR_FSBASE,%ecx movl PCB_FSBASE(%r8),%eax movl PCB_FSBASE+4(%r8),%edx .globl ld_fsbase -ld_fsbase: wrmsr +ld_fsbase: + wrmsr 1: /* Restore %gs and gsbase */ movw TF_GS(%rsp),%si @@ -678,7 +681,8 @@ ld_fsbase: wrmsr movl $MSR_GSBASE,%ecx rdmsr .globl ld_gs -ld_gs: movw %si,%gs +ld_gs: + movw %si,%gs wrmsr popfq cmpw $KUG32SEL,%si @@ -687,12 +691,17 @@ ld_gs: movw %si,%gs movl PCB_GSBASE(%r8),%eax movl PCB_GSBASE+4(%r8),%edx .globl ld_gsbase -ld_gsbase: wrmsr -1: .globl ld_es -ld_es: movw TF_ES(%rsp),%es +ld_gsbase: + wrmsr +1: + .globl ld_es +ld_es: + movw TF_ES(%rsp),%es .globl ld_ds -ld_ds: movw TF_DS(%rsp),%ds -ld_regs:movq TF_RDI(%rsp),%rdi +ld_ds: + movw TF_DS(%rsp),%ds +ld_regs: + movq TF_RDI(%rsp),%rdi movq TF_RSI(%rsp),%rsi movq TF_RDX(%rsp),%rdx movq TF_RCX(%rsp),%rcx @@ -711,7 +720,8 @@ ld_regs:movq TF_RDI(%rsp),%rdi jz 1f /* keep running with kernel GS.base */ cli swapgs -1: addq $TF_RIP,%rsp /* skip over tf_err, tf_trapno */ +1: + addq $TF_RIP,%rsp /* skip over tf_err, tf_trapno */ .globl doreti_iret doreti_iret: iretq @@ -738,7 +748,8 @@ doreti_iret_fault: testl $PSL_I,TF_RFLAGS(%rsp) jz 1f sti -1: movw %fs,TF_FS(%rsp) +1: + movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) @@ -768,7 +779,7 @@ doreti_iret_fault: .globl ds_load_fault ds_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movq %rsp, %rdi + movq %rsp,%rdi call trap movw $KUDSEL,TF_DS(%rsp) jmp doreti @@ -777,7 +788,7 @@ ds_load_fault: .globl es_load_fault es_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movq %rsp, %rdi + movq %rsp,%rdi call trap movw $KUDSEL,TF_ES(%rsp) jmp doreti @@ -786,7 +797,7 @@ es_load_fault: .globl fs_load_fault fs_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movq %rsp, %rdi + movq %rsp,%rdi call trap movw $KUF32SEL,TF_FS(%rsp) jmp doreti @@ -796,7 +807,7 @@ fs_load_fault: gs_load_fault: popfq movl $T_PROTFLT,TF_TRAPNO(%rsp) - movq %rsp, %rdi + movq %rsp,%rdi call trap movw $KUG32SEL,TF_GS(%rsp) jmp doreti @@ -805,7 +816,7 @@ gs_load_fault: .globl fsbase_load_fault fsbase_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movq %rsp, %rdi + movq %rsp,%rdi call trap movq PCPU(CURTHREAD),%r8 movq TD_PCB(%r8),%r8 @@ -816,7 +827,7 @@ fsbase_load_fault: .globl gsbase_load_fault gsbase_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movq %rsp, %rdi + movq %rsp,%rdi call trap movq PCPU(CURTHREAD),%r8 movq TD_PCB(%r8),%r8 From owner-svn-src-head@FreeBSD.ORG Mon May 3 14:40:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 75A8F106566B; Mon, 3 May 2010 14:40:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 496898FC1A; Mon, 3 May 2010 14:40:21 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 00D7946B0C; Mon, 3 May 2010 10:40:21 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 1540A8A021; Mon, 3 May 2010 10:40:20 -0400 (EDT) From: John Baldwin To: Edwin Groothuis Date: Mon, 3 May 2010 10:15:33 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <201005010905.o4195600065956@svn.freebsd.org> In-Reply-To: <201005010905.o4195600065956@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201005031015.33773.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 03 May 2010 10:40:20 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207462 - head/sbin/tunefs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 14:40:21 -0000 On Saturday 01 May 2010 5:05:06 am Edwin Groothuis wrote: > Author: edwin > Date: Sat May 1 09:05:06 2010 > New Revision: 207462 > URL: http://svn.freebsd.org/changeset/base/207462 > > Log: > Improve usage of tunefs: > > Document -j switch in usage() to reflect recent SUJ work. > > Submitted by: Alastair Hogge > MFC after: 1 week -S is missing as well FWIW. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon May 3 14:40:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C21541065673; Mon, 3 May 2010 14:40:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 926CE8FC2C; Mon, 3 May 2010 14:40:22 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 466D046B2C; Mon, 3 May 2010 10:40:22 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 7EB358A025; Mon, 3 May 2010 10:40:21 -0400 (EDT) From: John Baldwin To: "M. Warner Losh" Date: Mon, 3 May 2010 10:21:03 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <201005011636.o41GaFsK084343@svn.freebsd.org> <9624CC6A-EEB1-4492-9E62-7ACD0BF6F39C@gsoft.com.au> <20100501.194758.49280345204940330.imp@bsdimp.com> In-Reply-To: <20100501.194758.49280345204940330.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201005031021.03746.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 03 May 2010 10:40:21 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, doconnor@gsoft.com.au, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207472 - in head/sys: conf dev/ath/ath_hal/ar5212 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 14:40:22 -0000 On Saturday 01 May 2010 9:47:58 pm M. Warner Losh wrote: > In message: <9624CC6A-EEB1-4492-9E62-7ACD0BF6F39C@gsoft.com.au> > "Daniel O'Connor" writes: > : > : On 02/05/2010, at 2:06 AM, Warner Losh wrote: > : > Unfortunately, this condition is impossible to detect at runtime > : > without MIPS specific ifdefs. Rather than cast an overly-broad net > : > like Linux/OpenWRT dues (which enables this workaround all the time on > : > MIPS32 platforms), we put this option in the kernel for just the > : > affected machines. Sam didn't like this aspect of the patch when he > : > reviewed it, and I'd love to hear sane proposals on how to fix it :) > : > : Could you do TUNABLE_INT in the MIPS code and TUNABLE_INT_FETCH in ath_hal? > > How is that better than a kernel option? The only place this would > ever happen is atheros AR71xx SoC. It isn't like some of the Atheros > 71xx SoCs would have it and some wouldn't. > > And besides, kenv has to be compiled into the kernel on MIPS these > days... > > The only thing close to an idea I've had is to add: > > __weak int > ath_needs_dma_war() > { > return 0; > } > > and have this in the mips: > > int needs_ath_dma_war = 0; > __weak int ath_needs_dma_war() > { > return needs_ath_dma_war; > } > > and set it to 1 in the AR71xx CPU initialization. But that seemed > kind of lame... I think a kernel option is fine for this case. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon May 3 15:52:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39C251065670; Mon, 3 May 2010 15:52:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2A4588FC08; Mon, 3 May 2010 15:52:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43Fq0Z4023572; Mon, 3 May 2010 15:52:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43Fq06a023570; Mon, 3 May 2010 15:52:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005031552.o43Fq06a023570@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 15:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207571 - head/sys/dev/ti X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 15:52:00 -0000 Author: alc Date: Mon May 3 15:51:59 2010 New Revision: 207571 URL: http://svn.freebsd.org/changeset/base/207571 Log: Neither the page lock nor the page queues lock is required to unwire and free a VM_ALLOC_NOOBJ page. (Such pages are unmanaged.) Modified: head/sys/dev/ti/if_ti.c Modified: head/sys/dev/ti/if_ti.c ============================================================================== --- head/sys/dev/ti/if_ti.c Mon May 3 14:30:49 2010 (r207570) +++ head/sys/dev/ti/if_ti.c Mon May 3 15:51:59 2010 (r207571) @@ -1488,10 +1488,8 @@ ti_newbuf_jumbo(sc, idx, m_old) } sf[i] = sf_buf_alloc(frame, SFB_NOWAIT); if (sf[i] == NULL) { - vm_page_lock_queues(); vm_page_unwire(frame, 0); vm_page_free(frame); - vm_page_unlock_queues(); device_printf(sc->ti_dev, "buffer allocation " "failed -- packet dropped!\n"); printf(" index %d page %d\n", idx, i); From owner-svn-src-head@FreeBSD.ORG Mon May 3 16:08:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D113106564A; Mon, 3 May 2010 16:08:24 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 5D3338FC19; Mon, 3 May 2010 16:08:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43G8OPi027242; Mon, 3 May 2010 16:08:24 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43G8OKA027240; Mon, 3 May 2010 16:08:24 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201005031608.o43G8OKA027240@svn.freebsd.org> From: Marko Zec Date: Mon, 3 May 2010 16:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207572 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 16:08:24 -0000 Author: zec Date: Mon May 3 16:08:24 2010 New Revision: 207572 URL: http://svn.freebsd.org/changeset/base/207572 Log: When destroying a vnet, shut down all netgraph nodes tied to that vnet before proceeding with dismantling other protocol domains. This change only affects options VIMAGE builds. Reviewed by: julian, bz MFC after: 3 days Modified: head/sys/netgraph/ng_base.c Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Mon May 3 15:51:59 2010 (r207571) +++ head/sys/netgraph/ng_base.c Mon May 3 16:08:24 2010 (r207572) @@ -3067,28 +3067,42 @@ ng_mod_event(module_t mod, int event, vo static void vnet_netgraph_uninit(const void *unused __unused) { -#if 0 - node_p node, last_killed = NULL; + node_p node = NULL, last_killed = NULL; + int i; + + do { + /* Find a node to kill */ + mtx_lock(&ng_namehash_mtx); + for (i = 0; i < NG_NAME_HASH_SIZE; i++) { + LIST_FOREACH(node, &V_ng_name_hash[i], nd_nodes) { + if (node != &ng_deadnode) { + NG_NODE_REF(node); + break; + } + } + if (node != NULL) + break; + } + mtx_unlock(&ng_namehash_mtx); - /* XXXRW: utterly bogus. */ - while ((node = LIST_FIRST(&V_ng_allnodes)) != NULL) { - if (node == last_killed) { - /* This should never happen */ - node->nd_flags |= NGF_REALLY_DIE; - printf("netgraph node %s needs NGF_REALLY_DIE\n", - node->nd_name); + /* Attempt to kill it only if it is a regular node */ + if (node != NULL) { + if (node == last_killed) { + /* This should never happen */ + printf("ng node %s needs" + "NGF_REALLY_DIE\n", node->nd_name); + if (node->nd_flags & NGF_REALLY_DIE) + panic("ng node %s won't die", + node->nd_name); + node->nd_flags |= NGF_REALLY_DIE; + } ng_rmnode(node, NULL, NULL, 0); - /* This must never happen */ - if (node == LIST_FIRST(&V_ng_allnodes)) - panic("netgraph node %s won't die", - node->nd_name); + NG_NODE_UNREF(node); + last_killed = node; } - ng_rmnode(node, NULL, NULL, 0); - last_killed = node; - } -#endif + } while (node != NULL); } -VNET_SYSUNINIT(vnet_netgraph_uninit, SI_SUB_NETGRAPH, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_netgraph_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, vnet_netgraph_uninit, NULL); #endif /* VIMAGE */ From owner-svn-src-head@FreeBSD.ORG Mon May 3 16:41:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04F7E106566C; Mon, 3 May 2010 16:41:12 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D10838FC29; Mon, 3 May 2010 16:41:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43GfBmE034430; Mon, 3 May 2010 16:41:11 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43GfBjj034427; Mon, 3 May 2010 16:41:11 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005031641.o43GfBjj034427@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 16:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207573 - in head/sys: fs/tmpfs kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 16:41:12 -0000 Author: alc Date: Mon May 3 16:41:11 2010 New Revision: 207573 URL: http://svn.freebsd.org/changeset/base/207573 Log: Acquire the page lock around vm_page_unwire() and vm_page_wire(). Reviewed by: kib Modified: head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/vfs_bio.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Mon May 3 16:08:24 2010 (r207572) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Mon May 3 16:41:11 2010 (r207573) @@ -460,9 +460,11 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p error = uiomove_fromphys(&m, offset, tlen, uio); VM_OBJECT_LOCK(tobj); out: + vm_page_lock(m); vm_page_lock_queues(); vm_page_unwire(m, TRUE); vm_page_unlock_queues(); + vm_page_unlock(m); vm_page_wakeup(m); vm_object_pip_subtract(tobj, 1); VM_OBJECT_UNLOCK(tobj); @@ -691,6 +693,7 @@ nocache: out: if (vobj != NULL) VM_OBJECT_LOCK(vobj); + vm_page_lock(tpg); vm_page_lock_queues(); if (error == 0) { KASSERT(tpg->valid == VM_PAGE_BITS_ALL, @@ -699,6 +702,7 @@ out: } vm_page_unwire(tpg, TRUE); vm_page_unlock_queues(); + vm_page_unlock(tpg); vm_page_wakeup(tpg); if (vpg != NULL) vm_page_wakeup(vpg); Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon May 3 16:08:24 2010 (r207572) +++ head/sys/kern/vfs_bio.c Mon May 3 16:41:11 2010 (r207573) @@ -2942,7 +2942,6 @@ allocbuf(struct buf *bp, int size) vm_page_t m; VM_OBJECT_LOCK(bp->b_bufobj->bo_object); - vm_page_lock_queues(); for (i = desiredpages; i < bp->b_npages; i++) { /* * the page is not freed here -- it @@ -2952,13 +2951,17 @@ allocbuf(struct buf *bp, int size) m = bp->b_pages[i]; KASSERT(m != bogus_page, ("allocbuf: bogus page found")); - while (vm_page_sleep_if_busy(m, TRUE, "biodep")) - vm_page_lock_queues(); + while (vm_page_sleep_if_busy(m, TRUE, + "biodep")) + continue; bp->b_pages[i] = NULL; + vm_page_lock(m); + vm_page_lock_queues(); vm_page_unwire(m, 0); + vm_page_unlock_queues(); + vm_page_unlock(m); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); pmap_qremove((vm_offset_t) trunc_page((vm_offset_t)bp->b_data) + (desiredpages << PAGE_SHIFT), (bp->b_npages - desiredpages)); @@ -3039,9 +3042,11 @@ allocbuf(struct buf *bp, int size) /* * We have a good page. */ + vm_page_lock(m); vm_page_lock_queues(); vm_page_wire(m); vm_page_unlock_queues(); + vm_page_unlock(m); bp->b_pages[bp->b_npages] = m; ++bp->b_npages; } From owner-svn-src-head@FreeBSD.ORG Mon May 3 16:55:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 30ABA106566C; Mon, 3 May 2010 16:55:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 20DB78FC29; Mon, 3 May 2010 16:55:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43GtpVX037714; Mon, 3 May 2010 16:55:51 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43GtoYK037710; Mon, 3 May 2010 16:55:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005031655.o43GtoYK037710@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 16:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207574 - in head/sys/dev: agp drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 16:55:51 -0000 Author: alc Date: Mon May 3 16:55:50 2010 New Revision: 207574 URL: http://svn.freebsd.org/changeset/base/207574 Log: Acquire the page lock around vm_page_unwire(). For consistency, extend the scope of the object lock in agp_i810.c. (In this specific case, the scope of the object lock shouldn't matter, but I don't want to create a bad example that might be copied to a case where it did matter.) Reviewed by: kib Modified: head/sys/dev/agp/agp.c head/sys/dev/agp/agp_i810.c head/sys/dev/drm/via_dmablit.c Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Mon May 3 16:41:11 2010 (r207573) +++ head/sys/dev/agp/agp.c Mon May 3 16:55:50 2010 (r207574) @@ -623,9 +623,11 @@ bad: m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(k)); if (k >= i) vm_page_wakeup(m); + vm_page_lock(m); vm_page_lock_queues(); vm_page_unwire(m, 0); vm_page_unlock_queues(); + vm_page_unlock(m); } VM_OBJECT_UNLOCK(mem->am_obj); @@ -657,9 +659,11 @@ agp_generic_unbind_memory(device_t dev, VM_OBJECT_LOCK(mem->am_obj); for (i = 0; i < mem->am_size; i += PAGE_SIZE) { m = vm_page_lookup(mem->am_obj, atop(i)); + vm_page_lock(m); vm_page_lock_queues(); vm_page_unwire(m, 0); vm_page_unlock_queues(); + vm_page_unlock(m); } VM_OBJECT_UNLOCK(mem->am_obj); Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Mon May 3 16:41:11 2010 (r207573) +++ head/sys/dev/agp/agp_i810.c Mon May 3 16:55:50 2010 (r207574) @@ -1010,10 +1010,12 @@ agp_i810_free_memory(device_t dev, struc VM_OBJECT_LOCK(mem->am_obj); m = vm_page_lookup(mem->am_obj, 0); - VM_OBJECT_UNLOCK(mem->am_obj); + vm_page_lock(m); vm_page_lock_queues(); vm_page_unwire(m, 0); vm_page_unlock_queues(); + vm_page_unlock(m); + VM_OBJECT_UNLOCK(mem->am_obj); } else { contigfree(sc->argb_cursor, mem->am_size, M_AGP); sc->argb_cursor = NULL; Modified: head/sys/dev/drm/via_dmablit.c ============================================================================== --- head/sys/dev/drm/via_dmablit.c Mon May 3 16:41:11 2010 (r207573) +++ head/sys/dev/drm/via_dmablit.c Mon May 3 16:55:50 2010 (r207574) @@ -178,9 +178,11 @@ via_free_sg_info(drm_via_sg_info_t *vsg) case dr_via_pages_locked: for (i=0; i < vsg->num_pages; ++i) { if ( NULL != (page = vsg->pages[i])) { + vm_page_lock(page); vm_page_lock_queues(); vm_page_unwire(page, 0); vm_page_unlock_queues(); + vm_page_unlock(page); } } case dr_via_pages_alloc: From owner-svn-src-head@FreeBSD.ORG Mon May 3 17:35:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03CB9106566B; Mon, 3 May 2010 17:35:32 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E846F8FC12; Mon, 3 May 2010 17:35:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43HZVc7046525; Mon, 3 May 2010 17:35:31 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43HZV6V046523; Mon, 3 May 2010 17:35:31 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005031735.o43HZV6V046523@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 17:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207576 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 17:35:32 -0000 Author: alc Date: Mon May 3 17:35:31 2010 New Revision: 207576 URL: http://svn.freebsd.org/changeset/base/207576 Log: It makes more sense for the object-based backend allocator to use OBJT_PHYS objects instead of OBJT_DEFAULT objects because we never reclaim or pageout the allocated pages. Moreover, they are mapped with pmap_qenter(), which creates unmanaged mappings. Reviewed by: kib Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Mon May 3 17:34:12 2010 (r207575) +++ head/sys/vm/uma_core.c Mon May 3 17:35:31 2010 (r207576) @@ -1022,12 +1022,8 @@ obj_alloc(uma_zone_t zone, int bytes, u_ while (pages != startpages) { pages--; p = TAILQ_LAST(&object->memq, pglist); - vm_page_lock(p); - vm_page_lock_queues(); vm_page_unwire(p, 0); vm_page_free(p); - vm_page_unlock_queues(); - vm_page_unlock(p); } retkva = 0; goto done; @@ -2893,13 +2889,11 @@ uma_zone_set_obj(uma_zone_t zone, struct if (kva == 0) return (0); - if (obj == NULL) { - obj = vm_object_allocate(OBJT_DEFAULT, - pages); - } else { + if (obj == NULL) + obj = vm_object_allocate(OBJT_PHYS, pages); + else { VM_OBJECT_LOCK_INIT(obj, "uma object"); - _vm_object_allocate(OBJT_DEFAULT, - pages, obj); + _vm_object_allocate(OBJT_PHYS, pages, obj); } ZONE_LOCK(zone); keg->uk_kva = kva; From owner-svn-src-head@FreeBSD.ORG Mon May 3 17:55:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C11D4106566B; Mon, 3 May 2010 17:55:32 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B1BF48FC1F; Mon, 3 May 2010 17:55:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43HtW2Q050923; Mon, 3 May 2010 17:55:32 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43HtWBZ050921; Mon, 3 May 2010 17:55:32 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005031755.o43HtWBZ050921@svn.freebsd.org> From: Alan Cox Date: Mon, 3 May 2010 17:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207577 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 17:55:32 -0000 Author: alc Date: Mon May 3 17:55:32 2010 New Revision: 207577 URL: http://svn.freebsd.org/changeset/base/207577 Log: Acquire the page lock around vm_page_wire() in vm_page_grab(). Assert that the page lock is held in vm_page_wire(). Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon May 3 17:35:31 2010 (r207576) +++ head/sys/vm/vm_page.c Mon May 3 17:55:32 2010 (r207577) @@ -1544,6 +1544,7 @@ vm_page_wire(vm_page_t m) * it is already off the queues). */ mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if (m->flags & PG_FICTITIOUS) return; if (m->wire_count == 0) { @@ -1914,9 +1915,11 @@ retrylookup: goto retrylookup; } else { if ((allocflags & VM_ALLOC_WIRED) != 0) { + vm_page_lock(m); vm_page_lock_queues(); vm_page_wire(m); vm_page_unlock_queues(); + vm_page_unlock(m); } if ((allocflags & VM_ALLOC_NOBUSY) == 0) vm_page_busy(m); From owner-svn-src-head@FreeBSD.ORG Mon May 3 18:04:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E74171065676; Mon, 3 May 2010 18:04:17 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D70DB8FC14; Mon, 3 May 2010 18:04:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43I4HDK052913; Mon, 3 May 2010 18:04:17 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43I4HYV052911; Mon, 3 May 2010 18:04:17 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201005031804.o43I4HYV052911@svn.freebsd.org> From: Alexander Kabaev Date: Mon, 3 May 2010 18:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207578 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 18:04:18 -0000 Author: kan Date: Mon May 3 18:04:17 2010 New Revision: 207578 URL: http://svn.freebsd.org/changeset/base/207578 Log: Do not encode more than CTF_MAX_VLEN(1023) enum members. CTF can not represent enums with more than CTF_MAX_VLEN members, but ctfconvert will happily ignore that limitation and create CTF section no other tool can interpret. This change is different from similar change from upstream, which just returns an error if big enum is encountered. Doing that means that every FreeBSD kernel with compiled in hwpmc will have no useable CTF information due to pmc_event enum having 1236+ members. Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Mon May 3 17:55:32 2010 (r207577) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Mon May 3 18:04:17 2010 (r207578) @@ -355,14 +355,21 @@ write_type(void *arg1, void *arg2) for (i = 0, ep = tp->t_emem; ep != NULL; ep = ep->el_next) i++; /* count up enum members */ + if (i > CTF_MAX_VLEN) { + warning("enum %s has too many values: %d > %d\n", + tdesc_name(tp), i, CTF_MAX_VLEN); + i = CTF_MAX_VLEN; + } + ctt.ctt_info = CTF_TYPE_INFO(CTF_K_ENUM, isroot, i); write_sized_type_rec(b, &ctt, tp->t_size); - for (ep = tp->t_emem; ep != NULL; ep = ep->el_next) { + for (ep = tp->t_emem; ep != NULL && i > 0; ep = ep->el_next) { offset = strtab_insert(&b->ctb_strtab, ep->el_name); cte.cte_name = CTF_TYPE_NAME(CTF_STRTAB_0, offset); cte.cte_value = ep->el_number; ctf_buf_write(b, &cte, sizeof (cte)); + i--; } break; From owner-svn-src-head@FreeBSD.ORG Mon May 3 18:39:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E03AA1065674; Mon, 3 May 2010 18:39:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D03868FC13; Mon, 3 May 2010 18:39:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43Ide5U060701; Mon, 3 May 2010 18:39:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43IdeNa060700; Mon, 3 May 2010 18:39:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005031839.o43IdeNa060700@svn.freebsd.org> From: Marius Strobl Date: Mon, 3 May 2010 18:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207579 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 18:39:41 -0000 Author: marius Date: Mon May 3 18:39:40 2010 New Revision: 207579 URL: http://svn.freebsd.org/changeset/base/207579 Log: On sparc64 obtain the initiator ID from the Open Firmware device tree in order to match what the PROM built-in driver uses. Approved by: mjacob Modified: head/sys/dev/isp/isp_pci.c head/sys/dev/isp/isp_sbus.c Modified: head/sys/dev/isp/isp_pci.c ============================================================================== --- head/sys/dev/isp/isp_pci.c Mon May 3 18:04:17 2010 (r207578) +++ head/sys/dev/isp/isp_pci.c Mon May 3 18:39:40 2010 (r207579) @@ -46,6 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __sparc64__ +#include +#include +#endif + #include static uint32_t isp_pci_rd_reg(ispsoftc_t *, int); @@ -517,7 +522,11 @@ isp_get_specific_options(device_t dev, i if (IS_FC(isp)) { ISP_FC_PC(isp, chan)->default_id = 109 - chan; } else { +#ifdef __sparc64__ + ISP_SPI_PC(isp, chan)->iid = OF_getscsinitid(dev); +#else ISP_SPI_PC(isp, chan)->iid = 7; +#endif } } else { if (IS_FC(isp)) { Modified: head/sys/dev/isp/isp_sbus.c ============================================================================== --- head/sys/dev/isp/isp_sbus.c Mon May 3 18:04:17 2010 (r207578) +++ head/sys/dev/isp/isp_sbus.c Mon May 3 18:39:40 2010 (r207579) @@ -41,8 +41,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include #include @@ -264,11 +266,7 @@ isp_sbus_attach(device_t dev) isp->isp_confopts |= ISP_CFG_OWNLOOPID; } if (default_id == -1) { - /* - * XXX: should be a way to get properties w/o having - * XXX: to call OF_xxx functions - */ - default_id = 7; + default_id = OF_getscsinitid(dev); } ISP_SPI_PC(isp, 0)->iid = default_id; From owner-svn-src-head@FreeBSD.ORG Mon May 3 19:19:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3413D1065670; Mon, 3 May 2010 19:19:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 241B98FC1C; Mon, 3 May 2010 19:19:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43JJxSB069646; Mon, 3 May 2010 19:19:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43JJxu5069644; Mon, 3 May 2010 19:19:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005031919.o43JJxu5069644@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 May 2010 19:19:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207580 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 19:19:59 -0000 Author: kib Date: Mon May 3 19:19:58 2010 New Revision: 207580 URL: http://svn.freebsd.org/changeset/base/207580 Log: Handle busy status of the page in a way expected for pager_getpage(). Flush requested page, unbusy other pages, do not clear m->busy. Reviewed by: alc MFC after: 1 week Modified: head/sys/vm/phys_pager.c Modified: head/sys/vm/phys_pager.c ============================================================================== --- head/sys/vm/phys_pager.c Mon May 3 18:39:40 2010 (r207579) +++ head/sys/vm/phys_pager.c Mon May 3 19:19:58 2010 (r207580) @@ -152,10 +152,10 @@ phys_pager_getpages(vm_object_t object, KASSERT(m[i]->dirty == 0, ("phys_pager_getpages: dirty page %p", m[i])); /* The requested page must remain busy, the others not. */ - if (reqpage != i) { - m[i]->oflags &= ~VPO_BUSY; - m[i]->busy = 0; - } + if (i == reqpage) + vm_page_flash(m[i]); + else + vm_page_wakeup(m[i]); } return (VM_PAGER_OK); } From owner-svn-src-head@FreeBSD.ORG Mon May 3 20:31:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 366E61065676; Mon, 3 May 2010 20:31:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 24E1C8FC1D; Mon, 3 May 2010 20:31:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43KVECC085474; Mon, 3 May 2010 20:31:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43KVD43085468; Mon, 3 May 2010 20:31:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005032031.o43KVD43085468@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 3 May 2010 20:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207584 - in head/sys: dev/md fs/nfsclient fs/nwfs fs/smbfs nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 20:31:14 -0000 Author: kib Date: Mon May 3 20:31:13 2010 New Revision: 207584 URL: http://svn.freebsd.org/changeset/base/207584 Log: Lock the page around vm_page_activate() and vm_page_deactivate() calls where it was missed. The wrapped fragments now protect wire_count with page lock. Reviewed by: alc Modified: head/sys/dev/md/md.c head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/nfsclient/nfs_bio.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon May 3 19:56:52 2010 (r207583) +++ head/sys/dev/md/md.c Mon May 3 20:31:13 2010 (r207584) @@ -665,11 +665,13 @@ mdstart_swap(struct md_s *sc, struct bio sf_buf_free(sf); sched_unpin(); vm_page_wakeup(m); + vm_page_lock(m); vm_page_lock_queues(); vm_page_activate(m); if (bp->bio_cmd == BIO_WRITE) vm_page_dirty(m); vm_page_unlock_queues(); + vm_page_unlock(m); /* Actions on further pages start at offset 0 */ p += PAGE_SIZE - offs; Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Mon May 3 19:56:52 2010 (r207583) +++ head/sys/fs/nfsclient/nfs_clbio.c Mon May 3 20:31:13 2010 (r207584) @@ -192,12 +192,14 @@ ncl_getpages(struct vop_getpages_args *a size = count - uio.uio_resid; VM_OBJECT_LOCK(object); - vm_page_lock_queues(); for (i = 0, toff = 0; i < npages; i++, toff = nextoff) { vm_page_t m; nextoff = toff + PAGE_SIZE; m = pages[i]; + vm_page_lock(m); + vm_page_lock_queues(); + if (nextoff <= size) { /* * Read operation filled an entire page @@ -244,8 +246,10 @@ ncl_getpages(struct vop_getpages_args *a vm_page_free(m); } } + + vm_page_unlock_queues(); + vm_page_unlock(m); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return (0); } Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Mon May 3 19:56:52 2010 (r207583) +++ head/sys/fs/nwfs/nwfs_io.c Mon May 3 20:31:13 2010 (r207584) @@ -449,12 +449,14 @@ nwfs_getpages(ap) size = count - uio.uio_resid; - vm_page_lock_queues(); for (i = 0, toff = 0; i < npages; i++, toff = nextoff) { vm_page_t m; nextoff = toff + PAGE_SIZE; m = pages[i]; + vm_page_lock(m); + vm_page_lock_queues(); + if (nextoff <= size) { m->valid = VM_PAGE_BITS_ALL; KASSERT(m->dirty == 0, @@ -489,8 +491,10 @@ nwfs_getpages(ap) vm_page_free(m); } } + + vm_page_unlock_queues(); + vm_page_unlock(m); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return 0; #endif /* NWFS_RWCACHE */ Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Mon May 3 19:56:52 2010 (r207583) +++ head/sys/fs/smbfs/smbfs_io.c Mon May 3 20:31:13 2010 (r207584) @@ -500,12 +500,14 @@ smbfs_getpages(ap) size = count - uio.uio_resid; - vm_page_lock_queues(); for (i = 0, toff = 0; i < npages; i++, toff = nextoff) { vm_page_t m; nextoff = toff + PAGE_SIZE; m = pages[i]; + vm_page_lock(m); + vm_page_lock_queues(); + if (nextoff <= size) { /* * Read operation filled an entire page @@ -553,8 +555,10 @@ smbfs_getpages(ap) vm_page_free(m); } } + + vm_page_unlock_queues(); + vm_page_unlock(m); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return 0; #endif /* SMBFS_RWGENERIC */ Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Mon May 3 19:56:52 2010 (r207583) +++ head/sys/nfsclient/nfs_bio.c Mon May 3 20:31:13 2010 (r207584) @@ -189,12 +189,14 @@ nfs_getpages(struct vop_getpages_args *a size = count - uio.uio_resid; VM_OBJECT_LOCK(object); - vm_page_lock_queues(); for (i = 0, toff = 0; i < npages; i++, toff = nextoff) { vm_page_t m; nextoff = toff + PAGE_SIZE; m = pages[i]; + vm_page_lock(m); + vm_page_lock_queues(); + if (nextoff <= size) { /* * Read operation filled an entire page @@ -241,8 +243,10 @@ nfs_getpages(struct vop_getpages_args *a vm_page_free(m); } } + + vm_page_unlock_queues(); + vm_page_unlock(m); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon May 3 20:57:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D77FB106566C; Mon, 3 May 2010 20:57:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C5B518FC12; Mon, 3 May 2010 20:57:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43KvGYg091476; Mon, 3 May 2010 20:57:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43KvGaF091473; Mon, 3 May 2010 20:57:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005032057.o43KvGaF091473@svn.freebsd.org> From: Marius Strobl Date: Mon, 3 May 2010 20:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207585 - head/sys/dev/cas X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 20:57:17 -0000 Author: marius Date: Mon May 3 20:57:16 2010 New Revision: 207585 URL: http://svn.freebsd.org/changeset/base/207585 Log: - Don't set CAS_PCS_DATAPATH to anything except CAS_PCS_DATAPATH_SERDES on Cassini using the external PCS SERDES otherwise unaligned access traps and other strange effects happen with some machines. Don't touch the MIF which is unused in that case either. These changes require the PHY type to use to be determined via the OFW device tree or from the VPD in machines without the former. - Disable the SERDES pins of Saturn when not used in order to save power and ensure they are enabled otherwise. - In cas_attach() use the correct register offset for CAS_PCS_CONF_EN. - Add some bus space barriers missing in the PCS code path. These changes make the Sun GigaSwift Ethernet 1.0 MMF cards as well as the on-board interfaces found in Sun Fire B100s Blade Server work. PR: 144867 Modified: head/sys/dev/cas/if_cas.c head/sys/dev/cas/if_casreg.h Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Mon May 3 20:31:13 2010 (r207584) +++ head/sys/dev/cas/if_cas.c Mon May 3 20:57:16 2010 (r207585) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #if defined(__powerpc__) || defined(__sparc64__) +#include #include #include #endif @@ -321,55 +322,82 @@ cas_attach(struct cas_softc *sc) } } - CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII); - - cas_mifinit(sc); - - /* - * Look for an external PHY. - */ - error = ENXIO; - v = CAS_READ_4(sc, CAS_MIF_CONF); - if ((v & CAS_MIF_CONF_MDI1) != 0) { - v |= CAS_MIF_CONF_PHY_SELECT; - CAS_WRITE_4(sc, CAS_MIF_CONF, v); - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; + if ((sc->sc_flags & CAS_SERDES) == 0) { + CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII); + CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + cas_mifinit(sc); + /* + * Look for an external PHY. + */ + error = ENXIO; + v = CAS_READ_4(sc, CAS_MIF_CONF); + if ((v & CAS_MIF_CONF_MDI1) != 0) { + v |= CAS_MIF_CONF_PHY_SELECT; + CAS_WRITE_4(sc, CAS_MIF_CONF, v); + CAS_BARRIER(sc, CAS_MIF_CONF, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + /* Enable/unfreeze the GMII pins of Saturn. */ + if (sc->sc_variant == CAS_SATURN) { + CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0); + CAS_BARRIER(sc, CAS_SATURN_PCFG, 4, + BUS_SPACE_BARRIER_READ | + BUS_SPACE_BARRIER_WRITE); + } + switch (sc->sc_variant) { + default: + sc->sc_phyad = -1; + break; + } + error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, + cas_mediachange, cas_mediastatus); } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); - } - - /* - * Fall back on an internal PHY if no external PHY was found. - */ - if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) { - v &= ~CAS_MIF_CONF_PHY_SELECT; - CAS_WRITE_4(sc, CAS_MIF_CONF, v); - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; + /* + * Fall back on an internal PHY if no external PHY was found. + */ + if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) { + v &= ~CAS_MIF_CONF_PHY_SELECT; + CAS_WRITE_4(sc, CAS_MIF_CONF, v); + CAS_BARRIER(sc, CAS_MIF_CONF, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + /* Freeze the GMII pins of Saturn for saving power. */ + if (sc->sc_variant == CAS_SATURN) { + CAS_WRITE_4(sc, CAS_SATURN_PCFG, + CAS_SATURN_PCFG_FSI); + CAS_BARRIER(sc, CAS_SATURN_PCFG, 4, + BUS_SPACE_BARRIER_READ | + BUS_SPACE_BARRIER_WRITE); + } + switch (sc->sc_variant) { + default: + sc->sc_phyad = -1; + break; + } + error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, + cas_mediachange, cas_mediastatus); } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); - } - - /* - * Try the external PCS SERDES if we didn't find any PHYs. - */ - if (error != 0) { + } else { + /* + * Use the external PCS SERDES. + */ CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_SERDES); + CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4, BUS_SPACE_BARRIER_WRITE); + /* Enable/unfreeze the SERDES pins of Saturn. */ + if (sc->sc_variant == CAS_SATURN) { + CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0); + CAS_BARRIER(sc, CAS_SATURN_PCFG, 4, + BUS_SPACE_BARRIER_WRITE); + } CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL, CAS_PCS_SERDES_CTRL_ESD); - CAS_WRITE_4(sc, CAS_PCS_CONF_EN, CAS_PCS_CONF_EN); - sc->sc_flags |= CAS_SERDES; + CAS_BARRIER(sc, CAS_PCS_SERDES_CTRL, 4, + BUS_SPACE_BARRIER_WRITE); + CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN); + CAS_BARRIER(sc, CAS_PCS_CONF, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); sc->sc_phyad = CAS_PHYAD_EXTERNAL; error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, cas_mediachange, cas_mediastatus); } - if (error != 0) { device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); goto fail_rxmap; @@ -956,8 +984,9 @@ cas_init_locked(struct cas_softc *sc) __func__); #endif - /* Re-initialize the MIF. */ - cas_mifinit(sc); + if ((sc->sc_flags & CAS_SERDES) == 0) + /* Re-initialize the MIF. */ + cas_mifinit(sc); /* step 3. Setup data structures in host memory. */ cas_meminit(sc); @@ -2105,6 +2134,8 @@ cas_mifinit(struct cas_softc *sc) /* Configure the MIF in frame mode. */ CAS_WRITE_4(sc, CAS_MIF_CONF, CAS_READ_4(sc, CAS_MIF_CONF) & ~CAS_MIF_CONF_BB_MODE); + CAS_BARRIER(sc, CAS_MIF_CONF, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } /* @@ -2219,10 +2250,16 @@ cas_mii_writereg(device_t dev, int phy, CAS_BARRIER(sc, CAS_PCS_CONF, 4, BUS_SPACE_BARRIER_WRITE); CAS_WRITE_4(sc, CAS_PCS_ANAR, val); + CAS_BARRIER(sc, CAS_PCS_ANAR, 4, + BUS_SPACE_BARRIER_WRITE); CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL, CAS_PCS_SERDES_CTRL_ESD); + CAS_BARRIER(sc, CAS_PCS_CONF, 4, + BUS_SPACE_BARRIER_WRITE); CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN); + CAS_BARRIER(sc, CAS_PCS_CONF, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); return (0); case MII_ANLPAR: reg = CAS_PCS_ANLPAR; @@ -2233,6 +2270,8 @@ cas_mii_writereg(device_t dev, int phy, return (0); } CAS_WRITE_4(sc, reg, val); + CAS_BARRIER(sc, reg, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); return (0); } @@ -2630,15 +2669,20 @@ static struct resource_spec cas_pci_res_ { -1, 0 } }; +#define CAS_LOCAL_MAC_ADDRESS "local-mac-address" +#define CAS_PHY_INTERFACE "phy-interface" +#define CAS_PHY_TYPE "phy-type" +#define CAS_PHY_TYPE_PCS "pcs" + static int cas_pci_attach(device_t dev) { + char buf[sizeof(CAS_LOCAL_MAC_ADDRESS)]; struct cas_softc *sc; int i; #if !(defined(__powerpc__) || defined(__sparc64__)) u_char enaddr[4][ETHER_ADDR_LEN]; - char lma[sizeof("local-mac-address")]; - int found, j; + u_int j, k, lma, pcs[4], phy; #endif sc = device_get_softc(dev); @@ -2679,13 +2723,20 @@ cas_pci_attach(device_t dev) #if defined(__powerpc__) || defined(__sparc64__) OF_getetheraddr(dev, sc->sc_enaddr); + if (OF_getprop(ofw_bus_get_node(dev), CAS_PHY_INTERFACE, buf, + sizeof(buf)) > 0 || OF_getprop(ofw_bus_get_node(dev), + CAS_PHY_TYPE, buf, sizeof(buf)) > 0) { + buf[sizeof(buf) - 1] = '\0'; + if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0) + sc->sc_flags |= CAS_SERDES; + } #else /* - * Dig out VPD (vital product data) and read the MAX address. - * The VPD resides in the PCI Expansion ROM (PCI FCode) and - * can't be accessed via the PCI capability pointer. - * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format - * described in US Patent 7149820. + * Dig out VPD (vital product data) and read the MAC address as well + * as the PHY type. The VPD resides in the PCI Expansion ROM (PCI + * FCode) and can't be accessed via the PCI capability pointer. + * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format described + * in the free US Patent 7149820. */ #define PCI_ROMHDR_SIZE 0x1c @@ -2719,7 +2770,10 @@ cas_pci_attach(device_t dev) #define CAS_ROM_READ_4(sc, offs) \ CAS_READ_4((sc), CAS_PCI_ROM_OFFSET + (offs)) - found = 0; + lma = phy = 0; + memset(enaddr, 0, sizeof(enaddr)); + memset(pcs, 0, sizeof(pcs)); + /* Enable PCI Expansion ROM access. */ CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN, CAS_BIM_LDEV_OEN_PAD | CAS_BIM_LDEV_OEN_PROM); @@ -2768,23 +2822,51 @@ cas_pci_attach(device_t dev) if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE) != 'I') /* no instance property */ continue; - if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) != 'B') - /* no byte array */ - continue; - if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 4) != - ETHER_ADDR_LEN) - continue; - bus_read_region_1(sc->sc_res[CAS_RES_MEM], - CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5, - lma, sizeof(lma)); - if (strcmp(lma, "local-mac-address") != 0) - continue; - bus_read_region_1(sc->sc_res[CAS_RES_MEM], - CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5 + - sizeof(lma), enaddr[found], - sizeof(enaddr[found])); - if (found++ == 4) - break; + if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) == 'B') { + /* byte array */ + if (CAS_ROM_READ_1(sc, + j + PCI_VPD_SIZE + 4) != ETHER_ADDR_LEN) + continue; + bus_read_region_1(sc->sc_res[CAS_RES_MEM], + CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5, + buf, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if (strcmp(buf, CAS_LOCAL_MAC_ADDRESS) != 0) + continue; + bus_read_region_1(sc->sc_res[CAS_RES_MEM], + CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + + 5 + sizeof(CAS_LOCAL_MAC_ADDRESS), + enaddr[lma], sizeof(enaddr[lma])); + lma++; + if (lma == 4 && phy == 4) + break; + } else if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) == + 'S') { + /* string */ + if (CAS_ROM_READ_1(sc, + j + PCI_VPD_SIZE + 4) != + sizeof(CAS_PHY_TYPE_PCS)) + continue; + bus_read_region_1(sc->sc_res[CAS_RES_MEM], + CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5, + buf, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if (strcmp(buf, CAS_PHY_INTERFACE) == 0) + k = sizeof(CAS_PHY_INTERFACE); + else if (strcmp(buf, CAS_PHY_TYPE) == 0) + k = sizeof(CAS_PHY_TYPE); + else + continue; + bus_read_region_1(sc->sc_res[CAS_RES_MEM], + CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + + 5 + k, buf, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0) + pcs[phy] = 1; + phy++; + if (lma == 4 && phy == 4) + break; + } } break; default: @@ -2795,14 +2877,24 @@ cas_pci_attach(device_t dev) fail_prom: CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN, 0); - if (found == 0) { + if (lma == 0) { device_printf(dev, "could not determine Ethernet address\n"); goto fail; } i = 0; - if (found > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr)) + if (lma > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr)) i = pci_get_slot(dev); memcpy(sc->sc_enaddr, enaddr[i], ETHER_ADDR_LEN); + + if (phy == 0) { + device_printf(dev, "could not determine PHY type\n"); + goto fail; + } + i = 0; + if (phy > 1 && pci_get_slot(dev) < sizeof(pcs) / sizeof(*pcs)) + i = pci_get_slot(dev); + if (pcs[i] != 0) + sc->sc_flags |= CAS_SERDES; #endif if (cas_attach(sc) != 0) { Modified: head/sys/dev/cas/if_casreg.h ============================================================================== --- head/sys/dev/cas/if_casreg.h Mon May 3 20:31:13 2010 (r207584) +++ head/sys/dev/cas/if_casreg.h Mon May 3 20:57:16 2010 (r207585) @@ -68,6 +68,7 @@ #define CAS_STATUS4 0x105c /* interrupt status 4 for INTD */ #define CAS_CLEAR_ALIAS4 0x1060 /* clear mask alias 4 for INTD */ #define CAS_STATUS_ALIAS4 0x1064 /* interrupt status alias 4 for INTD */ +#define CAS_SATURN_PCFG 0x106c /* internal MACPHY pin configuration */ #define CAS_CAW_RX_WGHT_MASK 0x00000003 /* RX DMA factor for... */ #define CAS_CAW_RX_WGHT_SHFT 0 /* ...weighted round robin */ @@ -171,6 +172,17 @@ /* INTn enable bit for CAS_INTMASK[2-4] */ #define CAS_INTMASKN_EN 0x00000080 /* INT[B-D] enable */ +#define CAS_SATURN_PCFG_TLA 0x00000001 /* PHY activity LED */ +#define CAS_SATURN_PCFG_FLA 0x00000002 /* PHY 10MBit/sec LED */ +#define CAS_SATURN_PCFG_CLA 0x00000004 /* PHY 100MBit/sec LED */ +#define CAS_SATURN_PCFG_LLA 0x00000008 /* PHY 1000MBit/sec LED */ +#define CAS_SATURN_PCFG_RLA 0x00000010 /* PHY full-duplex LED */ +#define CAS_SATURN_PCFG_PDS 0x00000020 /* PHY debug mode */ +#define CAS_SATURN_PCFG_MTP 0x00000080 /* test point select */ +#define CAS_SATURN_PCFG_GMO 0x00000100 /* GMII observe */ +#define CAS_SATURN_PCFG_FSI 0x00000200 /* freeze GMII/SERDES */ +#define CAS_SATURN_PCFG_LAD 0x00000800 /* MAC LED control active low */ + /* TX DMA registers */ #define CAS_TX_CONF 0x2004 /* TX configuration */ #define CAS_TX_FIFO_WR 0x2014 /* FIFO write pointer */ From owner-svn-src-head@FreeBSD.ORG Mon May 3 20:59:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A047A1065670; Mon, 3 May 2010 20:59:27 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8F8658FC18; Mon, 3 May 2010 20:59:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43KxRlI092007; Mon, 3 May 2010 20:59:27 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43KxRma092005; Mon, 3 May 2010 20:59:27 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005032059.o43KxRma092005@svn.freebsd.org> From: Marius Strobl Date: Mon, 3 May 2010 20:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207586 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 20:59:27 -0000 Author: marius Date: Mon May 3 20:59:27 2010 New Revision: 207586 URL: http://svn.freebsd.org/changeset/base/207586 Log: Sun GigaSwift Ethernet 1.0 MMF work with r207585 in place. Modified: head/share/man/man4/cas.4 Modified: head/share/man/man4/cas.4 ============================================================================== --- head/share/man/man4/cas.4 Mon May 3 20:57:16 2010 (r207585) +++ head/share/man/man4/cas.4 Mon May 3 20:59:27 2010 (r207586) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 15, 2009 +.Dd May 3, 2010 .Dt CAS 4 .Os .Sh NAME @@ -91,6 +91,9 @@ driver at this time: .Pp .Bl -bullet -compact .It +Sun GigaSwift Ethernet 1.0 MMF (Cassini Kuheen) +(part no.\& 501-5524) +.It Sun GigaSwift Ethernet 1.0 UTP (Cassini) (part no.\& 501-5902) .It From owner-svn-src-head@FreeBSD.ORG Mon May 3 22:32:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0AA4106564A; Mon, 3 May 2010 22:32:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 900C68FC0A; Mon, 3 May 2010 22:32:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o43MWQC2021683; Mon, 3 May 2010 22:32:26 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o43MWQhN021681; Mon, 3 May 2010 22:32:26 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201005032232.o43MWQhN021681@svn.freebsd.org> From: Ed Maste Date: Mon, 3 May 2010 22:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207590 - head/contrib/tzcode/zic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 22:32:26 -0000 Author: emaste Date: Mon May 3 22:32:26 2010 New Revision: 207590 URL: http://svn.freebsd.org/changeset/base/207590 Log: Update GRANDPARENTED text to match the contents of tzdata/factory r19879. This eliminates "warning: time zone abbreviation differs from POSIX" on installworld to an empty filesystem. Reviewed by: edwin MFC after: 1 week Modified: head/contrib/tzcode/zic/private.h Modified: head/contrib/tzcode/zic/private.h ============================================================================== --- head/contrib/tzcode/zic/private.h Mon May 3 22:14:06 2010 (r207589) +++ head/contrib/tzcode/zic/private.h Mon May 3 22:32:26 2010 (r207590) @@ -34,7 +34,7 @@ static const char privatehid[] = "@(#)pr #endif /* !defined NOID */ #endif /* !defined lint */ -#define GRANDPARENTED "Local time zone must be set--see zic manual page" +#define GRANDPARENTED "Local time zone must be set--use tzsetup" /* ** Defaults for preprocessor symbols. From owner-svn-src-head@FreeBSD.ORG Tue May 4 01:46:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 90589106564A; Tue, 4 May 2010 01:46:58 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 80BF48FC14; Tue, 4 May 2010 01:46:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o441kwun064572; Tue, 4 May 2010 01:46:58 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o441kwg0064570; Tue, 4 May 2010 01:46:58 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201005040146.o441kwg0064570@svn.freebsd.org> From: Doug Barton Date: Tue, 4 May 2010 01:46:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207592 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 01:46:58 -0000 Author: dougb Date: Tue May 4 01:46:58 2010 New Revision: 207592 URL: http://svn.freebsd.org/changeset/base/207592 Log: Make address assignment via ipv6_prefix_IF work again Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Tue May 4 00:42:03 2010 (r207591) +++ head/etc/network.subr Tue May 4 01:46:58 2010 (r207592) @@ -399,6 +399,8 @@ ipv6if() $_if|"$_if "*|*" $_if"|*" $_if "*|[Aa][Uu][Tt][Oo]) # True if $ifconfig_IF_ipv6 is defined. _tmpargs=`_ifconfig_getargs $_if ipv6` + # Also true if ipv6_prefix_IF is defined + [ -n "$_tmpargs" ] || _tmpargs=`get_if_var $_if ipv6_prefix_IF` ;; esac From owner-svn-src-head@FreeBSD.ORG Tue May 4 05:47:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B4042106566C; Tue, 4 May 2010 05:47:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id A25148FC21; Tue, 4 May 2010 05:47:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o445lHrv017718; Tue, 4 May 2010 05:47:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o445lHbm017716; Tue, 4 May 2010 05:47:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005040547.o445lHbm017716@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 May 2010 05:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207600 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 05:47:17 -0000 Author: kib Date: Tue May 4 05:47:17 2010 New Revision: 207600 URL: http://svn.freebsd.org/changeset/base/207600 Log: Move definition of struct rusage_ext before struct thread. MFC after: 1 week Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue May 4 05:34:18 2010 (r207599) +++ head/sys/sys/proc.h Tue May 4 05:47:17 2010 (r207600) @@ -173,6 +173,27 @@ struct kdtrace_thread; struct cpuset; /* + * XXX: Does this belong in resource.h or resourcevar.h instead? + * Resource usage extension. The times in rusage structs in the kernel are + * never up to date. The actual times are kept as runtimes and tick counts + * (with control info in the "previous" times), and are converted when + * userland asks for rusage info. Backwards compatibility prevents putting + * this directly in the user-visible rusage struct. + * + * Locking for p_rux: (cj) means (j) for p_rux and (c) for p_crux. + * Locking for td_rux: (t) for all fields. + */ +struct rusage_ext { + u_int64_t rux_runtime; /* (cj) Real time. */ + u_int64_t rux_uticks; /* (cj) Statclock hits in user mode. */ + u_int64_t rux_sticks; /* (cj) Statclock hits in sys mode. */ + u_int64_t rux_iticks; /* (cj) Statclock hits in intr mode. */ + u_int64_t rux_uu; /* (c) Previous user time in usec. */ + u_int64_t rux_su; /* (c) Previous sys time in usec. */ + u_int64_t rux_tu; /* (c) Previous total time in usec. */ +}; + +/* * Kernel runnable context (thread). * This is what is put to sleep and reactivated. * Thread context. Processes may have multiple threads. @@ -426,26 +447,6 @@ do { \ #define TD_SET_CAN_RUN(td) (td)->td_state = TDS_CAN_RUN /* - * XXX: Does this belong in resource.h or resourcevar.h instead? - * Resource usage extension. The times in rusage structs in the kernel are - * never up to date. The actual times are kept as runtimes and tick counts - * (with control info in the "previous" times), and are converted when - * userland asks for rusage info. Backwards compatibility prevents putting - * this directly in the user-visible rusage struct. - * - * Locking: (cj) means (j) for p_rux and (c) for p_crux. - */ -struct rusage_ext { - u_int64_t rux_runtime; /* (cj) Real time. */ - u_int64_t rux_uticks; /* (cj) Statclock hits in user mode. */ - u_int64_t rux_sticks; /* (cj) Statclock hits in sys mode. */ - u_int64_t rux_iticks; /* (cj) Statclock hits in intr mode. */ - u_int64_t rux_uu; /* (c) Previous user time in usec. */ - u_int64_t rux_su; /* (c) Previous sys time in usec. */ - u_int64_t rux_tu; /* (c) Previous total time in usec. */ -}; - -/* * Process structure. */ struct proc { From owner-svn-src-head@FreeBSD.ORG Tue May 4 05:55:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9243A1065670; Tue, 4 May 2010 05:55:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 812518FC17; Tue, 4 May 2010 05:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o445tJPm019530; Tue, 4 May 2010 05:55:19 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o445tJ33019528; Tue, 4 May 2010 05:55:19 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005040555.o445tJ33019528@svn.freebsd.org> From: Alan Cox Date: Tue, 4 May 2010 05:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207601 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 05:55:19 -0000 Author: alc Date: Tue May 4 05:55:19 2010 New Revision: 207601 URL: http://svn.freebsd.org/changeset/base/207601 Log: Add lock assertions. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue May 4 05:47:17 2010 (r207600) +++ head/sys/vm/vm_page.c Tue May 4 05:55:19 2010 (r207601) @@ -1385,6 +1385,7 @@ vm_page_activate(vm_page_t m) { mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if (VM_PAGE_GETKNOWNQUEUE2(m) != PQ_ACTIVE) { vm_pageq_remove(m); if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { @@ -1588,8 +1589,10 @@ void vm_page_unwire(vm_page_t m, int activate) { - if ((m->flags & PG_UNMANAGED) == 0) + if ((m->flags & PG_UNMANAGED) == 0) { mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); + } if (m->flags & PG_FICTITIOUS) return; if (m->wire_count > 0) { @@ -1626,6 +1629,7 @@ _vm_page_deactivate(vm_page_t m, int ath { mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); /* * Ignore if already inactive. @@ -1845,6 +1849,8 @@ vm_page_dontneed(vm_page_t m) int head; mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); dnw = ++dnweight; /* From owner-svn-src-head@FreeBSD.ORG Tue May 4 05:55:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A2CD21065740; Tue, 4 May 2010 05:55:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 90AD48FC14; Tue, 4 May 2010 05:55:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o445tbK0019637; Tue, 4 May 2010 05:55:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o445tbrh019631; Tue, 4 May 2010 05:55:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005040555.o445tbrh019631@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 May 2010 05:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207602 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 05:55:37 -0000 Author: kib Date: Tue May 4 05:55:37 2010 New Revision: 207602 URL: http://svn.freebsd.org/changeset/base/207602 Log: Implement RUSAGE_THREAD. Add td_rux to keep extended runtime and ticks information for thread to allow calcru1() (re)use. Rename ruxagg()->ruxagg_locked(), ruxagg_tlock()->ruxagg() [1]. The ruxagg_locked() function no longer clears thread ticks nor td_incruntime. Requested by: attilio [1] Discussed with: attilio, bde Reviewed by: bde Based on submission by: Alexander Krizhanovsky MFC after: 1 week X-MFC-Note: td_rux shall be moved to the end of struct thread Modified: head/sys/kern/kern_resource.c head/sys/kern/kern_thread.c head/sys/sys/proc.h head/sys/sys/resource.h head/sys/sys/resourcevar.h Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Tue May 4 05:55:19 2010 (r207601) +++ head/sys/kern/kern_resource.c Tue May 4 05:55:37 2010 (r207602) @@ -76,7 +76,7 @@ static void calcru1(struct proc *p, stru struct timeval *up, struct timeval *sp); static int donice(struct thread *td, struct proc *chgp, int n); static struct uidinfo *uilookup(uid_t uid); -static void ruxagg_tlock(struct proc *p, struct thread *td); +static void ruxagg(struct proc *p, struct thread *td); /* * Resource controls and accounting. @@ -630,7 +630,7 @@ lim_cb(void *arg) return; PROC_SLOCK(p); FOREACH_THREAD_IN_PROC(p, td) { - ruxagg_tlock(p, td); + ruxagg(p, td); } PROC_SUNLOCK(p); if (p->p_rux.rux_runtime > p->p_cpulimit * cpu_tickrate()) { @@ -841,7 +841,7 @@ calcru(struct proc *p, struct timeval *u FOREACH_THREAD_IN_PROC(p, td) { if (td->td_incruntime == 0) continue; - ruxagg_tlock(p, td); + ruxagg(p, td); } calcru1(p, &p->p_rux, up, sp); } @@ -961,6 +961,16 @@ kern_getrusage(struct thread *td, int wh calccru(p, &rup->ru_utime, &rup->ru_stime); break; + case RUSAGE_THREAD: + PROC_SLOCK(p); + ruxagg(p, td); + PROC_SUNLOCK(p); + thread_lock(td); + *rup = td->td_ru; + calcru1(p, &td->td_rux, &rup->ru_utime, &rup->ru_stime); + thread_unlock(td); + break; + default: error = EINVAL; } @@ -1001,7 +1011,7 @@ ruadd(struct rusage *ru, struct rusage_e * Aggregate tick counts into the proc's rusage_ext. */ void -ruxagg(struct rusage_ext *rux, struct thread *td) +ruxagg_locked(struct rusage_ext *rux, struct thread *td) { THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -1010,18 +1020,19 @@ ruxagg(struct rusage_ext *rux, struct th rux->rux_uticks += td->td_uticks; rux->rux_sticks += td->td_sticks; rux->rux_iticks += td->td_iticks; - td->td_incruntime = 0; - td->td_uticks = 0; - td->td_iticks = 0; - td->td_sticks = 0; } static void -ruxagg_tlock(struct proc *p, struct thread *td) +ruxagg(struct proc *p, struct thread *td) { thread_lock(td); - ruxagg(&p->p_rux, td); + ruxagg_locked(&p->p_rux, td); + ruxagg_locked(&td->td_rux, td); + td->td_incruntime = 0; + td->td_uticks = 0; + td->td_iticks = 0; + td->td_sticks = 0; thread_unlock(td); } @@ -1039,7 +1050,7 @@ rufetch(struct proc *p, struct rusage *r *ru = p->p_ru; if (p->p_numthreads > 0) { FOREACH_THREAD_IN_PROC(p, td) { - ruxagg_tlock(p, td); + ruxagg(p, td); rucollect(ru, &td->td_ru); } } Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue May 4 05:55:19 2010 (r207601) +++ head/sys/kern/kern_thread.c Tue May 4 05:55:37 2010 (r207602) @@ -432,7 +432,7 @@ thread_exit(void) PROC_UNLOCK(p); thread_lock(td); /* Save our tick information with both the thread and proc locked */ - ruxagg(&p->p_rux, td); + ruxagg_locked(&p->p_rux, td); PROC_SUNLOCK(p); td->td_state = TDS_INACTIVE; #ifdef WITNESS Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue May 4 05:55:19 2010 (r207601) +++ head/sys/sys/proc.h Tue May 4 05:55:37 2010 (r207602) @@ -240,7 +240,8 @@ struct thread { u_int td_estcpu; /* (t) estimated cpu utilization */ int td_slptick; /* (t) Time at sleep. */ int td_blktick; /* (t) Time spent blocked. */ - struct rusage td_ru; /* (t) rusage information */ + struct rusage td_ru; /* (t) rusage information. */ + struct rusage_ext td_rux; /* (t) Internal rusage information. */ uint64_t td_incruntime; /* (t) Cpu ticks to transfer to proc. */ uint64_t td_runtime; /* (t) How many cpu ticks we've run. */ u_int td_pticks; /* (t) Statclock hits for profiling */ Modified: head/sys/sys/resource.h ============================================================================== --- head/sys/sys/resource.h Tue May 4 05:55:19 2010 (r207601) +++ head/sys/sys/resource.h Tue May 4 05:55:37 2010 (r207602) @@ -56,6 +56,7 @@ #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN -1 +#define RUSAGE_THREAD 1 struct rusage { struct timeval ru_utime; /* user time used */ Modified: head/sys/sys/resourcevar.h ============================================================================== --- head/sys/sys/resourcevar.h Tue May 4 05:55:19 2010 (r207601) +++ head/sys/sys/resourcevar.h Tue May 4 05:55:37 2010 (r207602) @@ -131,7 +131,7 @@ void rucollect(struct rusage *ru, struc void rufetch(struct proc *p, struct rusage *ru); void rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up, struct timeval *sp); -void ruxagg(struct rusage_ext *rux, struct thread *td); +void ruxagg_locked(struct rusage_ext *rux, struct thread *td); int suswintr(void *base, int word); struct uidinfo *uifind(uid_t uid); From owner-svn-src-head@FreeBSD.ORG Tue May 4 06:00:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB8331065670; Tue, 4 May 2010 06:00:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id AA5D18FC2B; Tue, 4 May 2010 06:00:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4460dBM020788; Tue, 4 May 2010 06:00:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4460dRK020786; Tue, 4 May 2010 06:00:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005040600.o4460dRK020786@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 May 2010 06:00:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207603 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 06:00:39 -0000 Author: kib Date: Tue May 4 06:00:39 2010 New Revision: 207603 URL: http://svn.freebsd.org/changeset/base/207603 Log: Use td_rux.rux_runtime for ki_runtime instead of redoing calculation. Submitted by: bde MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue May 4 05:55:37 2010 (r207602) +++ head/sys/kern/kern_proc.c Tue May 4 06:00:39 2010 (r207603) @@ -901,7 +901,7 @@ fill_kinfo_thread(struct thread *td, str kp->ki_pri.pri_user = td->td_user_pri; if (preferthread) { - kp->ki_runtime = cputick2usec(td->td_runtime); + kp->ki_runtime = td->td_rux.rux_runtime; kp->ki_pctcpu = sched_pctcpu(td); kp->ki_estcpu = td->td_estcpu; } From owner-svn-src-head@FreeBSD.ORG Tue May 4 06:01:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B537106566B; Tue, 4 May 2010 06:01:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 09E378FC12; Tue, 4 May 2010 06:01:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4461Pbn020993; Tue, 4 May 2010 06:01:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4461P9v020991; Tue, 4 May 2010 06:01:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005040601.o4461P9v020991@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 May 2010 06:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207604 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 06:01:26 -0000 Author: kib Date: Tue May 4 06:01:25 2010 New Revision: 207604 URL: http://svn.freebsd.org/changeset/base/207604 Log: Document RUSAGE_THREAD. Reviewed by: bde MFC after: 1 week Modified: head/lib/libc/sys/getrusage.2 Modified: head/lib/libc/sys/getrusage.2 ============================================================================== --- head/lib/libc/sys/getrusage.2 Tue May 4 06:00:39 2010 (r207603) +++ head/lib/libc/sys/getrusage.2 Tue May 4 06:01:25 2010 (r207604) @@ -28,7 +28,7 @@ .\" @(#)getrusage.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 1, 2010 .Dt GETRUSAGE 2 .Os .Sh NAME @@ -42,6 +42,7 @@ .In sys/resource.h .Fd "#define RUSAGE_SELF 0" .Fd "#define RUSAGE_CHILDREN -1" +.Fd "#define RUSAGE_THREAD 1" .Ft int .Fn getrusage "int who" "struct rusage *rusage" .Sh DESCRIPTION @@ -49,11 +50,12 @@ The .Fn getrusage system call returns information describing the resources utilized by the current -process, or all its terminated child processes. +thread, the current process, or all its terminated child processes. The .Fa who argument is either -.Dv RUSAGE_SELF +.Dv RUSAGE_THREAD , +.Dv RUSAGE_SELF , or .Dv RUSAGE_CHILDREN . The buffer to which @@ -175,6 +177,10 @@ The .Fn getrusage system call appeared in .Bx 4.2 . +The +.Dv RUSAGE_THREAD +facility first appeared in +.Fx 8.1 . .Sh BUGS There is no way to obtain information about a child process that has not yet terminated. From owner-svn-src-head@FreeBSD.ORG Tue May 4 06:04:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 227381065672; Tue, 4 May 2010 06:04:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1142E8FC0C; Tue, 4 May 2010 06:04:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4464Xw8021718; Tue, 4 May 2010 06:04:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4464X6a021716; Tue, 4 May 2010 06:04:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005040604.o4464X6a021716@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 May 2010 06:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207605 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 06:04:34 -0000 Author: kib Date: Tue May 4 06:04:33 2010 New Revision: 207605 URL: http://svn.freebsd.org/changeset/base/207605 Log: Remove a comment that merely repeats code. Submitted by: bde MFC after: 1 week Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue May 4 06:01:25 2010 (r207604) +++ head/sys/kern/kern_thread.c Tue May 4 06:04:33 2010 (r207605) @@ -431,7 +431,6 @@ thread_exit(void) #endif PROC_UNLOCK(p); thread_lock(td); - /* Save our tick information with both the thread and proc locked */ ruxagg_locked(&p->p_rux, td); PROC_SUNLOCK(p); td->td_state = TDS_INACTIVE; From owner-svn-src-head@FreeBSD.ORG Tue May 4 06:06:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A9C5B1065678; Tue, 4 May 2010 06:06:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 989E38FC24; Tue, 4 May 2010 06:06:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44661Dm022080; Tue, 4 May 2010 06:06:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44661d6022078; Tue, 4 May 2010 06:06:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005040606.o44661d6022078@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 4 May 2010 06:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207606 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 06:06:01 -0000 Author: kib Date: Tue May 4 06:06:01 2010 New Revision: 207606 URL: http://svn.freebsd.org/changeset/base/207606 Log: Fix typo in comment. MFC after: 3 days Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue May 4 06:04:33 2010 (r207605) +++ head/sys/kern/kern_thread.c Tue May 4 06:06:01 2010 (r207606) @@ -398,7 +398,7 @@ thread_exit(void) /* * The test below is NOT true if we are the - * sole exiting thread. P_STOPPED_SNGL is unset + * sole exiting thread. P_STOPPED_SINGLE is unset * in exit1() after it is the only survivor. */ if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { From owner-svn-src-head@FreeBSD.ORG Tue May 4 06:13:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39214106564A; Tue, 4 May 2010 06:13:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 268CA8FC12; Tue, 4 May 2010 06:13:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o446DIb1023754; Tue, 4 May 2010 06:13:18 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o446DI8m023750; Tue, 4 May 2010 06:13:18 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201005040613.o446DI8m023750@svn.freebsd.org> From: Warner Losh Date: Tue, 4 May 2010 06:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207607 - head/usr.bin/tftp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 06:13:18 -0000 Author: imp Date: Tue May 4 06:13:17 2010 New Revision: 207607 URL: http://svn.freebsd.org/changeset/base/207607 Log: Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Modified: head/usr.bin/tftp/Makefile head/usr.bin/tftp/main.c head/usr.bin/tftp/tftp.1 head/usr.bin/tftp/tftp.c Modified: head/usr.bin/tftp/Makefile ============================================================================== --- head/usr.bin/tftp/Makefile Tue May 4 06:06:01 2010 (r207606) +++ head/usr.bin/tftp/Makefile Tue May 4 06:13:17 2010 (r207607) @@ -1,9 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +CFLAGS=-g -Wall +WARNS= 3 PROG= tftp -SRCS= main.c tftp.c tftpsubs.c +SRCS= main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c tftp-options.c DPADD= ${LIBEDIT} ${LIBTERMCAP} LDADD= -ledit -ltermcap +CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp +.PATH: ${.CURDIR}/../../libexec/tftpd .include Modified: head/usr.bin/tftp/main.c ============================================================================== --- head/usr.bin/tftp/main.c Tue May 4 06:06:01 2010 (r207606) +++ head/usr.bin/tftp/main.c Tue May 4 06:13:17 2010 (r207607) @@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include - #include +#include #include #include @@ -72,119 +74,212 @@ __FBSDID("$FreeBSD$"); #include #include -#include "extern.h" +#include "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" +#include "tftp.h" #define MAXLINE 200 #define TIMEOUT 5 /* secs between rexmt's */ -struct sockaddr_storage peeraddr; -int f; -int trace; -int verbose; -int connected; -char mode[32]; -char line[MAXLINE]; -int margc; +static struct sockaddr_storage peeraddr; +static int connected; +static char mode[32]; +jmp_buf toplevel; +volatile int txrx_error; +static int peer; + #define MAX_MARGV 20 -char *margv[MAX_MARGV]; -jmp_buf toplevel; -volatile int txrx_error; - -void get(int, char **); -void help(int, char **); -void intr(int); -void modecmd(int, char **); -void put(int, char **); -void quit(int, char **); -void setascii(int, char **); -void setbinary(int, char **); -void setpeer0(char *, const char *); -void setpeer(int, char **); -void setrexmt(int, char **); -void settimeout(int, char **); -void settrace(int, char **); -void setverbose(int, char **); -void status(int, char **); +static int margc; +static char *margv[MAX_MARGV]; + +int verbose; +char *port = NULL; + +static void get(int, char **); +static void help(int, char **); +static void intr(int); +static void modecmd(int, char **); +static void put(int, char **); +static void quit(int, char **); +static void setascii(int, char **); +static void setbinary(int, char **); +static void setpeer0(char *, const char *); +static void setpeer(int, char **); +static void settimeoutpacket(int, char **); +static void settimeoutnetwork(int, char **); +static void setdebug(int, char **); +static void setverbose(int, char **); +static void showstatus(int, char **); +static void setblocksize(int, char **); +static void setblocksize2(int, char **); +static void setoptions(int, char **); +static void setrollover(int, char **); +static void setpacketdrop(int, char **); static void command(void) __dead2; static const char *command_prompt(void); -static void getusage(const char *); -static void makeargv(void); -static void putusage(const char *); +static void urihandling(char *URI); +static void getusage(char *); +static void makeargv(char *line); +static void putusage(char *); static void settftpmode(const char *); -char *tail(char *); -struct cmd *getcmd(char *); +static char *tail(char *); +static struct cmd *getcmd(char *); #define HELPINDENT (sizeof("connect")) struct cmd { const char *name; - char *help; void (*handler)(int, char **); + const char *help; }; -char vhelp[] = "toggle verbose mode"; -char thelp[] = "toggle packet tracing"; -char chelp[] = "connect to remote tftp"; -char qhelp[] = "exit tftp"; -char hhelp[] = "print help information"; -char shelp[] = "send file"; -char rhelp[] = "receive file"; -char mhelp[] = "set file transfer mode"; -char sthelp[] = "show current status"; -char xhelp[] = "set per-packet retransmission timeout"; -char ihelp[] = "set total retransmission timeout"; -char ashelp[] = "set mode to netascii"; -char bnhelp[] = "set mode to octet"; - -struct cmd cmdtab[] = { - { "connect", chelp, setpeer }, - { "mode", mhelp, modecmd }, - { "put", shelp, put }, - { "get", rhelp, get }, - { "quit", qhelp, quit }, - { "verbose", vhelp, setverbose }, - { "trace", thelp, settrace }, - { "status", sthelp, status }, - { "binary", bnhelp, setbinary }, - { "ascii", ashelp, setascii }, - { "rexmt", xhelp, setrexmt }, - { "timeout", ihelp, settimeout }, - { "?", hhelp, help }, - { NULL, NULL, NULL } +static struct cmd cmdtab[] = { + { "connect", setpeer, "connect to remote tftp" }, + { "mode", modecmd, "set file transfer mode" }, + { "put", put, "send file" }, + { "get", get, "receive file" }, + { "quit", quit, "exit tftp" }, + { "verbose", setverbose, "toggle verbose mode" }, + { "status", showstatus, "show current status" }, + { "binary", setbinary, "set mode to octet" }, + { "ascii", setascii, "set mode to netascii" }, + { "rexmt", settimeoutpacket, + "set per-packet retransmission timeout[-]" }, + { "timeout", settimeoutnetwork, + "set total retransmission timeout" }, + { "trace", setdebug, "enable 'debug packet'[-]" }, + { "debug", setdebug, "enable verbose output" }, + { "blocksize", setblocksize, "set blocksize[*]" }, + { "blocksize2", setblocksize2, "set blocksize as a power of 2[**]" }, + { "rollover", setrollover, "rollover after 64K packets[**]" }, + { "options", setoptions, + "enable or disable RFC2347 style options" }, + { "help", help, "print help information" }, + { "packetdrop", setpacketdrop, "artifical packetloss feature" }, + { "?", help, "print help information" }, + { NULL, NULL, NULL } +}; + +static struct modes { + const char *m_name; + const char *m_mode; +} modes[] = { + { "ascii", "netascii" }, + { "netascii", "netascii" }, + { "binary", "octet" }, + { "image", "octet" }, + { "octet", "octet" }, + { NULL, NULL } }; int main(int argc, char *argv[]) { - f = -1; + + acting_as_client = 1; + peer = -1; strcpy(mode, "netascii"); signal(SIGINT, intr); if (argc > 1) { if (setjmp(toplevel) != 0) exit(txrx_error); + + if (strncmp(argv[1], "tftp://", 7) == 0) { + urihandling(argv[1]); + exit(txrx_error); + } + setpeer(argc, argv); } if (setjmp(toplevel) != 0) (void)putchar('\n'); + + init_options(); command(); } -char hostname[MAXHOSTNAMELEN]; +/* + * RFC3617 handling of TFTP URIs: + * + * tftpURI = "tftp://" host "/" file [ mode ] + * mode = ";" "mode=" ( "netascii" / "octet" ) + * file = *( unreserved / escaped ) + * host = + * unreserved = + * escaped = + * + * We are cheating a little bit by allowing any mode as specified in the + * modes table defined earlier on in this file and mapping it on the real + * mode. + */ +static void +urihandling(char *URI) +{ + char uri[ARG_MAX]; + char *host = NULL; + char *path = NULL; + char *options = NULL; + char *mode = "octet"; + char *s; + char line[MAXLINE]; + int i; + + strncpy(uri, URI, ARG_MAX); + host = uri + 7; + + if ((s = strchr(host, '/')) == NULL) { + fprintf(stderr, + "Invalid URI: Couldn't find / after hostname\n"); + exit(1); + } + *s = '\0'; + path = s + 1; + + if ((s = strchr(path, ';')) != NULL) { + *s = '\0'; + options = s + 1; + + if (strncmp(options, "mode=", 5) == 0) { + mode = options; + mode += 5; + + for (i = 0; modes[i].m_name != NULL; i++) { + if (strcmp(modes[i].m_name, mode) == 0) + break; + } + if (modes[i].m_name == NULL) { + fprintf(stderr, "Invalid mode: '%s'\n", mode); + exit(1); + } + settftpmode(modes[i].m_mode); + } + } else { + settftpmode("octet"); + } + + setpeer0(host, NULL); + + sprintf(line, "get %s", path); + makeargv(line); + get(margc, margv); +} + +static char hostname[MAXHOSTNAMELEN]; -void -setpeer0(char *host, const char *port) +static void +setpeer0(char *host, const char *lport) { struct addrinfo hints, *res0, *res; int error; - struct sockaddr_storage ss; const char *cause = "unknown"; if (connected) { - close(f); - f = -1; + close(peer); + peer = -1; } connected = 0; @@ -193,9 +288,9 @@ setpeer0(char *host, const char *port) hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = AI_CANONNAME; - if (!port) - port = "tftp"; - error = getaddrinfo(host, port, &hints, &res0); + if (!lport) + lport = "tftp"; + error = getaddrinfo(host, lport, &hints, &res0); if (error) { warnx("%s", gai_strerror(error)); return; @@ -204,50 +299,53 @@ setpeer0(char *host, const char *port) for (res = res0; res; res = res->ai_next) { if (res->ai_addrlen > sizeof(peeraddr)) continue; - f = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (f < 0) { + peer = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (peer < 0) { cause = "socket"; continue; } - memset(&ss, 0, sizeof(ss)); - ss.ss_family = res->ai_family; - ss.ss_len = res->ai_addrlen; - if (bind(f, (struct sockaddr *)&ss, ss.ss_len) < 0) { + memset(&peer_sock, 0, sizeof(peer_sock)); + peer_sock.ss_family = res->ai_family; + peer_sock.ss_len = res->ai_addrlen; + if (bind(peer, (struct sockaddr *)&peer_sock, peer_sock.ss_len) < 0) { cause = "bind"; - close(f); - f = -1; + close(peer); + peer = -1; continue; } break; } - if (f < 0) + if (peer < 0) warn("%s", cause); else { /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ - memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); + memcpy(&peer_sock, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strlcpy(hostname, res->ai_canonname, + (void) strncpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strlcpy(hostname, host, sizeof(hostname)); + (void) strncpy(hostname, host, sizeof(hostname)); + hostname[sizeof(hostname)-1] = 0; connected = 1; } freeaddrinfo(res0); } -void +static void setpeer(int argc, char *argv[]) { + char line[MAXLINE]; if (argc < 2) { strcpy(line, "Connect "); printf("(to) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -255,26 +353,14 @@ setpeer(int argc, char *argv[]) printf("usage: %s [host [port]]\n", argv[0]); return; } - if (argc == 3) + if (argc == 3) { + port = argv[2]; setpeer0(argv[1], argv[2]); - else + } else setpeer0(argv[1], NULL); } -struct modes { - const char *m_name; - const char *m_mode; -} modes[] = { - { "ascii", "netascii" }, - { "netascii", "netascii" }, - { "binary", "octet" }, - { "image", "octet" }, - { "octet", "octet" }, -/* { "mail", "mail" }, */ - { 0, 0 } -}; - -void +static void modecmd(int argc, char *argv[]) { struct modes *p; @@ -298,7 +384,7 @@ modecmd(int argc, char *argv[]) printf("usage: %s [", argv[0]); sep = " "; - for (p = modes; p->m_name; p++) { + for (p = modes; p->m_name != NULL; p++) { printf("%s%s", sep, p->m_name); if (*sep == ' ') sep = " | "; @@ -307,14 +393,14 @@ modecmd(int argc, char *argv[]) return; } -void +static void setbinary(int argc __unused, char *argv[] __unused) { settftpmode("octet"); } -void +static void setascii(int argc __unused, char *argv[] __unused) { @@ -324,6 +410,7 @@ setascii(int argc __unused, char *argv[] static void settftpmode(const char *newmode) { + strcpy(mode, newmode); if (verbose) printf("mode set to %s\n", mode); @@ -333,18 +420,20 @@ settftpmode(const char *newmode) /* * Send file(s). */ -void +static void put(int argc, char *argv[]) { - int fd; - int n; - char *cp, *targ; + int fd; + int n; + char *cp, *targ; + char line[MAXLINE]; + struct stat sb; if (argc < 2) { strcpy(line, "send "); printf("(file) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -381,10 +470,14 @@ put(int argc, char *argv[]) warn("%s", cp); return; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - cp, hostname, targ, mode); - xmitfile(fd, targ, mode); + cp, hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); return; } /* this assumes the target is a directory */ @@ -398,36 +491,43 @@ put(int argc, char *argv[]) warn("%s", argv[n]); continue; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - argv[n], hostname, targ, mode); - xmitfile(fd, targ, mode); + argv[n], hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); } } static void -putusage(const char *s) +putusage(char *s) { - printf("usage: %s file [[host:]remotename]\n", s); + + printf("usage: %s file [remotename]\n", s); + printf(" %s file host:remotename\n", s); printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); } /* * Receive file(s). */ -void +static void get(int argc, char *argv[]) { int fd; int n; char *cp; char *src; + char line[MAXLINE]; if (argc < 2) { strcpy(line, "get "); printf("(files) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -438,6 +538,8 @@ get(int argc, char *argv[]) if (!connected) { for (n = 1; n < argc ; n++) if (rindex(argv[n], ':') == 0) { + printf("No remote host specified and " + "no host given for file '%s'\n", argv[n]); getusage(argv[0]); return; } @@ -468,8 +570,8 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); break; } cp = tail(src); /* new .. jdg */ @@ -480,30 +582,31 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); } } static void -getusage(const char *s) +getusage(char *s) { - printf("usage: %s [host:]file [localname]\n", s); + + printf("usage: %s file [localname]\n", s); + printf(" %s [host:]file [localname]\n", s); printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s); } -int rexmtval = TIMEOUT; - -void -setrexmt(int argc, char *argv[]) +static void +settimeoutpacket(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Rexmt-timeout "); + strcpy(line, "Packet timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -512,24 +615,25 @@ setrexmt(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - rexmtval = t; -} + return; + } -int maxtimeout = 5 * TIMEOUT; + settimeouts(t, timeoutnetwork, maxtimeouts); +} -void -settimeout(int argc, char *argv[]) +static void +settimeoutnetwork(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Maximum-timeout "); + strcpy(line, "Network timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -538,26 +642,36 @@ settimeout(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - maxtimeout = t; + return; + } + + settimeouts(timeoutpacket, t, maxtimeouts); } -void -status(int argc __unused, char *argv[] __unused) +static void +showstatus(int argc __unused, char *argv[] __unused) { - if (connected) - printf("Connected to %s.\n", hostname); - else - printf("Not connected.\n"); - printf("Mode: %s Verbose: %s Tracing: %s\n", mode, - verbose ? "on" : "off", trace ? "on" : "off"); - printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n", - rexmtval, maxtimeout); + + printf("Remote host: %s\n", + connected ? hostname : "none specified yet"); + printf("RFC2347 Options support: %s\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Non-RFC defined options support: %s\n", + options_extra_enabled ? "enabled" : "disabled"); + printf("Mode: %s\n", mode); + printf("Verbose: %s\n", verbose ? "on" : "off"); + printf("Debug: %s\n", debug_show(debug)); + printf("Artificial packetloss: %d in 100 packets\n", + packetdroppercentage); + printf("Segment size: %d bytes\n", segsize); + printf("Network timeout: %d seconds\n", timeoutpacket); + printf("Maximum network timeout: %d seconds\n", timeoutnetwork); + printf("Maximum timeouts: %d \n", maxtimeouts); } -void +static void intr(int dummy __unused) { @@ -566,7 +680,7 @@ intr(int dummy __unused) longjmp(toplevel, -1); } -char * +static char * tail(char *filename) { char *s; @@ -583,7 +697,7 @@ tail(char *filename) } static const char * -command_prompt(void) +command_prompt() { return ("tftp> "); @@ -602,6 +716,7 @@ command(void) const char *bp; char *cp; int len, num, vrbose; + char line[MAXLINE]; vrbose = isatty(0); if (vrbose) { @@ -623,6 +738,7 @@ command(void) line[len] = '\0'; history(hist, &he, H_ENTER, bp); } else { + line[0] = 0; if (fgets(line, sizeof line , stdin) == 0) { if (feof(stdin)) { exit(txrx_error); @@ -635,7 +751,7 @@ command(void) *cp = '\0'; if (line[0] == 0) continue; - makeargv(); + makeargv(line); if (margc == 0) continue; c = getcmd(margv[0]); @@ -651,7 +767,7 @@ command(void) } } -struct cmd * +static struct cmd * getcmd(char *name) { const char *p, *q; @@ -683,15 +799,15 @@ getcmd(char *name) * Slice a string up into argc/argv. */ static void -makeargv(void) +makeargv(char *line) { char *cp; char **argp = margv; margc = 0; - if ((cp = strchr(line, '\n'))) + if ((cp = strchr(line, '\n')) != NULL) *cp = '\0'; - for (cp = line; margc < MAX_MARGV - 1 && *cp;) { + for (cp = line; margc < MAX_MARGV - 1 && *cp != '\0';) { while (isspace(*cp)) cp++; if (*cp == '\0') @@ -707,16 +823,17 @@ makeargv(void) *argp++ = 0; } -void +static void quit(int argc __unused, char *argv[] __unused) { + exit(txrx_error); } /* * Help command. */ -void +static void help(int argc, char *argv[]) { struct cmd *c; @@ -725,6 +842,10 @@ help(int argc, char *argv[]) printf("Commands may be abbreviated. Commands are:\n\n"); for (c = cmdtab; c->name; c++) printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help); + + printf("\n[-] : You shouldn't use these ones anymore.\n"); + printf("[*] : RFC2834 options support required.\n"); + printf("[**] : Non-standard RFC2834 option.\n"); return; } while (--argc > 0) { @@ -732,24 +853,211 @@ help(int argc, char *argv[]) arg = *++argv; c = getcmd(arg); if (c == (struct cmd *)-1) - printf("?Ambiguous help command %s\n", arg); + printf("?Ambiguous help command: %s\n", arg); else if (c == (struct cmd *)0) - printf("?Invalid help command %s\n", arg); + printf("?Invalid help command: %s\n", arg); else printf("%s\n", c->help); } } -void -settrace(int argc __unused, char **argv __unused) +static void +setverbose(int argc __unused, char *argv[] __unused) { - trace = !trace; - printf("Packet tracing %s.\n", trace ? "on" : "off"); -} -void -setverbose(int argc __unused, char **argv __unused) -{ verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); } + +static void +setoptions(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "enable") == 0 || + strcasecmp(argv[1], "on") == 0) { + options_extra_enabled = 1; + options_rfc_enabled = 1; + } + if (strcasecmp(argv[1], "disable") == 0 || + strcasecmp(argv[1], "off") == 0) { + options_extra_enabled = 0; + options_rfc_enabled = 0; + } + if (strcasecmp(argv[1], "extra") == 0) + options_extra_enabled = !options_extra_enabled; + } + printf("Support for RFC2347 style options are now %s.\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Support for non-RFC defined options are now %s.\n", + options_extra_enabled ? "enabled" : "disabled"); + + printf("\nThe following options are available:\n" + "\toptions on : enable support for RFC2347 style options\n" + "\toptions off : disable support for RFC2347 style options\n" + "\toptions extra : toggle support for non-RFC defined options\n" + ); +} + +static void +setrollover(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "never") == 0 || + strcasecmp(argv[1], "none") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = NULL; + } + if (strcasecmp(argv[1], "1") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("1"); + } + if (strcasecmp(argv[1], "0") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("0"); + } + } + printf("Support for the rollover options is %s.\n", + options[OPT_ROLLOVER].o_request != NULL ? "enabled" : "disabled"); + if (options[OPT_ROLLOVER].o_request != NULL) + printf("Block rollover will be to block %s.\n", + options[OPT_ROLLOVER].o_request); + + + printf("\nThe following rollover options are available:\n" + "\trollover 0 : rollover to block zero (default)\n" + "\trollover 1 : rollover to block one\n" + "\trollover never : do not support the rollover option\n" + "\trollover none : do not support the rollover option\n" + ); +} + +static void +setdebug(int argc, char *argv[]) +{ + int i; + + if (argc != 1) { + i = 1; + while (i < argc) + debug ^= debug_find(argv[i++]); + } + printf("The following debugging is enabled: %s\n", debug_show(debug)); + + printf("\nThe following debugs are available:\n"); + i = 0; + while (debugs[i].name != NULL) { + printf("\t%s\t%s\n", debugs[i].name, debugs[i].desc); + i++; + } +} + +static void +setblocksize(int argc, char *argv[]) +{ + + if (!options_rfc_enabled) + printf("RFC2347 style options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + size_t max; + char maxbuffer[100]; + int *maxdgram; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize should be between %d and %d bytes.\n", + BLKSIZE_MIN, BLKSIZE_MAX); + return; + } else if (size > *maxdgram - 4) { + printf("Blocksize can't be bigger than %d bytes due " + "to the net.inet.udp.maxdgram sysctl limitation.\n", + *maxdgram - 4); + asprintf(&options[OPT_BLKSIZE].o_request, + "%d", *maxdgram - 4); + } else { + asprintf(&options[OPT_BLKSIZE].o_request, "%d", size); + } + } + printf("Blocksize is now %s bytes.\n", options[OPT_BLKSIZE].o_request); +} + +static void +setblocksize2(int argc, char *argv[]) +{ + + if (!options_rfc_enabled || !options_extra_enabled) + printf( + "RFC2347 style or non-RFC defined options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + int i; + size_t max; + char maxbuffer[100]; + int *maxdgram; + + int sizes[] = { + 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096, 8192, 16384, 32768, 0 + }; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + for (i = 0; sizes[i] != 0; i++) { + if (sizes[i] == size) break; + } + if (sizes[i] == 0) { + printf("Blocksize2 should be a power of two between " + "8 and 32768.\n"); + return; + } + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize2 should be between " *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue May 4 06:19:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 603D7106566B; Tue, 4 May 2010 06:19:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 4D8E78FC08; Tue, 4 May 2010 06:19:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o446JKnU025089; Tue, 4 May 2010 06:19:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o446JKZU025085; Tue, 4 May 2010 06:19:20 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201005040619.o446JKZU025085@svn.freebsd.org> From: Warner Losh Date: Tue, 4 May 2010 06:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207608 - head/libexec/tftpd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 06:19:20 -0000 Author: imp Date: Tue May 4 06:19:19 2010 New Revision: 207608 URL: http://svn.freebsd.org/changeset/base/207608 Log: Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Modified: head/libexec/tftpd/Makefile head/libexec/tftpd/tftpd.8 head/libexec/tftpd/tftpd.c Modified: head/libexec/tftpd/Makefile ============================================================================== --- head/libexec/tftpd/Makefile Tue May 4 06:13:17 2010 (r207607) +++ head/libexec/tftpd/Makefile Tue May 4 06:19:19 2010 (r207608) @@ -2,15 +2,14 @@ # $FreeBSD$ PROG= tftpd -SRCS= tftpd.c tftpsubs.c -DPADD= ${LIBUTIL} -LDADD= -lutil - -WARNS?= 1 +SRCS= tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c tftp-options.c +WARNS= 3 WFORMAT=0 - MAN= tftpd.8 -CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp +CFLAGS=-g -Wall +CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd .PATH: ${.CURDIR}/../../usr.bin/tftp +COPTFLAGS = -O +LDFLAGS= -lwrap .include Modified: head/libexec/tftpd/tftpd.8 ============================================================================== --- head/libexec/tftpd/tftpd.8 Tue May 4 06:13:17 2010 (r207607) +++ head/libexec/tftpd/tftpd.8 Tue May 4 06:19:19 2010 (r207608) @@ -40,7 +40,7 @@ .Nd Internet Trivial File Transfer Protocol server .Sh SYNOPSIS .Nm tftpd -.Op Fl cClnwW +.Op Fl cdClnow .Op Fl F Ar strftime-format .Op Fl s Ar directory .Op Fl u Ar user @@ -150,6 +150,9 @@ compatible format string for the creatio .Fl W is specified. By default the string "%Y%m%d" is used. +.It Fl d +Enables debug output. +If specified twice, it will log DATA and ACK packets too. .It Fl l Log all requests using .Xr syslog 3 @@ -164,6 +167,8 @@ must also be enabled in the syslog confi .It Fl n Suppress negative acknowledgement of requests for nonexistent relative filenames. +.It Fl o +Disable support for RFC2347 style TFTP Options. .It Fl s Ar directory Cause .Nm @@ -240,10 +245,16 @@ and the and .Fl W options were introduced in -.Fx 8.0 . +.Fx 7 . .Pp +Support for Timeout Interval and Transfer Size Options (RFC2349) +was introduced in +.Fx 5.0 , +support for the TFTP Blocksize Option (RFC2348) and the blksize2 option +was introduced in +.Fx 7 . .Sh BUGS Files larger than 33488896 octets (65535 blocks) cannot be transferred -without client and server supporting blocksize negotiation (RFC1783). +without client and server supporting blocksize negotiation (RFC2348). .Pp Many tftp clients will not transfer files over 16744448 octets (32767 blocks). Modified: head/libexec/tftpd/tftpd.c ============================================================================== --- head/libexec/tftpd/tftpd.c Tue May 4 06:13:17 2010 (r207607) +++ head/libexec/tftpd/tftpd.c Tue May 4 06:19:19 2010 (r207608) @@ -41,9 +41,9 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); /* * Trivial file transfer protocol server. @@ -56,43 +56,30 @@ static const char rcsid[] = #include #include #include -#include -#include #include #include -#include #include #include #include -#include #include #include -#include -#include #include #include #include #include +#include #include -#include "tftpsubs.h" +#include "tftp-file.h" +#include "tftp-io.h" +#include "tftp-utils.h" +#include "tftp-transfer.h" +#include "tftp-options.h" -#define TIMEOUT 5 -#define MAX_TIMEOUTS 5 - -int peer; -int rexmtval = TIMEOUT; -int max_rexmtval = 2*TIMEOUT; - -#define PKTSIZE SEGSIZE+4 -char buf[PKTSIZE]; -char ackbuf[PKTSIZE]; -struct sockaddr_storage from; - -void tftp(struct tftphdr *, int); -static void unmappedaddr(struct sockaddr_in6 *); +static void tftp_wrq(int peer, char *, ssize_t); +static void tftp_rrq(int peer, char *, ssize_t); /* * Null-terminated directory prefix list for absolute pathname requests and @@ -112,31 +99,44 @@ static int ipchroot; static int create_new = 0; static char *newfile_format = "%Y%m%d"; static int increase_name = 0; -static mode_t mask = S_IWGRP|S_IWOTH; +static mode_t mask = S_IWGRP | S_IWOTH; + +struct formats; +static void tftp_recvfile(int peer, const char *mode); +static void tftp_xmitfile(int peer, const char *mode); +static int validate_access(int peer, char **, int); +static char peername[NI_MAXHOST]; -static const char *errtomsg(int); -static void nak(int); -static void oack(void); +FILE *file; -static void timer(int); -static void justquit(int); +struct formats { + const char *f_mode; + int f_convert; +} formats[] = { + { "netascii", 1 }, + { "octet", 0 }, + { NULL, 0 } +}; int main(int argc, char *argv[]) { struct tftphdr *tp; - socklen_t fromlen, len; - int n; - int ch, on; - struct sockaddr_storage me; - char *chroot_dir = NULL; - struct passwd *nobody; - const char *chuser = "nobody"; + int peer; + socklen_t peerlen, len; + ssize_t n; + int ch; + char *chroot_dir = NULL; + struct passwd *nobody; + const char *chuser = "nobody"; + char recvbuffer[MAXPKTSIZE]; + int allow_ro = 1, allow_wo = 1; tzset(); /* syslog in localtime */ + acting_as_client = 0; - openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP); - while ((ch = getopt(argc, argv, "cCF:lns:u:U:wW")) != -1) { + tftp_openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP); + while ((ch = getopt(argc, argv, "cCd:F:lnoOp:s:u:U:wW")) != -1) { switch (ch) { case 'c': ipchroot = 1; @@ -144,6 +144,12 @@ main(int argc, char *argv[]) case 'C': ipchroot = 2; break; + case 'd': + if (atoi(optarg) != 0) + debug += atoi(optarg); + else + debug |= debug_finds(optarg); + break; case 'F': newfile_format = optarg; break; @@ -153,6 +159,18 @@ main(int argc, char *argv[]) case 'n': suppress_naks = 1; break; + case 'o': + options_rfc_enabled = 0; + break; + case 'O': + options_extra_enabled = 0; + break; + case 'p': + packetdroppercentage = atoi(optarg); + tftp_log(LOG_INFO, + "Randomly dropping %d out of 100 packets", + packetdroppercentage); + break; case 's': chroot_dir = optarg; break; @@ -170,7 +188,8 @@ main(int argc, char *argv[]) increase_name = 1; break; default: - syslog(LOG_WARNING, "ignoring unknown option -%c", ch); + tftp_log(LOG_WARNING, + "ignoring unknown option -%c", ch); } } if (optind < argc) { @@ -191,24 +210,31 @@ main(int argc, char *argv[]) dirs->len = 1; } if (ipchroot > 0 && chroot_dir == NULL) { - syslog(LOG_ERR, "-c requires -s"); + tftp_log(LOG_ERR, "-c requires -s"); exit(1); } umask(mask); - on = 1; - if (ioctl(0, FIONBIO, &on) < 0) { - syslog(LOG_ERR, "ioctl(FIONBIO): %m"); - exit(1); + { + int on = 1; + if (ioctl(0, FIONBIO, &on) < 0) { + tftp_log(LOG_ERR, "ioctl(FIONBIO): %s", strerror(errno)); + exit(1); + } } - fromlen = sizeof (from); - n = recvfrom(0, buf, sizeof (buf), 0, - (struct sockaddr *)&from, &fromlen); + + /* Find out who we are talking to and what we are going to do */ + peerlen = sizeof(peer_sock); + n = recvfrom(0, recvbuffer, MAXPKTSIZE, 0, + (struct sockaddr *)&peer_sock, &peerlen); if (n < 0) { - syslog(LOG_ERR, "recvfrom: %m"); + tftp_log(LOG_ERR, "recvfrom: %s", strerror(errno)); exit(1); } + getnameinfo((struct sockaddr *)&peer_sock, peer_sock.ss_len, + peername, sizeof(peername), NULL, 0, NI_NUMERICHOST); + /* * Now that we have read the message out of the UDP * socket, we fork and exit. Thus, inetd will go back @@ -240,9 +266,9 @@ main(int argc, char *argv[]) * than one tftpd being started up to service * a single request from a single client. */ - fromlen = sizeof from; - i = recvfrom(0, buf, sizeof (buf), 0, - (struct sockaddr *)&from, &fromlen); + peerlen = sizeof peer_sock; + i = recvfrom(0, recvbuffer, MAXPKTSIZE, 0, + (struct sockaddr *)&peer_sock, &peerlen); if (i > 0) { n = i; } @@ -251,7 +277,7 @@ main(int argc, char *argv[]) } } if (pid < 0) { - syslog(LOG_ERR, "fork: %m"); + tftp_log(LOG_ERR, "fork: %s", strerror(errno)); exit(1); } else if (pid != 0) { exit(0); @@ -259,6 +285,55 @@ main(int argc, char *argv[]) } /* + * See if the client is allowed to talk to me. + * (This needs to be done before the chroot()) + */ + { + struct request_info req; + + request_init(&req, RQ_CLIENT_ADDR, peername, 0); + request_set(&req, RQ_DAEMON, "tftpd", 0); + + if (hosts_access(&req) == 0) { + if (debug&DEBUG_ACCESS) + tftp_log(LOG_WARNING, + "Access denied by 'tftpd' entry " + "in /etc/hosts.allow"); + + /* + * Full access might be disabled, but maybe the + * client is allowed to do read-only access. + */ + request_set(&req, RQ_DAEMON, "tftpd-ro", 0); + allow_ro = hosts_access(&req); + + request_set(&req, RQ_DAEMON, "tftpd-wo", 0); + allow_wo = hosts_access(&req); + + if (allow_ro == 0 && allow_wo == 0) { + tftp_log(LOG_WARNING, + "Unauthorized access from %s", peername); + exit(1); + } + + if (debug&DEBUG_ACCESS) { + if (allow_ro) + tftp_log(LOG_WARNING, + "But allowed readonly access " + "via 'tftpd-ro' entry"); + if (allow_wo) + tftp_log(LOG_WARNING, + "But allowed writeonly access " + "via 'tftpd-wo' entry"); + } + } else + if (debug&DEBUG_ACCESS) + tftp_log(LOG_WARNING, + "Full access allowed" + "in /etc/hosts.allow"); + } + + /* * Since we exit here, we should do that only after the above * recvfrom to keep inetd from constantly forking should there * be a problem. See the above comment about system clogging. @@ -271,7 +346,8 @@ main(int argc, char *argv[]) struct sockaddr_storage ss; char hbuf[NI_MAXHOST]; - memcpy(&ss, &from, from.ss_len); + statret = -1; + memcpy(&ss, &peer_sock, peer_sock.ss_len); unmappedaddr((struct sockaddr_in6 *)&ss); getnameinfo((struct sockaddr *)&ss, ss.ss_len, hbuf, sizeof(hbuf), NULL, 0, @@ -285,11 +361,12 @@ main(int argc, char *argv[]) } /* Must get this before chroot because /etc might go away */ if ((nobody = getpwnam(chuser)) == NULL) { - syslog(LOG_ERR, "%s: no such user", chuser); + tftp_log(LOG_ERR, "%s: no such user", chuser); exit(1); } if (chroot(chroot_dir)) { - syslog(LOG_ERR, "chroot: %s: %m", chroot_dir); + tftp_log(LOG_ERR, "chroot: %s: %s", + chroot_dir, strerror(errno)); exit(1); } chdir("/"); @@ -297,44 +374,56 @@ main(int argc, char *argv[]) setuid(nobody->pw_uid); } - len = sizeof(me); - if (getsockname(0, (struct sockaddr *)&me, &len) == 0) { - switch (me.ss_family) { + len = sizeof(me_sock); + if (getsockname(0, (struct sockaddr *)&me_sock, &len) == 0) { + switch (me_sock.ss_family) { case AF_INET: - ((struct sockaddr_in *)&me)->sin_port = 0; + ((struct sockaddr_in *)&me_sock)->sin_port = 0; break; case AF_INET6: - ((struct sockaddr_in6 *)&me)->sin6_port = 0; + ((struct sockaddr_in6 *)&me_sock)->sin6_port = 0; break; default: /* unsupported */ break; } } else { - memset(&me, 0, sizeof(me)); - me.ss_family = from.ss_family; - me.ss_len = from.ss_len; + memset(&me_sock, 0, sizeof(me_sock)); + me_sock.ss_family = peer_sock.ss_family; + me_sock.ss_len = peer_sock.ss_len; } - alarm(0); close(0); close(1); - peer = socket(from.ss_family, SOCK_DGRAM, 0); + peer = socket(peer_sock.ss_family, SOCK_DGRAM, 0); if (peer < 0) { - syslog(LOG_ERR, "socket: %m"); + tftp_log(LOG_ERR, "socket: %s", strerror(errno)); exit(1); } - if (bind(peer, (struct sockaddr *)&me, me.ss_len) < 0) { - syslog(LOG_ERR, "bind: %m"); + if (bind(peer, (struct sockaddr *)&me_sock, me_sock.ss_len) < 0) { + tftp_log(LOG_ERR, "bind: %s", strerror(errno)); exit(1); } - if (connect(peer, (struct sockaddr *)&from, from.ss_len) < 0) { - syslog(LOG_ERR, "connect: %m"); - exit(1); - } - tp = (struct tftphdr *)buf; + + tp = (struct tftphdr *)recvbuffer; tp->th_opcode = ntohs(tp->th_opcode); - if (tp->th_opcode == RRQ || tp->th_opcode == WRQ) - tftp(tp, n); + if (tp->th_opcode == RRQ) { + if (allow_ro) + tftp_rrq(peer, tp->th_stuff, n - 1); + else { + tftp_log(LOG_WARNING, + "%s read access denied", peername); + exit(1); + } + } + if (tp->th_opcode == WRQ) { + if (allow_wo) + tftp_wrq(peer, tp->th_stuff, n - 1); + else { + tftp_log(LOG_WARNING, + "%s write access denied", peername); + exit(1); + } + } exit(1); } @@ -369,138 +458,145 @@ reduce_path(char *fn) } } -struct formats; -int validate_access(char **, int); -void xmitfile(struct formats *); -void recvfile(struct formats *); +static char * +parse_header(int peer, char *recvbuffer, ssize_t size, + char **filename, char **mode) +{ + char *cp; + int i; + struct formats *pf; -struct formats { - const char *f_mode; - int (*f_validate)(char **, int); - void (*f_send)(struct formats *); - void (*f_recv)(struct formats *); - int f_convert; -} formats[] = { - { "netascii", validate_access, xmitfile, recvfile, 1 }, - { "octet", validate_access, xmitfile, recvfile, 0 }, -#ifdef notdef - { "mail", validate_user, sendmail, recvmail, 1 }, -#endif - { 0, NULL, NULL, NULL, 0 } -}; + *mode = NULL; + cp = recvbuffer; -struct options { - const char *o_type; - char *o_request; - int o_reply; /* turn into union if need be */ -} options[] = { - { "tsize", NULL, 0 }, /* OPT_TSIZE */ - { "timeout", NULL, 0 }, /* OPT_TIMEOUT */ - { NULL, NULL, 0 } -}; + i = get_field(peer, recvbuffer, size); + if (i >= PATH_MAX) { + tftp_log(LOG_ERR, "Bad option - filename too long"); + send_error(peer, EBADOP); + exit(1); + } + *filename = recvbuffer; + tftp_log(LOG_INFO, "Filename: '%s'", *filename); + cp += i; -enum opt_enum { - OPT_TSIZE = 0, - OPT_TIMEOUT, -}; + i = get_field(peer, cp, size); + *mode = cp; + cp += i; + + /* Find the file transfer mode */ + for (cp = *mode; *cp; cp++) + if (isupper(*cp)) + *cp = tolower(*cp); + for (pf = formats; pf->f_mode; pf++) + if (strcmp(pf->f_mode, *mode) == 0) + break; + if (pf->f_mode == NULL) { + tftp_log(LOG_ERR, + "Bad option - Unknown transfer mode (%s)", *mode); + send_error(peer, EBADOP); + exit(1); + } + tftp_log(LOG_INFO, "Mode: '%s'", *mode); + + return (cp + 1); +} /* - * Handle initial connection protocol. + * WRQ - receive a file from the client */ void -tftp(struct tftphdr *tp, int size) +tftp_wrq(int peer, char *recvbuffer, ssize_t size) { char *cp; - int i, first = 1, has_options = 0, ecode; - struct formats *pf; - char *filename, *mode, *option, *ccp; + int has_options = 0, ecode; + char *filename, *mode; char fnbuf[PATH_MAX]; - cp = tp->th_stuff; -again: - while (cp < buf + size) { - if (*cp == '\0') - break; - cp++; + cp = parse_header(peer, recvbuffer, size, &filename, &mode); + size -= (cp - recvbuffer) + 1; + + strcpy(fnbuf, filename); + reduce_path(fnbuf); + filename = fnbuf; + + if (size > 0) { + if (options_rfc_enabled) + has_options = !parse_options(peer, cp, size); + else + tftp_log(LOG_INFO, "Options found but not enabled"); } - if (*cp != '\0') { - nak(EBADOP); - exit(1); + + ecode = validate_access(peer, &filename, WRQ); + if (ecode == 0) { + if (has_options) + send_oack(peer); + else + send_ack(peer, 0); } - i = cp - tp->th_stuff; - if (i >= sizeof(fnbuf)) { - nak(EBADOP); - exit(1); + if (logging) { + tftp_log(LOG_INFO, "%s: write request for %s: %s", peername, + filename, errtomsg(ecode)); } - memcpy(fnbuf, tp->th_stuff, i); - fnbuf[i] = '\0'; + + tftp_recvfile(peer, mode); + exit(0); +} + +/* + * RRQ - send a file to the client + */ +void +tftp_rrq(int peer, char *recvbuffer, ssize_t size) +{ + char *cp; + int has_options = 0, ecode; + char *filename, *mode; + char fnbuf[PATH_MAX]; + + cp = parse_header(peer, recvbuffer, size, &filename, &mode); + size -= (cp - recvbuffer) + 1; + + strcpy(fnbuf, filename); reduce_path(fnbuf); filename = fnbuf; - if (first) { - mode = ++cp; - first = 0; - goto again; - } - for (cp = mode; *cp; cp++) - if (isupper(*cp)) - *cp = tolower(*cp); - for (pf = formats; pf->f_mode; pf++) - if (strcmp(pf->f_mode, mode) == 0) - break; - if (pf->f_mode == 0) { - nak(EBADOP); - exit(1); - } - while (++cp < buf + size) { - for (i = 2, ccp = cp; i > 0; ccp++) { - if (ccp >= buf + size) { - /* - * Don't reject the request, just stop trying - * to parse the option and get on with it. - * Some Apple Open Firmware versions have - * trailing garbage on the end of otherwise - * valid requests. - */ - goto option_fail; - } else if (*ccp == '\0') - i--; - } - for (option = cp; *cp; cp++) - if (isupper(*cp)) - *cp = tolower(*cp); - for (i = 0; options[i].o_type != NULL; i++) - if (strcmp(option, options[i].o_type) == 0) { - options[i].o_request = ++cp; - has_options = 1; - } - cp = ccp-1; + + if (size > 0) { + if (options_rfc_enabled) + has_options = !parse_options(peer, cp, size); + else + tftp_log(LOG_INFO, "Options found but not enabled"); } -option_fail: - if (options[OPT_TIMEOUT].o_request) { - int to = atoi(options[OPT_TIMEOUT].o_request); - if (to < 1 || to > 255) { - nak(EBADOP); - exit(1); + ecode = validate_access(peer, &filename, RRQ); + if (ecode == 0) { + if (has_options) { + int n; + char lrecvbuffer[MAXPKTSIZE]; + struct tftphdr *rp = (struct tftphdr *)lrecvbuffer; + + send_oack(peer); + n = receive_packet(peer, lrecvbuffer, MAXPKTSIZE, + NULL, timeoutpacket); + if (n < 0) { + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_DEBUG, "Aborting: %s", + rp_strerror(n)); + return; + } + if (rp->th_opcode != ACK) { + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_DEBUG, + "Expected ACK, got %s on OACK", + packettype(rp->th_opcode)); + return; + } } - else if (to <= max_rexmtval) - options[OPT_TIMEOUT].o_reply = rexmtval = to; - else - options[OPT_TIMEOUT].o_request = NULL; } - ecode = (*pf->f_validate)(&filename, tp->th_opcode); - if (has_options && ecode == 0) - oack(); - if (logging) { - char hbuf[NI_MAXHOST]; + if (logging) + tftp_log(LOG_INFO, "%s: read request for %s: %s", peername, + filename, errtomsg(ecode)); - getnameinfo((struct sockaddr *)&from, from.ss_len, - hbuf, sizeof(hbuf), NULL, 0, 0); - syslog(LOG_INFO, "%s: %s request for %s: %s", hbuf, - tp->th_opcode == WRQ ? "write" : "read", - filename, errtomsg(ecode)); - } if (ecode) { /* * Avoid storms of naks to a RRQ broadcast for a relative @@ -508,19 +604,13 @@ option_fail: */ if (suppress_naks && *filename != '/' && ecode == ENOTFOUND) exit(0); - nak(ecode); + tftp_log(LOG_ERR, "Prevent NAK storm"); + send_error(peer, ecode); exit(1); } - if (tp->th_opcode == WRQ) - (*pf->f_recv)(pf); - else - (*pf->f_send)(pf); - exit(0); + tftp_xmitfile(peer, mode); } - -FILE *file; - /* * Find the next value for YYYYMMDD.nn when the file to be written should * be unique. Due to the limitations of nn, we will fail if nn reaches 100. @@ -536,8 +626,6 @@ find_next_name(char *filename, int *fd) struct tm lt; char yyyymmdd[MAXPATHLEN]; char newname[MAXPATHLEN]; - struct stat sb; - int ret; /* Create the YYYYMMDD part of the filename */ time(&tval); @@ -553,7 +641,7 @@ find_next_name(char *filename, int *fd) /* Make sure the new filename is not too long */ if (strlen(filename) > MAXPATHLEN - len - 5) { syslog(LOG_WARNING, - "Filename too long (%d characters, %d maximum)", + "Filename too long (%zd characters, %zd maximum)", strlen(filename), MAXPATHLEN - len - 5); return (EACCESS); } @@ -584,7 +672,7 @@ find_next_name(char *filename, int *fd) * given as we have no login directory. */ int -validate_access(char **filep, int mode) +validate_access(int peer, char **filep, int mode) { struct stat stbuf; int fd; @@ -660,14 +748,13 @@ validate_access(char **filep, int mode) else if (mode == RRQ) return (err); } - if (options[OPT_TSIZE].o_request) { - if (mode == RRQ) - options[OPT_TSIZE].o_reply = stbuf.st_size; - else - /* XXX Allows writes of all sizes. */ - options[OPT_TSIZE].o_reply = - atoi(options[OPT_TSIZE].o_request); - } + + /* + * This option is handled here because it (might) require(s) the + * size of the file. + */ + option_tsize(peer, NULL, mode, &stbuf); + if (mode == RRQ) fd = open(filename, O_RDONLY); else { @@ -694,305 +781,60 @@ validate_access(char **filep, int mode) return (0); } -int timeouts; -jmp_buf timeoutbuf; - -void -timer(int sig __unused) +static void +tftp_xmitfile(int peer, const char *mode) { - if (++timeouts > MAX_TIMEOUTS) - exit(1); - longjmp(timeoutbuf, 1); -} + uint16_t block; + uint32_t amount; + time_t now; + struct tftp_stats ts; + + now = time(NULL); + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_DEBUG, "Transmitting file"); -/* - * Send the requested file. - */ -void -xmitfile(struct formats *pf) -{ - struct tftphdr *dp; - struct tftphdr *ap; /* ack packet */ - int size, n; - volatile unsigned short block; - - signal(SIGALRM, timer); - dp = r_init(); - ap = (struct tftphdr *)ackbuf; + read_init(0, file, mode); block = 1; - do { - size = readit(file, &dp, pf->f_convert); - if (size < 0) { - nak(errno + 100); - goto abort; - } - dp->th_opcode = htons((u_short)DATA); - dp->th_block = htons((u_short)block); - timeouts = 0; - (void)setjmp(timeoutbuf); - -send_data: - { - int i, t = 1; - for (i = 0; ; i++){ - if (send(peer, dp, size + 4, 0) != size + 4) { - sleep(t); - t = (t < 32) ? t<< 1 : t; - if (i >= 12) { - syslog(LOG_ERR, "write: %m"); - goto abort; - } - } - break; - } - } - read_ahead(file, pf->f_convert); - for ( ; ; ) { - alarm(rexmtval); /* read the ack */ - n = recv(peer, ackbuf, sizeof (ackbuf), 0); - alarm(0); - if (n < 0) { - syslog(LOG_ERR, "read: %m"); - goto abort; - } - ap->th_opcode = ntohs((u_short)ap->th_opcode); - ap->th_block = ntohs((u_short)ap->th_block); - - if (ap->th_opcode == ERROR) - goto abort; - - if (ap->th_opcode == ACK) { - if (ap->th_block == block) - break; - /* Re-synchronize with the other side */ - (void) synchnet(peer); - if (ap->th_block == (block -1)) - goto send_data; - } - - } - block++; - } while (size == SEGSIZE); -abort: - (void) fclose(file); + tftp_send(peer, &block, &ts); + read_close(); + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_INFO, "Sent %d bytes in %d seconds", + amount, time(NULL) - now); } -void -justquit(int sig __unused) +static void +tftp_recvfile(int peer, const char *mode) { - exit(0); -} + uint32_t filesize; + uint16_t block; + struct timeval now1, now2; + struct tftp_stats ts; + + gettimeofday(&now1, NULL); + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_DEBUG, "Receiving file"); + write_init(0, file, mode); -/* - * Receive a file. - */ -void -recvfile(struct formats *pf) -{ - struct tftphdr *dp; - struct tftphdr *ap; /* ack buffer */ - int n, size; - volatile unsigned short block; - - signal(SIGALRM, timer); - dp = w_init(); - ap = (struct tftphdr *)ackbuf; block = 0; - do { - timeouts = 0; - ap->th_opcode = htons((u_short)ACK); - ap->th_block = htons((u_short)block); - block++; - (void) setjmp(timeoutbuf); -send_ack: - if (send(peer, ackbuf, 4, 0) != 4) { - syslog(LOG_ERR, "write: %m"); - goto abort; - } - write_behind(file, pf->f_convert); - for ( ; ; ) { - alarm(rexmtval); - n = recv(peer, dp, PKTSIZE, 0); - alarm(0); - if (n < 0) { /* really? */ - syslog(LOG_ERR, "read: %m"); - goto abort; - } - dp->th_opcode = ntohs((u_short)dp->th_opcode); - dp->th_block = ntohs((u_short)dp->th_block); - if (dp->th_opcode == ERROR) - goto abort; - if (dp->th_opcode == DATA) { - if (dp->th_block == block) { - break; /* normal */ - } - /* Re-synchronize with the other side */ - (void) synchnet(peer); - if (dp->th_block == (block-1)) - goto send_ack; /* rexmit */ - } - } - /* size = write(file, dp->th_data, n - 4); */ - size = writeit(file, &dp, n - 4, pf->f_convert); - if (size != (n-4)) { /* ahem */ - if (size < 0) nak(errno + 100); - else nak(ENOSPACE); - goto abort; - } - } while (size == SEGSIZE); - write_behind(file, pf->f_convert); - (void) fclose(file); /* close data file */ - - ap->th_opcode = htons((u_short)ACK); /* send the "final" ack */ - ap->th_block = htons((u_short)(block)); - (void) send(peer, ackbuf, 4, 0); - - signal(SIGALRM, justquit); /* just quit on timeout */ - alarm(rexmtval); - n = recv(peer, buf, sizeof (buf), 0); /* normally times out and quits */ - alarm(0); - if (n >= 4 && /* if read some data */ - dp->th_opcode == DATA && /* and got a data block */ - block == dp->th_block) { /* then my last ack was lost */ - (void) send(peer, ackbuf, 4, 0); /* resend final ack */ - } -abort: - return; -} - -struct errmsg { - int e_code; - const char *e_msg; -} errmsgs[] = { - { EUNDEF, "Undefined error code" }, - { ENOTFOUND, "File not found" }, - { EACCESS, "Access violation" }, - { ENOSPACE, "Disk full or allocation exceeded" }, - { EBADOP, "Illegal TFTP operation" }, - { EBADID, "Unknown transfer ID" }, - { EEXISTS, "File already exists" }, - { ENOUSER, "No such user" }, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue May 4 10:14:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 57573106566C; Tue, 4 May 2010 10:14:06 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 44D618FC16; Tue, 4 May 2010 10:14:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44AE6kX076886; Tue, 4 May 2010 10:14:06 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44AE6A6076880; Tue, 4 May 2010 10:14:06 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201005041014.o44AE6A6076880@svn.freebsd.org> From: Kevin Lo Date: Tue, 4 May 2010 10:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207611 - in head/sys: arm/arm arm/include conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 10:14:06 -0000 Author: kevlo Date: Tue May 4 10:14:05 2010 New Revision: 207611 URL: http://svn.freebsd.org/changeset/base/207611 Log: Add support for FA626TE. Tested on GM8181 development board. Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/cpufunc_asm_fa526.S head/sys/arm/arm/elf_trampoline.c head/sys/arm/arm/identcpu.c head/sys/arm/include/cpuconf.h head/sys/arm/include/cpufunc.h head/sys/conf/options.arm Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Tue May 4 08:37:28 2010 (r207610) +++ head/sys/arm/arm/cpufunc.c Tue May 4 10:14:05 2010 (r207611) @@ -783,69 +783,66 @@ struct cpu_functions xscalec3_cpufuncs = #endif /* CPU_XSCALE_81342 */ -#if defined(CPU_FA526) +#if defined(CPU_FA526) || defined(CPU_FA626TE) struct cpu_functions fa526_cpufuncs = { /* CPU functions */ - .cf_id = cpufunc_id, - .cf_cpwait = cpufunc_nullop, + cpufunc_id, /* id */ + cpufunc_nullop, /* cpwait */ /* MMU functions */ - .cf_control = cpufunc_control, - .cf_domains = cpufunc_domains, - .cf_setttb = fa526_setttb, - .cf_faultstatus = cpufunc_faultstatus, - .cf_faultaddress = cpufunc_faultaddress, + cpufunc_control, /* control */ + cpufunc_domains, /* domain */ + fa526_setttb, /* setttb */ + cpufunc_faultstatus, /* faultstatus */ + cpufunc_faultaddress, /* faultaddress */ /* TLB functions */ - .cf_tlb_flushID = armv4_tlb_flushID, - .cf_tlb_flushID_SE = fa526_tlb_flushID_SE, - .cf_tlb_flushI = armv4_tlb_flushI, - .cf_tlb_flushI_SE = fa526_tlb_flushI_SE, - .cf_tlb_flushD = armv4_tlb_flushD, - .cf_tlb_flushD_SE = armv4_tlb_flushD_SE, + armv4_tlb_flushID, /* tlb_flushID */ + fa526_tlb_flushID_SE, /* tlb_flushID_SE */ + armv4_tlb_flushI, /* tlb_flushI */ + fa526_tlb_flushI_SE, /* tlb_flushI_SE */ + armv4_tlb_flushD, /* tlb_flushD */ + armv4_tlb_flushD_SE, /* tlb_flushD_SE */ /* Cache operations */ - .cf_icache_sync_all = fa526_icache_sync_all, - .cf_icache_sync_range = fa526_icache_sync_range, - - .cf_dcache_wbinv_all = fa526_dcache_wbinv_all, - .cf_dcache_wbinv_range = fa526_dcache_wbinv_range, - .cf_dcache_inv_range = fa526_dcache_inv_range, - .cf_dcache_wb_range = fa526_dcache_wb_range, - - .cf_idcache_wbinv_all = fa526_idcache_wbinv_all, - .cf_idcache_wbinv_range = fa526_idcache_wbinv_range, - - - .cf_l2cache_wbinv_all = cpufunc_nullop, - .cf_l2cache_wbinv_range = (void *)cpufunc_nullop, - .cf_l2cache_inv_range = (void *)cpufunc_nullop, - .cf_l2cache_wb_range = (void *)cpufunc_nullop, + fa526_icache_sync_all, /* icache_sync_all */ + fa526_icache_sync_range, /* icache_sync_range */ + fa526_dcache_wbinv_all, /* dcache_wbinv_all */ + fa526_dcache_wbinv_range, /* dcache_wbinv_range */ + fa526_dcache_inv_range, /* dcache_inv_range */ + fa526_dcache_wb_range, /* dcache_wb_range */ + + fa526_idcache_wbinv_all, /* idcache_wbinv_all */ + fa526_idcache_wbinv_range, /* idcache_wbinv_range */ + cpufunc_nullop, /* l2cache_wbinv_all */ + (void *)cpufunc_nullop, /* l2cache_wbinv_range */ + (void *)cpufunc_nullop, /* l2cache_inv_range */ + (void *)cpufunc_nullop, /* l2cache_wb_range */ /* Other functions */ - .cf_flush_prefetchbuf = fa526_flush_prefetchbuf, - .cf_drain_writebuf = armv4_drain_writebuf, - .cf_flush_brnchtgt_C = cpufunc_nullop, - .cf_flush_brnchtgt_E = fa526_flush_brnchtgt_E, + fa526_flush_prefetchbuf, /* flush_prefetchbuf */ + armv4_drain_writebuf, /* drain_writebuf */ + cpufunc_nullop, /* flush_brnchtgt_C */ + fa526_flush_brnchtgt_E, /* flush_brnchtgt_E */ - .cf_sleep = fa526_cpu_sleep, + fa526_cpu_sleep, /* sleep */ /* Soft functions */ - .cf_dataabt_fixup = cpufunc_null_fixup, - .cf_prefetchabt_fixup = cpufunc_null_fixup, + cpufunc_null_fixup, /* dataabt_fixup */ + cpufunc_null_fixup, /* prefetchabt_fixup */ - .cf_context_switch = fa526_context_switch, + fa526_context_switch, /* context_switch */ - .cf_setup = fa526_setup -}; -#endif /* CPU_FA526 */ + fa526_setup /* cpu setup */ +}; +#endif /* CPU_FA526 || CPU_FA626TE */ /* @@ -856,11 +853,11 @@ struct cpu_functions cpufuncs; u_int cputype; u_int cpu_reset_needs_v4_MMU_disable; /* flag used in locore.s */ -#if defined(CPU_ARM7TDMI) || defined(CPU_ARM8) || defined(CPU_ARM9) || \ - defined (CPU_ARM9E) || defined (CPU_ARM10) || \ - defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ - defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ - defined(CPU_FA526) || \ +#if defined(CPU_ARM7TDMI) || defined(CPU_ARM8) || defined(CPU_ARM9) || \ + defined (CPU_ARM9E) || defined (CPU_ARM10) || \ + defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ + defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ + defined(CPU_FA526) || defined(CPU_FA626TE) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) static void get_cachetype_cp15(void); @@ -1141,8 +1138,8 @@ set_cpufuncs() goto out; } #endif /* CPU_SA1110 */ -#ifdef CPU_FA526 - if (cputype == CPU_ID_FA526) { +#if defined(CPU_FA526) || defined(CPU_FA626TE) + if (cputype == CPU_ID_FA526 || cputype == CPU_ID_FA626TE) { cpufuncs = fa526_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* SA needs it */ get_cachetype_cp15(); @@ -1153,7 +1150,7 @@ set_cpufuncs() goto out; } -#endif /* CPU_FA526 */ +#endif /* CPU_FA526 || CPU_FA626TE */ #ifdef CPU_IXP12X0 if (cputype == CPU_ID_IXP1200) { cpufuncs = ixp12x0_cpufuncs; @@ -1629,7 +1626,7 @@ late_abort_fixup(arg) defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \ defined(CPU_ARM10) || defined(CPU_ARM11) || \ - defined(CPU_FA526) + defined(CPU_FA526) || defined(CPU_FA626TE) #define IGN 0 #define OR 1 @@ -2095,7 +2092,7 @@ sa11x0_setup(args) } #endif /* CPU_SA1100 || CPU_SA1110 */ -#if defined(CPU_FA526) +#if defined(CPU_FA526) || defined(CPU_FA626TE) struct cpu_option fa526_options[] = { #ifdef COMPAT_12 { "nocache", IGN, BIC, (CPU_CONTROL_IC_ENABLE | @@ -2149,7 +2146,7 @@ fa526_setup(char *args) ctrl = cpuctrl; cpu_control(0xffffffff, cpuctrl); } -#endif /* CPU_FA526 */ +#endif /* CPU_FA526 || CPU_FA626TE */ #if defined(CPU_IXP12X0) Modified: head/sys/arm/arm/cpufunc_asm_fa526.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_fa526.S Tue May 4 08:37:28 2010 (r207610) +++ head/sys/arm/arm/cpufunc_asm_fa526.S Tue May 4 10:14:05 2010 (r207611) @@ -32,7 +32,11 @@ #include __FBSDID("$FreeBSD$"); +#ifdef CPU_FA526 #define CACHELINE_SIZE 16 +#else +#define CACHELINE_SIZE 32 +#endif ENTRY(fa526_setttb) mov r1, #0 Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Tue May 4 08:37:28 2010 (r207610) +++ head/sys/arm/arm/elf_trampoline.c Tue May 4 10:14:05 2010 (r207611) @@ -57,7 +57,7 @@ void __startC(void); #define cpu_idcache_wbinv_all arm8_cache_purgeID #elif defined(CPU_ARM9) #define cpu_idcache_wbinv_all arm9_idcache_wbinv_all -#elif defined(CPU_FA526) +#elif defined(CPU_FA526) || defined(CPU_FA626TE) #define cpu_idcache_wbinv_all fa526_idcache_wbinv_all #elif defined(CPU_ARM9E) #define cpu_idcache_wbinv_all armv5_ec_idcache_wbinv_all Modified: head/sys/arm/arm/identcpu.c ============================================================================== --- head/sys/arm/arm/identcpu.c Tue May 4 08:37:28 2010 (r207610) +++ head/sys/arm/arm/identcpu.c Tue May 4 10:14:05 2010 (r207611) @@ -220,7 +220,9 @@ const struct cpuidtab cpuids[] = { generic_steppings }, { CPU_ID_ARM966ESR1, CPU_CLASS_ARM9ES, "ARM966E-S", generic_steppings }, - { CPU_ID_FA526, CPU_CLASS_ARM9, "FA526", + { CPU_ID_FA526, CPU_CLASS_ARM9, "FA526", + generic_steppings }, + { CPU_ID_FA626TE, CPU_CLASS_ARM9ES, "FA626TE", generic_steppings }, { CPU_ID_TI925T, CPU_CLASS_ARM9TDMI, "TI ARM925T", Modified: head/sys/arm/include/cpuconf.h ============================================================================== --- head/sys/arm/include/cpuconf.h Tue May 4 08:37:28 2010 (r207610) +++ head/sys/arm/include/cpuconf.h Tue May 4 10:14:05 2010 (r207611) @@ -62,6 +62,7 @@ defined(CPU_XSCALE_80321) + \ defined(CPU_XSCALE_PXA2X0) + \ defined(CPU_FA526) + \ + defined(CPU_FA626TE) + \ defined(CPU_XSCALE_IXP425)) /* @@ -78,7 +79,7 @@ #if (defined(CPU_ARM9E) || defined(CPU_ARM10) || \ defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) || \ - defined(CPU_XSCALE_PXA2X0)) + defined(CPU_XSCALE_PXA2X0) || defined(CPU_FA626TE)) #define ARM_ARCH_5 1 #else #define ARM_ARCH_5 0 @@ -126,7 +127,8 @@ #if (defined(CPU_ARM6) || defined(CPU_ARM7) || defined(CPU_ARM7TDMI) || \ defined(CPU_ARM8) || defined(CPU_ARM9) || defined(CPU_ARM9E) || \ - defined(CPU_ARM10) || defined(CPU_ARM11) || defined(CPU_FA526)) + defined(CPU_ARM10) || defined(CPU_ARM11) || defined(CPU_FA526) || \ + defined(CPU_FA626TE)) #define ARM_MMU_GENERIC 1 #else #define ARM_MMU_GENERIC 0 Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Tue May 4 08:37:28 2010 (r207610) +++ head/sys/arm/include/cpufunc.h Tue May 4 10:14:05 2010 (r207611) @@ -284,7 +284,7 @@ u_int arm8_clock_config (u_int, u_int); #endif -#ifdef CPU_FA526 +#if defined(CPU_FA526) || defined(CPU_FA626TE) void fa526_setup (char *arg); void fa526_setttb (u_int ttb); void fa526_context_switch (void); @@ -464,11 +464,11 @@ extern unsigned armv5_dcache_index_max; extern unsigned armv5_dcache_index_inc; #endif -#if defined(CPU_ARM9) || defined(CPU_ARM9E) || defined(CPU_ARM10) || \ - defined(CPU_SA110) || defined(CPU_SA1100) || defined(CPU_SA1110) || \ - defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ - defined(CPU_FA526) || \ - defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ +#if defined(CPU_ARM9) || defined(CPU_ARM9E) || defined(CPU_ARM10) || \ + defined(CPU_SA110) || defined(CPU_SA1100) || defined(CPU_SA1110) || \ + defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ + defined(CPU_FA526) || defined(CPU_FA626TE) || \ + defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) void armv4_tlb_flushID (void); Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Tue May 4 08:37:28 2010 (r207610) +++ head/sys/conf/options.arm Tue May 4 10:14:05 2010 (r207611) @@ -37,3 +37,4 @@ AT91_BWCT opt_at91.h AT91_TSC opt_at91.h AT91_KWIKBYTE opt_at91.h CPU_FA526 opt_global.h +CPU_FA626TE opt_global.h From owner-svn-src-head@FreeBSD.ORG Tue May 4 11:25:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 956661065670; Tue, 4 May 2010 11:25:05 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 867058FC1D; Tue, 4 May 2010 11:25:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44BP5fv098018; Tue, 4 May 2010 11:25:05 GMT (envelope-from nork@svn.freebsd.org) Received: (from nork@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44BP5eW098015; Tue, 4 May 2010 11:25:05 GMT (envelope-from nork@svn.freebsd.org) Message-Id: <201005041125.o44BP5eW098015@svn.freebsd.org> From: Norikatsu Shigemura Date: Tue, 4 May 2010 11:25:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207612 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 11:25:05 -0000 Author: nork Date: Tue May 4 11:25:04 2010 New Revision: 207612 URL: http://svn.freebsd.org/changeset/base/207612 Log: Add support run services_mkdb(8). Approved by: dougb, imp (mentor) Reviewed by: ume MFC after: 2 weeks Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Tue May 4 10:14:05 2010 (r207611) +++ head/usr.sbin/mergemaster/mergemaster.sh Tue May 4 11:25:04 2010 (r207612) @@ -849,6 +849,9 @@ mm_install () { /etc/login.conf) NEED_CAP_MKDB=yes ;; + /etc/services) + NEED_SERVICES_MKDB=yes + ;; /etc/master.passwd) do_install_and_rm 600 "${1}" "${DESTDIR}${INSTALL_DIR}" NEED_PWD_MKDB=yes @@ -1278,6 +1281,17 @@ case "${NEED_CAP_MKDB}" in ;; esac +case "${NEED_SERVICES_MKDB}" in +'') ;; +*) + echo '' + echo "*** You installed a services file, so make sure that you run" + echo " '/usr/sbin/services_mkdb -q -o ${DESTDIR}/var/db/services.db ${DESTDIR}/etc/services'" + echo " to rebuild your services database" + run_it_now "/usr/sbin/services_mkdb -q -o ${DESTDIR}/var/db/services.db ${DESTDIR}/etc/services" + ;; +esac + case "${NEED_PWD_MKDB}" in '') ;; *) From owner-svn-src-head@FreeBSD.ORG Tue May 4 11:34:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E05151065676; Tue, 4 May 2010 11:34:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C91078FC1B; Tue, 4 May 2010 11:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44BYE77000727; Tue, 4 May 2010 11:34:14 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44BYENg000724; Tue, 4 May 2010 11:34:14 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201005041134.o44BYENg000724@svn.freebsd.org> From: Ed Maste Date: Tue, 4 May 2010 11:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207613 - head/usr.bin/chpass X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 11:34:15 -0000 Author: emaste Date: Tue May 4 11:34:13 2010 New Revision: 207613 URL: http://svn.freebsd.org/changeset/base/207613 Log: Restore historical behaviour of only executing chflags on files that exist. This eliminates cosmetic errors of the form "chflags: ...: No such file or directory" during an installworld to an empty destination. Modified: head/usr.bin/chpass/Makefile Modified: head/usr.bin/chpass/Makefile ============================================================================== --- head/usr.bin/chpass/Makefile Tue May 4 11:25:04 2010 (r207612) +++ head/usr.bin/chpass/Makefile Tue May 4 11:34:13 2010 (r207613) @@ -38,7 +38,9 @@ MLINKS+= chpass.1 ypchpass.1 chpass.1 yp beforeinstall: .for i in chpass chfn chsh ypchpass ypchfn ypchsh +.if exists(${DESTDIR}${BINDIR}/$i) -chflags noschg ${DESTDIR}${BINDIR}/$i +.endif .endfor .if !defined(NO_FSCHG) From owner-svn-src-head@FreeBSD.ORG Tue May 4 13:07:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D77961065673; Tue, 4 May 2010 13:07:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C5E498FC19; Tue, 4 May 2010 13:07:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44D7eGj025795; Tue, 4 May 2010 13:07:40 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44D7eHn025794; Tue, 4 May 2010 13:07:40 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201005041307.o44D7eHn025794@svn.freebsd.org> From: Warner Losh Date: Tue, 4 May 2010 13:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207614 - head/libexec/tftpd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 13:07:40 -0000 Author: imp Date: Tue May 4 13:07:40 2010 New Revision: 207614 URL: http://svn.freebsd.org/changeset/base/207614 Log: Bring in new files from edwin's tftp Added: head/libexec/tftpd/tftp-file.c (contents, props changed) head/libexec/tftpd/tftp-file.h (contents, props changed) head/libexec/tftpd/tftp-io.c (contents, props changed) head/libexec/tftpd/tftp-io.h (contents, props changed) head/libexec/tftpd/tftp-options.c (contents, props changed) head/libexec/tftpd/tftp-options.h (contents, props changed) head/libexec/tftpd/tftp-transfer.c (contents, props changed) head/libexec/tftpd/tftp-transfer.h (contents, props changed) head/libexec/tftpd/tftp-utils.c (contents, props changed) head/libexec/tftpd/tftp-utils.h (contents, props changed) Added: head/libexec/tftpd/tftp-file.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/tftpd/tftp-file.c Tue May 4 13:07:40 2010 (r207614) @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "tftp-file.h" +#include "tftp-utils.h" + +static FILE *file; +static int convert; + +static char convbuffer[66000]; +static int gotcr = 0; + +static size_t +convert_from_net(char *buffer, size_t count) +{ + size_t i, n; + + /* + * Convert all CR/LF to LF and all CR,NUL to CR + */ + + n = 0; + for (i = 0; i < count; i++) { + + if (gotcr == 0) { + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + /* CR, NULL -> CR */ + if (buffer[i] == '\0') { + gotcr = 0; + continue; + } + + /* CR, LF -> LF */ + if (buffer[i] == '\n') { + if (n == 0) { + if (ftell(file) != 0) { + fseek(file, -1, SEEK_END); + convbuffer[n++] = '\n'; + } else { + /* This shouldn't happen */ + tftp_log(LOG_ERR, + "Received LF as first character"); + abort(); + } + } else + convbuffer[n-1] = '\n'; + gotcr = 0; + continue; + } + + /* Everything else just accept as is */ + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + return fwrite(convbuffer, 1, n, file); +} + +static size_t +convert_to_net(char *buffer, size_t count, int init) +{ + size_t i; + static size_t n = 0, read = 0; + static int newline = 0; + + if (init) { + newline = 0; + n = 0; + read = 0; + return 0 ; + } + + /* + * Convert all LF to CR,LF and all CR to CR,NUL + */ + i = 0; + + if (newline) { + buffer[i++] = newline; + newline = 0; + } + + while (i < count) { + if (n == read) { + /* When done we're done */ + if (feof(file)) break; + + /* Otherwise read another bunch */ + read = fread(convbuffer, 1, count, file); + if (read == 0) break; + n = 0; + } + + /* CR -> CR,NULL */ + if (convbuffer[n] == '\r') { + buffer[i++] = '\r'; + buffer[i++] = '\0'; + n++; + continue; + } + + /* LF -> CR,LF */ + if (convbuffer[n] == '\n') { + buffer[i++] = '\r'; + buffer[i++] = '\n'; + n++; + continue; + } + + buffer[i++] = convbuffer[n++]; + } + + if (i > count) { + /* + * Whoops... that isn't alllowed (but it will happen + * when there is a CR or LF at the end of the buffer) + */ + newline = buffer[i-1]; + } + + if (i < count) { + /* We are done! */ + return i; + } else + return count; + +} + +int +write_init(int fd, FILE *f, const char *mode) +{ + + if (f == NULL) { + file = fdopen(fd, "w"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +write_file(char *buffer, int count) +{ + + if (convert == 0) + return fwrite(buffer, 1, count, file); + + return convert_from_net(buffer, count); +} + +int +write_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + +int +read_init(int fd, FILE *f, const char *mode) +{ + + convert_to_net(NULL, 0, 1); + if (f == NULL) { + file = fdopen(fd, "r"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +read_file(char *buffer, int count) +{ + + if (convert == 0) + return fread(buffer, 1, count, file); + + return convert_to_net(buffer, count, 0); +} + +int +read_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + + +int +synchnet(int peer) +{ + + return 0; +} Added: head/libexec/tftpd/tftp-file.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/tftpd/tftp-file.h Tue May 4 13:07:40 2010 (r207614) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +int write_init(int fd, FILE *f, const char *mode); +size_t write_file(char *buffer, int count); +int write_close(void); + +int read_init(int fd, FILE *f, const char *mode); +size_t read_file(char *buffer, int count); +int read_close(void); + +int synchnet(int peer); Added: head/libexec/tftpd/tftp-io.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/tftpd/tftp-io.c Tue May 4 13:07:40 2010 (r207614) @@ -0,0 +1,478 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tftp-file.h" +#include "tftp-io.h" +#include "tftp-utils.h" +#include "tftp-options.h" + +struct sockaddr_storage peer_sock; +struct sockaddr_storage me_sock; + +static int send_packet(int peer, uint16_t block, char *pkt, int size); + +struct errmsg { + int e_code; + const char *e_msg; +} errmsgs[] = { + { EUNDEF, "Undefined error code" }, + { ENOTFOUND, "File not found" }, + { EACCESS, "Access violation" }, + { ENOSPACE, "Disk full or allocation exceeded" }, + { EBADOP, "Illegal TFTP operation" }, + { EBADID, "Unknown transfer ID" }, + { EEXISTS, "File already exists" }, + { ENOUSER, "No such user" }, + { EOPTNEG, "Option negotiation" }, + { -1, NULL } +}; + +#define DROPPACKET(s) \ + if (packetdroppercentage != 0 && \ + random()%100 < packetdroppercentage) { \ + tftp_log(LOG_DEBUG, "Artifical packet drop in %s", s); \ + return; \ + } +#define DROPPACKETn(s,n) \ + if (packetdroppercentage != 0 && \ + random()%100 < packetdroppercentage) { \ + tftp_log(LOG_DEBUG, "Artifical packet drop in %s", s); \ + return (n); \ + } + +const char * +errtomsg(int error) +{ + static char ebuf[40]; + struct errmsg *pe; + char buf[MAXPKTSIZE]; + + if (error == 0) + return ("success"); + for (pe = errmsgs; pe->e_code >= 0; pe++) + if (pe->e_code == error) + return (pe->e_msg); + snprintf(ebuf, sizeof(buf), "error %d", error); + return (ebuf); +} + +static int +send_packet(int peer, uint16_t block, char *pkt, int size) +{ + int i; + int t = 1; + + for (i = 0; i < 12 ; i++) { + DROPPACKETn("send_packet", 0); + + if (sendto(peer, pkt, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) + == size) { + if (i) + tftp_log(LOG_ERR, + "%s block %d, attempt %d successful", + block, i); + return (0); + } + tftp_log(LOG_ERR, + "%s block %d, attempt %d failed (Error %d: %s)", + packettype(ntohs(((struct tftphdr *)(pkt))->th_opcode)), + block, i, errno, strerror(errno)); + sleep(t); + if (t < 32) + t <<= 1; + } + tftp_log(LOG_ERR, "send_packet: %s", strerror(errno)); + return (1); +} + +/* + * Send an ERROR packet (error message). + * Error code passed in is one of the + * standard TFTP codes, or a UNIX errno + * offset by 100. + */ +void +send_error(int peer, int error) +{ + struct tftphdr *tp; + int length; + struct errmsg *pe; + char buf[MAXPKTSIZE]; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending ERROR %d: %s", error); + + DROPPACKET("send_error"); + + tp = (struct tftphdr *)buf; + tp->th_opcode = htons((u_short)ERROR); + tp->th_code = htons((u_short)error); + for (pe = errmsgs; pe->e_code >= 0; pe++) + if (pe->e_code == error) + break; + if (pe->e_code < 0) { + pe->e_msg = strerror(error - 100); + tp->th_code = EUNDEF; /* set 'undef' errorcode */ + } + strcpy(tp->th_msg, pe->e_msg); + length = strlen(pe->e_msg); + tp->th_msg[length] = '\0'; + length += 5; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending ERROR %d: %s", error, tp->th_msg); + + if (sendto(peer, buf, length, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) != length) + tftp_log(LOG_ERR, "send_error: %s", strerror(errno)); +} + +/* + * Send an WRQ packet (write request). + */ +int +send_wrq(int peer, char *filename, char *mode) +{ + int n; + struct tftphdr *tp; + char *bp; + char buf[MAXPKTSIZE]; + int size; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending WRQ: filename: '%s', mode '%s'", + filename, mode + ); + + DROPPACKETn("send_wrq", 1); + + tp = (struct tftphdr *)buf; + tp->th_opcode = htons((u_short)WRQ); + size = 2; + + bp = tp->th_stuff; + strcpy(bp, filename); + bp += strlen(filename); + *bp = 0; + bp++; + size += strlen(filename) + 1; + + strcpy(bp, mode); + bp += strlen(mode); + *bp = 0; + bp++; + size += strlen(mode) + 1; + + if (options_rfc_enabled) + size += make_options(peer, bp, sizeof(buf) - size); + + n = sendto(peer, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len); + if (n != size) { + tftp_log(LOG_ERR, "send_wrq: %s", strerror(errno)); + return (1); + } + return (0); +} + +/* + * Send an RRQ packet (write request). + */ +int +send_rrq(int peer, char *filename, char *mode) +{ + int n; + struct tftphdr *tp; + char *bp; + char buf[MAXPKTSIZE]; + int size; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending RRQ: filename: '%s', mode '%s'", + filename, mode + ); + + DROPPACKETn("send_rrq", 1); + + tp = (struct tftphdr *)buf; + tp->th_opcode = htons((u_short)RRQ); + size = 2; + + bp = tp->th_stuff; + strcpy(bp, filename); + bp += strlen(filename); + *bp = 0; + bp++; + size += strlen(filename) + 1; + + strcpy(bp, mode); + bp += strlen(mode); + *bp = 0; + bp++; + size += strlen(mode) + 1; + + if (options_rfc_enabled) { + options[OPT_TSIZE].o_request = strdup("0"); + size += make_options(peer, bp, sizeof(buf) - size); + } + + n = sendto(peer, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len); + if (n != size) { + tftp_log(LOG_ERR, "send_rrq: %s", n, strerror(errno)); + return (1); + } + return (0); +} + +/* + * Send an OACK packet (option acknowledgement). + */ +int +send_oack(int peer) +{ + struct tftphdr *tp; + int size, i, n; + char *bp; + char buf[MAXPKTSIZE]; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending OACK"); + + DROPPACKETn("send_oack", 0); + + /* + * Send back an options acknowledgement (only the ones with + * a reply for) + */ + tp = (struct tftphdr *)buf; + bp = buf + 2; + size = sizeof(buf) - 2; + tp->th_opcode = htons((u_short)OACK); + for (i = 0; options[i].o_type != NULL; i++) { + if (options[i].o_reply != NULL) { + n = snprintf(bp, size, "%s%c%s", options[i].o_type, + 0, options[i].o_reply); + bp += n+1; + size -= n+1; + if (size < 0) { + tftp_log(LOG_ERR, "oack: buffer overflow"); + exit(1); + } + } + } + size = bp - buf; + + if (sendto(peer, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) != size) { + tftp_log(LOG_INFO, "send_oack: %s", strerror(errno)); + return (1); + } + + return (0); +} + +/* + * Send an ACK packet (acknowledgement). + */ +int +send_ack(int fp, uint16_t block) +{ + struct tftphdr *tp; + int size; + char *bp; + char buf[MAXPKTSIZE]; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending ACK for block %d", block); + + DROPPACKETn("send_ack", 0); + + tp = (struct tftphdr *)buf; + bp = buf + 2; + size = sizeof(buf) - 2; + tp->th_opcode = htons((u_short)ACK); + tp->th_block = htons((u_short)block); + size = 4; + + if (sendto(fp, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) != size) { + tftp_log(LOG_INFO, "send_ack: %s", strerror(errno)); + return (1); + } + + return (0); +} + +/* + * Send a DATA packet + */ +int +send_data(int peer, uint16_t block, char *data, int size) +{ + char buf[MAXPKTSIZE]; + struct tftphdr *pkt; + int n; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending DATA packet %d of %d bytes", + block, size); + + DROPPACKETn("send_data", 0); + + pkt = (struct tftphdr *)buf; + + pkt->th_opcode = htons((u_short)DATA); + pkt->th_block = htons((u_short)block); + memcpy(pkt->th_data, data, size); + + n = send_packet(peer, block, (char *)pkt, size + 4); + return (n); +} + + +/* + * Receive a packet + */ +jmp_buf timeoutbuf; + +static void +timeout(int sig __unused) +{ + + /* tftp_log(LOG_DEBUG, "Timeout\n"); Inside a signal handler... */ + longjmp(timeoutbuf, 1); +} + +int +receive_packet(int peer, char *data, int size, struct sockaddr_storage *from, + int thistimeout) +{ + struct tftphdr *pkt; + struct sockaddr_storage from_local; + struct sockaddr_storage *pfrom; + socklen_t fromlen; + int n; + static int waiting; + + pfrom = (from == NULL) ? &from_local : from; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, + "Waiting %d seconds for packet", timeoutpacket); + + pkt = (struct tftphdr *)data; + + waiting = 0; + signal(SIGALRM, timeout); + setjmp(timeoutbuf); + alarm(thistimeout); + + if (waiting > 0) { + alarm(0); + return (RP_TIMEOUT); + } + + if (waiting > 0) { + tftp_log(LOG_ERR, "receive_packet: timeout"); + alarm(0); + return (RP_TIMEOUT); + } + + waiting++; + fromlen = sizeof(*pfrom); + n = recvfrom(peer, data, size, 0, (struct sockaddr *)pfrom, &fromlen); + + alarm(0); + + DROPPACKETn("receive_packet", RP_TIMEOUT); + + if (n < 0) { + tftp_log(LOG_ERR, "receive_packet: timeout"); + return (RP_TIMEOUT); + } + + alarm(0); + + if (n < 0) { + /* No idea what could have happened if it isn't a timeout */ + tftp_log(LOG_ERR, "receive_packet: %s", strerror(errno)); + return (RP_RECVFROM); + } + if (n < 4) { + tftp_log(LOG_ERR, + "receive_packet: packet too small (%d bytes)", n); + return (RP_TOOSMALL); + } + + pkt->th_opcode = ntohs((u_short)pkt->th_opcode); + if (pkt->th_opcode == DATA || + pkt->th_opcode == ACK) + pkt->th_block = ntohs((u_short)pkt->th_block); + + if (pkt->th_opcode == DATA && n > pktsize) { + tftp_log(LOG_ERR, "receive_packet: packet too big"); + return (RP_TOOBIG); + } + + if (((struct sockaddr_in *)(pfrom))->sin_addr.s_addr != + ((struct sockaddr_in *)(&peer_sock))->sin_addr.s_addr) { + tftp_log(LOG_ERR, + "receive_packet: received packet from wrong source"); + return (RP_WRONGSOURCE); + } + + if (pkt->th_opcode == ERROR) { + tftp_log(LOG_ERR, "Got ERROR packet: %s", pkt->th_msg); + return (RP_ERROR); + } + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Received %d bytes in a %s packet", + n, packettype(pkt->th_opcode)); + + return n - 4; +} Added: head/libexec/tftpd/tftp-io.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/tftpd/tftp-io.h Tue May 4 13:07:40 2010 (r207614) @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#define RP_NONE 0 +#define RP_RECVFROM -1 +#define RP_TOOSMALL -2 +#define RP_ERROR -3 +#define RP_WRONGSOURCE -4 +#define RP_TIMEOUT -5 +#define RP_TOOBIG -6 + +const char *errtomsg(int); +void send_error(int peer, int); +int send_wrq(int peer, char *, char *); +int send_rrq(int peer, char *, char *); +int send_oack(int peer); +int send_ack(int peer, unsigned short); +int send_data(int peer, uint16_t, char *, int); +int receive_packet(int peer, char *, int, struct sockaddr_storage *, int); + +extern struct sockaddr_storage peer_sock; +extern struct sockaddr_storage me_sock; Added: head/libexec/tftpd/tftp-options.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/tftpd/tftp-options.c Tue May 4 13:07:40 2010 (r207614) @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" + +/* + * Option handlers + */ + +struct options options[] = { + { "tsize", NULL, NULL, NULL /* option_tsize */, 1 }, + { "timeout", NULL, NULL, option_timeout, 1 }, + { "blksize", NULL, NULL, option_blksize, 1 }, + { "blksize2", NULL, NULL, option_blksize2, 0 }, + { "rollover", NULL, NULL, option_rollover, 0 }, + { NULL, NULL, NULL, NULL, 0 } +}; + +/* By default allow them */ +int options_rfc_enabled = 1; +int options_extra_enabled = 1; + +/* + * Rules for the option handlers: + * - If there is no o_request, there will be no processing. + * + * For servers + * - Logging is done as warnings. + * - The handler exit()s if there is a serious problem with the + * values submitted in the option. + * + * For clients + * - Logging is done as errors. After all, the server shouldn't + * return rubbish. + * - The handler returns if there is a serious problem with the + * values submitted in the option. + * - Sending the EBADOP packets is done by the handler. + */ + +int +option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf) +{ + + if (options[OPT_TSIZE].o_request == NULL) + return (0); + + if (mode == RRQ) + asprintf(&options[OPT_TSIZE].o_reply, + "%ju", stbuf->st_size); + else + /* XXX Allows writes of all sizes. */ + options[OPT_TSIZE].o_reply = + strdup(options[OPT_TSIZE].o_request); + return (0); +} + +int +option_timeout(int peer) +{ + + if (options[OPT_TIMEOUT].o_request == NULL) + return (0); + + int to = atoi(options[OPT_TIMEOUT].o_request); + if (to < TIMEOUT_MIN || to > TIMEOUT_MAX) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Received bad value for timeout. " + "Should be between %d and %d, received %s", + TIMEOUT_MIN, TIMEOUT_MAX); + send_error(peer, EBADOP); + if (acting_as_client) + return (1); + exit(1); + } else { + timeoutpacket = to; + options[OPT_TIMEOUT].o_reply = + strdup(options[OPT_TIMEOUT].o_request); + } + settimeouts(timeoutpacket, timeoutnetwork, maxtimeouts); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting timeout to '%s'", + options[OPT_TIMEOUT].o_reply); + + return (0); +} + +int +option_rollover(int peer) +{ + + if (options[OPT_ROLLOVER].o_request == NULL) + return (0); + + if (strcmp(options[OPT_ROLLOVER].o_request, "0") != 0 + && strcmp(options[OPT_ROLLOVER].o_request, "1") != 0) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Bad value for rollover, " + "should be either 0 or 1, received '%s', " + "ignoring request", + options[OPT_ROLLOVER].o_request); + if (acting_as_client) { + send_error(peer, EBADOP); + return (1); + } + return (0); + } + options[OPT_ROLLOVER].o_reply = + strdup(options[OPT_ROLLOVER].o_request); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting rollover to '%s'", + options[OPT_ROLLOVER].o_reply); + + return (0); +} + +int +option_blksize(int peer) +{ + int *maxdgram; + char maxbuffer[100]; + size_t len; + + if (options[OPT_BLKSIZE].o_request == NULL) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue May 4 14:03:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F9EA106564A; Tue, 4 May 2010 14:03:12 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id E6B518FC1C; Tue, 4 May 2010 14:03:11 +0000 (UTC) Received: from outgoing.leidinger.net (pD9E2D0FC.dip.t-dialin.net [217.226.208.252]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 04293844109; Tue, 4 May 2010 16:03:02 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 95EA85056; Tue, 4 May 2010 16:02:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1272981776; bh=ENp7P23eseMbqKGE1J8KwOITMg1YMKsl0SkAd2F04sY=; h=Message-ID:Date:From:To:Cc:Subject:References:In-Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding; b=MuwcUuXlHeMiLqxdvPt1axmLUjl+OsbfSNLCKz5yA9UUCLtk4mW4ANc9+Pe6Y2kEM PAHVzLrH0Yfths0evEqCH+J0umA6NZWT/YJ9CfuB1HmnIsG+QwI23Pnz2MA6xv5/wT ZMChKmpmeTn3UFukfSv7ns4fUkCvMS0OUmA1JqPSII+R1gC+5aDAsskTRFU/I68uk2 zxWXU/5/s8gN/l9vHVDWZZXR0kgsxJJgVwhoa6c+Ex9B5rV/iyBl8d16j0vt8+DilD muYkSvGwn7iuUfUaxmufPTtSfJFMaEX8SjqjgRJwkI1eVD2Rhx/xPsygam4U9ce/JV 36hnyAAKOLrXA== Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id o44E2tVA088817; Tue, 4 May 2010 16:02:55 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Tue, 04 May 2010 16:02:55 +0200 Message-ID: <20100504160255.83302gi3jcftvoys@webmail.leidinger.net> Date: Tue, 04 May 2010 16:02:55 +0200 From: Alexander Leidinger To: Norikatsu Shigemura , dougb@FreeBSD.org References: <201005041125.o44BP5eW098015@svn.freebsd.org> In-Reply-To: <201005041125.o44BP5eW098015@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: 04293844109.5C5FA X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=-1.363, required 6, autolearn=disabled, ALL_TRUSTED -1.44, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, TW_SV 0.08) X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1273586586.13426@hdyAcU2+lGBF/I//3A7HCQ X-EBL-Spam-Status: No Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r207612 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 14:03:12 -0000 Quoting Norikatsu Shigemura (from Tue, 4 May 2010 11:25:04 +0000 (UTC)): > Author: nork > Date: Tue May 4 11:25:04 2010 > New Revision: 207612 > URL: http://svn.freebsd.org/changeset/base/207612 > > Log: > Add support run services_mkdb(8). Shouldn't this (and similar messages) only be done if there is a corresponding DB file? Everything is working just fine without the DB files, and the man-pages only recommend to create DB files for performance reasons. By default the DB files are not created, and as such it looks a bit strange to tell to "make sure" to create the DB file(s). Bye, Alexander. -- The best laid plans of mice and men are held up in the legal department. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Tue May 4 14:08:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 390F51065673; Tue, 4 May 2010 14:08:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0AE0A8FC16; Tue, 4 May 2010 14:08:05 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 8FD1146B39; Tue, 4 May 2010 10:08:04 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 00BF28A01F; Tue, 4 May 2010 10:08:03 -0400 (EDT) From: John Baldwin To: Warner Losh Date: Tue, 4 May 2010 09:31:23 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <201005040613.o446DI8m023750@svn.freebsd.org> In-Reply-To: <201005040613.o446DI8m023750@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201005040931.23960.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 04 May 2010 10:08:04 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207607 - head/usr.bin/tftp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 14:08:05 -0000 On Tuesday 04 May 2010 2:13:18 am Warner Losh wrote: > Author: imp > Date: Tue May 4 06:13:17 2010 > New Revision: 207607 > URL: http://svn.freebsd.org/changeset/base/207607 > > Log: > Go ahead and merge the work edwin@ on tftpd into the tree. It is a > lot better than what's in the tree now. Edwin tested it at a prior > employer, but can't test it today. I've found that it works a lot > better with the various uboot versions that I've used in my embedded > work. Here's the pkg-descr from the port that describes the changes: bin/67550 and bin/118874 perhaps? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue May 4 14:22:48 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 13BA51065673; Tue, 4 May 2010 14:22:46 +0000 (UTC) (envelope-from nork@FreeBSD.org) Date: Tue, 4 May 2010 23:22:46 +0900 From: Norikatsu Shigemura To: Alexander Leidinger Message-Id: <20100504232246.4a29424f.nork@FreeBSD.org> In-Reply-To: <20100504160255.83302gi3jcftvoys@webmail.leidinger.net> References: <201005041125.o44BP5eW098015@svn.freebsd.org> <20100504160255.83302gi3jcftvoys@webmail.leidinger.net> X-Mailer: Sylpheed 3.0.0 (GTK+ 2.18.7; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r207612 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 14:22:48 -0000 Hi netchild. On Tue, 04 May 2010 16:02:55 +0200 Alexander Leidinger wrote: > > URL: http://svn.freebsd.org/changeset/base/207612 > > Log: > > Add support run services_mkdb(8). > Shouldn't this (and similar messages) only be done if there is a > corresponding DB file? > Everything is working just fine without the DB files, and the > man-pages only recommend to create DB files for performance reasons. > By default the DB files are not created, and as such it looks a bit > strange to tell to "make sure" to create the DB file(s). My first patch has a test code '[ -f /var/db/services.db ] &&', However, as the result, I discussed with dougb, he said that existing /var/db/services.db is harmless. So I don't have any objection, and remove a test code. From owner-svn-src-head@FreeBSD.ORG Tue May 4 14:46:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 349121065672; Tue, 4 May 2010 14:46:06 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id B31C08FC1D; Tue, 4 May 2010 14:46:05 +0000 (UTC) Received: from outgoing.leidinger.net (pD9E2D0FC.dip.t-dialin.net [217.226.208.252]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 5AAB4844217; Tue, 4 May 2010 16:45:59 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 26018507A; Tue, 4 May 2010 16:45:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1272984355; bh=V1wShdoR41gHTz76EoaQzP70CBUZhTd1SWIhEAR/JZs=; h=Message-ID:Date:From:To:Cc:Subject:References:In-Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding; b=syRfCizkiyXaqNabogZnzDMZGYt/HYmnPqz56J/EjzXt1vtenr7VXjKAqOC1mGilp 9ck5kOOS7IAPSzQZZ0wzQ6ulY0ABBFODHnjxatmv5UKxqQpLjgHv2cc8/J8q0ZdkG+ 4XWm1gLqBCjXr9oP9p02tGyqOweFzzMeZ0Ye/RwdQCRp25wagtaYZ7owcSzRdl6pIp gvVFztRimkETAMz/CwlPnBXZD7sI4AIzkbk5G3V0qipsexAONLoVmDkTLimNiUjH77 zTuVz2tUbyO0ofEezUruVgD4WwM7DSbw49WpeugLVVLpTRAm8ZKgj0qDNtOqHd/Kp5 5xjdsEfAN63JQ== Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id o44Ejsi0004690; Tue, 4 May 2010 16:45:54 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Tue, 04 May 2010 16:45:53 +0200 Message-ID: <20100504164553.55334ng6l4o6afms@webmail.leidinger.net> Date: Tue, 04 May 2010 16:45:53 +0200 From: Alexander Leidinger To: Norikatsu Shigemura References: <201005041125.o44BP5eW098015@svn.freebsd.org> <20100504160255.83302gi3jcftvoys@webmail.leidinger.net> <20100504232246.4a29424f.nork@FreeBSD.org> In-Reply-To: <20100504232246.4a29424f.nork@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: 5AAB4844217.B32D4 X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=-1.363, required 6, autolearn=disabled, ALL_TRUSTED -1.44, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, TW_SV 0.08) X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1273589160.95797@y1XUcf1phRFoooAjBkRKlA X-EBL-Spam-Status: No Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r207612 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 14:46:06 -0000 Quoting Norikatsu Shigemura (from Tue, 4 May 2010 23:22:46 +0900): > Hi netchild. > > On Tue, 04 May 2010 16:02:55 +0200 > Alexander Leidinger wrote: >> > URL: http://svn.freebsd.org/changeset/base/207612 >> > Log: >> > Add support run services_mkdb(8). >> Shouldn't this (and similar messages) only be done if there is a >> corresponding DB file? >> Everything is working just fine without the DB files, and the >> man-pages only recommend to create DB files for performance reasons. >> By default the DB files are not created, and as such it looks a bit >> strange to tell to "make sure" to create the DB file(s). > > My first patch has a test code '[ -f /var/db/services.db ] &&', > However, as the result, I discussed with dougb, he said that > existing /var/db/services.db is harmless. So I don't have any > objection, and remove a test code. I do not complain about your patch, you just had the bad luck that I noticed an extension of something which I think is not user friendly. I just used your commit to tell Doug (and others) about it. I would print such a message only (for login.conf, services or whatever), if the DB file exists. Because if it exists, not updating the DB file is harmful (it does not contain what people would expect). If the file does not exist, there is nothing to do. The user does not want or does not know how to use this feature, so do not tell him to do or use something he doesn't want or doesn't understand (lack of knowledge, not lack of capability). Bye, Alexander. -- Sometime in 1993 NANCY SINATRA will lead a BLOODLESS COUP on GUAM!! http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Tue May 4 15:29:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C1B1B1065670; Tue, 4 May 2010 15:29:08 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B11078FC12; Tue, 4 May 2010 15:29:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44FT8L0058334; Tue, 4 May 2010 15:29:08 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44FT8BE058333; Tue, 4 May 2010 15:29:08 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <201005041529.o44FT8BE058333@svn.freebsd.org> From: "Christian S.J. Peron" Date: Tue, 4 May 2010 15:29:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207615 - head/sys/security/audit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 15:29:08 -0000 Author: csjp Date: Tue May 4 15:29:07 2010 New Revision: 207615 URL: http://svn.freebsd.org/changeset/base/207615 Log: Add a case to make sure that internal audit records get converted to BSM format for lpathconf(2) events. MFC after: 2 weeks Modified: head/sys/security/audit/audit_bsm.c Modified: head/sys/security/audit/audit_bsm.c ============================================================================== --- head/sys/security/audit/audit_bsm.c Tue May 4 13:07:40 2010 (r207614) +++ head/sys/security/audit/audit_bsm.c Tue May 4 15:29:07 2010 (r207615) @@ -740,6 +740,7 @@ kaudit_to_bsm(struct kaudit_record *kar, case AUE_LUTIMES: case AUE_NFS_GETFH: case AUE_LSTAT: + case AUE_LPATHCONF: case AUE_PATHCONF: case AUE_READLINK: case AUE_REVOKE: From owner-svn-src-head@FreeBSD.ORG Tue May 4 15:55:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C9F71065679; Tue, 4 May 2010 15:55:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1B8248FC26; Tue, 4 May 2010 15:55:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44FtfUi064237; Tue, 4 May 2010 15:55:41 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44FtfE0064230; Tue, 4 May 2010 15:55:41 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005041555.o44FtfE0064230@svn.freebsd.org> From: Alan Cox Date: Tue, 4 May 2010 15:55:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207617 - in head/sys: dev/drm kern net vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 15:55:42 -0000 Author: alc Date: Tue May 4 15:55:41 2010 New Revision: 207617 URL: http://svn.freebsd.org/changeset/base/207617 Log: Add page locking to the vm_page_cow* functions. Push down the acquisition and release of the page queues lock into vm_page_wire(). Reviewed by: kib Modified: head/sys/dev/drm/via_dmablit.c head/sys/kern/uipc_cow.c head/sys/kern/vfs_bio.c head/sys/net/bpf_zerocopy.c head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/dev/drm/via_dmablit.c ============================================================================== --- head/sys/dev/drm/via_dmablit.c Tue May 4 15:52:17 2010 (r207616) +++ head/sys/dev/drm/via_dmablit.c Tue May 4 15:55:41 2010 (r207617) @@ -251,10 +251,8 @@ via_lock_all_dma_pages(drm_via_sg_info_t if (m == NULL) break; vm_page_lock(m); - vm_page_lock_queues(); vm_page_wire(m); vm_page_unhold(m); - vm_page_unlock_queues(); vm_page_unlock(m); vsg->pages[i] = m; } Modified: head/sys/kern/uipc_cow.c ============================================================================== --- head/sys/kern/uipc_cow.c Tue May 4 15:52:17 2010 (r207616) +++ head/sys/kern/uipc_cow.c Tue May 4 15:55:41 2010 (r207617) @@ -131,10 +131,8 @@ socow_setup(struct mbuf *m0, struct uio * set up COW */ vm_page_lock(pp); - vm_page_lock_queues(); if (vm_page_cowsetup(pp) != 0) { vm_page_unhold(pp); - vm_page_unlock_queues(); vm_page_unlock(pp); return (0); } @@ -144,7 +142,6 @@ socow_setup(struct mbuf *m0, struct uio */ vm_page_wire(pp); vm_page_unhold(pp); - vm_page_unlock_queues(); vm_page_unlock(pp); /* * Allocate an sf buf Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue May 4 15:52:17 2010 (r207616) +++ head/sys/kern/vfs_bio.c Tue May 4 15:55:41 2010 (r207617) @@ -3043,9 +3043,7 @@ allocbuf(struct buf *bp, int size) * We have a good page. */ vm_page_lock(m); - vm_page_lock_queues(); vm_page_wire(m); - vm_page_unlock_queues(); vm_page_unlock(m); bp->b_pages[bp->b_npages] = m; ++bp->b_npages; Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Tue May 4 15:52:17 2010 (r207616) +++ head/sys/net/bpf_zerocopy.c Tue May 4 15:55:41 2010 (r207617) @@ -171,10 +171,8 @@ zbuf_sfbuf_get(struct vm_map *map, vm_of if (pp == NULL) return (NULL); vm_page_lock(pp); - vm_page_lock_queues(); vm_page_wire(pp); vm_page_unhold(pp); - vm_page_unlock_queues(); vm_page_unlock(pp); sf = sf_buf_alloc(pp, SFB_NOWAIT); if (sf == NULL) { Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue May 4 15:52:17 2010 (r207616) +++ head/sys/vm/vm_fault.c Tue May 4 15:55:41 2010 (r207617) @@ -315,8 +315,6 @@ RetryFault:; (fault_type & VM_PROT_WRITE) && (fs.object == fs.first_object)) { vm_page_cowfault(fs.m); - vm_page_unlock_queues(); - vm_page_unlock(fs.m); unlock_and_deallocate(&fs); goto RetryFault; } @@ -797,9 +795,7 @@ vnode_locked: if (wired && (fault_flags & VM_FAULT_CHANGE_WIRING) == 0) { vm_page_lock(fs.first_m); - vm_page_lock_queues(); vm_page_wire(fs.first_m); - vm_page_unlock_queues(); vm_page_unlock(fs.first_m); vm_page_lock(fs.m); @@ -1285,9 +1281,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm vm_page_unlock(src_m); vm_page_lock(dst_m); - vm_page_lock_queues(); vm_page_wire(dst_m); - vm_page_unlock_queues(); vm_page_unlock(dst_m); } else { vm_page_lock(dst_m); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue May 4 15:52:17 2010 (r207616) +++ head/sys/vm/vm_page.c Tue May 4 15:55:41 2010 (r207617) @@ -1544,13 +1544,15 @@ vm_page_wire(vm_page_t m) * and only unqueue the page if it is on some queue (if it is unmanaged * it is already off the queues). */ - mtx_assert(&vm_page_queue_mtx, MA_OWNED); vm_page_lock_assert(m, MA_OWNED); if (m->flags & PG_FICTITIOUS) return; if (m->wire_count == 0) { - if ((m->flags & PG_UNMANAGED) == 0) + if ((m->flags & PG_UNMANAGED) == 0) { + vm_page_lock_queues(); vm_pageq_remove(m); + vm_page_unlock_queues(); + } atomic_add_int(&cnt.v_wire_count, 1); } m->wire_count++; @@ -1922,9 +1924,7 @@ retrylookup: } else { if ((allocflags & VM_ALLOC_WIRED) != 0) { vm_page_lock(m); - vm_page_lock_queues(); vm_page_wire(m); - vm_page_unlock_queues(); vm_page_unlock(m); } if ((allocflags & VM_ALLOC_NOBUSY) == 0) @@ -2224,6 +2224,7 @@ vm_page_cowfault(vm_page_t m) vm_object_t object; vm_pindex_t pindex; + vm_page_lock_assert(m, MA_OWNED); object = m->object; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); KASSERT(object->paging_in_progress != 0, @@ -2238,17 +2239,18 @@ vm_page_cowfault(vm_page_t m) if (mnew == NULL) { vm_page_insert(m, object, pindex); vm_page_unlock_queues(); + vm_page_unlock(m); VM_OBJECT_UNLOCK(object); VM_WAIT; VM_OBJECT_LOCK(object); if (m == vm_page_lookup(object, pindex)) { + vm_page_lock(m); vm_page_lock_queues(); goto retry_alloc; } else { /* * Page disappeared during the wait. */ - vm_page_lock_queues(); return; } } @@ -2269,13 +2271,15 @@ vm_page_cowfault(vm_page_t m) mnew->wire_count = m->wire_count - m->cow; m->wire_count = m->cow; } + vm_page_unlock_queues(); + vm_page_unlock(m); } void vm_page_cowclear(vm_page_t m) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if (m->cow) { m->cow--; /* @@ -2291,11 +2295,13 @@ int vm_page_cowsetup(vm_page_t m) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if (m->cow == USHRT_MAX - 1) return (EBUSY); m->cow++; + vm_page_lock_queues(); pmap_remove_write(m); + vm_page_unlock_queues(); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue May 4 16:00:37 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 758C71065674 for ; Tue, 4 May 2010 16:00:37 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx22.fluidhosting.com [204.14.89.5]) by mx1.freebsd.org (Postfix) with ESMTP id 041F18FC1C for ; Tue, 4 May 2010 16:00:36 +0000 (UTC) Received: (qmail 11786 invoked by uid 399); 4 May 2010 16:00:36 -0000 Received: from localhost (HELO ?192.168.0.145?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 4 May 2010 16:00:36 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4BE044A1.1060804@FreeBSD.org> Date: Tue, 04 May 2010 09:00:33 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Alexander Leidinger References: <201005041125.o44BP5eW098015@svn.freebsd.org> <20100504160255.83302gi3jcftvoys@webmail.leidinger.net> In-Reply-To: <20100504160255.83302gi3jcftvoys@webmail.leidinger.net> X-Enigmail-Version: 1.0.1 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Norikatsu Shigemura Subject: Re: svn commit: r207612 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 16:00:37 -0000 On 5/4/2010 7:02 AM, Alexander Leidinger wrote: > Quoting Norikatsu Shigemura (from Tue, 4 May 2010 > 11:25:04 +0000 (UTC)): > >> Author: nork >> Date: Tue May 4 11:25:04 2010 >> New Revision: 207612 >> URL: http://svn.freebsd.org/changeset/base/207612 >> >> Log: >> Add support run services_mkdb(8). > > Shouldn't this (and similar messages) only be done if there is a > corresponding DB file? This is the first case where the db file is "optional." All the others have been created by default for ages now, and nork was simply copying the existing code (including the "make sure" bit). As he pointed out, I asked him to make the prompt unconditional since the db file is small, and harmless if not being used. Making it conditional now is a pointless micro-optimization that will have to be removed down the road when having/needing it becomes the default. hth, Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Tue May 4 16:57:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 625261065672; Tue, 4 May 2010 16:57:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 519868FC08; Tue, 4 May 2010 16:57:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44Gv0RX077894; Tue, 4 May 2010 16:57:00 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44Gv0gC077891; Tue, 4 May 2010 16:57:00 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201005041657.o44Gv0gC077891@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 4 May 2010 16:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207620 - head/sys/dev/sound/pcm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 16:57:00 -0000 Author: jkim Date: Tue May 4 16:56:59 2010 New Revision: 207620 URL: http://svn.freebsd.org/changeset/base/207620 Log: - Remove more dead code[1]. Since r207330, we only need to check division by zero of the second argument 'from'. - Prefer u_int32_t over unsigned int to make its intention more clearer. - Move the function to a header file and make it a static inline function. Pointed out by: Andrew Reilly (areilly at bigpond dot net dot au)[1] MFC after: 3 days Modified: head/sys/dev/sound/pcm/buffer.c head/sys/dev/sound/pcm/buffer.h Modified: head/sys/dev/sound/pcm/buffer.c ============================================================================== --- head/sys/dev/sound/pcm/buffer.c Tue May 4 16:12:48 2010 (r207619) +++ head/sys/dev/sound/pcm/buffer.c Tue May 4 16:56:59 2010 (r207620) @@ -566,19 +566,6 @@ sndbuf_updateprevtotal(struct snd_dbuf * } unsigned int -snd_xbytes(unsigned int v, unsigned int from, unsigned int to) -{ - - if (from == to) - return v; - - if (from == 0 || to == 0 || v == 0) - return 0; - - return (unsigned int)(((u_int64_t)v * to) / from); -} - -unsigned int sndbuf_xbytes(unsigned int v, struct snd_dbuf *from, struct snd_dbuf *to) { if (from == NULL || to == NULL || v == 0) Modified: head/sys/dev/sound/pcm/buffer.h ============================================================================== --- head/sys/dev/sound/pcm/buffer.h Tue May 4 16:12:48 2010 (r207619) +++ head/sys/dev/sound/pcm/buffer.h Tue May 4 16:56:59 2010 (r207620) @@ -111,7 +111,6 @@ u_int64_t sndbuf_getblocks(struct snd_db u_int64_t sndbuf_getprevblocks(struct snd_dbuf *b); u_int64_t sndbuf_gettotal(struct snd_dbuf *b); u_int64_t sndbuf_getprevtotal(struct snd_dbuf *b); -unsigned int snd_xbytes(unsigned int v, unsigned int from, unsigned int to); unsigned int sndbuf_xbytes(unsigned int v, struct snd_dbuf *from, struct snd_dbuf *to); u_int8_t sndbuf_zerodata(u_int32_t fmt); void sndbuf_updateprevtotal(struct snd_dbuf *b); @@ -132,3 +131,14 @@ void sndbuf_dmabounce(struct snd_dbuf *b #ifdef OSSV4_EXPERIMENT void sndbuf_getpeaks(struct snd_dbuf *b, int *lp, int *rp); #endif + +static inline u_int32_t +snd_xbytes(u_int32_t v, u_int32_t from, u_int32_t to) +{ + + if (from == to) + return (v); + if (from == 0) + return (0); + return ((u_int64_t)v * to / from); +} From owner-svn-src-head@FreeBSD.ORG Tue May 4 17:00:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 903D2106566B; Tue, 4 May 2010 17:00:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 7F4928FC08; Tue, 4 May 2010 17:00:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44H0I0u078673; Tue, 4 May 2010 17:00:18 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44H0IVt078672; Tue, 4 May 2010 17:00:18 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201005041700.o44H0IVt078672@svn.freebsd.org> From: Warner Losh Date: Tue, 4 May 2010 17:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207621 - head/usr.bin/tftp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 17:00:18 -0000 Author: imp Date: Tue May 4 17:00:18 2010 New Revision: 207621 URL: http://svn.freebsd.org/changeset/base/207621 Log: Doh! Add another new file forgotten by the importer of edwin@'s tftp improvements. MFC after: 1 week Pointy Hat: imp-o-rama... Added: head/usr.bin/tftp/tftp.h (contents, props changed) Added: head/usr.bin/tftp/tftp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/tftp/tftp.h Tue May 4 17:00:18 2010 (r207621) @@ -0,0 +1,42 @@ +/* + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)extern.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ + */ + +void recvfile(int peer, char *port, int fd, char *name, char *mode); +void xmitfile(int peer, char *port, int fd, char *name, char *mode); + +extern int verbose; +extern int maxtimeout; +extern volatile int txrx_error; From owner-svn-src-head@FreeBSD.ORG Tue May 4 17:02:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E17E106566B; Tue, 4 May 2010 17:02:34 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 6D6A58FC17; Tue, 4 May 2010 17:02:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44H2Y7u079197; Tue, 4 May 2010 17:02:34 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44H2Ygm079195; Tue, 4 May 2010 17:02:34 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005041702.o44H2Ygm079195@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 4 May 2010 17:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207622 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 17:02:34 -0000 Author: yongari Date: Tue May 4 17:02:34 2010 New Revision: 207622 URL: http://svn.freebsd.org/changeset/base/207622 Log: Drop driver lock before exiting from interrupt handler. Submitted by: jhb MFC after: 3 days Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Tue May 4 17:00:18 2010 (r207621) +++ head/sys/dev/msk/if_msk.c Tue May 4 17:02:34 2010 (r207622) @@ -3594,6 +3594,7 @@ msk_intr(void *xsc) (sc->msk_pflags & MSK_FLAG_SUSPEND) != 0 || (status & sc->msk_intrmask) == 0) { CSR_WRITE_4(sc, B0_Y2_SP_ICR, 2); + MSK_UNLOCK(sc); return; } From owner-svn-src-head@FreeBSD.ORG Tue May 4 17:12:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 30444106564A; Tue, 4 May 2010 17:12:37 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1F67F8FC12; Tue, 4 May 2010 17:12:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44HCaBi081415; Tue, 4 May 2010 17:12:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44HCash081413; Tue, 4 May 2010 17:12:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005041712.o44HCash081413@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 4 May 2010 17:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207623 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 17:12:37 -0000 Author: yongari Date: Tue May 4 17:12:36 2010 New Revision: 207623 URL: http://svn.freebsd.org/changeset/base/207623 Log: Make sure to check whether driver is running before processing received frames. Also check driver has valid ifp pointer before calling msk_stop() in device_shutdown handler. While I'm here remove unnecessary accesses to interrupt mask registers in device_shutdown handler because driver puts the controller into reset state. With these changes, msk(4) now survive from heavy RX traffic(1byte UDP frame) while reboot is in progress. Reported by: Mark Atkinson < atkin901 <> gmail dot com > Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Tue May 4 17:02:34 2010 (r207622) +++ head/sys/dev/msk/if_msk.c Tue May 4 17:12:36 2010 (r207623) @@ -2904,20 +2904,15 @@ mskc_shutdown(device_t dev) sc = device_get_softc(dev); MSK_LOCK(sc); for (i = 0; i < sc->msk_num_port; i++) { - if (sc->msk_if[i] != NULL) + if (sc->msk_if[i] != NULL && sc->msk_if[i]->msk_ifp != NULL && + ((sc->msk_if[i]->msk_ifp->if_drv_flags & + IFF_DRV_RUNNING) != 0)) msk_stop(sc->msk_if[i]); } - - /* Disable all interrupts. */ - CSR_WRITE_4(sc, B0_IMSK, 0); - CSR_READ_4(sc, B0_IMSK); - CSR_WRITE_4(sc, B0_HWE_IMSK, 0); - CSR_READ_4(sc, B0_HWE_IMSK); + MSK_UNLOCK(sc); /* Put hardware reset. */ CSR_WRITE_2(sc, B0_CTST, CS_RST_SET); - - MSK_UNLOCK(sc); return (0); } @@ -3525,6 +3520,8 @@ msk_handle_events(struct msk_softc *sc) sc_if->msk_csum = status; break; case OP_RXSTAT: + if (!(sc_if->msk_ifp->if_drv_flags & IFF_DRV_RUNNING)) + break; if (sc_if->msk_framesize > (MCLBYTES - MSK_RX_BUF_ALIGN)) msk_jumbo_rxeof(sc_if, status, control, len); From owner-svn-src-head@FreeBSD.ORG Tue May 4 17:30:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1C751065673; Tue, 4 May 2010 17:30:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9E8908FC0C; Tue, 4 May 2010 17:30:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44HU705085265; Tue, 4 May 2010 17:30:07 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44HU7XQ085262; Tue, 4 May 2010 17:30:07 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005041730.o44HU7XQ085262@svn.freebsd.org> From: Martin Matuska Date: Tue, 4 May 2010 17:30:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207624 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 17:30:07 -0000 Author: mm Date: Tue May 4 17:30:07 2010 New Revision: 207624 URL: http://svn.freebsd.org/changeset/base/207624 Log: Fix deadlock during zfs receive. OpenSolaris onnv revision: 9299:8809e849f63e PR: kern/146296 Submitted by: myself Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6783818, 6826836) MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue May 4 17:12:36 2010 (r207623) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue May 4 17:30:07 2010 (r207624) @@ -464,15 +464,15 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t ASSERT(db->db_buf == NULL); if (db->db_blkid == DB_BONUS_BLKID) { - int bonuslen = dn->dn_bonuslen; + int bonuslen = MIN(dn->dn_bonuslen, dn->dn_phys->dn_bonuslen); ASSERT3U(bonuslen, <=, db->db.db_size); db->db.db_data = zio_buf_alloc(DN_MAX_BONUSLEN); arc_space_consume(DN_MAX_BONUSLEN); if (bonuslen < DN_MAX_BONUSLEN) bzero(db->db.db_data, DN_MAX_BONUSLEN); - bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, - bonuslen); + if (bonuslen) + bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, bonuslen); dbuf_update_data(db); db->db_state = DB_CACHED; mutex_exit(&db->db_mtx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Tue May 4 17:12:36 2010 (r207623) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Tue May 4 17:30:07 2010 (r207624) @@ -128,15 +128,6 @@ dmu_object_reclaim(objset_t *os, uint64_ return (0); } - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, object); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err) { - dmu_tx_abort(tx); - dnode_rele(dn, FTAG); - return (err); - } - nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT); /* @@ -144,16 +135,27 @@ dmu_object_reclaim(objset_t *os, uint64_ * be a new file instance. We must clear out the previous file * contents before we can change this type of metadata in the dnode. */ - if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize) - dmu_free_long_range(os, object, 0, DMU_OBJECT_END); + if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize) { + err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END); + if (err) + goto out; + } + + tx = dmu_tx_create(os); + dmu_tx_hold_bonus(tx, object); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err) { + dmu_tx_abort(tx); + goto out; + } dnode_reallocate(dn, ot, blocksize, bonustype, bonuslen, tx); dmu_tx_commit(tx); - +out: dnode_rele(dn, FTAG); - return (0); + return (err); } int From owner-svn-src-head@FreeBSD.ORG Tue May 4 17:34:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3B7DD1065672; Tue, 4 May 2010 17:34:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2AA478FC0C; Tue, 4 May 2010 17:34:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44HY1Hx086164; Tue, 4 May 2010 17:34:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44HY1X7086162; Tue, 4 May 2010 17:34:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005041734.o44HY1X7086162@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 4 May 2010 17:34:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207625 - head/sys/dev/sge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 17:34:01 -0000 Author: yongari Date: Tue May 4 17:34:00 2010 New Revision: 207625 URL: http://svn.freebsd.org/changeset/base/207625 Log: Remove clearing RxHashTable2 register. The register is reprogrammed in sge_rxfilter(). Modified: head/sys/dev/sge/if_sge.c Modified: head/sys/dev/sge/if_sge.c ============================================================================== --- head/sys/dev/sge/if_sge.c Tue May 4 17:30:07 2010 (r207624) +++ head/sys/dev/sge/if_sge.c Tue May 4 17:34:00 2010 (r207625) @@ -1577,7 +1577,6 @@ sge_init_locked(struct sge_softc *sc) CSR_WRITE_4(sc, RX_DESC, SGE_ADDR_LO(sc->sge_ldata.sge_rx_paddr)); CSR_WRITE_4(sc, TxMacControl, 0x60); - CSR_WRITE_4(sc, 0x6c, 0); CSR_WRITE_4(sc, RxWakeOnLan, 0); CSR_WRITE_4(sc, RxWakeOnLanData, 0); /* Allow receiving VLAN frames. */ From owner-svn-src-head@FreeBSD.ORG Tue May 4 17:40:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A36AF1065670; Tue, 4 May 2010 17:40:24 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8838C8FC1E; Tue, 4 May 2010 17:40:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44HeONg087570; Tue, 4 May 2010 17:40:24 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44HeOOj087566; Tue, 4 May 2010 17:40:24 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005041740.o44HeOOj087566@svn.freebsd.org> From: Martin Matuska Date: Tue, 4 May 2010 17:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207626 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 17:40:24 -0000 Author: mm Date: Tue May 4 17:40:24 2010 New Revision: 207626 URL: http://svn.freebsd.org/changeset/base/207626 Log: Speed up ZFS list operation with objset prefetching. Partial import of OpenSolaris onnv revisions: 8415:8809e849f63e, 10474:0e96dd3b905a PR: kern/146297 Submitted by: myself Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6386929, 6755389, 6847118) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Tue May 4 17:34:00 2010 (r207625) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Tue May 4 17:40:24 2010 (r207626) @@ -1213,6 +1213,39 @@ dmu_objset_find_spa(spa_t *spa, const ch return (err); } +/* ARGSUSED */ +int +dmu_objset_prefetch(char *name, void *arg) +{ + dsl_dataset_t *ds; + + if (dsl_dataset_hold(name, FTAG, &ds)) + return (0); + + if (!BP_IS_HOLE(&ds->ds_phys->ds_bp)) { + mutex_enter(&ds->ds_opening_lock); + if (!dsl_dataset_get_user_ptr(ds)) { + uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH; + zbookmark_t zb; + + zb.zb_objset = ds->ds_object; + zb.zb_object = 0; + zb.zb_level = -1; + zb.zb_blkid = 0; + + (void) arc_read_nolock(NULL, dsl_dataset_get_spa(ds), + &ds->ds_phys->ds_bp, NULL, NULL, + ZIO_PRIORITY_ASYNC_READ, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, + &aflags, &zb); + } + mutex_exit(&ds->ds_opening_lock); + } + + dsl_dataset_rele(ds, FTAG); + return (0); +} + void dmu_objset_set_user(objset_t *os, void *user_ptr) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Tue May 4 17:34:00 2010 (r207625) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Tue May 4 17:40:24 2010 (r207626) @@ -26,8 +26,6 @@ #ifndef _SYS_DMU_OBJSET_H #define _SYS_DMU_OBJSET_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -118,6 +116,7 @@ int dmu_objset_find(char *name, int func int flags); int dmu_objset_find_spa(spa_t *spa, const char *name, int func(spa_t *, uint64_t, const char *, void *), void *arg, int flags); +int dmu_objset_prefetch(char *name, void *arg); void dmu_objset_byteswap(void *buf, size_t size); int dmu_objset_evict_dbufs(objset_t *os); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue May 4 17:34:00 2010 (r207625) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue May 4 17:40:24 2010 (r207626) @@ -1349,6 +1349,14 @@ zfs_ioc_dataset_list_next(zfs_cmd_t *zc) (void) strlcat(zc->zc_name, "/", sizeof (zc->zc_name)); p = zc->zc_name + strlen(zc->zc_name); + if (zc->zc_cookie == 0) { + uint64_t cookie = 0; + int len = sizeof (zc->zc_name) - (p - zc->zc_name); + + while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) + dmu_objset_prefetch(p, NULL); + } + do { error = dmu_dir_list_next(os, sizeof (zc->zc_name) - (p - zc->zc_name), p, @@ -1387,6 +1395,9 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc objset_t *os; int error; + if (zc->zc_cookie == 0) + dmu_objset_find(zc->zc_name, dmu_objset_prefetch, + NULL, DS_FIND_SNAPSHOTS); error = dmu_objset_open(zc->zc_name, DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os); if (error) From owner-svn-src-head@FreeBSD.ORG Tue May 4 17:44:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4C8E1065672; Tue, 4 May 2010 17:44:40 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B41148FC0C; Tue, 4 May 2010 17:44:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44HieIv088583; Tue, 4 May 2010 17:44:40 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44HieS4088581; Tue, 4 May 2010 17:44:40 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005041744.o44HieS4088581@svn.freebsd.org> From: Martin Matuska Date: Tue, 4 May 2010 17:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207627 - head/cddl/contrib/opensolaris/cmd/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 17:44:40 -0000 Author: mm Date: Tue May 4 17:44:40 2010 New Revision: 207627 URL: http://svn.freebsd.org/changeset/base/207627 Log: Enable "zfs list" to list explicitly requested snapshots. Partial import of OpenSolaris onnv revision: 8415:8809e849f63e PR: kern/146297 Submitted by: myself Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6758338) MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue May 4 17:40:24 2010 (r207626) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue May 4 17:44:40 2010 (r207627) @@ -1790,7 +1790,7 @@ zfs_do_list(int argc, char **argv) boolean_t scripted = B_FALSE; static char default_fields[] = "name,used,available,referenced,mountpoint"; - int types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME; + int types = ZFS_TYPE_DATASET; boolean_t types_specified = B_FALSE; char *fields = NULL; list_cbdata_t cb = { 0 }; From owner-svn-src-head@FreeBSD.ORG Tue May 4 19:04:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 00975106566B; Tue, 4 May 2010 19:04:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E35838FC12; Tue, 4 May 2010 19:04:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44J4pI3006445; Tue, 4 May 2010 19:04:51 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44J4pFA006442; Tue, 4 May 2010 19:04:51 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005041904.o44J4pFA006442@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 4 May 2010 19:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207628 - head/sys/dev/sge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 19:04:52 -0000 Author: yongari Date: Tue May 4 19:04:51 2010 New Revision: 207628 URL: http://svn.freebsd.org/changeset/base/207628 Log: Enable multi-descriptor transmisstion for fragmented mbufs. There is no more need to defragment mbufs. After transmitting the multi-fragmented frame, the controller updates only the first descriptor of multi-descriptor transmission so it's driver's responsibility to clear OWN bits of remaining descriptor of multi-descriptor transmission. It seems the controller behaves much like jme(4) controllers in descriptor handling. Tested by: xclin cs dot nctu dot edu dot tw > Modified: head/sys/dev/sge/if_sge.c head/sys/dev/sge/if_sgereg.h Modified: head/sys/dev/sge/if_sge.c ============================================================================== --- head/sys/dev/sge/if_sge.c Tue May 4 17:44:40 2010 (r207627) +++ head/sys/dev/sge/if_sge.c Tue May 4 19:04:51 2010 (r207628) @@ -756,6 +756,8 @@ sge_dma_alloc(struct sge_softc *sc) { struct sge_chain_data *cd; struct sge_list_data *ld; + struct sge_rxdesc *rxd; + struct sge_txdesc *txd; int error, i; cd = &sc->sge_cdata; @@ -869,8 +871,12 @@ sge_dma_alloc(struct sge_softc *sc) /* Create DMA maps for Tx buffers. */ for (i = 0; i < SGE_TX_RING_CNT; i++) { + txd = &cd->sge_txdesc[i]; + txd->tx_m = NULL; + txd->tx_dmamap = NULL; + txd->tx_ndesc = 0; error = bus_dmamap_create(cd->sge_txmbuf_tag, 0, - &cd->sge_tx_map[i]); + &txd->tx_dmamap); if (error != 0) { device_printf(sc->sge_dev, "could not create Tx DMA map.\n"); @@ -886,8 +892,11 @@ sge_dma_alloc(struct sge_softc *sc) } /* Create DMA maps for Rx buffers. */ for (i = 0; i < SGE_RX_RING_CNT; i++) { + rxd = &cd->sge_rxdesc[i]; + rxd->rx_m = NULL; + rxd->rx_dmamap = NULL; error = bus_dmamap_create(cd->sge_rxmbuf_tag, 0, - &cd->sge_rx_map[i]); + &rxd->rx_dmamap); if (error) { device_printf(sc->sge_dev, "could not create Rx DMA map.\n"); @@ -903,6 +912,8 @@ sge_dma_free(struct sge_softc *sc) { struct sge_chain_data *cd; struct sge_list_data *ld; + struct sge_rxdesc *rxd; + struct sge_txdesc *txd; int i; cd = &sc->sge_cdata; @@ -934,10 +945,11 @@ sge_dma_free(struct sge_softc *sc) /* Rx buffers. */ if (cd->sge_rxmbuf_tag != NULL) { for (i = 0; i < SGE_RX_RING_CNT; i++) { - if (cd->sge_rx_map[i] != NULL) { + rxd = &cd->sge_rxdesc[i]; + if (rxd->rx_dmamap != NULL) { bus_dmamap_destroy(cd->sge_rxmbuf_tag, - cd->sge_rx_map[i]); - cd->sge_rx_map[i] = NULL; + rxd->rx_dmamap); + rxd->rx_dmamap = NULL; } } if (cd->sge_rx_spare_map != NULL) { @@ -951,10 +963,11 @@ sge_dma_free(struct sge_softc *sc) /* Tx buffers. */ if (cd->sge_txmbuf_tag != NULL) { for (i = 0; i < SGE_TX_RING_CNT; i++) { - if (cd->sge_tx_map[i] != NULL) { + txd = &cd->sge_txdesc[i]; + if (txd->tx_dmamap != NULL) { bus_dmamap_destroy(cd->sge_txmbuf_tag, - cd->sge_tx_map[i]); - cd->sge_tx_map[i] = NULL; + txd->tx_dmamap); + txd->tx_dmamap = NULL; } } bus_dma_tag_destroy(cd->sge_txmbuf_tag); @@ -991,18 +1004,20 @@ static int sge_list_tx_free(struct sge_softc *sc) { struct sge_chain_data *cd; + struct sge_txdesc *txd; int i; SGE_LOCK_ASSERT(sc); cd = &sc->sge_cdata; for (i = 0; i < SGE_TX_RING_CNT; i++) { - if (cd->sge_tx_mbuf[i] != NULL) { - bus_dmamap_sync(cd->sge_txmbuf_tag, - cd->sge_tx_map[i], BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(cd->sge_txmbuf_tag, - cd->sge_tx_map[i]); - m_free(cd->sge_tx_mbuf[i]); - cd->sge_tx_mbuf[i] = NULL; + txd = &cd->sge_txdesc[i]; + if (txd->tx_m != NULL) { + bus_dmamap_sync(cd->sge_txmbuf_tag, txd->tx_dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(cd->sge_txmbuf_tag, txd->tx_dmamap); + m_free(txd->tx_m); + txd->tx_m = NULL; + txd->tx_ndesc = 0; } } @@ -1037,18 +1052,20 @@ static int sge_list_rx_free(struct sge_softc *sc) { struct sge_chain_data *cd; + struct sge_rxdesc *rxd; int i; SGE_LOCK_ASSERT(sc); cd = &sc->sge_cdata; for (i = 0; i < SGE_RX_RING_CNT; i++) { - if (cd->sge_rx_mbuf[i] != NULL) { - bus_dmamap_sync(cd->sge_rxmbuf_tag, cd->sge_rx_map[i], + rxd = &cd->sge_rxdesc[i]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(cd->sge_rxmbuf_tag, - cd->sge_rx_map[i]); - m_free(cd->sge_rx_mbuf[i]); - cd->sge_rx_mbuf[i] = NULL; + rxd->rx_dmamap); + m_free(rxd->rx_m); + rxd->rx_m = NULL; } } return (0); @@ -1063,6 +1080,7 @@ sge_newbuf(struct sge_softc *sc, int pro struct mbuf *m; struct sge_desc *desc; struct sge_chain_data *cd; + struct sge_rxdesc *rxd; bus_dma_segment_t segs[1]; bus_dmamap_t map; int error, nsegs; @@ -1082,17 +1100,18 @@ sge_newbuf(struct sge_softc *sc, int pro return (error); } KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - if (cd->sge_rx_mbuf[prod] != NULL) { - bus_dmamap_sync(cd->sge_rxmbuf_tag, cd->sge_rx_map[prod], + rxd = &cd->sge_rxdesc[prod]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(cd->sge_rxmbuf_tag, cd->sge_rx_map[prod]); + bus_dmamap_unload(cd->sge_rxmbuf_tag, rxd->rx_dmamap); } - map = cd->sge_rx_map[prod]; - cd->sge_rx_map[prod] = cd->sge_rx_spare_map; + map = rxd->rx_dmamap; + rxd->rx_dmamap = cd->sge_rx_spare_map; cd->sge_rx_spare_map = map; - bus_dmamap_sync(cd->sge_rxmbuf_tag, cd->sge_rx_map[prod], + bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, BUS_DMASYNC_PREREAD); - cd->sge_rx_mbuf[prod] = m; + rxd->rx_m = m; desc = &sc->sge_ldata.sge_rx_ring[prod]; desc->sge_sts_size = 0; @@ -1178,7 +1197,7 @@ sge_rxeof(struct sge_softc *sc) ifp->if_ierrors++; continue; } - m = cd->sge_rx_mbuf[cons]; + m = cd->sge_rxdesc[cons].rx_m; if (sge_newbuf(sc, cons) != 0) { sge_discard_rxbuf(sc, cons); ifp->if_iqdrops++; @@ -1245,8 +1264,9 @@ sge_txeof(struct sge_softc *sc) struct ifnet *ifp; struct sge_list_data *ld; struct sge_chain_data *cd; + struct sge_txdesc *txd; uint32_t txstat; - int cons, prod; + int cons, nsegs, prod; SGE_LOCK_ASSERT(sc); @@ -1260,33 +1280,47 @@ sge_txeof(struct sge_softc *sc) BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); cons = cd->sge_tx_cons; prod = cd->sge_tx_prod; - for (; cons != prod; SGE_INC(cons, SGE_TX_RING_CNT)) { + for (; cons != prod;) { txstat = le32toh(ld->sge_tx_ring[cons].sge_cmdsts); if ((txstat & TDC_OWN) != 0) break; - cd->sge_tx_cnt--; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - if (cd->sge_tx_mbuf[cons] != NULL) { - bus_dmamap_sync(cd->sge_txmbuf_tag, - cd->sge_tx_map[cons], BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(cd->sge_txmbuf_tag, - cd->sge_tx_map[cons]); - m_freem(cd->sge_tx_mbuf[cons]); - cd->sge_tx_mbuf[cons] = NULL; - if (SGE_TX_ERROR(txstat) != 0) { + /* + * Only the first descriptor of multi-descriptor transmission + * is updated by controller. Driver should skip entire + * chained buffers for the transmitted frame. In other words + * TDC_OWN bit is valid only at the first descriptor of a + * multi-descriptor transmission. + */ + if (SGE_TX_ERROR(txstat) != 0) { #ifdef SGE_SHOW_ERRORS - device_printf(sc->sge_dev, "Tx error : 0x%b\n", - txstat, TX_ERR_BITS); + device_printf(sc->sge_dev, "Tx error : 0x%b\n", + txstat, TX_ERR_BITS); #endif - ifp->if_oerrors++; - } else { + ifp->if_oerrors++; + } else { #ifdef notyet - ifp->if_collisions += (txstat & 0xFFFF) - 1; + ifp->if_collisions += (txstat & 0xFFFF) - 1; #endif - ifp->if_opackets++; - } + ifp->if_opackets++; } - + txd = &cd->sge_txdesc[cons]; + for (nsegs = 0; nsegs < txd->tx_ndesc; nsegs++) { + ld->sge_tx_ring[cons].sge_cmdsts = 0; + SGE_INC(cons, SGE_TX_RING_CNT); + } + /* Reclaim transmitted mbuf. */ + KASSERT(txd->tx_m != NULL, + ("%s: freeing NULL mbuf\n", __func__)); + bus_dmamap_sync(cd->sge_txmbuf_tag, txd->tx_dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(cd->sge_txmbuf_tag, txd->tx_dmamap); + m_freem(txd->tx_m); + txd->tx_m = NULL; + cd->sge_tx_cnt -= txd->tx_ndesc; + KASSERT(cd->sge_tx_cnt >= 0, + ("%s: Active Tx desc counter was garbled\n", __func__)); + txd->tx_ndesc = 0; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } cd->sge_tx_cons = cons; if (cd->sge_tx_cnt == 0) @@ -1388,73 +1422,78 @@ sge_encap(struct sge_softc *sc, struct m { struct mbuf *m; struct sge_desc *desc; + struct sge_txdesc *txd; bus_dma_segment_t txsegs[SGE_MAXTXSEGS]; - bus_dmamap_t map; uint32_t cflags; - int error, nsegs, prod; + int error, i, nsegs, prod, si; SGE_LOCK_ASSERT(sc); - prod = sc->sge_cdata.sge_tx_prod; - map = sc->sge_cdata.sge_tx_map[prod]; - /* - * Reading Windows inf file indicates SiS controller supports - * TSO, VLAN hardware tag insertion/stripping, interrupt - * moderation and Tx/Rx checksum offloading. Unfortunately - * vendor didn't release these information so we're guessing - * descriptor usage with trial and errors. - * - * Controller seems to support multi-fragmented buffers but - * don't know how to enable that feature so limit number of - * fragmented Tx buffers to single buffer until we understand - * the controller internals. - * I assume the controller can pad zero bytes if frame length - * is less than 60 bytes and I also think the controller has - * no Tx buffer alignment limitation. - Need testing! - */ - if ((*m_head)->m_next != NULL) { - m = m_defrag(*m_head, M_DONTWAIT); + si = prod = sc->sge_cdata.sge_tx_prod; + txd = &sc->sge_cdata.sge_txdesc[prod]; + error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, 0); + if (error == EFBIG) { + m = m_collapse(*m_head, M_DONTWAIT, SGE_MAXTXSEGS); if (m == NULL) { m_freem(*m_head); *m_head = NULL; return (ENOBUFS); } *m_head = m; - } - error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, map, - *m_head, txsegs, &nsegs, 0); - if (error != 0) { - m_freem(*m_head); - *m_head = NULL; + error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, 0); + if (error != 0) { + m_freem(*m_head); + *m_head = NULL; + return (error); + } + } else if (error != 0) return (error); - } + + KASSERT(nsegs != 0, ("zero segment returned")); /* Check descriptor overrun. */ if (sc->sge_cdata.sge_tx_cnt + nsegs >= SGE_TX_RING_CNT) { - bus_dmamap_unload(sc->sge_cdata.sge_txmbuf_tag, map); + bus_dmamap_unload(sc->sge_cdata.sge_txmbuf_tag, txd->tx_dmamap); return (ENOBUFS); } - bus_dmamap_sync(sc->sge_cdata.sge_txmbuf_tag, map, + bus_dmamap_sync(sc->sge_cdata.sge_txmbuf_tag, txd->tx_dmamap, BUS_DMASYNC_PREWRITE); + m = *m_head; cflags = 0; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) + if (m->m_pkthdr.csum_flags & CSUM_IP) cflags |= TDC_IP_CSUM; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) + if (m->m_pkthdr.csum_flags & CSUM_TCP) cflags |= TDC_TCP_CSUM; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) + if (m->m_pkthdr.csum_flags & CSUM_UDP) cflags |= TDC_UDP_CSUM; - desc = &sc->sge_ldata.sge_tx_ring[prod]; - desc->sge_sts_size = htole32((*m_head)->m_pkthdr.len); - desc->sge_ptr = htole32(SGE_ADDR_LO(txsegs[0].ds_addr)); - desc->sge_flags = htole32(txsegs[0].ds_len); - if (prod == SGE_TX_RING_CNT - 1) - desc->sge_flags |= htole32(RING_END); + for (i = 0; i < nsegs; i++) { + desc = &sc->sge_ldata.sge_tx_ring[prod]; + if (i == 0) { + desc->sge_sts_size = htole32(m->m_pkthdr.len); + desc->sge_cmdsts = 0; + } else { + desc->sge_sts_size = 0; + desc->sge_cmdsts = htole32(TDC_OWN); + } + desc->sge_ptr = htole32(SGE_ADDR_LO(txsegs[i].ds_addr)); + desc->sge_flags = htole32(txsegs[i].ds_len); + if (prod == SGE_TX_RING_CNT - 1) + desc->sge_flags |= htole32(RING_END); + sc->sge_cdata.sge_tx_cnt++; + SGE_INC(prod, SGE_TX_RING_CNT); + } + /* Update producer index. */ + sc->sge_cdata.sge_tx_prod = prod; + + desc = &sc->sge_ldata.sge_tx_ring[si]; /* Configure VLAN. */ - if(((*m_head)->m_flags & M_VLANTAG) != 0) { - cflags |= (*m_head)->m_pkthdr.ether_vtag; + if((m->m_flags & M_VLANTAG) != 0) { + cflags |= m->m_pkthdr.ether_vtag; desc->sge_sts_size |= htole32(TDS_INS_VLAN); } - desc->sge_cmdsts = htole32(TDC_DEF | TDC_CRC | TDC_PAD | cflags); + desc->sge_cmdsts |= htole32(TDC_DEF | TDC_CRC | TDC_PAD | cflags); #if 1 if ((sc->sge_flags & SGE_FLAG_SPEED_1000) != 0) desc->sge_cmdsts |= htole32(TDC_BST); @@ -1466,13 +1505,9 @@ sge_encap(struct sge_softc *sc, struct m } #endif /* Request interrupt and give ownership to controller. */ - if ((prod % SGE_TX_INTR_FRAMES) == 0) - desc->sge_cmdsts |= htole32(TDC_OWN | TDC_INTR); - else - desc->sge_cmdsts |= htole32(TDC_OWN); - sc->sge_cdata.sge_tx_mbuf[prod] = *m_head; - sc->sge_cdata.sge_tx_cnt++; - SGE_INC(sc->sge_cdata.sge_tx_prod, SGE_TX_RING_CNT); + desc->sge_cmdsts |= htole32(TDC_OWN | TDC_INTR); + txd->tx_m = m; + txd->tx_ndesc = nsegs; return (0); } @@ -1503,7 +1538,8 @@ sge_start_locked(struct ifnet *ifp) return; for (queued = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { - if (sc->sge_cdata.sge_tx_cnt == SGE_TX_RING_CNT - 1) { + if (sc->sge_cdata.sge_tx_cnt > (SGE_TX_RING_CNT - + SGE_MAXTXSEGS)) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } Modified: head/sys/dev/sge/if_sgereg.h ============================================================================== --- head/sys/dev/sge/if_sgereg.h Tue May 4 17:44:40 2010 (r207627) +++ head/sys/dev/sge/if_sgereg.h Tue May 4 19:04:51 2010 (r207628) @@ -283,7 +283,7 @@ struct sge_desc { #define SGE_RX_RING_CNT 256 /* [8, 1024] */ #define SGE_TX_RING_CNT 256 /* [8, 8192] */ #define SGE_DESC_ALIGN 16 -#define SGE_MAXTXSEGS 1 +#define SGE_MAXTXSEGS 16 #define SGE_RX_BUF_ALIGN sizeof(uint64_t) #define SGE_RX_RING_SZ (SGE_RX_RING_CNT * sizeof(struct sge_desc)) @@ -298,6 +298,17 @@ struct sge_list_data { bus_addr_t sge_tx_paddr; }; +struct sge_txdesc { + struct mbuf *tx_m; + bus_dmamap_t tx_dmamap; + int tx_ndesc; +}; + +struct sge_rxdesc { + struct mbuf *rx_m; + bus_dmamap_t rx_dmamap; +}; + struct sge_chain_data { bus_dma_tag_t sge_tag; bus_dma_tag_t sge_rx_tag; @@ -306,11 +317,9 @@ struct sge_chain_data { bus_dmamap_t sge_tx_dmamap; bus_dma_tag_t sge_txmbuf_tag; bus_dma_tag_t sge_rxmbuf_tag; - struct mbuf *sge_rx_mbuf[SGE_RX_RING_CNT]; - struct mbuf *sge_tx_mbuf[SGE_TX_RING_CNT]; - bus_dmamap_t sge_rx_map[SGE_RX_RING_CNT]; + struct sge_txdesc sge_txdesc[SGE_TX_RING_CNT]; + struct sge_rxdesc sge_rxdesc[SGE_RX_RING_CNT]; bus_dmamap_t sge_rx_spare_map; - bus_dmamap_t sge_tx_map[SGE_TX_RING_CNT]; int sge_rx_cons; int sge_tx_prod; int sge_tx_cons; From owner-svn-src-head@FreeBSD.ORG Tue May 4 19:58:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 382B9106566C; Tue, 4 May 2010 19:58:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 281788FC0C; Tue, 4 May 2010 19:58:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44JwuCs018269; Tue, 4 May 2010 19:58:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44JwuG8018267; Tue, 4 May 2010 19:58:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201005041958.o44JwuG8018267@svn.freebsd.org> From: Xin LI Date: Tue, 4 May 2010 19:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207630 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 19:58:56 -0000 Author: delphij Date: Tue May 4 19:58:55 2010 New Revision: 207630 URL: http://svn.freebsd.org/changeset/base/207630 Log: Remove if_ar, if_ray, if_sr, if_ppp, if_sl to reflect the current modules available, they were removed due to NEEDSGIANT. While I'm there, add if_et which was missed quite a while ago. MFC after: 2 weeks Modified: head/sys/boot/forth/loader.conf Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Tue May 4 19:18:00 2010 (r207629) +++ head/sys/boot/forth/loader.conf Tue May 4 19:58:55 2010 (r207630) @@ -197,8 +197,6 @@ if_epair_load="NO" # Virtual b-t-b Ethe if_faith_load="NO" # IPv6-to-IPv4 TCP relay capturing interface if_gif_load="NO" # generic tunnel interface if_gre_load="NO" # encapsulating network device -if_ppp_load="NO" # Kernel ppp -if_sl_load="NO" # SLIP if_stf_load="NO" # 6to4 tunnel interface if_tap_load="NO" # Ethernet tunnel software network interface if_tun_load="NO" # Tunnel driver (user process ppp) @@ -217,7 +215,6 @@ if_age_load="NO" # Attansic/Atheros L1 if_alc_load="NO" # Atheros AR8131/AR8132 Ethernet if_ale_load="NO" # Atheros AR8121/AR8113/AR8114 Ethernet if_an_load="NO" # Aironet 4500/4800 802.11 wireless NICs -if_ar_load="NO" # Digi SYNC/570i if_ath_load="NO" # Atheros IEEE 802.11 wireless NICs if_aue_load="NO" # ADMtek AN986 Pegasus USB Ethernet if_awi_load="NO" # AMD PCnetMobile IEEE 802.11 wireless NICs @@ -237,6 +234,7 @@ if_ed_load="NO" # National Semiconduct if_em_load="NO" # Intel(R) PRO/1000 Gigabit Ethernet if_en_load="NO" # Midway-based ATM interfaces if_ep_load="NO" # 3Com Etherlink III (3c5x9) +if_et_load="NO" # Agere ET1310 10/100/Gigabit Ethernet if_ex_load="NO" # Intel EtherExpress Pro/10 Ethernet if_fe_load="NO" # Fujitsu MB86960A/MB86965A based Ethernet # adapters @@ -265,17 +263,15 @@ if_nve_load="NO" # NVIDIA nForce MCP Ne if_nxge_load="NO" # Neterion Xframe 10Gb Ethernet if_pcn_load="NO" # AMD PCnet PCI if_ral_load="NO" # Ralink Technology wireless -if_ray_load="NO" # Raytheon Raylink/Webgear Aviator PCCard if_re_load="NO" # RealTek 8139C+/8169/8169S/8110S if_rl_load="NO" # RealTek 8129/8139 if_rue_load="NO" # RealTek RTL8150 USB to Fast Ethernet if_sbni_load="NO" # Granch SBNI12 leased line adapters if_sf_load="NO" # Adaptec Duralink PCI (AIC-6915 "starfire") -if_sge_load="NO" # Silicon Integrated Systems SiS190/191 +if_sge_load="NO" # Silicon Integrated Systems SiS 190/191 if_sis_load="NO" # Silicon Integrated Systems SiS 900/7016 if_sk_load="NO" # SysKonnect SK-984x series PCI Gigabit Ethernet if_sn_load="NO" # SMC 91Cxx -if_sr_load="NO" # synchronous RISCom/N2 / WANic 400/405 if_ste_load="NO" # Sundance Technologies ST201 Fast Ethernet if_stge_load="NO" # Sundance/Tamarack TC9021 Gigabit Ethernet if_ti_load="NO" # Alteon Networks Tigon 1 and Tigon 2 From owner-svn-src-head@FreeBSD.ORG Tue May 4 20:37:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7BA6E106566C; Tue, 4 May 2010 20:37:36 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 32FC38FC0C; Tue, 4 May 2010 20:37:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 1BA63FECD; Wed, 5 May 2010 08:37:35 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pG10J-OrshLR; Wed, 5 May 2010 08:37:30 +1200 (NZST) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Wed, 5 May 2010 08:37:30 +1200 (NZST) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 6F38911420; Wed, 5 May 2010 08:37:30 +1200 (NZST) Date: Wed, 5 May 2010 08:37:30 +1200 From: Andrew Thompson To: Martin Matuska Message-ID: <20100504203730.GA5420@citylink.fud.org.nz> References: <201005041730.o44HU7XQ085262@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201005041730.o44HU7XQ085262@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207624 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 20:37:36 -0000 On Tue, May 04, 2010 at 05:30:07PM +0000, Martin Matuska wrote: > Author: mm > Date: Tue May 4 17:30:07 2010 > New Revision: 207624 > URL: http://svn.freebsd.org/changeset/base/207624 > > Log: > Fix deadlock during zfs receive. > > OpenSolaris onnv revision: 9299:8809e849f63e > I believe I have hit this before, thanks for importing the fix. Andrew From owner-svn-src-head@FreeBSD.ORG Tue May 4 21:23:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC5F21065674; Tue, 4 May 2010 21:23:59 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CCD3B8FC16; Tue, 4 May 2010 21:23:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44LNxxS037248; Tue, 4 May 2010 21:23:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44LNxF2037246; Tue, 4 May 2010 21:23:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005042123.o44LNxF2037246@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 4 May 2010 21:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207635 - head/sys/dev/sge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 21:24:00 -0000 Author: yongari Date: Tue May 4 21:23:59 2010 New Revision: 207635 URL: http://svn.freebsd.org/changeset/base/207635 Log: Free entire mbuf chain instead of the first mbuf. Modified: head/sys/dev/sge/if_sge.c Modified: head/sys/dev/sge/if_sge.c ============================================================================== --- head/sys/dev/sge/if_sge.c Tue May 4 21:21:05 2010 (r207634) +++ head/sys/dev/sge/if_sge.c Tue May 4 21:23:59 2010 (r207635) @@ -1015,7 +1015,7 @@ sge_list_tx_free(struct sge_softc *sc) bus_dmamap_sync(cd->sge_txmbuf_tag, txd->tx_dmamap, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(cd->sge_txmbuf_tag, txd->tx_dmamap); - m_free(txd->tx_m); + m_freem(txd->tx_m); txd->tx_m = NULL; txd->tx_ndesc = 0; } @@ -1064,7 +1064,7 @@ sge_list_rx_free(struct sge_softc *sc) BUS_DMASYNC_POSTREAD); bus_dmamap_unload(cd->sge_rxmbuf_tag, rxd->rx_dmamap); - m_free(rxd->rx_m); + m_freem(rxd->rx_m); rxd->rx_m = NULL; } } From owner-svn-src-head@FreeBSD.ORG Tue May 4 22:24:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F25121065679; Tue, 4 May 2010 22:24:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E2EDC8FC1D; Tue, 4 May 2010 22:24:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44MOJmx060341; Tue, 4 May 2010 22:24:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44MOJ26060339; Tue, 4 May 2010 22:24:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005042224.o44MOJ26060339@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 4 May 2010 22:24:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207638 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 22:24:20 -0000 Author: yongari Date: Tue May 4 22:24:19 2010 New Revision: 207638 URL: http://svn.freebsd.org/changeset/base/207638 Log: When VLAN hardware tagging is disabled, make sure to disable VLAN checksum offloading as well as TSO over VLAN. Reported by: jhb Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Tue May 4 22:22:31 2010 (r207637) +++ head/sys/dev/msk/if_msk.c Tue May 4 22:24:19 2010 (r207638) @@ -1101,7 +1101,8 @@ msk_ioctl(struct ifnet *ifp, u_long comm (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if ((IFCAP_VLAN_HWTAGGING & ifp->if_capenable) == 0) - ifp->if_capenable &= ~IFCAP_VLAN_HWTSO; + ifp->if_capenable &= + ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM); msk_setvlan(sc_if, ifp); } if (ifp->if_mtu > ETHERMTU && From owner-svn-src-head@FreeBSD.ORG Tue May 4 23:55:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F3FE106564A; Tue, 4 May 2010 23:55:08 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 6F5848FC0C; Tue, 4 May 2010 23:55:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o44Nt85t080179; Tue, 4 May 2010 23:55:08 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o44Nt8VO080177; Tue, 4 May 2010 23:55:08 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201005042355.o44Nt8VO080177@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 4 May 2010 23:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207639 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 23:55:08 -0000 Author: np Date: Tue May 4 23:55:08 2010 New Revision: 207639 URL: http://svn.freebsd.org/changeset/base/207639 Log: Add IFCAP_LINKSTATE to cxgb's capabilities. MFC after: 3 days Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Tue May 4 22:24:19 2010 (r207638) +++ head/sys/dev/cxgb/cxgb_main.c Tue May 4 23:55:08 2010 (r207639) @@ -981,7 +981,7 @@ cxgb_makedev(struct port_info *pi) #define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \ IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \ - IFCAP_VLAN_HWTSO) + IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define CXGB_CAP_ENABLE (CXGB_CAP & ~IFCAP_TSO6) static int From owner-svn-src-head@FreeBSD.ORG Wed May 5 00:41:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 041BE1065673; Wed, 5 May 2010 00:41:41 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E68A98FC0A; Wed, 5 May 2010 00:41:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o450feg7090593; Wed, 5 May 2010 00:41:40 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o450fesw090589; Wed, 5 May 2010 00:41:40 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201005050041.o450fesw090589@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 5 May 2010 00:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207643 - in head: sys/dev/cxgb usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 00:41:41 -0000 Author: np Date: Wed May 5 00:41:40 2010 New Revision: 207643 URL: http://svn.freebsd.org/changeset/base/207643 Log: Add support for hardware filters to cxgb(4). The T3 chip can inspect L2/3/4 headers and can drop or steer packets as instructed. Filtering based on src ip, dst ip, src port, dst port, 802.1q, udp/tcp, and mac addr is possible. Add support in cxgbtool to program these filters. Some simple examples: Drop all tcp/80 traffic coming from the subnet specified. # cxgbtool cxgb2 filter 0 sip 192.168.1.0/24 dport 80 type tcp action drop Steer all incoming UDP traffic to qset 0. # cxgbtool cxgb2 filter 1 type udp queue 0 action pass Steer all tcp traffic from 192.168.1.1 to qset 1. # cxgbtool cxgb2 filter 2 sip 192.168.1.1 type tcp queue 1 action pass Drop fragments. # cxgbtool cxgb2 filter 3 type frag action drop List all filters. # cxgbtool cxgb2 filter list index SIP DIP sport dport VLAN PRI P/MAC type Q 0 192.168.1.0/24 0.0.0.0 * 80 0 0/1 */* tcp - 1 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* udp 0 2 192.168.1.1/32 0.0.0.0 * * 0 0/1 */* tcp 1 3 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* frag - 16367 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* * * MFC after: 2 weeks Modified: head/sys/dev/cxgb/cxgb_ioctl.h head/sys/dev/cxgb/cxgb_main.c head/usr.sbin/cxgbtool/cxgbtool.c Modified: head/sys/dev/cxgb/cxgb_ioctl.h ============================================================================== --- head/sys/dev/cxgb/cxgb_ioctl.h Wed May 5 00:39:50 2010 (r207642) +++ head/sys/dev/cxgb/cxgb_ioctl.h Wed May 5 00:41:40 2010 (r207643) @@ -59,6 +59,9 @@ enum { CH_CLEAR_STATS, CH_GET_UP_LA, CH_GET_UP_IOQS, + CH_SET_FILTER, + CH_DEL_FILTER, + CH_GET_FILTER, }; /* statistics categories */ @@ -215,6 +218,29 @@ struct ch_up_ioqs { struct t3_ioq_entry *data; }; +struct ch_filter_tuple { + uint32_t sip; + uint32_t dip; + uint16_t sport; + uint16_t dport; + uint16_t vlan:12; + uint16_t vlan_prio:3; +}; + +struct ch_filter { + uint32_t filter_id; + struct ch_filter_tuple val; + struct ch_filter_tuple mask; + uint16_t mac_addr_idx; + uint8_t mac_hit:1; + uint8_t proto:2; + + uint8_t want_filter_id:1; + uint8_t pass:1; + uint8_t rss:1; + uint8_t qset; +}; + #define CHELSIO_SETREG _IOW('f', CH_SETREG, struct ch_reg) #define CHELSIO_GETREG _IOWR('f', CH_GETREG, struct ch_reg) #define CHELSIO_GETMTUTAB _IOR('f', CH_GETMTUTAB, struct ch_mtus) @@ -239,4 +265,7 @@ struct ch_up_ioqs { #define CHELSIO_GET_EEPROM _IOWR('f', CH_GET_EEPROM, struct ch_eeprom) #define CHELSIO_GET_UP_LA _IOWR('f', CH_GET_UP_LA, struct ch_up_la) #define CHELSIO_GET_UP_IOQS _IOWR('f', CH_GET_UP_IOQS, struct ch_up_ioqs) +#define CHELSIO_SET_FILTER _IOW('f', CH_SET_FILTER, struct ch_filter) +#define CHELSIO_DEL_FILTER _IOW('f', CH_DEL_FILTER, struct ch_filter) +#define CHELSIO_GET_FILTER _IOWR('f', CH_GET_FILTER, struct ch_filter) #endif Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Wed May 5 00:39:50 2010 (r207642) +++ head/sys/dev/cxgb/cxgb_main.c Wed May 5 00:41:40 2010 (r207643) @@ -99,6 +99,13 @@ static void cxgb_ext_intr_handler(void * static void cxgb_tick_handler(void *, int); static void cxgb_tick(void *); static void setup_rss(adapter_t *sc); +static int alloc_filters(struct adapter *); +static int setup_hw_filters(struct adapter *); +static int set_filter(struct adapter *, int, const struct filter_info *); +static inline void mk_set_tcb_field(struct cpl_set_tcb_field *, unsigned int, + unsigned int, u64, u64); +static inline void set_tcb_field_ulp(struct cpl_set_tcb_field *, unsigned int, + unsigned int, u64, u64); /* Attachment glue for the PCI controller end of the device. Each port of * the device is attached separately, as defined later. @@ -1661,6 +1668,13 @@ cxgb_up(struct adapter *sc) if ((err = update_tpsram(sc))) goto out; + if (is_offload(sc)) { + sc->params.mc5.nservers = 0; + sc->params.mc5.nroutes = 0; + sc->params.mc5.nfilters = t3_mc5_size(&sc->mc5) - + MC5_MIN_TIDS; + } + err = t3_init_hw(sc, 0); if (err) goto out; @@ -1672,6 +1686,7 @@ cxgb_up(struct adapter *sc) if (err) goto out; + alloc_filters(sc); setup_rss(sc); t3_intr_clear(sc); @@ -1698,6 +1713,7 @@ cxgb_up(struct adapter *sc) if (!(sc->flags & QUEUES_BOUND)) { bind_qsets(sc); + setup_hw_filters(sc); sc->flags |= QUEUES_BOUND; } @@ -3076,6 +3092,139 @@ cxgb_extension_ioctl(struct cdev *dev, u free(buf, M_DEVBUF); break; } + case CHELSIO_SET_FILTER: { + struct ch_filter *f = (struct ch_filter *)data;; + struct filter_info *p; + unsigned int nfilters = sc->params.mc5.nfilters; + + if (!is_offload(sc)) + return (EOPNOTSUPP); /* No TCAM */ + if (!(sc->flags & FULL_INIT_DONE)) + return (EAGAIN); /* mc5 not setup yet */ + if (nfilters == 0) + return (EBUSY); /* TOE will use TCAM */ + + /* sanity checks */ + if (f->filter_id >= nfilters || + (f->val.dip && f->mask.dip != 0xffffffff) || + (f->val.sport && f->mask.sport != 0xffff) || + (f->val.dport && f->mask.dport != 0xffff) || + (f->val.vlan && f->mask.vlan != 0xfff) || + (f->val.vlan_prio && + f->mask.vlan_prio != FILTER_NO_VLAN_PRI) || + (f->mac_addr_idx != 0xffff && f->mac_addr_idx > 15) || + f->qset >= SGE_QSETS || + sc->rrss_map[f->qset] >= RSS_TABLE_SIZE) + return (EINVAL); + + /* Was allocated with M_WAITOK */ + KASSERT(sc->filters, ("filter table NULL\n")); + + p = &sc->filters[f->filter_id]; + if (p->locked) + return (EPERM); + + bzero(p, sizeof(*p)); + p->sip = f->val.sip; + p->sip_mask = f->mask.sip; + p->dip = f->val.dip; + p->sport = f->val.sport; + p->dport = f->val.dport; + p->vlan = f->mask.vlan ? f->val.vlan : 0xfff; + p->vlan_prio = f->mask.vlan_prio ? (f->val.vlan_prio & 6) : + FILTER_NO_VLAN_PRI; + p->mac_hit = f->mac_hit; + p->mac_vld = f->mac_addr_idx != 0xffff; + p->mac_idx = f->mac_addr_idx; + p->pkt_type = f->proto; + p->report_filter_id = f->want_filter_id; + p->pass = f->pass; + p->rss = f->rss; + p->qset = f->qset; + + error = set_filter(sc, f->filter_id, p); + if (error == 0) + p->valid = 1; + break; + } + case CHELSIO_DEL_FILTER: { + struct ch_filter *f = (struct ch_filter *)data; + struct filter_info *p; + unsigned int nfilters = sc->params.mc5.nfilters; + + if (!is_offload(sc)) + return (EOPNOTSUPP); + if (!(sc->flags & FULL_INIT_DONE)) + return (EAGAIN); + if (nfilters == 0 || sc->filters == NULL) + return (EINVAL); + if (f->filter_id >= nfilters) + return (EINVAL); + + p = &sc->filters[f->filter_id]; + if (p->locked) + return (EPERM); + if (!p->valid) + return (EFAULT); /* Read "Bad address" as "Bad index" */ + + bzero(p, sizeof(*p)); + p->sip = p->sip_mask = 0xffffffff; + p->vlan = 0xfff; + p->vlan_prio = FILTER_NO_VLAN_PRI; + p->pkt_type = 1; + error = set_filter(sc, f->filter_id, p); + break; + } + case CHELSIO_GET_FILTER: { + struct ch_filter *f = (struct ch_filter *)data; + struct filter_info *p; + unsigned int i, nfilters = sc->params.mc5.nfilters; + + if (!is_offload(sc)) + return (EOPNOTSUPP); + if (!(sc->flags & FULL_INIT_DONE)) + return (EAGAIN); + if (nfilters == 0 || sc->filters == NULL) + return (EINVAL); + + i = f->filter_id == 0xffffffff ? 0 : f->filter_id + 1; + for (; i < nfilters; i++) { + p = &sc->filters[i]; + if (!p->valid) + continue; + + bzero(f, sizeof(*f)); + + f->filter_id = i; + f->val.sip = p->sip; + f->mask.sip = p->sip_mask; + f->val.dip = p->dip; + f->mask.dip = p->dip ? 0xffffffff : 0; + f->val.sport = p->sport; + f->mask.sport = p->sport ? 0xffff : 0; + f->val.dport = p->dport; + f->mask.dport = p->dport ? 0xffff : 0; + f->val.vlan = p->vlan == 0xfff ? 0 : p->vlan; + f->mask.vlan = p->vlan == 0xfff ? 0 : 0xfff; + f->val.vlan_prio = p->vlan_prio == FILTER_NO_VLAN_PRI ? + 0 : p->vlan_prio; + f->mask.vlan_prio = p->vlan_prio == FILTER_NO_VLAN_PRI ? + 0 : FILTER_NO_VLAN_PRI; + f->mac_hit = p->mac_hit; + f->mac_addr_idx = p->mac_vld ? p->mac_idx : 0xffff; + f->proto = p->pkt_type; + f->want_filter_id = p->report_filter_id; + f->pass = p->pass; + f->rss = p->rss; + f->qset = p->qset; + + break; + } + + if (i == nfilters) + f->filter_id = 0xffffffff; + break; + } default: return (EOPNOTSUPP); break; @@ -3130,5 +3279,129 @@ cxgb_get_regs(adapter_t *sc, struct ch_i XGM_REG(A_XGM_RX_SPI4_SOP_EOP_CNT, 1)); } +static int +alloc_filters(struct adapter *sc) +{ + struct filter_info *p; + unsigned int nfilters = sc->params.mc5.nfilters; + + if (nfilters == 0) + return (0); + + p = malloc(sizeof(*p) * nfilters, M_DEVBUF, M_WAITOK | M_ZERO); + sc->filters = p; + + p = &sc->filters[nfilters - 1]; + p->vlan = 0xfff; + p->vlan_prio = FILTER_NO_VLAN_PRI; + p->pass = p->rss = p->valid = p->locked = 1; + + return (0); +} + +static int +setup_hw_filters(struct adapter *sc) +{ + int i, rc; + unsigned int nfilters = sc->params.mc5.nfilters; + + if (!sc->filters) + return (0); + + t3_enable_filters(sc); + + for (i = rc = 0; i < nfilters && !rc; i++) { + if (sc->filters[i].locked) + rc = set_filter(sc, i, &sc->filters[i]); + } + + return (rc); +} + +static int +set_filter(struct adapter *sc, int id, const struct filter_info *f) +{ + int len; + struct mbuf *m; + struct ulp_txpkt *txpkt; + struct work_request_hdr *wr; + struct cpl_pass_open_req *oreq; + struct cpl_set_tcb_field *sreq; + + len = sizeof(*wr) + sizeof(*oreq) + 2 * sizeof(*sreq); + KASSERT(len <= MHLEN, ("filter request too big for an mbuf")); + + id += t3_mc5_size(&sc->mc5) - sc->params.mc5.nroutes - + sc->params.mc5.nfilters; + + m = m_gethdr(M_WAITOK, MT_DATA); + m->m_len = m->m_pkthdr.len = len; + bzero(mtod(m, char *), len); + + wr = mtod(m, struct work_request_hdr *); + wr->wrh_hi = htonl(V_WR_OP(FW_WROPCODE_BYPASS) | F_WR_ATOMIC); + + oreq = (struct cpl_pass_open_req *)(wr + 1); + txpkt = (struct ulp_txpkt *)oreq; + txpkt->cmd_dest = htonl(V_ULPTX_CMD(ULP_TXPKT)); + txpkt->len = htonl(V_ULPTX_NFLITS(sizeof(*oreq) / 8)); + OPCODE_TID(oreq) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, id)); + oreq->local_port = htons(f->dport); + oreq->peer_port = htons(f->sport); + oreq->local_ip = htonl(f->dip); + oreq->peer_ip = htonl(f->sip); + oreq->peer_netmask = htonl(f->sip_mask); + oreq->opt0h = 0; + oreq->opt0l = htonl(F_NO_OFFLOAD); + oreq->opt1 = htonl(V_MAC_MATCH_VALID(f->mac_vld) | + V_CONN_POLICY(CPL_CONN_POLICY_FILTER) | + V_VLAN_PRI(f->vlan_prio >> 1) | + V_VLAN_PRI_VALID(f->vlan_prio != FILTER_NO_VLAN_PRI) | + V_PKT_TYPE(f->pkt_type) | V_OPT1_VLAN(f->vlan) | + V_MAC_MATCH(f->mac_idx | (f->mac_hit << 4))); + + sreq = (struct cpl_set_tcb_field *)(oreq + 1); + set_tcb_field_ulp(sreq, id, 1, 0x1800808000ULL, + (f->report_filter_id << 15) | (1 << 23) | + ((u64)f->pass << 35) | ((u64)!f->rss << 36)); + set_tcb_field_ulp(sreq + 1, id, 0, 0xffffffff, (2 << 19) | 1); + t3_mgmt_tx(sc, m); + + if (f->pass && !f->rss) { + len = sizeof(*sreq); + m = m_gethdr(M_WAITOK, MT_DATA); + m->m_len = m->m_pkthdr.len = len; + bzero(mtod(m, char *), len); + sreq = mtod(m, struct cpl_set_tcb_field *); + sreq->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); + mk_set_tcb_field(sreq, id, 25, 0x3f80000, + (u64)sc->rrss_map[f->qset] << 19); + t3_mgmt_tx(sc, m); + } + return 0; +} + +static inline void +mk_set_tcb_field(struct cpl_set_tcb_field *req, unsigned int tid, + unsigned int word, u64 mask, u64 val) +{ + OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); + req->reply = V_NO_REPLY(1); + req->cpu_idx = 0; + req->word = htons(word); + req->mask = htobe64(mask); + req->val = htobe64(val); +} + +static inline void +set_tcb_field_ulp(struct cpl_set_tcb_field *req, unsigned int tid, + unsigned int word, u64 mask, u64 val) +{ + struct ulp_txpkt *txpkt = (struct ulp_txpkt *)req; + + txpkt->cmd_dest = htonl(V_ULPTX_CMD(ULP_TXPKT)); + txpkt->len = htonl(V_ULPTX_NFLITS(sizeof(*req) / 8)); + mk_set_tcb_field(req, tid, word, mask, val); +} MODULE_DEPEND(if_cxgb, cxgb_t3fw, 1, 1, 1); Modified: head/usr.sbin/cxgbtool/cxgbtool.c ============================================================================== --- head/usr.sbin/cxgbtool/cxgbtool.c Wed May 5 00:39:50 2010 (r207642) +++ head/usr.sbin/cxgbtool/cxgbtool.c Wed May 5 00:41:40 2010 (r207643) @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2007-2009, Chelsio Inc. +Copyright (c) 2007-2010, Chelsio Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -93,6 +93,9 @@ usage(FILE *fp) "\tclearstats clear MAC statistics\n" "\tcontext show an SGE context\n" "\tdesc [] dump SGE descriptors\n" + "\tfilter [ ] ... set a filter\n" + "\tfilter delete|clear delete a filter\n" + "\tfilter list list all filters\n" "\tioqs dump uP IOQs\n" "\tla dump uP logic analyzer info\n" "\tloadboot download boot image\n" @@ -1177,24 +1180,25 @@ parse_ipaddr(const char *s, uint32_t *ad * Parse a string containing a value and an optional colon separated mask. */ static int -parse_val_mask_param(const char *s, uint32_t *val, uint32_t *mask) +parse_val_mask_param(const char *s, uint32_t *val, uint32_t *mask, + uint32_t default_mask) { char *p; - *mask = 0xffffffffU; + *mask = default_mask; *val = strtoul(s, &p, 0); - if (p == s) + if (p == s || *val > default_mask) return -1; if (*p == ':' && p[1]) *mask = strtoul(p + 1, &p, 0); - return *p ? -1 : 0; + return *p || *mask > default_mask ? -1 : 0; } static int parse_trace_param(const char *s, uint32_t *val, uint32_t *mask) { return strchr(s, '.') ? parse_ipaddr(s, val, mask) : - parse_val_mask_param(s, val, mask); + parse_val_mask_param(s, val, mask, 0xffffffffU); } static int @@ -1273,6 +1277,174 @@ trace_config(int argc, char *argv[], int return 0; } +static void +show_filters(const char *iff_name) +{ + static const char *pkt_type[] = { "*", "tcp", "udp", "frag" }; + struct ch_filter op; + union { + uint32_t nip; + uint8_t octet[4]; + } nsip, ndip; + char sip[20], dip[20]; + int header = 0; + + bzero(&op, sizeof(op)); + op.filter_id = 0xffffffff; + + do { + if (doit(iff_name, CHELSIO_GET_FILTER, &op) < 0) + err(1, "list filters"); + + if (op.filter_id == 0xffffffff) + break; + + if (!header) { + printf("index SIP DIP sport " + "dport VLAN PRI P/MAC type Q\n"); + header = 1; + } + + nsip.nip = htonl(op.val.sip); + ndip.nip = htonl(op.val.dip); + + sprintf(sip, "%u.%u.%u.%u/%-2u", nsip.octet[0], nsip.octet[1], + nsip.octet[2], nsip.octet[3], + op.mask.sip ? 33 - ffs(op.mask.sip) : 0); + sprintf(dip, "%u.%u.%u.%u", ndip.octet[0], ndip.octet[1], + ndip.octet[2], ndip.octet[3]); + printf("%5zu %18s %15s ", (size_t)op.filter_id, sip, dip); + printf(op.val.sport ? "%5u " : " * ", op.val.sport); + printf(op.val.dport ? "%5u " : " * ", op.val.dport); + printf(op.val.vlan != 0xfff ? "%4u " : " * ", op.val.vlan); + printf(op.val.vlan_prio == 7 ? " * " : + "%1u/%1u ", op.val.vlan_prio, op.val.vlan_prio | 1); + if (op.mac_addr_idx == 0xffff) + printf("*/* "); + else if (op.mac_hit) + printf("%1u/%3u ", (op.mac_addr_idx >> 3) & 0x1, + (op.mac_addr_idx) & 0x7); + else + printf("%1u/ * ", (op.mac_addr_idx >> 3) & 0x1); + printf("%4s ", pkt_type[op.proto]); + if (!op.pass) + printf("-\n"); + else if (op.rss) + printf("*\n"); + else + printf("%1u\n", op.qset); + } while (1); +} + +static int +filter_config(int argc, char *argv[], int start_arg, const char *iff_name) +{ + int ret = 0; + uint32_t val, mask; + struct ch_filter op; + + if (argc < start_arg + 1) + return -1; + + memset(&op, 0, sizeof(op)); + op.mac_addr_idx = 0xffff; + op.rss = 1; + + if (argc == start_arg + 1 && !strcmp(argv[start_arg], "list")) { + show_filters(iff_name); + return 0; + } + + if (get_int_arg(argv[start_arg++], &op.filter_id)) + return -1; + if (argc == start_arg + 1 && (!strcmp(argv[start_arg], "delete") || + !strcmp(argv[start_arg], "clear"))) { + if (doit(iff_name, CHELSIO_DEL_FILTER, &op) < 0) { + if (errno == EBUSY) + err(1, "no filter support when offload in use"); + err(1, "delete filter"); + } + return 0; + } + + while (start_arg + 2 <= argc) { + if (!strcmp(argv[start_arg], "sip")) { + ret = parse_ipaddr(argv[start_arg + 1], &op.val.sip, + &op.mask.sip); + } else if (!strcmp(argv[start_arg], "dip")) { + ret = parse_ipaddr(argv[start_arg + 1], &op.val.dip, + &op.mask.dip); + } else if (!strcmp(argv[start_arg], "sport")) { + ret = parse_val_mask_param(argv[start_arg + 1], + &val, &mask, 0xffff); + op.val.sport = val; + op.mask.sport = mask; + } else if (!strcmp(argv[start_arg], "dport")) { + ret = parse_val_mask_param(argv[start_arg + 1], + &val, &mask, 0xffff); + op.val.dport = val; + op.mask.dport = mask; + } else if (!strcmp(argv[start_arg], "vlan")) { + ret = parse_val_mask_param(argv[start_arg + 1], + &val, &mask, 0xfff); + op.val.vlan = val; + op.mask.vlan = mask; + } else if (!strcmp(argv[start_arg], "prio")) { + ret = parse_val_mask_param(argv[start_arg + 1], + &val, &mask, 7); + op.val.vlan_prio = val; + op.mask.vlan_prio = mask; + } else if (!strcmp(argv[start_arg], "mac")) { + if (!strcmp(argv[start_arg + 1], "none")) + val = -1; + else + ret = get_int_arg(argv[start_arg + 1], &val); + op.mac_hit = val != (uint32_t)-1; + op.mac_addr_idx = op.mac_hit ? val : 0; + } else if (!strcmp(argv[start_arg], "type")) { + if (!strcmp(argv[start_arg + 1], "tcp")) + op.proto = 1; + else if (!strcmp(argv[start_arg + 1], "udp")) + op.proto = 2; + else if (!strcmp(argv[start_arg + 1], "frag")) + op.proto = 3; + else + errx(1, "unknown type \"%s\"; must be one of " + "\"tcp\", \"udp\", or \"frag\"", + argv[start_arg + 1]); + } else if (!strcmp(argv[start_arg], "queue")) { + ret = get_int_arg(argv[start_arg + 1], &val); + op.qset = val; + op.rss = 0; + } else if (!strcmp(argv[start_arg], "action")) { + if (!strcmp(argv[start_arg + 1], "pass")) + op.pass = 1; + else if (strcmp(argv[start_arg + 1], "drop")) + errx(1, "unknown action \"%s\"; must be one of " + "\"pass\" or \"drop\"", + argv[start_arg + 1]); + } else + errx(1, "unknown filter parameter \"%s\"\n" + "known parameters are \"mac\", \"sip\", " + "\"dip\", \"sport\", \"dport\", \"vlan\", " + "\"prio\", \"type\", \"queue\", and \"action\"", + argv[start_arg]); + if (ret < 0) + errx(1, "bad value \"%s\" for parameter \"%s\"", + argv[start_arg + 1], argv[start_arg]); + start_arg += 2; + } + if (start_arg != argc) + errx(1, "no value for \"%s\"", argv[start_arg]); + + if (doit(iff_name, CHELSIO_SET_FILTER, &op) < 0) { + if (errno == EBUSY) + err(1, "no filter support when offload in use"); + err(1, "set filter"); + } + + return 0; +} static int get_sched_param(int argc, char *argv[], int pos, unsigned int *valp) { @@ -1501,6 +1673,8 @@ run_cmd(int argc, char *argv[], const ch r = pktsched(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "tcb")) r = get_tcb2(argc, argv, 3, iff_name); + else if (!strcmp(argv[2], "filter")) + r = filter_config(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "clearstats")) r = clear_stats(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "la")) From owner-svn-src-head@FreeBSD.ORG Wed May 5 03:45:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 081FD1065673; Wed, 5 May 2010 03:45:47 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id EA8498FC12; Wed, 5 May 2010 03:45:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o453jk37031306; Wed, 5 May 2010 03:45:46 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o453jk6i031298; Wed, 5 May 2010 03:45:46 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005050345.o453jk6i031298@svn.freebsd.org> From: Alan Cox Date: Wed, 5 May 2010 03:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207644 - in head/sys: dev/agp fs/tmpfs kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 03:45:47 -0000 Author: alc Date: Wed May 5 03:45:46 2010 New Revision: 207644 URL: http://svn.freebsd.org/changeset/base/207644 Log: Push down the acquisition of the page queues lock into vm_page_unwire(). Update the comment describing which lock should be held on entry to vm_page_wire(). Reviewed by: kib Modified: head/sys/dev/agp/agp.c head/sys/dev/agp/agp_i810.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/vfs_bio.c head/sys/vm/vm_fault.c head/sys/vm/vm_glue.c head/sys/vm/vm_page.c Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Wed May 5 00:41:40 2010 (r207643) +++ head/sys/dev/agp/agp.c Wed May 5 03:45:46 2010 (r207644) @@ -624,9 +624,7 @@ bad: if (k >= i) vm_page_wakeup(m); vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); - vm_page_unlock_queues(); vm_page_unlock(m); } VM_OBJECT_UNLOCK(mem->am_obj); @@ -660,9 +658,7 @@ agp_generic_unbind_memory(device_t dev, for (i = 0; i < mem->am_size; i += PAGE_SIZE) { m = vm_page_lookup(mem->am_obj, atop(i)); vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); - vm_page_unlock_queues(); vm_page_unlock(m); } VM_OBJECT_UNLOCK(mem->am_obj); Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Wed May 5 00:41:40 2010 (r207643) +++ head/sys/dev/agp/agp_i810.c Wed May 5 03:45:46 2010 (r207644) @@ -1011,9 +1011,7 @@ agp_i810_free_memory(device_t dev, struc VM_OBJECT_LOCK(mem->am_obj); m = vm_page_lookup(mem->am_obj, 0); vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); - vm_page_unlock_queues(); vm_page_unlock(m); VM_OBJECT_UNLOCK(mem->am_obj); } else { Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed May 5 00:41:40 2010 (r207643) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed May 5 03:45:46 2010 (r207644) @@ -461,9 +461,7 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p VM_OBJECT_LOCK(tobj); out: vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, TRUE); - vm_page_unlock_queues(); vm_page_unlock(m); vm_page_wakeup(m); vm_object_pip_subtract(tobj, 1); Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed May 5 00:41:40 2010 (r207643) +++ head/sys/kern/vfs_bio.c Wed May 5 03:45:46 2010 (r207644) @@ -1571,7 +1571,6 @@ vfs_vmio_release(struct buf *bp) * everything on the inactive queue. */ vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); /* * We don't mess with busy pages, it is @@ -1580,6 +1579,7 @@ vfs_vmio_release(struct buf *bp) */ if ((m->oflags & VPO_BUSY) == 0 && m->busy == 0 && m->wire_count == 0) { + vm_page_lock_queues(); /* * Might as well free the page if we can and it has * no valid data. We also free the page if the @@ -1593,8 +1593,8 @@ vfs_vmio_release(struct buf *bp) } else if (buf_vm_page_count_severe()) { vm_page_try_to_cache(m); } + vm_page_unlock_queues(); } - vm_page_unlock_queues(); vm_page_unlock(m); } VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); @@ -2957,9 +2957,7 @@ allocbuf(struct buf *bp, int size) bp->b_pages[i] = NULL; vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); - vm_page_unlock_queues(); vm_page_unlock(m); } VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed May 5 00:41:40 2010 (r207643) +++ head/sys/vm/vm_fault.c Wed May 5 03:45:46 2010 (r207644) @@ -799,9 +799,7 @@ vnode_locked: vm_page_unlock(fs.first_m); vm_page_lock(fs.m); - vm_page_lock_queues(); vm_page_unwire(fs.m, FALSE); - vm_page_unlock_queues(); vm_page_unlock(fs.m); } /* @@ -1112,6 +1110,7 @@ vm_fault_unwire(vm_map_t map, vm_offset_ { vm_paddr_t pa; vm_offset_t va; + vm_page_t m; pmap_t pmap; pmap = vm_map_pmap(map); @@ -1125,11 +1124,10 @@ vm_fault_unwire(vm_map_t map, vm_offset_ if (pa != 0) { pmap_change_wiring(pmap, va, FALSE); if (!fictitious) { - vm_page_lock(PHYS_TO_VM_PAGE(pa)); - vm_page_lock_queues(); - vm_page_unwire(PHYS_TO_VM_PAGE(pa), 1); - vm_page_unlock_queues(); - vm_page_unlock(PHYS_TO_VM_PAGE(pa)); + m = PHYS_TO_VM_PAGE(pa); + vm_page_lock(m); + vm_page_unwire(m, TRUE); + vm_page_unlock(m); } } } @@ -1275,9 +1273,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm if (upgrade) { vm_page_lock(src_m); - vm_page_lock_queues(); vm_page_unwire(src_m, 0); - vm_page_unlock_queues(); vm_page_unlock(src_m); vm_page_lock(dst_m); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed May 5 00:41:40 2010 (r207643) +++ head/sys/vm/vm_glue.c Wed May 5 03:45:46 2010 (r207644) @@ -529,9 +529,7 @@ vm_thread_swapout(struct thread *td) panic("vm_thread_swapout: kstack already missing?"); vm_page_dirty(m); vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); - vm_page_unlock_queues(); vm_page_unlock(m); } VM_OBJECT_UNLOCK(ksobj); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed May 5 00:41:40 2010 (r207643) +++ head/sys/vm/vm_page.c Wed May 5 03:45:46 2010 (r207644) @@ -1532,7 +1532,7 @@ vm_page_free_toq(vm_page_t m) * another map, removing it from paging queues * as necessary. * - * The page queues must be locked. + * The page must be locked. * This routine may not block. */ void @@ -1584,31 +1584,31 @@ vm_page_wire(vm_page_t m) * be placed in the cache - for example, just after dirtying a page. * dirty pages in the cache are not allowed. * - * The page queues must be locked. + * The page must be locked. * This routine may not block. */ void vm_page_unwire(vm_page_t m, int activate) { - if ((m->flags & PG_UNMANAGED) == 0) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if ((m->flags & PG_UNMANAGED) == 0) vm_page_lock_assert(m, MA_OWNED); - } if (m->flags & PG_FICTITIOUS) return; if (m->wire_count > 0) { m->wire_count--; if (m->wire_count == 0) { atomic_subtract_int(&cnt.v_wire_count, 1); - if (m->flags & PG_UNMANAGED) { - ; - } else if (activate) + if ((m->flags & PG_UNMANAGED) != 0) + return; + vm_page_lock_queues(); + if (activate) vm_page_enqueue(PQ_ACTIVE, m); else { vm_page_flag_clear(m, PG_WINATCFLS); vm_page_enqueue(PQ_INACTIVE, m); } + vm_page_unlock_queues(); } } else { panic("vm_page_unwire: invalid wire count: %d", m->wire_count); From owner-svn-src-head@FreeBSD.ORG Wed May 5 04:37:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B1521065672; Wed, 5 May 2010 04:37:45 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8A5FC8FC08; Wed, 5 May 2010 04:37:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o454bjGf042734; Wed, 5 May 2010 04:37:45 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o454bj8G042732; Wed, 5 May 2010 04:37:45 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201005050437.o454bj8G042732@svn.freebsd.org> From: Neel Natu Date: Wed, 5 May 2010 04:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207645 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 04:37:45 -0000 Author: neel Date: Wed May 5 04:37:45 2010 New Revision: 207645 URL: http://svn.freebsd.org/changeset/base/207645 Log: Fix DDB backtrace involving kernel modules. We can no longer assume that all valid program counter values reside within the kernel object file. Modified: head/sys/mips/mips/db_trace.c Modified: head/sys/mips/mips/db_trace.c ============================================================================== --- head/sys/mips/mips/db_trace.c Wed May 5 03:45:46 2010 (r207644) +++ head/sys/mips/mips/db_trace.c Wed May 5 04:37:45 2010 (r207645) @@ -181,7 +181,7 @@ loop: } /* check for bad PC */ /*XXX MIPS64 bad: These hard coded constants are lame */ - if (pc & 3 || pc < (uintptr_t)0x80000000 || pc >= (uintptr_t)edata) { + if (pc & 3 || pc < (uintptr_t)0x80000000) { (*printfn) ("PC 0x%x: not in kernel\n", pc); ra = 0; goto done; From owner-svn-src-head@FreeBSD.ORG Wed May 5 07:40:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 616361065672; Wed, 5 May 2010 07:40:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 519A98FC1D; Wed, 5 May 2010 07:40:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o457eusd083170; Wed, 5 May 2010 07:40:56 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o457etCN083169; Wed, 5 May 2010 07:40:55 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005050740.o457etCN083169@svn.freebsd.org> From: Alan Cox Date: Wed, 5 May 2010 07:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207648 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 07:40:56 -0000 Author: alc Date: Wed May 5 07:40:54 2010 New Revision: 207648 URL: http://svn.freebsd.org/changeset/base/207648 Log: Push down the acquisition of the page queues lock into vm_page_unwire(). Modified: head/sys/dev/drm/via_dmablit.c Modified: head/sys/dev/drm/via_dmablit.c ============================================================================== --- head/sys/dev/drm/via_dmablit.c Wed May 5 05:18:08 2010 (r207647) +++ head/sys/dev/drm/via_dmablit.c Wed May 5 07:40:54 2010 (r207648) @@ -179,9 +179,7 @@ via_free_sg_info(drm_via_sg_info_t *vsg) for (i=0; i < vsg->num_pages; ++i) { if ( NULL != (page = vsg->pages[i])) { vm_page_lock(page); - vm_page_lock_queues(); vm_page_unwire(page, 0); - vm_page_unlock_queues(); vm_page_unlock(page); } } From owner-svn-src-head@FreeBSD.ORG Wed May 5 07:47:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD071106566B; Wed, 5 May 2010 07:47:40 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CCAB48FC08; Wed, 5 May 2010 07:47:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o457le82084681; Wed, 5 May 2010 07:47:40 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o457leh4084679; Wed, 5 May 2010 07:47:40 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005050747.o457leh4084679@svn.freebsd.org> From: Alan Cox Date: Wed, 5 May 2010 07:47:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207649 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 07:47:41 -0000 Author: alc Date: Wed May 5 07:47:40 2010 New Revision: 207649 URL: http://svn.freebsd.org/changeset/base/207649 Log: Use an OBJT_PHYS object and thus PG_UNMANAGED pages to implement the TSB. The TSB is not a pageable structure, so there is no point in using managed pages. Reviewed by: kib Modified: head/sys/sparc64/sparc64/pmap.c Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Wed May 5 07:40:54 2010 (r207648) +++ head/sys/sparc64/sparc64/pmap.c Wed May 5 07:47:40 2010 (r207649) @@ -1091,7 +1091,7 @@ pmap_pinit(pmap_t pm) * Allocate an object for it. */ if (pm->pm_tsb_obj == NULL) - pm->pm_tsb_obj = vm_object_allocate(OBJT_DEFAULT, TSB_PAGES); + pm->pm_tsb_obj = vm_object_allocate(OBJT_PHYS, TSB_PAGES); VM_OBJECT_LOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) { @@ -1152,16 +1152,10 @@ pmap_release(pmap_t pm) KASSERT(obj->ref_count == 1, ("pmap_release: tsbobj ref count != 1")); while (!TAILQ_EMPTY(&obj->memq)) { m = TAILQ_FIRST(&obj->memq); - vm_page_lock_queues(); - if (vm_page_sleep_if_busy(m, FALSE, "pmaprl")) - continue; - KASSERT(m->hold_count == 0, - ("pmap_release: freeing held tsb page")); m->md.pmap = NULL; m->wire_count--; atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free_zero(m); - vm_page_unlock_queues(); } VM_OBJECT_UNLOCK(obj); pmap_qremove((vm_offset_t)pm->pm_tsb, TSB_PAGES); From owner-svn-src-head@FreeBSD.ORG Wed May 5 08:10:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 90C1D1065673; Wed, 5 May 2010 08:10:27 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 03B488FC1B; Wed, 5 May 2010 08:10:26 +0000 (UTC) Received: from outgoing.leidinger.net (pD954F941.dip.t-dialin.net [217.84.249.65]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 8911784446F; Wed, 5 May 2010 10:10:20 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 5448B5120; Wed, 5 May 2010 10:10:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1273047015; bh=4BlLt4+Wa4lohxSnZ9oT58xvjFwXVkIor0JR4vki744=; h=Message-ID:Date:From:To:Cc:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; b=eu+8xiCbUJTWmpgfw6nVEtLsovcg2GmS8sUtVKMYvDgh54B0la5XbvZLvktLoDY04 CiwT+W8lcQmlqrLAoroE/wpLXcFZoUKMVlVkxtXGtYMEDqKHqi00RecuEJUmbTLqTa zbZ4dYIikbMnyWN/m0EaOJdMIs2On3ExSFg41AOIqTtWivkts+Ag2e6l6dMhbqrfqs iBdtjxFY0usxfGJdOf2UrrBz21IS+TOglFidh6Y6GWimY93niurMtLiYfMk23W1vZf bZkk8Z7bXJ0LX/zRB0b2eJnBOIqAn1p26jAdqPKyAv25JSSMtYf3ujIt+vWvkjPEG8 sPnP/W2dyzpzg== Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id o458AFEO080875; Wed, 5 May 2010 10:10:15 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Wed, 05 May 2010 10:10:14 +0200 Message-ID: <20100505101014.21013q8knucsqo00@webmail.leidinger.net> Date: Wed, 05 May 2010 10:10:14 +0200 From: Alexander Leidinger To: Doug Barton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: 8911784446F.22E31 X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=-1.363, required 6, autolearn=disabled, ALL_TRUSTED -1.44, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, TW_SV 0.08) X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1273651822.38624@uUlS5k7NgpPRowQdKr3F6A X-EBL-Spam-Status: No Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Norikatsu Shigemura Subject: Re: svn commit: r207612 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 08:10:27 -0000 Quoting Doug Barton (from Tue, 04 May 2010 09:00:33 -0700): > On 5/4/2010 7:02 AM, Alexander Leidinger wrote: >> Quoting Norikatsu Shigemura (from Tue, 4 May 2010 >> 11:25:04 +0000 (UTC)): >> >>> Author: nork >>> Date: Tue May 4 11:25:04 2010 >>> New Revision: 207612 >>> URL: http://svn.freebsd.org/changeset/base/207612 >>> >>> Log: >>> Add support run services_mkdb(8). >> >> Shouldn't this (and similar messages) only be done if there is a >> corresponding DB file? > > This is the first case where the db file is "optional." All the others No, the DB for login.conf is optional too. The man page of login.conf is wrong. The cgetent(3) man-page explicitely tells that it first looks in the DB file, but falls back to the ASCII file if the DB file is not available. > have been created by default for ages now, and nork was simply copying > the existing code (including the "make sure" bit). I was assuming that it is just a copy of what exists. > As he pointed out, I asked him to make the prompt unconditional since > the db file is small, and harmless if not being used. Making it > conditional now is a pointless micro-optimization that will have to be > removed down the road when having/needing it becomes the default. Is there some movement to make it not optional? I do not think it is a micro-optimization. I do not talk about some performance impact (be it work which has to do be done by a person or by a CPU), it is about system knowledge. The DB is optional, if you ask someone without enough knowledge (and there are a lot of such people which do sysadministration stuff) to do this, he will not understand what this implies (that he has to run such a command every time /etc/services is changed). The DB file is only harmless if it is in sync with the ASCII file. If they are not in sync, the DB file is harmful to people which do not know about this feature. As an example of what I talk about: my client is a part of the european comission. This means we talk about a some kind of government entity (what follows can be told about big corporations too). They outsource the work for some specific time, and after that they make a new call for tender for this position. Most of the time the cheapest offer wins (decission of the bean counters, not by people which know what it means technically). I was there in the previous contract and in the current contract. In the previous contract we all where highly skilled. Now with a new manager (who has himself some sysadmin knowledge) everything changed. Junior admins are taking care about all sysadmin stuff, and the few seniors which are left are some kind of firefighters and do some kind of special investigations work. Now, if a junior admin sees some kind of procedure, he follows it. He does not see strange things, he does not know the implications of a lot of stuff, and not all ask questions of what it means for the system if he runs a command he does not know about. That's bad, but this is life. They do what they get told to do to earn money. To make my life a little bit more easy, I wrote a script which checks a system (Solaris) for the correct setup. It checks a lot of things, simple things (hostname, domainname, TZ, ...) and complex things (multipathing, ZFS/VxVM stuff, Zones, SMF, ...), generic stuff and the site specific configs. There I do not say only OK or ERROR, I also give infos. The infos are not only like 'do this', but also sometimes also 'ask someone with knowledge about this'. What I try to do there is to be as precise as possible (if there are conditions, I check the conditions if possible, or to tell as good as possible how to check conditions, which the script can not check itself), because I've already seen what people make out of not so detailed explanations. To come back to FreeBSD: a port may tell to modify /etc/services, but it may not tell to recreate the optional DB file (or the user may decide to not act because of the 'optional' and because he does not know what this is). The ports we can fix, but if someone is using some 3rd party application which is not in ports, and this application tells to modify /etc/services, then it is not within our control to fix the problem which may be caused by a stale DB file which the person installing the application does not know about. I hope this makes it more clear what kind of problem I see with the DB files for login.conf and the services file. Bye, Alexander. -- My brain is my second favorite organ. -- Woody Allen http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Wed May 5 08:43:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E0F2106566C; Wed, 5 May 2010 08:43:48 +0000 (UTC) (envelope-from danger@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1DC2F8FC18; Wed, 5 May 2010 08:43:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o458hl8o097108; Wed, 5 May 2010 08:43:47 GMT (envelope-from danger@svn.freebsd.org) Received: (from danger@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o458hlgM097105; Wed, 5 May 2010 08:43:47 GMT (envelope-from danger@svn.freebsd.org) Message-Id: <201005050843.o458hlgM097105@svn.freebsd.org> From: Daniel Gerzo Date: Wed, 5 May 2010 08:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207650 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 08:43:48 -0000 Author: danger (doc committer) Date: Wed May 5 08:43:47 2010 New Revision: 207650 URL: http://svn.freebsd.org/changeset/base/207650 Log: - fix typo Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Wed May 5 07:47:40 2010 (r207649) +++ head/usr.sbin/jail/jail.8 Wed May 5 08:43:47 2010 (r207650) @@ -239,7 +239,7 @@ The .Xr jexec 8 . .It Va ip4.addr A comma-separated list of IPv4 addresses assigned to the prison. -If this is set, the jail is restricted to using only these address. +If this is set, the jail is restricted to using only these addresses. Any attempts to use other addresses fail, and attempts to use wildcard addresses silently use the jailed address instead. For IPv4 the first address given will be kept used as the source address From owner-svn-src-head@FreeBSD.ORG Wed May 5 08:55:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 812161065673; Wed, 5 May 2010 08:55:26 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 70ADC8FC1A; Wed, 5 May 2010 08:55:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o458tQ2a099713; Wed, 5 May 2010 08:55:26 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o458tQw3099711; Wed, 5 May 2010 08:55:26 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <201005050855.o458tQw3099711@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Wed, 5 May 2010 08:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207651 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 08:55:26 -0000 Author: vanhu Date: Wed May 5 08:55:26 2010 New Revision: 207651 URL: http://svn.freebsd.org/changeset/base/207651 Log: Update SA's NAT-T stuff before calling key_mature() in key_update(), as SA may be used as soon as key_mature() has been called. Obtained from: NETASQ MFC after: 1 week Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed May 5 08:43:47 2010 (r207650) +++ head/sys/netipsec/key.c Wed May 5 08:55:26 2010 (r207651) @@ -5156,12 +5156,6 @@ key_update(so, m, mhp) return key_senderror(so, m, error); } - /* check SA values to be mature. */ - if ((mhp->msg->sadb_msg_errno = key_mature(sav)) != 0) { - KEY_FREESAV(&sav); - return key_senderror(so, m, 0); - } - #ifdef IPSEC_NAT_T /* * Handle more NAT-T info if present, @@ -5188,6 +5182,12 @@ key_update(so, m, mhp) #endif #endif + /* check SA values to be mature. */ + if ((mhp->msg->sadb_msg_errno = key_mature(sav)) != 0) { + KEY_FREESAV(&sav); + return key_senderror(so, m, 0); + } + { struct mbuf *n; From owner-svn-src-head@FreeBSD.ORG Wed May 5 08:58:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F111A1065673; Wed, 5 May 2010 08:58:58 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E0E738FC16; Wed, 5 May 2010 08:58:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o458wwJl000596; Wed, 5 May 2010 08:58:58 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o458ww9n000594; Wed, 5 May 2010 08:58:58 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <201005050858.o458ww9n000594@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Wed, 5 May 2010 08:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207652 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 08:58:59 -0000 Author: vanhu Date: Wed May 5 08:58:58 2010 New Revision: 207652 URL: http://svn.freebsd.org/changeset/base/207652 Log: Set SA's natt_type before calling key_mature() in key_add(), as the SA may be used as soon as key_mature() has been done. Obtained from: NETASQ MFC after: 1 week Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed May 5 08:55:26 2010 (r207651) +++ head/sys/netipsec/key.c Wed May 5 08:58:58 2010 (r207652) @@ -5422,12 +5422,6 @@ key_add(so, m, mhp) return key_senderror(so, m, error); } - /* check SA values to be mature. */ - if ((error = key_mature(newsav)) != 0) { - KEY_FREESAV(&newsav); - return key_senderror(so, m, error); - } - #ifdef IPSEC_NAT_T /* * Handle more NAT-T info if present, @@ -5447,6 +5441,12 @@ key_add(so, m, mhp) #endif #endif + /* check SA values to be mature. */ + if ((error = key_mature(newsav)) != 0) { + KEY_FREESAV(&newsav); + return key_senderror(so, m, error); + } + /* * don't call key_freesav() here, as we would like to keep the SA * in the database on success. From owner-svn-src-head@FreeBSD.ORG Wed May 5 10:02:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C20BD106564A; Wed, 5 May 2010 10:02:53 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id 7C7CC8FC15; Wed, 5 May 2010 10:02:53 +0000 (UTC) Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14]) by karen.lavabit.com (Postfix) with ESMTP id 74DDE11BA1C; Wed, 5 May 2010 05:02:52 -0500 (CDT) Received: from 10.0.10.3 (54.81.54.77.rev.vodafone.pt [77.54.81.54]) by lavabit.com with ESMTP id 8ADHUWL21VJZ; Wed, 05 May 2010 05:02:52 -0500 Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <201005050041.o450fesw090589@svn.freebsd.org> Date: Wed, 5 May 2010 11:02:49 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201005050041.o450fesw090589@svn.freebsd.org> To: Navdeep Parhar X-Mailer: Apple Mail (2.1078) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207643 - in head: sys/dev/cxgb usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 10:02:53 -0000 On 5 May 2010, at 01:41, Navdeep Parhar wrote: > Author: np > Date: Wed May 5 00:41:40 2010 > New Revision: 207643 > URL: http://svn.freebsd.org/changeset/base/207643 >=20 > Log: > Add support for hardware filters to cxgb(4). The T3 chip can inspect > L2/3/4 headers and can drop or steer packets as instructed. = Filtering > based on src ip, dst ip, src port, dst port, 802.1q, udp/tcp, and mac > addr is possible. Add support in cxgbtool to program these filters. > Some simple examples: >=20 > Drop all tcp/80 traffic coming from the subnet specified. > # cxgbtool cxgb2 filter 0 sip 192.168.1.0/24 dport 80 type tcp action = drop >=20 > Steer all incoming UDP traffic to qset 0. > # cxgbtool cxgb2 filter 1 type udp queue 0 action pass >=20 > Steer all tcp traffic from 192.168.1.1 to qset 1. > # cxgbtool cxgb2 filter 2 sip 192.168.1.1 type tcp queue 1 action = pass >=20 > Drop fragments. > # cxgbtool cxgb2 filter 3 type frag action drop >=20 > List all filters. > # cxgbtool cxgb2 filter list > index SIP DIP sport dport VLAN PRI P/MAC = type Q > 0 192.168.1.0/24 0.0.0.0 * 80 0 0/1 */* = tcp - > 1 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* = udp 0 > 2 192.168.1.1/32 0.0.0.0 * * 0 0/1 */* = tcp 1 > 3 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* = frag - > 16367 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* = * * >=20 > MFC after: 2 weeks Wow, this is great! So this is able to do packet filtering at 10Gbps = with no CPU impact? Regards, -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Wed May 5 10:23:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A2D351065672; Wed, 5 May 2010 10:23:31 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 368C58FC18; Wed, 5 May 2010 10:23:31 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id CA03446B89; Wed, 5 May 2010 06:23:30 -0400 (EDT) Date: Wed, 5 May 2010 11:23:30 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Navdeep Parhar In-Reply-To: <201005050041.o450fesw090589@svn.freebsd.org> Message-ID: References: <201005050041.o450fesw090589@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207643 - in head: sys/dev/cxgb usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 10:23:31 -0000 On Wed, 5 May 2010, Navdeep Parhar wrote: > L2/3/4 headers and can drop or steer packets as instructed. Filtering > based on src ip, dst ip, src port, dst port, 802.1q, udp/tcp, and mac > addr is possible. Add support in cxgbtool to program these filters. > Some simple examples: Excellent news! Now to start to teach the network stack how to use these features itself for the purposes of aligning connection affinity up/down the stack! Robert > > Drop all tcp/80 traffic coming from the subnet specified. > # cxgbtool cxgb2 filter 0 sip 192.168.1.0/24 dport 80 type tcp action drop > > Steer all incoming UDP traffic to qset 0. > # cxgbtool cxgb2 filter 1 type udp queue 0 action pass > > Steer all tcp traffic from 192.168.1.1 to qset 1. > # cxgbtool cxgb2 filter 2 sip 192.168.1.1 type tcp queue 1 action pass > > Drop fragments. > # cxgbtool cxgb2 filter 3 type frag action drop > > List all filters. > # cxgbtool cxgb2 filter list > index SIP DIP sport dport VLAN PRI P/MAC type Q > 0 192.168.1.0/24 0.0.0.0 * 80 0 0/1 */* tcp - > 1 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* udp 0 > 2 192.168.1.1/32 0.0.0.0 * * 0 0/1 */* tcp 1 > 3 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* frag - > 16367 0.0.0.0/0 0.0.0.0 * * 0 0/1 */* * * > > MFC after: 2 weeks > > Modified: > head/sys/dev/cxgb/cxgb_ioctl.h > head/sys/dev/cxgb/cxgb_main.c > head/usr.sbin/cxgbtool/cxgbtool.c > > Modified: head/sys/dev/cxgb/cxgb_ioctl.h > ============================================================================== > --- head/sys/dev/cxgb/cxgb_ioctl.h Wed May 5 00:39:50 2010 (r207642) > +++ head/sys/dev/cxgb/cxgb_ioctl.h Wed May 5 00:41:40 2010 (r207643) > @@ -59,6 +59,9 @@ enum { > CH_CLEAR_STATS, > CH_GET_UP_LA, > CH_GET_UP_IOQS, > + CH_SET_FILTER, > + CH_DEL_FILTER, > + CH_GET_FILTER, > }; > > /* statistics categories */ > @@ -215,6 +218,29 @@ struct ch_up_ioqs { > struct t3_ioq_entry *data; > }; > > +struct ch_filter_tuple { > + uint32_t sip; > + uint32_t dip; > + uint16_t sport; > + uint16_t dport; > + uint16_t vlan:12; > + uint16_t vlan_prio:3; > +}; > + > +struct ch_filter { > + uint32_t filter_id; > + struct ch_filter_tuple val; > + struct ch_filter_tuple mask; > + uint16_t mac_addr_idx; > + uint8_t mac_hit:1; > + uint8_t proto:2; > + > + uint8_t want_filter_id:1; > + uint8_t pass:1; > + uint8_t rss:1; > + uint8_t qset; > +}; > + > #define CHELSIO_SETREG _IOW('f', CH_SETREG, struct ch_reg) > #define CHELSIO_GETREG _IOWR('f', CH_GETREG, struct ch_reg) > #define CHELSIO_GETMTUTAB _IOR('f', CH_GETMTUTAB, struct ch_mtus) > @@ -239,4 +265,7 @@ struct ch_up_ioqs { > #define CHELSIO_GET_EEPROM _IOWR('f', CH_GET_EEPROM, struct ch_eeprom) > #define CHELSIO_GET_UP_LA _IOWR('f', CH_GET_UP_LA, struct ch_up_la) > #define CHELSIO_GET_UP_IOQS _IOWR('f', CH_GET_UP_IOQS, struct ch_up_ioqs) > +#define CHELSIO_SET_FILTER _IOW('f', CH_SET_FILTER, struct ch_filter) > +#define CHELSIO_DEL_FILTER _IOW('f', CH_DEL_FILTER, struct ch_filter) > +#define CHELSIO_GET_FILTER _IOWR('f', CH_GET_FILTER, struct ch_filter) > #endif > > Modified: head/sys/dev/cxgb/cxgb_main.c > ============================================================================== > --- head/sys/dev/cxgb/cxgb_main.c Wed May 5 00:39:50 2010 (r207642) > +++ head/sys/dev/cxgb/cxgb_main.c Wed May 5 00:41:40 2010 (r207643) > @@ -99,6 +99,13 @@ static void cxgb_ext_intr_handler(void * > static void cxgb_tick_handler(void *, int); > static void cxgb_tick(void *); > static void setup_rss(adapter_t *sc); > +static int alloc_filters(struct adapter *); > +static int setup_hw_filters(struct adapter *); > +static int set_filter(struct adapter *, int, const struct filter_info *); > +static inline void mk_set_tcb_field(struct cpl_set_tcb_field *, unsigned int, > + unsigned int, u64, u64); > +static inline void set_tcb_field_ulp(struct cpl_set_tcb_field *, unsigned int, > + unsigned int, u64, u64); > > /* Attachment glue for the PCI controller end of the device. Each port of > * the device is attached separately, as defined later. > @@ -1661,6 +1668,13 @@ cxgb_up(struct adapter *sc) > if ((err = update_tpsram(sc))) > goto out; > > + if (is_offload(sc)) { > + sc->params.mc5.nservers = 0; > + sc->params.mc5.nroutes = 0; > + sc->params.mc5.nfilters = t3_mc5_size(&sc->mc5) - > + MC5_MIN_TIDS; > + } > + > err = t3_init_hw(sc, 0); > if (err) > goto out; > @@ -1672,6 +1686,7 @@ cxgb_up(struct adapter *sc) > if (err) > goto out; > > + alloc_filters(sc); > setup_rss(sc); > > t3_intr_clear(sc); > @@ -1698,6 +1713,7 @@ cxgb_up(struct adapter *sc) > > if (!(sc->flags & QUEUES_BOUND)) { > bind_qsets(sc); > + setup_hw_filters(sc); > sc->flags |= QUEUES_BOUND; > } > > @@ -3076,6 +3092,139 @@ cxgb_extension_ioctl(struct cdev *dev, u > free(buf, M_DEVBUF); > break; > } > + case CHELSIO_SET_FILTER: { > + struct ch_filter *f = (struct ch_filter *)data;; > + struct filter_info *p; > + unsigned int nfilters = sc->params.mc5.nfilters; > + > + if (!is_offload(sc)) > + return (EOPNOTSUPP); /* No TCAM */ > + if (!(sc->flags & FULL_INIT_DONE)) > + return (EAGAIN); /* mc5 not setup yet */ > + if (nfilters == 0) > + return (EBUSY); /* TOE will use TCAM */ > + > + /* sanity checks */ > + if (f->filter_id >= nfilters || > + (f->val.dip && f->mask.dip != 0xffffffff) || > + (f->val.sport && f->mask.sport != 0xffff) || > + (f->val.dport && f->mask.dport != 0xffff) || > + (f->val.vlan && f->mask.vlan != 0xfff) || > + (f->val.vlan_prio && > + f->mask.vlan_prio != FILTER_NO_VLAN_PRI) || > + (f->mac_addr_idx != 0xffff && f->mac_addr_idx > 15) || > + f->qset >= SGE_QSETS || > + sc->rrss_map[f->qset] >= RSS_TABLE_SIZE) > + return (EINVAL); > + > + /* Was allocated with M_WAITOK */ > + KASSERT(sc->filters, ("filter table NULL\n")); > + > + p = &sc->filters[f->filter_id]; > + if (p->locked) > + return (EPERM); > + > + bzero(p, sizeof(*p)); > + p->sip = f->val.sip; > + p->sip_mask = f->mask.sip; > + p->dip = f->val.dip; > + p->sport = f->val.sport; > + p->dport = f->val.dport; > + p->vlan = f->mask.vlan ? f->val.vlan : 0xfff; > + p->vlan_prio = f->mask.vlan_prio ? (f->val.vlan_prio & 6) : > + FILTER_NO_VLAN_PRI; > + p->mac_hit = f->mac_hit; > + p->mac_vld = f->mac_addr_idx != 0xffff; > + p->mac_idx = f->mac_addr_idx; > + p->pkt_type = f->proto; > + p->report_filter_id = f->want_filter_id; > + p->pass = f->pass; > + p->rss = f->rss; > + p->qset = f->qset; > + > + error = set_filter(sc, f->filter_id, p); > + if (error == 0) > + p->valid = 1; > + break; > + } > + case CHELSIO_DEL_FILTER: { > + struct ch_filter *f = (struct ch_filter *)data; > + struct filter_info *p; > + unsigned int nfilters = sc->params.mc5.nfilters; > + > + if (!is_offload(sc)) > + return (EOPNOTSUPP); > + if (!(sc->flags & FULL_INIT_DONE)) > + return (EAGAIN); > + if (nfilters == 0 || sc->filters == NULL) > + return (EINVAL); > + if (f->filter_id >= nfilters) > + return (EINVAL); > + > + p = &sc->filters[f->filter_id]; > + if (p->locked) > + return (EPERM); > + if (!p->valid) > + return (EFAULT); /* Read "Bad address" as "Bad index" */ > + > + bzero(p, sizeof(*p)); > + p->sip = p->sip_mask = 0xffffffff; > + p->vlan = 0xfff; > + p->vlan_prio = FILTER_NO_VLAN_PRI; > + p->pkt_type = 1; > + error = set_filter(sc, f->filter_id, p); > + break; > + } > + case CHELSIO_GET_FILTER: { > + struct ch_filter *f = (struct ch_filter *)data; > + struct filter_info *p; > + unsigned int i, nfilters = sc->params.mc5.nfilters; > + > + if (!is_offload(sc)) > + return (EOPNOTSUPP); > + if (!(sc->flags & FULL_INIT_DONE)) > + return (EAGAIN); > + if (nfilters == 0 || sc->filters == NULL) > + return (EINVAL); > + > + i = f->filter_id == 0xffffffff ? 0 : f->filter_id + 1; > + for (; i < nfilters; i++) { > + p = &sc->filters[i]; > + if (!p->valid) > + continue; > + > + bzero(f, sizeof(*f)); > + > + f->filter_id = i; > + f->val.sip = p->sip; > + f->mask.sip = p->sip_mask; > + f->val.dip = p->dip; > + f->mask.dip = p->dip ? 0xffffffff : 0; > + f->val.sport = p->sport; > + f->mask.sport = p->sport ? 0xffff : 0; > + f->val.dport = p->dport; > + f->mask.dport = p->dport ? 0xffff : 0; > + f->val.vlan = p->vlan == 0xfff ? 0 : p->vlan; > + f->mask.vlan = p->vlan == 0xfff ? 0 : 0xfff; > + f->val.vlan_prio = p->vlan_prio == FILTER_NO_VLAN_PRI ? > + 0 : p->vlan_prio; > + f->mask.vlan_prio = p->vlan_prio == FILTER_NO_VLAN_PRI ? > + 0 : FILTER_NO_VLAN_PRI; > + f->mac_hit = p->mac_hit; > + f->mac_addr_idx = p->mac_vld ? p->mac_idx : 0xffff; > + f->proto = p->pkt_type; > + f->want_filter_id = p->report_filter_id; > + f->pass = p->pass; > + f->rss = p->rss; > + f->qset = p->qset; > + > + break; > + } > + > + if (i == nfilters) > + f->filter_id = 0xffffffff; > + break; > + } > default: > return (EOPNOTSUPP); > break; > @@ -3130,5 +3279,129 @@ cxgb_get_regs(adapter_t *sc, struct ch_i > XGM_REG(A_XGM_RX_SPI4_SOP_EOP_CNT, 1)); > } > > +static int > +alloc_filters(struct adapter *sc) > +{ > + struct filter_info *p; > + unsigned int nfilters = sc->params.mc5.nfilters; > + > + if (nfilters == 0) > + return (0); > + > + p = malloc(sizeof(*p) * nfilters, M_DEVBUF, M_WAITOK | M_ZERO); > + sc->filters = p; > + > + p = &sc->filters[nfilters - 1]; > + p->vlan = 0xfff; > + p->vlan_prio = FILTER_NO_VLAN_PRI; > + p->pass = p->rss = p->valid = p->locked = 1; > + > + return (0); > +} > + > +static int > +setup_hw_filters(struct adapter *sc) > +{ > + int i, rc; > + unsigned int nfilters = sc->params.mc5.nfilters; > + > + if (!sc->filters) > + return (0); > + > + t3_enable_filters(sc); > + > + for (i = rc = 0; i < nfilters && !rc; i++) { > + if (sc->filters[i].locked) > + rc = set_filter(sc, i, &sc->filters[i]); > + } > + > + return (rc); > +} > + > +static int > +set_filter(struct adapter *sc, int id, const struct filter_info *f) > +{ > + int len; > + struct mbuf *m; > + struct ulp_txpkt *txpkt; > + struct work_request_hdr *wr; > + struct cpl_pass_open_req *oreq; > + struct cpl_set_tcb_field *sreq; > + > + len = sizeof(*wr) + sizeof(*oreq) + 2 * sizeof(*sreq); > + KASSERT(len <= MHLEN, ("filter request too big for an mbuf")); > + > + id += t3_mc5_size(&sc->mc5) - sc->params.mc5.nroutes - > + sc->params.mc5.nfilters; > + > + m = m_gethdr(M_WAITOK, MT_DATA); > + m->m_len = m->m_pkthdr.len = len; > + bzero(mtod(m, char *), len); > + > + wr = mtod(m, struct work_request_hdr *); > + wr->wrh_hi = htonl(V_WR_OP(FW_WROPCODE_BYPASS) | F_WR_ATOMIC); > + > + oreq = (struct cpl_pass_open_req *)(wr + 1); > + txpkt = (struct ulp_txpkt *)oreq; > + txpkt->cmd_dest = htonl(V_ULPTX_CMD(ULP_TXPKT)); > + txpkt->len = htonl(V_ULPTX_NFLITS(sizeof(*oreq) / 8)); > + OPCODE_TID(oreq) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, id)); > + oreq->local_port = htons(f->dport); > + oreq->peer_port = htons(f->sport); > + oreq->local_ip = htonl(f->dip); > + oreq->peer_ip = htonl(f->sip); > + oreq->peer_netmask = htonl(f->sip_mask); > + oreq->opt0h = 0; > + oreq->opt0l = htonl(F_NO_OFFLOAD); > + oreq->opt1 = htonl(V_MAC_MATCH_VALID(f->mac_vld) | > + V_CONN_POLICY(CPL_CONN_POLICY_FILTER) | > + V_VLAN_PRI(f->vlan_prio >> 1) | > + V_VLAN_PRI_VALID(f->vlan_prio != FILTER_NO_VLAN_PRI) | > + V_PKT_TYPE(f->pkt_type) | V_OPT1_VLAN(f->vlan) | > + V_MAC_MATCH(f->mac_idx | (f->mac_hit << 4))); > + > + sreq = (struct cpl_set_tcb_field *)(oreq + 1); > + set_tcb_field_ulp(sreq, id, 1, 0x1800808000ULL, > + (f->report_filter_id << 15) | (1 << 23) | > + ((u64)f->pass << 35) | ((u64)!f->rss << 36)); > + set_tcb_field_ulp(sreq + 1, id, 0, 0xffffffff, (2 << 19) | 1); > + t3_mgmt_tx(sc, m); > + > + if (f->pass && !f->rss) { > + len = sizeof(*sreq); > + m = m_gethdr(M_WAITOK, MT_DATA); > + m->m_len = m->m_pkthdr.len = len; > + bzero(mtod(m, char *), len); > + sreq = mtod(m, struct cpl_set_tcb_field *); > + sreq->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); > + mk_set_tcb_field(sreq, id, 25, 0x3f80000, > + (u64)sc->rrss_map[f->qset] << 19); > + t3_mgmt_tx(sc, m); > + } > + return 0; > +} > + > +static inline void > +mk_set_tcb_field(struct cpl_set_tcb_field *req, unsigned int tid, > + unsigned int word, u64 mask, u64 val) > +{ > + OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); > + req->reply = V_NO_REPLY(1); > + req->cpu_idx = 0; > + req->word = htons(word); > + req->mask = htobe64(mask); > + req->val = htobe64(val); > +} > + > +static inline void > +set_tcb_field_ulp(struct cpl_set_tcb_field *req, unsigned int tid, > + unsigned int word, u64 mask, u64 val) > +{ > + struct ulp_txpkt *txpkt = (struct ulp_txpkt *)req; > + > + txpkt->cmd_dest = htonl(V_ULPTX_CMD(ULP_TXPKT)); > + txpkt->len = htonl(V_ULPTX_NFLITS(sizeof(*req) / 8)); > + mk_set_tcb_field(req, tid, word, mask, val); > +} > > MODULE_DEPEND(if_cxgb, cxgb_t3fw, 1, 1, 1); > > Modified: head/usr.sbin/cxgbtool/cxgbtool.c > ============================================================================== > --- head/usr.sbin/cxgbtool/cxgbtool.c Wed May 5 00:39:50 2010 (r207642) > +++ head/usr.sbin/cxgbtool/cxgbtool.c Wed May 5 00:41:40 2010 (r207643) > @@ -1,6 +1,6 @@ > /************************************************************************** > > -Copyright (c) 2007-2009, Chelsio Inc. > +Copyright (c) 2007-2010, Chelsio Inc. > All rights reserved. > > Redistribution and use in source and binary forms, with or without > @@ -93,6 +93,9 @@ usage(FILE *fp) > "\tclearstats clear MAC statistics\n" > "\tcontext show an SGE context\n" > "\tdesc [] dump SGE descriptors\n" > + "\tfilter [ ] ... set a filter\n" > + "\tfilter delete|clear delete a filter\n" > + "\tfilter list list all filters\n" > "\tioqs dump uP IOQs\n" > "\tla dump uP logic analyzer info\n" > "\tloadboot download boot image\n" > @@ -1177,24 +1180,25 @@ parse_ipaddr(const char *s, uint32_t *ad > * Parse a string containing a value and an optional colon separated mask. > */ > static int > -parse_val_mask_param(const char *s, uint32_t *val, uint32_t *mask) > +parse_val_mask_param(const char *s, uint32_t *val, uint32_t *mask, > + uint32_t default_mask) > { > char *p; > > - *mask = 0xffffffffU; > + *mask = default_mask; > *val = strtoul(s, &p, 0); > - if (p == s) > + if (p == s || *val > default_mask) > return -1; > if (*p == ':' && p[1]) > *mask = strtoul(p + 1, &p, 0); > - return *p ? -1 : 0; > + return *p || *mask > default_mask ? -1 : 0; > } > > static int > parse_trace_param(const char *s, uint32_t *val, uint32_t *mask) > { > return strchr(s, '.') ? parse_ipaddr(s, val, mask) : > - parse_val_mask_param(s, val, mask); > + parse_val_mask_param(s, val, mask, 0xffffffffU); > } > > static int > @@ -1273,6 +1277,174 @@ trace_config(int argc, char *argv[], int > return 0; > } > > +static void > +show_filters(const char *iff_name) > +{ > + static const char *pkt_type[] = { "*", "tcp", "udp", "frag" }; > + struct ch_filter op; > + union { > + uint32_t nip; > + uint8_t octet[4]; > + } nsip, ndip; > + char sip[20], dip[20]; > + int header = 0; > + > + bzero(&op, sizeof(op)); > + op.filter_id = 0xffffffff; > + > + do { > + if (doit(iff_name, CHELSIO_GET_FILTER, &op) < 0) > + err(1, "list filters"); > + > + if (op.filter_id == 0xffffffff) > + break; > + > + if (!header) { > + printf("index SIP DIP sport " > + "dport VLAN PRI P/MAC type Q\n"); > + header = 1; > + } > + > + nsip.nip = htonl(op.val.sip); > + ndip.nip = htonl(op.val.dip); > + > + sprintf(sip, "%u.%u.%u.%u/%-2u", nsip.octet[0], nsip.octet[1], > + nsip.octet[2], nsip.octet[3], > + op.mask.sip ? 33 - ffs(op.mask.sip) : 0); > + sprintf(dip, "%u.%u.%u.%u", ndip.octet[0], ndip.octet[1], > + ndip.octet[2], ndip.octet[3]); > + printf("%5zu %18s %15s ", (size_t)op.filter_id, sip, dip); > + printf(op.val.sport ? "%5u " : " * ", op.val.sport); > + printf(op.val.dport ? "%5u " : " * ", op.val.dport); > + printf(op.val.vlan != 0xfff ? "%4u " : " * ", op.val.vlan); > + printf(op.val.vlan_prio == 7 ? " * " : > + "%1u/%1u ", op.val.vlan_prio, op.val.vlan_prio | 1); > + if (op.mac_addr_idx == 0xffff) > + printf("*/* "); > + else if (op.mac_hit) > + printf("%1u/%3u ", (op.mac_addr_idx >> 3) & 0x1, > + (op.mac_addr_idx) & 0x7); > + else > + printf("%1u/ * ", (op.mac_addr_idx >> 3) & 0x1); > + printf("%4s ", pkt_type[op.proto]); > + if (!op.pass) > + printf("-\n"); > + else if (op.rss) > + printf("*\n"); > + else > + printf("%1u\n", op.qset); > + } while (1); > +} > + > +static int > +filter_config(int argc, char *argv[], int start_arg, const char *iff_name) > +{ > + int ret = 0; > + uint32_t val, mask; > + struct ch_filter op; > + > + if (argc < start_arg + 1) > + return -1; > + > + memset(&op, 0, sizeof(op)); > + op.mac_addr_idx = 0xffff; > + op.rss = 1; > + > + if (argc == start_arg + 1 && !strcmp(argv[start_arg], "list")) { > + show_filters(iff_name); > + return 0; > + } > + > + if (get_int_arg(argv[start_arg++], &op.filter_id)) > + return -1; > + if (argc == start_arg + 1 && (!strcmp(argv[start_arg], "delete") || > + !strcmp(argv[start_arg], "clear"))) { > + if (doit(iff_name, CHELSIO_DEL_FILTER, &op) < 0) { > + if (errno == EBUSY) > + err(1, "no filter support when offload in use"); > + err(1, "delete filter"); > + } > + return 0; > + } > + > + while (start_arg + 2 <= argc) { > + if (!strcmp(argv[start_arg], "sip")) { > + ret = parse_ipaddr(argv[start_arg + 1], &op.val.sip, > + &op.mask.sip); > + } else if (!strcmp(argv[start_arg], "dip")) { > + ret = parse_ipaddr(argv[start_arg + 1], &op.val.dip, > + &op.mask.dip); > + } else if (!strcmp(argv[start_arg], "sport")) { > + ret = parse_val_mask_param(argv[start_arg + 1], > + &val, &mask, 0xffff); > + op.val.sport = val; > + op.mask.sport = mask; > + } else if (!strcmp(argv[start_arg], "dport")) { > + ret = parse_val_mask_param(argv[start_arg + 1], > + &val, &mask, 0xffff); > + op.val.dport = val; > + op.mask.dport = mask; > + } else if (!strcmp(argv[start_arg], "vlan")) { > + ret = parse_val_mask_param(argv[start_arg + 1], > + &val, &mask, 0xfff); > + op.val.vlan = val; > + op.mask.vlan = mask; > + } else if (!strcmp(argv[start_arg], "prio")) { > + ret = parse_val_mask_param(argv[start_arg + 1], > + &val, &mask, 7); > + op.val.vlan_prio = val; > + op.mask.vlan_prio = mask; > + } else if (!strcmp(argv[start_arg], "mac")) { > + if (!strcmp(argv[start_arg + 1], "none")) > + val = -1; > + else > + ret = get_int_arg(argv[start_arg + 1], &val); > + op.mac_hit = val != (uint32_t)-1; > + op.mac_addr_idx = op.mac_hit ? val : 0; > + } else if (!strcmp(argv[start_arg], "type")) { > + if (!strcmp(argv[start_arg + 1], "tcp")) > + op.proto = 1; > + else if (!strcmp(argv[start_arg + 1], "udp")) > + op.proto = 2; > + else if (!strcmp(argv[start_arg + 1], "frag")) > + op.proto = 3; > + else > + errx(1, "unknown type \"%s\"; must be one of " > + "\"tcp\", \"udp\", or \"frag\"", > + argv[start_arg + 1]); > + } else if (!strcmp(argv[start_arg], "queue")) { > + ret = get_int_arg(argv[start_arg + 1], &val); > + op.qset = val; > + op.rss = 0; > + } else if (!strcmp(argv[start_arg], "action")) { > + if (!strcmp(argv[start_arg + 1], "pass")) > + op.pass = 1; > + else if (strcmp(argv[start_arg + 1], "drop")) > + errx(1, "unknown action \"%s\"; must be one of " > + "\"pass\" or \"drop\"", > + argv[start_arg + 1]); > + } else > + errx(1, "unknown filter parameter \"%s\"\n" > + "known parameters are \"mac\", \"sip\", " > + "\"dip\", \"sport\", \"dport\", \"vlan\", " > + "\"prio\", \"type\", \"queue\", and \"action\"", > + argv[start_arg]); > + if (ret < 0) > + errx(1, "bad value \"%s\" for parameter \"%s\"", > + argv[start_arg + 1], argv[start_arg]); > + start_arg += 2; > + } > + if (start_arg != argc) > + errx(1, "no value for \"%s\"", argv[start_arg]); > + > + if (doit(iff_name, CHELSIO_SET_FILTER, &op) < 0) { > + if (errno == EBUSY) > + err(1, "no filter support when offload in use"); > + err(1, "set filter"); > + } > + > + return 0; > +} > static int > get_sched_param(int argc, char *argv[], int pos, unsigned int *valp) > { > @@ -1501,6 +1673,8 @@ run_cmd(int argc, char *argv[], const ch > r = pktsched(argc, argv, 3, iff_name); > else if (!strcmp(argv[2], "tcb")) > r = get_tcb2(argc, argv, 3, iff_name); > + else if (!strcmp(argv[2], "filter")) > + r = filter_config(argc, argv, 3, iff_name); > else if (!strcmp(argv[2], "clearstats")) > r = clear_stats(argc, argv, 3, iff_name); > else if (!strcmp(argv[2], "la")) > From owner-svn-src-head@FreeBSD.ORG Wed May 5 10:30:57 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with SMTP id 263A5106566C; Wed, 5 May 2010 10:30:56 +0000 (UTC) (envelope-from nork@FreeBSD.org) Date: Wed, 5 May 2010 19:30:49 +0900 From: Norikatsu Shigemura To: Navdeep Parhar Message-Id: <20100505193049.cd94c63e.nork@FreeBSD.org> In-Reply-To: <201005050041.o450fesw090589@svn.freebsd.org> References: <201005050041.o450fesw090589@svn.freebsd.org> X-Mailer: Sylpheed 3.0.0 (GTK+ 2.18.7; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r207643 - in head: sys/dev/cxgb usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 10:30:57 -0000 Hi np! On Wed, 5 May 2010 00:41:40 +0000 (UTC) Navdeep Parhar wrote: > Add support for hardware filters to cxgb(4). The T3 chip can inspect > L2/3/4 headers and can drop or steer packets as instructed. Filtering > based on src ip, dst ip, src port, dst port, 802.1q, udp/tcp, and mac > addr is possible. Add support in cxgbtool to program these filters. Great news. Do you have any schedule to implement ipfw(4) hardware acceleration? :-) -- Norikatsu Shigemura From owner-svn-src-head@FreeBSD.ORG Wed May 5 16:05:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A970A1065670; Wed, 5 May 2010 16:05:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 99BEE8FC19; Wed, 5 May 2010 16:05:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45G5pe5096480; Wed, 5 May 2010 16:05:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45G5pDG096478; Wed, 5 May 2010 16:05:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005051605.o45G5pDG096478@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 5 May 2010 16:05:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207659 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 16:05:51 -0000 Author: kib Date: Wed May 5 16:05:51 2010 New Revision: 207659 URL: http://svn.freebsd.org/changeset/base/207659 Log: Fix a mistake in r207603. td_rux.rux_runtime still needs conversion. Reported and tested by: nwhitehorn Pointy hat to: kib MFC after: 6 days Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Wed May 5 12:48:30 2010 (r207658) +++ head/sys/kern/kern_proc.c Wed May 5 16:05:51 2010 (r207659) @@ -901,7 +901,7 @@ fill_kinfo_thread(struct thread *td, str kp->ki_pri.pri_user = td->td_user_pri; if (preferthread) { - kp->ki_runtime = td->td_rux.rux_runtime; + kp->ki_runtime = cputick2usec(td->td_rux.rux_runtime); kp->ki_pctcpu = sched_pctcpu(td); kp->ki_estcpu = td->td_estcpu; } From owner-svn-src-head@FreeBSD.ORG Wed May 5 16:44:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 642391065675; Wed, 5 May 2010 16:44:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 51D398FC29; Wed, 5 May 2010 16:44:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45GiQlc005186; Wed, 5 May 2010 16:44:26 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45GiQBB005173; Wed, 5 May 2010 16:44:26 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201005051644.o45GiQBB005173@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 5 May 2010 16:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207662 - in head/sys: fs/ext2fs fs/msdosfs fs/nfsclient fs/nwfs fs/smbfs fs/tmpfs gnu/fs/xfs/FreeBSD kern nfsclient sys ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 16:44:26 -0000 Author: trasz Date: Wed May 5 16:44:25 2010 New Revision: 207662 URL: http://svn.freebsd.org/changeset/base/207662 Log: Move checking against RLIMIT_FSIZE into one place, vn_rlimit_fsize(). Reviewed by: kib Modified: head/sys/fs/ext2fs/ext2_readwrite.c head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c head/sys/kern/vfs_vnops.c head/sys/nfsclient/nfs_bio.c head/sys/sys/vnode.h head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/fs/ext2fs/ext2_readwrite.c ============================================================================== --- head/sys/fs/ext2fs/ext2_readwrite.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/fs/ext2fs/ext2_readwrite.c Wed May 5 16:44:25 2010 (r207662) @@ -168,7 +168,6 @@ WRITE(ap) struct inode *ip; FS *fs; struct buf *bp; - struct thread *td; daddr_t lbn; off_t osize; int blkoffset, error, flags, ioflag, resid, size, seqcount, xfersize; @@ -213,17 +212,8 @@ WRITE(ap) * Maybe this should be above the vnode op call, but so long as * file servers have no limits, I don't think it matters. */ - td = uio->uio_td; - if (vp->v_type == VREG && td != NULL) { - PROC_LOCK(td->td_proc); - if (uio->uio_offset + uio->uio_resid > - lim_cur(td->td_proc, RLIMIT_FSIZE)) { - psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); - return (EFBIG); - } - PROC_UNLOCK(td->td_proc); - } + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) + return (EFBIG); resid = uio->uio_resid; osize = ip->i_size; Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/fs/ext2fs/ext2_vnops.c Wed May 5 16:44:25 2010 (r207662) @@ -46,7 +46,6 @@ #include #include -#include #include #include #include @@ -54,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -71,7 +69,6 @@ #include -#include #include #include Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Wed May 5 16:44:25 2010 (r207662) @@ -61,9 +61,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -699,16 +696,8 @@ msdosfs_write(ap) /* * If they've exceeded their filesize limit, tell them about it. */ - if (td != NULL) { - PROC_LOCK(td->td_proc); - if ((uoff_t)uio->uio_offset + uio->uio_resid > - lim_cur(td->td_proc, RLIMIT_FSIZE)) { - psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); - return (EFBIG); - } - PROC_UNLOCK(td->td_proc); - } + if (vn_rlimit_fsize(vp, uio, td)) + return (EFBIG); /* * If the offset we are starting the write at is beyond the end of Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/fs/nfsclient/nfs_clbio.c Wed May 5 16:44:25 2010 (r207662) @@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include #include #include @@ -880,7 +877,6 @@ ncl_write(struct vop_write_args *ap) daddr_t lbn; int bcount; int n, on, error = 0; - struct proc *p = td?td->td_proc:NULL; #ifdef DIAGNOSTIC if (uio->uio_rw != UIO_WRITE) @@ -962,16 +958,8 @@ flush_and_restart: * Maybe this should be above the vnode op call, but so long as * file servers have no limits, i don't think it matters */ - if (p != NULL) { - PROC_LOCK(p); - if (uio->uio_offset + uio->uio_resid > - lim_cur(p, RLIMIT_FSIZE)) { - psignal(p, SIGXFSZ); - PROC_UNLOCK(p); - return (EFBIG); - } - PROC_UNLOCK(p); - } + if (vn_rlimit_fsize(vp, uio, td)) + return (EFBIG); biosize = vp->v_mount->mnt_stat.f_iosize; /* Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/fs/nwfs/nwfs_io.c Wed May 5 16:44:25 2010 (r207662) @@ -28,16 +28,13 @@ */ #include #include -#include /* defines plimit structure in proc struct */ #include #include #include -#include #include #include #include #include -#include #include #include @@ -229,16 +226,10 @@ nwfs_writevnode(vp, uiop, cred, ioflag) } } if (uiop->uio_resid == 0) return 0; - if (td != NULL) { - PROC_LOCK(td->td_proc); - if (uiop->uio_offset + uiop->uio_resid > - lim_cur(td->td_proc, RLIMIT_FSIZE)) { - psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); - return (EFBIG); - } - PROC_UNLOCK(td->td_proc); - } + + if (vn_rlimit_fsize(vp, uiop, td)) + return (EFBIG); + error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, uiop, cred); NCPVNDEBUG("after: ofs=%d,resid=%d\n",(int)uiop->uio_offset, uiop->uio_resid); if (!error) { Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/fs/smbfs/smbfs_io.c Wed May 5 16:44:25 2010 (r207662) @@ -28,9 +28,7 @@ */ #include #include -#include /* defines plimit structure in proc struct */ #include -#include #include #include #include @@ -235,7 +233,6 @@ smbfs_writevnode(struct vnode *vp, struc struct smbmount *smp = VTOSMBFS(vp); struct smbnode *np = VTOSMB(vp); struct smb_cred scred; - struct proc *p; struct thread *td; int error = 0; @@ -249,7 +246,6 @@ smbfs_writevnode(struct vnode *vp, struc /* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize) return (EFBIG);*/ td = uiop->uio_td; - p = td->td_proc; if (ioflag & (IO_APPEND | IO_SYNC)) { if (np->n_flag & NMODIFIED) { smbfs_attr_cacheremove(vp); @@ -271,16 +267,10 @@ smbfs_writevnode(struct vnode *vp, struc } if (uiop->uio_resid == 0) return 0; - if (p != NULL) { - PROC_LOCK(p); - if (uiop->uio_offset + uiop->uio_resid > - lim_cur(p, RLIMIT_FSIZE)) { - psignal(p, SIGXFSZ); - PROC_UNLOCK(p); - return EFBIG; - } - PROC_UNLOCK(p); - } + + if (vn_rlimit_fsize(vp, uiop, td)) + return (EFBIG); + smb_makescred(&scred, td, cred); error = smb_write(smp->sm_share, np->n_fid, uiop, &scred); SMBVDEBUG("after: ofs=%d,resid=%d\n",(int)uiop->uio_offset, uiop->uio_resid); Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed May 5 16:44:25 2010 (r207662) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -748,16 +747,8 @@ tmpfs_write(struct vop_write_args *v) VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize) return (EFBIG); - if (vp->v_type == VREG && td != NULL) { - PROC_LOCK(td->td_proc); - if (uio->uio_offset + uio->uio_resid > - lim_cur(td->td_proc, RLIMIT_FSIZE)) { - psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); - return (EFBIG); - } - PROC_UNLOCK(td->td_proc); - } + if (vn_rlimit_fsize(vp, uio, td)) + return (EFBIG); extended = uio->uio_offset + uio->uio_resid > node->tn_size; if (extended) { Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Wed May 5 16:44:25 2010 (r207662) @@ -598,16 +598,8 @@ xfs_write_file(xfs_inode_t *xip, struct */ #if 0 td = uio->uio_td; - if (vp->v_type == VREG && td != NULL) { - PROC_LOCK(td->td_proc); - if (uio->uio_offset + uio->uio_resid > - lim_cur(td->td_proc, RLIMIT_FSIZE)) { - psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); - return (EFBIG); - } - PROC_UNLOCK(td->td_proc); - } + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) + return (EFBIG); #endif resid = uio->uio_resid; Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/kern/vfs_vnops.c Wed May 5 16:44:25 2010 (r207662) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1338,3 +1339,21 @@ vn_vget_ino(struct vnode *vp, ino_t ino, } return (error); } + +int +vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, const struct thread *td) +{ + if (vp->v_type != VREG || td == NULL) + return (0); + + PROC_LOCK(td->td_proc); + if (uio->uio_offset + uio->uio_resid > + lim_cur(td->td_proc, RLIMIT_FSIZE)) { + psignal(td->td_proc, SIGXFSZ); + PROC_UNLOCK(td->td_proc); + return (EFBIG); + } + PROC_UNLOCK(td->td_proc); + + return (0); +} Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/nfsclient/nfs_bio.c Wed May 5 16:44:25 2010 (r207662) @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include @@ -873,7 +871,6 @@ nfs_write(struct vop_write_args *ap) daddr_t lbn; int bcount; int n, on, error = 0; - struct proc *p = td?td->td_proc:NULL; #ifdef DIAGNOSTIC if (uio->uio_rw != UIO_WRITE) @@ -954,16 +951,8 @@ flush_and_restart: * Maybe this should be above the vnode op call, but so long as * file servers have no limits, i don't think it matters */ - if (p != NULL) { - PROC_LOCK(p); - if (uio->uio_offset + uio->uio_resid > - lim_cur(p, RLIMIT_FSIZE)) { - psignal(p, SIGXFSZ); - PROC_UNLOCK(p); - return (EFBIG); - } - PROC_UNLOCK(p); - } + if (vn_rlimit_fsize(vp, uio, td)) + return (EFBIG); biosize = vp->v_mount->mnt_stat.f_iosize; /* Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed May 5 16:41:14 2010 (r207661) +++ head/sys/sys/vnode.h Wed May 5 16:44:25 2010 (r207662) @@ -780,6 +780,7 @@ struct dirent; int vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off); int vfs_unixify_accmode(accmode_t *accmode); +int vn_rlimit_fsize(const struct vnode *vn, const struct uio *uio, const struct thread *td); #endif /* _KERNEL */ Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Wed May 5 16:41:14 2010 (r207661) +++ head/sys/ufs/ffs/ffs_vnops.c Wed May 5 16:44:25 2010 (r207662) @@ -75,9 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include #include #include #include @@ -652,7 +649,6 @@ ffs_write(ap) struct inode *ip; struct fs *fs; struct buf *bp; - struct thread *td; ufs_lbn_t lbn; off_t osize; int seqcount; @@ -704,17 +700,8 @@ ffs_write(ap) * Maybe this should be above the vnode op call, but so long as * file servers have no limits, I don't think it matters. */ - td = uio->uio_td; - if (vp->v_type == VREG && td != NULL) { - PROC_LOCK(td->td_proc); - if (uio->uio_offset + uio->uio_resid > - lim_cur(td->td_proc, RLIMIT_FSIZE)) { - psignal(td->td_proc, SIGXFSZ); - PROC_UNLOCK(td->td_proc); - return (EFBIG); - } - PROC_UNLOCK(td->td_proc); - } + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) + return (EFBIG); resid = uio->uio_resid; osize = ip->i_size; From owner-svn-src-head@FreeBSD.ORG Wed May 5 16:48:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1205) id 4186C1065672; Wed, 5 May 2010 16:48:22 +0000 (UTC) Date: Wed, 5 May 2010 16:48:22 +0000 From: Navdeep Parhar To: Rui Paulo Message-ID: <20100505164822.GA44629@hub.freebsd.org> Mail-Followup-To: Rui Paulo , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201005050041.o450fesw090589@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207643 - in head: sys/dev/cxgb usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 16:48:22 -0000 On Wed, May 05, 2010 at 11:02:49AM +0100, Rui Paulo wrote: > On 5 May 2010, at 01:41, Navdeep Parhar wrote: > > > Author: np > > Date: Wed May 5 00:41:40 2010 > > New Revision: 207643 > > URL: http://svn.freebsd.org/changeset/base/207643 > > > > Log: > > Add support for hardware filters to cxgb(4). The T3 chip can inspect > > L2/3/4 headers and can drop or steer packets as instructed. Filtering > > based on src ip, dst ip, src port, dst port, 802.1q, udp/tcp, and mac > > addr is possible. Add support in cxgbtool to program these filters. > > Some simple examples: > > ... > > MFC after: 2 weeks > > Wow, this is great! So this is able to do packet filtering at 10Gbps with no CPU impact? Yes, a packet that is dropped due to a filter match is dropped by the NIC's silicon. There is no CPU impact. Regards, Navdeep > > Regards, > -- > Rui Paulo > > From owner-svn-src-head@FreeBSD.ORG Wed May 5 18:16:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F92D106564A; Wed, 5 May 2010 18:16:07 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2E89B8FC19; Wed, 5 May 2010 18:16:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45IG7a1025764; Wed, 5 May 2010 18:16:07 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45IG6FX025752; Wed, 5 May 2010 18:16:06 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005051816.o45IG6FX025752@svn.freebsd.org> From: Alan Cox Date: Wed, 5 May 2010 18:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207669 - in head/sys: fs/nfsclient fs/nwfs fs/smbfs kern nfsclient ufs/ffs vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 18:16:07 -0000 Author: alc Date: Wed May 5 18:16:06 2010 New Revision: 207669 URL: http://svn.freebsd.org/changeset/base/207669 Log: Acquire the page lock around all remaining calls to vm_page_free() on managed pages that didn't already have that lock held. (Freeing an unmanaged page, such as the various pmaps use, doesn't require the page lock.) This allows a change in vm_page_remove()'s locking requirements. It now expects the page lock to be held instead of the page queues lock. Consequently, the page queues lock is no longer required at all by callers to vm_page_rename(). Discussed with: kib Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/kern/kern_exec.c head/sys/kern/subr_uio.c head/sys/nfsclient/nfs_bio.c head/sys/ufs/ffs/ffs_vnops.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/fs/nfsclient/nfs_clbio.c Wed May 5 18:16:06 2010 (r207669) @@ -131,12 +131,15 @@ ncl_getpages(struct vop_getpages_args *a */ VM_OBJECT_LOCK(object); if (pages[ap->a_reqpage]->valid != 0) { - vm_page_lock_queues(); for (i = 0; i < npages; ++i) { - if (i != ap->a_reqpage) + if (i != ap->a_reqpage) { + vm_page_lock(pages[i]); + vm_page_lock_queues(); vm_page_free(pages[i]); + vm_page_unlock_queues(); + vm_page_unlock(pages[i]); + } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return (0); } @@ -171,12 +174,15 @@ ncl_getpages(struct vop_getpages_args *a if (error && (uio.uio_resid == count)) { ncl_printf("nfs_getpages: error %d\n", error); VM_OBJECT_LOCK(object); - vm_page_lock_queues(); for (i = 0; i < npages; ++i) { - if (i != ap->a_reqpage) + if (i != ap->a_reqpage) { + vm_page_lock(pages[i]); + vm_page_lock_queues(); vm_page_free(pages[i]); + vm_page_unlock_queues(); + vm_page_unlock(pages[i]); + } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return (VM_PAGER_ERROR); } Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/fs/nwfs/nwfs_io.c Wed May 5 18:16:06 2010 (r207669) @@ -428,12 +428,15 @@ nwfs_getpages(ap) VM_OBJECT_LOCK(object); if (error && (uio.uio_resid == count)) { printf("nwfs_getpages: error %d\n",error); - vm_page_lock_queues(); for (i = 0; i < npages; i++) { - if (ap->a_reqpage != i) + if (ap->a_reqpage != i) { + vm_page_lock(pages[i]); + vm_page_lock_queues(); vm_page_free(pages[i]); + vm_page_unlock_queues(); + vm_page_unlock(pages[i]); + } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return VM_PAGER_ERROR; } Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/fs/smbfs/smbfs_io.c Wed May 5 18:16:06 2010 (r207669) @@ -440,12 +440,15 @@ smbfs_getpages(ap) VM_OBJECT_LOCK(object); if (m->valid != 0) { - vm_page_lock_queues(); for (i = 0; i < npages; ++i) { - if (i != reqpage) + if (i != reqpage) { + vm_page_lock(pages[i]); + vm_page_lock_queues(); vm_page_free(pages[i]); + vm_page_unlock_queues(); + vm_page_unlock(pages[i]); + } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return 0; } @@ -478,12 +481,15 @@ smbfs_getpages(ap) VM_OBJECT_LOCK(object); if (error && (uio.uio_resid == count)) { printf("smbfs_getpages: error %d\n",error); - vm_page_lock_queues(); for (i = 0; i < npages; i++) { - if (reqpage != i) + if (reqpage != i) { + vm_page_lock(pages[i]); + vm_page_lock_queues(); vm_page_free(pages[i]); + vm_page_unlock_queues(); + vm_page_unlock(pages[i]); + } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return VM_PAGER_ERROR; } Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/kern/kern_exec.c Wed May 5 18:16:06 2010 (r207669) @@ -949,9 +949,11 @@ exec_map_first_page(imgp) ma[0] = vm_page_lookup(object, 0); if ((rv != VM_PAGER_OK) || (ma[0] == NULL)) { if (ma[0]) { + vm_page_lock(ma[0]); vm_page_lock_queues(); vm_page_free(ma[0]); vm_page_unlock_queues(); + vm_page_unlock(ma[0]); } VM_OBJECT_UNLOCK(object); return (EIO); Modified: head/sys/kern/subr_uio.c ============================================================================== --- head/sys/kern/subr_uio.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/kern/subr_uio.c Wed May 5 18:16:06 2010 (r207669) @@ -104,9 +104,11 @@ retry: if ((user_pg = vm_page_lookup(uobject, upindex)) != NULL) { if (vm_page_sleep_if_busy(user_pg, TRUE, "vm_pgmoveco")) goto retry; + vm_page_lock(user_pg); vm_page_lock_queues(); pmap_remove_all(user_pg); vm_page_free(user_pg); + vm_page_unlock(user_pg); } else { /* * Even if a physical page does not exist in the Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/nfsclient/nfs_bio.c Wed May 5 18:16:06 2010 (r207669) @@ -129,12 +129,15 @@ nfs_getpages(struct vop_getpages_args *a */ VM_OBJECT_LOCK(object); if (pages[ap->a_reqpage]->valid != 0) { - vm_page_lock_queues(); for (i = 0; i < npages; ++i) { - if (i != ap->a_reqpage) + if (i != ap->a_reqpage) { + vm_page_lock(pages[i]); + vm_page_lock_queues(); vm_page_free(pages[i]); + vm_page_unlock_queues(); + vm_page_unlock(pages[i]); + } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return (0); } @@ -169,12 +172,15 @@ nfs_getpages(struct vop_getpages_args *a if (error && (uio.uio_resid == count)) { nfs_printf("nfs_getpages: error %d\n", error); VM_OBJECT_LOCK(object); - vm_page_lock_queues(); for (i = 0; i < npages; ++i) { - if (i != ap->a_reqpage) + if (i != ap->a_reqpage) { + vm_page_lock(pages[i]); + vm_page_lock_queues(); vm_page_free(pages[i]); + vm_page_unlock_queues(); + vm_page_unlock(pages[i]); + } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); return (VM_PAGER_ERROR); } Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/ufs/ffs/ffs_vnops.c Wed May 5 18:16:06 2010 (r207669) @@ -847,13 +847,15 @@ ffs_getpages(ap) if (mreq->valid) { if (mreq->valid != VM_PAGE_BITS_ALL) vm_page_zero_invalid(mreq, TRUE); - vm_page_lock_queues(); for (i = 0; i < pcount; i++) { if (i != ap->a_reqpage) { + vm_page_lock(ap->a_m[i]); + vm_page_lock_queues(); vm_page_free(ap->a_m[i]); + vm_page_unlock_queues(); + vm_page_unlock(ap->a_m[i]); } } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(mreq->object); return VM_PAGER_OK; } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/vm/vm_fault.c Wed May 5 18:16:06 2010 (r207669) @@ -778,9 +778,7 @@ vnode_locked: * automatically made dirty. */ vm_page_lock(fs.m); - vm_page_lock_queues(); vm_page_rename(fs.m, fs.first_object, fs.first_pindex); - vm_page_unlock_queues(); vm_page_unlock(fs.m); vm_page_busy(fs.m); fs.first_m = fs.m; Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/vm/vm_object.c Wed May 5 18:16:06 2010 (r207669) @@ -1461,9 +1461,7 @@ retry: goto retry; } vm_page_lock(m); - vm_page_lock_queues(); vm_page_rename(m, new_object, idx); - vm_page_unlock_queues(); vm_page_unlock(m); /* page automatically made dirty by rename and cache handled */ vm_page_busy(m); @@ -1691,9 +1689,7 @@ vm_object_backing_scan(vm_object_t objec * mapped through the rename. */ vm_page_lock(p); - vm_page_lock_queues(); vm_page_rename(p, object, new_pindex); - vm_page_unlock_queues(); vm_page_unlock(p); /* page automatically made dirty by rename */ } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed May 5 17:17:19 2010 (r207668) +++ head/sys/vm/vm_page.c Wed May 5 18:16:06 2010 (r207669) @@ -791,7 +791,7 @@ vm_page_remove(vm_page_t m) vm_page_t root; if ((m->flags & PG_UNMANAGED) == 0) - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); if ((object = m->object) == NULL) return; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); @@ -2234,11 +2234,11 @@ vm_page_cowfault(vm_page_t m) retry_alloc: pmap_remove_all(m); + vm_page_unlock_queues(); vm_page_remove(m); mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); if (mnew == NULL) { vm_page_insert(m, object, pindex); - vm_page_unlock_queues(); vm_page_unlock(m); VM_OBJECT_UNLOCK(object); VM_WAIT; @@ -2261,7 +2261,12 @@ vm_page_cowfault(vm_page_t m) * waiting to allocate a page. If so, put things back * the way they were */ + vm_page_unlock(m); + vm_page_lock(mnew); + vm_page_lock_queues(); vm_page_free(mnew); + vm_page_unlock_queues(); + vm_page_unlock(mnew); vm_page_insert(m, object, pindex); } else { /* clear COW & copy page */ if (!so_zerocp_fullpage) @@ -2270,9 +2275,8 @@ vm_page_cowfault(vm_page_t m) vm_page_dirty(mnew); mnew->wire_count = m->wire_count - m->cow; m->wire_count = m->cow; + vm_page_unlock(m); } - vm_page_unlock_queues(); - vm_page_unlock(m); } void Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed May 5 17:17:19 2010 (r207668) +++ head/sys/vm/vm_page.h Wed May 5 18:16:06 2010 (r207669) @@ -103,7 +103,7 @@ struct vm_page { struct vm_page *left; /* splay tree link (O) */ struct vm_page *right; /* splay tree link (O) */ - vm_object_t object; /* which object am I in (O,Q)*/ + vm_object_t object; /* which object am I in (O,P)*/ vm_pindex_t pindex; /* offset into object (O,Q) */ vm_paddr_t phys_addr; /* physical address of page */ struct md_page md; /* machine dependant stuff */ From owner-svn-src-head@FreeBSD.ORG Wed May 5 18:22:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5AC061065672; Wed, 5 May 2010 18:22:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 479548FC0C; Wed, 5 May 2010 18:22:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45IMUg2027227; Wed, 5 May 2010 18:22:30 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45IMUrh027219; Wed, 5 May 2010 18:22:30 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005051822.o45IMUrh027219@svn.freebsd.org> From: Martin Matuska Date: Wed, 5 May 2010 18:22:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207670 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cd... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 18:22:30 -0000 Author: mm Date: Wed May 5 18:22:29 2010 New Revision: 207670 URL: http://svn.freebsd.org/changeset/base/207670 Log: Introduce hardforce export option (-F) for "zpool export". When exporting with this flag, zpool.cache remains untouched. OpenSolaris onnv revision: 8211:32722be6ad3b Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID: 6775357) Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed May 5 18:16:06 2010 (r207669) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed May 5 18:22:29 2010 (r207670) @@ -879,17 +879,21 @@ int zpool_do_export(int argc, char **argv) { boolean_t force = B_FALSE; + boolean_t hardforce = B_FALSE; int c; zpool_handle_t *zhp; int ret; int i; /* check options */ - while ((c = getopt(argc, argv, "f")) != -1) { + while ((c = getopt(argc, argv, "fF")) != -1) { switch (c) { case 'f': force = B_TRUE; break; + case 'F': + hardforce = B_TRUE; + break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -919,8 +923,12 @@ zpool_do_export(int argc, char **argv) continue; } - if (zpool_export(zhp, force) != 0) + if (hardforce) { + if (zpool_export_force(zhp) != 0) + ret = 1; + } else if (zpool_export(zhp, force) != 0) { ret = 1; + } zpool_close(zhp); } Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed May 5 18:16:06 2010 (r207669) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed May 5 18:22:29 2010 (r207670) @@ -3039,7 +3039,7 @@ ztest_spa_import_export(char *oldname, c /* * Export it. */ - error = spa_export(oldname, &config, B_FALSE); + error = spa_export(oldname, &config, B_FALSE, B_FALSE); if (error) fatal(0, "spa_export('%s') = %d", oldname, error); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed May 5 18:16:06 2010 (r207669) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed May 5 18:22:29 2010 (r207670) @@ -289,6 +289,7 @@ extern int zpool_get_errlog(zpool_handle * Import and export functions */ extern int zpool_export(zpool_handle_t *, boolean_t); +extern int zpool_export_force(zpool_handle_t *); extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *, char *altroot); extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *, Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed May 5 18:16:06 2010 (r207669) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Wed May 5 18:22:29 2010 (r207670) @@ -1096,7 +1096,7 @@ zpool_add(zpool_handle_t *zhp, nvlist_t * mounted datasets in the pool. */ int -zpool_export(zpool_handle_t *zhp, boolean_t force) +zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce) { zfs_cmd_t zc = { 0 }; char msg[1024]; @@ -1109,6 +1109,7 @@ zpool_export(zpool_handle_t *zhp, boolea (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); zc.zc_cookie = force; + zc.zc_guid = hardforce; if (zfs_ioctl(zhp->zpool_hdl, ZFS_IOC_POOL_EXPORT, &zc) != 0) { switch (errno) { @@ -1129,6 +1130,18 @@ zpool_export(zpool_handle_t *zhp, boolea return (0); } +int +zpool_export(zpool_handle_t *zhp, boolean_t force) +{ + return (zpool_export_common(zhp, force, B_FALSE)); +} + +int +zpool_export_force(zpool_handle_t *zhp) +{ + return (zpool_export_common(zhp, B_TRUE, B_TRUE)); +} + /* * zpool_import() is a contracted interface. Should be kept the same * if possible. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed May 5 18:16:06 2010 (r207669) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed May 5 18:22:29 2010 (r207670) @@ -2564,11 +2564,12 @@ spa_tryimport(nvlist_t *tryconfig) * The act of destroying or exporting a pool is very simple. We make sure there * is no more pending I/O and any references to the pool are gone. Then, we * update the pool state and sync all the labels to disk, removing the - * configuration from the cache afterwards. + * configuration from the cache afterwards. If the 'hardforce' flag is set, then + * we don't sync the labels or remove the configuration cache. */ static int spa_export_common(char *pool, int new_state, nvlist_t **oldconfig, - boolean_t force) + boolean_t force, boolean_t hardforce) { spa_t *spa; @@ -2636,7 +2637,7 @@ spa_export_common(char *pool, int new_st * so mark them all dirty. spa_unload() will do the * final sync that pushes these changes out. */ - if (new_state != POOL_STATE_UNINITIALIZED) { + if (new_state != POOL_STATE_UNINITIALIZED && !hardforce) { spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); spa->spa_state = new_state; spa->spa_final_txg = spa_last_synced_txg(spa) + 1; @@ -2656,7 +2657,8 @@ spa_export_common(char *pool, int new_st VERIFY(nvlist_dup(spa->spa_config, oldconfig, 0) == 0); if (new_state != POOL_STATE_UNINITIALIZED) { - spa_config_sync(spa, B_TRUE, B_TRUE); + if (!hardforce) + spa_config_sync(spa, B_TRUE, B_TRUE); spa_remove(spa); } mutex_exit(&spa_namespace_lock); @@ -2670,16 +2672,19 @@ spa_export_common(char *pool, int new_st int spa_destroy(char *pool) { - return (spa_export_common(pool, POOL_STATE_DESTROYED, NULL, B_FALSE)); + return (spa_export_common(pool, POOL_STATE_DESTROYED, NULL, + B_FALSE, B_FALSE)); } /* * Export a storage pool. */ int -spa_export(char *pool, nvlist_t **oldconfig, boolean_t force) +spa_export(char *pool, nvlist_t **oldconfig, boolean_t force, + boolean_t hardforce) { - return (spa_export_common(pool, POOL_STATE_EXPORTED, oldconfig, force)); + return (spa_export_common(pool, POOL_STATE_EXPORTED, oldconfig, + force, hardforce)); } /* @@ -2690,7 +2695,7 @@ int spa_reset(char *pool) { return (spa_export_common(pool, POOL_STATE_UNINITIALIZED, NULL, - B_FALSE)); + B_FALSE, B_FALSE)); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed May 5 18:16:06 2010 (r207669) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed May 5 18:22:29 2010 (r207670) @@ -333,7 +333,8 @@ extern int spa_import(const char *pool, extern int spa_import_faulted(const char *, nvlist_t *, nvlist_t *); extern nvlist_t *spa_tryimport(nvlist_t *tryconfig); extern int spa_destroy(char *pool); -extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force); +extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force, + boolean_t hardforce); extern int spa_reset(char *pool); extern void spa_async_request(spa_t *spa, int flag); extern void spa_async_unrequest(spa_t *spa, int flag); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed May 5 18:16:06 2010 (r207669) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed May 5 18:22:29 2010 (r207670) @@ -882,9 +882,10 @@ zfs_ioc_pool_export(zfs_cmd_t *zc) { int error; boolean_t force = (boolean_t)zc->zc_cookie; + boolean_t hardforce = (boolean_t)zc->zc_guid; zfs_log_history(zc); - error = spa_export(zc->zc_name, NULL, force); + error = spa_export(zc->zc_name, NULL, force, hardforce); return (error); } From owner-svn-src-head@FreeBSD.ORG Wed May 5 18:53:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1929F1065675; Wed, 5 May 2010 18:53:25 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 096408FC08; Wed, 5 May 2010 18:53:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45IrO0L034085; Wed, 5 May 2010 18:53:24 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45IrOS6034082; Wed, 5 May 2010 18:53:24 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201005051853.o45IrOS6034082@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 5 May 2010 18:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207671 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 18:53:25 -0000 Author: jh Date: Wed May 5 18:53:24 2010 New Revision: 207671 URL: http://svn.freebsd.org/changeset/base/207671 Log: Fix deadlock between GEOM class unloading and withering. Withering can't proceed while g_unload_class() blocks the event thread. Fix this by not running g_unload_class() as a GEOM event and dropping the topology lock when withering needs to proceed. PR: kern/139847 Silence on: freebsd-geom Modified: head/sys/geom/geom.h head/sys/geom/geom_subr.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Wed May 5 18:22:29 2010 (r207670) +++ head/sys/geom/geom.h Wed May 5 18:53:24 2010 (r207671) @@ -353,6 +353,9 @@ g_free(void *ptr) sx_assert(&topology_lock, SX_UNLOCKED); \ } while (0) +#define g_topology_sleep(chan, timo) \ + sx_sleep(chan, &topology_lock, 0, "gtopol", timo) + #define DECLARE_GEOM_CLASS(class, name) \ static moduledata_t name##_mod = { \ #name, g_modevent, &class \ Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Wed May 5 18:22:29 2010 (r207670) +++ head/sys/geom/geom_subr.c Wed May 5 18:53:24 2010 (r207671) @@ -134,65 +134,73 @@ g_load_class(void *arg, int flag) } } -static void -g_unload_class(void *arg, int flag) +static int +g_unload_class(struct g_class *mp) { - struct g_hh00 *hh; - struct g_class *mp; struct g_geom *gp; struct g_provider *pp; struct g_consumer *cp; int error; - g_topology_assert(); - hh = arg; - mp = hh->mp; - G_VALID_CLASS(mp); + g_topology_lock(); g_trace(G_T_TOPOLOGY, "g_unload_class(%s)", mp->name); - - /* - * We allow unloading if we have no geoms, or a class - * method we can use to get rid of them. - */ - if (!LIST_EMPTY(&mp->geom) && mp->destroy_geom == NULL) { - hh->error = EOPNOTSUPP; - return; - } - - /* We refuse to unload if anything is open */ +retry: + G_VALID_CLASS(mp); LIST_FOREACH(gp, &mp->geom, geom) { + /* We refuse to unload if anything is open */ LIST_FOREACH(pp, &gp->provider, provider) if (pp->acr || pp->acw || pp->ace) { - hh->error = EBUSY; - return; + g_topology_unlock(); + return (EBUSY); } LIST_FOREACH(cp, &gp->consumer, consumer) if (cp->acr || cp->acw || cp->ace) { - hh->error = EBUSY; - return; + g_topology_unlock(); + return (EBUSY); } + /* If the geom is withering, wait for it to finish. */ + if (gp->flags & G_GEOM_WITHER) { + g_topology_sleep(mp, 1); + goto retry; + } + } + + /* + * We allow unloading if we have no geoms, or a class + * method we can use to get rid of them. + */ + if (!LIST_EMPTY(&mp->geom) && mp->destroy_geom == NULL) { + g_topology_unlock(); + return (EOPNOTSUPP); } /* Bar new entries */ mp->taste = NULL; mp->config = NULL; - error = 0; + LIST_FOREACH(gp, &mp->geom, geom) { + error = mp->destroy_geom(NULL, mp, gp); + if (error != 0) { + g_topology_unlock(); + return (error); + } + } + /* Wait for withering to finish. */ for (;;) { gp = LIST_FIRST(&mp->geom); if (gp == NULL) break; - error = mp->destroy_geom(NULL, mp, gp); - if (error != 0) - break; + KASSERT(gp->flags & G_GEOM_WITHER, + ("Non-withering geom in class %s", mp->name)); + g_topology_sleep(mp, 1); } - if (error == 0) { - if (mp->fini != NULL) - mp->fini(mp); - LIST_REMOVE(mp, class); - } - hh->error = error; - return; + G_VALID_CLASS(mp); + if (mp->fini != NULL) + mp->fini(mp); + LIST_REMOVE(mp, class); + g_topology_unlock(); + + return (0); } int @@ -213,12 +221,12 @@ g_modevent(module_t mod, int type, void g_ignition++; g_init(); } - hh = g_malloc(sizeof *hh, M_WAITOK | M_ZERO); - hh->mp = data; error = EOPNOTSUPP; switch (type) { case MOD_LOAD: - g_trace(G_T_TOPOLOGY, "g_modevent(%s, LOAD)", hh->mp->name); + g_trace(G_T_TOPOLOGY, "g_modevent(%s, LOAD)", mp->name); + hh = g_malloc(sizeof *hh, M_WAITOK | M_ZERO); + hh->mp = mp; /* * Once the system is not cold, MOD_LOAD calls will be * from the userland and the g_event thread will be able @@ -236,18 +244,14 @@ g_modevent(module_t mod, int type, void } break; case MOD_UNLOAD: - g_trace(G_T_TOPOLOGY, "g_modevent(%s, UNLOAD)", hh->mp->name); - error = g_waitfor_event(g_unload_class, hh, M_WAITOK, NULL); - if (error == 0) - error = hh->error; + g_trace(G_T_TOPOLOGY, "g_modevent(%s, UNLOAD)", mp->name); + DROP_GIANT(); + error = g_unload_class(mp); + PICKUP_GIANT(); if (error == 0) { - KASSERT(LIST_EMPTY(&hh->mp->geom), - ("Unloaded class (%s) still has geom", hh->mp->name)); + KASSERT(LIST_EMPTY(&mp->geom), + ("Unloaded class (%s) still has geom", mp->name)); } - g_free(hh); - break; - default: - g_free(hh); break; } return (error); From owner-svn-src-head@FreeBSD.ORG Wed May 5 18:57:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6EE01065677; Wed, 5 May 2010 18:57:55 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B510B8FC1B; Wed, 5 May 2010 18:57:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45Ivt4W035132; Wed, 5 May 2010 18:57:55 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45Ivt1O035124; Wed, 5 May 2010 18:57:55 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201005051857.o45Ivt1O035124@svn.freebsd.org> From: Martin Matuska Date: Wed, 5 May 2010 18:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207672 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cd... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 18:57:55 -0000 Author: mm Date: Wed May 5 18:57:55 2010 New Revision: 207672 URL: http://svn.freebsd.org/changeset/base/207672 Log: Forced commit to set MFC period for r207670. Approved by: delphij (mentor) MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== From owner-svn-src-head@FreeBSD.ORG Wed May 5 20:39:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 895FE1065670; Wed, 5 May 2010 20:39:02 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 766468FC0C; Wed, 5 May 2010 20:39:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45Kd25t057718; Wed, 5 May 2010 20:39:02 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45Kd21m057708; Wed, 5 May 2010 20:39:02 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201005052039.o45Kd21m057708@svn.freebsd.org> From: Joel Dahl Date: Wed, 5 May 2010 20:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207673 - in head/sys: amd64/include/xen dev/cxgb/sys dev/xen/netfront i386/include/xen kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 20:39:02 -0000 Author: joel (doc committer) Date: Wed May 5 20:39:02 2010 New Revision: 207673 URL: http://svn.freebsd.org/changeset/base/207673 Log: Switch to our preferred 2-clause BSD license. Approved by: kmacy Modified: head/sys/amd64/include/xen/xenfunc.h head/sys/amd64/include/xen/xenvar.h head/sys/dev/cxgb/sys/mvec.h head/sys/dev/cxgb/sys/uipc_mvec.c head/sys/dev/xen/netfront/netfront.c head/sys/i386/include/xen/xenfunc.h head/sys/i386/include/xen/xenvar.h head/sys/kern/subr_bufring.c head/sys/sys/buf_ring.h Modified: head/sys/amd64/include/xen/xenfunc.h ============================================================================== --- head/sys/amd64/include/xen/xenfunc.h Wed May 5 18:57:55 2010 (r207672) +++ head/sys/amd64/include/xen/xenfunc.h Wed May 5 20:39:02 2010 (r207673) @@ -1,6 +1,5 @@ -/* - * - * Copyright (c) 2004,2005 Kip Macy +/*- + * Copyright (c) 2004, 2005 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,22 +10,22 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ */ - #ifndef _XEN_XENFUNC_H_ #define _XEN_XENFUNC_H_ Modified: head/sys/amd64/include/xen/xenvar.h ============================================================================== --- head/sys/amd64/include/xen/xenvar.h Wed May 5 18:57:55 2010 (r207672) +++ head/sys/amd64/include/xen/xenvar.h Wed May 5 20:39:02 2010 (r207673) @@ -1,29 +1,27 @@ -/* +/*- * Copyright (c) 2008 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ Modified: head/sys/dev/cxgb/sys/mvec.h ============================================================================== --- head/sys/dev/cxgb/sys/mvec.h Wed May 5 18:57:55 2010 (r207672) +++ head/sys/dev/cxgb/sys/mvec.h Wed May 5 20:39:02 2010 (r207673) @@ -1,33 +1,31 @@ -/************************************************************************** - * - * Copyright (c) 2007,2009 Kip Macy kmacy@freebsd.org +/*- + * Copyright (c) 2007, 2009 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. The name of Kip Macy nor the names of other - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ * - ***************************************************************************/ + */ #ifndef _MVEC_H_ #define _MVEC_H_ Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Wed May 5 18:57:55 2010 (r207672) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Wed May 5 20:39:02 2010 (r207673) @@ -1,32 +1,28 @@ -/************************************************************************** - * - * Copyright (c) 2007-2008, Kip Macy kmacy@freebsd.org +/*- + * Copyright (c) 2007-2008 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. The name of Kip Macy nor the names of other - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * - ***************************************************************************/ + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ #include __FBSDID("$FreeBSD$"); Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Wed May 5 18:57:55 2010 (r207672) +++ head/sys/dev/xen/netfront/netfront.c Wed May 5 20:39:02 2010 (r207673) @@ -1,19 +1,27 @@ -/* - * +/*- * Copyright (c) 2004-2006 Kip Macy * All rights reserved. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ Modified: head/sys/i386/include/xen/xenfunc.h ============================================================================== --- head/sys/i386/include/xen/xenfunc.h Wed May 5 18:57:55 2010 (r207672) +++ head/sys/i386/include/xen/xenfunc.h Wed May 5 20:39:02 2010 (r207673) @@ -1,6 +1,5 @@ -/* - * - * Copyright (c) 2004,2005 Kip Macy +/*- + * Copyright (c) 2004, 2005 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,24 +10,22 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ - #ifndef _XEN_XENFUNC_H_ #define _XEN_XENFUNC_H_ Modified: head/sys/i386/include/xen/xenvar.h ============================================================================== --- head/sys/i386/include/xen/xenvar.h Wed May 5 18:57:55 2010 (r207672) +++ head/sys/i386/include/xen/xenvar.h Wed May 5 20:39:02 2010 (r207673) @@ -1,32 +1,31 @@ -/* +/*- * Copyright (c) 2008 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ + #ifndef XENVAR_H_ #define XENVAR_H_ #define XBOOTUP 0x1 Modified: head/sys/kern/subr_bufring.c ============================================================================== --- head/sys/kern/subr_bufring.c Wed May 5 18:57:55 2010 (r207672) +++ head/sys/kern/subr_bufring.c Wed May 5 20:39:02 2010 (r207673) @@ -1,32 +1,29 @@ -/************************************************************************** - * - * Copyright (c) 2007,2008 Kip Macy kmacy@freebsd.org +/*- + * Copyright (c) 2007, 2008 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. The name of Kip Macy nor the names of other - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * - ***************************************************************************/ + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #include __FBSDID("$FreeBSD$"); Modified: head/sys/sys/buf_ring.h ============================================================================== --- head/sys/sys/buf_ring.h Wed May 5 18:57:55 2010 (r207672) +++ head/sys/sys/buf_ring.h Wed May 5 20:39:02 2010 (r207673) @@ -1,33 +1,31 @@ -/************************************************************************** - * - * Copyright (c) 2007-2009 Kip Macy kmacy@freebsd.org +/*- + * Copyright (c) 2007-2009 Kip Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * 2. The name of Kip Macy nor the names of other - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ * - ***************************************************************************/ + */ #ifndef _SYS_BUF_RING_H_ #define _SYS_BUF_RING_H_ From owner-svn-src-head@FreeBSD.ORG Wed May 5 20:50:46 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 374DB1065673; Wed, 5 May 2010 20:50:46 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id B5E398FC13; Wed, 5 May 2010 20:50:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o45KieAl017226; Wed, 5 May 2010 14:44:40 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 05 May 2010 14:45:01 -0600 (MDT) Message-Id: <20100505.144501.1034091071783952146.imp@bsdimp.com> To: nork@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20100505193049.cd94c63e.nork@FreeBSD.org> References: <201005050041.o450fesw090589@svn.freebsd.org> <20100505193049.cd94c63e.nork@FreeBSD.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, np@FreeBSD.org Subject: Re: svn commit: r207643 - in head: sys/dev/cxgb usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 20:50:46 -0000 In message: <20100505193049.cd94c63e.nork@FreeBSD.org> Norikatsu Shigemura writes: : Hi np! : : On Wed, 5 May 2010 00:41:40 +0000 (UTC) : Navdeep Parhar wrote: : > Add support for hardware filters to cxgb(4). The T3 chip can inspect : > L2/3/4 headers and can drop or steer packets as instructed. Filtering : > based on src ip, dst ip, src port, dst port, 802.1q, udp/tcp, and mac : > addr is possible. Add support in cxgbtool to program these filters. : : Great news. Do you have any schedule to implement ipfw(4) : hardware acceleration? :-) There's some embedded kit that has switches that can do limited filtering as well, and there it would be a big win.... Warner From owner-svn-src-head@FreeBSD.ORG Wed May 5 21:07:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 258341065672; Wed, 5 May 2010 21:07:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0B2D68FC1C; Wed, 5 May 2010 21:07:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45L7l0W064260; Wed, 5 May 2010 21:07:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45L7lMA064255; Wed, 5 May 2010 21:07:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005052107.o45L7lMA064255@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 5 May 2010 21:07:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207676 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 21:07:48 -0000 Author: kib Date: Wed May 5 21:07:47 2010 New Revision: 207676 URL: http://svn.freebsd.org/changeset/base/207676 Log: Add definitions for Intel AESNI CPUID bits and print the capabilities on boot. Hardware provided by: Sentex Communications MFC after: 1 week Modified: head/sys/amd64/amd64/identcpu.c head/sys/amd64/include/specialreg.h head/sys/i386/i386/identcpu.c head/sys/i386/include/specialreg.h Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Wed May 5 20:54:16 2010 (r207675) +++ head/sys/amd64/amd64/identcpu.c Wed May 5 21:07:47 2010 (r207676) @@ -240,7 +240,7 @@ printcpuinfo(void) printf("\n Features2=0x%b", cpu_feature2, "\020" "\001SSE3" /* SSE3 */ - "\002" + "\002PCLMULQDQ" /* Carry-Less Mul Quadword */ "\003DTES64" /* 64-bit Debug Trace */ "\004MON" /* MONITOR/MWAIT Instructions */ "\005DS_CPL" /* CPL Qualified Debug Store */ @@ -264,7 +264,7 @@ printcpuinfo(void) "\027MOVBE" "\030POPCNT" "\031" - "\032" + "\032AESNI" /* AES Crypto*/ "\033XSAVE" "\034OSXSAVE" "\035" Modified: head/sys/amd64/include/specialreg.h ============================================================================== --- head/sys/amd64/include/specialreg.h Wed May 5 20:54:16 2010 (r207675) +++ head/sys/amd64/include/specialreg.h Wed May 5 21:07:47 2010 (r207676) @@ -113,6 +113,7 @@ #define CPUID_PBE 0x80000000 #define CPUID2_SSE3 0x00000001 +#define CPUID2_PCLMULQDQ 0x00000002 #define CPUID2_DTES64 0x00000004 #define CPUID2_MON 0x00000008 #define CPUID2_DS_CPL 0x00000010 @@ -131,6 +132,7 @@ #define CPUID2_X2APIC 0x00200000 #define CPUID2_MOVBE 0x00400000 #define CPUID2_POPCNT 0x00800000 +#define CPUID2_AESNI 0x02000000 /* * Important bits in the AMD extended cpuid flags Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Wed May 5 20:54:16 2010 (r207675) +++ head/sys/i386/i386/identcpu.c Wed May 5 21:07:47 2010 (r207676) @@ -727,7 +727,7 @@ printcpuinfo(void) printf("\n Features2=0x%b", cpu_feature2, "\020" "\001SSE3" /* SSE3 */ - "\002" + "\002PCLMULQDQ" /* Carry-Less Mul Quadword */ "\003DTES64" /* 64-bit Debug Trace */ "\004MON" /* MONITOR/MWAIT Instructions */ "\005DS_CPL" /* CPL Qualified Debug Store */ @@ -751,7 +751,7 @@ printcpuinfo(void) "\027MOVBE" "\030POPCNT" "\031" - "\032" + "\032AESNI" /* AES Crypto*/ "\033XSAVE" "\034OSXSAVE" "\035" Modified: head/sys/i386/include/specialreg.h ============================================================================== --- head/sys/i386/include/specialreg.h Wed May 5 20:54:16 2010 (r207675) +++ head/sys/i386/include/specialreg.h Wed May 5 21:07:47 2010 (r207676) @@ -110,6 +110,7 @@ #define CPUID_PBE 0x80000000 #define CPUID2_SSE3 0x00000001 +#define CPUID2_PCLMULQDQ 0x00000002 #define CPUID2_DTES64 0x00000004 #define CPUID2_MON 0x00000008 #define CPUID2_DS_CPL 0x00000010 @@ -128,6 +129,7 @@ #define CPUID2_X2APIC 0x00200000 #define CPUID2_MOVBE 0x00400000 #define CPUID2_POPCNT 0x00800000 +#define CPUID2_AESNI 0x02000000 /* * Important bits in the AMD extended cpuid flags From owner-svn-src-head@FreeBSD.ORG Wed May 5 21:24:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02F841065673; Wed, 5 May 2010 21:24:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E5E968FC1C; Wed, 5 May 2010 21:24:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45LOJvF067981; Wed, 5 May 2010 21:24:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45LOJES067973; Wed, 5 May 2010 21:24:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201005052124.o45LOJES067973@svn.freebsd.org> From: Xin LI Date: Wed, 5 May 2010 21:24:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207677 - head/usr.bin/find X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 21:24:20 -0000 Author: delphij Date: Wed May 5 21:24:18 2010 New Revision: 207677 URL: http://svn.freebsd.org/changeset/base/207677 Log: Move SCCS tags to comments as they were already #if 0'ed. Modified: head/usr.bin/find/find.c head/usr.bin/find/function.c head/usr.bin/find/ls.c head/usr.bin/find/main.c head/usr.bin/find/misc.c head/usr.bin/find/operator.c head/usr.bin/find/option.c Modified: head/usr.bin/find/find.c ============================================================================== --- head/usr.bin/find/find.c Wed May 5 21:07:47 2010 (r207676) +++ head/usr.bin/find/find.c Wed May 5 21:24:18 2010 (r207677) @@ -32,15 +32,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)find.c 8.5 (Berkeley) 8/5/94 */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)find.c 8.5 (Berkeley) 8/5/94"; -#else -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Wed May 5 21:07:47 2010 (r207676) +++ head/usr.bin/find/function.c Wed May 5 21:24:18 2010 (r207677) @@ -32,14 +32,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)function.c 8.10 (Berkeley) 5/4/95 */ -#ifndef lint -#if 0 -static const char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/ls.c ============================================================================== --- head/usr.bin/find/ls.c Wed May 5 21:07:47 2010 (r207676) +++ head/usr.bin/find/ls.c Wed May 5 21:24:18 2010 (r207677) @@ -29,14 +29,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)ls.c 8.1 (Berkeley) 6/6/93 */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)ls.c 8.1 (Berkeley) 6/6/93"; -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/main.c ============================================================================== --- head/usr.bin/find/main.c Wed May 5 21:07:47 2010 (r207676) +++ head/usr.bin/find/main.c Wed May 5 21:24:18 2010 (r207677) @@ -32,6 +32,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)main.c 8.4 (Berkeley) 5/4/95 */ #ifndef lint @@ -40,12 +42,6 @@ char copyright[] = The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/misc.c ============================================================================== --- head/usr.bin/find/misc.c Wed May 5 21:07:47 2010 (r207676) +++ head/usr.bin/find/misc.c Wed May 5 21:24:18 2010 (r207677) @@ -32,15 +32,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)misc.c 8.2 (Berkeley) 4/1/94 */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/1/94"; -#else -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/operator.c ============================================================================== --- head/usr.bin/find/operator.c Wed May 5 21:07:47 2010 (r207676) +++ head/usr.bin/find/operator.c Wed May 5 21:24:18 2010 (r207677) @@ -32,14 +32,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)operator.c 8.1 (Berkeley) 6/6/93 */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)operator.c 8.1 (Berkeley) 6/6/93"; -#endif -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/option.c ============================================================================== --- head/usr.bin/find/option.c Wed May 5 21:07:47 2010 (r207676) +++ head/usr.bin/find/option.c Wed May 5 21:24:18 2010 (r207677) @@ -32,14 +32,10 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)option.c 8.2 (Berkeley) 4/16/94 */ -#ifndef lint -/* -static char sccsid[] = "@(#)option.c 8.2 (Berkeley) 4/16/94"; -*/ -#endif /* not lint */ - #include __FBSDID("$FreeBSD$"); From owner-svn-src-head@FreeBSD.ORG Wed May 5 21:48:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA9461065670; Wed, 5 May 2010 21:48:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id A895F8FC16; Wed, 5 May 2010 21:48:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45Lmelb073394; Wed, 5 May 2010 21:48:40 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45LmevA073389; Wed, 5 May 2010 21:48:40 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005052148.o45LmevA073389@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 5 May 2010 21:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207678 - in head: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 21:48:40 -0000 Author: jilles Date: Wed May 5 21:48:40 2010 New Revision: 207678 URL: http://svn.freebsd.org/changeset/base/207678 Log: sh: Apply locale vars on builtins, recognize LC_MESSAGES as a locale var. This allows doing things like LC_ALL=C some_builtin to run a builtin under a different locale, just like is possible with external programs. The immediate reason is that this allows making printf(1) a builtin without breaking things like LC_NUMERIC=C printf '%f\n' 1.2 This change also affects special builtins, as even though the assignment is persistent, the export is only to the builtin (unless the variable was already exported). Note: for this to work for builtins that also exist as external programs such as /bin/test, the setlocale() call must be under #ifndef SHELL. The shell will do the setlocale() calls which may not agree with the environment variables. Added: head/tools/regression/bin/sh/builtins/locale1.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/var.c head/bin/sh/var.h Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Wed May 5 21:24:18 2010 (r207677) +++ head/bin/sh/eval.c Wed May 5 21:48:40 2010 (r207678) @@ -937,6 +937,8 @@ evalcommand(union node *cmd, int flags, cmdentry.special = 1; if (cmdentry.special) listsetvar(cmdenviron); + if (argc > 0) + bltinsetlocale(); commandname = argv[0]; argptr = argv + 1; nextopt_optptr = NULL; /* initialize nextopt */ @@ -944,6 +946,8 @@ evalcommand(union node *cmd, int flags, exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv); flushall(); cmddone: + if (argc > 0) + bltinunsetlocale(); cmdenviron = NULL; out1 = &output; out2 = &errout; Modified: head/bin/sh/var.c ============================================================================== --- head/bin/sh/var.c Wed May 5 21:24:18 2010 (r207677) +++ head/bin/sh/var.c Wed May 5 21:48:40 2010 (r207678) @@ -122,6 +122,14 @@ STATIC const struct varinit varinit[] = STATIC struct var *vartab[VTABSIZE]; +STATIC const char *const locale_names[7] = { + "LC_COLLATE", "LC_CTYPE", "LC_MONETARY", + "LC_NUMERIC", "LC_TIME", "LC_MESSAGES", NULL +}; +STATIC const int locale_categories[7] = { + LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, LC_MESSAGES, 0 +}; + STATIC struct var **hashvar(const char *); STATIC int varequal(const char *, const char *); STATIC int localevar(const char *); @@ -258,11 +266,7 @@ setvar(const char *name, const char *val STATIC int localevar(const char *s) { - static const char *lnames[7] = { - "ALL", "COLLATE", "CTYPE", "MONETARY", - "NUMERIC", "TIME", NULL - }; - const char **ss; + const char *const *ss; if (*s != 'L') return 0; @@ -270,8 +274,10 @@ localevar(const char *s) return 1; if (strncmp(s + 1, "C_", 2) != 0) return 0; - for (ss = lnames; *ss ; ss++) - if (varequal(s + 3, *ss)) + if (varequal(s + 3, "ALL")) + return 1; + for (ss = locale_names; *ss ; ss++) + if (varequal(s + 3, *ss + 3)) return 1; return 0; } @@ -437,6 +443,61 @@ bltinlookup(const char *name, int doall) } +/* + * Set up locale for a builtin (LANG/LC_* assignments). + */ +void +bltinsetlocale(void) +{ + struct strlist *lp; + int act = 0; + char *loc, *locdef; + int i; + + for (lp = cmdenviron ; lp ; lp = lp->next) { + if (localevar(lp->text)) { + act = 1; + break; + } + } + if (!act) + return; + loc = bltinlookup("LC_ALL", 0); + INTOFF; + if (loc != NULL) { + setlocale(LC_ALL, loc); + INTON; + return; + } + locdef = bltinlookup("LANG", 0); + for (i = 0; locale_names[i] != NULL; i++) { + loc = bltinlookup(locale_names[i], 0); + if (loc == NULL) + loc = locdef; + if (loc != NULL) + setlocale(locale_categories[i], loc); + } + INTON; +} + +/* + * Undo the effect of bltinlocaleset(). + */ +void +bltinunsetlocale(void) +{ + struct strlist *lp; + + INTOFF; + for (lp = cmdenviron ; lp ; lp = lp->next) { + if (localevar(lp->text)) { + setlocale(LC_ALL, ""); + return; + } + } + INTON; +} + /* * Generate a list of exported variables. This routine is used to construct Modified: head/bin/sh/var.h ============================================================================== --- head/bin/sh/var.h Wed May 5 21:24:18 2010 (r207677) +++ head/bin/sh/var.h Wed May 5 21:48:40 2010 (r207678) @@ -107,6 +107,8 @@ struct strlist; void listsetvar(struct strlist *); char *lookupvar(const char *); char *bltinlookup(const char *, int); +void bltinsetlocale(void); +void bltinunsetlocale(void); char **environment(void); int showvarscmd(int, char **); int exportcmd(int, char **); Added: head/tools/regression/bin/sh/builtins/locale1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/locale1.0 Wed May 5 21:48:40 2010 (r207678) @@ -0,0 +1,133 @@ +# $FreeBSD$ +# Note: this test depends on strerror() using locale. + +failures=0 + +check() { + if ! eval "[ $1 ]"; then + echo "Failed: $1 at $2" + : $((failures += 1)) + fi +} + +unset LANG LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME LC_MESSAGES + +msgeng="No such file or directory" +msgdut="Bestand of map niet gevonden" + +# Verify C locale error message. +case $(command . /var/empty/foo 2>&1) in + *"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +# Various locale variables that should not affect the message. +case $(LC_ALL=C command . /var/empty/foo 2>&1) in + *"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LC_ALL=C LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in + *"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LC_ALL=C LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in + *"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LC_CTYPE=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in + *"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +# Verify Dutch message. +case $(export LANG=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(export LC_MESSAGES=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(export LC_ALL=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +# Verify that command assignments do not set the locale persistently. +case $(command . /var/empty/foo 2>&1) in + *"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in + *"$msgdut"*"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in + *"$msgdut"*"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in + *"$msgdut"*"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +# Check special builtin; add colon invocation to avoid depending on certain fix. +case $(LC_ALL=nl_NL.ISO8859-1 . /var/empty/foo 2>&1; :) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +# Assignments on special builtins are exported to that builtin; the export +# is not persistent. +case $(LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in + *"$msgeng"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +case $(export LC_ALL; LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in + *"$msgdut"*) ok=1 ;; + *) ok=0 ;; +esac +check '$ok -eq 1' $LINENO + +exit $((failures > 0)) From owner-svn-src-head@FreeBSD.ORG Wed May 5 22:06:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 533FC1065704; Wed, 5 May 2010 22:06:06 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 421648FC24; Wed, 5 May 2010 22:06:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45M6665077353; Wed, 5 May 2010 22:06:06 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45M66Zc077346; Wed, 5 May 2010 22:06:06 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201005052206.o45M66Zc077346@svn.freebsd.org> From: Marko Zec Date: Wed, 5 May 2010 22:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207680 - in head: share/man/man4 sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 22:06:06 -0000 Author: zec Date: Wed May 5 22:06:05 2010 New Revision: 207680 URL: http://svn.freebsd.org/changeset/base/207680 Log: Add an optional "persistent" flag to ng_hub and ng_bridge, which if set, disables automatic node shutdown when the last hook gets disconnected. Reviewed by: julian Modified: head/share/man/man4/ng_bridge.4 head/share/man/man4/ng_hub.4 head/sys/netgraph/ng_bridge.c head/sys/netgraph/ng_bridge.h head/sys/netgraph/ng_hub.c head/sys/netgraph/ng_hub.h Modified: head/share/man/man4/ng_bridge.4 ============================================================================== --- head/share/man/man4/ng_bridge.4 Wed May 5 22:00:57 2010 (r207679) +++ head/share/man/man4/ng_bridge.4 Wed May 5 22:06:05 2010 (r207680) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 31, 2000 +.Dd May 5, 2010 .Dt NG_BRIDGE 4 .Os .Sh NAME @@ -181,11 +181,17 @@ but also atomically clears the statistic .It Dv NGM_BRIDGE_GET_TABLE Returns the current host mapping table used to direct packets, in a .Dv "struct ng_bridge_host_ary" . +.It Dv NGM_BRIDGE_SET_PERSISTENT +This command sets the persistent flag on the node, and takes no arguments. .El .Sh SHUTDOWN This node shuts down upon receipt of a .Dv NGM_SHUTDOWN -control message, or when all hooks have been disconnected. +control message, or when all hooks have been disconnected. Setting the +persistent flag via a +.Dv NGM_BRIDGE_SET_PERSISTENT +control message disables automatic node shutdown when the last hook gets +disconnected. .Sh FILES .Bl -tag -width XXXXXXXX -compact .It Pa /usr/share/examples/netgraph/ether.bridge Modified: head/share/man/man4/ng_hub.4 ============================================================================== --- head/share/man/man4/ng_hub.4 Wed May 5 22:00:57 2010 (r207679) +++ head/share/man/man4/ng_hub.4 Wed May 5 22:06:05 2010 (r207680) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 17, 2004 +.Dd May 5, 2010 .Dt NG_HUB 4 .Os .Sh NAME @@ -45,11 +45,20 @@ A node accepts any request to connect, regardless of the hook name, as long as the name is unique. .Sh CONTROL MESSAGES -This node type supports only the generic control messages. +This node type supports the generic control messages, plus the +following: +.Bl -tag -width foo +.It Dv NGM_HUB_SET_PERSISTENT +This command sets the persistent flag on the node, and takes no arguments. +.El .Sh SHUTDOWN This node shuts down upon receipt of a .Dv NGM_SHUTDOWN -control message, or when all hooks have been disconnected. +control message, or when all hooks have been disconnected. Setting the +persistent flag via a +.Dv NGM_HUB_SET_PERSISTENT +control message disables automatic node shutdown when the last hook gets +disconnected. .Sh SEE ALSO .Xr netgraph 4 , .Xr ng_bridge 4 , Modified: head/sys/netgraph/ng_bridge.c ============================================================================== --- head/sys/netgraph/ng_bridge.c Wed May 5 22:00:57 2010 (r207679) +++ head/sys/netgraph/ng_bridge.c Wed May 5 22:06:05 2010 (r207680) @@ -84,7 +84,7 @@ #include #ifdef NG_SEPARATE_MALLOC -MALLOC_DEFINE(M_NETGRAPH_BRIDGE, "netgraph_bridge", "netgraph bridge node "); +MALLOC_DEFINE(M_NETGRAPH_BRIDGE, "netgraph_bridge", "netgraph bridge node"); #else #define M_NETGRAPH_BRIDGE M_NETGRAPH #endif @@ -106,6 +106,7 @@ struct ng_bridge_private { u_int numBuckets; /* num buckets in table */ u_int hashMask; /* numBuckets - 1 */ int numLinks; /* num connected links */ + int persistent; /* can exist w/o hooks */ struct callout timer; /* one second periodic timer */ }; typedef struct ng_bridge_private *priv_p; @@ -271,6 +272,13 @@ static const struct ng_cmdlist ng_bridge NULL, &ng_bridge_host_ary_type }, + { + NGM_BRIDGE_COOKIE, + NGM_BRIDGE_SET_PERSISTENT, + "setpersistent", + NULL, + NULL + }, { 0 } }; @@ -495,6 +503,11 @@ ng_bridge_rcvmsg(node_p node, item_p ite } break; } + case NGM_BRIDGE_SET_PERSISTENT: + { + priv->persistent = 1; + break; + } default: error = EINVAL; break; @@ -800,7 +813,8 @@ ng_bridge_disconnect(hook_p hook) /* If no more hooks, go away */ if ((NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0) - && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook)))) { + && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook))) + && !priv->persistent) { ng_rmnode_self(NG_HOOK_NODE(hook)); } return (0); Modified: head/sys/netgraph/ng_bridge.h ============================================================================== --- head/sys/netgraph/ng_bridge.h Wed May 5 22:00:57 2010 (r207679) +++ head/sys/netgraph/ng_bridge.h Wed May 5 22:06:05 2010 (r207680) @@ -149,6 +149,7 @@ enum { NGM_BRIDGE_CLR_STATS, /* clear link stats */ NGM_BRIDGE_GETCLR_STATS, /* atomically get & clear link stats */ NGM_BRIDGE_GET_TABLE, /* get link table */ + NGM_BRIDGE_SET_PERSISTENT, /* set persistent mode */ }; #endif /* _NETGRAPH_NG_BRIDGE_H_ */ Modified: head/sys/netgraph/ng_hub.c ============================================================================== --- head/sys/netgraph/ng_hub.c Wed May 5 22:00:57 2010 (r207679) +++ head/sys/netgraph/ng_hub.c Wed May 5 22:06:05 2010 (r207680) @@ -36,16 +36,46 @@ #include #include +#ifdef NG_SEPARATE_MALLOC +MALLOC_DEFINE(M_NETGRAPH_HUB, "netgraph_hub", "netgraph hub node"); +#else +#define M_NETGRAPH_HUB M_NETGRAPH +#endif + +/* Per-node private data */ +struct ng_hub_private { + int persistent; /* can exist w/o hooks */ +}; +typedef struct ng_hub_private *priv_p; + +/* Netgraph node methods */ static ng_constructor_t ng_hub_constructor; +static ng_rcvmsg_t ng_hub_rcvmsg; +static ng_shutdown_t ng_hub_shutdown; static ng_rcvdata_t ng_hub_rcvdata; static ng_disconnect_t ng_hub_disconnect; +/* List of commands and how to convert arguments to/from ASCII */ +static const struct ng_cmdlist ng_hub_cmdlist[] = { + { + NGM_HUB_COOKIE, + NGM_HUB_SET_PERSISTENT, + "setpersistent", + NULL, + NULL + }, + { 0 } +}; + static struct ng_type ng_hub_typestruct = { .version = NG_ABI_VERSION, .name = NG_HUB_NODE_TYPE, .constructor = ng_hub_constructor, + .rcvmsg = ng_hub_rcvmsg, + .shutdown = ng_hub_shutdown, .rcvdata = ng_hub_rcvdata, .disconnect = ng_hub_disconnect, + .cmdlist = ng_hub_cmdlist, }; NETGRAPH_INIT(hub, &ng_hub_typestruct); @@ -53,10 +83,39 @@ NETGRAPH_INIT(hub, &ng_hub_typestruct); static int ng_hub_constructor(node_p node) { + priv_p priv; + + /* Allocate and initialize private info */ + priv = malloc(sizeof(*priv), M_NETGRAPH_HUB, M_NOWAIT | M_ZERO); + if (priv == NULL) + return (ENOMEM); + NG_NODE_SET_PRIVATE(node, priv); return (0); } +/* + * Receive a control message + */ +static int +ng_hub_rcvmsg(node_p node, item_p item, hook_p lasthook) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + int error = 0; + struct ng_mesg *msg; + + NGI_GET_MSG(item, msg); + if (msg->header.typecookie == NGM_HUB_COOKIE && + msg->header.cmd == NGM_HUB_SET_PERSISTENT) { + priv->persistent = 1; + } else { + error = EINVAL; + } + + NG_FREE_MSG(msg); + return (error); +} + static int ng_hub_rcvdata(hook_p hook, item_p item) { @@ -89,12 +148,25 @@ ng_hub_rcvdata(hook_p hook, item_p item) return (error); } +/* + * Shutdown node + */ +static int +ng_hub_shutdown(node_p node) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + + free(priv, M_NETGRAPH_HUB); + return (0); +} + static int ng_hub_disconnect(hook_p hook) { + const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0 && - NG_NODE_IS_VALID(NG_HOOK_NODE(hook))) + NG_NODE_IS_VALID(NG_HOOK_NODE(hook)) && !priv->persistent) ng_rmnode_self(NG_HOOK_NODE(hook)); return (0); } Modified: head/sys/netgraph/ng_hub.h ============================================================================== --- head/sys/netgraph/ng_hub.h Wed May 5 22:00:57 2010 (r207679) +++ head/sys/netgraph/ng_hub.h Wed May 5 22:06:05 2010 (r207680) @@ -33,4 +33,9 @@ #define NG_HUB_NODE_TYPE "hub" #define NGM_HUB_COOKIE 1082189597 +/* Netgraph control messages */ +enum { + NGM_HUB_SET_PERSISTENT = 1, /* set persistent mode */ +}; + #endif /* _NETGRAPH_NG_HUB_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed May 5 22:15:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02BCA1065670; Wed, 5 May 2010 22:15:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E58D98FC15; Wed, 5 May 2010 22:15:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45MFKF0079544; Wed, 5 May 2010 22:15:20 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45MFKHU079542; Wed, 5 May 2010 22:15:20 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005052215.o45MFKHU079542@svn.freebsd.org> From: Marius Strobl Date: Wed, 5 May 2010 22:15:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207683 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 22:15:21 -0000 Author: marius Date: Wed May 5 22:15:20 2010 New Revision: 207683 URL: http://svn.freebsd.org/changeset/base/207683 Log: - Fix broken symlinks on cross platform zfs send/recv. [1] - Enable zfs_ace_byteswap() on FreeBSD as it works just fine (tested between amd64 and sparc64 in both directions by Michael Moll). PR: 146272 Approved by: mm, pjd Obtained from: OpenSolaris (onnv rev. 8283:1ca59f393041; Bug ID 6764193) [1] MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c Wed May 5 22:12:56 2010 (r207682) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c Wed May 5 22:15:20 2010 (r207683) @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -50,7 +48,6 @@ zfs_oldace_byteswap(ace_t *ace, int ace_ void zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout) { -#ifdef TODO caddr_t end; caddr_t ptr; zfs_ace_t *zacep; @@ -64,6 +61,20 @@ zfs_ace_byteswap(void *buf, size_t size, while (ptr < end) { if (zfs_layout) { + /* + * Avoid overrun. Embedded aces can have one + * of several sizes. We don't know exactly + * how many our present, only the size of the + * buffer containing them. That size may be + * larger than needed to hold the aces + * present. As long as we do not do any + * swapping beyond the end of our block we are + * okay. It it safe to swap any non-ace data + * within the block since it is just zeros. + */ + if (ptr + sizeof (zfs_ace_hdr_t) > end) { + break; + } zacep = (zfs_ace_t *)ptr; zacep->z_hdr.z_access_mask = BSWAP_32(zacep->z_hdr.z_access_mask); @@ -72,6 +83,10 @@ zfs_ace_byteswap(void *buf, size_t size, BSWAP_16(zacep->z_hdr.z_type); entry_type = zacep->z_hdr.z_flags & ACE_TYPE_FLAGS; } else { + /* Overrun avoidance */ + if (ptr + sizeof (ace_t) > end) { + break; + } acep = (ace_t *)ptr; acep->a_access_mask = BSWAP_32(acep->a_access_mask); acep->a_flags = BSWAP_16(acep->a_flags); @@ -88,8 +103,14 @@ zfs_ace_byteswap(void *buf, size_t size, break; case ACE_IDENTIFIER_GROUP: default: + /* Overrun avoidance */ if (zfs_layout) { - zacep->z_fuid = BSWAP_64(zacep->z_fuid); + if (ptr + sizeof (zfs_ace_t) <= end) { + zacep->z_fuid = BSWAP_64(zacep->z_fuid); + } else { + entry_size = sizeof (zfs_ace_t); + break; + } } switch (ace_type) { case ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE: @@ -108,9 +129,6 @@ zfs_ace_byteswap(void *buf, size_t size, } ptr = ptr + entry_size; } -#else /* TODO */ - panic("%s:%u: TODO", __func__, __LINE__); -#endif /* TODO */ } /* ARGSUSED */ @@ -173,7 +191,8 @@ zfs_znode_byteswap(void *buf, size_t siz if (zp->zp_acl.z_acl_version == ZFS_ACL_VERSION) { zfs_acl_byteswap((void *)&zp->zp_acl.z_ace_data[0], ZFS_ACE_SPACE); - } else + } else { zfs_oldace_byteswap((ace_t *)&zp->zp_acl.z_ace_data[0], ACE_SLOT_CNT); + } } From owner-svn-src-head@FreeBSD.ORG Wed May 5 22:29:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D9CAD1065672; Wed, 5 May 2010 22:29:54 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C9B788FC18; Wed, 5 May 2010 22:29:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45MTsck083023; Wed, 5 May 2010 22:29:54 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45MTsY4083021; Wed, 5 May 2010 22:29:54 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201005052229.o45MTsY4083021@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 5 May 2010 22:29:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207687 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 22:29:55 -0000 Author: np Date: Wed May 5 22:29:54 2010 New Revision: 207687 URL: http://svn.freebsd.org/changeset/base/207687 Log: Do not hold the T3 firmware in memory all the time. firmware(9) can load/unload it as needed. Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Wed May 5 22:23:29 2010 (r207686) +++ head/sys/dev/cxgb/cxgb_main.c Wed May 5 22:29:54 2010 (r207687) @@ -3403,5 +3403,3 @@ set_tcb_field_ulp(struct cpl_set_tcb_fie txpkt->len = htonl(V_ULPTX_NFLITS(sizeof(*req) / 8)); mk_set_tcb_field(req, tid, word, mask, val); } - -MODULE_DEPEND(if_cxgb, cxgb_t3fw, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Wed May 5 22:52:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 393BF106566C; Wed, 5 May 2010 22:52:07 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 28B778FC1E; Wed, 5 May 2010 22:52:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o45Mq78N087932; Wed, 5 May 2010 22:52:07 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o45Mq61F087929; Wed, 5 May 2010 22:52:06 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201005052252.o45Mq61F087929@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 5 May 2010 22:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207688 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2010 22:52:07 -0000 Author: np Date: Wed May 5 22:52:06 2010 New Revision: 207688 URL: http://svn.freebsd.org/changeset/base/207688 Log: Don't ring the tx doorbell for every frame when we know more frames will follow. Adjust the freelist and response queue doorbells too. Discussed with: kmacy Modified: head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_sge.c Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Wed May 5 22:29:54 2010 (r207687) +++ head/sys/dev/cxgb/cxgb_adapter.h Wed May 5 22:52:06 2010 (r207688) @@ -204,6 +204,7 @@ struct sge_fl { uint32_t cidx; uint32_t pidx; uint32_t gen; + uint32_t db_pending; bus_addr_t phys_addr; uint32_t cntxt_id; uint32_t empty; @@ -232,6 +233,7 @@ struct sge_txq { uint32_t pidx; uint32_t gen; uint32_t unacked; + uint32_t db_pending; struct tx_desc *desc; struct tx_sw_desc *sdesc; uint32_t token; Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Wed May 5 22:29:54 2010 (r207687) +++ head/sys/dev/cxgb/cxgb_sge.c Wed May 5 22:52:06 2010 (r207688) @@ -696,7 +696,7 @@ refill_fl(adapter_t *sc, struct sge_fl * struct refill_fl_cb_arg cb_arg; struct mbuf *m; caddr_t cl; - int err, count = 0; + int err; cb_arg.error = 0; while (n--) { @@ -754,12 +754,14 @@ refill_fl(adapter_t *sc, struct sge_fl * d = q->desc; } q->credits++; - count++; + q->db_pending++; } done: - if (count) + if (q->db_pending >= 32) { + q->db_pending = 0; t3_write_reg(sc, A_SG_KDOORBELL, V_EGRCNTX(q->cntxt_id)); + } } @@ -810,8 +812,10 @@ __refill_fl(adapter_t *adap, struct sge_ static __inline void __refill_fl_lt(adapter_t *adap, struct sge_fl *fl, int max) { - if ((fl->size - fl->credits) < max) - refill_fl(adap, fl, min(max, fl->size - fl->credits)); + uint32_t reclaimable = fl->size - fl->credits; + + if (reclaimable > 0) + refill_fl(adap, fl, min(max, reclaimable)); } /** @@ -1261,7 +1265,7 @@ make_sgl(struct sg_ent *sgp, bus_dma_seg * When GTS is disabled we unconditionally ring the doorbell. */ static __inline void -check_ring_tx_db(adapter_t *adap, struct sge_txq *q) +check_ring_tx_db(adapter_t *adap, struct sge_txq *q, int mustring) { #if USE_GTS clear_bit(TXQ_LAST_PKT_DB, &q->flags); @@ -1275,9 +1279,12 @@ check_ring_tx_db(adapter_t *adap, struct F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); } #else - wmb(); /* write descriptors before telling HW */ - t3_write_reg(adap, A_SG_KDOORBELL, - F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); + if (mustring || ++q->db_pending >= 32) { + wmb(); /* write descriptors before telling HW */ + t3_write_reg(adap, A_SG_KDOORBELL, + F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); + q->db_pending = 0; + } #endif } @@ -1480,7 +1487,7 @@ t3_encap(struct sge_qset *qs, struct mbu wmb(); ETHER_BPF_MTAP(pi->ifp, m0); wr_gen2(txd, txqs.gen); - check_ring_tx_db(sc, txq); + check_ring_tx_db(sc, txq, 0); return (0); } else if (tso_info) { int eth_type; @@ -1543,7 +1550,7 @@ t3_encap(struct sge_qset *qs, struct mbu wmb(); ETHER_BPF_MTAP(pi->ifp, m0); wr_gen2(txd, txqs.gen); - check_ring_tx_db(sc, txq); + check_ring_tx_db(sc, txq, 0); m_freem(m0); return (0); } @@ -1574,7 +1581,7 @@ t3_encap(struct sge_qset *qs, struct mbu wmb(); ETHER_BPF_MTAP(pi->ifp, m0); wr_gen2(txd, txqs.gen); - check_ring_tx_db(sc, txq); + check_ring_tx_db(sc, txq, 0); m_freem(m0); return (0); } @@ -1593,7 +1600,7 @@ t3_encap(struct sge_qset *qs, struct mbu wr_lo = htonl(V_WR_TID(txq->token)); write_wr_hdr_sgl(ndesc, txd, &txqs, txq, sgl, flits, sgl_flits, wr_hi, wr_lo); - check_ring_tx_db(sc, txq); + check_ring_tx_db(sc, txq, 0); return (0); } @@ -1643,7 +1650,6 @@ cxgb_start_locked(struct sge_qset *qs) { struct mbuf *m_head = NULL; struct sge_txq *txq = &qs->txq[TXQ_ETH]; - int in_use_init = txq->in_use; struct port_info *pi = qs->port; struct ifnet *ifp = pi->ifp; @@ -1655,8 +1661,7 @@ cxgb_start_locked(struct sge_qset *qs) return; } TXQ_LOCK_ASSERT(qs); - while ((txq->in_use - in_use_init < TX_START_MAX_DESC) && - !TXQ_RING_EMPTY(qs) && (ifp->if_drv_flags & IFF_DRV_RUNNING) && + while (!TXQ_RING_EMPTY(qs) && (ifp->if_drv_flags & IFF_DRV_RUNNING) && pi->link_config.link_ok) { reclaim_completed_tx(qs, cxgb_tx_reclaim_threshold, TXQ_ETH); @@ -1674,6 +1679,10 @@ cxgb_start_locked(struct sge_qset *qs) m_head = NULL; } + + if (txq->db_pending) + check_ring_tx_db(pi->adapter, txq, 1); + if (!TXQ_RING_EMPTY(qs) && callout_pending(&txq->txq_timer) == 0 && pi->link_config.link_ok) callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, @@ -1707,6 +1716,9 @@ cxgb_transmit_locked(struct ifnet *ifp, (error = drbr_enqueue(ifp, br, m)) != 0) return (error); } else { + if (txq->db_pending) + check_ring_tx_db(pi->adapter, txq, 1); + /* * We've bypassed the buf ring so we need to update * the stats directly @@ -2354,7 +2366,7 @@ again: reclaim_completed_tx(qs, 16, TXQ_ TXQ_UNLOCK(qs); write_ofld_wr(adap, m, q, pidx, gen, ndesc, segs, nsegs); - check_ring_tx_db(adap, q); + check_ring_tx_db(adap, q, 1); return (0); } @@ -3033,7 +3045,7 @@ process_responses(adapter_t *adap, struc r = rspq->desc; } - if (++rspq->credits >= (rspq->size / 4)) { + if (++rspq->credits >= 64) { refill_rspq(adap, rspq, rspq->credits); rspq->credits = 0; } From owner-svn-src-head@FreeBSD.ORG Thu May 6 00:24:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3EF76106566B; Thu, 6 May 2010 00:24:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2E97C8FC12; Thu, 6 May 2010 00:24:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o460O8tN008288; Thu, 6 May 2010 00:24:08 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o460O8QE008286; Thu, 6 May 2010 00:24:08 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201005060024.o460O8QE008286@svn.freebsd.org> From: Rick Macklem Date: Thu, 6 May 2010 00:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207689 - head/usr.sbin/mountd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 00:24:09 -0000 Author: rmacklem Date: Thu May 6 00:24:08 2010 New Revision: 207689 URL: http://svn.freebsd.org/changeset/base/207689 Log: If the "-alldirs" export option was used for the V4: line, mountd would crash in check_options() since dp == NULL for the V4: line. This patch moves the check for options allowed on the V4: line to ahead of where dp is used to avoid this crash. Reported by: mamalos AT eng.auth.gr MFC after: 1 week Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Wed May 5 22:52:06 2010 (r207688) +++ head/usr.sbin/mountd/mountd.c Thu May 6 00:24:08 2010 (r207689) @@ -2881,16 +2881,16 @@ check_options(dp) syslog(LOG_ERR, "-mask and /masklen are mutually exclusive"); return (1); } - if ((opt_flags & OP_ALLDIRS) && dp->dp_left) { - syslog(LOG_ERR, "-alldirs has multiple directories"); - return (1); - } if (v4root_phase > 0 && (opt_flags & ~(OP_SEC | OP_MASK | OP_NET | OP_HAVEMASK | OP_MASKLEN)) != 0) { syslog(LOG_ERR,"only -sec,-net,-mask options allowed on V4:"); return (1); } + if ((opt_flags & OP_ALLDIRS) && dp->dp_left) { + syslog(LOG_ERR, "-alldirs has multiple directories"); + return (1); + } return (0); } From owner-svn-src-head@FreeBSD.ORG Thu May 6 01:00:56 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B5D6E106564A; Thu, 6 May 2010 01:00:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 324428FC0C; Thu, 6 May 2010 01:00:55 +0000 (UTC) Received: from c122-106-171-133.carlnfd1.nsw.optusnet.com.au (c122-106-171-133.carlnfd1.nsw.optusnet.com.au [122.106.171.133]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o4610ql5009956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 May 2010 11:00:54 +1000 Date: Thu, 6 May 2010 11:00:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Xin LI In-Reply-To: <201005052124.o45LOJES067973@svn.freebsd.org> Message-ID: <20100506105825.B18998@delplex.bde.org> References: <201005052124.o45LOJES067973@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r207677 - head/usr.bin/find X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 01:00:56 -0000 On Wed, 5 May 2010, Xin LI wrote: > Log: > Move SCCS tags to comments as they were already #if 0'ed. This is explicitly disrecommended in style(9): All VCS (version control system) revision identification in files obtained from elsewhere should be maintained, including, where applica- ble, multiple IDs showing a file's history. In general, do not edit for- eign IDs or their infrastructure. Unless otherwise wrapped (such as ``#if defined(LIBC_SCCS)''), enclose both in ``#if 0 ... #endif'' to hide any uncompilable bits and to keep the IDs out of object files. Only add ``From: '' in front of foreign VCS IDs if the file is renamed. Bruce From owner-svn-src-head@FreeBSD.ORG Thu May 6 04:23:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D222D1065670; Thu, 6 May 2010 04:23:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C1EFA8FC25; Thu, 6 May 2010 04:23:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o464Nq0B061924; Thu, 6 May 2010 04:23:52 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o464Nq83061921; Thu, 6 May 2010 04:23:52 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005060423.o464Nq83061921@svn.freebsd.org> From: Alan Cox Date: Thu, 6 May 2010 04:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207692 - in head/sys/mips: include mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 04:23:52 -0000 Author: alc Date: Thu May 6 04:23:52 2010 New Revision: 207692 URL: http://svn.freebsd.org/changeset/base/207692 Log: Eliminate dead code. Modified: head/sys/mips/include/pmap.h head/sys/mips/mips/pmap.c Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Thu May 6 01:08:36 2010 (r207691) +++ head/sys/mips/include/pmap.h Thu May 6 04:23:52 2010 (r207692) @@ -175,7 +175,6 @@ void pmap_unmapdev(vm_offset_t, vm_size_ vm_offset_t pmap_steal_memory(vm_size_t size); void pmap_set_modified(vm_offset_t pa); int page_is_managed(vm_offset_t pa); -void pmap_page_is_free(vm_page_t m); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void pmap_kremove(vm_offset_t va); void *pmap_kenter_temporary(vm_paddr_t pa, int i); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu May 6 01:08:36 2010 (r207691) +++ head/sys/mips/mips/pmap.c Thu May 6 04:23:52 2010 (r207692) @@ -3030,20 +3030,6 @@ init_pte_prot(vm_offset_t va, vm_page_t } /* - * pmap_page_is_free: - * - * Called when a page is freed to allow pmap to clean up - * any extra state associated with the page. In this case - * clear modified/referenced bits. - */ -void -pmap_page_is_free(vm_page_t m) -{ - - m->md.pv_flags = 0; -} - -/* * pmap_set_modified: * * Sets the page modified and reference bits for the specified page. From owner-svn-src-head@FreeBSD.ORG Thu May 6 04:57:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 867791065687; Thu, 6 May 2010 04:57:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 75DDB8FC1D; Thu, 6 May 2010 04:57:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o464vXOX069422; Thu, 6 May 2010 04:57:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o464vXBF069418; Thu, 6 May 2010 04:57:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005060457.o464vXBF069418@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 6 May 2010 04:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207694 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 04:57:33 -0000 Author: kib Date: Thu May 6 04:57:33 2010 New Revision: 207694 URL: http://svn.freebsd.org/changeset/base/207694 Log: Add a helper function vm_pageout_page_lock(), similar to tegge' vm_pageout_fallback_object_lock(), to obtain the page lock while having page queue lock locked, and still maintain the page position in a queue. Use the helper to lock the page in the pageout daemon and contig launder iterators instead of skipping the page if its lock is contested. Skipping locked pages easily causes pagedaemon or launder to not make a progress with page cleaning. Proposed and reviewed by: alc Modified: head/sys/vm/vm_contig.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pageout.h Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Thu May 6 04:57:10 2010 (r207693) +++ head/sys/vm/vm_contig.c Thu May 6 04:57:33 2010 (r207694) @@ -168,8 +168,10 @@ vm_contig_launder(int queue) if ((m->flags & PG_MARKER) != 0) continue; - if (!vm_page_trylock(m)) - continue; + if (!vm_pageout_page_lock(m, &next)) { + vm_page_unlock(m); + return (FALSE); + } KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); error = vm_contig_launder_page(m, &next); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Thu May 6 04:57:10 2010 (r207693) +++ head/sys/vm/vm_pageout.c Thu May 6 04:57:33 2010 (r207694) @@ -215,6 +215,17 @@ static void vm_req_vmdaemon(int req); #endif static void vm_pageout_page_stats(void); +static void +vm_pageout_init_marker(vm_page_t marker, u_short queue) +{ + + bzero(marker, sizeof(*marker)); + marker->flags = PG_FICTITIOUS | PG_MARKER; + marker->oflags = VPO_BUSY; + marker->queue = queue; + marker->wire_count = 1; +} + /* * vm_pageout_fallback_object_lock: * @@ -237,16 +248,8 @@ vm_pageout_fallback_object_lock(vm_page_ u_short queue; vm_object_t object; - /* - * Initialize our marker - */ - bzero(&marker, sizeof(marker)); - marker.flags = PG_FICTITIOUS | PG_MARKER; - marker.oflags = VPO_BUSY; - marker.queue = m->queue; - marker.wire_count = 1; - queue = m->queue; + vm_pageout_init_marker(&marker, queue); object = m->object; TAILQ_INSERT_AFTER(&vm_page_queues[queue].pl, @@ -268,6 +271,43 @@ vm_pageout_fallback_object_lock(vm_page_ } /* + * Lock the page while holding the page queue lock. Use marker page + * to detect page queue changes and maintain notion of next page on + * page queue. Return TRUE if no changes were detected, FALSE + * otherwise. The page is locked on return. The page queue lock might + * be dropped and reacquired. + * + * This function depends on normal struct vm_page being type stable. + */ +boolean_t +vm_pageout_page_lock(vm_page_t m, vm_page_t *next) +{ + struct vm_page marker; + boolean_t unchanged; + u_short queue; + + vm_page_lock_assert(m, MA_NOTOWNED); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + + if (vm_page_trylock(m)) + return (TRUE); + + queue = m->queue; + vm_pageout_init_marker(&marker, queue); + + TAILQ_INSERT_AFTER(&vm_page_queues[queue].pl, m, &marker, pageq); + vm_page_unlock_queues(); + vm_page_lock(m); + vm_page_lock_queues(); + + /* Page queue might have changed. */ + *next = TAILQ_NEXT(&marker, pageq); + unchanged = (m->queue == queue && &marker == TAILQ_NEXT(m, pageq)); + TAILQ_REMOVE(&vm_page_queues[queue].pl, &marker, pageq); + return (unchanged); +} + +/* * vm_pageout_clean: * * Clean the page and remove it from the laundry. @@ -777,7 +817,11 @@ rescan0: if (m->flags & PG_MARKER) continue; - if (!vm_page_trylock(m)) { + /* + * Lock the page. + */ + if (!vm_pageout_page_lock(m, &next)) { + vm_page_unlock(m); addl_page_shortage++; continue; } @@ -1112,7 +1156,9 @@ unlock_and_continue: m = next; continue; } - if (!vm_page_trylock(m) || (object = m->object) == NULL) { + if (!vm_pageout_page_lock(m, &next) || + (object = m->object) == NULL) { + vm_page_unlock(m); m = next; continue; } @@ -1375,7 +1421,9 @@ vm_pageout_page_stats() continue; } vm_page_lock_assert(m, MA_NOTOWNED); - if (vm_page_trylock(m) == 0 || (object = m->object) == NULL) { + if (!vm_pageout_page_lock(m, &next) || + (object = m->object) == NULL) { + vm_page_unlock(m); m = next; continue; } Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Thu May 6 04:57:10 2010 (r207693) +++ head/sys/vm/vm_pageout.h Thu May 6 04:57:33 2010 (r207694) @@ -104,5 +104,6 @@ extern void vm_waitpfault(void); boolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *); int vm_pageout_flush(vm_page_t *, int, int); void vm_pageout_oom(int shortage); +boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *); #endif #endif /* _VM_VM_PAGEOUT_H_ */ From owner-svn-src-head@FreeBSD.ORG Thu May 6 06:44:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AEB12106576C; Thu, 6 May 2010 06:44:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 141ED8FC1C; Thu, 6 May 2010 06:44:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o466iQdY092745; Thu, 6 May 2010 06:44:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o466iQP9092743; Thu, 6 May 2010 06:44:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201005060644.o466iQP9092743@svn.freebsd.org> From: Alexander Motin Date: Thu, 6 May 2010 06:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207696 - head/sys/dev/mvs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 06:44:27 -0000 Author: mav Date: Thu May 6 06:44:26 2010 New Revision: 207696 URL: http://svn.freebsd.org/changeset/base/207696 Log: Fix polled operation. Now it is possible to dump kernel via mvs(4). Modified: head/sys/dev/mvs/mvs.c Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Thu May 6 06:44:19 2010 (r207695) +++ head/sys/dev/mvs/mvs.c Thu May 6 06:44:26 2010 (r207696) @@ -2168,6 +2168,6 @@ mvspoll(struct cam_sim *sim) arg.arg = ch->dev; arg.cause = 2; /* XXX */ - mvs_ch_intr(arg.arg); + mvs_ch_intr(&arg); } From owner-svn-src-head@FreeBSD.ORG Thu May 6 15:52:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CE8F21065675; Thu, 6 May 2010 15:52:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BF16D8FC12; Thu, 6 May 2010 15:52:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46Fq8fD019246; Thu, 6 May 2010 15:52:08 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46Fq809019245; Thu, 6 May 2010 15:52:08 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005061552.o46Fq809019245@svn.freebsd.org> From: Alan Cox Date: Thu, 6 May 2010 15:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207700 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 15:52:08 -0000 Author: alc Date: Thu May 6 15:52:08 2010 New Revision: 207700 URL: http://svn.freebsd.org/changeset/base/207700 Log: Eliminate a small bit of unneeded code from kern_sendfile(): While kern_sendfile() is running, the file's vm object can't be destroyed because kern_sendfile() increments the vm object's reference count. (Once kern_sendfile() decrements the reference count and returns, the vm object can, however, be destroyed. So, sf_buf_mext() must handle the case where the vm object is destroyed.) Reviewed by: kib Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu May 6 12:37:01 2010 (r207699) +++ head/sys/kern/uipc_syscalls.c Thu May 6 15:52:08 2010 (r207700) @@ -2139,14 +2139,9 @@ retry_space: (mnw ? SFB_NOWAIT : SFB_CATCH))) == NULL) { mbstat.sf_allocfail++; vm_page_lock(pg); - vm_page_lock_queues(); vm_page_unwire(pg, 0); - /* - * XXX: Not same check as above!? - */ - if (pg->wire_count == 0 && pg->object == NULL) - vm_page_free(pg); - vm_page_unlock_queues(); + KASSERT(pg->object != NULL, + ("kern_sendfile: object disappeared")); vm_page_unlock(pg); error = (mnw ? EAGAIN : EINTR); break; From owner-svn-src-head@FreeBSD.ORG Thu May 6 16:37:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3C2C9106566B; Thu, 6 May 2010 16:37:51 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2C76B8FC18; Thu, 6 May 2010 16:37:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46GbpxG029343; Thu, 6 May 2010 16:37:51 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46GbpIU029341; Thu, 6 May 2010 16:37:51 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201005061637.o46GbpIU029341@svn.freebsd.org> From: "Andrey A. Chernov" Date: Thu, 6 May 2010 16:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207701 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 16:37:51 -0000 Author: ache Date: Thu May 6 16:37:50 2010 New Revision: 207701 URL: http://svn.freebsd.org/changeset/base/207701 Log: Fix recent space skipping: 1) add missing (unsigned char) cast to ctype() macro 2) fix off-by-one error causing last letter always doubled Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Thu May 6 15:52:08 2010 (r207700) +++ head/usr.bin/calendar/io.c Thu May 6 16:37:50 2010 (r207701) @@ -155,8 +155,8 @@ cal(void) } /* Get rid of leading spaces (non-standard) */ - while (isspace(buf[0])) - memcpy(buf, buf + 1, strlen(buf) - 1); + while (isspace((unsigned char)buf[0])) + memcpy(buf, buf + 1, strlen(buf)); /* No tab in the line, then not a valid line */ if ((pp = strchr(buf, '\t')) == NULL) From owner-svn-src-head@FreeBSD.ORG Thu May 6 16:39:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 854451065673; Thu, 6 May 2010 16:39:43 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 74F378FC1C; Thu, 6 May 2010 16:39:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46GdhIL029772; Thu, 6 May 2010 16:39:43 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46GdhZC029766; Thu, 6 May 2010 16:39:43 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005061639.o46GdhZC029766@svn.freebsd.org> From: Alan Cox Date: Thu, 6 May 2010 16:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207702 - in head/sys: amd64/amd64 i386/i386 sparc64/sparc64 vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 16:39:43 -0000 Author: alc Date: Thu May 6 16:39:43 2010 New Revision: 207702 URL: http://svn.freebsd.org/changeset/base/207702 Log: Push down the page queues lock inside of vm_page_free_toq() and pmap_page_is_mapped() in preparation for removing page queues locking around calls to vm_page_free(). Setting aside the assertion that calls pmap_page_is_mapped(), vm_page_free_toq() now acquires and holds the page queues lock just long enough to actually add or remove the page from the paging queues. Update vm_page_unhold() to reflect the above change. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu May 6 16:37:50 2010 (r207701) +++ head/sys/amd64/amd64/pmap.c Thu May 6 16:39:43 2010 (r207702) @@ -3961,16 +3961,15 @@ pmap_pvh_wired_mappings(struct md_page * boolean_t pmap_page_is_mapped(vm_page_t m) { - struct md_page *pvh; + boolean_t rv; if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) return (FALSE); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - return (!TAILQ_EMPTY(&pvh->pv_list)); - } else - return (TRUE); + vm_page_lock_queues(); + rv = !TAILQ_EMPTY(&m->md.pv_list) || + !TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list); + vm_page_unlock_queues(); + return (rv); } /* Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Thu May 6 16:37:50 2010 (r207701) +++ head/sys/i386/i386/pmap.c Thu May 6 16:39:43 2010 (r207702) @@ -4125,16 +4125,15 @@ pmap_pvh_wired_mappings(struct md_page * boolean_t pmap_page_is_mapped(vm_page_t m) { - struct md_page *pvh; + boolean_t rv; if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) return (FALSE); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - return (!TAILQ_EMPTY(&pvh->pv_list)); - } else - return (TRUE); + vm_page_lock_queues(); + rv = !TAILQ_EMPTY(&m->md.pv_list) || + !TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list); + vm_page_unlock_queues(); + return (rv); } /* Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Thu May 6 16:37:50 2010 (r207701) +++ head/sys/sparc64/sparc64/pmap.c Thu May 6 16:39:43 2010 (r207702) @@ -1834,14 +1834,19 @@ boolean_t pmap_page_is_mapped(vm_page_t m) { struct tte *tp; + boolean_t rv; + rv = FALSE; if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) - return (FALSE); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + return (rv); + vm_page_lock_queues(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) - if ((tp->tte_data & TD_PV) != 0) - return (TRUE); - return (FALSE); + if ((tp->tte_data & TD_PV) != 0) { + rv = TRUE; + break; + } + vm_page_unlock_queues(); + return (rv); } /* Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu May 6 16:37:50 2010 (r207701) +++ head/sys/vm/vm_page.c Thu May 6 16:39:43 2010 (r207702) @@ -563,11 +563,8 @@ vm_page_unhold(vm_page_t mem) vm_page_lock_assert(mem, MA_OWNED); --mem->hold_count; KASSERT(mem->hold_count >= 0, ("vm_page_unhold: hold count < 0!!!")); - if (mem->hold_count == 0 && VM_PAGE_INQUEUE2(mem, PQ_HOLD)) { - vm_page_lock_queues(); + if (mem->hold_count == 0 && VM_PAGE_INQUEUE2(mem, PQ_HOLD)) vm_page_free_toq(mem); - vm_page_unlock_queues(); - } } /* @@ -1448,10 +1445,11 @@ void vm_page_free_toq(vm_page_t m) { - if (VM_PAGE_GETQUEUE(m) != PQ_NONE) - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - KASSERT(!pmap_page_is_mapped(m), - ("vm_page_free_toq: freeing mapped page %p", m)); + if ((m->flags & PG_UNMANAGED) == 0) { + vm_page_lock_assert(m, MA_OWNED); + KASSERT(!pmap_page_is_mapped(m), + ("vm_page_free_toq: freeing mapped page %p", m)); + } PCPU_INC(cnt.v_tfree); if (m->busy || VM_PAGE_IS_FREE(m)) { @@ -1471,7 +1469,11 @@ vm_page_free_toq(vm_page_t m) * callback routine until after we've put the page on the * appropriate free queue. */ - vm_pageq_remove(m); + if (VM_PAGE_GETQUEUE(m) != PQ_NONE) { + vm_page_lock_queues(); + vm_pageq_remove(m); + vm_page_unlock_queues(); + } vm_page_remove(m); /* @@ -1493,9 +1495,10 @@ vm_page_free_toq(vm_page_t m) panic("vm_page_free: freeing wired page"); } if (m->hold_count != 0) { - vm_page_lock_assert(m, MA_OWNED); m->flags &= ~PG_ZERO; + vm_page_lock_queues(); vm_page_enqueue(PQ_HOLD, m); + vm_page_unlock_queues(); } else { /* * Restore the default memory attribute to the page. Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Thu May 6 16:37:50 2010 (r207701) +++ head/sys/vm/vm_page.h Thu May 6 16:39:43 2010 (r207702) @@ -107,7 +107,7 @@ struct vm_page { vm_pindex_t pindex; /* offset into object (O,Q) */ vm_paddr_t phys_addr; /* physical address of page */ struct md_page md; /* machine dependant stuff */ - uint8_t queue; /* page queue index */ + uint8_t queue; /* page queue index (P,Q) */ int8_t segind; u_short flags; /* see below */ uint8_t order; /* index of the buddy queue */ From owner-svn-src-head@FreeBSD.ORG Thu May 6 16:54:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3B67A1065673; Thu, 6 May 2010 16:54:47 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2BB2B8FC08; Thu, 6 May 2010 16:54:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46GslYA033120; Thu, 6 May 2010 16:54:47 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46GslfG033117; Thu, 6 May 2010 16:54:47 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201005061654.o46GslfG033117@svn.freebsd.org> From: "Andrey A. Chernov" Date: Thu, 6 May 2010 16:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207703 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 16:54:47 -0000 Author: ache Date: Thu May 6 16:54:46 2010 New Revision: 207703 URL: http://svn.freebsd.org/changeset/base/207703 Log: While I am here, add more missing (unsigned char) casts to ctype() macros Modified: head/usr.bin/calendar/io.c head/usr.bin/calendar/parsedata.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Thu May 6 16:39:43 2010 (r207702) +++ head/usr.bin/calendar/io.c Thu May 6 16:54:46 2010 (r207703) @@ -163,7 +163,7 @@ cal(void) continue; /* Trim spaces in front of the tab */ - while (isspace(pp[-1])) + while (isspace((unsigned char)pp[-1])) pp--; p = *pp; Modified: head/usr.bin/calendar/parsedata.c ============================================================================== --- head/usr.bin/calendar/parsedata.c Thu May 6 16:39:43 2010 (r207702) +++ head/usr.bin/calendar/parsedata.c Thu May 6 16:54:46 2010 (r207703) @@ -872,7 +872,7 @@ isonlydigits(char *s, int nostar) for (i = 0; s[i] != '\0'; i++) { if (nostar == 0 && s[i] == '*' && s[i + 1] == '\0') return 1; - if (!isdigit(s[i])) + if (!isdigit((unsigned char)s[i])) return (0); } return (1); From owner-svn-src-head@FreeBSD.ORG Thu May 6 17:06:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2202E1065670; Thu, 6 May 2010 17:06:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 070C48FC0A; Thu, 6 May 2010 17:06:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46H6a1S035866; Thu, 6 May 2010 17:06:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46H6aVD035858; Thu, 6 May 2010 17:06:36 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201005061706.o46H6aVD035858@svn.freebsd.org> From: Xin LI Date: Thu, 6 May 2010 17:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207705 - head/usr.bin/find X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 17:06:37 -0000 Author: delphij Date: Thu May 6 17:06:36 2010 New Revision: 207705 URL: http://svn.freebsd.org/changeset/base/207705 Log: Revert r207677 which is considered a violation of style(9). Pointed out by: bde Pointy hat to: delphij Modified: head/usr.bin/find/find.c head/usr.bin/find/function.c head/usr.bin/find/ls.c head/usr.bin/find/main.c head/usr.bin/find/misc.c head/usr.bin/find/operator.c head/usr.bin/find/option.c Modified: head/usr.bin/find/find.c ============================================================================== --- head/usr.bin/find/find.c Thu May 6 17:03:27 2010 (r207704) +++ head/usr.bin/find/find.c Thu May 6 17:06:36 2010 (r207705) @@ -32,10 +32,15 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)find.c 8.5 (Berkeley) 8/5/94 */ +#ifndef lint +#if 0 +static char sccsid[] = "@(#)find.c 8.5 (Berkeley) 8/5/94"; +#else +#endif +#endif /* not lint */ + #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Thu May 6 17:03:27 2010 (r207704) +++ head/usr.bin/find/function.c Thu May 6 17:06:36 2010 (r207705) @@ -32,10 +32,14 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)function.c 8.10 (Berkeley) 5/4/95 */ +#ifndef lint +#if 0 +static const char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95"; +#endif +#endif /* not lint */ + #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/ls.c ============================================================================== --- head/usr.bin/find/ls.c Thu May 6 17:03:27 2010 (r207704) +++ head/usr.bin/find/ls.c Thu May 6 17:06:36 2010 (r207705) @@ -29,10 +29,14 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)ls.c 8.1 (Berkeley) 6/6/93 */ +#ifndef lint +#if 0 +static char sccsid[] = "@(#)ls.c 8.1 (Berkeley) 6/6/93"; +#endif +#endif /* not lint */ + #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/main.c ============================================================================== --- head/usr.bin/find/main.c Thu May 6 17:03:27 2010 (r207704) +++ head/usr.bin/find/main.c Thu May 6 17:06:36 2010 (r207705) @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)main.c 8.4 (Berkeley) 5/4/95 */ #ifndef lint @@ -42,6 +40,12 @@ char copyright[] = The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ +#ifndef lint +#if 0 +static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; +#endif +#endif /* not lint */ + #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/misc.c ============================================================================== --- head/usr.bin/find/misc.c Thu May 6 17:03:27 2010 (r207704) +++ head/usr.bin/find/misc.c Thu May 6 17:06:36 2010 (r207705) @@ -32,10 +32,15 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)misc.c 8.2 (Berkeley) 4/1/94 */ +#ifndef lint +#if 0 +static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/1/94"; +#else +#endif +#endif /* not lint */ + #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/operator.c ============================================================================== --- head/usr.bin/find/operator.c Thu May 6 17:03:27 2010 (r207704) +++ head/usr.bin/find/operator.c Thu May 6 17:06:36 2010 (r207705) @@ -32,10 +32,14 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)operator.c 8.1 (Berkeley) 6/6/93 */ +#ifndef lint +#if 0 +static char sccsid[] = "@(#)operator.c 8.1 (Berkeley) 6/6/93"; +#endif +#endif /* not lint */ + #include __FBSDID("$FreeBSD$"); Modified: head/usr.bin/find/option.c ============================================================================== --- head/usr.bin/find/option.c Thu May 6 17:03:27 2010 (r207704) +++ head/usr.bin/find/option.c Thu May 6 17:06:36 2010 (r207705) @@ -32,10 +32,14 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)option.c 8.2 (Berkeley) 4/16/94 */ +#ifndef lint +/* +static char sccsid[] = "@(#)option.c 8.2 (Berkeley) 4/16/94"; +*/ +#endif /* not lint */ + #include __FBSDID("$FreeBSD$"); @@ -51,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include "find.h" -int typecompare(const void *, const void *); +static int typecompare(const void *, const void *); /* NB: the following table must be sorted lexically. */ /* Options listed with C++ comments are in gnu find, but not our find */ @@ -190,7 +194,7 @@ lookup_option(const char *name) sizeof(options)/sizeof(OPTION), sizeof(OPTION), typecompare)); } -int +static int typecompare(const void *a, const void *b) { return (strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name)); From owner-svn-src-head@FreeBSD.ORG Thu May 6 17:26:55 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E1891065678; Thu, 6 May 2010 17:26:55 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by mx1.freebsd.org (Postfix) with ESMTP id 8E3188FC13; Thu, 6 May 2010 17:26:54 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 7C794A69503; Fri, 7 May 2010 01:10:38 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with LMTP id Q6H155hFCKpI; Fri, 7 May 2010 01:10:31 +0800 (CST) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id DDA9DA69502; Fri, 7 May 2010 01:10:28 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=TqjoP4xBx7XONek7nGSl4ETTyNk1YCdYbm9dbrMi3f4mDXruS6ZT0eFdQhjLd4MMF a889VpgtunpcfMQgFvtnQ== Message-ID: <4BE2F7FF.9070902@delphij.net> Date: Thu, 06 May 2010 10:10:23 -0700 From: Xin LI Organization: The Geek China Organization User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.9) Gecko/20100408 Thunderbird/3.0.4 ThunderBrowse/3.2.8.1 MIME-Version: 1.0 To: Bruce Evans References: <201005052124.o45LOJES067973@svn.freebsd.org> <20100506105825.B18998@delplex.bde.org> In-Reply-To: <20100506105825.B18998@delplex.bde.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Xin LI Subject: Re: svn commit: r207677 - head/usr.bin/find X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 17:26:55 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2010/05/05 18:00, Bruce Evans wrote: > On Wed, 5 May 2010, Xin LI wrote: > >> Log: >> Move SCCS tags to comments as they were already #if 0'ed. > > This is explicitly disrecommended in style(9): > > All VCS (version control system) revision identification in files > obtained from elsewhere should be maintained, including, where > applica- > ble, multiple IDs showing a file's history. In general, do not > edit for- > eign IDs or their infrastructure. Unless otherwise wrapped (such as > ``#if defined(LIBC_SCCS)''), enclose both in ``#if 0 ... #endif'' > to hide > any uncompilable bits and to keep the IDs out of object files. > Only add > ``From: '' in front of foreign VCS IDs if the file is renamed. Sorry for that. I thought that the style(9) approach actually creates more diffs but I'll obey these rule. Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iQEcBAEBAgAGBQJL4vf/AAoJEATO+BI/yjfB8UQH/1RFuhSbshX6f7096nhQPsEv poHVmmYvEivhaE25PZkSSyBTVws4arN1IuBGerS2OKqBn+E3L09dHiSOxFG0qiTN wnNcfXZo/OuniSZIhcvBhkO0EgXsAhNacPDxrx+WjjQthnQPoM4bprVgfk6mHd+/ x8BXxxLwtbMawwf/QlA97/h2TpMab/Hmx4J3pV7dBLjDVzEmnPPiD0mMaqnffAW7 Z3nRNhydea014fUMUDr/wpIx0XOFJsIIHrPwWK5odQ1TUGxLqly4mBCwy//ydVLK bdUVnmU26j50zC6dQSvsO/tQEd4Katw/ITat2vLn5cA9i2KnWP4HMEGulGyW9JI= =19LB -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Thu May 6 17:29:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0955D1065675; Thu, 6 May 2010 17:29:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B7B208FC16; Thu, 6 May 2010 17:28:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46HSxLl040812; Thu, 6 May 2010 17:28:59 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46HSxvW040810; Thu, 6 May 2010 17:28:59 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005061728.o46HSxvW040810@svn.freebsd.org> From: Alan Cox Date: Thu, 6 May 2010 17:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207706 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 17:29:00 -0000 Author: alc Date: Thu May 6 17:28:59 2010 New Revision: 207706 URL: http://svn.freebsd.org/changeset/base/207706 Log: Update a comment to say that access to a page's wire count is now synchronized by the page lock. Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Thu May 6 17:06:36 2010 (r207705) +++ head/sys/vm/vm_page.h Thu May 6 17:28:59 2010 (r207706) @@ -113,7 +113,7 @@ struct vm_page { uint8_t order; /* index of the buddy queue */ uint8_t pool; u_short cow; /* page cow mapping count (Q) */ - u_int wire_count; /* wired down maps refs (Q) */ + u_int wire_count; /* wired down maps refs (P) */ short hold_count; /* page hold count (P) */ u_short oflags; /* page flags (O) */ u_char act_count; /* page usage count (Q) */ From owner-svn-src-head@FreeBSD.ORG Thu May 6 17:43:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D24B51065675; Thu, 6 May 2010 17:43:41 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C2A998FC17; Thu, 6 May 2010 17:43:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46Hhf7X044168; Thu, 6 May 2010 17:43:41 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46Hhfb7044164; Thu, 6 May 2010 17:43:41 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005061743.o46Hhfb7044164@svn.freebsd.org> From: Alan Cox Date: Thu, 6 May 2010 17:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207708 - in head/sys: kern net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 17:43:42 -0000 Author: alc Date: Thu May 6 17:43:41 2010 New Revision: 207708 URL: http://svn.freebsd.org/changeset/base/207708 Log: Remove page queues locking from all sf_buf_mext()-like functions. The page lock now suffices. Fix a couple nearby style violations. Modified: head/sys/kern/uipc_cow.c head/sys/kern/uipc_syscalls.c head/sys/net/bpf_zerocopy.c Modified: head/sys/kern/uipc_cow.c ============================================================================== --- head/sys/kern/uipc_cow.c Thu May 6 17:37:23 2010 (r207707) +++ head/sys/kern/uipc_cow.c Thu May 6 17:43:41 2010 (r207708) @@ -81,7 +81,6 @@ socow_iodone(void *addr, void *args) sf_buf_free(sf); /* remove COW mapping */ vm_page_lock(pp); - vm_page_lock_queues(); vm_page_cowclear(pp); vm_page_unwire(pp, 0); /* @@ -91,7 +90,6 @@ socow_iodone(void *addr, void *args) */ if (pp->wire_count == 0 && pp->object == NULL) vm_page_free(pp); - vm_page_unlock_queues(); vm_page_unlock(pp); socow_stats.iodone++; } @@ -147,9 +145,8 @@ socow_setup(struct mbuf *m0, struct uio * Allocate an sf buf */ sf = sf_buf_alloc(pp, SFB_CATCH); - if (!sf) { + if (sf == NULL) { vm_page_lock(pp); - vm_page_lock_queues(); vm_page_cowclear(pp); vm_page_unwire(pp, 0); /* @@ -159,7 +156,6 @@ socow_setup(struct mbuf *m0, struct uio */ if (pp->wire_count == 0 && pp->object == NULL) vm_page_free(pp); - vm_page_unlock_queues(); vm_page_unlock(pp); socow_stats.fail_sf_buf++; return(0); Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu May 6 17:37:23 2010 (r207707) +++ head/sys/kern/uipc_syscalls.c Thu May 6 17:43:41 2010 (r207708) @@ -1716,7 +1716,6 @@ sf_buf_mext(void *addr, void *args) m = sf_buf_page(args); sf_buf_free(args); vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); /* * Check for the object going away on us. This can @@ -1725,7 +1724,6 @@ sf_buf_mext(void *addr, void *args) */ if (m->wire_count == 0 && m->object == NULL) vm_page_free(m); - vm_page_unlock_queues(); vm_page_unlock(m); if (addr == NULL) return; @@ -2111,7 +2109,6 @@ retry_space: } if (error) { vm_page_lock(pg); - vm_page_lock_queues(); vm_page_unwire(pg, 0); /* * See if anyone else might know about @@ -2120,10 +2117,8 @@ retry_space: */ if (pg->wire_count == 0 && pg->valid == 0 && pg->busy == 0 && !(pg->oflags & VPO_BUSY) && - pg->hold_count == 0) { + pg->hold_count == 0) vm_page_free(pg); - } - vm_page_unlock_queues(); vm_page_unlock(pg); VM_OBJECT_UNLOCK(obj); if (error == EAGAIN) Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Thu May 6 17:37:23 2010 (r207707) +++ head/sys/net/bpf_zerocopy.c Thu May 6 17:43:41 2010 (r207708) @@ -113,11 +113,9 @@ zbuf_page_free(vm_page_t pp) { vm_page_lock(pp); - vm_page_lock_queues(); vm_page_unwire(pp, 0); if (pp->wire_count == 0 && pp->object == NULL) vm_page_free(pp); - vm_page_unlock_queues(); vm_page_unlock(pp); } From owner-svn-src-head@FreeBSD.ORG Thu May 6 17:53:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E25F31065670; Thu, 6 May 2010 17:53:04 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D28928FC13; Thu, 6 May 2010 17:53:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46Hr4vq046298; Thu, 6 May 2010 17:53:04 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46Hr4d0046296; Thu, 6 May 2010 17:53:04 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201005061753.o46Hr4d0046296@svn.freebsd.org> From: Bernhard Schmidt Date: Thu, 6 May 2010 17:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207709 - head/sys/dev/iwn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 17:53:05 -0000 Author: bschmidt Date: Thu May 6 17:53:04 2010 New Revision: 207709 URL: http://svn.freebsd.org/changeset/base/207709 Log: Add a workaround for a bug in the firmware regarding the transition from passive to active scans. Basicly disable it by increasing the amount packets to be received to an amount which can't be reached during dwell times. Approved by: rpaulo (mentor) MFC after: 3 days Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Thu May 6 17:43:41 2010 (r207708) +++ head/sys/dev/iwn/if_iwn.c Thu May 6 17:53:04 2010 (r207709) @@ -4730,7 +4730,7 @@ iwn_scan(struct iwn_softc *sc) chan->passive = htole16(78); else chan->passive = htole16(110); - hdr->crc_threshold = htole16(1); + hdr->crc_threshold = 0xffff; } else if (!(c->ic_flags & IEEE80211_CHAN_PASSIVE)) { chan->rf_gain = 0x28; chan->active = htole16(36); @@ -4743,7 +4743,7 @@ iwn_scan(struct iwn_softc *sc) chan->passive = htole16(88); else chan->passive = htole16(120); - hdr->crc_threshold = htole16(1); + hdr->crc_threshold = 0xffff; } DPRINTF(sc, IWN_DEBUG_STATE, From owner-svn-src-head@FreeBSD.ORG Thu May 6 17:55:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 905D7106566C; Thu, 6 May 2010 17:55:18 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-ew0-f224.google.com (mail-ew0-f224.google.com [209.85.219.224]) by mx1.freebsd.org (Postfix) with ESMTP id B7D798FC1F; Thu, 6 May 2010 17:55:17 +0000 (UTC) Received: by ewy24 with SMTP id 24so62109ewy.33 for ; Thu, 06 May 2010 10:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=OokrPnC0I+JkMNGwjd1GFamJWu2ZaXYi7bj8OXJcOdY=; b=HZeijsHxilpoeFR/8cfXwkXfKqgnzPVPAQmFOKhQOfAnznWambSLVyPRgVBg627Naz d6AgN8Ruko9d1OyPReilfpmqLYsvRolZV/7BQk9LNC6YFayuipmDlTpZO/reAEtGmsLk vpOinip22zcvE+bFHRlT0PCQEZZmB7k72pk9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=tmFRL0Iq0I3nKuiBip5He4sYJcKNZJNBzoWTOHXqHZ+lJ8yniFnplU4uD1MBGPNd5y Byot2Ffd5QmGaSxKQHB80efAiW4njziFhDH8W5QuAoe4QjqBG0L84nZbt66aJCitrtfW N9c7Ks/A3cWfdLqV6ydhCRRaCw+HnU2ooanHo= MIME-Version: 1.0 Received: by 10.213.46.133 with SMTP id j5mr3689856ebf.66.1273168511547; Thu, 06 May 2010 10:55:11 -0700 (PDT) Received: by 10.213.108.141 with HTTP; Thu, 6 May 2010 10:55:11 -0700 (PDT) In-Reply-To: <201005061753.o46Hr4d0046296@svn.freebsd.org> References: <201005061753.o46Hr4d0046296@svn.freebsd.org> Date: Thu, 6 May 2010 13:55:11 -0400 Message-ID: From: Ben Kaduk To: Bernhard Schmidt Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207709 - head/sys/dev/iwn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 17:55:18 -0000 On Thu, May 6, 2010 at 1:53 PM, Bernhard Schmidt wrote: > Author: bschmidt > Date: Thu May 6 17:53:04 2010 > New Revision: 207709 > URL: http://svn.freebsd.org/changeset/base/207709 > > Log: > Add a workaround for a bug in the firmware regarding the transition > from passive to active scans. Basicly disable it by increasing the > amount packets to be received to an amount which can't be reached > during dwell times. Is this expected to fix the firmware errors that have cropped up periodically for me? (Sorry for the lack of useful bug reports, etc.) Thanks, Ben Kaduk From owner-svn-src-head@FreeBSD.ORG Thu May 6 18:26:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02663106567C; Thu, 6 May 2010 18:26:58 +0000 (UTC) (envelope-from bschmidt@mx.techwires.net) Received: from mx.techwires.net (mx.techwires.net [79.140.39.242]) by mx1.freebsd.org (Postfix) with ESMTP id 6F8968FC1B; Thu, 6 May 2010 18:26:57 +0000 (UTC) Received: by mx.techwires.net (Postfix, from userid 1001) id 34FFC291A1; Thu, 6 May 2010 20:11:10 +0200 (CEST) Date: Thu, 6 May 2010 20:11:10 +0200 From: Bernhard Schmidt To: Ben Kaduk Message-ID: <20100506181110.GA6628@mx.techwires.net> References: <201005061753.o46Hr4d0046296@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r207709 - head/sys/dev/iwn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 18:26:58 -0000 On Thu, May 06, 2010 at 01:55:11PM -0400, Ben Kaduk wrote: > On Thu, May 6, 2010 at 1:53 PM, Bernhard Schmidt wrote: > > Author: bschmidt > > Date: Thu May 6 17:53:04 2010 > > New Revision: 207709 > > URL: http://svn.freebsd.org/changeset/base/207709 > > > > Log: > > Add a workaround for a bug in the firmware regarding the transition > > from passive to active scans. Basicly disable it by increasing the > > amount packets to be received to an amount which can't be reached > > during dwell times. > > Is this expected to fix the firmware errors that have cropped up > periodically for me? > (Sorry for the lack of useful bug reports, etc.) I'm not aware that this generated any firmware errors. For scans on certain channels (definitely those which require radar detection) the firmware scan command might return with an error code instead of the expected scan result though. Which made it pretty much impossible to connect on those channels. -- Bernhard From owner-svn-src-head@FreeBSD.ORG Thu May 6 18:43:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B57C91065670; Thu, 6 May 2010 18:43:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9AC768FC17; Thu, 6 May 2010 18:43:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46IhJ6h058011; Thu, 6 May 2010 18:43:19 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46IhJxk058006; Thu, 6 May 2010 18:43:19 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201005061843.o46IhJxk058006@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 6 May 2010 18:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207719 - in head/sys: fs/msdosfs fs/tmpfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 18:43:19 -0000 Author: trasz Date: Thu May 6 18:43:19 2010 New Revision: 207719 URL: http://svn.freebsd.org/changeset/base/207719 Log: Style fixes and removal of unneeded variable. Submitted by: bde@ Modified: head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/vfs_vnops.c head/sys/sys/vnode.h Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Thu May 6 18:43:00 2010 (r207718) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Thu May 6 18:43:19 2010 (r207719) @@ -652,7 +652,6 @@ msdosfs_write(ap) struct buf *bp; int ioflag = ap->a_ioflag; struct uio *uio = ap->a_uio; - struct thread *td = uio->uio_td; struct vnode *vp = ap->a_vp; struct vnode *thisvp; struct denode *dep = VTODE(vp); @@ -696,7 +695,7 @@ msdosfs_write(ap) /* * If they've exceeded their filesize limit, tell them about it. */ - if (vn_rlimit_fsize(vp, uio, td)) + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) return (EFBIG); /* Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Thu May 6 18:43:00 2010 (r207718) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Thu May 6 18:43:19 2010 (r207719) @@ -717,7 +717,6 @@ tmpfs_write(struct vop_write_args *v) struct vnode *vp = v->a_vp; struct uio *uio = v->a_uio; int ioflag = v->a_ioflag; - struct thread *td = uio->uio_td; boolean_t extended; int error = 0; @@ -747,7 +746,7 @@ tmpfs_write(struct vop_write_args *v) VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize) return (EFBIG); - if (vn_rlimit_fsize(vp, uio, td)) + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) return (EFBIG); extended = uio->uio_offset + uio->uio_resid > node->tn_size; Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu May 6 18:43:00 2010 (r207718) +++ head/sys/kern/vfs_vnops.c Thu May 6 18:43:19 2010 (r207719) @@ -1341,11 +1341,12 @@ vn_vget_ino(struct vnode *vp, ino_t ino, } int -vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, const struct thread *td) +vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, + const struct thread *td) { + if (vp->v_type != VREG || td == NULL) return (0); - PROC_LOCK(td->td_proc); if (uio->uio_offset + uio->uio_resid > lim_cur(td->td_proc, RLIMIT_FSIZE)) { @@ -1354,6 +1355,5 @@ vn_rlimit_fsize(const struct vnode *vp, return (EFBIG); } PROC_UNLOCK(td->td_proc); - return (0); } Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu May 6 18:43:00 2010 (r207718) +++ head/sys/sys/vnode.h Thu May 6 18:43:19 2010 (r207719) @@ -655,6 +655,8 @@ int vn_rdwr_inchunks(enum uio_rw rw, str size_t len, off_t offset, enum uio_seg segflg, int ioflg, struct ucred *active_cred, struct ucred *file_cred, size_t *aresid, struct thread *td); +int vn_rlimit_fsize(const struct vnode *vn, const struct uio *uio, + const struct thread *td); int vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred, struct ucred *file_cred, struct thread *td); int vn_start_write(struct vnode *vp, struct mount **mpp, int flags); @@ -670,6 +672,7 @@ int vn_extattr_rm(struct vnode *vp, int int vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp); + int vfs_cache_lookup(struct vop_lookup_args *ap); void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp); @@ -780,7 +783,6 @@ struct dirent; int vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off); int vfs_unixify_accmode(accmode_t *accmode); -int vn_rlimit_fsize(const struct vnode *vn, const struct uio *uio, const struct thread *td); #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Thu May 6 18:52:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D683B106566C; Thu, 6 May 2010 18:52:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C6BB18FC26; Thu, 6 May 2010 18:52:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46Iqf7Y060365; Thu, 6 May 2010 18:52:41 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46Iqf2s060363; Thu, 6 May 2010 18:52:41 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201005061852.o46Iqf2s060363@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 6 May 2010 18:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207725 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 18:52:41 -0000 Author: trasz Date: Thu May 6 18:52:41 2010 New Revision: 207725 URL: http://svn.freebsd.org/changeset/base/207725 Log: Avoid overflow. Submitted by: bde@ Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Thu May 6 18:51:47 2010 (r207724) +++ head/sys/kern/vfs_vnops.c Thu May 6 18:52:41 2010 (r207725) @@ -1348,7 +1348,7 @@ vn_rlimit_fsize(const struct vnode *vp, if (vp->v_type != VREG || td == NULL) return (0); PROC_LOCK(td->td_proc); - if (uio->uio_offset + uio->uio_resid > + if ((uoff_t)uio->uio_offset + uio->uio_resid > lim_cur(td->td_proc, RLIMIT_FSIZE)) { psignal(td->td_proc, SIGXFSZ); PROC_UNLOCK(td->td_proc); From owner-svn-src-head@FreeBSD.ORG Thu May 6 18:58:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 728ED106564A; Thu, 6 May 2010 18:58:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 611C68FC16; Thu, 6 May 2010 18:58:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46IwXiF061788; Thu, 6 May 2010 18:58:33 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46IwXwd061775; Thu, 6 May 2010 18:58:33 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005061858.o46IwXwd061775@svn.freebsd.org> From: Alan Cox Date: Thu, 6 May 2010 18:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207728 - in head/sys: fs/nfsclient fs/nwfs fs/smbfs kern nfsclient ufs/ffs vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 18:58:33 -0000 Author: alc Date: Thu May 6 18:58:32 2010 New Revision: 207728 URL: http://svn.freebsd.org/changeset/base/207728 Log: Eliminate page queues locking around most calls to vm_page_free(). Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/kern/kern_exec.c head/sys/nfsclient/nfs_bio.c head/sys/ufs/ffs/ffs_vnops.c head/sys/vm/device_pager.c head/sys/vm/sg_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_glue.c head/sys/vm/vm_object.c head/sys/vm/vnode_pager.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/fs/nfsclient/nfs_clbio.c Thu May 6 18:58:32 2010 (r207728) @@ -134,9 +134,7 @@ ncl_getpages(struct vop_getpages_args *a for (i = 0; i < npages; ++i) { if (i != ap->a_reqpage) { vm_page_lock(pages[i]); - vm_page_lock_queues(); vm_page_free(pages[i]); - vm_page_unlock_queues(); vm_page_unlock(pages[i]); } } @@ -177,9 +175,7 @@ ncl_getpages(struct vop_getpages_args *a for (i = 0; i < npages; ++i) { if (i != ap->a_reqpage) { vm_page_lock(pages[i]); - vm_page_lock_queues(); vm_page_free(pages[i]); - vm_page_unlock_queues(); vm_page_unlock(pages[i]); } } Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/fs/nwfs/nwfs_io.c Thu May 6 18:58:32 2010 (r207728) @@ -431,9 +431,7 @@ nwfs_getpages(ap) for (i = 0; i < npages; i++) { if (ap->a_reqpage != i) { vm_page_lock(pages[i]); - vm_page_lock_queues(); vm_page_free(pages[i]); - vm_page_unlock_queues(); vm_page_unlock(pages[i]); } } Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/fs/smbfs/smbfs_io.c Thu May 6 18:58:32 2010 (r207728) @@ -443,9 +443,7 @@ smbfs_getpages(ap) for (i = 0; i < npages; ++i) { if (i != reqpage) { vm_page_lock(pages[i]); - vm_page_lock_queues(); vm_page_free(pages[i]); - vm_page_unlock_queues(); vm_page_unlock(pages[i]); } } @@ -484,9 +482,7 @@ smbfs_getpages(ap) for (i = 0; i < npages; i++) { if (reqpage != i) { vm_page_lock(pages[i]); - vm_page_lock_queues(); vm_page_free(pages[i]); - vm_page_unlock_queues(); vm_page_unlock(pages[i]); } } Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/kern/kern_exec.c Thu May 6 18:58:32 2010 (r207728) @@ -948,11 +948,9 @@ exec_map_first_page(imgp) rv = vm_pager_get_pages(object, ma, initial_pagein, 0); ma[0] = vm_page_lookup(object, 0); if ((rv != VM_PAGER_OK) || (ma[0] == NULL)) { - if (ma[0]) { + if (ma[0] != NULL) { vm_page_lock(ma[0]); - vm_page_lock_queues(); vm_page_free(ma[0]); - vm_page_unlock_queues(); vm_page_unlock(ma[0]); } VM_OBJECT_UNLOCK(object); Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/nfsclient/nfs_bio.c Thu May 6 18:58:32 2010 (r207728) @@ -132,9 +132,7 @@ nfs_getpages(struct vop_getpages_args *a for (i = 0; i < npages; ++i) { if (i != ap->a_reqpage) { vm_page_lock(pages[i]); - vm_page_lock_queues(); vm_page_free(pages[i]); - vm_page_unlock_queues(); vm_page_unlock(pages[i]); } } @@ -175,9 +173,7 @@ nfs_getpages(struct vop_getpages_args *a for (i = 0; i < npages; ++i) { if (i != ap->a_reqpage) { vm_page_lock(pages[i]); - vm_page_lock_queues(); vm_page_free(pages[i]); - vm_page_unlock_queues(); vm_page_unlock(pages[i]); } } Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/ufs/ffs/ffs_vnops.c Thu May 6 18:58:32 2010 (r207728) @@ -850,9 +850,7 @@ ffs_getpages(ap) for (i = 0; i < pcount; i++) { if (i != ap->a_reqpage) { vm_page_lock(ap->a_m[i]); - vm_page_lock_queues(); vm_page_free(ap->a_m[i]); - vm_page_unlock_queues(); vm_page_unlock(ap->a_m[i]); } } Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/vm/device_pager.c Thu May 6 18:58:32 2010 (r207728) @@ -255,9 +255,7 @@ dev_pager_getpages(object, m, count, req for (i = 0; i < count; i++) { if (i != reqpage) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } } @@ -272,9 +270,7 @@ dev_pager_getpages(object, m, count, req TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, page, pageq); for (i = 0; i < count; i++) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } vm_page_insert(page, object, offset); Modified: head/sys/vm/sg_pager.c ============================================================================== --- head/sys/vm/sg_pager.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/vm/sg_pager.c Thu May 6 18:58:32 2010 (r207728) @@ -200,9 +200,7 @@ sg_pager_getpages(vm_object_t object, vm /* Free the original pages and insert this fake page into the object. */ for (i = 0; i < count; i++) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } vm_page_insert(page, object, offset); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/vm/vm_fault.c Thu May 6 18:58:32 2010 (r207728) @@ -164,9 +164,7 @@ unlock_and_deallocate(struct faultstate if (fs->object != fs->first_object) { VM_OBJECT_LOCK(fs->first_object); vm_page_lock(fs->first_m); - vm_page_lock_queues(); vm_page_free(fs->first_m); - vm_page_unlock_queues(); vm_page_unlock(fs->first_m); vm_object_pip_wakeup(fs->first_object); VM_OBJECT_UNLOCK(fs->first_object); @@ -348,9 +346,7 @@ RetryFault:; if (fs.object != fs.first_object) { VM_OBJECT_LOCK(fs.first_object); vm_page_lock(fs.first_m); - vm_page_lock_queues(); vm_page_free(fs.first_m); - vm_page_unlock_queues(); vm_page_unlock(fs.first_m); vm_object_pip_wakeup(fs.first_object); VM_OBJECT_UNLOCK(fs.first_object); @@ -638,9 +634,7 @@ vnode_locked: if (((fs.map != kernel_map) && (rv == VM_PAGER_ERROR)) || (rv == VM_PAGER_BAD)) { vm_page_lock(fs.m); - vm_page_lock_queues(); vm_page_free(fs.m); - vm_page_unlock_queues(); vm_page_unlock(fs.m); fs.m = NULL; unlock_and_deallocate(&fs); @@ -648,9 +642,7 @@ vnode_locked: } if (fs.object != fs.first_object) { vm_page_lock(fs.m); - vm_page_lock_queues(); vm_page_free(fs.m); - vm_page_unlock_queues(); vm_page_unlock(fs.m); fs.m = NULL; /* @@ -764,13 +756,11 @@ vnode_locked: * We don't chase down the shadow chain */ fs.object == fs.first_object->backing_object) { - vm_page_lock(fs.first_m); - vm_page_lock_queues(); /* * get rid of the unnecessary page */ + vm_page_lock(fs.first_m); vm_page_free(fs.first_m); - vm_page_unlock_queues(); vm_page_unlock(fs.first_m); /* * grab the page and put it into the Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/vm/vm_glue.c Thu May 6 18:58:32 2010 (r207728) @@ -258,9 +258,7 @@ vm_imgact_hold_page(vm_object_t object, goto out; if (rv != VM_PAGER_OK) { vm_page_lock(m); - vm_page_lock_queues(); vm_page_free(m); - vm_page_unlock_queues(); vm_page_unlock(m); m = NULL; goto out; @@ -437,10 +435,8 @@ vm_thread_stack_dispose(vm_object_t ksob if (m == NULL) panic("vm_thread_dispose: kstack already missing?"); vm_page_lock(m); - vm_page_lock_queues(); vm_page_unwire(m, 0); vm_page_free(m); - vm_page_unlock_queues(); vm_page_unlock(m); } VM_OBJECT_UNLOCK(ksobj); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/vm/vm_object.c Thu May 6 18:58:32 2010 (r207728) @@ -2046,9 +2046,7 @@ vm_object_populate(vm_object_t object, v break; if (rv != VM_PAGER_OK) { vm_page_lock(m); - vm_page_lock_queues(); vm_page_free(m); - vm_page_unlock_queues(); vm_page_unlock(m); break; } Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Thu May 6 18:53:43 2010 (r207727) +++ head/sys/vm/vnode_pager.c Thu May 6 18:58:32 2010 (r207728) @@ -725,9 +725,7 @@ vnode_pager_generic_getpages(vp, m, byte for (i = 0; i < count; i++) if (i != reqpage) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } PCPU_INC(cnt.v_vnodein); @@ -740,9 +738,7 @@ vnode_pager_generic_getpages(vp, m, byte for (i = 0; i < count; i++) if (i != reqpage) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } VM_OBJECT_UNLOCK(object); @@ -759,9 +755,7 @@ vnode_pager_generic_getpages(vp, m, byte for (i = 0; i < count; i++) if (i != reqpage) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } VM_OBJECT_UNLOCK(object); @@ -780,9 +774,7 @@ vnode_pager_generic_getpages(vp, m, byte for (i = 0; i < count; i++) if (i != reqpage) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } VM_OBJECT_UNLOCK(object); @@ -795,9 +787,7 @@ vnode_pager_generic_getpages(vp, m, byte for (i = 0; i < count; i++) if (i != reqpage) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } VM_OBJECT_UNLOCK(object); @@ -821,9 +811,7 @@ vnode_pager_generic_getpages(vp, m, byte for (; i < count; i++) if (i != reqpage) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } VM_OBJECT_UNLOCK(object); @@ -840,9 +828,7 @@ vnode_pager_generic_getpages(vp, m, byte (uintmax_t)object->un_pager.vnp.vnp_size); } vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); VM_OBJECT_UNLOCK(object); runend = i + 1; @@ -854,9 +840,7 @@ vnode_pager_generic_getpages(vp, m, byte VM_OBJECT_LOCK(object); for (j = i; j < runend; j++) { vm_page_lock(m[j]); - vm_page_lock_queues(); vm_page_free(m[j]); - vm_page_unlock_queues(); vm_page_unlock(m[j]); } VM_OBJECT_UNLOCK(object); @@ -865,9 +849,7 @@ vnode_pager_generic_getpages(vp, m, byte VM_OBJECT_LOCK(object); for (i = first + runpg; i < count; i++) { vm_page_lock(m[i]); - vm_page_lock_queues(); vm_page_free(m[i]); - vm_page_unlock_queues(); vm_page_unlock(m[i]); } VM_OBJECT_UNLOCK(object); From owner-svn-src-head@FreeBSD.ORG Thu May 6 19:22:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDC251065677; Thu, 6 May 2010 19:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BCED48FC0C; Thu, 6 May 2010 19:22:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46JMouR067220; Thu, 6 May 2010 19:22:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46JMoWr067215; Thu, 6 May 2010 19:22:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005061922.o46JMoWr067215@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 6 May 2010 19:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207729 - in head/sys: fs/devfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 19:22:50 -0000 Author: kib Date: Thu May 6 19:22:50 2010 New Revision: 207729 URL: http://svn.freebsd.org/changeset/base/207729 Log: Add MAKEDEV_NOWAIT flag to make_dev_credf(9), to create a device node in a no-sleep context. If resource allocation cannot be done without sleep, make_dev_credf() fails and returns NULL. Reviewed by: jh MFC after: 2 weeks Modified: head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_int.h head/sys/kern/kern_conf.c head/sys/sys/conf.h Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Thu May 6 18:58:32 2010 (r207728) +++ head/sys/fs/devfs/devfs_devs.c Thu May 6 19:22:50 2010 (r207729) @@ -115,17 +115,21 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev 0, sizeof(struct cdev_priv), "sizeof(struct cdev_priv)"); struct cdev * -devfs_alloc(void) +devfs_alloc(int flags) { struct cdev_priv *cdp; struct cdev *cdev; struct timespec ts; - cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO | M_WAITOK); + cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO | + ((flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK)); + if (cdp == NULL) + return (NULL); cdp->cdp_dirents = &cdp->cdp_dirent0; cdp->cdp_dirent0 = NULL; cdp->cdp_maxdirent = 0; + cdp->cdp_inode = 0; cdev = &cdp->cdp_c; @@ -133,6 +137,7 @@ devfs_alloc(void) LIST_INIT(&cdev->si_children); vfs_timestamp(&ts); cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts; + cdev->si_cred = NULL; return (cdev); } Modified: head/sys/fs/devfs/devfs_int.h ============================================================================== --- head/sys/fs/devfs/devfs_int.h Thu May 6 18:58:32 2010 (r207728) +++ head/sys/fs/devfs/devfs_int.h Thu May 6 19:22:50 2010 (r207729) @@ -70,7 +70,7 @@ struct cdev_priv { #define cdev2priv(c) member2struct(cdev_priv, cdp_c, c) -struct cdev *devfs_alloc(void); +struct cdev *devfs_alloc(int); void devfs_free(struct cdev *); void devfs_create(struct cdev *dev); void devfs_destroy(struct cdev *dev); Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Thu May 6 18:58:32 2010 (r207728) +++ head/sys/kern/kern_conf.c Thu May 6 19:22:50 2010 (r207729) @@ -505,7 +505,7 @@ giant_mmap_single(struct cdev *dev, vm_o } static void -notify(struct cdev *dev, const char *ev) +notify(struct cdev *dev, const char *ev, int flags) { static const char prefix[] = "cdev="; char *data; @@ -514,7 +514,8 @@ notify(struct cdev *dev, const char *ev) if (cold) return; namelen = strlen(dev->si_name); - data = malloc(namelen + sizeof(prefix), M_TEMP, M_NOWAIT); + data = malloc(namelen + sizeof(prefix), M_TEMP, + (flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK); if (data == NULL) return; memcpy(data, prefix, sizeof(prefix) - 1); @@ -524,17 +525,17 @@ notify(struct cdev *dev, const char *ev) } static void -notify_create(struct cdev *dev) +notify_create(struct cdev *dev, int flags) { - notify(dev, "CREATE"); + notify(dev, "CREATE", flags); } static void notify_destroy(struct cdev *dev) { - notify(dev, "DESTROY"); + notify(dev, "DESTROY", MAKEDEV_WAITOK); } static struct cdev * @@ -572,24 +573,27 @@ fini_cdevsw(struct cdevsw *devsw) devsw->d_flags &= ~D_INIT; } -static void -prep_cdevsw(struct cdevsw *devsw) +static int +prep_cdevsw(struct cdevsw *devsw, int flags) { struct cdevsw *dsw2; mtx_assert(&devmtx, MA_OWNED); if (devsw->d_flags & D_INIT) - return; + return (1); if (devsw->d_flags & D_NEEDGIANT) { dev_unlock(); - dsw2 = malloc(sizeof *dsw2, M_DEVT, M_WAITOK); + dsw2 = malloc(sizeof *dsw2, M_DEVT, + (flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK); dev_lock(); + if (dsw2 == NULL && !(devsw->d_flags & D_INIT)) + return (0); } else dsw2 = NULL; if (devsw->d_flags & D_INIT) { if (dsw2 != NULL) cdevsw_free_devlocked(dsw2); - return; + return (1); } if (devsw->d_version != D_VERSION_03) { @@ -647,6 +651,7 @@ prep_cdevsw(struct cdevsw *devsw) if (dsw2 != NULL) cdevsw_free_devlocked(dsw2); + return (1); } static struct cdev * @@ -657,9 +662,15 @@ make_dev_credv(int flags, struct cdevsw struct cdev *dev; int i; - dev = devfs_alloc(); + dev = devfs_alloc(flags); + if (dev == NULL) + return (NULL); dev_lock(); - prep_cdevsw(devsw); + if (!prep_cdevsw(devsw, flags)) { + dev_unlock(); + devfs_free(dev); + return (NULL); + } dev = newdev(devsw, unit, dev); if (flags & MAKEDEV_REF) dev_refl(dev); @@ -686,8 +697,6 @@ make_dev_credv(int flags, struct cdevsw dev->si_flags |= SI_NAMED; if (cr != NULL) dev->si_cred = crhold(cr); - else - dev->si_cred = NULL; dev->si_uid = uid; dev->si_gid = gid; dev->si_mode = mode; @@ -696,7 +705,7 @@ make_dev_credv(int flags, struct cdevsw clean_unrhdrl(devfs_inos); dev_unlock_and_free(); - notify_create(dev); + notify_create(dev, flags); return (dev); } @@ -771,7 +780,7 @@ make_dev_alias(struct cdev *pdev, const int i; KASSERT(pdev != NULL, ("NULL pdev")); - dev = devfs_alloc(); + dev = devfs_alloc(MAKEDEV_WAITOK); dev_lock(); dev->si_flags |= SI_ALIAS; dev->si_flags |= SI_NAMED; @@ -788,7 +797,7 @@ make_dev_alias(struct cdev *pdev, const clean_unrhdrl(devfs_inos); dev_unlock(); - notify_create(dev); + notify_create(dev, MAKEDEV_WAITOK); return (dev); } @@ -973,9 +982,9 @@ clone_create(struct clonedevs **cdp, str * the end of the list. */ unit = *up; - ndev = devfs_alloc(); + ndev = devfs_alloc(MAKEDEV_WAITOK); dev_lock(); - prep_cdevsw(csw); + prep_cdevsw(csw, MAKEDEV_WAITOK); low = extra; de = dl = NULL; cd = *cdp; Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Thu May 6 18:58:32 2010 (r207728) +++ head/sys/sys/conf.h Thu May 6 19:22:50 2010 (r207729) @@ -262,8 +262,10 @@ struct cdev *make_dev(struct cdevsw *_de struct cdev *make_dev_cred(struct cdevsw *_devsw, int _unit, struct ucred *_cr, uid_t _uid, gid_t _gid, int _perms, const char *_fmt, ...) __printflike(7, 8); -#define MAKEDEV_REF 0x1 -#define MAKEDEV_WHTOUT 0x2 +#define MAKEDEV_REF 0x1 +#define MAKEDEV_WHTOUT 0x2 +#define MAKEDEV_NOWAIT 0x4 +#define MAKEDEV_WAITOK 0x8 struct cdev *make_dev_credf(int _flags, struct cdevsw *_devsw, int _unit, struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode, From owner-svn-src-head@FreeBSD.ORG Thu May 6 19:23:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A49DB1065672; Thu, 6 May 2010 19:23:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 94A768FC08; Thu, 6 May 2010 19:23:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46JNnAC067456; Thu, 6 May 2010 19:23:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46JNnuX067454; Thu, 6 May 2010 19:23:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005061923.o46JNnuX067454@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 6 May 2010 19:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207730 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 19:23:49 -0000 Author: kib Date: Thu May 6 19:23:49 2010 New Revision: 207730 URL: http://svn.freebsd.org/changeset/base/207730 Log: Document MAKEDEV_NOWAIT flag for make_dev_credf(9). Reviewed by: jh MFC after: 2 weeks Modified: head/share/man/man9/make_dev.9 Modified: head/share/man/man9/make_dev.9 ============================================================================== --- head/share/man/man9/make_dev.9 Thu May 6 19:22:50 2010 (r207729) +++ head/share/man/man9/make_dev.9 Thu May 6 19:23:49 2010 (r207730) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 28, 2008 +.Dd May 6, 2010 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -133,9 +133,18 @@ The following values are currently accep .Pp .Bd -literal -offset indent -compact MAKEDEV_REF reference the created device +MAKEDEV_NOWAIT do not sleep, may return NULL +MAKEDEV_WAITOK allow the function to sleep to satisfy malloc .Ed .Pp The +.Dv MAKEDEV_WAITOK +flag is assumed if none of +.Dv MAKEDEV_WAITOK , +.Dv MAKEDEV_NOWAIT +is specified. +.Pp +The .Xr dev_clone 9 event handler shall specify .Dv MAKEDEV_REF From owner-svn-src-head@FreeBSD.ORG Thu May 6 20:54:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D5741106566B; Thu, 6 May 2010 20:54:19 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C51FD8FC13; Thu, 6 May 2010 20:54:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46KsJBK087524; Thu, 6 May 2010 20:54:19 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46KsJOu087523; Thu, 6 May 2010 20:54:19 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201005062054.o46KsJOu087523@svn.freebsd.org> From: Fabien Thomas Date: Thu, 6 May 2010 20:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207731 - head/usr.sbin/pmcstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 20:54:19 -0000 Author: fabient Date: Thu May 6 20:54:19 2010 New Revision: 207731 URL: http://svn.freebsd.org/changeset/base/207731 Log: Exclude undefined symbol from ELF file when doing function resolve. MFC after: 3 days Modified: head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat_log.c Thu May 6 19:23:49 2010 (r207730) +++ head/usr.sbin/pmcstat/pmcstat_log.c Thu May 6 20:54:19 2010 (r207731) @@ -539,6 +539,8 @@ pmcstat_image_add_symbols(struct pmcstat return; if (GELF_ST_TYPE(sym.st_info) != STT_FUNC) continue; + if (sym.st_shndx == STN_UNDEF) + continue; if (!firsttime && pmcstat_symbol_search(image, sym.st_value)) continue; /* We've seen this symbol already. */ From owner-svn-src-head@FreeBSD.ORG Thu May 6 20:58:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88714106566B; Thu, 6 May 2010 20:58:23 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 77E8D8FC14; Thu, 6 May 2010 20:58:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46KwNth088460; Thu, 6 May 2010 20:58:23 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46KwNjg088458; Thu, 6 May 2010 20:58:23 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201005062058.o46KwNjg088458@svn.freebsd.org> From: Fabien Thomas Date: Thu, 6 May 2010 20:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207732 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 20:58:23 -0000 Author: fabient Date: Thu May 6 20:58:23 2010 New Revision: 207732 URL: http://svn.freebsd.org/changeset/base/207732 Log: Fix an invalid parameter detected by INVARIANT and confirmed by r193272. Modified: head/sys/netgraph/ng_ksocket.c Modified: head/sys/netgraph/ng_ksocket.c ============================================================================== --- head/sys/netgraph/ng_ksocket.c Thu May 6 20:54:19 2010 (r207731) +++ head/sys/netgraph/ng_ksocket.c Thu May 6 20:58:23 2010 (r207732) @@ -1272,7 +1272,7 @@ ng_ksocket_finish_accept(priv_p priv) soupcall_set(so, SO_RCV, ng_ksocket_incoming, node); SOCKBUF_UNLOCK(&so->so_rcv); SOCKBUF_LOCK(&so->so_snd); - soupcall_set(so, SO_RCV, ng_ksocket_incoming, node); + soupcall_set(so, SO_SND, ng_ksocket_incoming, node); SOCKBUF_UNLOCK(&so->so_snd); /* Fill in the response data and send it or return it to the caller */ From owner-svn-src-head@FreeBSD.ORG Thu May 6 21:34:04 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 784DE106567F; Thu, 6 May 2010 21:34:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id E5FE68FC2B; Thu, 6 May 2010 21:34:03 +0000 (UTC) Received: from c122-106-171-133.carlnfd1.nsw.optusnet.com.au (c122-106-171-133.carlnfd1.nsw.optusnet.com.au [122.106.171.133]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o46LXeMK004342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 7 May 2010 07:33:43 +1000 Date: Fri, 7 May 2010 07:33:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: d@delphij.net In-Reply-To: <4BE2F7FF.9070902@delphij.net> Message-ID: <20100507073128.Q19830@delplex.bde.org> References: <201005052124.o45LOJES067973@svn.freebsd.org> <20100506105825.B18998@delplex.bde.org> <4BE2F7FF.9070902@delphij.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI , Bruce Evans Subject: Re: svn commit: r207677 - head/usr.bin/find X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 21:34:04 -0000 On Thu, 6 May 2010, Xin LI wrote: > On 2010/05/05 18:00, Bruce Evans wrote: >> On Wed, 5 May 2010, Xin LI wrote: >> >>> Log: >>> Move SCCS tags to comments as they were already #if 0'ed. >> >> This is explicitly disrecommended in style(9): >> ... > > Sorry for that. I thought that the style(9) approach actually creates > more diffs but I'll obey these rule. Thanks. The rule is to minimise diffs. It doesn't quite do that, but at least it prevents the VCS id itself showing up on changed lines (or at all in plain diffs). Bruce From owner-svn-src-head@FreeBSD.ORG Thu May 6 21:57:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B998B106566B; Thu, 6 May 2010 21:57:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8F9828FC0C; Thu, 6 May 2010 21:57:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46LvcSX001559; Thu, 6 May 2010 21:57:38 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46Lvc4m001557; Thu, 6 May 2010 21:57:38 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201005062157.o46Lvc4m001557@svn.freebsd.org> From: Xin LI Date: Thu, 6 May 2010 21:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207733 - head/usr.bin/rpcgen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 21:57:38 -0000 Author: delphij Date: Thu May 6 21:57:38 2010 New Revision: 207733 URL: http://svn.freebsd.org/changeset/base/207733 Log: Plug a memory leak. MFC after: 2 weeks Modified: head/usr.bin/rpcgen/rpc_cout.c Modified: head/usr.bin/rpcgen/rpc_cout.c ============================================================================== --- head/usr.bin/rpcgen/rpc_cout.c Thu May 6 20:58:23 2010 (r207732) +++ head/usr.bin/rpcgen/rpc_cout.c Thu May 6 21:57:38 2010 (r207733) @@ -489,6 +489,7 @@ inline_struct(definition *def, int flag) } size = 0; i = 0; + free(sizestr); sizestr = NULL; print_stat(indent + 1, &dl->decl); } From owner-svn-src-head@FreeBSD.ORG Thu May 6 22:06:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A5F31065755; Thu, 6 May 2010 22:06:15 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 42CE08FC19; Thu, 6 May 2010 22:06:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46M6FjU003517; Thu, 6 May 2010 22:06:15 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46M6FXB003515; Thu, 6 May 2010 22:06:15 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005062206.o46M6FXB003515@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 6 May 2010 22:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207734 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 22:06:15 -0000 Author: jilles Date: Thu May 6 22:06:14 2010 New Revision: 207734 URL: http://svn.freebsd.org/changeset/base/207734 Log: sigaltstack(2): document some modernizations: * un-document 'struct sigaltstack' tag for stack_t as this is BSD-specific; this doesn't seem useful enough to document as such * alternate stacks are per thread, not per process * update error codes to what the kernel does and POSIX requires MFC after: 1 week Modified: head/lib/libc/sys/sigaltstack.2 Modified: head/lib/libc/sys/sigaltstack.2 ============================================================================== --- head/lib/libc/sys/sigaltstack.2 Thu May 6 21:57:38 2010 (r207733) +++ head/lib/libc/sys/sigaltstack.2 Thu May 6 22:06:14 2010 (r207734) @@ -28,7 +28,7 @@ .\" @(#)sigaltstack.2 8.2 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd May 1, 1995 +.Dd May 6, 2010 .Dt SIGALTSTACK 2 .Os .Sh NAME @@ -39,7 +39,7 @@ .Sh SYNOPSIS .In signal.h .Bd -literal -typedef struct sigaltstack { +typedef struct { char *ss_sp; size_t ss_size; int ss_flags; @@ -51,25 +51,25 @@ typedef struct sigaltstack { The .Fn sigaltstack system call -allows users to define an alternate stack on which signals -are to be processed. +allows defining an alternate stack on which signals +are to be processed for the current thread. If .Fa ss is non-zero, it specifies a pointer to and the size of a .Em "signal stack" -on which to deliver signals, -and tells the system if the process is currently executing -on that stack. +on which to deliver signals. When a signal's action indicates its handler should execute on the signal stack (specified with a .Xr sigaction 2 system call), the system checks to see -if the process is currently executing on that stack. -If the process is not currently executing on the signal stack, +if the thread is currently executing on that stack. +If the thread is not currently executing on the signal stack, the system arranges a switch to the signal stack for the duration of the signal handler's execution. .Pp +An active stack cannot be modified. +.Pp If .Dv SS_DISABLE is set in @@ -78,12 +78,6 @@ is set in and .Fa ss_size are ignored and the signal stack will be disabled. -Trying to disable an active stack will cause -.Fn sigaltstack -to return -1 with -.Va errno -set to -.Er EINVAL . A disabled stack will cause all signals to be taken on the regular user stack. If the stack is later re-enabled then all signals that were specified @@ -96,7 +90,7 @@ The .Fa ss_flags field will contain the value .Dv SS_ONSTACK -if the process is currently on a signal stack and +if the thread is currently on a signal stack and .Dv SS_DISABLE if the signal stack is currently disabled. .Sh NOTES @@ -146,8 +140,12 @@ or .Fa oss points to memory that is not a valid part of the process address space. +.It Bq Er EPERM +An attempt was made to modify an active stack. .It Bq Er EINVAL -An attempt was made to disable an active stack. +The +.Fa ss_flags +field was invalid. .It Bq Er ENOMEM Size of alternate stack area is less than or equal to .Dv MINSIGSTKSZ . From owner-svn-src-head@FreeBSD.ORG Thu May 6 22:49:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C76CA106566B; Thu, 6 May 2010 22:49:54 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B56148FC17; Thu, 6 May 2010 22:49:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46MnsfN013119; Thu, 6 May 2010 22:49:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46Mnser013107; Thu, 6 May 2010 22:49:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005062249.o46Mnser013107@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 6 May 2010 22:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207735 - in head: lib/libc/gen lib/libc/sys usr.bin/lastcomm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 22:49:54 -0000 Author: jilles Date: Thu May 6 22:49:54 2010 New Revision: 207735 URL: http://svn.freebsd.org/changeset/base/207735 Log: Update xrefs from 4.3BSD to modern signal functions in various man pages. sigvec(2) references have been updated to sigaction(2), sigsetmask(2) and sigblock(2) to sigprocmask(2), sigpause(2) to sigsuspend(2). Some legacy man pages still refer to them, that is OK. Modified: head/lib/libc/gen/alarm.3 head/lib/libc/gen/siginterrupt.3 head/lib/libc/gen/ualarm.3 head/lib/libc/sys/execve.2 head/lib/libc/sys/fcntl.2 head/lib/libc/sys/getitimer.2 head/lib/libc/sys/getrlimit.2 head/lib/libc/sys/sigaction.2 head/lib/libc/sys/sigreturn.2 head/lib/libc/sys/vfork.2 head/usr.bin/lastcomm/lastcomm.1 Modified: head/lib/libc/gen/alarm.3 ============================================================================== --- head/lib/libc/gen/alarm.3 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/gen/alarm.3 Thu May 6 22:49:54 2010 (r207735) @@ -76,8 +76,7 @@ If no alarm is currently set, the return .Sh SEE ALSO .Xr setitimer 2 , .Xr sigaction 2 , -.Xr sigpause 2 , -.Xr sigvec 2 , +.Xr sigsuspend 2 , .Xr signal 3 , .Xr sleep 3 , .Xr ualarm 3 , Modified: head/lib/libc/gen/siginterrupt.3 ============================================================================== --- head/lib/libc/gen/siginterrupt.3 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/gen/siginterrupt.3 Thu May 6 22:49:54 2010 (r207735) @@ -109,9 +109,8 @@ is not a valid signal number. .El .Sh SEE ALSO .Xr sigaction 2 , -.Xr sigblock 2 , -.Xr sigpause 2 , -.Xr sigsetmask 2 , +.Xr sigprocmask 2 , +.Xr sigsuspend 2 , .Xr signal 3 .Sh HISTORY The Modified: head/lib/libc/gen/ualarm.3 ============================================================================== --- head/lib/libc/gen/ualarm.3 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/gen/ualarm.3 Thu May 6 22:49:54 2010 (r207735) @@ -84,8 +84,8 @@ A microsecond is 0.000001 seconds. .Sh SEE ALSO .Xr getitimer 2 , .Xr setitimer 2 , -.Xr sigpause 2 , -.Xr sigvec 2 , +.Xr sigaction 2 , +.Xr sigsuspend 2 , .Xr alarm 3 , .Xr signal 3 , .Xr sleep 3 , Modified: head/lib/libc/sys/execve.2 ============================================================================== --- head/lib/libc/sys/execve.2 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/sys/execve.2 Thu May 6 22:49:54 2010 (r207735) @@ -189,8 +189,8 @@ the calling process: .It interval timers Ta see Xr getitimer 2 .It resource limits Ta see Xr getrlimit 2 .It file mode mask Ta see Xr umask 2 -.It signal mask Ta see Xr sigvec 2 , -.Xr sigsetmask 2 +.It signal mask Ta see Xr sigaction 2 , +.Xr sigprocmask 2 .El .Pp When a program is executed as a result of an Modified: head/lib/libc/sys/fcntl.2 ============================================================================== --- head/lib/libc/sys/fcntl.2 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/sys/fcntl.2 Thu May 6 22:49:54 2010 (r207735) @@ -618,7 +618,7 @@ for the reasons as stated in .Xr flock 2 , .Xr getdtablesize 2 , .Xr open 2 , -.Xr sigvec 2 , +.Xr sigaction 2 , .Xr lockf 3 , .Xr tcgetpgrp 3 , .Xr tcsetpgrp 3 Modified: head/lib/libc/sys/getitimer.2 ============================================================================== --- head/lib/libc/sys/getitimer.2 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/sys/getitimer.2 Thu May 6 22:49:54 2010 (r207735) @@ -171,7 +171,7 @@ to be handled. .Sh SEE ALSO .Xr gettimeofday 2 , .Xr select 2 , -.Xr sigvec 2 , +.Xr sigaction 2 , .Xr clocks 7 .Sh HISTORY The Modified: head/lib/libc/sys/getrlimit.2 ============================================================================== --- head/lib/libc/sys/getrlimit.2 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/sys/getrlimit.2 Thu May 6 22:49:54 2010 (r207735) @@ -193,7 +193,7 @@ raised the maximum limit value, and the .Xr quota 1 , .Xr quotactl 2 , .Xr sigaltstack 2 , -.Xr sigvec 2 , +.Xr sigaction 2 , .Xr sysctl 3 , .Xr ulimit 3 .Sh HISTORY Modified: head/lib/libc/sys/sigaction.2 ============================================================================== --- head/lib/libc/sys/sigaction.2 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/sys/sigaction.2 Thu May 6 22:49:54 2010 (r207735) @@ -609,13 +609,9 @@ or .Xr kill 2 , .Xr ptrace 2 , .Xr sigaltstack 2 , -.Xr sigblock 2 , -.Xr sigpause 2 , .Xr sigpending 2 , .Xr sigprocmask 2 , -.Xr sigsetmask 2 , .Xr sigsuspend 2 , -.Xr sigvec 2 , .Xr wait 2 , .Xr fpsetmask 3 , .Xr setjmp 3 , Modified: head/lib/libc/sys/sigreturn.2 ============================================================================== --- head/lib/libc/sys/sigreturn.2 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/sys/sigreturn.2 Thu May 6 22:49:54 2010 (r207735) @@ -83,7 +83,7 @@ The process status longword is invalid o raise the privilege level of the process. .El .Sh SEE ALSO -.Xr sigvec 2 , +.Xr sigaction 2 , .Xr setjmp 3 , .Xr ucontext 3 .Sh HISTORY Modified: head/lib/libc/sys/vfork.2 ============================================================================== --- head/lib/libc/sys/vfork.2 Thu May 6 22:06:14 2010 (r207734) +++ head/lib/libc/sys/vfork.2 Thu May 6 22:49:54 2010 (r207735) @@ -104,7 +104,7 @@ Same as for .Xr _exit 2 , .Xr fork 2 , .Xr rfork 2 , -.Xr sigvec 2 , +.Xr sigaction 2 , .Xr wait 2 , .Xr exit 3 .Sh HISTORY Modified: head/usr.bin/lastcomm/lastcomm.1 ============================================================================== --- head/usr.bin/lastcomm/lastcomm.1 Thu May 6 22:06:14 2010 (r207734) +++ head/usr.bin/lastcomm/lastcomm.1 Thu May 6 22:49:54 2010 (r207735) @@ -168,7 +168,7 @@ while will print details of each terminating command. .Sh SEE ALSO .Xr last 1 , -.Xr sigvec 2 , +.Xr sigaction 2 , .Xr acct 5 , .Xr core 5 .Sh HISTORY From owner-svn-src-head@FreeBSD.ORG Fri May 7 00:41:13 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 70466106566B; Fri, 7 May 2010 00:41:13 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 5C13F8FC1C; Fri, 7 May 2010 00:41:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o470fDU2037414; Fri, 7 May 2010 00:41:13 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o470fDOU037408; Fri, 7 May 2010 00:41:13 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201005070041.o470fDOU037408@svn.freebsd.org> From: Kirk McKusick Date: Fri, 7 May 2010 00:41:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207736 - in head: contrib/top lib/libc/sys lib/libutil libexec/rpc.rquotad sbin/quotacheck sys/ufs/ufs usr.bin/quota usr.sbin/edquota usr.sbin/quotaon usr.sbin/repquota X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 00:41:13 -0000 Author: mckusick Date: Fri May 7 00:41:12 2010 New Revision: 207736 URL: http://svn.freebsd.org/changeset/base/207736 Log: Merger of the quota64 project into head. This joint work of Dag-Erling Smørgrav and myself updates the FFS quota system to support both traditional 32-bit and new 64-bit quotas (for those of you who want to put 2+Tb quotas on your users). By default quotas are not compiled into the kernel. To include them in your kernel configuration you need to specify: options QUOTA # Enable FFS quotas If you are already running with the current 32-bit quotas, they should continue to work just as they have in the past. If you wish to convert to using 64-bit quotas, use `quotacheck -c 64'; if you wish to revert from 64-bit quotas back to 32-bit quotas, use `quotacheck -c 32'. There is a new library of functions to simplify the use of the quota system, do `man quotafile' for details. If your application is currently using the quotactl(2), it is highly recommended that you convert your application to use the quotafile interface. Note that existing binaries will continue to work. Special thanks to John Kozubik of rsync.net for getting me interested in pursuing 64-bit quota support and for funding part of my development time on this project. Added: head/lib/libutil/quotafile.3 - copied unchanged from r207707, projects/quota64/lib/libutil/quotafile.3 head/lib/libutil/quotafile.c - copied unchanged from r207707, projects/quota64/lib/libutil/quotafile.c Modified: head/lib/libc/sys/quotactl.2 head/lib/libutil/Makefile head/lib/libutil/libutil.h head/libexec/rpc.rquotad/Makefile head/libexec/rpc.rquotad/rquotad.c head/sbin/quotacheck/Makefile head/sbin/quotacheck/preen.c head/sbin/quotacheck/quotacheck.8 head/sbin/quotacheck/quotacheck.c head/sbin/quotacheck/quotacheck.h head/sys/ufs/ufs/quota.h head/sys/ufs/ufs/ufs_quota.c head/sys/ufs/ufs/ufs_vfsops.c head/sys/ufs/ufs/ufsmount.h head/usr.bin/quota/Makefile head/usr.bin/quota/quota.c head/usr.sbin/edquota/Makefile head/usr.sbin/edquota/edquota.8 head/usr.sbin/edquota/edquota.c head/usr.sbin/quotaon/Makefile head/usr.sbin/quotaon/quotaon.c head/usr.sbin/repquota/Makefile head/usr.sbin/repquota/repquota.8 head/usr.sbin/repquota/repquota.c Directory Properties: head/ (props changed) head/cddl/contrib/opensolaris/ (props changed) head/contrib/bind9/ (props changed) head/contrib/ee/ (props changed) head/contrib/expat/ (props changed) head/contrib/file/ (props changed) head/contrib/gdb/ (props changed) head/contrib/gdtoa/ (props changed) head/contrib/gnu-sort/ (props changed) head/contrib/groff/ (props changed) head/contrib/less/ (props changed) head/contrib/libpcap/ (props changed) head/contrib/ncurses/ (props changed) head/contrib/netcat/ (props changed) head/contrib/ntp/ (props changed) head/contrib/one-true-awk/ (props changed) head/contrib/openbsm/ (props changed) head/contrib/openpam/ (props changed) head/contrib/pf/ (props changed) head/contrib/sendmail/ (props changed) head/contrib/tcpdump/ (props changed) head/contrib/tcsh/ (props changed) head/contrib/top/ (props changed) head/contrib/top/install-sh (props changed) head/contrib/tzcode/stdtime/ (props changed) head/contrib/tzcode/zic/ (props changed) head/contrib/tzdata/ (props changed) head/contrib/wpa/ (props changed) head/crypto/openssh/ (props changed) head/crypto/openssl/ (props changed) head/lib/libc/ (props changed) head/lib/libc/stdtime/ (props changed) head/lib/libutil/ (props changed) head/lib/libz/ (props changed) head/sbin/ (props changed) head/sbin/ipfw/ (props changed) head/share/zoneinfo/ (props changed) head/sys/ (props changed) head/sys/amd64/include/xen/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/pf/ (props changed) head/sys/contrib/x86emu/ (props changed) head/sys/dev/xen/xenpci/ (props changed) head/usr.bin/csup/ (props changed) head/usr.bin/procstat/ (props changed) head/usr.sbin/zic/ (props changed) Modified: head/lib/libc/sys/quotactl.2 ============================================================================== --- head/lib/libc/sys/quotactl.2 Thu May 6 22:49:54 2010 (r207735) +++ head/lib/libc/sys/quotactl.2 Fri May 7 00:41:12 2010 (r207736) @@ -84,7 +84,7 @@ and group identifiers (GRPQUOTA). The .Dq ufs specific commands are: -.Bl -tag -width Q_QUOTAOFFxx +.Bl -tag -width Q_GETQUOTASIZEx .It Dv Q_QUOTAON Enable disk quotas for the file system specified by .Fa path . @@ -110,6 +110,17 @@ and .Fa id arguments are unused. Only the super-user may turn quotas off. +.It Dv Q_GETQUOTASIZE +Get the wordsize used to represent the quotas for the user or group +(as determined by the command type). +Possible values are 32 for the old-style quota file +and 64 for the new-style quota file. +The +.Fa addr +argument is a pointer to an integer into which the size is stored. +The identifier +.Fa id +is not used. .It Dv Q_GETQUOTA Get disk quota limits and current usage for the user or group (as determined by the command type) with identifier @@ -177,9 +188,11 @@ The argument or the command type is invalid. In -.Dv Q_GETQUOTA -and +.Dv Q_GETQUOTASIZE , +.Dv Q_GETQUOTA , .Dv Q_SETQUOTA , +and +.Dv Q_SETUSE , quotas are not currently enabled for this file system. .Pp The @@ -208,7 +221,8 @@ Too many symbolic links were encountered .It Bq Er EROFS In .Dv Q_QUOTAON , -the quota file resides on a read-only file system. +either the file system on which quotas are to be enabled is mounted read-only +or the quota file resides on a read-only file system. .It Bq Er EIO An .Tn I/O Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Thu May 6 22:49:54 2010 (r207735) +++ head/lib/libutil/Makefile Fri May 7 00:41:12 2010 (r207736) @@ -12,7 +12,7 @@ SRCS= _secure_path.c auth.c expand_numbe hexdump.c humanize_number.c kinfo_getfile.c kinfo_getvmmap.c kld.c \ login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ - pidfile.c property.c pty.c pw_util.c realhostname.c \ + pidfile.c property.c pty.c pw_util.c quotafile.c realhostname.c \ stub.c trimdomain.c uucplock.c INCS= libutil.h login_cap.h @@ -29,7 +29,7 @@ MAN+= kld.3 login_auth.3 login_tty.3 pty _secure_path.3 uucplock.3 property.3 auth.3 realhostname.3 \ realhostname_sa.3 trimdomain.3 fparseln.3 humanize_number.3 \ pidfile.3 flopen.3 expand_number.3 hexdump.3 \ - kinfo_getfile.3 kinfo_getvmmap.3 + kinfo_getfile.3 kinfo_getvmmap.3 quotafile.3 MAN+= login.conf.5 auth.conf.5 MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 MLINKS+= property.3 properties_read.3 property.3 properties_free.3 @@ -57,5 +57,13 @@ MLINKS+=pidfile.3 pidfile_open.3 \ pidfile.3 pidfile_write.3 \ pidfile.3 pidfile_close.3 \ pidfile.3 pidfile_remove.3 +MLINKS+=quotafile.3 quota_open.3 \ + quotafile.3 quota_fsname.3 \ + quotafile.3 quota_qfname.3 \ + quotafile.3 quota_statfs.3 \ + quotafile.3 quota_read.3 \ + quotafile.3 quota_write_limits.3 \ + quotafile.3 quota_write_usage.3 \ + quotafile.3 quota_close.3 .include Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Thu May 6 22:49:54 2010 (r207735) +++ head/lib/libutil/libutil.h Fri May 7 00:41:12 2010 (r207736) @@ -164,6 +164,23 @@ int pidfile_close(struct pidfh *pfh); int pidfile_remove(struct pidfh *pfh); #endif +#ifdef _UFS_UFS_QUOTA_H_ +struct quotafile; +struct fstab; +struct quotafile *quota_open(struct fstab *, int, int); +void quota_close(struct quotafile *); +int quota_on(struct quotafile *); +int quota_off(struct quotafile *); +const char *quota_fsname(const struct quotafile *); +const char *quota_qfname(const struct quotafile *); +int quota_maxid(struct quotafile *); +int quota_check_path(const struct quotafile *, const char *path); +int quota_read(struct quotafile *, struct dqblk *, int); +int quota_write_limits(struct quotafile *, struct dqblk *, int); +int quota_write_usage(struct quotafile *, struct dqblk *, int); +int quota_convert(struct quotafile *, int); +#endif + __END_DECLS #define UU_LOCK_INUSE (1) Copied: head/lib/libutil/quotafile.3 (from r207707, projects/quota64/lib/libutil/quotafile.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libutil/quotafile.3 Fri May 7 00:41:12 2010 (r207736, copy of r207707, projects/quota64/lib/libutil/quotafile.3) @@ -0,0 +1,290 @@ +.\"- +.\" Copyright (c) 2009 Dag-Erling Coïdan Smørgrav and +.\" Marshall Kirk McKusick. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 28, 2009 +.Dt QUOTAFILE 3 +.Os +.Sh NAME +.Nm quota_open +.Nm quota_close +.Nm quota_on +.Nm quota_off +.Nm quota_read +.Nm quota_write_limits +.Nm quota_write_usage +.Nm quota_fsname +.Nm quota_qfname +.Nm quota_maxid +.Nm quota_check_path +.Nm quota_convert +.Nd "Manipulate quotas" +.Sh LIBRARY +.Lb libutil +.Sh SYNOPSIS +.In sys/param.h +.In sys/mount.h +.In ufs/ufs/quota.h +.In fcntl.h +.In fstab.h +.In libutil.h +.Ft "struct quotafile *" +.Fn quota_open "struct fstab *fs" "int quotatype" "int openflags" +.Ft int +.Fn quota_close "struct quotafile *qf" +.Ft int +.Fn quota_on "const struct quotafile *qf" +.Ft int +.Fn quota_off "const struct quotafile *qf" +.Ft int +.Fn quota_read "struct quotafile *qf" "struct dqblk *dqb" "int id" +.Ft int +.Fn quota_write_limits "struct quotafile *qf" "struct dqblk *dqb" "int id" +.Ft int +.Fn quota_write_usage "struct quotafile *qf" "struct dqblk *dqb" "int id" +.Ft "const char *" +.Fn quota_fsname "const struct quotafile *qf" +.Ft "const char *" +.Fn quota_qfname "const struct quotafile *qf" +.Ft int +.Fn quota_maxid "const struct quotafile *qf" +.Ft int +.Fn quota_check_path "const struct quotafile *qf" "const char *path" +.Ft int +.Fn quota_convert "struct quotafile *qf" "int wordsize" +.Sh DESCRIPTION +These functions are designed to simplify access to filesystem quotas. +If quotas are active on a filesystem, +these functions will access them directly from the kernel using the +.Fn quotactl +system call. +If quotas are not active, +these functions will access them by reading and writing +the quota files directly. +.Pp +The +.Fn quota_open +function takes a pointer to an +.Vt fstab +entry corresponding to the filesystem on which quotas +are to be accessed. +The +.Va quotatype +field indicates the type of quotas being sought, either +.Dv USRQUOTA +or +.Dv GRPQUOTA . +The +.Va openflags +are those used by the +.Fn open +system call, usually either +.Dv O_RDONLY +if the quotas are just to be read, or +.Dv O_RDWR +if the quotas are to be updated. +The +.Dv O_CREAT +flag should be specified if a new quota file of the requested type +should be created if it does not already exist. +.Pp +The +.Fn quota_close +function closes any open file descriptors and frees any storage +associated with the filesystem and quota type referenced by +.Va qf . +.Pp +The +.Fn quota_on +function enables quotas for the filesystem associated with its +.Va qf +argument which may have been opened +.Dv O_RDONLY +or +.Dv O_RDWR . +The +.Fn quota_on +function returns 0 if successful; +otherwise the value\~-1 is returned and the global variable +.Va errno +is set to indicate the error, see +.Xr quotactl 2 +for the possible errors. +.Pp +The +.Fn quota_off +function disables quotas for the filesystem associated with its +.Va qf +argument which may have been opened +.Dv O_RDONLY +or +.Dv O_RDWR . +The +.Fn quota_off +function returns 0 if successful; +otherwise the value\~-1 is returned and the global variable +.Va errno +is set to indicate the error, see +.Xr quotactl 2 +for the possible errors. +.Pp +The +.Fn quota_read +function reads the quota from the filesystem and quota type referenced by +.Va qf +for the user (or group) specified by +.Va id +into the +.Vt dqblk +quota structure pointed to by +.Va dqb . +.Pp +The +.Fn quota_write_limits +function updates the limit fields (but not the usage fields) +for the filesystem and quota type referenced by +.Va qf +for the user (or group) specified by +.Va id +from the +.Vt dqblk +quota structure pointed to by +.Va dqb . +.Pp +The +.Fn quota_write_usage +function updates the usage fields (but not the limit fields) +for the filesystem and quota type referenced by +.Va qf +for the user (or group) specified by +.Va id +from the +.Vt dqblk +quota structure pointed to by +.Va dqb . +.Pp +The +.Fn quota_fsname +function returns a pointer to a buffer containing the path to the root +of the file system that corresponds to its +.Va qf +argument, as listed in +.Pa /etc/fstab . +Note that this may be a symbolic link to the actual directory. +.Pp +The +.Fn quota_qfname +function returns a pointer to a buffer containing the name of the +quota file that corresponds to its +.Va qf +argument. +Note that this may be a symbolic link to the actual file. +.Pp +The +.Fn quota_maxid +function returns the maximum user (or group) +.Va id +contained in the quota file associated with its +.Va qf +argument. +.Pp +The +.Fn quota_check_path +function checks if the specified path is within the filesystem that +corresponds to its +.Va qf +argument. +If the +.Va path +argument refers to a symbolic link, +.Fn quota_check_path +will follow it. +.Pp +The +.Fn quota_convert +function converts the quota file associated with its +.Va qf +argument to the data size specified by its +.Va wordsize +argument. +The supported wordsize arguments are 32 for the old 32-bit +quota file format and 64 for the new 64-bit quota file format. +The +.Fn quota_convert +function may only be called to operate on quota files that +are not currently active. +.Sh IMPLEMENTATION NOTES +If the underlying quota file is in or converted to the old 32-bit format, +limit and usage values written to the quota file will be clipped to 32 bits. +.Sh RETURN VALUES +If the filesystem has quotas associated with it, +.Fn quota_open +returns a pointer to a +.Vt quotafile +structure used in subsequent quota access calls. +If the filesystem has no quotas, or access permission is denied +.Dv NULL +is returned and +.Va errno +is set to indicate the error. +.Pp +The +.Fn quota_check_path +function returns\~1 for a positive result and\~0 for a negative +result. +If an error occurs, it returns\~-1 and sets +.Va errno +to indicate the error. +.Pp +The +.Fn quota_read , +.Fn quota_write_limits , +.Fn quota_write_usage , +.Fn quota_convert , +and +.Fn quota_close +functions return zero on success. +On error they return\~-1 +and set +.Va errno +to indicate the error. +.Sh SEE ALSO +.Xr quotactl 2 , +.Xr quota.user 5 , +.Xr quota.group 5 +.Sh HISTORY +The +.Nm quotafile +functions first appeared in +.Fx 8.1 . +.Sh AUTHORS +.An -nosplit +The +.Nm quotafile +functions and this manual page were written by +.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +and +.An Marshall Kirk McKusick Aq mckusick@mckusick.com . Copied: head/lib/libutil/quotafile.c (from r207707, projects/quota64/lib/libutil/quotafile.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libutil/quotafile.c Fri May 7 00:41:12 2010 (r207736, copy of r207707, projects/quota64/lib/libutil/quotafile.c) @@ -0,0 +1,593 @@ +/*- + * Copyright (c) 2008 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2008 Marshall Kirk McKusick + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct quotafile { + int fd; /* -1 means using quotactl for access */ + int accmode; /* access mode */ + int wordsize; /* 32-bit or 64-bit limits */ + int quotatype; /* USRQUOTA or GRPQUOTA */ + dev_t dev; /* device */ + char fsname[MAXPATHLEN + 1]; /* mount point of filesystem */ + char qfname[MAXPATHLEN + 1]; /* quota file if not using quotactl */ +}; + +static const char *qfextension[] = INITQFNAMES; + +/* + * Check to see if a particular quota is to be enabled. + */ +static int +hasquota(struct fstab *fs, int type, char *qfnamep, int qfbufsize) +{ + char *opt; + char *cp; + struct statfs sfb; + char buf[BUFSIZ]; + static char initname, usrname[100], grpname[100]; + + /* + * 1) we only need one of these + * 2) fstab may specify a different filename + */ + if (!initname) { + (void)snprintf(usrname, sizeof(usrname), "%s%s", + qfextension[USRQUOTA], QUOTAFILENAME); + (void)snprintf(grpname, sizeof(grpname), "%s%s", + qfextension[GRPQUOTA], QUOTAFILENAME); + initname = 1; + } + strcpy(buf, fs->fs_mntops); + for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) { + if ((cp = index(opt, '='))) + *cp++ = '\0'; + if (type == USRQUOTA && strcmp(opt, usrname) == 0) + break; + if (type == GRPQUOTA && strcmp(opt, grpname) == 0) + break; + } + if (!opt) + return (0); + /* + * Ensure that the filesystem is mounted. + */ + if (statfs(fs->fs_file, &sfb) != 0 || + strcmp(fs->fs_file, sfb.f_mntonname)) { + return (0); + } + if (cp) { + strncpy(qfnamep, cp, qfbufsize); + } else { + (void)snprintf(qfnamep, qfbufsize, "%s/%s.%s", fs->fs_file, + QUOTAFILENAME, qfextension[type]); + } + return (1); +} + +struct quotafile * +quota_open(struct fstab *fs, int quotatype, int openflags) +{ + struct quotafile *qf; + struct dqhdr64 dqh; + struct group *grp; + struct stat st; + int qcmd, serrno; + + if (strcmp(fs->fs_vfstype, "ufs")) + return (NULL); + if ((qf = calloc(1, sizeof(*qf))) == NULL) + return (NULL); + qf->fd = -1; + qf->quotatype = quotatype; + strncpy(qf->fsname, fs->fs_file, sizeof(qf->fsname)); + if (stat(qf->fsname, &st) != 0) + goto error; + qf->dev = st.st_dev; + serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); + qcmd = QCMD(Q_GETQUOTASIZE, quotatype); + if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0) + return (qf); + if (serrno == 0) { + errno = EOPNOTSUPP; + goto error; + } + qf->accmode = openflags & O_ACCMODE; + if ((qf->fd = open(qf->qfname, qf->accmode)) < 0 && + (openflags & O_CREAT) != O_CREAT) + goto error; + /* File open worked, so process it */ + if (qf->fd != -1) { + qf->wordsize = 32; + switch (read(qf->fd, &dqh, sizeof(dqh))) { + case -1: + goto error; + case sizeof(dqh): + if (strcmp(dqh.dqh_magic, Q_DQHDR64_MAGIC) != 0) { + /* no magic, assume 32 bits */ + qf->wordsize = 32; + return (qf); + } + if (be32toh(dqh.dqh_version) != Q_DQHDR64_VERSION || + be32toh(dqh.dqh_hdrlen) != sizeof(struct dqhdr64) || + be32toh(dqh.dqh_reclen) != sizeof(struct dqblk64)) { + /* correct magic, wrong version / lengths */ + errno = EINVAL; + goto error; + } + qf->wordsize = 64; + return (qf); + default: + qf->wordsize = 32; + return (qf); + } + /* not reached */ + } + /* open failed, but O_CREAT was specified, so create a new file */ + if ((qf->fd = open(qf->qfname, O_RDWR|O_CREAT|O_TRUNC, 0)) < 0) + goto error; + qf->wordsize = 64; + memset(&dqh, 0, sizeof(dqh)); + memcpy(dqh.dqh_magic, Q_DQHDR64_MAGIC, sizeof(dqh.dqh_magic)); + dqh.dqh_version = htobe32(Q_DQHDR64_VERSION); + dqh.dqh_hdrlen = htobe32(sizeof(struct dqhdr64)); + dqh.dqh_reclen = htobe32(sizeof(struct dqblk64)); + if (write(qf->fd, &dqh, sizeof(dqh)) != sizeof(dqh)) { + /* it was one we created ourselves */ + unlink(qf->qfname); + goto error; + } + grp = getgrnam(QUOTAGROUP); + fchown(qf->fd, 0, grp ? grp->gr_gid : 0); + fchmod(qf->fd, 0640); + return (qf); +error: + serrno = errno; + /* did we have an open file? */ + if (qf->fd != -1) + close(qf->fd); + free(qf); + errno = serrno; + return (NULL); +} + +void +quota_close(struct quotafile *qf) +{ + + if (qf->fd != -1) + close(qf->fd); + free(qf); +} + +int +quota_on(struct quotafile *qf) +{ + int qcmd; + + qcmd = QCMD(Q_QUOTAON, qf->quotatype); + return (quotactl(qf->fsname, qcmd, 0, qf->qfname)); +} + +int +quota_off(struct quotafile *qf) +{ + + return (quotactl(qf->fsname, QCMD(Q_QUOTAOFF, qf->quotatype), 0, 0)); +} + +const char * +quota_fsname(const struct quotafile *qf) +{ + + return (qf->fsname); +} + +const char * +quota_qfname(const struct quotafile *qf) +{ + + return (qf->qfname); +} + +int +quota_check_path(const struct quotafile *qf, const char *path) +{ + struct stat st; + + if (stat(path, &st) == -1) + return (-1); + return (st.st_dev == qf->dev); +} + +int +quota_maxid(struct quotafile *qf) +{ + struct stat st; + int maxid; + + if (stat(qf->qfname, &st) < 0) + return (0); + switch (qf->wordsize) { + case 32: + maxid = st.st_size / sizeof(struct dqblk32) - 1; + break; + case 64: + maxid = st.st_size / sizeof(struct dqblk64) - 2; + break; + default: + maxid = 0; + break; + } + return (maxid > 0 ? maxid : 0); +} + +static int +quota_read32(struct quotafile *qf, struct dqblk *dqb, int id) +{ + struct dqblk32 dqb32; + off_t off; + + off = id * sizeof(struct dqblk32); + if (lseek(qf->fd, off, SEEK_SET) == -1) + return (-1); + switch (read(qf->fd, &dqb32, sizeof(dqb32))) { + case 0: + memset(dqb, 0, sizeof(*dqb)); + return (0); + case sizeof(dqb32): + dqb->dqb_bhardlimit = dqb32.dqb_bhardlimit; + dqb->dqb_bsoftlimit = dqb32.dqb_bsoftlimit; + dqb->dqb_curblocks = dqb32.dqb_curblocks; + dqb->dqb_ihardlimit = dqb32.dqb_ihardlimit; + dqb->dqb_isoftlimit = dqb32.dqb_isoftlimit; + dqb->dqb_curinodes = dqb32.dqb_curinodes; + dqb->dqb_btime = dqb32.dqb_btime; + dqb->dqb_itime = dqb32.dqb_itime; + return (0); + default: + return (-1); + } +} + +static int +quota_read64(struct quotafile *qf, struct dqblk *dqb, int id) +{ + struct dqblk64 dqb64; + off_t off; + + off = sizeof(struct dqhdr64) + id * sizeof(struct dqblk64); + if (lseek(qf->fd, off, SEEK_SET) == -1) + return (-1); + switch (read(qf->fd, &dqb64, sizeof(dqb64))) { + case 0: + memset(dqb, 0, sizeof(*dqb)); + return (0); + case sizeof(dqb64): + dqb->dqb_bhardlimit = be64toh(dqb64.dqb_bhardlimit); + dqb->dqb_bsoftlimit = be64toh(dqb64.dqb_bsoftlimit); + dqb->dqb_curblocks = be64toh(dqb64.dqb_curblocks); + dqb->dqb_ihardlimit = be64toh(dqb64.dqb_ihardlimit); + dqb->dqb_isoftlimit = be64toh(dqb64.dqb_isoftlimit); + dqb->dqb_curinodes = be64toh(dqb64.dqb_curinodes); + dqb->dqb_btime = be64toh(dqb64.dqb_btime); + dqb->dqb_itime = be64toh(dqb64.dqb_itime); + return (0); + default: + return (-1); + } +} + +int +quota_read(struct quotafile *qf, struct dqblk *dqb, int id) +{ + int qcmd; + + if (qf->fd == -1) { + qcmd = QCMD(Q_GETQUOTA, qf->quotatype); + return (quotactl(qf->fsname, qcmd, id, dqb)); + } + switch (qf->wordsize) { + case 32: + return (quota_read32(qf, dqb, id)); + case 64: + return (quota_read64(qf, dqb, id)); + default: + errno = EINVAL; + return (-1); + } + /* not reached */ +} + +#define CLIP32(u64) ((u64) > UINT32_MAX ? UINT32_MAX : (uint32_t)(u64)) + +static int +quota_write32(struct quotafile *qf, const struct dqblk *dqb, int id) +{ + struct dqblk32 dqb32; + off_t off; + + dqb32.dqb_bhardlimit = CLIP32(dqb->dqb_bhardlimit); + dqb32.dqb_bsoftlimit = CLIP32(dqb->dqb_bsoftlimit); + dqb32.dqb_curblocks = CLIP32(dqb->dqb_curblocks); + dqb32.dqb_ihardlimit = CLIP32(dqb->dqb_ihardlimit); + dqb32.dqb_isoftlimit = CLIP32(dqb->dqb_isoftlimit); + dqb32.dqb_curinodes = CLIP32(dqb->dqb_curinodes); + dqb32.dqb_btime = CLIP32(dqb->dqb_btime); + dqb32.dqb_itime = CLIP32(dqb->dqb_itime); + + off = id * sizeof(struct dqblk32); + if (lseek(qf->fd, off, SEEK_SET) == -1) + return (-1); + if (write(qf->fd, &dqb32, sizeof(dqb32)) == sizeof(dqb32)) + return (0); + return (-1); +} + +static int +quota_write64(struct quotafile *qf, const struct dqblk *dqb, int id) +{ + struct dqblk64 dqb64; + off_t off; + + dqb64.dqb_bhardlimit = htobe64(dqb->dqb_bhardlimit); + dqb64.dqb_bsoftlimit = htobe64(dqb->dqb_bsoftlimit); + dqb64.dqb_curblocks = htobe64(dqb->dqb_curblocks); + dqb64.dqb_ihardlimit = htobe64(dqb->dqb_ihardlimit); + dqb64.dqb_isoftlimit = htobe64(dqb->dqb_isoftlimit); + dqb64.dqb_curinodes = htobe64(dqb->dqb_curinodes); + dqb64.dqb_btime = htobe64(dqb->dqb_btime); + dqb64.dqb_itime = htobe64(dqb->dqb_itime); + + off = sizeof(struct dqhdr64) + id * sizeof(struct dqblk64); + if (lseek(qf->fd, off, SEEK_SET) == -1) + return (-1); + if (write(qf->fd, &dqb64, sizeof(dqb64)) == sizeof(dqb64)) + return (0); + return (-1); +} + +int +quota_write_usage(struct quotafile *qf, struct dqblk *dqb, int id) +{ + struct dqblk dqbuf; + int qcmd; + + if (qf->fd == -1) { + qcmd = QCMD(Q_SETUSE, qf->quotatype); + return (quotactl(qf->fsname, qcmd, id, dqb)); + } + /* + * Have to do read-modify-write of quota in file. + */ + if ((qf->accmode & O_RDWR) != O_RDWR) { + errno = EBADF; + return (-1); + } + if (quota_read(qf, &dqbuf, id) != 0) + return (-1); + /* + * Reset time limit if have a soft limit and were + * previously under it, but are now over it. + */ + if (dqbuf.dqb_bsoftlimit && id != 0 && + dqbuf.dqb_curblocks < dqbuf.dqb_bsoftlimit && + dqb->dqb_curblocks >= dqbuf.dqb_bsoftlimit) + dqbuf.dqb_btime = 0; + if (dqbuf.dqb_isoftlimit && id != 0 && + dqbuf.dqb_curinodes < dqbuf.dqb_isoftlimit && + dqb->dqb_curinodes >= dqbuf.dqb_isoftlimit) + dqbuf.dqb_itime = 0; + dqbuf.dqb_curinodes = dqb->dqb_curinodes; + dqbuf.dqb_curblocks = dqb->dqb_curblocks; + /* + * Write it back. + */ + switch (qf->wordsize) { + case 32: + return (quota_write32(qf, &dqbuf, id)); + case 64: + return (quota_write64(qf, &dqbuf, id)); + default: + errno = EINVAL; + return (-1); + } + /* not reached */ +} + +int +quota_write_limits(struct quotafile *qf, struct dqblk *dqb, int id) +{ + struct dqblk dqbuf; + int qcmd; + + if (qf->fd == -1) { + qcmd = QCMD(Q_SETQUOTA, qf->quotatype); + return (quotactl(qf->fsname, qcmd, id, dqb)); + } + /* + * Have to do read-modify-write of quota in file. + */ + if ((qf->accmode & O_RDWR) != O_RDWR) { + errno = EBADF; + return (-1); + } + if (quota_read(qf, &dqbuf, id) != 0) + return (-1); + /* + * Reset time limit if have a soft limit and were + * previously under it, but are now over it + * or if there previously was no soft limit, but + * now have one and are over it. + */ + if (dqbuf.dqb_bsoftlimit && id != 0 && + dqbuf.dqb_curblocks < dqbuf.dqb_bsoftlimit && + dqbuf.dqb_curblocks >= dqb->dqb_bsoftlimit) + dqb->dqb_btime = 0; + if (dqbuf.dqb_bsoftlimit == 0 && id != 0 && + dqb->dqb_bsoftlimit > 0 && + dqbuf.dqb_curblocks >= dqb->dqb_bsoftlimit) + dqb->dqb_btime = 0; + if (dqbuf.dqb_isoftlimit && id != 0 && + dqbuf.dqb_curinodes < dqbuf.dqb_isoftlimit && + dqbuf.dqb_curinodes >= dqb->dqb_isoftlimit) + dqb->dqb_itime = 0; + if (dqbuf.dqb_isoftlimit == 0 && id !=0 && + dqb->dqb_isoftlimit > 0 && + dqbuf.dqb_curinodes >= dqb->dqb_isoftlimit) + dqb->dqb_itime = 0; + dqb->dqb_curinodes = dqbuf.dqb_curinodes; + dqb->dqb_curblocks = dqbuf.dqb_curblocks; + /* + * Write it back. + */ + switch (qf->wordsize) { + case 32: + return (quota_write32(qf, dqb, id)); + case 64: + return (quota_write64(qf, dqb, id)); + default: + errno = EINVAL; + return (-1); + } + /* not reached */ +} + +/* + * Convert a quota file from one format to another. + */ +int +quota_convert(struct quotafile *qf, int wordsize) +{ + struct quotafile *newqf; + struct dqhdr64 dqh; + struct dqblk dqblk; + struct group *grp; + int serrno, maxid, id, fd; + + /* + * Quotas must not be active and quotafile must be open + * for reading and writing. + */ + if ((qf->accmode & O_RDWR) != O_RDWR || qf->fd == -1) { + errno = EBADF; + return (-1); + } + if ((wordsize != 32 && wordsize != 64) || + wordsize == qf->wordsize) { + errno = EINVAL; + return (-1); + } + maxid = quota_maxid(qf); + if ((newqf = calloc(1, sizeof(*qf))) == NULL) { + errno = ENOMEM; + return (-1); + } + *newqf = *qf; + snprintf(newqf->qfname, MAXPATHLEN + 1, "%s_%d.orig", qf->qfname, + qf->wordsize); + if (rename(qf->qfname, newqf->qfname) < 0) { + free(newqf); + return (-1); + } + if ((newqf->fd = open(qf->qfname, O_RDWR|O_CREAT|O_TRUNC, 0)) < 0) { + serrno = errno; + goto error; + } + newqf->wordsize = wordsize; + if (wordsize == 64) { + memset(&dqh, 0, sizeof(dqh)); + memcpy(dqh.dqh_magic, Q_DQHDR64_MAGIC, sizeof(dqh.dqh_magic)); + dqh.dqh_version = htobe32(Q_DQHDR64_VERSION); + dqh.dqh_hdrlen = htobe32(sizeof(struct dqhdr64)); + dqh.dqh_reclen = htobe32(sizeof(struct dqblk64)); + if (write(newqf->fd, &dqh, sizeof(dqh)) != sizeof(dqh)) { + serrno = errno; + goto error; + } + } + grp = getgrnam(QUOTAGROUP); + fchown(newqf->fd, 0, grp ? grp->gr_gid : 0); + fchmod(newqf->fd, 0640); + for (id = 0; id <= maxid; id++) { + if ((quota_read(qf, &dqblk, id)) < 0) + break; + switch (newqf->wordsize) { + case 32: + if ((quota_write32(newqf, &dqblk, id)) < 0) + break; + continue; + case 64: + if ((quota_write64(newqf, &dqblk, id)) < 0) + break; + continue; + default: + errno = EINVAL; + break; + } + } + if (id < maxid) { + serrno = errno; + goto error; + } + /* + * Update the passed in quotafile to reference the new file + * of the converted format size. + */ + fd = qf->fd; + qf->fd = newqf->fd; + newqf->fd = fd; + qf->wordsize = newqf->wordsize; + quota_close(newqf); + return (0); +error: + /* put back the original file */ + (void) rename(newqf->qfname, qf->qfname); + quota_close(newqf); + errno = serrno; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri May 7 04:14:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03095106567C; Fri, 7 May 2010 04:14:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E7B638FC1F; Fri, 7 May 2010 04:14:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o474E7p2084393; Fri, 7 May 2010 04:14:07 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o474E7tR084390; Fri, 7 May 2010 04:14:07 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005070414.o474E7tR084390@svn.freebsd.org> From: Alan Cox Date: Fri, 7 May 2010 04:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207738 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 04:14:08 -0000 Author: alc Date: Fri May 7 04:14:07 2010 New Revision: 207738 URL: http://svn.freebsd.org/changeset/base/207738 Log: Push down the page queues lock into vm_page_deactivate(). Eliminate an incorrect comment. Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Fri May 7 04:04:24 2010 (r207737) +++ head/sys/vm/vm_fault.c Fri May 7 04:14:07 2010 (r207738) @@ -138,9 +138,7 @@ release_page(struct faultstate *fs) vm_page_wakeup(fs->m); vm_page_lock(fs->m); - vm_page_lock_queues(); vm_page_deactivate(fs->m); - vm_page_unlock_queues(); vm_page_unlock(fs->m); fs->m = NULL; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri May 7 04:04:24 2010 (r207737) +++ head/sys/vm/vm_page.c Fri May 7 04:14:07 2010 (r207738) @@ -1618,10 +1618,8 @@ vm_page_unwire(vm_page_t m, int activate } } - /* - * Move the specified page to the inactive queue. If the page has - * any associated swap, the swap is deallocated. + * Move the specified page to the inactive queue. * * Normally athead is 0 resulting in LRU operation. athead is set * to 1 if we want this page to be 'as if it were placed in the cache', @@ -1633,7 +1631,6 @@ static inline void _vm_page_deactivate(vm_page_t m, int athead) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); vm_page_lock_assert(m, MA_OWNED); /* @@ -1642,6 +1639,7 @@ _vm_page_deactivate(vm_page_t m, int ath if (VM_PAGE_INQUEUE2(m, PQ_INACTIVE)) return; if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { + vm_page_lock_queues(); vm_page_flag_clear(m, PG_WINATCFLS); vm_pageq_remove(m); if (athead) @@ -1650,13 +1648,20 @@ _vm_page_deactivate(vm_page_t m, int ath TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq); VM_PAGE_SETQUEUE2(m, PQ_INACTIVE); cnt.v_inactive_count++; + vm_page_unlock_queues(); } } +/* + * Move the specified page to the inactive queue. + * + * The page must be locked. + */ void vm_page_deactivate(vm_page_t m) { - _vm_page_deactivate(m, 0); + + _vm_page_deactivate(m, 0); } /* From owner-svn-src-head@FreeBSD.ORG Fri May 7 05:23:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 962A51065677; Fri, 7 May 2010 05:23:15 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 868E88FC15; Fri, 7 May 2010 05:23:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o475NFTv099388; Fri, 7 May 2010 05:23:15 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o475NFCq099385; Fri, 7 May 2010 05:23:15 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005070523.o475NFCq099385@svn.freebsd.org> From: Alan Cox Date: Fri, 7 May 2010 05:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207739 - in head/sys: sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 05:23:15 -0000 Author: alc Date: Fri May 7 05:23:15 2010 New Revision: 207739 URL: http://svn.freebsd.org/changeset/base/207739 Log: Eliminate acquisitions of the page queues lock that are no longer needed. Switch to a per-processor counter for the number of pages freed during process termination. Modified: head/sys/sys/vmmeter.h head/sys/vm/vm_object.c Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Fri May 7 04:14:07 2010 (r207738) +++ head/sys/sys/vmmeter.h Fri May 7 05:23:15 2010 (r207739) @@ -74,7 +74,7 @@ struct vmmeter { u_int v_tcached; /* (q) total pages cached */ u_int v_dfree; /* (q) pages freed by daemon */ - u_int v_pfree; /* (q) pages freed by exiting processes */ + u_int v_pfree; /* (p) pages freed by exiting processes */ u_int v_tfree; /* (p) total pages freed */ /* * Distribution of page usages. Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Fri May 7 04:14:07 2010 (r207738) +++ head/sys/vm/vm_object.c Fri May 7 05:23:15 2010 (r207739) @@ -722,14 +722,11 @@ vm_object_terminate(vm_object_t object) ("vm_object_terminate: freeing busy page %p " "p->busy = %d, p->oflags %x\n", p, p->busy, p->oflags)); vm_page_lock(p); - vm_page_lock_queues(); if (p->wire_count == 0) { vm_page_free(p); - cnt.v_pfree++; - } else { + PCPU_INC(cnt.v_pfree); + } else vm_page_remove(p); - } - vm_page_unlock_queues(); vm_page_unlock(p); } @@ -1634,14 +1631,12 @@ vm_object_backing_scan(vm_object_t objec * can simply destroy it. */ vm_page_lock(p); - vm_page_lock_queues(); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); if (p->wire_count == 0) vm_page_free(p); else vm_page_remove(p); - vm_page_unlock_queues(); vm_page_unlock(p); p = next; continue; @@ -1660,14 +1655,12 @@ vm_object_backing_scan(vm_object_t objec * Leave the parent's page alone */ vm_page_lock(p); - vm_page_lock_queues(); KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); if (p->wire_count == 0) vm_page_free(p); else vm_page_remove(p); - vm_page_unlock_queues(); vm_page_unlock(p); p = next; continue; From owner-svn-src-head@FreeBSD.ORG Fri May 7 06:58:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0CD41065670; Fri, 7 May 2010 06:58:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 911298FC15; Fri, 7 May 2010 06:58:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o476wrVr020383; Fri, 7 May 2010 06:58:53 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o476wroB020381; Fri, 7 May 2010 06:58:53 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005070658.o476wroB020381@svn.freebsd.org> From: Alan Cox Date: Fri, 7 May 2010 06:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207740 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 06:58:53 -0000 Author: alc Date: Fri May 7 06:58:53 2010 New Revision: 207740 URL: http://svn.freebsd.org/changeset/base/207740 Log: Update the synchronization requirements for the page usage count. Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Fri May 7 05:23:15 2010 (r207739) +++ head/sys/vm/vm_page.h Fri May 7 06:58:53 2010 (r207740) @@ -116,7 +116,7 @@ struct vm_page { u_int wire_count; /* wired down maps refs (P) */ short hold_count; /* page hold count (P) */ u_short oflags; /* page flags (O) */ - u_char act_count; /* page usage count (Q) */ + u_char act_count; /* page usage count (P) */ u_char busy; /* page busy count (O) */ /* NOTE that these must support one bit per DEV_BSIZE in a page!!! */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ From owner-svn-src-head@FreeBSD.ORG Fri May 7 08:20:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7083B1065673; Fri, 7 May 2010 08:20:56 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 604E88FC1B; Fri, 7 May 2010 08:20:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o478KuHJ038387; Fri, 7 May 2010 08:20:56 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o478Kunr038385; Fri, 7 May 2010 08:20:56 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201005070820.o478Kunr038385@svn.freebsd.org> From: Jeff Roberson Date: Fri, 7 May 2010 08:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207741 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 08:20:56 -0000 Author: jeff Date: Fri May 7 08:20:56 2010 New Revision: 207741 URL: http://svn.freebsd.org/changeset/base/207741 Log: - Use the correct flag mask when determining whether an inode has successfully made it to the free list yet or not. This fixes a deadlock that can occur with unlinked but referenced files. Journal space and inodedeps were not correctly reclaimed because the inode block was not left dirty. Tested/Reported by: lwindschuh@googlemail.com Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri May 7 06:58:53 2010 (r207740) +++ head/sys/ufs/ffs/ffs_softdep.c Fri May 7 08:20:56 2010 (r207741) @@ -9301,7 +9301,7 @@ handle_written_inodeblock(inodedep, bp) hadchanges = 1; } /* Leave this inodeblock dirty until it's in the list. */ - if ((inodedep->id_state & (UNLINKED | DEPCOMPLETE)) == UNLINKED) + if ((inodedep->id_state & (UNLINKED | UNLINKONLIST)) == UNLINKED) hadchanges = 1; /* * If we had to rollback the inode allocation because of From owner-svn-src-head@FreeBSD.ORG Fri May 7 08:45:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 428661065676; Fri, 7 May 2010 08:45:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 31BBF8FC12; Fri, 7 May 2010 08:45:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o478jM7q043760; Fri, 7 May 2010 08:45:22 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o478jMXO043757; Fri, 7 May 2010 08:45:22 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201005070845.o478jMXO043757@svn.freebsd.org> From: Jeff Roberson Date: Fri, 7 May 2010 08:45:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207742 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 08:45:22 -0000 Author: jeff Date: Fri May 7 08:45:21 2010 New Revision: 207742 URL: http://svn.freebsd.org/changeset/base/207742 Log: - Call softdep_prealloc() before any of the balloc routines in the snapshot code. - Don't fsync() vnodes in prealloc if copy on write is in progress. It is not safe to recurse back into the write path here. Reported by: Vladimir Grebenschikov Modified: head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Fri May 7 08:20:56 2010 (r207741) +++ head/sys/ufs/ffs/ffs_snapshot.c Fri May 7 08:45:21 2010 (r207742) @@ -1002,6 +1002,8 @@ expunge_ufs1(snapvp, cancelip, fs, acctf if (lbn < NDADDR) { blkno = VTOI(snapvp)->i_din1->di_db[lbn]; } else { + if (DOINGSOFTDEP(snapvp)) + softdep_prealloc(snapvp, MNT_WAIT); td->td_pflags |= TDP_COWINPROGRESS; error = ffs_balloc_ufs1(snapvp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, BA_METAONLY, &bp); @@ -1283,6 +1285,8 @@ expunge_ufs2(snapvp, cancelip, fs, acctf if (lbn < NDADDR) { blkno = VTOI(snapvp)->i_din2->di_db[lbn]; } else { + if (DOINGSOFTDEP(snapvp)) + softdep_prealloc(snapvp, MNT_WAIT); td->td_pflags |= TDP_COWINPROGRESS; error = ffs_balloc_ufs2(snapvp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, BA_METAONLY, &bp); @@ -1746,6 +1750,8 @@ retry: goto retry; TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { vp = ITOV(ip); + if (DOINGSOFTDEP(vp)) + softdep_prealloc(vp, MNT_WAIT); /* * Lookup block being written. */ @@ -2268,6 +2274,8 @@ ffs_copyonwrite(devvp, bp) } TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { vp = ITOV(ip); + if (DOINGSOFTDEP(vp)) + softdep_prealloc(vp, MNT_WAIT); /* * We ensure that everything of our own that needs to be * copied will be done at the time that ffs_snapshot is Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri May 7 08:20:56 2010 (r207741) +++ head/sys/ufs/ffs/ffs_softdep.c Fri May 7 08:45:21 2010 (r207742) @@ -2475,7 +2475,8 @@ softdep_prealloc(vp, waitok) * Attempt to sync this vnode once to flush any journal * work attached to it. */ - ffs_syncvnode(vp, waitok); + if ((curthread->td_pflags & TDP_COWINPROGRESS) == 0) + ffs_syncvnode(vp, waitok); ACQUIRE_LOCK(&lk); process_removes(vp); if (journal_space(ump, 0) == 0) { From owner-svn-src-head@FreeBSD.ORG Fri May 7 14:30:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CFC24106566B; Fri, 7 May 2010 14:30:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BF7808FC1C; Fri, 7 May 2010 14:30:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47EULRS022324; Fri, 7 May 2010 14:30:21 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47EULv6022323; Fri, 7 May 2010 14:30:21 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201005071430.o47EULv6022323@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 7 May 2010 14:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207745 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 14:30:21 -0000 Author: trasz Date: Fri May 7 14:30:21 2010 New Revision: 207745 URL: http://svn.freebsd.org/changeset/base/207745 Log: Enforce RLIMIT_FSIZE in ZFS. Reviewed by: pjd@ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri May 7 11:17:20 2010 (r207744) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri May 7 14:30:21 2010 (r207745) @@ -3977,6 +3977,9 @@ zfs_freebsd_write(ap) } */ *ap; { + if (vn_rlimit_fsize(ap->a_vp, ap->a_uio, ap->a_uio->uio_td)) + return (EFBIG); + return (zfs_write(ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, NULL)); } From owner-svn-src-head@FreeBSD.ORG Fri May 7 15:49:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 64100106566C; Fri, 7 May 2010 15:49:44 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 522DE8FC12; Fri, 7 May 2010 15:49:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47FniW7040487; Fri, 7 May 2010 15:49:44 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47FniP8040479; Fri, 7 May 2010 15:49:44 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005071549.o47FniP8040479@svn.freebsd.org> From: Alan Cox Date: Fri, 7 May 2010 15:49:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207746 - in head/sys: fs/nfsclient fs/nwfs fs/smbfs nfsclient vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 15:49:44 -0000 Author: alc Date: Fri May 7 15:49:43 2010 New Revision: 207746 URL: http://svn.freebsd.org/changeset/base/207746 Log: Push down the page queues lock into vm_page_activate(). Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/nfsclient/nfs_bio.c head/sys/vm/vm_fault.c head/sys/vm/vm_page.c head/sys/vm/vnode_pager.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Fri May 7 14:30:21 2010 (r207745) +++ head/sys/fs/nfsclient/nfs_clbio.c Fri May 7 15:49:43 2010 (r207746) @@ -196,9 +196,6 @@ ncl_getpages(struct vop_getpages_args *a nextoff = toff + PAGE_SIZE; m = pages[i]; - vm_page_lock(m); - vm_page_lock_queues(); - if (nextoff <= size) { /* * Read operation filled an entire page @@ -236,18 +233,22 @@ ncl_getpages(struct vop_getpages_args *a * now tell them that it is ok to use. */ if (!error) { - if (m->oflags & VPO_WANTED) + if (m->oflags & VPO_WANTED) { + vm_page_lock(m); vm_page_activate(m); - else + vm_page_unlock(m); + } else { + vm_page_lock(m); vm_page_deactivate(m); + vm_page_unlock(m); + } vm_page_wakeup(m); } else { + vm_page_lock(m); vm_page_free(m); + vm_page_unlock(m); } } - - vm_page_unlock_queues(); - vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); return (0); Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Fri May 7 14:30:21 2010 (r207745) +++ head/sys/fs/nwfs/nwfs_io.c Fri May 7 15:49:43 2010 (r207746) @@ -446,9 +446,6 @@ nwfs_getpages(ap) nextoff = toff + PAGE_SIZE; m = pages[i]; - vm_page_lock(m); - vm_page_lock_queues(); - if (nextoff <= size) { m->valid = VM_PAGE_BITS_ALL; KASSERT(m->dirty == 0, @@ -474,18 +471,22 @@ nwfs_getpages(ap) * now tell them that it is ok to use. */ if (!error) { - if (m->oflags & VPO_WANTED) + if (m->oflags & VPO_WANTED) { + vm_page_lock(m); vm_page_activate(m); - else + vm_page_unlock(m); + } else { + vm_page_lock(m); vm_page_deactivate(m); + vm_page_unlock(m); + } vm_page_wakeup(m); } else { + vm_page_lock(m); vm_page_free(m); + vm_page_unlock(m); } } - - vm_page_unlock_queues(); - vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); return 0; Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Fri May 7 14:30:21 2010 (r207745) +++ head/sys/fs/smbfs/smbfs_io.c Fri May 7 15:49:43 2010 (r207746) @@ -497,9 +497,6 @@ smbfs_getpages(ap) nextoff = toff + PAGE_SIZE; m = pages[i]; - vm_page_lock(m); - vm_page_lock_queues(); - if (nextoff <= size) { /* * Read operation filled an entire page @@ -538,18 +535,22 @@ smbfs_getpages(ap) * now tell them that it is ok to use. */ if (!error) { - if (m->oflags & VPO_WANTED) + if (m->oflags & VPO_WANTED) { + vm_page_lock(m); vm_page_activate(m); - else + vm_page_unlock(m); + } else { + vm_page_lock(m); vm_page_deactivate(m); + vm_page_unlock(m); + } vm_page_wakeup(m); } else { + vm_page_lock(m); vm_page_free(m); + vm_page_unlock(m); } } - - vm_page_unlock_queues(); - vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); return 0; Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Fri May 7 14:30:21 2010 (r207745) +++ head/sys/nfsclient/nfs_bio.c Fri May 7 15:49:43 2010 (r207746) @@ -194,9 +194,6 @@ nfs_getpages(struct vop_getpages_args *a nextoff = toff + PAGE_SIZE; m = pages[i]; - vm_page_lock(m); - vm_page_lock_queues(); - if (nextoff <= size) { /* * Read operation filled an entire page @@ -234,18 +231,22 @@ nfs_getpages(struct vop_getpages_args *a * now tell them that it is ok to use. */ if (!error) { - if (m->oflags & VPO_WANTED) + if (m->oflags & VPO_WANTED) { + vm_page_lock(m); vm_page_activate(m); - else + vm_page_unlock(m); + } else { + vm_page_lock(m); vm_page_deactivate(m); + vm_page_unlock(m); + } vm_page_wakeup(m); } else { + vm_page_lock(m); vm_page_free(m); + vm_page_unlock(m); } } - - vm_page_unlock_queues(); - vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); return (0); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Fri May 7 14:30:21 2010 (r207745) +++ head/sys/vm/vm_fault.c Fri May 7 15:49:43 2010 (r207746) @@ -937,7 +937,6 @@ vnode_locked: vm_fault_prefault(fs.map->pmap, vaddr, fs.entry); VM_OBJECT_LOCK(fs.object); vm_page_lock(fs.m); - vm_page_lock_queues(); /* * If the page is not wired down, then put it where the pageout daemon @@ -948,10 +947,8 @@ vnode_locked: vm_page_wire(fs.m); else vm_page_unwire(fs.m, 1); - } else { + } else vm_page_activate(fs.m); - } - vm_page_unlock_queues(); vm_page_unlock(fs.m); vm_page_wakeup(fs.m); @@ -1267,9 +1264,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm vm_page_unlock(dst_m); } else { vm_page_lock(dst_m); - vm_page_lock_queues(); vm_page_activate(dst_m); - vm_page_unlock_queues(); vm_page_unlock(dst_m); } vm_page_wakeup(dst_m); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri May 7 14:30:21 2010 (r207745) +++ head/sys/vm/vm_page.c Fri May 7 15:49:43 2010 (r207746) @@ -1374,22 +1374,25 @@ vm_page_enqueue(int queue, vm_page_t m) * Ensure that act_count is at least ACT_INIT but do not otherwise * mess with it. * - * The page queues must be locked. + * The page must be locked. * This routine may not block. */ void vm_page_activate(vm_page_t m) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); vm_page_lock_assert(m, MA_OWNED); if (VM_PAGE_GETKNOWNQUEUE2(m) != PQ_ACTIVE) { - vm_pageq_remove(m); if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; + vm_page_lock_queues(); + vm_pageq_remove(m); vm_page_enqueue(PQ_ACTIVE, m); - } + vm_page_unlock_queues(); + } else + KASSERT(m->queue == PQ_NONE, + ("vm_page_activate: wired page %p is queued", m)); } else { if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Fri May 7 14:30:21 2010 (r207745) +++ head/sys/vm/vnode_pager.c Fri May 7 15:49:43 2010 (r207746) @@ -948,8 +948,6 @@ vnode_pager_generic_getpages(vp, m, byte nextoff = tfoff + PAGE_SIZE; mt = m[i]; - vm_page_lock(mt); - vm_page_lock_queues(); if (nextoff <= object->un_pager.vnp.vnp_size) { /* * Read filled up entire page. @@ -992,17 +990,22 @@ vnode_pager_generic_getpages(vp, m, byte * now tell them that it is ok to use */ if (!error) { - if (mt->oflags & VPO_WANTED) + if (mt->oflags & VPO_WANTED) { + vm_page_lock(mt); vm_page_activate(mt); - else + vm_page_unlock(mt); + } else { + vm_page_lock(mt); vm_page_deactivate(mt); + vm_page_unlock(mt); + } vm_page_wakeup(mt); } else { + vm_page_lock(mt); vm_page_free(mt); + vm_page_unlock(mt); } } - vm_page_unlock_queues(); - vm_page_unlock(mt); } VM_OBJECT_UNLOCK(object); if (error) { From owner-svn-src-head@FreeBSD.ORG Fri May 7 16:22:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6619B106564A; Fri, 7 May 2010 16:22:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 56A938FC15; Fri, 7 May 2010 16:22:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47GM6kj047603; Fri, 7 May 2010 16:22:06 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47GM6X0047601; Fri, 7 May 2010 16:22:06 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005071622.o47GM6X0047601@svn.freebsd.org> From: Alan Cox Date: Fri, 7 May 2010 16:22:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207747 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 16:22:06 -0000 Author: alc Date: Fri May 7 16:22:06 2010 New Revision: 207747 URL: http://svn.freebsd.org/changeset/base/207747 Log: Eliminate unnecessary page queues locking. Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Fri May 7 15:49:43 2010 (r207746) +++ head/sys/vm/swap_pager.c Fri May 7 16:22:06 2010 (r207747) @@ -1140,16 +1140,12 @@ swap_pager_getpages(vm_object_t object, for (k = 0; k < i; ++k) { vm_page_lock(m[k]); - vm_page_lock_queues(); swp_pager_free_nrpage(m[k]); - vm_page_unlock_queues(); vm_page_unlock(m[k]); } for (k = j; k < count; ++k) { vm_page_lock(m[k]); - vm_page_lock_queues(); swp_pager_free_nrpage(m[k]); - vm_page_unlock_queues(); vm_page_unlock(m[k]); } } From owner-svn-src-head@FreeBSD.ORG Fri May 7 16:43:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6875106566B; Fri, 7 May 2010 16:43:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B69E88FC17; Fri, 7 May 2010 16:43:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47Gh03v052143; Fri, 7 May 2010 16:43:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47Gh0VV052141; Fri, 7 May 2010 16:43:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005071643.o47Gh0VV052141@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 7 May 2010 16:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207748 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 16:43:00 -0000 Author: yongari Date: Fri May 7 16:43:00 2010 New Revision: 207748 URL: http://svn.freebsd.org/changeset/base/207748 Log: It seems controller has two types of promiscuous control, one for unicast and the other for multicast. To receive multicast frames that host didn't join in promiscuous mode, driver have to set promiscuous mode for multicast frames as well. The Open Source Software Developer Manual for i8255x was not clear how to handle promiscuous mode. PR: kern/145905 MFC after: 5 days Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Fri May 7 16:22:06 2010 (r207747) +++ head/sys/dev/fxp/if_fxp.c Fri May 7 16:43:00 2010 (r207748) @@ -2345,7 +2345,7 @@ fxp_init_body(struct fxp_softc *sc) cbp->force_fdx = 0; /* (don't) force full duplex */ cbp->fdx_pin_en = 1; /* (enable) FDX# pin */ cbp->multi_ia = 0; /* (don't) accept multiple IAs */ - cbp->mc_all = ifp->if_flags & IFF_ALLMULTI ? 1 : 0; + cbp->mc_all = ifp->if_flags & IFF_ALLMULTI ? 1 : prm; cbp->gamla_rx = sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0; cbp->vlan_strip_en = ((sc->flags & FXP_FLAG_EXT_RFA) != 0 && (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) ? 1 : 0; From owner-svn-src-head@FreeBSD.ORG Fri May 7 17:20:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D52C106564A; Fri, 7 May 2010 17:20:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 3C6168FC12; Fri, 7 May 2010 17:20:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47HKGYF060409; Fri, 7 May 2010 17:20:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47HKGQS060407; Fri, 7 May 2010 17:20:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005071720.o47HKGQS060407@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 7 May 2010 17:20:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207749 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 17:20:16 -0000 Author: jilles Date: Fri May 7 17:20:15 2010 New Revision: 207749 URL: http://svn.freebsd.org/changeset/base/207749 Log: raise(3): Note that this sends a signal to the current thread, not process. This is how it works (with threading libraries loaded) and what POSIX requires. MFC after: 1 week Modified: head/lib/libc/gen/raise.3 Modified: head/lib/libc/gen/raise.3 ============================================================================== --- head/lib/libc/gen/raise.3 Fri May 7 16:43:00 2010 (r207748) +++ head/lib/libc/gen/raise.3 Fri May 7 17:20:15 2010 (r207749) @@ -32,12 +32,12 @@ .\" @(#)raise.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 7, 2010 .Dt RAISE 3 .Os .Sh NAME .Nm raise -.Nd send a signal to the current process +.Nd send a signal to the current thread .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -49,7 +49,7 @@ The .Fn raise function sends the signal .Fa sig -to the current process. +to the current thread. .Sh RETURN VALUES .Rv -std raise .Sh ERRORS From owner-svn-src-head@FreeBSD.ORG Fri May 7 18:03:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2419E1065675; Fri, 7 May 2010 18:03:36 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1401F8FC0C; Fri, 7 May 2010 18:03:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47I3ZdV069960; Fri, 7 May 2010 18:03:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47I3ZYO069958; Fri, 7 May 2010 18:03:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005071803.o47I3ZYO069958@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 7 May 2010 18:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207750 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 18:03:36 -0000 Author: yongari Date: Fri May 7 18:03:35 2010 New Revision: 207750 URL: http://svn.freebsd.org/changeset/base/207750 Log: 8255x configure command requires number of bytes of configuration table. The default size of the configuration table was 22 bytes. To use extended feature of 82550/82551 the configuration table size was expanded to 32 bytes. The added configuration for 82550/82551 specifies VLAN hardware tagging and IPSec configuration as well as TCO. To make configuration easier fxp(4) used a configuration template and the template was copied to configuration table. After that, some parameters of the configuration table was changed depending on controller type and operation mode. However the size of template was 22 bytes so some configuration parameters were not properly initialized on 82550/82551. Fix this by increasing the template size. For 82557, 82558 and 82559 the size of the configuration is still 22 bytes. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Fri May 7 17:20:15 2010 (r207749) +++ head/sys/dev/fxp/if_fxp.c Fri May 7 18:03:35 2010 (r207750) @@ -106,9 +106,8 @@ static int tx_threshold = 64; /* * The configuration byte map has several undefined fields which - * must be one or must be zero. Set up a template for these bits - * only, (assuming a 82557 chip) leaving the actual configuration - * to fxp_init. + * must be one or must be zero. Set up a template for these bits. + * The actual configuration is performed in fxp_init. * * See struct fxp_cb_config for the bit definitions. */ @@ -137,7 +136,17 @@ static u_char fxp_cb_config_template[] = 0xf0, /* 18 */ 0x0, /* 19 */ 0x3f, /* 20 */ - 0x5 /* 21 */ + 0x5, /* 21 */ + 0x0, /* 22 */ + 0x0, /* 23 */ + 0x0, /* 24 */ + 0x0, /* 25 */ + 0x0, /* 26 */ + 0x0, /* 27 */ + 0x0, /* 28 */ + 0x0, /* 29 */ + 0x0, /* 30 */ + 0x0 /* 31 */ }; /* From owner-svn-src-head@FreeBSD.ORG Fri May 7 18:57:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A3A36106567A; Fri, 7 May 2010 18:57:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 93D1E8FC21; Fri, 7 May 2010 18:57:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47IvQkl081846; Fri, 7 May 2010 18:57:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47IvQpG081844; Fri, 7 May 2010 18:57:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201005071857.o47IvQpG081844@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 7 May 2010 18:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207752 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 18:57:26 -0000 Author: kib Date: Fri May 7 18:57:26 2010 New Revision: 207752 URL: http://svn.freebsd.org/changeset/base/207752 Log: One more use for vm_pageout_init_marker(). Reviewed by: alc Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri May 7 18:22:51 2010 (r207751) +++ head/sys/vm/vm_pageout.c Fri May 7 18:57:26 2010 (r207752) @@ -765,14 +765,7 @@ vm_pageout_scan(int pass) */ page_shortage = vm_paging_target() + addl_page_shortage_init; - /* - * Initialize our marker - */ - bzero(&marker, sizeof(marker)); - marker.flags = PG_FICTITIOUS | PG_MARKER; - marker.oflags = VPO_BUSY; - marker.queue = PQ_INACTIVE; - marker.wire_count = 1; + vm_pageout_marker_init(&marker, PQ_INACTIVE); /* * Start scanning the inactive queue for pages we can move to the From owner-svn-src-head@FreeBSD.ORG Fri May 7 19:48:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 18EEC1065670; Fri, 7 May 2010 19:48:51 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 074C18FC12; Fri, 7 May 2010 19:48:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47JmoRx093417; Fri, 7 May 2010 19:48:50 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47JmooH093415; Fri, 7 May 2010 19:48:50 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201005071948.o47JmooH093415@svn.freebsd.org> From: Fabien Thomas Date: Fri, 7 May 2010 19:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207755 - head/usr.sbin/pmcstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 19:48:51 -0000 Author: fabient Date: Fri May 7 19:48:50 2010 New Revision: 207755 URL: http://svn.freebsd.org/changeset/base/207755 Log: Rework the calltree top view by critical callchain. The percentage show is the sum of the cost for the codepath. MFC after: 1 week Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- head/usr.sbin/pmcstat/pmcpl_calltree.c Fri May 7 19:02:31 2010 (r207754) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Fri May 7 19:48:50 2010 (r207755) @@ -120,8 +120,15 @@ struct pmcpl_ct_node_hash { struct pmcpl_ct_sample pmcpl_ct_callid; #define PMCPL_CT_MAXCOL PMC_CALLCHAIN_DEPTH_MAX -#define PMCPL_CT_MAXLINE 256 -struct pmcpl_ct_node *pmcpl_ct_topscreen[PMCPL_CT_MAXCOL][PMCPL_CT_MAXLINE]; +#define PMCPL_CT_MAXLINE 1024 /* TODO: dynamic. */ + +struct pmcpl_ct_line { + unsigned ln_sum; + unsigned ln_index; +}; + +struct pmcpl_ct_line pmcpl_ct_topmax[PMCPL_CT_MAXLINE+1]; +struct pmcpl_ct_node *pmcpl_ct_topscreen[PMCPL_CT_MAXCOL+1][PMCPL_CT_MAXLINE+1]; /* * All nodes indexed by function/image name are placed in a hash table. @@ -225,28 +232,6 @@ pmcpl_ct_arc_grow(int cursize, int *maxs } /* - * Compare two arc by samples value. - */ -static int -pmcpl_ct_arc_compare(void *thunk, const void *a, const void *b) -{ - const struct pmcpl_ct_arc *ct1, *ct2; - int pmcin = *(int *)thunk; - - ct1 = (const struct pmcpl_ct_arc *) a; - ct2 = (const struct pmcpl_ct_arc *) b; - - /* Sort in reverse order */ - if (PMCPL_CT_SAMPLE(pmcin, &ct1->pcta_samples) < - PMCPL_CT_SAMPLE(pmcin, &ct2->pcta_samples)) - return (1); - if (PMCPL_CT_SAMPLE(pmcin, &ct1->pcta_samples) > - PMCPL_CT_SAMPLE(pmcin, &ct2->pcta_samples)) - return (-1); - return (0); -} - -/* * Grow the instr table. */ @@ -366,9 +351,9 @@ pmcpl_ct_node_cleartag(void) static int pmcpl_ct_node_dumptop(int pmcin, struct pmcpl_ct_node *ct, - struct pmcpl_ct_sample *rsamples, int x, int *y, int maxy) + struct pmcpl_ct_sample *rsamples, int x, int *y) { - int i; + int i, terminal; if (ct->pct_flags & PMCPL_PCT_TAG) return 0; @@ -382,12 +367,21 @@ pmcpl_ct_node_dumptop(int pmcin, struct pmcpl_ct_topscreen[x][*y] = ct; /* - * This is a terminal node + * Check if this is a terminal node. + * We need to check that some samples exist + * for at least one arc for that PMC. */ - if (ct->pct_narc == 0) { + terminal = 1; + for (i = 0; i < ct->pct_narc; i++) + if (PMCPL_CT_SAMPLE(pmcin, + &ct->pct_arc[i].pcta_samples) != 0) { + terminal = 0; + break; + } + + if (ct->pct_narc == 0 || terminal) { pmcpl_ct_topscreen[x+1][*y] = NULL; - if (*y >= PMCPL_CT_MAXLINE || - *y >= maxy) + if (*y >= PMCPL_CT_MAXLINE) return 1; *y = *y + 1; for (i=0; i < x; i++) @@ -396,14 +390,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct return 0; } - /* - * Quicksort the arcs. - */ - qsort_r(ct->pct_arc, ct->pct_narc, sizeof(struct pmcpl_ct_arc), - &pmcin, pmcpl_ct_arc_compare); - for (i = 0; i < ct->pct_narc; i++) { - /* Skip this arc if there is no sample at all. */ if (PMCPL_CT_SAMPLE(pmcin, &ct->pct_arc[i].pcta_samples) == 0) continue; @@ -411,7 +398,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct &ct->pct_arc[i].pcta_samples) > pmcstat_threshold) { if (pmcpl_ct_node_dumptop(pmcin, ct->pct_arc[i].pcta_child, - rsamples, x+1, y, maxy)) + rsamples, x+1, y)) return 1; } } @@ -420,12 +407,36 @@ pmcpl_ct_node_dumptop(int pmcin, struct } /* + * Compare two top line by sum. + */ +static int +pmcpl_ct_line_compare(const void *a, const void *b) +{ + const struct pmcpl_ct_line *ct1, *ct2; + + ct1 = (const struct pmcpl_ct_line *) a; + ct2 = (const struct pmcpl_ct_line *) b; + + /* Sort in reverse order */ + if (ct1->ln_sum < ct2->ln_sum) + return (1); + if (ct1->ln_sum > ct2->ln_sum) + return (-1); + return (0); +} + +/* * Format and display given PMC index. */ static void pmcpl_ct_node_printtop(struct pmcpl_ct_sample *rsamples, int pmcin, int maxy) { +#undef TS +#undef TSI +#define TS(x, y) (pmcpl_ct_topscreen[x][y]) +#define TSI(x, y) (pmcpl_ct_topscreen[x][pmcpl_ct_topmax[y].ln_index]) + int v_attrs, ns_len, vs_len, is_len, width, indentwidth, x, y; float v; char ns[30], vs[10], is[20]; @@ -433,33 +444,60 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s struct pmcstat_symbol *sym; const char *space = " "; + /* + * Sort by line cost. + */ + for (y = 0; ; y++) { + ct = TS(1, y); + if (ct == NULL) + break; + + pmcpl_ct_topmax[y].ln_sum = 0; + pmcpl_ct_topmax[y].ln_index = y; + for (x = 1; TS(x, y) != NULL; x++) { + pmcpl_ct_topmax[y].ln_sum += + PMCPL_CT_SAMPLE(pmcin, &TS(x, y)->pct_samples); + } + } + qsort(pmcpl_ct_topmax, y, sizeof(pmcpl_ct_topmax[0]), + pmcpl_ct_line_compare); + pmcpl_ct_topmax[y].ln_index = y; + for (y = 0; y < maxy; y++) { - /* Output image. */ - ct = pmcpl_ct_topscreen[0][y]; - snprintf(is, sizeof(is), "%-10.10s", - pmcstat_string_unintern(ct->pct_image->pi_name)); - PMCSTAT_PRINTW("%s ", is); - width = indentwidth = 11; + ct = TSI(1, y); + if (ct == NULL) + break; - for (x = 0; pmcpl_ct_topscreen[x][y] !=NULL; x++) { + if (y > 0) + PMCSTAT_PRINTW("\n"); - ct = pmcpl_ct_topscreen[x][y]; + /* Output sum. */ + v = pmcpl_ct_topmax[y].ln_sum * 100.0 / + rsamples->sb[pmcin]; + snprintf(vs, sizeof(vs), "%.1f", v); + v_attrs = PMCSTAT_ATTRPERCENT(v); + PMCSTAT_ATTRON(v_attrs); + PMCSTAT_PRINTW("%5.5s ", vs); + PMCSTAT_ATTROFF(v_attrs); + + width = indentwidth = 5 + 1; + + for (x = 1; (ct = TSI(x, y)) != NULL; x++) { - ns[0] = '\0'; ns_len = 0; vs[0] = '\0'; vs_len = 0; is[0] = '\0'; is_len = 0; /* Format value. */ v = PMCPL_CT_SAMPLEP(pmcin, &ct->pct_samples); if (v > pmcstat_threshold) - vs_len = snprintf(vs, sizeof(vs), "(%.1f%%)", v); + vs_len = snprintf(vs, sizeof(vs), + "(%.1f%%)", v); v_attrs = PMCSTAT_ATTRPERCENT(v); if (pmcstat_skiplink && v <= pmcstat_threshold) { - PMCSTAT_PRINTW(". "); - width += 2; - continue; - } + strlcpy(ns, ".", sizeof(ns)); + ns_len = 1; + } else { sym = pmcstat_symbol_search(ct->pct_image, ct->pct_func); if (sym != NULL) { ns_len = snprintf(ns, sizeof(ns), "%s", @@ -469,12 +507,14 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s (void *)ct->pct_func); /* Format image. */ - if (x > 0 && pmcpl_ct_topscreen[x-1][y]->pct_image != ct->pct_image) + if (x == 1 || + TSI(x-1, y)->pct_image != ct->pct_image) is_len = snprintf(is, sizeof(is), "@%s", pmcstat_string_unintern(ct->pct_image->pi_name)); /* Check for line wrap. */ width += ns_len + is_len + vs_len + 1; + } if (width >= pmcstat_displaywidth) { maxy--; if (y >= maxy) @@ -487,7 +527,6 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s PMCSTAT_PRINTW("%s%s%s ", ns, is, vs); PMCSTAT_ATTROFF(v_attrs); } - PMCSTAT_PRINTW("\n"); } } @@ -498,46 +537,25 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s void pmcpl_ct_topdisplay(void) { - int i, x, y, pmcin; + int y; struct pmcpl_ct_sample r, *rsamples; rsamples = &r; pmcpl_ct_samples_root(rsamples); - PMCSTAT_PRINTW("%-10.10s %s\n", "IMAGE", "CALLTREE"); + pmcpl_ct_node_cleartag(); - for (pmcin = 0; pmcin < pmcstat_npmcs; pmcin++) { - /* Filter PMCs. */ - if (pmcstat_pmcinfilter != pmcin) - continue; + PMCSTAT_PRINTW("%5.5s %s\n", "%SAMP", "CALLTREE"); - pmcpl_ct_node_cleartag(); + y = 0; + if (pmcpl_ct_node_dumptop(pmcstat_pmcinfilter, + pmcpl_ct_root, rsamples, 0, &y)) + PMCSTAT_PRINTW("...\n"); + pmcpl_ct_topscreen[1][y] = NULL; - /* Quicksort the arcs. */ - qsort_r(pmcpl_ct_root->pct_arc, - pmcpl_ct_root->pct_narc, - sizeof(struct pmcpl_ct_arc), - &pmcin, pmcpl_ct_arc_compare); - - x = y = 0; - for (i = 0; i < pmcpl_ct_root->pct_narc; i++) { - /* Skip this arc if there is no sample at all. */ - if (PMCPL_CT_SAMPLE(pmcin, - &pmcpl_ct_root->pct_arc[i].pcta_samples) == 0) - continue; - if (PMCPL_CT_SAMPLEP(pmcin, - &pmcpl_ct_root->pct_arc[i].pcta_samples) <= - pmcstat_threshold) - continue; - if (pmcpl_ct_node_dumptop(pmcin, - pmcpl_ct_root->pct_arc[i].pcta_child, - rsamples, x, &y, pmcstat_displayheight - 2)) { - break; - } - } + pmcpl_ct_node_printtop(rsamples, + pmcstat_pmcinfilter, pmcstat_displayheight - 2); - pmcpl_ct_node_printtop(rsamples, pmcin, y); - } pmcpl_ct_samples_free(rsamples); } From owner-svn-src-head@FreeBSD.ORG Fri May 7 20:46:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1D181065670; Fri, 7 May 2010 20:46:22 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 91CED8FC0A; Fri, 7 May 2010 20:46:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47KkMib006227; Fri, 7 May 2010 20:46:22 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47KkMmN006225; Fri, 7 May 2010 20:46:22 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005072046.o47KkMmN006225@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 7 May 2010 20:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207757 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 20:46:22 -0000 Author: jilles Date: Fri May 7 20:46:22 2010 New Revision: 207757 URL: http://svn.freebsd.org/changeset/base/207757 Log: sigprocmask(2): pthread_sigmask(3) must be used in threaded processes. Although libthr's pthread_sigmask() just calls sigprocmask() and this is unlikely to change, mention this POSIX requirement on applications. MFC after: 1 week Modified: head/lib/libc/sys/sigprocmask.2 Modified: head/lib/libc/sys/sigprocmask.2 ============================================================================== --- head/lib/libc/sys/sigprocmask.2 Fri May 7 20:02:36 2010 (r207756) +++ head/lib/libc/sys/sigprocmask.2 Fri May 7 20:46:22 2010 (r207757) @@ -28,7 +28,7 @@ .\" @(#)sigprocmask.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 7, 2010 .Dt SIGPROCMASK 2 .Os .Sh NAME @@ -96,6 +96,11 @@ quietly disallows or .Dv SIGSTOP to be blocked. +.Pp +In threaded applications, +.Xr pthread_sigmask 3 +must be used instead of +.Fn sigprocmask . .Sh RETURN VALUES .Rv -std sigprocmask .Sh ERRORS @@ -116,6 +121,7 @@ has a value other than those listed here .Xr sigpending 2 , .Xr sigsuspend 2 , .Xr fpsetmask 3 , +.Xr pthread_sigmask 3 , .Xr sigsetops 3 .Sh STANDARDS The From owner-svn-src-head@FreeBSD.ORG Fri May 7 21:06:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5313B10656A4; Fri, 7 May 2010 21:06:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 437538FC1E; Fri, 7 May 2010 21:06:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47L6qSW010789; Fri, 7 May 2010 21:06:52 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47L6q9g010787; Fri, 7 May 2010 21:06:52 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201005072106.o47L6q9g010787@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 7 May 2010 21:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207759 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 21:06:52 -0000 Author: jkim Date: Fri May 7 21:06:52 2010 New Revision: 207759 URL: http://svn.freebsd.org/changeset/base/207759 Log: Fix a typo in the previous commit. Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri May 7 20:58:50 2010 (r207758) +++ head/sys/vm/vm_pageout.c Fri May 7 21:06:52 2010 (r207759) @@ -765,7 +765,7 @@ vm_pageout_scan(int pass) */ page_shortage = vm_paging_target() + addl_page_shortage_init; - vm_pageout_marker_init(&marker, PQ_INACTIVE); + vm_pageout_init_marker(&marker, PQ_INACTIVE); /* * Start scanning the inactive queue for pages we can move to the From owner-svn-src-head@FreeBSD.ORG Fri May 7 22:09:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DB3481065672; Fri, 7 May 2010 22:09:17 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CAA0D8FC0C; Fri, 7 May 2010 22:09:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47M9Hqa024511; Fri, 7 May 2010 22:09:17 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47M9Hxf024507; Fri, 7 May 2010 22:09:17 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201005072209.o47M9Hxf024507@svn.freebsd.org> From: Fabien Thomas Date: Fri, 7 May 2010 22:09:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207761 - in head/sys: dev/bce dev/mxge sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 22:09:18 -0000 Author: fabient Date: Fri May 7 22:09:17 2010 New Revision: 207761 URL: http://svn.freebsd.org/changeset/base/207761 Log: Add a fastpath to allocate from packet zone when using m_getjcl. This will add support for packet zone for at least igb and ixgbe and will avoid to check for that in bce and mxge. MFC after: 1 week Modified: head/sys/dev/bce/if_bce.c head/sys/dev/mxge/if_mxge.c head/sys/sys/mbuf.h Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Fri May 7 21:48:51 2010 (r207760) +++ head/sys/dev/bce/if_bce.c Fri May 7 22:09:17 2010 (r207761) @@ -5059,11 +5059,8 @@ bce_get_rx_buf(struct bce_softc *sc, str #ifdef BCE_JUMBO_HDRSPLIT MGETHDR(m_new, M_DONTWAIT, MT_DATA); #else - if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES) - m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, - sc->rx_bd_mbuf_alloc_size); + m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, + sc->rx_bd_mbuf_alloc_size); #endif if (m_new == NULL) { Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Fri May 7 21:48:51 2010 (r207760) +++ head/sys/dev/mxge/if_mxge.c Fri May 7 22:09:17 2010 (r207761) @@ -2400,10 +2400,7 @@ mxge_get_buf_big(struct mxge_slice_state mxge_rx_ring_t *rx = &ss->rx_big; int cnt, err, i; - if (rx->cl_size == MCLBYTES) - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); if (m == NULL) { rx->alloc_fail++; err = ENOBUFS; Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Fri May 7 21:48:51 2010 (r207760) +++ head/sys/sys/mbuf.h Fri May 7 22:09:17 2010 (r207761) @@ -523,6 +523,9 @@ m_getjcl(int how, short type, int flags, struct mbuf *m, *n; uma_zone_t zone; + if (size == MCLBYTES) + return m_getcl(how, type, flags); + args.flags = flags; args.type = type; From owner-svn-src-head@FreeBSD.ORG Fri May 7 23:05:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B874F1065678; Fri, 7 May 2010 23:05:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id A84088FC13; Fri, 7 May 2010 23:05:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o47N5R7Z036981; Fri, 7 May 2010 23:05:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o47N5R61036979; Fri, 7 May 2010 23:05:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005072305.o47N5R61036979@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 7 May 2010 23:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207763 - head/sys/dev/re X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 23:05:27 -0000 Author: yongari Date: Fri May 7 23:05:27 2010 New Revision: 207763 URL: http://svn.freebsd.org/changeset/base/207763 Log: Don't change PCIe maximum read request size to 2048 on RTL810x controllers. It caused device timeouts. Reported by: McLone < mclone <> gmail dot com > Tested by: McLone < mclone <> gmail dot com > MFC after: 5 days Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Fri May 7 22:58:14 2010 (r207762) +++ head/sys/dev/re/if_re.c Fri May 7 23:05:27 2010 (r207763) @@ -1162,9 +1162,11 @@ re_attach(device_t dev) msic = 0; if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { sc->rl_flags |= RL_FLAG_PCIE; - /* Set PCIe maximum read request size to 2048. */ - if (pci_get_max_read_req(dev) < 2048) - pci_set_max_read_req(dev, 2048); + if (devid != RT_DEVICEID_8101E) { + /* Set PCIe maximum read request size to 2048. */ + if (pci_get_max_read_req(dev) < 2048) + pci_set_max_read_req(dev, 2048); + } msic = pci_msi_count(dev); if (bootverbose) device_printf(dev, "MSI count : %d\n", msic); From owner-svn-src-head@FreeBSD.ORG Sat May 8 01:24:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5435106566B; Sat, 8 May 2010 01:24:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D4C258FC0A; Sat, 8 May 2010 01:24:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o481OI8U067243; Sat, 8 May 2010 01:24:18 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o481OIGb067241; Sat, 8 May 2010 01:24:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201005080124.o481OIGb067241@svn.freebsd.org> From: Rick Macklem Date: Sat, 8 May 2010 01:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207764 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 01:24:19 -0000 Author: rmacklem Date: Sat May 8 01:24:18 2010 New Revision: 207764 URL: http://svn.freebsd.org/changeset/base/207764 Log: Patch the experimental NFS client so that it works for NFSv2 by adding the necessary mapping from NFSv3 procedure numbers to NFSv2 procedure numbers when doing NFSv2 RPCs. MFC after: 1 week Modified: head/sys/fs/nfs/nfs_commonkrpc.c Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Fri May 7 23:05:27 2010 (r207763) +++ head/sys/fs/nfs/nfs_commonkrpc.c Sat May 8 01:24:18 2010 (r207764) @@ -97,14 +97,37 @@ static void nfs_up(struct nfsmount *, st int, int); static int nfs_msg(struct thread *, const char *, const char *, int); -extern int nfsv2_procid[]; - struct nfs_cached_auth { int ca_refs; /* refcount, including 1 from the cache */ uid_t ca_uid; /* uid that corresponds to this auth */ AUTH *ca_auth; /* RPC auth handle */ }; +static int nfsv2_procid[NFS_V3NPROCS] = { + NFSV2PROC_NULL, + NFSV2PROC_GETATTR, + NFSV2PROC_SETATTR, + NFSV2PROC_LOOKUP, + NFSV2PROC_NOOP, + NFSV2PROC_READLINK, + NFSV2PROC_READ, + NFSV2PROC_WRITE, + NFSV2PROC_CREATE, + NFSV2PROC_MKDIR, + NFSV2PROC_SYMLINK, + NFSV2PROC_CREATE, + NFSV2PROC_REMOVE, + NFSV2PROC_RMDIR, + NFSV2PROC_RENAME, + NFSV2PROC_LINK, + NFSV2PROC_READDIR, + NFSV2PROC_NOOP, + NFSV2PROC_STATFS, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, +}; + /* * Initialize sockets and congestion for a new NFS connection. * We do not free the sockaddr if error. @@ -533,6 +556,15 @@ newnfs_request(struct nfsrv_descript *nd if (nmp != NULL) { NFSINCRGLOBAL(newnfsstats.rpcrequests); + + /* Map the procnum to the old NFSv2 one, as required. */ + if ((nd->nd_flag & ND_NFSV2) != 0) { + if (nd->nd_procnum < NFS_V3NPROCS) + procnum = nfsv2_procid[nd->nd_procnum]; + else + procnum = NFSV2PROC_NOOP; + } + /* * Now only used for the R_DONTRECOVER case, but until that is * supported within the krpc code, I need to keep a queue of From owner-svn-src-head@FreeBSD.ORG Sat May 8 11:56:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DEA531065672; Sat, 8 May 2010 11:56:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CEDC08FC12; Sat, 8 May 2010 11:56:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48Bu0cc006646; Sat, 8 May 2010 11:56:00 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48Bu0ma006645; Sat, 8 May 2010 11:56:00 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201005081156.o48Bu0ma006645@svn.freebsd.org> From: Ed Maste Date: Sat, 8 May 2010 11:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207768 - head/sys/dev/usb/wlan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 11:56:01 -0000 Author: emaste Date: Sat May 8 11:56:00 2010 New Revision: 207768 URL: http://svn.freebsd.org/changeset/base/207768 Log: Add dummy function for ic_update_mcast (a la if_urtw) to avoid console spam. Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat May 8 05:42:05 2010 (r207767) +++ head/sys/dev/usb/wlan/if_rum.c Sat May 8 11:56:00 2010 (r207768) @@ -197,6 +197,7 @@ static void rum_enable_tsf(struct rum_s static void rum_update_slot(struct ifnet *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); +static void rum_update_mcast(struct ifnet *); static void rum_update_promisc(struct ifnet *); static void rum_setpromisc(struct rum_softc *); static const char *rum_get_rf(int); @@ -514,6 +515,7 @@ rum_attach(device_t self) ic->ic_vap_create = rum_vap_create; ic->ic_vap_delete = rum_vap_delete; + ic->ic_update_mcast = rum_update_mcast; ieee80211_radiotap_attach(ic, &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), @@ -1815,6 +1817,13 @@ rum_update_promisc(struct ifnet *ifp) RUM_UNLOCK(sc); } +static void +rum_update_mcast(struct ifnet *ifp) +{ + + /* XXX do nothing? */ +} + static const char * rum_get_rf(int rev) { From owner-svn-src-head@FreeBSD.ORG Sat May 8 14:00:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6DA5B106566C; Sat, 8 May 2010 14:00:08 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 3E6468FC1A; Sat, 8 May 2010 14:00:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48E02Kv034732; Sat, 8 May 2010 14:00:02 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48E02TR034730; Sat, 8 May 2010 14:00:02 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005081400.o48E02TR034730@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 8 May 2010 14:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207783 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 14:00:08 -0000 Author: jilles Date: Sat May 8 14:00:01 2010 New Revision: 207783 URL: http://svn.freebsd.org/changeset/base/207783 Log: sh: Have only one copy of _PATH_STDPATH in the binary. Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sat May 8 13:49:43 2010 (r207782) +++ head/bin/sh/eval.c Sat May 8 14:00:01 2010 (r207783) @@ -1089,8 +1089,7 @@ breakcmd(int argc, char **argv) int commandcmd(int argc, char **argv) { - static char stdpath[] = _PATH_STDPATH; - char *path; + const char *path; int ch; int cmd = -1; @@ -1101,7 +1100,7 @@ commandcmd(int argc, char **argv) while ((ch = getopt(argc, argv, "pvV")) != -1) { switch (ch) { case 'p': - path = stdpath; + path = _PATH_STDPATH; break; case 'v': cmd = TYPECMD_SMALLV; From owner-svn-src-head@FreeBSD.ORG Sat May 8 14:50:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 81E981065672; Sat, 8 May 2010 14:50:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 723B48FC12; Sat, 8 May 2010 14:50:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48EoCeh045662; Sat, 8 May 2010 14:50:12 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48EoCR6045659; Sat, 8 May 2010 14:50:12 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201005081450.o48EoCR6045659@svn.freebsd.org> From: Rick Macklem Date: Sat, 8 May 2010 14:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207785 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 14:50:12 -0000 Author: rmacklem Date: Sat May 8 14:50:12 2010 New Revision: 207785 URL: http://svn.freebsd.org/changeset/base/207785 Log: Fix typos in macros. PR: kern/146375 Submitted by: simon AT comsys.ntu-kpi.kiev.ua MFC after: 1 week Modified: head/sys/fs/nfs/nfskpiport.h head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfskpiport.h ============================================================================== --- head/sys/fs/nfs/nfskpiport.h Sat May 8 14:12:04 2010 (r207784) +++ head/sys/fs/nfs/nfskpiport.h Sat May 8 14:50:12 2010 (r207785) @@ -27,7 +27,7 @@ */ #ifndef _NFS_NFSKPIPORT_H_ -#define _NFSKPIPORT_NFS_H_ +#define _NFS_NFSKPIPORT_H_ /* * These definitions are needed since the generic code is now using Darwin8 * KPI stuff. (I know, seems a bit silly, but I want the code to build on @@ -70,4 +70,4 @@ typedef struct mbuf * mbuf_t; #define uio_iov_len(p) ((p)->uio_iov->iov_len) #define uio_iov_len_add(p, v) ((p)->uio_iov->iov_len += (v)) -#endif /* _NFSKPIPORT_NFS_H */ +#endif /* _NFS_NFSKPIPORT_H */ Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Sat May 8 14:12:04 2010 (r207784) +++ head/sys/fs/nfs/nfsport.h Sat May 8 14:50:12 2010 (r207785) @@ -33,7 +33,7 @@ */ #ifndef _NFS_NFSPORT_H_ -#define _NFSPORT_NFS_H_ +#define _NFS_NFSPORT_H_ /* * In general, I'm not fond of #includes in .h files, but this seems @@ -918,4 +918,4 @@ struct nfsreq { #endif /* _KERNEL */ -#endif /* _NFSPORT_NFS_H */ +#endif /* _NFS_NFSPORT_H */ From owner-svn-src-head@FreeBSD.ORG Sat May 8 15:43:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1572106564A; Sat, 8 May 2010 15:43:59 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8F7FF8FC12; Sat, 8 May 2010 15:43:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48FhxnT057489; Sat, 8 May 2010 15:43:59 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48Fhxbg057487; Sat, 8 May 2010 15:43:59 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201005081543.o48Fhxbg057487@svn.freebsd.org> From: Tim Kientzle Date: Sat, 8 May 2010 15:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207786 - head/usr.bin/tar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 15:43:59 -0000 Author: kientzle Date: Sat May 8 15:43:59 2010 New Revision: 207786 URL: http://svn.freebsd.org/changeset/base/207786 Log: Various manpage updates, including many long-option synonyms that were previously undocumented. Modified: head/usr.bin/tar/bsdtar.1 Modified: head/usr.bin/tar/bsdtar.1 ============================================================================== --- head/usr.bin/tar/bsdtar.1 Sat May 8 14:50:12 2010 (r207785) +++ head/usr.bin/tar/bsdtar.1 Sat May 8 15:43:59 2010 (r207786) @@ -51,7 +51,7 @@ .Nm creates and manipulates streaming archive files. This implementation can extract from tar, pax, cpio, zip, jar, ar, -and ISO 9660 cdrom images and can create tar, pax, cpio, ar, +xar, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, and shar archives. .Pp The first synopsis form shows a @@ -67,6 +67,8 @@ is a mode indicator from the following l .Bl -tag -compact -width indent .It Fl c Create a new archive containing the specified items. +The long option form is +.Fl Fl create . .It Fl r Like .Fl c , @@ -75,8 +77,12 @@ Note that this only works on uncompresse The .Fl f option is required. +The long option form is +.Fl Fl append . .It Fl t List archive contents to stdout. +The long option form is +.Fl Fl list . .It Fl u Like .Fl r , @@ -86,11 +92,15 @@ Note that this only works on uncompresse The .Fl f option is required. +The long form is +.Fl Fl update . .It Fl x Extract to disk from the archive. If a file with the same name appears more than once in the archive, each copy will be extracted, with later copies overwriting (replacing) earlier copies. +The long option form is +.Fl Fl extract . .El .Pp In @@ -127,14 +137,18 @@ In contrast, .Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar creates a new archive with only two entries. Similarly, -.Dl Nm Fl czf Pa - Fl -format Cm pax Cm @ Ns Pa - +.Dl Nm Fl czf Pa - Fl Fl format Cm pax Cm @ Ns Pa - reads an archive from standard input (whose format will be determined automatically) and converts it into a gzip-compressed pax-format archive on stdout. In this way, .Nm can be used to convert archives from one format to another. -.It Fl b Ar blocksize +.It Fl B , Fl Fl read-full-blocks +Ignored for compatibility with other +.Xr tar 1 +implementations. +.It Fl b Ar blocksize , Fl Fl block-size Ar blocksize Specify the block size, in 512-byte records, for tape drive I/O. As a rule, this argument is only needed when reading from or writing to tape drives, and usually not even then as the default block size of @@ -144,21 +158,22 @@ In c and r mode, this changes the direct the following files. In x mode, change directories after opening the archive but before extracting entries from the archive. -.It Fl -check-links -(c and r modes only) -Issue a warning message unless all links to each file are archived. -.It Fl -chroot +.It Fl Fl chroot (x mode only) .Fn chroot to the current directory after processing any .Fl C options and before extracting any files. -.It Fl -exclude Ar pattern +.It Fl Fl disable-copyfile +Mac OS X specific. +Disable the use of +.Xr copyfile 3 . +.It Fl Fl exclude Ar pattern Do not process files or directories that match the specified pattern. Note that exclusions take precedence over patterns or filenames specified on the command line. -.It Fl -format Ar format +.It Fl Fl format Ar format (c, r, u mode only) Use the specified format for the created archive. Supported formats include @@ -172,16 +187,39 @@ Other formats may also be supported; see for more information about currently-supported formats. In r and u modes, when extending an existing archive, the format specified here must be compatible with the format of the existing archive on disk. -.It Fl f Ar file +.It Fl f Ar file , Fl Fl file Ar file Read the archive from or write the archive to the specified file. The filename can be .Pa - for standard input or standard output. -If not specified, the default tape device will be used. -(On +The default varies by system; +on .Fx , -the default tape device is -.Pa /dev/sa0 . ) +the default is +.Pa /dev/sa0 ; +on Linux, the default is +.Pa /dev/st0 . +.It Fl Fl gid Ar id +Use the provided group id number. +On extract, this overrides the group id in the archive; +the group name in the archive will be ignored. +On create, this overrides the group id read from disk; +if +.Fl Fl gname +is not also specified, the group name will be set to +match the group id. +.It Fl Fl gname Ar name +Use the provided group name. +On extract, this overrides the group name in the archive; +if the provided group name does not exist on the system, +the group id +(from the archive or from the +.Fl Fl gid +option) +will be used instead. +On create, this sets the group name that will be stored +in the archive; +the name will not be verified against the system group database. .It Fl H (c and r mode only) Symbolic links named on the command line will be followed; the @@ -193,25 +231,36 @@ Synonym for .It Fl I Synonym for .Fl T . -.It Fl -include Ar pattern +.It Fl Fl help +Show usage. +.It Fl Fl include Ar pattern Process only files or directories that match the specified pattern. Note that exclusions specified with -.Fl -exclude +.Fl Fl exclude take precedence over inclusions. If no inclusions are explicitly specified, all entries are processed by default. The -.Fl -include +.Fl Fl include option is especially useful when filtering archives. For example, the command -.Dl Nm Fl c Fl f Pa new.tar Fl -include='*foo*' Cm @ Ns Pa old.tgz +.Dl Nm Fl c Fl f Pa new.tar Fl Fl include='*foo*' Cm @ Ns Pa old.tgz creates a new archive .Pa new.tar containing only the entries from .Pa old.tgz containing the string .Sq foo . -.It Fl j +.It Fl J , Fl Fl xz +(c mode only) +Compress the resulting archive with +.Xr xz 1 . +In extract or list modes, this option is ignored. +Note that, unlike other +.Nm tar +implementations, this implementation recognizes XZ compression +automatically when reading archives. +.It Fl j , Fl Fl bzip , Fl Fl bzip2 , Fl Fl bunzip2 (c mode only) Compress the resulting archive with .Xr bzip2 1 . @@ -220,69 +269,99 @@ Note that, unlike other .Nm tar implementations, this implementation recognizes bzip2 compression automatically when reading archives. -.It Fl k +.It Fl k , Fl Fl keep-old-files (x mode only) Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies will not overwrite earlier copies. -.It Fl -keep-newer-files +.It Fl Fl keep-newer-files (x mode only) Do not overwrite existing files that are newer than the versions appearing in the archive being extracted. -.It Fl L +.It Fl L , Fl Fl dereference (c and r mode only) All symbolic links will be followed. Normally, symbolic links are archived as such. With this option, the target of the link will be archived instead. -.It Fl l -This is a synonym for the -.Fl -check-links -option. -.It Fl m +.It Fl l , Fl Fl check-links +(c and r modes only) +Issue a warning message unless all links to each file are archived. +.It Fl Fl lzma +(c mode only) Compress the resulting archive with the original LZMA algorithm. +Use of this option is discouraged and new archives should be created with +.Fl Fl xz +instead. +Note that, unlike other +.Nm tar +implementations, this implementation recognizes LZMA compression +automatically when reading archives. +.It Fl m , Fl Fl modification-time (x mode only) Do not extract modification time. By default, the modification time is set to the time stored in the archive. -.It Fl n +.It Fl n , Fl Fl norecurse , Fl Fl no-recursion (c, r, u modes only) Do not recursively archive the contents of directories. -.It Fl -newer Ar date +.It Fl Fl newer Ar date (c, r, u modes only) Only include files and directories newer than the specified date. This compares ctime entries. -.It Fl -newer-mtime Ar date +.It Fl Fl newer-mtime Ar date (c, r, u modes only) Like -.Fl -newer , +.Fl Fl newer , except it compares mtime entries instead of ctime entries. -.It Fl -newer-than Pa file +.It Fl Fl newer-than Pa file (c, r, u modes only) Only include files and directories newer than the specified file. This compares ctime entries. -.It Fl -newer-mtime-than Pa file +.It Fl Fl newer-mtime-than Pa file (c, r, u modes only) Like -.Fl -newer-than , +.Fl Fl newer-than , except it compares mtime entries instead of ctime entries. -.It Fl -nodump +.It Fl Fl nodump (c and r modes only) Honor the nodump file flag by skipping this file. -.It Fl -null +.It Fl Fl null (use with -.Fl I , -.Fl T , +.Fl I or -.Fl X ) +.Fl T ) Filenames or patterns are separated by null characters, not by newlines. This is often used to read filenames output by the .Fl print0 option to .Xr find 1 . -.It Fl -numeric-owner +.It Fl Fl no-same-owner +(x mode only) +Do not extract owner and group IDs. +This is the reverse of +.Fl Fl same-owner +and the default behavior if +.Nm +is run as non-root. +.It Fl Fl no-same-permissions (x mode only) -Ignore symbolic user and group names when restoring archives to disk, -only numeric uid and gid values will be obeyed. -.It Fl O +Do not extract full permissions (SGID, SUID, sticky bit, ACLs, +extended attributes or extended file flags). +This is the reverse of +.Fl p +and the default behavior if +.Nm +is run as non-root. +.It Fl Fl numeric-owner +This is equivalent to +.Fl Fl uname +.Qq +.Fl Fl gname +.Qq . +On extract, it causes user and group names in the archive +to be ignored in favor of the numeric user and group ids. +On create, it causes user and group names to not be stored +in the archive. +.It Fl O , Fl Fl to-stdout (x, t modes only) In extract (-x) mode, files will be written to standard out rather than being extracted to disk. @@ -301,11 +380,11 @@ the archive will be discarded. .It Fl o (c, r, u mode) A synonym for -.Fl -format Ar ustar -.It Fl -one-file-system +.Fl Fl format Ar ustar +.It Fl Fl one-file-system (c, r, and u modes) Do not cross mount points. -.It Fl -options Ar options +.It Fl Fl options Ar options Select optional behaviors for particular modules. The argument is a text string containing comma-separated keywords and values. @@ -376,7 +455,7 @@ Supported values are store (uncompressed .El If a provided option is not supported by any module, that is a fatal error. -.It Fl P +.It Fl P , Fl Fl absolute-paths Preserve pathnames. By default, absolute pathnames (those that begin with a / character) have the leading slash removed both when creating archives @@ -387,21 +466,22 @@ will refuse to extract archive entries w .Pa .. or whose target directory would be altered by a symlink. This option suppresses these behaviors. -.It Fl p +.It Fl p , Fl Fl insecure , Fl Fl preserve-permissions (x mode only) Preserve file permissions. Attempt to restore the full permissions, including owner, file modes, file flags and ACLs, if available, for each item extracted from the archive. -By default, newly-created files are owned by the user running -.Nm , -the file mode is restored for newly-created regular files, and -all other types of entries receive default permissions. -If +This is the default, if .Nm -is being run by root, the default is to restore the owner unless the -.Fl o -option is also specified. -.It Fl q ( Fl -fast-read ) +is being run by root and can be overriden by also specifying +.Fl Fl no-same-owner +and +.Fl Fl no-same-permissions . +.It Fl Fl posix +(c, r, u mode only) +Synonym for +.Fl Fl format Ar pax +.It Fl q , Fl Fl fast-read (x and t mode only) Extract or list only the first archive entry that matches each pattern or filename operand. @@ -416,7 +496,15 @@ Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similiar to the conv=sparse option of dd. -.It Fl -strip-components Ar count +.It Fl Fl same-owner +(x mode only) +Extract owner and group IDs. +This is the reverse of +.Fl Fl no-same-owner +and the default behavior if +.Nm +is run as root. +.It Fl Fl strip-components Ar count (x mode only) Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. @@ -439,7 +527,7 @@ If is not matched, the pattern is skipped. Within .Ar new , -~ is substituted with the match, \1 to \9 with the content of +~ is substituted with the match, \e1 to \e9 with the content of the corresponding captured group. The optional trailing g specifies that matching should continue after the matched part and stopped on the first unmatched pattern. @@ -448,7 +536,7 @@ of symbolic links. The optional trailing p specifies that after a successful substitution the original path name and the new path name should be printed to standard error. -.It Fl T Ar filename +.It Fl T Ar filename , Fl Fl files-from Ar filename In x or t mode, .Nm will read the list of names to be extracted from @@ -462,25 +550,50 @@ The special name on a line by itself will cause the current directory to be changed to the directory specified on the following line. Names are terminated by newlines unless -.Fl -null +.Fl Fl null is specified. Note that -.Fl -null +.Fl Fl null also disables the special handling of lines containing .Dq -C . -.It Fl U +.It Fl Fl totals +(c, r, u mode only) +After archiving all files, print a summary to stderr. +.It Fl U , Fl Fl unlink , Fl Fl unlink-first (x mode only) Unlink files before creating them. -Without this option, -.Nm -overwrites existing files, which preserves existing hardlinks. -With this option, existing hardlinks will be broken, as will any -symlink that would affect the location of an extracted file. -.It Fl -use-compress-program Ar program +This can be a minor performance optimization if most files +already exist, but can make things slower if most files +do not already exist. +This flag also causes +.Nm +to remove intervening directory symlinks instead of +reporting an error. +See the SECURITY section below for more details. +.It Fl Fl uid Ar id +Use the provided user id number and ignore the user +name from the archive. +On create, if +.Fl Fl uname +is not also specified, the user name will be set to +match the user id. +.It Fl Fl uname Ar name +Use the provided user name. +On extract, this overrides the user name in the archive; +if the provided user name does not exist on the system, +it will be ignored and the user id +(from the archive or from the +.Fl Fl uid +option) +will be used instead. +On create, this sets the user name that will be stored +in the archive; +the name is not verified against the system user database. +.It Fl Fl use-compress-program Ar program Pipe the input (in x or t mode) or the output (in c mode) through .Pa program instead of using the builtin compression support. -.It Fl v +.It Fl v , Fl Fl verbose Produce verbose output. In create and extract modes, .Nm @@ -493,18 +606,18 @@ will produce output similar to that of Additional .Fl v options will provide additional detail. -.It Fl -version +.It Fl Fl version Print version of .Nm and .Nm libarchive , and exit. -.It Fl w +.It Fl w , Fl Fl confirmation , Fl Fl interactive Ask for confirmation for every action. -.It Fl X Ar filename +.It Fl X Ar filename , Fl Fl exclude-from Ar filename Read a list of exclusion patterns from the specified file. See -.Fl -exclude +.Fl Fl exclude for more information about the handling of exclusions. .It Fl y (c mode only) @@ -515,25 +628,27 @@ Note that, unlike other .Nm tar implementations, this implementation recognizes bzip2 compression automatically when reading archives. -.It Fl z +.It Fl Z , Fl Fl compress , Fl Fl uncompress (c mode only) Compress the resulting archive with -.Xr gzip 1 . +.Xr compress 1 . In extract or list modes, this option is ignored. Note that, unlike other .Nm tar -implementations, this implementation recognizes gzip compression +implementations, this implementation recognizes compress compression automatically when reading archives. -.It Fl Z +.It Fl z , Fl Fl gunzip , Fl Fl gzip (c mode only) Compress the resulting archive with -.Xr compress 1 . +.Xr gzip 1 . In extract or list modes, this option is ignored. Note that, unlike other .Nm tar -implementations, this implementation recognizes compress compression +implementations, this implementation recognizes gzip compression automatically when reading archives. .El +.Sh EXIT STATUS +.Ex -std .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : @@ -544,27 +659,19 @@ See .Xr environ 7 for more information. .It Ev TAPE -The default tape device. +The default device. The .Fl f option overrides this. +Please see the description of the +.Fl f +option above for more details. .It Ev TZ The timezone to use when displaying dates. See .Xr environ 7 for more information. .El -.Sh FILES -.Bl -tag -width ".Ev BLOCKSIZE" -.It Pa /dev/sa0 -The default tape device, if not overridden by the -.Ev TAPE -environment variable or the -.Fl f -option. -.El -.Sh EXIT STATUS -.Ex -std .Sh EXAMPLES The following creates a new archive called @@ -627,9 +734,9 @@ permissions, or names that differ from e .Dl $ tar -cvf output.tar @input.mtree .Pp The -.Fl -newer +.Fl Fl newer and -.Fl -newer-mtime +.Fl Fl newer-mtime switches accept a variety of common date and time specifications, including .Dq 12 Mar 2005 7:14:29pm , .Dq 2005-03-12 19:14 , @@ -638,7 +745,7 @@ and .Dq 19:14 PST May 1 . .Pp The -.Fl -options +.Fl Fl options argument can be used to control various details of archive generation or reading. For example, you can generate mtree output which only contains @@ -646,9 +753,9 @@ For example, you can generate mtree outp and .Cm uid keywords: -.Dl Nm Fl cf Pa file.tar Fl -format=mtree Fl -options='!all,type,time,uid' Pa dir +.Dl Nm Fl cf Pa file.tar Fl Fl format=mtree Fl Fl options='!all,type,time,uid' Pa dir or you can set the compression level used by gzip or xz compression: -.Dl Nm Fl czf Pa file.tar Fl -options='compression-level=9' . +.Dl Nm Fl czf Pa file.tar Fl Fl options='compression-level=9' . For more details, see the explanation of the .Fn archive_read_set_options and @@ -794,6 +901,7 @@ components, or symlinks to other directo .Xr mt 1 , .Xr pax 1 , .Xr shar 1 , +.Xr xz 1 , .Xr libarchive 3 , .Xr libarchive-formats 5 , .Xr tar 5 @@ -803,7 +911,7 @@ in .St -p1003.1-96 but was dropped from .St -p1003.1-2001 . -The options used by this implementation were developed by surveying a +The options supported by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX specification for pax. .Pp @@ -829,6 +937,9 @@ beginning with This is a complete re-implementation based on the .Xr libarchive 3 library. +It was first released with +.Fx 5.4 +in May, 2005. .Sh BUGS This program follows .St -p1003.1-96 @@ -838,7 +949,7 @@ option. Note that GNU tar prior to version 1.15 treated .Fl l as a synonym for the -.Fl -one-file-system +.Fl Fl one-file-system option. .Pp The @@ -916,6 +1027,3 @@ Converting between dissimilar archive fo convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) -.Pp -There are alternative long options for many of the short options that -are deliberately not documented. From owner-svn-src-head@FreeBSD.ORG Sat May 8 16:19:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 84932106566C; Sat, 8 May 2010 16:19:17 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 752FA8FC0C; Sat, 8 May 2010 16:19:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48GJHnO065336; Sat, 8 May 2010 16:19:17 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48GJHA2065334; Sat, 8 May 2010 16:19:17 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <201005081619.o48GJHA2065334@svn.freebsd.org> From: Ulf Lilleengen Date: Sat, 8 May 2010 16:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207789 - head/sys/geom/vinum X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 16:19:17 -0000 Author: lulf Date: Sat May 8 16:19:17 2010 New Revision: 207789 URL: http://svn.freebsd.org/changeset/base/207789 Log: - Remove obsolete flags. MFC after: 1 week Modified: head/sys/geom/vinum/geom_vinum_var.h Modified: head/sys/geom/vinum/geom_vinum_var.h ============================================================================== --- head/sys/geom/vinum/geom_vinum_var.h Sat May 8 16:10:54 2010 (r207788) +++ head/sys/geom/vinum/geom_vinum_var.h Sat May 8 16:19:17 2010 (r207789) @@ -335,9 +335,6 @@ struct gv_plex { int flags; #define GV_PLEX_ADDED 0x01 /* Added to an existing volume. */ #define GV_PLEX_SYNCING 0x02 /* Plex is syncing from another plex. */ -#define GV_PLEX_THREAD_ACTIVE 0x04 /* Plex has an active RAID5 thread. */ -#define GV_PLEX_THREAD_DIE 0x08 /* Signal the RAID5 thread to die. */ -#define GV_PLEX_THREAD_DEAD 0x10 /* The RAID5 thread has died. */ #define GV_PLEX_NEWBORN 0x20 /* The plex was just created. */ #define GV_PLEX_REBUILDING 0x40 /* The plex is rebuilding. */ #define GV_PLEX_GROWING 0x80 /* The plex is growing. */ @@ -371,9 +368,6 @@ struct gv_volume { #define GV_VOL_UP 1 int flags; -#define GV_VOL_THREAD_ACTIVE 0x01 /* Volume has an active thread. */ -#define GV_VOL_THREAD_DIE 0x02 /* Signal the thread to die. */ -#define GV_VOL_THREAD_DEAD 0x04 /* The thread has died. */ #define GV_VOL_NEWBORN 0x08 /* The volume was just created. */ LIST_HEAD(,gv_plex) plexes; /* List of attached plexes. */ From owner-svn-src-head@FreeBSD.ORG Sat May 8 16:28:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C00FB106566B; Sat, 8 May 2010 16:28:22 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id AF6298FC13; Sat, 8 May 2010 16:28:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48GSMa0067365; Sat, 8 May 2010 16:28:22 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48GSM9s067363; Sat, 8 May 2010 16:28:22 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201005081628.o48GSM9s067363@svn.freebsd.org> From: Tim Kientzle Date: Sat, 8 May 2010 16:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207790 - head/usr.bin/tar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 16:28:22 -0000 Author: kientzle Date: Sat May 8 16:28:22 2010 New Revision: 207790 URL: http://svn.freebsd.org/changeset/base/207790 Log: Config updates. Modified: head/usr.bin/tar/config_freebsd.h Modified: head/usr.bin/tar/config_freebsd.h ============================================================================== --- head/usr.bin/tar/config_freebsd.h Sat May 8 16:19:17 2010 (r207789) +++ head/usr.bin/tar/config_freebsd.h Sat May 8 16:28:22 2010 (r207790) @@ -30,6 +30,7 @@ #undef HAVE_ATTR_XATTR_H #define HAVE_CHROOT 1 +#undef HAVE_DIRECT_H #define HAVE_DIRENT_D_NAMLEN 1 #define HAVE_DIRENT_H 1 #define HAVE_D_MD_ORDER 1 @@ -38,32 +39,43 @@ #define HAVE_FCHDIR 1 #define HAVE_FCNTL_H 1 #define HAVE_GRP_H 1 +#undef HAVE_IO_H #define HAVE_LANGINFO_H 1 +#undef HAVE_LIBACL #define HAVE_LIBARCHIVE 1 #define HAVE_LIMITS_H 1 #undef HAVE_LINUX_EXT2_FS_H #undef HAVE_LINUX_FS_H #define HAVE_LOCALE_H 1 -#if __FreeBSD_version >= 450002 /* nl_langinfo introduced */ +#define HAVE_MBTOWC 1 +#undef HAVE_NDIR_H #define HAVE_NL_LANGINFO 1 -#endif #define HAVE_PATHS_H 1 #define HAVE_PWD_H 1 #define HAVE_REGEX_H 1 #define HAVE_SETLOCALE 1 +#define HAVE_SIGACTION 1 +#define HAVE_SIGNAL_H 1 #define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 +#undef HAVE_STRNCPY_S #define HAVE_STRUCT_STAT_ST_FLAGS 1 -#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#undef HAVE_STRUCT_STAT_ST_MTIME_N +#undef HAVE_STRUCT_STAT_ST_MTIME_USEC +#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC +#undef HAVE_STRUCT_STAT_ST_UMTIME +#define HAVE_SYS_CDEFS_H 1 +#define HAVE_SYS_DIR_H 1 #define HAVE_SYS_IOCTL_H 1 +#undef HAVE_SYS_NDIR_H #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_STAT_H 1 -#define HAVE_TIME_H 1 #define HAVE_SYS_TYPES_H 1 -#define HAVE_UINTMAX_T 1 +#define HAVE_TIME_H 1 #define HAVE_UNISTD_H 1 -#define HAVE_UNSIGNED_LONG_LONG #define HAVE_WCTYPE_H 1 -#undef MAJOR_IN_MKDEV +#undef HAVE_WINDOWS_H + From owner-svn-src-head@FreeBSD.ORG Sat May 8 16:29:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 396A2106566B; Sat, 8 May 2010 16:29:03 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 10D208FC08; Sat, 8 May 2010 16:29:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48GT2Rg067533; Sat, 8 May 2010 16:29:02 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48GT2f8067531; Sat, 8 May 2010 16:29:02 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201005081629.o48GT2f8067531@svn.freebsd.org> From: Tim Kientzle Date: Sat, 8 May 2010 16:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207791 - head/usr.bin/tar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 16:29:03 -0000 Author: kientzle Date: Sat May 8 16:29:02 2010 New Revision: 207791 URL: http://svn.freebsd.org/changeset/base/207791 Log: FreeBSD is now using bsdtar 2.8.3. Modified: head/usr.bin/tar/Makefile Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Sat May 8 16:28:22 2010 (r207790) +++ head/usr.bin/tar/Makefile Sat May 8 16:29:02 2010 (r207791) @@ -2,7 +2,7 @@ .include PROG= bsdtar -BSDTAR_VERSION_STRING=2.7.0 +BSDTAR_VERSION_STRING=2.8.3 SRCS= bsdtar.c \ cmdline.c \ err.c \ From owner-svn-src-head@FreeBSD.ORG Sat May 8 16:47:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 71FDE106566C; Sat, 8 May 2010 16:47:33 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 60B4F8FC0C; Sat, 8 May 2010 16:47:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48GlXgS071720; Sat, 8 May 2010 16:47:33 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48GlXxV071713; Sat, 8 May 2010 16:47:33 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201005081647.o48GlXxV071713@svn.freebsd.org> From: Tim Kientzle Date: Sat, 8 May 2010 16:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207792 - head/usr.bin/cpio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 16:47:33 -0000 Author: kientzle Date: Sat May 8 16:47:33 2010 New Revision: 207792 URL: http://svn.freebsd.org/changeset/base/207792 Log: bsdcpio 2.8.3 Added: head/usr.bin/cpio/err.h (contents, props changed) head/usr.bin/cpio/line_reader.c (contents, props changed) head/usr.bin/cpio/line_reader.h (contents, props changed) Modified: head/usr.bin/cpio/Makefile head/usr.bin/cpio/bsdcpio.1 head/usr.bin/cpio/cmdline.c head/usr.bin/cpio/config_freebsd.h head/usr.bin/cpio/cpio.c head/usr.bin/cpio/cpio.h head/usr.bin/cpio/cpio_platform.h head/usr.bin/cpio/err.c head/usr.bin/cpio/matching.c head/usr.bin/cpio/matching.h head/usr.bin/cpio/pathmatch.c head/usr.bin/cpio/pathmatch.h Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Sat May 8 16:29:02 2010 (r207791) +++ head/usr.bin/cpio/Makefile Sat May 8 16:47:33 2010 (r207792) @@ -3,8 +3,8 @@ .include PROG= bsdcpio -BSDCPIO_VERSION_STRING=2.7.0 -SRCS= cpio.c cmdline.c err.c matching.c pathmatch.c +BSDCPIO_VERSION_STRING=2.8.3 +SRCS= cpio.c cmdline.c err.c line_reader.c matching.c pathmatch.c CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\" CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" .ifdef RELEASE_CRUNCH Modified: head/usr.bin/cpio/bsdcpio.1 ============================================================================== --- head/usr.bin/cpio/bsdcpio.1 Sat May 8 16:29:02 2010 (r207791) +++ head/usr.bin/cpio/bsdcpio.1 Sat May 8 16:47:33 2010 (r207792) @@ -80,6 +80,9 @@ specified directory. Unless specifically stated otherwise, options are applicable in all operating modes. .Bl -tag -width indent +.It Fl 0 +Read filenames separated by NUL characters instead of newlines. +This is necessary if any of the filenames being read might contain newlines. .It Fl A (o mode only) Append to the specified archive. @@ -142,6 +145,11 @@ for more complete information about the formats currently supported by the underlying .Xr libarchive 3 library. +.It Fl H Ar format +Synonym for +.Fl -format . +.It Fl h , Fl -help +Print usage information. .It Fl I Ar file Read archive from .Ar file . @@ -154,6 +162,14 @@ Disable security checks during extractio This allows extraction via symbolic links and path names containing .Sq .. in the name. +.It Fl J +(o mode only) +Compress the file with xz-compatible compression before writing it. +In input mode, this option is ignored; xz compression is recognized +automatically on input. +.It Fl j +Synonym for +.Fl y . .It Fl L (o and p modes) All symbolic links will be followed. @@ -163,6 +179,11 @@ With this option, the target of the link (p mode only) Create links from the target directory to the original files, instead of copying. +.It Fl lzma +(o mode only) +Compress the file with lzma-compatible compression before writing it. +In input mode, this option is ignored; lzma compression is recognized +automatically on input. .It Fl m (i and p modes) Set file modification time on created files to match @@ -176,6 +197,10 @@ By default, displays the user and group names when they are provided in the archive, or looks up the user and group names in the system password database. +.It Fl no-preserve-owner +(i mode only) +Do not attempt to restore file ownership. +This is the default when run by non-root users. .It Fl O Ar file Write archive to .Ar file . @@ -185,6 +210,10 @@ See above for description. .It Fl p Pass-through mode. See above for description. +.It Fl preserve-owner +(i mode only) +Restore file ownership. +This is the default when run by the root user. .It Fl -quiet Suppress unnecessary messages. .It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc @@ -266,7 +295,7 @@ for more information. .Sh EXAMPLES The .Nm -command is traditionally used to copy file hierarchies in conjunction +command is traditionally used to copy file heirarchies in conjunction with the .Xr find 1 command. Modified: head/usr.bin/cpio/cmdline.c ============================================================================== --- head/usr.bin/cpio/cmdline.c Sat May 8 16:29:02 2010 (r207791) +++ head/usr.bin/cpio/cmdline.c Sat May 8 16:47:33 2010 (r207792) @@ -46,11 +46,12 @@ __FBSDID("$FreeBSD$"); #endif #include "cpio.h" +#include "err.h" /* * Short options for cpio. Please keep this sorted. */ -static const char *short_options = "0AaBC:F:O:cdE:f:H:hijLlmnopR:rtuvVW:yZz"; +static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuvW:yZz"; /* * Long options for cpio. Please keep this sorted. @@ -61,7 +62,6 @@ static const struct option { int equivalent; /* Equivalent short option. */ } cpio_longopts[] = { { "create", 0, 'o' }, - { "dot", 0, 'V' }, { "extract", 0, 'i' }, { "file", 1, 'F' }, { "format", 1, 'H' }, @@ -69,6 +69,7 @@ static const struct option { { "insecure", 0, OPTION_INSECURE }, { "link", 0, 'l' }, { "list", 0, 't' }, + { "lzma", 0, OPTION_LZMA }, { "make-directories", 0, 'd' }, { "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER }, { "null", 0, '0' }, @@ -76,10 +77,12 @@ static const struct option { { "owner", 1, 'R' }, { "pass-through", 0, 'p' }, { "preserve-modification-time", 0, 'm' }, + { "preserve-owner", 0, OPTION_PRESERVE_OWNER }, { "quiet", 0, OPTION_QUIET }, { "unconditional", 0, 'u' }, { "verbose", 0, 'v' }, { "version", 0, OPTION_VERSION }, + { "xz", 0, 'J' }, { NULL, 0, 0 } }; @@ -172,7 +175,7 @@ cpio_getopt(struct cpio *cpio) /* Otherwise, pick up the next word. */ opt_word = *cpio->argv; if (opt_word == NULL) { - cpio_warnc(0, + warnc(0, "Option -%c requires an argument", opt); return ('?'); @@ -223,13 +226,13 @@ cpio_getopt(struct cpio *cpio) /* Fail if there wasn't a unique match. */ if (match == NULL) { - cpio_warnc(0, + warnc(0, "Option %s%s is not supported", long_prefix, opt_word); return ('?'); } if (match2 != NULL) { - cpio_warnc(0, + warnc(0, "Ambiguous option %s%s (matches --%s and --%s)", long_prefix, opt_word, match->name, match2->name); return ('?'); @@ -241,7 +244,7 @@ cpio_getopt(struct cpio *cpio) if (cpio->optarg == NULL) { cpio->optarg = *cpio->argv; if (cpio->optarg == NULL) { - cpio_warnc(0, + warnc(0, "Option %s%s requires an argument", long_prefix, match->name); return ('?'); @@ -252,7 +255,7 @@ cpio_getopt(struct cpio *cpio) } else { /* Argument forbidden: fail if there is one. */ if (cpio->optarg != NULL) { - cpio_warnc(0, + warnc(0, "Option %s%s does not allow an argument", long_prefix, match->name); return ('?'); @@ -283,17 +286,20 @@ cpio_getopt(struct cpio *cpio) * * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified. * + * Returns NULL if no error, otherwise returns error string for display. + * */ -int +const char * owner_parse(const char *spec, int *uid, int *gid) { + static char errbuff[128]; const char *u, *ue, *g; *uid = -1; *gid = -1; if (spec[0] == '\0') - return (1); + return ("Invalid empty user/group spec"); /* * Split spec into [user][:.][group] @@ -321,10 +327,8 @@ owner_parse(const char *spec, int *uid, struct passwd *pwent; user = (char *)malloc(ue - u + 1); - if (user == NULL) { - cpio_warnc(errno, "Couldn't allocate memory"); - return (1); - } + if (user == NULL) + return ("Couldn't allocate memory"); memcpy(user, u, ue - u); user[ue - u] = '\0'; if ((pwent = getpwnam(user)) != NULL) { @@ -336,9 +340,10 @@ owner_parse(const char *spec, int *uid, errno = 0; *uid = strtoul(user, &end, 10); if (errno || *end != '\0') { - cpio_warnc(errno, + snprintf(errbuff, sizeof(errbuff), "Couldn't lookup user ``%s''", user); - return (1); + errbuff[sizeof(errbuff) - 1] = '\0'; + return (errbuff); } } free(user); @@ -353,11 +358,12 @@ owner_parse(const char *spec, int *uid, errno = 0; *gid = strtoul(g, &end, 10); if (errno || *end != '\0') { - cpio_warnc(errno, + snprintf(errbuff, sizeof(errbuff), "Couldn't lookup group ``%s''", g); - return (1); + errbuff[sizeof(errbuff) - 1] = '\0'; + return (errbuff); } } } - return (0); + return (NULL); } Modified: head/usr.bin/cpio/config_freebsd.h ============================================================================== --- head/usr.bin/cpio/config_freebsd.h Sat May 8 16:29:02 2010 (r207791) +++ head/usr.bin/cpio/config_freebsd.h Sat May 8 16:47:33 2010 (r207792) @@ -25,83 +25,32 @@ * $FreeBSD$ */ -/* A default configuration for FreeBSD, used if there is no config.h. */ +/* A hand-tooled configuration for FreeBSD. */ #include /* __FreeBSD_version */ -#if __FreeBSD__ > 4 -#define HAVE_ACL_GET_PERM 0 -#define HAVE_ACL_GET_PERM_NP 1 -#define HAVE_ACL_PERMSET_T 1 -#define HAVE_ACL_USER 1 -#endif -#undef HAVE_ATTR_XATTR_H -#define HAVE_BZLIB_H 1 -#define HAVE_CHFLAGS 1 -#define HAVE_DECL_OPTARG 1 -#define HAVE_DECL_OPTIND 1 -#define HAVE_DIRENT_D_NAMLEN 1 #define HAVE_DIRENT_H 1 -#define HAVE_D_MD_ORDER 1 #define HAVE_ERRNO_H 1 -#undef HAVE_EXT2FS_EXT2_FS_H -#define HAVE_FCHDIR 1 #define HAVE_FCNTL_H 1 -#define HAVE_FNMATCH 1 -#define HAVE_FNMATCH_H 1 -#define HAVE_FNM_LEADING_DIR 1 -#define HAVE_FTRUNCATE 1 #define HAVE_FUTIMES 1 -#undef HAVE_GETXATTR #define HAVE_GRP_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LANGINFO_H 1 -#undef HAVE_LGETXATTR -#undef HAVE_LIBACL #define HAVE_LIBARCHIVE 1 -#define HAVE_LIBBZ2 1 -#define HAVE_LIBZ 1 -#define HAVE_LIMITS_H 1 -#undef HAVE_LINUX_EXT2_FS_H -#undef HAVE_LINUX_FS_H -#undef HAVE_LISTXATTR -#undef HAVE_LLISTXATTR -#define HAVE_LOCALE_H 1 +#define HAVE_LINK 1 +#define HAVE_LSTAT 1 #define HAVE_LUTIMES 1 -#define HAVE_MALLOC 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMORY_H 1 -#define HAVE_MEMSET 1 -#if __FreeBSD_version >= 450002 /* nl_langinfo introduced */ -#define HAVE_NL_LANGINFO 1 -#endif -#define HAVE_PATHS_H 1 #define HAVE_PWD_H 1 -#define HAVE_SETLOCALE 1 +#define HAVE_READLINK 1 #define HAVE_STDARG_H 1 -#define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 -#define HAVE_STRCHR 1 -#define HAVE_STRDUP 1 -#define HAVE_STRERROR 1 -#define HAVE_STRFTIME 1 -#define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 -#define HAVE_STRRCHR 1 -#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC -#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -#define HAVE_SYS_ACL_H 1 -#define HAVE_SYS_IOCTL_H 1 -#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYMLINK 1 +#define HAVE_SYS_CDEFS_H 1 #define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 #define HAVE_TIME_H 1 -#define HAVE_SYS_TYPES_H 1 #define HAVE_UINTMAX_T 1 #define HAVE_UNISTD_H 1 #define HAVE_UNSIGNED_LONG_LONG 1 +#define HAVE_UTIME_H 1 #define HAVE_UTIMES 1 -#define HAVE_VPRINTF 1 -#define HAVE_ZLIB_H 1 -#undef MAJOR_IN_MKDEV -#define STDC_HEADERS 1 Modified: head/usr.bin/cpio/cpio.c ============================================================================== --- head/usr.bin/cpio/cpio.c Sat May 8 16:29:02 2010 (r207791) +++ head/usr.bin/cpio/cpio.c Sat May 8 16:47:33 2010 (r207792) @@ -56,6 +56,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_STDARG_H #include #endif +#ifdef HAVE_STDINT_H +#include +#endif #include #ifdef HAVE_STDLIB_H #include @@ -74,11 +77,17 @@ __FBSDID("$FreeBSD$"); #endif #include "cpio.h" +#include "err.h" +#include "line_reader.h" #include "matching.h" /* Fixed size of uname/gname caches. */ #define name_cache_size 101 +#ifndef O_BINARY +#define O_BINARY 0 +#endif + struct name_cache { int probes; int hits; @@ -89,7 +98,8 @@ struct name_cache { } cache[name_cache_size]; }; -static int copy_data(struct archive *, struct archive *); +static int extract_data(struct archive *, struct archive *); +const char * cpio_i64toa(int64_t); static const char *cpio_rename(const char *name); static int entry_to_archive(struct cpio *, struct archive_entry *); static int file_to_archive(struct cpio *, const char *); @@ -117,6 +127,7 @@ main(int argc, char *argv[]) static char buff[16384]; struct cpio _cpio; /* Allocated on stack. */ struct cpio *cpio; + const char *errmsg; int uid, gid; int opt; @@ -124,33 +135,26 @@ main(int argc, char *argv[]) memset(cpio, 0, sizeof(*cpio)); cpio->buff = buff; cpio->buff_size = sizeof(buff); -#if defined(_WIN32) && !defined(__CYGWIN__) - /* Make sure open() function will be used with a binary mode. */ - /* on cygwin, we need something similar, but instead link against */ - /* a special startup object, binmode.o */ - _set_fmode(_O_BINARY); -#endif - /* Need cpio_progname before calling cpio_warnc. */ + /* Need progname before calling warnc. */ if (*argv == NULL) - cpio_progname = "bsdcpio"; + progname = "bsdcpio"; else { #if defined(_WIN32) && !defined(__CYGWIN__) - cpio_progname = strrchr(*argv, '\\'); + progname = strrchr(*argv, '\\'); #else - cpio_progname = strrchr(*argv, '/'); + progname = strrchr(*argv, '/'); #endif - if (cpio_progname != NULL) - cpio_progname++; + if (progname != NULL) + progname++; else - cpio_progname = *argv; + progname = *argv; } cpio->uid_override = -1; cpio->gid_override = -1; cpio->argv = argv; cpio->argc = argc; - cpio->line_separator = '\n'; cpio->mode = '\0'; cpio->verbose = 0; cpio->compress = '\0'; @@ -161,19 +165,17 @@ main(int argc, char *argv[]) cpio->extract_flags |= ARCHIVE_EXTRACT_PERM; cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; cpio->extract_flags |= ARCHIVE_EXTRACT_ACL; -#if defined(_WIN32) || defined(__CYGWIN__) - if (bsdcpio_is_privileged()) -#else +#if !defined(_WIN32) && !defined(__CYGWIN__) if (geteuid() == 0) -#endif cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER; +#endif cpio->bytes_per_block = 512; cpio->filename = NULL; while ((opt = cpio_getopt(cpio)) != -1) { switch (opt) { case '0': /* GNU convention: --null, -0 */ - cpio->line_separator = '\0'; + cpio->option_null = 1; break; case 'A': /* NetBSD/OpenBSD */ cpio->option_append = 1; @@ -187,7 +189,7 @@ main(int argc, char *argv[]) case 'C': /* NetBSD/OpenBSD */ cpio->bytes_per_block = atoi(cpio->optarg); if (cpio->bytes_per_block <= 0) - cpio_errc(1, 0, "Invalid blocksize %s", cpio->optarg); + errc(1, 0, "Invalid blocksize %s", cpio->optarg); break; case 'c': /* POSIX 1997 */ cpio->format = "odc"; @@ -196,13 +198,14 @@ main(int argc, char *argv[]) cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR; break; case 'E': /* NetBSD/OpenBSD */ - include_from_file(cpio, cpio->optarg); + include_from_file(&cpio->matching, + cpio->optarg, cpio->option_null); break; case 'F': /* NetBSD/OpenBSD/GNU cpio */ cpio->filename = cpio->optarg; break; case 'f': /* POSIX 1997 */ - exclude(cpio, cpio->optarg); + exclude(&cpio->matching, cpio->optarg); break; case 'H': /* GNU cpio (also --format) */ cpio->format = cpio->optarg; @@ -215,10 +218,16 @@ main(int argc, char *argv[]) break; case 'i': /* POSIX 1997 */ if (cpio->mode != '\0') - cpio_errc(1, 0, + errc(1, 0, "Cannot use both -i and -%c", cpio->mode); cpio->mode = opt; break; + case 'J': /* GNU tar, others */ + cpio->compress = opt; + break; + case 'j': /* GNU tar, others */ + cpio->compress = opt; + break; case OPTION_INSECURE: cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; @@ -229,6 +238,9 @@ main(int argc, char *argv[]) case 'l': /* POSIX 1997 */ cpio->option_link = 1; break; + case OPTION_LZMA: /* GNU tar, others */ + cpio->compress = opt; + break; case 'm': /* POSIX 1997 */ cpio->extract_flags |= ARCHIVE_EXTRACT_TIME; break; @@ -243,23 +255,29 @@ main(int argc, char *argv[]) break; case 'o': /* POSIX 1997 */ if (cpio->mode != '\0') - cpio_errc(1, 0, + errc(1, 0, "Cannot use both -o and -%c", cpio->mode); cpio->mode = opt; break; case 'p': /* POSIX 1997 */ if (cpio->mode != '\0') - cpio_errc(1, 0, + errc(1, 0, "Cannot use both -p and -%c", cpio->mode); cpio->mode = opt; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; break; + case OPTION_PRESERVE_OWNER: + cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER; + break; case OPTION_QUIET: /* GNU cpio */ cpio->quiet = 1; break; case 'R': /* GNU cpio, also --owner */ - if (owner_parse(cpio->optarg, &uid, &gid)) + errmsg = owner_parse(cpio->optarg, &uid, &gid); + if (errmsg) { + warnc(-1, "%s", errmsg); usage(); + } if (uid != -1) cpio->uid_override = uid; if (gid != -1) @@ -278,9 +296,6 @@ main(int argc, char *argv[]) case 'v': /* POSIX 1997 */ cpio->verbose++; break; - case 'V': /* GNU cpio */ - cpio->dot++; - break; case OPTION_VERSION: /* GNU convention */ version(); break; @@ -293,23 +308,13 @@ main(int argc, char *argv[]) break; #endif case 'y': /* tar convention */ -#if HAVE_LIBBZ2 cpio->compress = opt; -#else - cpio_warnc(0, "bzip2 compression not supported by " - "this version of bsdcpio"); -#endif break; case 'Z': /* tar convention */ cpio->compress = opt; break; case 'z': /* tar convention */ -#if HAVE_LIBZ cpio->compress = opt; -#else - cpio_warnc(0, "gzip compression not supported by " - "this version of bsdcpio"); -#endif break; default: usage(); @@ -324,19 +329,16 @@ main(int argc, char *argv[]) cpio->mode = 'i'; /* -t requires -i */ if (cpio->option_list && cpio->mode != 'i') - cpio_errc(1, 0, "Option -t requires -i", cpio->mode); + errc(1, 0, "Option -t requires -i"); /* -n requires -it */ if (cpio->option_numeric_uid_gid && !cpio->option_list) - cpio_errc(1, 0, "Option -n requires -it"); + errc(1, 0, "Option -n requires -it"); /* Can only specify format when writing */ if (cpio->format != NULL && cpio->mode != 'o') - cpio_errc(1, 0, "Option --format requires -o"); + errc(1, 0, "Option --format requires -o"); /* -l requires -p */ if (cpio->option_link && cpio->mode != 'p') - cpio_errc(1, 0, "Option -l requires -p"); - /* -v overrides -V */ - if (cpio->dot && cpio->verbose) - cpio->dot = 0; + errc(1, 0, "Option -l requires -p"); /* TODO: Flag other nonsensical combinations. */ switch (cpio->mode) { @@ -350,7 +352,7 @@ main(int argc, char *argv[]) break; case 'i': while (*cpio->argv != NULL) { - include(cpio, *cpio->argv); + include(&cpio->matching, *cpio->argv); --cpio->argc; ++cpio->argv; } @@ -361,26 +363,26 @@ main(int argc, char *argv[]) break; case 'p': if (*cpio->argv == NULL || **cpio->argv == '\0') - cpio_errc(1, 0, + errc(1, 0, "-p mode requires a target directory"); mode_pass(cpio, *cpio->argv); break; default: - cpio_errc(1, 0, + errc(1, 0, "Must specify at least one of -i, -o, or -p"); } free_cache(cpio->gname_cache); free_cache(cpio->uname_cache); - return (0); + return (cpio->return_value); } -void +static void usage(void) { const char *p; - p = cpio_progname; + p = progname; fprintf(stderr, "Brief Usage:\n"); fprintf(stderr, " List: %s -it < archive\n", p); @@ -394,14 +396,9 @@ static const char *long_help_msg = "First option must be a mode specifier:\n" " -i Input -o Output -p Pass\n" "Common Options:\n" - " -v Verbose filenames -V one dot per file\n" + " -v Verbose\n" "Create: %p -o [options] < [list of files] > [archive]\n" -#ifdef HAVE_BZLIB_H - " -y Compress archive with bzip2\n" -#endif -#ifdef HAVE_ZLIB_H - " -z Compress archive with gzip\n" -#endif + " -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n" " --format {odc|newc|ustar} Select archive format\n" "List: %p -it < [archive]\n" "Extract: %p -i [options] < [archive]\n"; @@ -423,7 +420,7 @@ long_help(void) const char *prog; const char *p; - prog = cpio_progname; + prog = progname; fflush(stderr); @@ -455,19 +452,33 @@ version(void) static void mode_out(struct cpio *cpio) { - unsigned long blocks; struct archive_entry *entry, *spare; struct line_reader *lr; const char *p; int r; if (cpio->option_append) - cpio_errc(1, 0, "Append mode not yet supported."); + errc(1, 0, "Append mode not yet supported."); + + cpio->archive_read_disk = archive_read_disk_new(); + if (cpio->archive_read_disk == NULL) + errc(1, 0, "Failed to allocate archive object"); + if (cpio->option_follow_links) + archive_read_disk_set_symlink_logical(cpio->archive_read_disk); + else + archive_read_disk_set_symlink_physical(cpio->archive_read_disk); + archive_read_disk_set_standard_lookup(cpio->archive_read_disk); + cpio->archive = archive_write_new(); if (cpio->archive == NULL) - cpio_errc(1, 0, "Failed to allocate archive object"); + errc(1, 0, "Failed to allocate archive object"); switch (cpio->compress) { -#ifndef SMALLER + case 'J': + r = archive_write_set_compression_xz(cpio->archive); + break; + case OPTION_LZMA: + r = archive_write_set_compression_lzma(cpio->archive); + break; case 'j': case 'y': r = archive_write_set_compression_bzip2(cpio->archive); break; @@ -477,41 +488,30 @@ mode_out(struct cpio *cpio) case 'Z': r = archive_write_set_compression_compress(cpio->archive); break; -#endif - case '\0': + default: r = archive_write_set_compression_none(cpio->archive); break; - default: - cpio_errc(1, 0, "Unrecognized compression option"); } - if (r != ARCHIVE_OK) - cpio_errc(1, 0, "Unsupported compression format"); -#ifdef SMALLER - if (strcmp(cpio->format, "cpio")) - r = archive_write_set_format_cpio(cpio->archive); - else if (strcmp(cpio->format, "odc")) - r = archive_write_set_format_cpio(cpio->archive); - else if (strcmp(cpio->format, "newc")) - r = archive_write_set_format_cpio(cpio->archive); - else if (strcmp(cpio->format, "ustar")) - r = archive_write_set_format_cpio(cpio->archive); -#else + if (r < ARCHIVE_WARN) + errc(1, 0, "Requested compression not available"); r = archive_write_set_format_by_name(cpio->archive, cpio->format); -#endif if (r != ARCHIVE_OK) - cpio_errc(1, 0, archive_error_string(cpio->archive)); + errc(1, 0, "%s", archive_error_string(cpio->archive)); archive_write_set_bytes_per_block(cpio->archive, cpio->bytes_per_block); cpio->linkresolver = archive_entry_linkresolver_new(); archive_entry_linkresolver_set_strategy(cpio->linkresolver, archive_format(cpio->archive)); + /* + * The main loop: Copy each file into the output archive. + */ r = archive_write_open_file(cpio->archive, cpio->filename); if (r != ARCHIVE_OK) - cpio_errc(1, 0, archive_error_string(cpio->archive)); - lr = process_lines_init("-", cpio->line_separator); - while ((p = process_lines_next(lr)) != NULL) + errc(1, 0, "%s", archive_error_string(cpio->archive)); + lr = line_reader("-", cpio->option_null); + while ((p = line_reader_next(lr)) != NULL) file_to_archive(cpio, p); - process_lines_free(lr); + line_reader_free(lr); /* * The hardlink detection may have queued up a couple of entries @@ -527,15 +527,14 @@ mode_out(struct cpio *cpio) } r = archive_write_close(cpio->archive); - if (cpio->dot) - fprintf(stderr, "\n"); if (r != ARCHIVE_OK) - cpio_errc(1, 0, archive_error_string(cpio->archive)); + errc(1, 0, "%s", archive_error_string(cpio->archive)); if (!cpio->quiet) { - blocks = (archive_position_uncompressed(cpio->archive) + 511) - / 512; - fprintf(stderr, "%lu %s\n", blocks, + int64_t blocks = + (archive_position_uncompressed(cpio->archive) + 511) + / 512; + fprintf(stderr, "%lu %s\n", (unsigned long)blocks, blocks == 1 ? "block" : "blocks"); } archive_write_finish(cpio->archive); @@ -549,57 +548,37 @@ mode_out(struct cpio *cpio) static int file_to_archive(struct cpio *cpio, const char *srcpath) { - struct stat st; const char *destpath; struct archive_entry *entry, *spare; size_t len; const char *p; -#if !defined(_WIN32) || defined(__CYGWIN__) - int lnklen; -#endif int r; /* * Create an archive_entry describing the source file. * - * XXX TODO: rework to use archive_read_disk_entry_from_file() */ entry = archive_entry_new(); if (entry == NULL) - cpio_errc(1, 0, "Couldn't allocate entry"); + errc(1, 0, "Couldn't allocate entry"); archive_entry_copy_sourcepath(entry, srcpath); - - /* Get stat information. */ - if (cpio->option_follow_links) - r = stat(srcpath, &st); - else - r = lstat(srcpath, &st); - if (r != 0) { - cpio_warnc(errno, "Couldn't stat \"%s\"", srcpath); - archive_entry_free(entry); - return (0); + r = archive_read_disk_entry_from_file(cpio->archive_read_disk, + entry, -1, NULL); + if (r < ARCHIVE_FAILED) + errc(1, 0, "%s", + archive_error_string(cpio->archive_read_disk)); + if (r < ARCHIVE_OK) + warnc(0, "%s", + archive_error_string(cpio->archive_read_disk)); + if (r <= ARCHIVE_FAILED) { + cpio->return_value = 1; + return (r); } if (cpio->uid_override >= 0) - st.st_uid = cpio->uid_override; + archive_entry_set_uid(entry, cpio->uid_override); if (cpio->gid_override >= 0) - st.st_gid = cpio->gid_override; - archive_entry_copy_stat(entry, &st); - -#if !defined(_WIN32) || defined(__CYGWIN__) - /* If its a symlink, pull the target. */ - if (S_ISLNK(st.st_mode)) { - lnklen = readlink(srcpath, cpio->buff, cpio->buff_size); - if (lnklen < 0) { - cpio_warnc(errno, - "%s: Couldn't read symbolic link", srcpath); - archive_entry_free(entry); - return (0); - } - cpio->buff[lnklen] = 0; - archive_entry_set_symlink(entry, cpio->buff); - } -#endif + archive_entry_set_gid(entry, cpio->gid_override); /* * Generate a destination path for this entry. @@ -618,7 +597,7 @@ file_to_archive(struct cpio *cpio, const free(cpio->pass_destpath); cpio->pass_destpath = malloc(cpio->pass_destpath_alloc); if (cpio->pass_destpath == NULL) - cpio_errc(1, ENOMEM, + errc(1, ENOMEM, "Can't allocate path buffer"); } strcpy(cpio->pass_destpath, cpio->destdir); @@ -639,18 +618,18 @@ file_to_archive(struct cpio *cpio, const */ spare = NULL; if (cpio->linkresolver != NULL - && !S_ISDIR(st.st_mode)) { + && archive_entry_filetype(entry) != AE_IFDIR) { archive_entry_linkify(cpio->linkresolver, &entry, &spare); } if (entry != NULL) { r = entry_to_archive(cpio, entry); archive_entry_free(entry); - } - if (spare != NULL) { - if (r == 0) - r = entry_to_archive(cpio, spare); - archive_entry_free(spare); + if (spare != NULL) { + if (r == 0) + r = entry_to_archive(cpio, spare); + archive_entry_free(spare); + } } return (r); } @@ -667,8 +646,6 @@ entry_to_archive(struct cpio *cpio, stru /* Print out the destination name to the user. */ if (cpio->verbose) fprintf(stderr,"%s", destpath); - if (cpio->dot) - fprintf(stderr, "."); /* * Option_link only makes sense in pass mode and for @@ -686,7 +663,7 @@ entry_to_archive(struct cpio *cpio, stru /* Save the original entry in case we need it later. */ t = archive_entry_clone(entry); if (t == NULL) - cpio_errc(1, ENOMEM, "Can't create link"); + errc(1, ENOMEM, "Can't create link"); /* Note: link(2) doesn't create parent directories, * so we use archive_write_header() instead as a * convenience. */ @@ -696,15 +673,15 @@ entry_to_archive(struct cpio *cpio, stru r = archive_write_header(cpio->archive, t); archive_entry_free(t); if (r != ARCHIVE_OK) - cpio_warnc(archive_errno(cpio->archive), - archive_error_string(cpio->archive)); + warnc(archive_errno(cpio->archive), + "%s", archive_error_string(cpio->archive)); if (r == ARCHIVE_FATAL) exit(1); #ifdef EXDEV if (r != ARCHIVE_OK && archive_errno(cpio->archive) == EXDEV) { /* Cross-device link: Just fall through and use * the original entry to copy the file over. */ - cpio_warnc(0, "Copying file instead"); + warnc(0, "Copying file instead"); } else #endif return (0); @@ -716,9 +693,9 @@ entry_to_archive(struct cpio *cpio, stru */ if (archive_entry_filetype(entry) == AE_IFREG) { if (archive_entry_size(entry) > 0) { - fd = open(srcpath, O_RDONLY); + fd = open(srcpath, O_RDONLY | O_BINARY); if (fd < 0) { - cpio_warnc(errno, + warnc(errno, "%s: could not open file", srcpath); goto cleanup; } @@ -730,7 +707,7 @@ entry_to_archive(struct cpio *cpio, stru r = archive_write_header(cpio->archive, entry); if (r != ARCHIVE_OK) - cpio_warnc(archive_errno(cpio->archive), + warnc(archive_errno(cpio->archive), "%s: %s", srcpath, archive_error_string(cpio->archive)); @@ -744,10 +721,10 @@ entry_to_archive(struct cpio *cpio, stru r = archive_write_data(cpio->archive, cpio->buff, bytes_read); if (r < 0) - cpio_errc(1, archive_errno(cpio->archive), - archive_error_string(cpio->archive)); + errc(1, archive_errno(cpio->archive), + "%s", archive_error_string(cpio->archive)); if (r < bytes_read) { - cpio_warnc(0, + warnc(0, "Truncated write; file may have grown while being archived."); } bytes_read = read(fd, cpio->buff, cpio->buff_size); @@ -776,7 +753,7 @@ restore_time(struct cpio *cpio, struct a (void)name; /* UNUSED */ if (!warned) - cpio_warnc(0, "Can't restore access times on this platform"); + warnc(0, "Can't restore access times on this platform"); warned = 1; return (fd); #else @@ -795,7 +772,7 @@ restore_time(struct cpio *cpio, struct a times[0].tv_sec = archive_entry_atime(entry); times[0].tv_usec = archive_entry_atime_nsec(entry) / 1000; -#ifdef HAVE_FUTIMES +#if defined(HAVE_FUTIMES) && !defined(__CYGWIN__) if (fd >= 0 && futimes(fd, times) == 0) return (fd); #endif @@ -811,9 +788,10 @@ restore_time(struct cpio *cpio, struct a #ifdef HAVE_LUTIMES if (lutimes(name, times) != 0) #else - if (!S_ISLNK(archive_entry_mode(entry)) && utimes(name, times) != 0) + if ((AE_IFLNK != archive_entry_filetype(entry)) + && utimes(name, times) != 0) #endif - cpio_warnc(errno, "Can't update time for %s", name); + warnc(errno, "Can't update time for %s", name); #endif return (fd); } @@ -826,38 +804,32 @@ mode_in(struct cpio *cpio) struct archive_entry *entry; struct archive *ext; const char *destpath; - unsigned long blocks; int r; ext = archive_write_disk_new(); if (ext == NULL) - cpio_errc(1, 0, "Couldn't allocate restore object"); + errc(1, 0, "Couldn't allocate restore object"); r = archive_write_disk_set_options(ext, cpio->extract_flags); if (r != ARCHIVE_OK) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat May 8 20:34:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5BFC81065674; Sat, 8 May 2010 20:34:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 489E28FC0C; Sat, 8 May 2010 20:34:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48KY2Zp021665; Sat, 8 May 2010 20:34:02 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48KY1vZ021646; Sat, 8 May 2010 20:34:01 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005082034.o48KY1vZ021646@svn.freebsd.org> From: Alan Cox Date: Sat, 8 May 2010 20:34:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207796 - in head/sys: amd64/amd64 arm/arm i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke sparc64/sparc64 sun4v/sun4v sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 20:34:02 -0000 Author: alc Date: Sat May 8 20:34:01 2010 New Revision: 207796 URL: http://svn.freebsd.org/changeset/base/207796 Log: Push down the page queues into vm_page_cache(), vm_page_try_to_cache(), and vm_page_try_to_free(). Consequently, push down the page queues lock into pmap_enter_quick(), pmap_page_wired_mapped(), pmap_remove_all(), and pmap_remove_write(). Push down the page queues lock into Xen's pmap_page_is_mapped(). (I overlooked the Xen pmap in r207702.) Switch to a per-processor counter for the total number of pages cached. Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/pmap.c head/sys/kern/subr_uio.c head/sys/kern/vfs_bio.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/sun4v/sun4v/pmap.c head/sys/sys/vmmeter.h head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/amd64/amd64/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -2796,7 +2796,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_remove_all: page %p is fictitious", m)); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); while ((pv = TAILQ_FIRST(&pvh->pv_list)) != NULL) { pmap = PV_PMAP(pv); @@ -2834,6 +2834,7 @@ pmap_remove_all(vm_page_t m) PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* @@ -3414,8 +3415,10 @@ void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + vm_page_lock_queues(); PMAP_LOCK(pmap); - (void) pmap_enter_quick_locked(pmap, va, m, prot, NULL); + (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL); + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -3926,8 +3929,11 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); + vm_page_lock_queues(); count = pmap_pvh_wired_mappings(&m->md, count); - return (pmap_pvh_wired_mappings(pa_to_pvh(VM_PAGE_TO_PHYS(m)), count)); + count = pmap_pvh_wired_mappings(pa_to_pvh(VM_PAGE_TO_PHYS(m)), count); + vm_page_unlock_queues(); + return (count); } /* @@ -4237,7 +4243,7 @@ pmap_remove_write(vm_page_t m) if ((m->flags & PG_FICTITIOUS) != 0 || (m->flags & PG_WRITEABLE) == 0) return; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) { pmap = PV_PMAP(pv); @@ -4268,6 +4274,7 @@ retry: PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/arm/arm/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -3118,18 +3118,11 @@ pmap_remove_all(vm_page_t m) pmap_t curpm; int flags = 0; -#if defined(PMAP_DEBUG) - /* - * XXX This makes pmap_remove_all() illegal for non-managed pages! - */ - if (m->flags & PG_FICTITIOUS) { - panic("pmap_remove_all: illegal for unmanaged page, va: 0x%x", VM_PAGE_TO_PHYS(m)); - } -#endif - + KASSERT((m->flags & PG_FICTITIOUS) == 0, + ("pmap_remove_all: page %p is fictitious", m)); if (TAILQ_EMPTY(&m->md.pv_list)) return; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); pmap_remove_write(m); curpm = vmspace_pmap(curproc->p_vmspace); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { @@ -3180,6 +3173,7 @@ pmap_remove_all(vm_page_t m) pmap_tlb_flushD(curpm); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } @@ -3615,9 +3609,11 @@ void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + vm_page_lock_queues(); PMAP_LOCK(pmap); pmap_enter_locked(pmap, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE, M_NOWAIT); + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -4450,10 +4446,11 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) if ((pv->pv_flags & PVF_WIRED) != 0) count++; + vm_page_unlock_queues(); return (count); } @@ -4530,8 +4527,11 @@ void pmap_remove_write(vm_page_t m) { - if (m->flags & PG_WRITEABLE) + if (m->flags & PG_WRITEABLE) { + vm_page_lock_queues(); pmap_clearbit(m, PVF_WRITE); + vm_page_unlock_queues(); + } } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/i386/i386/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -2900,7 +2900,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_remove_all: page %p is fictitious", m)); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); sched_pin(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); while ((pv = TAILQ_FIRST(&pvh->pv_list)) != NULL) { @@ -2940,6 +2940,7 @@ pmap_remove_all(vm_page_t m) } vm_page_flag_clear(m, PG_WRITEABLE); sched_unpin(); + vm_page_unlock_queues(); } /* @@ -3544,8 +3545,10 @@ void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + vm_page_lock_queues(); PMAP_LOCK(pmap); - (void) pmap_enter_quick_locked(pmap, va, m, prot, NULL); + (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL); + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -4088,8 +4091,11 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); + vm_page_lock_queues(); count = pmap_pvh_wired_mappings(&m->md, count); - return (pmap_pvh_wired_mappings(pa_to_pvh(VM_PAGE_TO_PHYS(m)), count)); + count = pmap_pvh_wired_mappings(pa_to_pvh(VM_PAGE_TO_PHYS(m)), count); + vm_page_unlock_queues(); + return (count); } /* @@ -4404,10 +4410,10 @@ pmap_remove_write(vm_page_t m) pt_entry_t oldpte, *pte; vm_offset_t va; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & PG_FICTITIOUS) != 0 || (m->flags & PG_WRITEABLE) == 0) return; + vm_page_lock_queues(); sched_pin(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) { @@ -4445,6 +4451,7 @@ retry: } vm_page_flag_clear(m, PG_WRITEABLE); sched_unpin(); + vm_page_unlock_queues(); } /* Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/i386/xen/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -2485,16 +2485,9 @@ pmap_remove_all(vm_page_t m) pt_entry_t *pte, tpte; vm_page_t free; -#if defined(PMAP_DIAGNOSTIC) - /* - * XXX This makes pmap_remove_all() illegal for non-managed pages! - */ - if (m->flags & PG_FICTITIOUS) { - panic("pmap_remove_all: illegal for unmanaged page, va: 0x%jx", - VM_PAGE_TO_PHYS(m) & 0xffffffff); - } -#endif - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + KASSERT((m->flags & PG_FICTITIOUS) == 0, + ("pmap_remove_all: page %p is fictitious", m)); + vm_page_lock_queues(); sched_pin(); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pmap = PV_PMAP(pv); @@ -2531,6 +2524,7 @@ pmap_remove_all(vm_page_t m) if (*PMAP1) PT_SET_MA(PADDR1, 0); sched_unpin(); + vm_page_unlock_queues(); } /* @@ -2946,10 +2940,12 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ CTR4(KTR_PMAP, "pmap_enter_quick: pmap=%p va=0x%x m=%p prot=0x%x", pmap, va, m, prot); + vm_page_lock_queues(); PMAP_LOCK(pmap); - (void) pmap_enter_quick_locked(&mclp, &count, pmap, va, m, prot, NULL); + (void)pmap_enter_quick_locked(&mclp, &count, pmap, va, m, prot, NULL); if (count) HYPERVISOR_multicall(&mcl, count); + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -3504,7 +3500,7 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3515,6 +3511,7 @@ pmap_page_wired_mappings(vm_page_t m) PMAP_UNLOCK(pmap); } sched_unpin(); + vm_page_unlock_queues(); return (count); } @@ -3525,16 +3522,15 @@ pmap_page_wired_mappings(vm_page_t m) boolean_t pmap_page_is_mapped(vm_page_t m) { - struct md_page *pvh; + boolean_t rv; if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) return (FALSE); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - return (!TAILQ_EMPTY(&pvh->pv_list)); - } else - return (TRUE); + vm_page_lock_queues(); + rv = !TAILQ_EMPTY(&m->md.pv_list) || + !TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list); + vm_page_unlock_queues(); + return (rv); } /* @@ -3784,10 +3780,10 @@ pmap_remove_write(vm_page_t m) pmap_t pmap; pt_entry_t oldpte, *pte; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & PG_FICTITIOUS) != 0 || (m->flags & PG_WRITEABLE) == 0) return; + vm_page_lock_queues(); sched_pin(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); @@ -3818,6 +3814,7 @@ retry: if (*PMAP1) PT_SET_MA(PADDR1, 0); sched_unpin(); + vm_page_unlock_queues(); } /* Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/ia64/ia64/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -1392,15 +1392,9 @@ pmap_remove_all(vm_page_t m) pmap_t oldpmap; pv_entry_t pv; -#if defined(DIAGNOSTIC) - /* - * XXX This makes pmap_remove_all() illegal for non-managed pages! - */ - if (m->flags & PG_FICTITIOUS) { - panic("pmap_remove_all: illegal for unmanaged page, va: 0x%lx", VM_PAGE_TO_PHYS(m)); - } -#endif - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + KASSERT((m->flags & PG_FICTITIOUS) == 0, + ("pmap_remove_all: page %p is fictitious", m)); + vm_page_lock_queues(); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { struct ia64_lpte *pte; pmap_t pmap = pv->pv_pmap; @@ -1417,6 +1411,7 @@ pmap_remove_all(vm_page_t m) PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* @@ -1655,9 +1650,11 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ { pmap_t oldpmap; + vm_page_lock_queues(); PMAP_LOCK(pmap); oldpmap = pmap_switch(pmap); pmap_enter_quick_locked(pmap, va, m, prot); + vm_page_unlock_queues(); pmap_switch(oldpmap); PMAP_UNLOCK(pmap); } @@ -1875,7 +1872,7 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = pv->pv_pmap; PMAP_LOCK(pmap); @@ -1887,6 +1884,7 @@ pmap_page_wired_mappings(vm_page_t m) pmap_switch(oldpmap); PMAP_UNLOCK(pmap); } + vm_page_unlock_queues(); return (count); } @@ -2118,10 +2116,10 @@ pmap_remove_write(vm_page_t m) pv_entry_t pv; vm_prot_t prot; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & PG_FICTITIOUS) != 0 || (m->flags & PG_WRITEABLE) == 0) return; + vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = pv->pv_pmap; PMAP_LOCK(pmap); @@ -2142,6 +2140,7 @@ pmap_remove_write(vm_page_t m) PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* Modified: head/sys/kern/subr_uio.c ============================================================================== --- head/sys/kern/subr_uio.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/kern/subr_uio.c Sat May 8 20:34:01 2010 (r207796) @@ -105,7 +105,6 @@ retry: if (vm_page_sleep_if_busy(user_pg, TRUE, "vm_pgmoveco")) goto retry; vm_page_lock(user_pg); - vm_page_lock_queues(); pmap_remove_all(user_pg); vm_page_free(user_pg); vm_page_unlock(user_pg); @@ -117,11 +116,9 @@ retry: */ if (uobject->backing_object != NULL) pmap_remove(map->pmap, uaddr, uaddr + PAGE_SIZE); - vm_page_lock_queues(); } vm_page_insert(kern_pg, uobject, upindex); vm_page_dirty(kern_pg); - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(uobject); vm_map_lookup_done(map, entry); return(KERN_SUCCESS); Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/kern/vfs_bio.c Sat May 8 20:34:01 2010 (r207796) @@ -1579,7 +1579,6 @@ vfs_vmio_release(struct buf *bp) */ if ((m->oflags & VPO_BUSY) == 0 && m->busy == 0 && m->wire_count == 0) { - vm_page_lock_queues(); /* * Might as well free the page if we can and it has * no valid data. We also free the page if the @@ -1593,7 +1592,6 @@ vfs_vmio_release(struct buf *bp) } else if (buf_vm_page_count_severe()) { vm_page_try_to_cache(m); } - vm_page_unlock_queues(); } vm_page_unlock(m); } Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/mips/mips/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -1595,7 +1595,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_remove_all: page %p is fictitious", m)); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); if (m->md.pv_flags & PV_TABLE_REF) vm_page_flag_set(m, PG_REFERENCED); @@ -1646,6 +1646,7 @@ pmap_remove_all(vm_page_t m) vm_page_flag_clear(m, PG_WRITEABLE); m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); + vm_page_unlock_queues(); } /* @@ -1921,8 +1922,10 @@ void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + vm_page_lock_queues(); PMAP_LOCK(pmap); (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL); + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -2510,10 +2513,11 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) if (pv->pv_wired) count++; + vm_page_unlock_queues(); return (count); } @@ -2527,12 +2531,14 @@ pmap_remove_write(vm_page_t m) vm_offset_t va; pt_entry_t *pte; - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->flags & PG_FICTITIOUS) != 0 || + (m->flags & PG_WRITEABLE) == 0) return; /* * Loop over all current mappings setting/clearing as appropos. */ + vm_page_lock_queues(); for (pv = TAILQ_FIRST(&m->md.pv_list); pv; pv = npv) { npv = TAILQ_NEXT(pv, pv_plist); pte = pmap_pte(pv->pv_pmap, pv->pv_va); @@ -2545,6 +2551,7 @@ pmap_remove_write(vm_page_t m) VM_PROT_READ | VM_PROT_EXECUTE); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/powerpc/aim/mmu_oea.c Sat May 8 20:34:01 2010 (r207796) @@ -1208,11 +1208,12 @@ moea_enter_quick(mmu_t mmu, pmap_t pm, v vm_prot_t prot) { + vm_page_lock_queues(); PMAP_LOCK(pm); moea_enter_locked(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE); + vm_page_unlock_queues(); PMAP_UNLOCK(pm); - } vm_paddr_t @@ -1322,10 +1323,10 @@ moea_remove_write(mmu_t mmu, vm_page_t m pmap_t pmap; u_int lo; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || (m->flags & PG_WRITEABLE) == 0) return; + vm_page_lock_queues(); lo = moea_attr_fetch(m); powerpc_sync(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { @@ -1351,6 +1352,7 @@ moea_remove_write(mmu_t mmu, vm_page_t m vm_page_dirty(m); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* @@ -1518,10 +1520,11 @@ moea_page_wired_mappings(mmu_t mmu, vm_p count = 0; if (!moea_initialized || (m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) if ((pvo->pvo_vaddr & PVO_WIRED) != 0) count++; + vm_page_unlock_queues(); return (count); } @@ -1732,8 +1735,7 @@ moea_remove_all(mmu_t mmu, vm_page_t m) struct pvo_entry *pvo, *next_pvo; pmap_t pmap; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - + vm_page_lock_queues(); pvo_head = vm_page_to_pvoh(m); for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) { next_pvo = LIST_NEXT(pvo, pvo_vlink); @@ -1749,6 +1751,7 @@ moea_remove_all(mmu_t mmu, vm_page_t m) vm_page_dirty(m); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/powerpc/aim/mmu_oea64.c Sat May 8 20:34:01 2010 (r207796) @@ -1341,11 +1341,13 @@ void moea64_enter_quick(mmu_t mmu, pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + + vm_page_lock_queues(); PMAP_LOCK(pm); moea64_enter_locked(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE); + vm_page_unlock_queues(); PMAP_UNLOCK(pm); - } vm_paddr_t @@ -1517,10 +1519,10 @@ moea64_remove_write(mmu_t mmu, vm_page_t pmap_t pmap; uint64_t lo; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || (m->flags & PG_WRITEABLE) == 0) return; + vm_page_lock_queues(); lo = moea64_attr_fetch(m); SYNC(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { @@ -1547,6 +1549,7 @@ moea64_remove_write(mmu_t mmu, vm_page_t vm_page_dirty(m); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* @@ -1710,10 +1713,11 @@ moea64_page_wired_mappings(mmu_t mmu, vm count = 0; if (!moea64_initialized || (m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) if ((pvo->pvo_vaddr & PVO_WIRED) != 0) count++; + vm_page_unlock_queues(); return (count); } @@ -1929,8 +1933,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m struct pvo_entry *pvo, *next_pvo; pmap_t pmap; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - + vm_page_lock_queues(); pvo_head = vm_page_to_pvoh(m); for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) { next_pvo = LIST_NEXT(pvo, pvo_vlink); @@ -1946,6 +1949,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m vm_page_dirty(m); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/powerpc/booke/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -1722,9 +1722,11 @@ mmu_booke_enter_quick(mmu_t mmu, pmap_t vm_prot_t prot) { + vm_page_lock_queues(); PMAP_LOCK(pmap); mmu_booke_enter_locked(mmu, pmap, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE); + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -1783,8 +1785,7 @@ mmu_booke_remove_all(mmu_t mmu, vm_page_ pv_entry_t pv, pvn; uint8_t hold_flag; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - + vm_page_lock_queues(); for (pv = TAILQ_FIRST(&m->md.pv_list); pv != NULL; pv = pvn) { pvn = TAILQ_NEXT(pv, pv_link); @@ -1794,6 +1795,7 @@ mmu_booke_remove_all(mmu_t mmu, vm_page_ PMAP_UNLOCK(pv->pv_pmap); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } /* @@ -1939,11 +1941,10 @@ mmu_booke_remove_write(mmu_t mmu, vm_pag pv_entry_t pv; pte_t *pte; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || (m->flags & PG_WRITEABLE) == 0) return; - + vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { PMAP_LOCK(pv->pv_pmap); if ((pte = pte_find(mmu, pv->pv_pmap, pv->pv_va)) != NULL) { @@ -1967,6 +1968,7 @@ mmu_booke_remove_write(mmu_t mmu, vm_pag PMAP_UNLOCK(pv->pv_pmap); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } static void @@ -2388,8 +2390,7 @@ mmu_booke_page_wired_mappings(mmu_t mmu, if ((m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - + vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { PMAP_LOCK(pv->pv_pmap); if ((pte = pte_find(mmu, pv->pv_pmap, pv->pv_va)) != NULL) @@ -2397,7 +2398,7 @@ mmu_booke_page_wired_mappings(mmu_t mmu, count++; PMAP_UNLOCK(pv->pv_pmap); } - + vm_page_unlock_queues(); return (count); } Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/sparc64/sparc64/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -1240,7 +1240,7 @@ pmap_remove_all(vm_page_t m) struct tte *tp; vm_offset_t va; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); for (tp = TAILQ_FIRST(&m->md.tte_list); tp != NULL; tp = tpn) { tpn = TAILQ_NEXT(tp, tte_link); if ((tp->tte_data & TD_PV) == 0) @@ -1263,6 +1263,7 @@ pmap_remove_all(vm_page_t m) PMAP_UNLOCK(pm); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } int @@ -1502,9 +1503,11 @@ void pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + vm_page_lock_queues(); PMAP_LOCK(pm); pmap_enter_locked(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE); + vm_page_unlock_queues(); PMAP_UNLOCK(pm); } @@ -1809,10 +1812,11 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) if ((tp->tte_data & (TD_PV | TD_WIRED)) == (TD_PV | TD_WIRED)) count++; + vm_page_unlock_queues(); return (count); } @@ -1981,10 +1985,10 @@ pmap_remove_write(vm_page_t m) struct tte *tp; u_long data; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 || (m->flags & PG_WRITEABLE) == 0) return; + vm_page_lock_queues(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) continue; @@ -1995,6 +1999,7 @@ pmap_remove_write(vm_page_t m) } } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } int Modified: head/sys/sun4v/sun4v/pmap.c ============================================================================== --- head/sys/sun4v/sun4v/pmap.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/sun4v/sun4v/pmap.c Sat May 8 20:34:01 2010 (r207796) @@ -1211,8 +1211,11 @@ pmap_enter_object(pmap_t pmap, vm_offset void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + + vm_page_lock_queues(); PMAP_LOCK(pmap); pmap_enter_quick_locked(pmap, va, m, prot); + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } @@ -1714,7 +1717,7 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = pv->pv_pmap; PMAP_LOCK(pmap); @@ -1723,6 +1726,7 @@ pmap_page_wired_mappings(vm_page_t m) count++; PMAP_UNLOCK(pmap); } + vm_page_unlock_queues(); return (count); } @@ -1732,12 +1736,15 @@ pmap_page_wired_mappings(vm_page_t m) void pmap_remove_write(vm_page_t m) { + if ((m->flags & PG_WRITEABLE) == 0) return; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); tte_clear_phys_bit(m, VTD_SW_W|VTD_W); vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } + /* * Initialize the pmap associated with process 0. */ @@ -1956,7 +1963,7 @@ pmap_remove_all(vm_page_t m) uint64_t tte_data; DPRINTF("pmap_remove_all 0x%lx\n", VM_PAGE_TO_PHYS(m)); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { PMAP_LOCK(pv->pv_pmap); pv->pv_pmap->pm_stats.resident_count--; @@ -1986,6 +1993,7 @@ pmap_remove_all(vm_page_t m) free_pv_entry(pv); } vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_unlock_queues(); } static void Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Sat May 8 20:08:01 2010 (r207795) +++ head/sys/sys/vmmeter.h Sat May 8 20:34:01 2010 (r207796) @@ -72,7 +72,7 @@ struct vmmeter { u_int v_pdwakeups; /* (f) times daemon has awaken from sleep */ u_int v_pdpages; /* (q) pages analyzed by daemon */ - u_int v_tcached; /* (q) total pages cached */ + u_int v_tcached; /* (p) total pages cached */ u_int v_dfree; /* (q) pages freed by daemon */ u_int v_pfree; /* (p) pages freed by exiting processes */ u_int v_tfree; /* (p) total pages freed */ Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/vm/swap_pager.c Sat May 8 20:34:01 2010 (r207796) @@ -382,8 +382,10 @@ static void swp_pager_free_nrpage(vm_page_t m) { + vm_page_lock(m); if (m->wire_count == 0) vm_page_free(m); + vm_page_unlock(m); } /* @@ -1137,17 +1139,10 @@ swap_pager_getpages(vm_object_t object, if (0 < i || j < count) { int k; - - for (k = 0; k < i; ++k) { - vm_page_lock(m[k]); + for (k = 0; k < i; ++k) swp_pager_free_nrpage(m[k]); - vm_page_unlock(m[k]); - } - for (k = j; k < count; ++k) { - vm_page_lock(m[k]); + for (k = j; k < count; ++k) swp_pager_free_nrpage(m[k]); - vm_page_unlock(m[k]); - } } /* @@ -1514,8 +1509,6 @@ swp_pager_async_iodone(struct buf *bp) for (i = 0; i < bp->b_npages; ++i) { vm_page_t m = bp->b_pages[i]; - vm_page_lock(m); - vm_page_lock_queues(); m->oflags &= ~VPO_SWAPINPROG; if (bp->b_ioflags & BIO_ERROR) { @@ -1558,7 +1551,9 @@ swp_pager_async_iodone(struct buf *bp) * then finish the I/O. */ vm_page_dirty(m); + vm_page_lock(m); vm_page_activate(m); + vm_page_unlock(m); vm_page_io_finish(m); } } else if (bp->b_iocmd == BIO_READ) { @@ -1593,11 +1588,12 @@ swp_pager_async_iodone(struct buf *bp) * left busy. */ if (i != bp->b_pager.pg_reqpage) { + vm_page_lock(m); vm_page_deactivate(m); + vm_page_unlock(m); vm_page_wakeup(m); - } else { + } else vm_page_flash(m); - } } else { /* * For write success, clear the dirty @@ -1609,11 +1605,12 @@ swp_pager_async_iodone(struct buf *bp) " protected", m)); vm_page_undirty(m); vm_page_io_finish(m); - if (vm_page_count_severe()) + if (vm_page_count_severe()) { + vm_page_lock(m); vm_page_try_to_cache(m); + vm_page_unlock(m); + } } - vm_page_unlock_queues(); - vm_page_unlock(m); } /* Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/vm/vm_fault.c Sat May 8 20:34:01 2010 (r207796) @@ -487,20 +487,16 @@ readrest: (mt->oflags & VPO_BUSY)) continue; vm_page_lock(mt); - vm_page_lock_queues(); if (mt->hold_count || mt->wire_count) { - vm_page_unlock_queues(); vm_page_unlock(mt); continue; } pmap_remove_all(mt); - if (mt->dirty) { + if (mt->dirty != 0) vm_page_deactivate(mt); - } else { + else vm_page_cache(mt); - } - vm_page_unlock_queues(); vm_page_unlock(mt); } ahead += behind; @@ -1025,13 +1021,8 @@ vm_fault_prefault(pmap_t pmap, vm_offset break; } if (m->valid == VM_PAGE_BITS_ALL && - (m->flags & PG_FICTITIOUS) == 0) { - vm_page_lock(m); - vm_page_lock_queues(); + (m->flags & PG_FICTITIOUS) == 0) pmap_enter_quick(pmap, addr, m, entry->protection); - vm_page_unlock_queues(); - vm_page_unlock(m); - } VM_OBJECT_UNLOCK(lobject); } } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sat May 8 20:08:01 2010 (r207795) +++ head/sys/vm/vm_object.c Sat May 8 20:34:01 2010 (r207796) @@ -876,13 +876,8 @@ vm_object_page_clean(vm_object_t object, p->oflags |= VPO_CLEANCHK; if ((flags & OBJPC_NOSYNC) && (p->oflags & VPO_NOSYNC)) clearobjflags = 0; - else { - vm_page_lock(p); - vm_page_lock_queues(); + else pmap_remove_write(p); - vm_page_unlock_queues(); - vm_page_unlock(p); - } } if (clearobjflags && (tstart == 0) && (tend == object->size)) @@ -1048,11 +1043,7 @@ vm_object_page_collect_flush(vm_object_t vm_pageout_flush(ma, runlen, pagerflags); for (i = 0; i < runlen; i++) { if (ma[i]->dirty) { - vm_page_lock(ma[i]); - vm_page_lock_queues(); pmap_remove_write(ma[i]); - vm_page_unlock_queues(); - vm_page_unlock(ma[i]); ma[i]->oflags |= VPO_CLEANCHK; /* @@ -1968,7 +1959,6 @@ again: * if "clean_only" is FALSE. */ vm_page_lock(p); - vm_page_lock_queues(); if ((wirings = p->wire_count) != 0 && (wirings = pmap_page_wired_mappings(p)) != p->wire_count) { /* Fictitious pages do not have managed mappings. */ @@ -1980,7 +1970,6 @@ again: p->valid = 0; vm_page_undirty(p); } - vm_page_unlock_queues(); vm_page_unlock(p); continue; } @@ -1991,7 +1980,6 @@ again: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat May 8 21:35:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E6DD6106566B; Sat, 8 May 2010 21:35:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D717B8FC14; Sat, 8 May 2010 21:35:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48LZpS1035389; Sat, 8 May 2010 21:35:51 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48LZpkK035386; Sat, 8 May 2010 21:35:51 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005082135.o48LZpkK035386@svn.freebsd.org> From: Alan Cox Date: Sat, 8 May 2010 21:35:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207798 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 21:35:52 -0000 Author: alc Date: Sat May 8 21:35:51 2010 New Revision: 207798 URL: http://svn.freebsd.org/changeset/base/207798 Log: Minimize the scope of the page queues lock in vm_fault(). Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat May 8 21:18:22 2010 (r207797) +++ head/sys/vm/vm_fault.c Sat May 8 21:35:51 2010 (r207798) @@ -306,7 +306,6 @@ RetryFault:; * which is not what we want. */ vm_page_lock(fs.m); - vm_page_lock_queues(); if ((fs.m->cow) && (fault_type & VM_PROT_WRITE) && (fs.object == fs.first_object)) { @@ -337,6 +336,7 @@ RetryFault:; * sleeping so that the page daemon is less * likely to reclaim it. */ + vm_page_lock_queues(); vm_page_flag_set(fs.m, PG_REFERENCED); vm_page_unlock_queues(); vm_page_unlock(fs.m); @@ -363,6 +363,7 @@ RetryFault:; vm_object_deallocate(fs.first_object); goto RetryFault; } + vm_page_lock_queues(); vm_pageq_remove(fs.m); vm_page_unlock_queues(); vm_page_unlock(fs.m); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat May 8 21:18:22 2010 (r207797) +++ head/sys/vm/vm_page.c Sat May 8 21:35:51 2010 (r207798) @@ -2233,6 +2233,7 @@ vm_page_cowfault(vm_page_t m) vm_object_t object; vm_pindex_t pindex; + mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); vm_page_lock_assert(m, MA_OWNED); object = m->object; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); @@ -2243,7 +2244,6 @@ vm_page_cowfault(vm_page_t m) retry_alloc: pmap_remove_all(m); - vm_page_unlock_queues(); vm_page_remove(m); mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); if (mnew == NULL) { @@ -2254,7 +2254,6 @@ vm_page_cowfault(vm_page_t m) VM_OBJECT_LOCK(object); if (m == vm_page_lookup(object, pindex)) { vm_page_lock(m); - vm_page_lock_queues(); goto retry_alloc; } else { /* @@ -2272,9 +2271,7 @@ vm_page_cowfault(vm_page_t m) */ vm_page_unlock(m); vm_page_lock(mnew); - vm_page_lock_queues(); vm_page_free(mnew); - vm_page_unlock_queues(); vm_page_unlock(mnew); vm_page_insert(m, object, pindex); } else { /* clear COW & copy page */ From owner-svn-src-head@FreeBSD.ORG Sat May 8 23:01:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A366106566B; Sat, 8 May 2010 23:01:47 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 7AA458FC13; Sat, 8 May 2010 23:01:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o48N1lAK054511; Sat, 8 May 2010 23:01:47 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o48N1l0p054509; Sat, 8 May 2010 23:01:47 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005082301.o48N1l0p054509@svn.freebsd.org> From: Alan Cox Date: Sat, 8 May 2010 23:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207805 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 23:01:47 -0000 Author: alc Date: Sat May 8 23:01:47 2010 New Revision: 207805 URL: http://svn.freebsd.org/changeset/base/207805 Log: Update a comment: It no longer makes sense to talk about the page queues lock here. Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Sat May 8 22:25:37 2010 (r207804) +++ head/sys/kern/sys_pipe.c Sat May 8 23:01:47 2010 (r207805) @@ -767,13 +767,10 @@ pipe_build_write_buffer(wpipe, uio) return (EFAULT); for (i = 0; addr < endaddr; addr += PAGE_SIZE, i++) { /* - * vm_fault_quick() can sleep. Consequently, - * vm_page_lock_queue() and vm_page_unlock_queue() - * should not be performed outside of this loop. + * vm_fault_quick() can sleep. */ race: if (vm_fault_quick((caddr_t)addr, VM_PROT_READ) < 0) { - for (j = 0; j < i; j++) { vm_page_lock(wpipe->pipe_map.ms[j]); vm_page_unhold(wpipe->pipe_map.ms[j]);