From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 00:10:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D48710656C3; Sun, 5 Sep 2010 00:10:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C8728FC18; Sun, 5 Sep 2010 00:10: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 o850AIAd045482; Sun, 5 Sep 2010 00:10:18 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o850AIab045480; Sun, 5 Sep 2010 00:10:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009050010.o850AIab045480@svn.freebsd.org> From: Rick Macklem Date: Sun, 5 Sep 2010 00:10: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: r212216 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 00:10:18 -0000 Author: rmacklem Date: Sun Sep 5 00:10:18 2010 New Revision: 212216 URL: http://svn.freebsd.org/changeset/base/212216 Log: Disable use of the NLM in the experimental NFS client, since it will crash the kernel because it uses the nfsmount and nfsnode structures of the regular NFS client. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Sat Sep 4 23:53:47 2010 (r212215) +++ head/sys/fs/nfsclient/nfs_clvnops.c Sun Sep 5 00:10:18 2010 (r212216) @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); extern struct nfsstats newnfsstats; MALLOC_DECLARE(M_NEWNFSREQ); -vop_advlock_t *ncl_advlock_p = nfs_dolock; +vop_advlock_t *ncl_advlock_p = NULL; /* * Ifdef for FreeBSD-current merged buffer cache. It is unfortunate that these From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 00:47:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A06510656B2; Sun, 5 Sep 2010 00:47:44 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4947A8FC12; Sun, 5 Sep 2010 00:47: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 o850lilm046531; Sun, 5 Sep 2010 00:47:44 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o850lioc046529; Sun, 5 Sep 2010 00:47:44 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009050047.o850lioc046529@svn.freebsd.org> From: Rick Macklem Date: Sun, 5 Sep 2010 00:47: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: r212217 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 00:47:44 -0000 Author: rmacklem Date: Sun Sep 5 00:47:44 2010 New Revision: 212217 URL: http://svn.freebsd.org/changeset/base/212217 Log: Change the code in ncl_bioread() in the experimental NFS client to return an error when rabp is not set, so it behaves the same way as the regular NFS client for this case. It does not affect NFSv4, since nfs_getcacheblk() only fails for "intr" mounts and NFSv4 can't use the "intr" mount option. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clbio.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Sun Sep 5 00:10:18 2010 (r212216) +++ head/sys/fs/nfsclient/nfs_clbio.c Sun Sep 5 00:47:44 2010 (r212217) @@ -510,10 +510,7 @@ ncl_bioread(struct vnode *vp, struct uio rabp = nfs_getcacheblk(vp, rabn, biosize, td); if (!rabp) { error = newnfs_sigintr(nmp, td); - if (error) - return (error); - else - break; + return (error ? error : EINTR); } if ((rabp->b_flags & (B_CACHE|B_DELWRI)) == 0) { rabp->b_flags |= B_ASYNC; From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 01:57:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF6E21065695; Sun, 5 Sep 2010 01:57:25 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEB7C8FC0A; Sun, 5 Sep 2010 01:57: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 o851vP9F048360; Sun, 5 Sep 2010 01:57:25 GMT (envelope-from swills@svn.freebsd.org) Received: (from swills@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o851vPWn048358; Sun, 5 Sep 2010 01:57:25 GMT (envelope-from swills@svn.freebsd.org) Message-Id: <201009050157.o851vPWn048358@svn.freebsd.org> From: Steve Wills Date: Sun, 5 Sep 2010 01:57: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: r212218 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 01:57:26 -0000 Author: swills (ports committer) Date: Sun Sep 5 01:57:25 2010 New Revision: 212218 URL: http://svn.freebsd.org/changeset/base/212218 Log: Add myself to calendar.freebsd Approved By: pgollucci (co-mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Sep 5 00:47:44 2010 (r212217) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Sep 5 01:57:25 2010 (r212218) @@ -53,6 +53,7 @@ 02/13 Jesper Skriver born in Aarhus, Denmark, 1975 02/13 Andrey Slusar born in Odessa, USSR, 1979 02/13 David W. Chapman Jr. born in Bethel, Connecticut, United States, 1981 +02/13 Steve Wills born in Lynchburg, Virginia, United States, 1975 02/14 Erwin Lansing born in 's-Hertogenbosch, the Netherlands, 1975 02/14 Manolis Kiagias born in Chania, Greece, 1970 02/14 Martin Blapp born in Olten, Switzerland, 1976 From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 01:58:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D85491065695; Sun, 5 Sep 2010 01:58:21 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C836C8FC08; Sun, 5 Sep 2010 01:58: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 o851wL2v048419; Sun, 5 Sep 2010 01:58:21 GMT (envelope-from swills@svn.freebsd.org) Received: (from swills@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o851wL6M048417; Sun, 5 Sep 2010 01:58:21 GMT (envelope-from swills@svn.freebsd.org) Message-Id: <201009050158.o851wL6M048417@svn.freebsd.org> From: Steve Wills Date: Sun, 5 Sep 2010 01:58: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: r212219 - head/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 01:58:21 -0000 Author: swills (ports committer) Date: Sun Sep 5 01:58:21 2010 New Revision: 212219 URL: http://svn.freebsd.org/changeset/base/212219 Log: Add myself to commiters-ports.dot Approved By: pgollucci (co-mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sun Sep 5 01:57:25 2010 (r212218) +++ head/share/misc/committers-ports.dot Sun Sep 5 01:58:21 2010 (r212219) @@ -154,6 +154,7 @@ skreuzer [label="Steven Kreuzer\nskreuze sobomax[label="Maxim Sobolev\nsobomax@FreeBSD.org\n2000/05/17"] stas [label="Stanislav Sedov\nstas@FreeBSD.org\n2006/09/18"] stefan [label="Stefan Walter\nstefan@FreeBSD.org\n2006/05/07"] +swills [label="Steve Wills\nswills@FreeBSD.org\n2010/09/03"] tabthorpe [label="Thomas Abthorpe\ntabthorpe@FreeBSD.org\n2007/08/20"] tdb [label="Tim Bishop\ntdb@FreeBSD.org\n2005/11/30"] timur [label="Timur Bakeyev\ntimur@FreeBSD.org\n2007/06/07"] @@ -331,6 +332,8 @@ pav -> mnag pgj -> ashish pgj -> jacula +pgollucci -> swills + philip -> koitsu rafan -> chinsan @@ -373,5 +376,6 @@ will -> lioux wxs -> jsa wxs -> sahil wxs -> skreuzer +wxs -> swills } From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 04:58:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EC0A1065679; Sun, 5 Sep 2010 04:58:17 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E72D98FC0C; Sun, 5 Sep 2010 04:58: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 o854wGX1055425; Sun, 5 Sep 2010 04:58:16 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o854wGp0055422; Sun, 5 Sep 2010 04:58:16 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <201009050458.o854wGp0055422@svn.freebsd.org> From: Daichi GOTO Date: Sun, 5 Sep 2010 04:58: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: r212221 - in head: sbin/mount_unionfs sys/fs/unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 04:58:17 -0000 Author: daichi Date: Sun Sep 5 04:58:16 2010 New Revision: 212221 URL: http://svn.freebsd.org/changeset/base/212221 Log: Allowed unionfs to use whiteout not supporting file system as upper layer. Until now, unionfs prevents to use that kind of file system as upper layer. This time, I changed to allow that kind of file system as upper layer. By this change, you can use whiteout not supporting file system (e.g., especially for tmpfs) as upper layer. It's very useful for combination of tmpfs as upper layer and read only file system as lower layer. By difinition, without whiteout support from the file system backing the upper layer, there is no way that delete and rename operations on lower layer objects can be done. EOPNOTSUPP is returned for this kind of operations as generated by VOP_WHITEOUT() along with any others which would make modifica tions to the lower layer, such as chmod(1). This change is suggested by ed. Submitted by: ed Modified: head/sbin/mount_unionfs/mount_unionfs.8 head/sys/fs/unionfs/union_vfsops.c Modified: head/sbin/mount_unionfs/mount_unionfs.8 ============================================================================== --- head/sbin/mount_unionfs/mount_unionfs.8 Sun Sep 5 03:05:03 2010 (r212220) +++ head/sbin/mount_unionfs/mount_unionfs.8 Sun Sep 5 04:58:16 2010 (r212221) @@ -363,9 +363,10 @@ their intent to take it over. Without whiteout support from the file system backing the upper layer, there is no way that delete and rename operations on lower layer objects can be done. -.Er EROFS -is returned for this kind of operations along with any others -which would make modifications to the lower layer, such as +.Er EOPNOTSUPP +is returned for this kind of operations as generated by VOP_WHITEOUT() +along with any others which would make modifications to the lower +layer, such as .Xr chmod 1 . .Pp Running Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Sun Sep 5 03:05:03 2010 (r212220) +++ head/sys/fs/unionfs/union_vfsops.c Sun Sep 5 04:58:16 2010 (r212221) @@ -89,7 +89,6 @@ unionfs_domount(struct mount *mp) u_short ufile; unionfs_copymode copymode; unionfs_whitemode whitemode; - struct componentname fakecn; struct nameidata nd, *ndp; struct vattr va; @@ -280,26 +279,6 @@ unionfs_domount(struct mount *mp) mp->mnt_flag |= ump->um_uppervp->v_mount->mnt_flag & MNT_RDONLY; /* - * Check whiteout - */ - if ((mp->mnt_flag & MNT_RDONLY) == 0) { - memset(&fakecn, 0, sizeof(fakecn)); - fakecn.cn_nameiop = LOOKUP; - fakecn.cn_thread = td; - error = VOP_WHITEOUT(ump->um_uppervp, &fakecn, LOOKUP); - if (error) { - if (below) { - VOP_UNLOCK(ump->um_uppervp, 0); - vrele(upperrootvp); - } else - vput(ump->um_uppervp); - free(ump, M_UNIONFSMNT); - mp->mnt_data = NULL; - return (error); - } - } - - /* * Unlock the node */ VOP_UNLOCK(ump->um_uppervp, 0); From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 05:44:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 490D010656AB; Sun, 5 Sep 2010 05:44:41 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 384228FC08; Sun, 5 Sep 2010 05:44: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 o855ifCU057732; Sun, 5 Sep 2010 05:44:41 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o855ifCL057730; Sun, 5 Sep 2010 05:44:41 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <201009050544.o855ifCL057730@svn.freebsd.org> From: Daichi GOTO Date: Sun, 5 Sep 2010 05:44: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: r212222 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 05:44:41 -0000 Author: daichi Date: Sun Sep 5 05:44:40 2010 New Revision: 212222 URL: http://svn.freebsd.org/changeset/base/212222 Log: Avoid to try to remove suj journal file (.sujournal) and conventional snapshot directory (.snap) from cleartmp rc.d script. Modified: head/etc/rc.d/cleartmp Modified: head/etc/rc.d/cleartmp ============================================================================== --- head/etc/rc.d/cleartmp Sun Sep 5 04:58:16 2010 (r212221) +++ head/etc/rc.d/cleartmp Sun Sep 5 05:44:40 2010 (r212222) @@ -36,7 +36,10 @@ cleartmp_start() # it can prevent foot-shooting in future. # + /tmp/lost+found is preserved, but its contents are removed. # + lost+found and quota.* in subdirectories are removed. + # + .sujournal and .snap are preserved. find -x ${tmp}/. ! -name . \ + ! \( -name .sujournal -type f -user root \) \ + ! \( -name .snap -type d -user root \) \ ! \( -name lost+found -type d -user root \) \ ! \( \( -name quota.user -or -name quota.group \) \ -type f -user root \) \ From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 06:16:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 878B91065675; Sun, 5 Sep 2010 06:16:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 770D28FC15; Sun, 5 Sep 2010 06:16: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 o856G4kE059250; Sun, 5 Sep 2010 06:16:04 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o856G4bB059248; Sun, 5 Sep 2010 06:16:04 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009050616.o856G4bB059248@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Sep 2010 06:16: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: r212223 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 06:16:04 -0000 Author: mav Date: Sun Sep 5 06:16:04 2010 New Revision: 212223 URL: http://svn.freebsd.org/changeset/base/212223 Log: Initialize buffer for case of empty string. Happens only on non-refactored platforms. Modified: head/sys/kern/kern_et.c Modified: head/sys/kern/kern_et.c ============================================================================== --- head/sys/kern/kern_et.c Sun Sep 5 05:44:40 2010 (r212222) +++ head/sys/kern/kern_et.c Sun Sep 5 06:16:04 2010 (r212223) @@ -235,6 +235,7 @@ sysctl_kern_eventtimer_choice(SYSCTL_HAN spc = ""; error = 0; + buf[0] = 0; off = 0; ET_LOCK(); SLIST_FOREACH(et, &eventtimers, et_all) { From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 12:46:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69A4810656BD; Sun, 5 Sep 2010 12:46:39 +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 383338FC24; Sun, 5 Sep 2010 12:46:39 +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 D2F8546B5C; Sun, 5 Sep 2010 08:46:38 -0400 (EDT) Received: from zion.baldwin.cx (c-68-45-19-154.hsd1.nj.comcast.net [68.45.19.154]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 222BF8A051; Sun, 5 Sep 2010 08:46:38 -0400 (EDT) From: John Baldwin To: Rick Macklem Date: Sun, 5 Sep 2010 08:46:14 -0400 User-Agent: KMail/1.12.4 (FreeBSD/7.3-STABLE; KDE/4.3.4; i386; ; ) References: <201009050010.o850AIab045480@svn.freebsd.org> In-Reply-To: <201009050010.o850AIab045480@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009050846.14288.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Sun, 05 Sep 2010 08:46:38 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no 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: r212216 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 12:46:39 -0000 On Saturday 04 September 2010 08:10:18 pm Rick Macklem wrote: > Author: rmacklem > Date: Sun Sep 5 00:10:18 2010 > New Revision: 212216 > URL: http://svn.freebsd.org/changeset/base/212216 > > Log: > Disable use of the NLM in the experimental NFS client, since > it will crash the kernel because it uses the nfsmount and > nfsnode structures of the regular NFS client. Hmm, perhaps we could provide new VFS and/or VOP methods for NLM to use instead of reaching inside of those structures directly? I think we really want to support NLM on the new NFS client as many folks want working NFS locking. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 13:31:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A587810656CB; Sun, 5 Sep 2010 13:31:14 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A8B28FC0C; Sun, 5 Sep 2010 13: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 o85DVECi080880; Sun, 5 Sep 2010 13:31:14 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85DVE0g080877; Sun, 5 Sep 2010 13:31:14 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201009051331.o85DVE0g080877@svn.freebsd.org> From: Fabien Thomas Date: Sun, 5 Sep 2010 13:31: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: r212224 - in head: lib/libpmc sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 13:31:14 -0000 Author: fabient Date: Sun Sep 5 13:31:14 2010 New Revision: 212224 URL: http://svn.freebsd.org/changeset/base/212224 Log: Fix invalid class removal when IAF is not the last class. Keep IAF class with 0 PMC and change the alias in libpmc to IAP. MFC after: 1 week Modified: head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Sun Sep 5 06:16:04 2010 (r212223) +++ head/lib/libpmc/libpmc.c Sun Sep 5 13:31:14 2010 (r212224) @@ -2695,7 +2695,8 @@ pmc_init(void) */ cpu_has_iaf_counters = 0; for (t = 0; t < cpu_info.pm_nclass; t++) - if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF) + if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF && + cpu_info.pm_classes[t].pm_num > 0) cpu_has_iaf_counters = 1; #endif @@ -2708,9 +2709,8 @@ pmc_init(void) #define PMC_MDEP_INIT_INTEL_V2(C) do { \ PMC_MDEP_INIT(C); \ - if (cpu_has_iaf_counters) \ - pmc_class_table[n++] = &iaf_class_table_descr; \ - else \ + pmc_class_table[n++] = &iaf_class_table_descr; \ + if (!cpu_has_iaf_counters) \ pmc_mdep_event_aliases = \ C##_aliases_without_iaf; \ pmc_class_table[n] = &C##_class_table_descr; \ Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Sun Sep 5 06:16:04 2010 (r212223) +++ head/sys/dev/hwpmc/hwpmc_core.c Sun Sep 5 13:31:14 2010 (r212224) @@ -2234,21 +2234,8 @@ pmc_core_initialize(struct pmc_mdep *md, core_iaf_npmc = cpuid[CORE_CPUID_EDX] & 0x1F; core_iaf_width = (cpuid[CORE_CPUID_EDX] >> 5) & 0xFF; - if (core_iaf_npmc > 0) { - iaf_initialize(md, maxcpu, core_iaf_npmc, - core_iaf_width); - core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) << - IAF_OFFSET; - } else { - /* - * Adjust the number of classes exported to - * user space. - */ - md->pmd_nclass--; - KASSERT(md->pmd_nclass == 2, - ("[core,%d] unexpected nclass %d", __LINE__, - md->pmd_nclass)); - } + iaf_initialize(md, maxcpu, core_iaf_npmc, core_iaf_width); + core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) << IAF_OFFSET; } PMCDBG(MDP,INI,1,"core-init pmcmask=0x%jx iafri=%d", core_pmcmask, From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 13:41:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2A1E1065697; Sun, 5 Sep 2010 13:41:45 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6CC18FC0C; Sun, 5 Sep 2010 13:41: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 o85DfjMC081311; Sun, 5 Sep 2010 13:41:45 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85DfjH9081305; Sun, 5 Sep 2010 13:41:45 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201009051341.o85DfjH9081305@svn.freebsd.org> From: Randall Stewart Date: Sun, 5 Sep 2010 13:41: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: r212225 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 13:41:45 -0000 Author: rrs Date: Sun Sep 5 13:41:45 2010 New Revision: 212225 URL: http://svn.freebsd.org/changeset/base/212225 Log: Fix some CLANG warnings. One clang warning is left due to the fact that its bogus.. nam->sa_family will not change from AF_INET6 to AF_INET (but clang thinks it does ;-D) Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Sep 5 13:31:14 2010 (r212224) +++ head/sys/netinet/sctp_input.c Sun Sep 5 13:41:45 2010 (r212225) @@ -535,7 +535,7 @@ sctp_handle_heartbeat_ack(struct sctp_he struct sockaddr_storage store; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; - struct sctp_nets *r_net; + struct sctp_nets *r_net, *f_net; struct timeval tv; int req_prim = 0; @@ -581,16 +581,16 @@ sctp_handle_heartbeat_ack(struct sctp_he stcb->asoc.primary_destination = r_net; r_net->dest_state &= ~SCTP_ADDR_WAS_PRIMARY; r_net->dest_state &= ~SCTP_ADDR_REQ_PRIMARY; - r_net = TAILQ_FIRST(&stcb->asoc.nets); - if (r_net != stcb->asoc.primary_destination) { + f_net = TAILQ_FIRST(&stcb->asoc.nets); + if (f_net != r_net) { /* * first one on the list is NOT the primary * sctp_cmpaddr() is much more efficent if * the primary is the first on the list, * make it so. */ - TAILQ_REMOVE(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next); - TAILQ_INSERT_HEAD(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next); + TAILQ_REMOVE(&stcb->asoc.nets, r_net, sctp_next); + TAILQ_INSERT_HEAD(&stcb->asoc.nets, r_net, sctp_next); } req_prim = 1; } @@ -4685,14 +4685,14 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK\n"); SCTP_STAT_INCR(sctps_recvsacks); - if ((stcb->asoc.sctp_nr_sack_on_off == 0) || - (stcb->asoc.peer_supports_nr_sack == 0)) { - goto unknown_chunk; - } if (stcb == NULL) { SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing NR-SACK chunk\n"); break; } + if ((stcb->asoc.sctp_nr_sack_on_off == 0) || + (stcb->asoc.peer_supports_nr_sack == 0)) { + goto unknown_chunk; + } if (chk_length < sizeof(struct sctp_nr_sack_chunk)) { SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on NR-SACK chunk, too small\n"); break; Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Sep 5 13:31:14 2010 (r212224) +++ head/sys/netinet/sctp_output.c Sun Sep 5 13:41:45 2010 (r212225) @@ -9840,9 +9840,12 @@ sctp_fill_in_rest: at = TAILQ_FIRST(&asoc->sent_queue); for (i = 0; i < cnt_of_skipped; i++) { tp1 = TAILQ_NEXT(at, sctp_next); + if (tp1 == NULL) { + break; + } at = tp1; } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { + if (at && SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { sctp_misc_ints(SCTP_FWD_TSN_CHECK, 0xff, cnt_of_skipped, at->rec.data.TSN_seq, asoc->advanced_peer_ack_point); @@ -9852,7 +9855,8 @@ sctp_fill_in_rest: * last now points to last one I can report, update * peer ack point */ - advance_peer_ack_point = last->rec.data.TSN_seq; + if (last) + advance_peer_ack_point = last->rec.data.TSN_seq; space_needed = sizeof(struct sctp_forward_tsn_chunk) + cnt_of_skipped * sizeof(struct sctp_strseq); } @@ -9885,6 +9889,8 @@ sctp_fill_in_rest: at = TAILQ_FIRST(&asoc->sent_queue); for (i = 0; i < cnt_of_skipped; i++) { tp1 = TAILQ_NEXT(at, sctp_next); + if (tp1 == NULL) + break; if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) { /* We don't report these */ i--; @@ -10560,7 +10566,8 @@ sctp_send_shutdown_complete2(struct mbuf udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); udp->uh_dport = port; udp->uh_ulen = htons(sizeof(struct sctp_shutdown_complete_msg) + sizeof(struct udphdr)); - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); + if (iph_out) + udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); offset_out += sizeof(struct udphdr); comp_cp = (struct sctp_shutdown_complete_msg *)((caddr_t)comp_cp + sizeof(struct udphdr)); } Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Sep 5 13:31:14 2010 (r212224) +++ head/sys/netinet/sctp_pcb.c Sun Sep 5 13:41:45 2010 (r212225) @@ -517,7 +517,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, vo sizeof(struct sctp_ifn), SCTP_M_IFN); if (sctp_ifnp == NULL) { #ifdef INVARIANTS - panic("No memory for IFN:%u", sctp_ifnp->ifn_index); + panic("No memory for IFN"); #endif return (NULL); } @@ -5902,7 +5902,7 @@ sctp_load_addresses_from_init(struct sct } #endif default: - sa = NULL; + return (-1); break; } } else { Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sun Sep 5 13:31:14 2010 (r212224) +++ head/sys/netinet/sctp_timer.c Sun Sep 5 13:41:45 2010 (r212225) @@ -482,6 +482,9 @@ sctp_find_alternate_net(struct sctp_tcb if (mnet == NULL) { mnet = TAILQ_FIRST(&stcb->asoc.nets); + if (mnet == NULL) { + return (NULL); + } } do { alt = TAILQ_NEXT(mnet, sctp_next); @@ -491,6 +494,9 @@ sctp_find_alternate_net(struct sctp_tcb break; } alt = TAILQ_FIRST(&stcb->asoc.nets); + if (alt == NULL) { + return (NULL); + } } if (alt->ro.ro_rt == NULL) { if (alt->ro._s_addr) { @@ -517,6 +523,9 @@ sctp_find_alternate_net(struct sctp_tcb once = 0; mnet = net; do { + if (mnet == NULL) { + return (TAILQ_FIRST(&stcb->asoc.nets)); + } alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { once++; Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun Sep 5 13:31:14 2010 (r212224) +++ head/sys/netinet/sctputil.c Sun Sep 5 13:41:45 2010 (r212225) @@ -340,7 +340,7 @@ sctp_log_lock(struct sctp_inpcb *inp, st sctp_clog.x.lock.create_lock = SCTP_LOCK_UNKNOWN; } sctp_clog.x.lock.info_lock = rw_wowned(&SCTP_BASE_INFO(ipi_ep_mtx)); - if (inp->sctp_socket) { + if (inp && (inp->sctp_socket)) { sctp_clog.x.lock.sock_lock = mtx_owned(&(inp->sctp_socket->so_rcv.sb_mtx)); sctp_clog.x.lock.sockrcvbuf_lock = mtx_owned(&(inp->sctp_socket->so_rcv.sb_mtx)); sctp_clog.x.lock.socksndbuf_lock = mtx_owned(&(inp->sctp_socket->so_snd.sb_mtx)); @@ -4211,7 +4211,7 @@ void sctp_print_address_pkt(struct ip *iph, struct sctphdr *sh) { switch (iph->ip_v) { - case IPVERSION: + case IPVERSION: { struct sockaddr_in lsa, fsa; @@ -5704,7 +5704,9 @@ get_more_data: if ((SCTP_BUF_NEXT(m) == NULL) && (control->end_added)) { out_flags |= MSG_EOR; - if ((control->do_not_ref_stcb == 0) && ((control->spec_flags & M_NOTIFICATION) == 0)) + if ((control->do_not_ref_stcb == 0) && + (control->stcb != NULL) && + ((control->spec_flags & M_NOTIFICATION) == 0)) control->stcb->asoc.strmin[control->sinfo_stream].delivery_started = 0; } if (control->spec_flags & M_NOTIFICATION) { From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:02:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6F6F10656C4; Sun, 5 Sep 2010 14:02:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5D758FC13; Sun, 5 Sep 2010 14: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 o85E2YXt082355; Sun, 5 Sep 2010 14:02:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85E2Yem082353; Sun, 5 Sep 2010 14:02:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051402.o85E2Yem082353@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212226 - stable/8/sys/dev/null X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:02:34 -0000 Author: kib Date: Sun Sep 5 14:02:34 2010 New Revision: 212226 URL: http://svn.freebsd.org/changeset/base/212226 Log: MFC r196885 (by ed): Remove unneeded minor numbers from /dev/null and /dev/zero. Modified: stable/8/sys/dev/null/null.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/null/null.c ============================================================================== --- stable/8/sys/dev/null/null.c Sun Sep 5 13:41:45 2010 (r212225) +++ stable/8/sys/dev/null/null.c Sun Sep 5 14:02:34 2010 (r212226) @@ -49,9 +49,6 @@ static d_write_t null_write; static d_ioctl_t null_ioctl; static d_read_t zero_read; -#define NULL_MINOR 2 -#define ZERO_MINOR 12 - static struct cdevsw null_cdevsw = { .d_version = D_VERSION, .d_read = (d_read_t *)nullop, @@ -115,10 +112,10 @@ null_modevent(module_t mod __unused, int if (bootverbose) printf("null: \n"); zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - null_dev = make_dev(&null_cdevsw, NULL_MINOR, UID_ROOT, - GID_WHEEL, 0666, "null"); - zero_dev = make_dev(&zero_cdevsw, ZERO_MINOR, UID_ROOT, - GID_WHEEL, 0666, "zero"); + null_dev = make_dev(&null_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0666, "null"); + zero_dev = make_dev(&zero_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0666, "zero"); break; case MOD_UNLOAD: From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:16:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7ACB310656A6; Sun, 5 Sep 2010 14:16:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69FBA8FC0C; Sun, 5 Sep 2010 14:16:35 +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 o85EGZWt082963; Sun, 5 Sep 2010 14:16:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85EGZin082961; Sun, 5 Sep 2010 14:16:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051416.o85EGZin082961@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212227 - stable/8/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:16:35 -0000 Author: kib Date: Sun Sep 5 14:16:35 2010 New Revision: 212227 URL: http://svn.freebsd.org/changeset/base/212227 Log: MFC r210918: Initialize VV_ISTTY vnode flag on the devfs vnode creation instead of doing it on each open. Modified: stable/8/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Sun Sep 5 14:02:34 2010 (r212226) +++ stable/8/sys/fs/devfs/devfs_vnops.c Sun Sep 5 14:16:35 2010 (r212227) @@ -337,6 +337,7 @@ devfs_allocv(struct devfs_dirent *de, st struct vnode *vp; struct cdev *dev; struct devfs_mount *dmp; + struct cdevsw *dsw; dmp = VFSTODEVFS(mp); if (de->de_flags & DE_DOOMED) { @@ -393,6 +394,10 @@ devfs_allocv(struct devfs_dirent *de, st KASSERT(vp->v_usecount == 1, ("%s %d (%d)\n", __func__, __LINE__, vp->v_usecount)); dev->si_usecount += vp->v_usecount; + /* Special casing of ttys for deadfs. Probably redundant. */ + dsw = dev->si_devsw; + if (dsw != NULL && (dsw->d_flags & D_TTY) != 0) + vp->v_vflag |= VV_ISTTY; dev_unlock(); VI_UNLOCK(vp); vp->v_op = &devfs_specops; @@ -964,10 +969,6 @@ devfs_open(struct vop_open_args *ap) if (dsw == NULL) return (ENXIO); - /* XXX: Special casing of ttys for deadfs. Probably redundant. */ - if (dsw->d_flags & D_TTY) - vp->v_vflag |= VV_ISTTY; - VOP_UNLOCK(vp, 0); fpop = td->td_fpop; From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:20:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C705F1065697; Sun, 5 Sep 2010 14:20:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D28F8FC0C; Sun, 5 Sep 2010 14:20: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 o85EKYQe083163; Sun, 5 Sep 2010 14:20:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85EKY6U083159; Sun, 5 Sep 2010 14:20:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051420.o85EKY6U083159@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212228 - stable/8/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:20:34 -0000 Author: kib Date: Sun Sep 5 14:20:34 2010 New Revision: 212228 URL: http://svn.freebsd.org/changeset/base/212228 Log: MFC r210921: Enable shared locks for the devfs vnodes. Honor the locking mode requested by lookup(). Modified: stable/8/sys/fs/devfs/devfs.h stable/8/sys/fs/devfs/devfs_vfsops.c stable/8/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/devfs/devfs.h ============================================================================== --- stable/8/sys/fs/devfs/devfs.h Sun Sep 5 14:16:35 2010 (r212227) +++ stable/8/sys/fs/devfs/devfs.h Sun Sep 5 14:20:34 2010 (r212228) @@ -172,7 +172,7 @@ extern unsigned devfs_rule_depth; void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de); void devfs_rules_cleanup (struct devfs_mount *dm); int devfs_rules_ioctl(struct devfs_mount *dm, u_long cmd, caddr_t data, struct thread *td); -int devfs_allocv (struct devfs_dirent *de, struct mount *mp, +int devfs_allocv(struct devfs_dirent *de, struct mount *mp, int lockmode, struct vnode **vpp); void devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int vp_locked); void devfs_dirent_free(struct devfs_dirent *de); Modified: stable/8/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vfsops.c Sun Sep 5 14:16:35 2010 (r212227) +++ stable/8/sys/fs/devfs/devfs_vfsops.c Sun Sep 5 14:20:34 2010 (r212228) @@ -155,7 +155,7 @@ devfs_root(struct mount *mp, int flags, dmp = VFSTODEVFS(mp); sx_xlock(&dmp->dm_lock); - error = devfs_allocv(dmp->dm_rootdir, mp, &vp); + error = devfs_allocv(dmp->dm_rootdir, mp, LK_EXCLUSIVE, &vp); if (error) return (error); vp->v_vflag |= VV_ROOT; Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Sun Sep 5 14:16:35 2010 (r212227) +++ stable/8/sys/fs/devfs/devfs_vnops.c Sun Sep 5 14:20:34 2010 (r212228) @@ -331,7 +331,8 @@ devfs_insmntque_dtr(struct vnode *vp, vo * it on return. */ int -devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp) +devfs_allocv(struct devfs_dirent *de, struct mount *mp, int lockmode, + struct vnode **vpp) { int error; struct vnode *vp; @@ -352,7 +353,7 @@ devfs_allocv(struct devfs_dirent *de, st VI_LOCK(vp); mtx_unlock(&devfs_de_interlock); sx_xunlock(&dmp->dm_lock); - error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread); + error = vget(vp, lockmode | LK_INTERLOCK, curthread); sx_xlock(&dmp->dm_lock); if (devfs_allocv_drop_refs(0, dmp, de)) { if (error == 0) @@ -408,6 +409,7 @@ devfs_allocv(struct devfs_dirent *de, st } else { vp->v_type = VBAD; } + VN_LOCK_ASHARE(vp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_NOWITNESS); mtx_lock(&devfs_de_interlock); vp->v_data = de; @@ -747,7 +749,7 @@ devfs_lookupx(struct vop_lookup_args *ap struct devfs_dirent **dde; struct devfs_mount *dmp; struct cdev *cdev; - int error, flags, nameiop; + int error, flags, nameiop, dvplocked; char specname[SPECNAMELEN + 1], *pname; cnp = ap->a_cnp; @@ -788,10 +790,12 @@ devfs_lookupx(struct vop_lookup_args *ap de = devfs_parent_dirent(dd); if (de == NULL) return (ENOENT); + dvplocked = VOP_ISLOCKED(dvp); VOP_UNLOCK(dvp, 0); - error = devfs_allocv(de, dvp->v_mount, vpp); + error = devfs_allocv(de, dvp->v_mount, + cnp->cn_lkflags & LK_TYPE_MASK, vpp); *dm_unlock = 0; - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(dvp, dvplocked | LK_RETRY); return (error); } @@ -878,7 +882,8 @@ devfs_lookupx(struct vop_lookup_args *ap return (0); } } - error = devfs_allocv(de, dvp->v_mount, vpp); + error = devfs_allocv(de, dvp->v_mount, cnp->cn_lkflags & LK_TYPE_MASK, + vpp); *dm_unlock = 0; return (error); } @@ -936,7 +941,7 @@ devfs_mknod(struct vop_mknod_args *ap) if (de == NULL) goto notfound; de->de_flags &= ~DE_WHITEOUT; - error = devfs_allocv(de, dvp->v_mount, vpp); + error = devfs_allocv(de, dvp->v_mount, LK_EXCLUSIVE, vpp); return (error); notfound: sx_xunlock(&dmp->dm_lock); @@ -951,7 +956,7 @@ devfs_open(struct vop_open_args *ap) struct vnode *vp = ap->a_vp; struct cdev *dev = vp->v_rdev; struct file *fp = ap->a_fp; - int error; + int error, vlocked; struct cdevsw *dsw; struct file *fpop; @@ -969,6 +974,7 @@ devfs_open(struct vop_open_args *ap) if (dsw == NULL) return (ENXIO); + vlocked = VOP_ISLOCKED(vp); VOP_UNLOCK(vp, 0); fpop = td->td_fpop; @@ -983,18 +989,15 @@ devfs_open(struct vop_open_args *ap) error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td); td->td_fpop = fpop; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - + vn_lock(vp, vlocked | LK_RETRY); dev_relthread(dev); - if (error) return (error); #if 0 /* /dev/console */ - KASSERT(fp != NULL, - ("Could not vnode bypass device on NULL fp")); + KASSERT(fp != NULL, ("Could not vnode bypass device on NULL fp")); #else - if(fp == NULL) + if (fp == NULL) return (error); #endif if (fp->f_ops == &badfileops) @@ -1487,7 +1490,7 @@ devfs_symlink(struct vop_symlink_args *a mac_devfs_create_symlink(ap->a_cnp->cn_cred, dmp->dm_mount, dd, de); #endif TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); - return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp)); + return (devfs_allocv(de, ap->a_dvp->v_mount, LK_EXCLUSIVE, ap->a_vpp)); } static int From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:27:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8FF41065670; Sun, 5 Sep 2010 14:27:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D66C78FC1A; Sun, 5 Sep 2010 14:27: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 o85ERtTl083469; Sun, 5 Sep 2010 14:27:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85ERti5083459; Sun, 5 Sep 2010 14:27:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051427.o85ERti5083459@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212229 - in stable/8/sys: fs/devfs kern sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:27:56 -0000 Author: kib Date: Sun Sep 5 14:27:55 2010 New Revision: 212229 URL: http://svn.freebsd.org/changeset/base/212229 Log: MFC r210923: Add new make_dev_p(9) flag MAKEDEV_ETERNAL to inform devfs that created cdev will never be destroyed. Propagate the flag to devfs vnodes as VV_ETERNVALDEV. Use the flags to avoid acquiring devmtx and taking a thread reference on such nodes. Modified: stable/8/sys/fs/devfs/devfs_rule.c stable/8/sys/fs/devfs/devfs_vnops.c stable/8/sys/kern/kern_conf.c stable/8/sys/kern/tty.c stable/8/sys/kern/vfs_bio.c stable/8/sys/sys/conf.h stable/8/sys/sys/vnode.h stable/8/sys/vm/device_pager.c stable/8/sys/vm/vm_mmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_rule.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_rule.c Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/fs/devfs/devfs_rule.c Sun Sep 5 14:27:55 2010 (r212229) @@ -528,6 +528,7 @@ devfs_rule_match(struct devfs_krule *dk, struct devfs_rule *dr = &dk->dk_rule; struct cdev *dev; struct cdevsw *dsw; + int ref; dev = devfs_rule_getdev(de); /* @@ -545,14 +546,14 @@ devfs_rule_match(struct devfs_krule *dk, if (dr->dr_icond & DRC_DSWFLAGS) { if (dev == NULL) return (0); - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (0); if ((dsw->d_flags & dr->dr_dswflags) == 0) { - dev_relthread(dev); + dev_relthread(dev, ref); return (0); } - dev_relthread(dev); + dev_relthread(dev, ref); } if (dr->dr_icond & DRC_PATHPTRN) if (!devfs_rule_matchpath(dk, de)) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/fs/devfs/devfs_vnops.c Sun Sep 5 14:27:55 2010 (r212229) @@ -82,13 +82,14 @@ struct mtx cdevpriv_mtx; MTX_SYSINIT(cdevpriv_mtx, &cdevpriv_mtx, "cdevpriv lock", MTX_DEF); static int -devfs_fp_check(struct file *fp, struct cdev **devp, struct cdevsw **dswp) +devfs_fp_check(struct file *fp, struct cdev **devp, struct cdevsw **dswp, + int *ref) { - *dswp = devvn_refthread(fp->f_vnode, devp); + *dswp = devvn_refthread(fp->f_vnode, devp, ref); if (*devp != fp->f_data) { if (*dswp != NULL) - dev_relthread(*devp); + dev_relthread(*devp, *ref); return (ENXIO); } KASSERT((*devp)->si_refcount > 0, @@ -401,6 +402,8 @@ devfs_allocv(struct devfs_dirent *de, st vp->v_vflag |= VV_ISTTY; dev_unlock(); VI_UNLOCK(vp); + if ((dev->si_flags & SI_ETERNAL) != 0) + vp->v_vflag |= VV_ETERNALDEV; vp->v_op = &devfs_specops; } else if (de->de_dirent->d_type == DT_DIR) { vp->v_type = VDIR; @@ -465,7 +468,7 @@ devfs_close(struct vop_close_args *ap) struct thread *td = ap->a_td; struct cdev *dev = vp->v_rdev; struct cdevsw *dsw; - int vp_locked, error; + int vp_locked, error, ref; /* * XXX: Don't call d_close() if we were called because of @@ -507,7 +510,7 @@ devfs_close(struct vop_close_args *ap) * sum of the reference counts on all the aliased * vnodes descends to one, we are on last close. */ - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); VI_LOCK(vp); @@ -517,7 +520,7 @@ devfs_close(struct vop_close_args *ap) /* Keep device updated on status. */ } else if (count_dev(dev) > 1) { VI_UNLOCK(vp); - dev_relthread(dev); + dev_relthread(dev, ref); return (0); } vholdl(vp); @@ -527,7 +530,7 @@ devfs_close(struct vop_close_args *ap) KASSERT(dev->si_refcount > 0, ("devfs_close() on un-referenced struct cdev *(%s)", devtoname(dev))); error = dsw->d_close(dev, ap->a_fflag, S_IFCHR, td); - dev_relthread(dev); + dev_relthread(dev, ref); vn_lock(vp, vp_locked | LK_RETRY); vdrop(vp); return (error); @@ -645,20 +648,20 @@ devfs_ioctl_f(struct file *fp, u_long co struct cdevsw *dsw; struct vnode *vp; struct vnode *vpold; - int error, i; + int error, i, ref; const char *p; struct fiodgname_arg *fgn; struct file *fpop; fpop = td->td_fpop; - error = devfs_fp_check(fp, &dev, &dsw); + error = devfs_fp_check(fp, &dev, &dsw, &ref); if (error) return (error); if (com == FIODTYPE) { *(int *)data = dsw->d_flags & D_TYPEMASK; td->td_fpop = fpop; - dev_relthread(dev); + dev_relthread(dev, ref); return (0); } else if (com == FIODGNAME) { fgn = data; @@ -669,12 +672,12 @@ devfs_ioctl_f(struct file *fp, u_long co else error = copyout(p, fgn->buf, i); td->td_fpop = fpop; - dev_relthread(dev); + dev_relthread(dev, ref); return (error); } error = dsw->d_ioctl(dev, com, data, fp->f_flag, td); td->td_fpop = NULL; - dev_relthread(dev); + dev_relthread(dev, ref); if (error == ENOIOCTL) error = ENOTTY; if (error == 0 && com == TIOCSCTTY) { @@ -708,18 +711,18 @@ devfs_kqfilter_f(struct file *fp, struct { struct cdev *dev; struct cdevsw *dsw; - int error; + int error, ref; struct file *fpop; struct thread *td; td = curthread; fpop = td->td_fpop; - error = devfs_fp_check(fp, &dev, &dsw); + error = devfs_fp_check(fp, &dev, &dsw, &ref); if (error) return (error); error = dsw->d_kqfilter(dev, kn); td->td_fpop = fpop; - dev_relthread(dev); + dev_relthread(dev, ref); return (error); } @@ -956,7 +959,7 @@ devfs_open(struct vop_open_args *ap) struct vnode *vp = ap->a_vp; struct cdev *dev = vp->v_rdev; struct file *fp = ap->a_fp; - int error, vlocked; + int error, ref, vlocked; struct cdevsw *dsw; struct file *fpop; @@ -970,7 +973,7 @@ devfs_open(struct vop_open_args *ap) if (dev->si_iosize_max == 0) dev->si_iosize_max = DFLTPHYS; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); @@ -990,7 +993,7 @@ devfs_open(struct vop_open_args *ap) td->td_fpop = fpop; vn_lock(vp, vlocked | LK_RETRY); - dev_relthread(dev); + dev_relthread(dev, ref); if (error) return (error); @@ -1033,16 +1036,16 @@ devfs_poll_f(struct file *fp, int events { struct cdev *dev; struct cdevsw *dsw; - int error; + int error, ref; struct file *fpop; fpop = td->td_fpop; - error = devfs_fp_check(fp, &dev, &dsw); + error = devfs_fp_check(fp, &dev, &dsw, &ref); if (error) return (poll_no_poll(events)); error = dsw->d_poll(dev, events, td); td->td_fpop = fpop; - dev_relthread(dev); + dev_relthread(dev, ref); return(error); } @@ -1062,12 +1065,12 @@ static int devfs_read_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td) { struct cdev *dev; - int ioflag, error, resid; + int ioflag, error, ref, resid; struct cdevsw *dsw; struct file *fpop; fpop = td->td_fpop; - error = devfs_fp_check(fp, &dev, &dsw); + error = devfs_fp_check(fp, &dev, &dsw, &ref); if (error) return (error); resid = uio->uio_resid; @@ -1082,7 +1085,7 @@ devfs_read_f(struct file *fp, struct uio if (uio->uio_resid != resid || (error == 0 && resid != 0)) vfs_timestamp(&dev->si_atime); td->td_fpop = fpop; - dev_relthread(dev); + dev_relthread(dev, ref); if ((flags & FOF_OFFSET) == 0) fp->f_offset = uio->uio_offset; @@ -1505,12 +1508,12 @@ static int devfs_write_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td) { struct cdev *dev; - int error, ioflag, resid; + int error, ioflag, ref, resid; struct cdevsw *dsw; struct file *fpop; fpop = td->td_fpop; - error = devfs_fp_check(fp, &dev, &dsw); + error = devfs_fp_check(fp, &dev, &dsw, &ref); if (error) return (error); KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -1528,7 +1531,7 @@ devfs_write_f(struct file *fp, struct ui dev->si_mtime = dev->si_ctime; } td->td_fpop = fpop; - dev_relthread(dev); + dev_relthread(dev, ref); if ((flags & FOF_OFFSET) == 0) fp->f_offset = uio->uio_offset; Modified: stable/8/sys/kern/kern_conf.c ============================================================================== --- stable/8/sys/kern/kern_conf.c Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/kern/kern_conf.c Sun Sep 5 14:27:55 2010 (r212229) @@ -177,12 +177,16 @@ dev_rel(struct cdev *dev) } struct cdevsw * -dev_refthread(struct cdev *dev) +dev_refthread(struct cdev *dev, int *ref) { struct cdevsw *csw; struct cdev_priv *cdp; mtx_assert(&devmtx, MA_NOTOWNED); + if ((dev->si_flags & SI_ETERNAL) != 0) { + *ref = 0; + return (dev->si_devsw); + } dev_lock(); csw = dev->si_devsw; if (csw != NULL) { @@ -193,36 +197,59 @@ dev_refthread(struct cdev *dev) csw = NULL; } dev_unlock(); + *ref = 1; return (csw); } struct cdevsw * -devvn_refthread(struct vnode *vp, struct cdev **devp) +devvn_refthread(struct vnode *vp, struct cdev **devp, int *ref) { struct cdevsw *csw; struct cdev_priv *cdp; + struct cdev *dev; mtx_assert(&devmtx, MA_NOTOWNED); + if ((vp->v_vflag & VV_ETERNALDEV) != 0) { + dev = vp->v_rdev; + if (dev == NULL) + return (NULL); + KASSERT((dev->si_flags & SI_ETERNAL) != 0, + ("Not eternal cdev")); + *ref = 0; + csw = dev->si_devsw; + KASSERT(csw != NULL, ("Eternal cdev is destroyed")); + *devp = dev; + return (csw); + } + csw = NULL; dev_lock(); - *devp = vp->v_rdev; - if (*devp != NULL) { - cdp = cdev2priv(*devp); - if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) { - csw = (*devp)->si_devsw; - if (csw != NULL) - (*devp)->si_threadcount++; - } + dev = vp->v_rdev; + if (dev == NULL) { + dev_unlock(); + return (NULL); + } + cdp = cdev2priv(dev); + if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) { + csw = dev->si_devsw; + if (csw != NULL) + dev->si_threadcount++; } dev_unlock(); + if (csw != NULL) { + *devp = dev; + *ref = 1; + } return (csw); } void -dev_relthread(struct cdev *dev) +dev_relthread(struct cdev *dev, int ref) { mtx_assert(&devmtx, MA_NOTOWNED); + if (!ref) + return; dev_lock(); KASSERT(dev->si_threadcount > 0, ("%s threadcount is wrong", dev->si_name)); @@ -325,15 +352,15 @@ static int giant_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_open(dev, oflags, devtype, td); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -341,15 +368,15 @@ static int giant_fdopen(struct cdev *dev, int oflags, struct thread *td, struct file *fp) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_fdopen(dev, oflags, td, fp); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -357,15 +384,15 @@ static int giant_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_close(dev, fflag, devtype, td); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -374,9 +401,10 @@ giant_strategy(struct bio *bp) { struct cdevsw *dsw; struct cdev *dev; + int ref; dev = bp->bio_dev; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) { biofinish(bp, NULL, ENXIO); return; @@ -384,22 +412,22 @@ giant_strategy(struct bio *bp) mtx_lock(&Giant); dsw->d_gianttrick->d_strategy(bp); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); } static int giant_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_ioctl(dev, cmd, data, fflag, td); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -407,15 +435,15 @@ static int giant_read(struct cdev *dev, struct uio *uio, int ioflag) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_read(dev, uio, ioflag); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -423,15 +451,15 @@ static int giant_write(struct cdev *dev, struct uio *uio, int ioflag) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_write(dev, uio, ioflag); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -439,15 +467,15 @@ static int giant_poll(struct cdev *dev, int events, struct thread *td) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_poll(dev, events, td); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -455,15 +483,15 @@ static int giant_kqfilter(struct cdev *dev, struct knote *kn) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_kqfilter(dev, kn); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -472,9 +500,9 @@ giant_mmap(struct cdev *dev, vm_offset_t vm_memattr_t *memattr) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); @@ -484,7 +512,7 @@ giant_mmap(struct cdev *dev, vm_offset_t else retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -493,16 +521,16 @@ giant_mmap_single(struct cdev *dev, vm_o vm_object_t *object, int nprot) { struct cdevsw *dsw; - int retval; + int ref, retval; - dsw = dev_refthread(dev); + dsw = dev_refthread(dev, &ref); if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); retval = dsw->d_gianttrick->d_mmap_single(dev, offset, size, object, nprot); mtx_unlock(&Giant); - dev_relthread(dev); + dev_relthread(dev, ref); return (retval); } @@ -682,6 +710,8 @@ make_dev_credv(int flags, struct cdev ** dev = newdev(devsw, unit, dev); if (flags & MAKEDEV_REF) dev_refl(dev); + if (flags & MAKEDEV_ETERNAL) + dev->si_flags |= SI_ETERNAL; if (dev->si_flags & SI_CHEAPCLONE && dev->si_flags & SI_NAMED) { /* @@ -846,6 +876,9 @@ destroy_devl(struct cdev *dev) mtx_assert(&devmtx, MA_OWNED); KASSERT(dev->si_flags & SI_NAMED, ("WARNING: Driver mistake: destroy_dev on %d\n", dev2unit(dev))); + KASSERT((dev->si_flags & SI_ETERNAL) == 0, + ("WARNING: Driver mistake: destroy_dev on eternal %d\n", + dev2unit(dev))); devfs_destroy(dev); Modified: stable/8/sys/kern/tty.c ============================================================================== --- stable/8/sys/kern/tty.c Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/kern/tty.c Sun Sep 5 14:27:55 2010 (r212229) @@ -1777,7 +1777,7 @@ ttyhook_register(struct tty **rtp, struc struct cdev *dev; struct cdevsw *cdp; struct filedesc *fdp; - int error; + int error, ref; /* Validate the file descriptor. */ if ((fdp = p->p_fd) == NULL) @@ -1803,7 +1803,7 @@ ttyhook_register(struct tty **rtp, struc } /* Make sure it is a TTY. */ - cdp = devvn_refthread(fp->f_vnode, &dev); + cdp = devvn_refthread(fp->f_vnode, &dev, &ref); if (cdp == NULL) { error = ENXIO; goto done1; @@ -1839,7 +1839,7 @@ ttyhook_register(struct tty **rtp, struc th->th_rint = ttyhook_defrint; done3: tty_unlock(tp); -done2: dev_relthread(dev); +done2: dev_relthread(dev, ref); done1: fdrop(fp, curthread); return (error); } Modified: stable/8/sys/kern/vfs_bio.c ============================================================================== --- stable/8/sys/kern/vfs_bio.c Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/kern/vfs_bio.c Sun Sep 5 14:27:55 2010 (r212229) @@ -3195,6 +3195,7 @@ dev_strategy(struct cdev *dev, struct bu { struct cdevsw *csw; struct bio *bip; + int ref; if ((!bp->b_iocmd) || (bp->b_iocmd & (bp->b_iocmd - 1))) panic("b_iocmd botch"); @@ -3216,7 +3217,7 @@ dev_strategy(struct cdev *dev, struct bu KASSERT(dev->si_refcount > 0, ("dev_strategy on un-referenced struct cdev *(%s)", devtoname(dev))); - csw = dev_refthread(dev); + csw = dev_refthread(dev, &ref); if (csw == NULL) { g_destroy_bio(bip); bp->b_error = ENXIO; @@ -3225,7 +3226,7 @@ dev_strategy(struct cdev *dev, struct bu return; } (*csw->d_strategy)(bip); - dev_relthread(dev); + dev_relthread(dev, ref); } /* Modified: stable/8/sys/sys/conf.h ============================================================================== --- stable/8/sys/sys/conf.h Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/sys/conf.h Sun Sep 5 14:27:55 2010 (r212229) @@ -54,6 +54,7 @@ struct file; struct cdev { void *__si_reserved; u_int si_flags; +#define SI_ETERNAL 0x0001 /* never destroyed */ #define SI_ALIAS 0x0002 /* carrier of alias name */ #define SI_NAMED 0x0004 /* make_dev{_alias} has been called */ #define SI_CHEAPCLONE 0x0008 /* can be removed_dev'ed when vnode reclaims */ @@ -258,9 +259,9 @@ int destroy_dev_sched(struct cdev *dev); int destroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg); void destroy_dev_drain(struct cdevsw *csw); void drain_dev_clone_events(void); -struct cdevsw *dev_refthread(struct cdev *_dev); -struct cdevsw *devvn_refthread(struct vnode *vp, struct cdev **devp); -void dev_relthread(struct cdev *_dev); +struct cdevsw *dev_refthread(struct cdev *_dev, int *_ref); +struct cdevsw *devvn_refthread(struct vnode *vp, struct cdev **devp, int *_ref); +void dev_relthread(struct cdev *_dev, int _ref); void dev_depends(struct cdev *_pdev, struct cdev *_cdev); void dev_ref(struct cdev *dev); void dev_refl(struct cdev *dev); @@ -271,10 +272,11 @@ 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_NOWAIT 0x4 -#define MAKEDEV_WAITOK 0x8 +#define MAKEDEV_REF 0x01 +#define MAKEDEV_WHTOUT 0x02 +#define MAKEDEV_NOWAIT 0x04 +#define MAKEDEV_WAITOK 0x08 +#define MAKEDEV_ETERNAL 0x10 struct cdev *make_dev_credf(int _flags, struct cdevsw *_devsw, int _unit, struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode, @@ -288,6 +290,12 @@ void dev_lock(void); void dev_unlock(void); void setconf(void); +#ifdef KLD_MODULE +#define MAKEDEV_ETERNAL_KLD 0 +#else +#define MAKEDEV_ETERNAL_KLD MAKEDEV_ETERNAL +#endif + #define dev2unit(d) ((d)->si_drv0) typedef void (*cdevpriv_dtr_t)(void *data); Modified: stable/8/sys/sys/vnode.h ============================================================================== --- stable/8/sys/sys/vnode.h Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/sys/vnode.h Sun Sep 5 14:27:55 2010 (r212229) @@ -243,6 +243,7 @@ struct xvnode { #define VV_ROOT 0x0001 /* root of its filesystem */ #define VV_ISTTY 0x0002 /* vnode represents a tty */ #define VV_NOSYNC 0x0004 /* unlinked, stop syncing */ +#define VV_ETERNALDEV 0x0008 /* device that is never destroyed */ #define VV_CACHEDLABEL 0x0010 /* Vnode has valid cached MAC label */ #define VV_TEXT 0x0020 /* vnode is a pure text prototype */ #define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */ Modified: stable/8/sys/vm/device_pager.c ============================================================================== --- stable/8/sys/vm/device_pager.c Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/vm/device_pager.c Sun Sep 5 14:27:55 2010 (r212229) @@ -119,6 +119,7 @@ dev_pager_alloc(void *handle, vm_ooffset vm_offset_t off; vm_memattr_t dummy; struct cdevsw *csw; + int ref; /* * Offset should be page aligned. @@ -133,7 +134,7 @@ dev_pager_alloc(void *handle, vm_ooffset * Make sure this device can be mapped. */ dev = handle; - csw = dev_refthread(dev); + csw = dev_refthread(dev, &ref); if (csw == NULL) return (NULL); @@ -146,7 +147,7 @@ dev_pager_alloc(void *handle, vm_ooffset npages = OFF_TO_IDX(size); for (off = foff; npages--; off += PAGE_SIZE) if (dev_mmap(csw, dev, off, &paddr, (int)prot, &dummy) != 0) { - dev_relthread(dev); + dev_relthread(dev, ref); return (NULL); } @@ -188,7 +189,7 @@ dev_pager_alloc(void *handle, vm_ooffset object->size = pindex; } mtx_unlock(&dev_pager_mtx); - dev_relthread(dev); + dev_relthread(dev, ref); vm_object_deallocate(object1); return (object); } @@ -225,7 +226,7 @@ dev_pager_getpages(object, m, count, req vm_page_t m_paddr, page; vm_memattr_t memattr; struct cdev *dev; - int i, ret; + int i, ref, ret; struct cdevsw *csw; struct thread *td; struct file *fpop; @@ -236,7 +237,7 @@ dev_pager_getpages(object, m, count, req offset = page->pindex; memattr = object->memattr; VM_OBJECT_UNLOCK(object); - csw = dev_refthread(dev); + csw = dev_refthread(dev, &ref); if (csw == NULL) panic("dev_pager_getpage: no cdevsw"); td = curthread; @@ -246,7 +247,7 @@ dev_pager_getpages(object, m, count, req PROT_READ, &memattr); KASSERT(ret == 0, ("dev_pager_getpage: map function returns error")); td->td_fpop = fpop; - dev_relthread(dev); + dev_relthread(dev, ref); /* If "paddr" is a real page, perform a sanity check on "memattr". */ if ((m_paddr = vm_phys_paddr_to_vm_page(paddr)) != NULL && pmap_page_get_memattr(m_paddr) != memattr) { Modified: stable/8/sys/vm/vm_mmap.c ============================================================================== --- stable/8/sys/vm/vm_mmap.c Sun Sep 5 14:20:34 2010 (r212228) +++ stable/8/sys/vm/vm_mmap.c Sun Sep 5 14:27:55 2010 (r212229) @@ -1243,15 +1243,15 @@ vm_mmap_cdev(struct thread *td, vm_size_ { vm_object_t obj; struct cdevsw *dsw; - int error, flags; + int error, flags, ref; flags = *flagsp; - dsw = dev_refthread(cdev); + dsw = dev_refthread(cdev, &ref); if (dsw == NULL) return (ENXIO); if (dsw->d_flags & D_MMAP_ANON) { - dev_relthread(cdev); + dev_relthread(cdev, ref); *maxprotp = VM_PROT_ALL; *flagsp |= MAP_ANON; return (0); @@ -1261,11 +1261,11 @@ vm_mmap_cdev(struct thread *td, vm_size_ */ if ((*maxprotp & VM_PROT_WRITE) == 0 && (prot & PROT_WRITE) != 0) { - dev_relthread(cdev); + dev_relthread(cdev, ref); return (EACCES); } if (flags & (MAP_PRIVATE|MAP_COPY)) { - dev_relthread(cdev); + dev_relthread(cdev, ref); return (EINVAL); } /* @@ -1275,7 +1275,7 @@ vm_mmap_cdev(struct thread *td, vm_size_ #ifdef MAC_XXX error = mac_cdev_check_mmap(td->td_ucred, cdev, prot); if (error != 0) { - dev_relthread(cdev); + dev_relthread(cdev, ref); return (error); } #endif @@ -1289,7 +1289,7 @@ vm_mmap_cdev(struct thread *td, vm_size_ * XXX assumes VM_PROT_* == PROT_* */ error = dsw->d_mmap_single(cdev, foff, objsize, objp, (int)prot); - dev_relthread(cdev); + dev_relthread(cdev, ref); if (error != ENODEV) return (error); obj = vm_pager_allocate(OBJT_DEVICE, cdev, objsize, prot, *foff, From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:31:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 628F81065697; Sun, 5 Sep 2010 14:31:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 372EC8FC15; Sun, 5 Sep 2010 14:31: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 o85EVxDa083740; Sun, 5 Sep 2010 14:31:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85EVxNY083738; Sun, 5 Sep 2010 14:31:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051431.o85EVxNY083738@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212230 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:31:59 -0000 Author: kib Date: Sun Sep 5 14:31:58 2010 New Revision: 212230 URL: http://svn.freebsd.org/changeset/base/212230 Log: MFC r210924: Add "show cdev" ddb command. Modified: stable/8/sys/kern/kern_conf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_conf.c ============================================================================== --- stable/8/sys/kern/kern_conf.c Sun Sep 5 14:27:55 2010 (r212229) +++ stable/8/sys/kern/kern_conf.c Sun Sep 5 14:31:58 2010 (r212230) @@ -1235,3 +1235,71 @@ devdtr_init(void *dummy __unused) } SYSINIT(devdtr, SI_SUB_DEVFS, SI_ORDER_SECOND, devdtr_init, NULL); + +#include "opt_ddb.h" +#ifdef DDB +#include + +#include + +DB_SHOW_COMMAND(cdev, db_show_cdev) +{ + struct cdev_priv *cdp; + struct cdev *dev; + u_int flags; + char buf[512]; + + if (!have_addr) { + TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) { + dev = &cdp->cdp_c; + db_printf("%s %p\n", dev->si_name, dev); + if (db_pager_quit) + break; + } + return; + } + + dev = (struct cdev *)addr; + cdp = cdev2priv(dev); + db_printf("dev %s ref %d use %ld thr %ld inuse %u fdpriv %p\n", + dev->si_name, dev->si_refcount, dev->si_usecount, + dev->si_threadcount, cdp->cdp_inuse, cdp->cdp_fdpriv.lh_first); + db_printf("devsw %p si_drv0 %d si_drv1 %p si_drv2 %p\n", + dev->si_devsw, dev->si_drv0, dev->si_drv1, dev->si_drv2); + flags = dev->si_flags; +#define SI_FLAG(flag) do { \ + if (flags & (flag)) { \ + if (buf[0] != '\0') \ + strlcat(buf, ", ", sizeof(buf)); \ + strlcat(buf, (#flag) + 3, sizeof(buf)); \ + flags &= ~(flag); \ + } \ +} while (0) + buf[0] = '\0'; + SI_FLAG(SI_ETERNAL); + SI_FLAG(SI_ALIAS); + SI_FLAG(SI_NAMED); + SI_FLAG(SI_CHEAPCLONE); + SI_FLAG(SI_CHILD); + SI_FLAG(SI_DEVOPEN); + SI_FLAG(SI_CONSOPEN); + SI_FLAG(SI_DUMPDEV); + SI_FLAG(SI_CANDELETE); + SI_FLAG(SI_CLONELIST); + db_printf("si_flags %s\n", buf); + + flags = cdp->cdp_flags; +#define CDP_FLAG(flag) do { \ + if (flags & (flag)) { \ + if (buf[0] != '\0') \ + strlcat(buf, ", ", sizeof(buf)); \ + strlcat(buf, (#flag) + 4, sizeof(buf)); \ + flags &= ~(flag); \ + } \ +} while (0) + buf[0] = '\0'; + CDP_FLAG(CDP_ACTIVE); + CDP_FLAG(CDP_SCHED_DTR); + db_printf("cdp_flags %s\n", buf); +} +#endif From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:35:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C65010656D9; Sun, 5 Sep 2010 14:35:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B4CE8FC1A; Sun, 5 Sep 2010 14:35: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 o85EZRwl083950; Sun, 5 Sep 2010 14:35:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85EZRRg083948; Sun, 5 Sep 2010 14:35:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051435.o85EZRRg083948@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212231 - stable/8/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:35:27 -0000 Author: kib Date: Sun Sep 5 14:35:26 2010 New Revision: 212231 URL: http://svn.freebsd.org/changeset/base/212231 Log: MFC r210925: Enable shared lookups and externed shared ops for devfs. Modified: stable/8/sys/fs/devfs/devfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vfsops.c Sun Sep 5 14:31:58 2010 (r212230) +++ stable/8/sys/fs/devfs/devfs_vfsops.c Sun Sep 5 14:35:26 2010 (r212231) @@ -81,7 +81,8 @@ devfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_MPSAFE; + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | + MNTK_EXTENDED_SHARED; #ifdef MAC mp->mnt_flag |= MNT_MULTILABEL; #endif From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:37:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82EAF10656CC; Sun, 5 Sep 2010 14:37:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71FC08FC19; Sun, 5 Sep 2010 14:37:29 +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 o85EbTWT084091; Sun, 5 Sep 2010 14:37:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85EbTut084089; Sun, 5 Sep 2010 14:37:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051437.o85EbTut084089@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:37:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212232 - stable/8/sys/dev/null X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:37:29 -0000 Author: kib Date: Sun Sep 5 14:37:29 2010 New Revision: 212232 URL: http://svn.freebsd.org/changeset/base/212232 Log: MFC r210926: Mark /dev/zero and /dev/null as eternal. Modified: stable/8/sys/dev/null/null.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/null/null.c ============================================================================== --- stable/8/sys/dev/null/null.c Sun Sep 5 14:35:26 2010 (r212231) +++ stable/8/sys/dev/null/null.c Sun Sep 5 14:37:29 2010 (r212232) @@ -112,10 +112,10 @@ null_modevent(module_t mod __unused, int if (bootverbose) printf("null: \n"); zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - null_dev = make_dev(&null_cdevsw, 0, UID_ROOT, GID_WHEEL, - 0666, "null"); - zero_dev = make_dev(&zero_cdevsw, 0, UID_ROOT, GID_WHEEL, - 0666, "zero"); + null_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &null_cdevsw, 0, + NULL, UID_ROOT, GID_WHEEL, 0666, "null"); + zero_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &zero_cdevsw, 0, + NULL, UID_ROOT, GID_WHEEL, 0666, "zero"); break; case MOD_UNLOAD: From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:47:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FF3010656CA; Sun, 5 Sep 2010 14:47:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F76F8FC17; Sun, 5 Sep 2010 14:47: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 o85ElkiF084801; Sun, 5 Sep 2010 14:47:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85ElkEh084799; Sun, 5 Sep 2010 14:47:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051447.o85ElkEh084799@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:47: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: r212233 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:47:46 -0000 Author: kib Date: Sun Sep 5 14:47:46 2010 New Revision: 212233 URL: http://svn.freebsd.org/changeset/base/212233 Log: Document MAKEDEV_ETERNAL. MFC after: 3 days Modified: head/share/man/man9/make_dev.9 Modified: head/share/man/man9/make_dev.9 ============================================================================== --- head/share/man/man9/make_dev.9 Sun Sep 5 14:37:29 2010 (r212232) +++ head/share/man/man9/make_dev.9 Sun Sep 5 14:47:46 2010 (r212233) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 6, 2010 +.Dd September 5, 2010 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -135,6 +135,7 @@ The following values are currently accep MAKEDEV_REF reference the created device MAKEDEV_NOWAIT do not sleep, may return NULL MAKEDEV_WAITOK allow the function to sleep to satisfy malloc +MAKEDEV_ETERNAL created device will be never destroyed .Ed .Pp The @@ -154,6 +155,18 @@ the device created is destroyed immediat drops his reference to cdev. .Pp The +.Dv MAKEDEV_ETERNAL +flag allows the kernel to not acquire some locks when translating system +calls into the cdevsw methods calls. +It is responsibility of the driver author to make sure that +.Fn destroy_dev +is never called on the returned cdev. +For the convenience, use the +.Dv MAKEDEV_ETERNAL_KLD +flag for the code that can be compiled into kernel or loaded +(and unloaded) as loadable module. +.Pp +The .Fn make_dev_cred function is equivalent to the call .Bd -literal -offset indent From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 14:52:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1970F1065697; Sun, 5 Sep 2010 14:52:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0907C8FC0A; Sun, 5 Sep 2010 14:52: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 o85EqR81085009; Sun, 5 Sep 2010 14:52:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85EqRTl085007; Sun, 5 Sep 2010 14:52:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009051452.o85EqRTl085007@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 5 Sep 2010 14:52: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: r212234 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 14:52:28 -0000 Author: kib Date: Sun Sep 5 14:52:27 2010 New Revision: 212234 URL: http://svn.freebsd.org/changeset/base/212234 Log: Document "show cdev" command. MFC after: 3 days Modified: head/share/man/man4/ddb.4 Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Sun Sep 5 14:47:46 2010 (r212233) +++ head/share/man/man4/ddb.4 Sun Sep 5 14:52:27 2010 (r212234) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2010 +.Dd September 5, 2010 .Dt DDB 4 .Os .Sh NAME @@ -589,6 +589,12 @@ header file. Show brief information about the TTY subsystem. .\" .Pp +.It Ic show Cm cdev +Without argument, show the list of all created cdev's, consisting of devfs +node name and struct cdev address. +When address of cdev is supplied, show some internal devfs state of the cdev. +.\" +.Pp .It Ic show Cm conifhk Lists hooks currently waiting for completion in run_interrupt_driven_config_hooks(). From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 16:12:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C31F10656D0; Sun, 5 Sep 2010 16:12:11 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E535A8FC16; Sun, 5 Sep 2010 16:12: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 o85GCAsO088454; Sun, 5 Sep 2010 16:12:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85GCAgn088451; Sun, 5 Sep 2010 16:12:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009051612.o85GCAgn088451@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 5 Sep 2010 16:12: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: r212235 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 16:12:11 -0000 Author: jilles Date: Sun Sep 5 16:12:10 2010 New Revision: 212235 URL: http://svn.freebsd.org/changeset/base/212235 Log: libedit: Try to map to ed-delete-next-char. This adds a new "arrow" key "delete" corresponding to the kD termcap value. It only works if that is a sequence such as "\033[3~"; if it is "\177", the em-delete-prev-char or ed-delete-prev-char from the single-character mappings remains. It turns out that most terminals (xterm and alikes, syscons in xterm mode) produce "\033[3~" by default so has the expected effect. This also means that things need to be considerably misconfigured for to perform a action. Modified: head/lib/libedit/term.c head/lib/libedit/term.h Modified: head/lib/libedit/term.c ============================================================================== --- head/lib/libedit/term.c Sun Sep 5 14:52:27 2010 (r212234) +++ head/lib/libedit/term.c Sun Sep 5 16:12:10 2010 (r212235) @@ -223,7 +223,9 @@ private const struct termcapstr { { "kh", "send cursor home" }, #define T_at7 37 { "@7", "send cursor end" }, -#define T_str 38 +#define T_kD 38 + { "kD", "send cursor delete" }, +#define T_str 39 { NULL, NULL } }; @@ -1062,6 +1064,11 @@ term_init_arrow(EditLine *el) arrow[A_K_EN].key = T_at7; arrow[A_K_EN].fun.cmd = ED_MOVE_TO_END; arrow[A_K_EN].type = XK_CMD; + + arrow[A_K_DE].name = "delete"; + arrow[A_K_DE].key = T_kD; + arrow[A_K_DE].fun.cmd = ED_DELETE_NEXT_CHAR; + arrow[A_K_DE].type = XK_CMD; } Modified: head/lib/libedit/term.h ============================================================================== --- head/lib/libedit/term.h Sun Sep 5 14:52:27 2010 (r212234) +++ head/lib/libedit/term.h Sun Sep 5 16:12:10 2010 (r212235) @@ -79,7 +79,8 @@ typedef struct { #define A_K_RT 3 #define A_K_HO 4 #define A_K_EN 5 -#define A_K_NKEYS 6 +#define A_K_DE 6 +#define A_K_NKEYS 7 protected void term_move_to_line(EditLine *, int); protected void term_move_to_char(EditLine *, int); From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 16:14:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8922410656B6; Sun, 5 Sep 2010 16:14:26 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id DFBC08FC1F; Sun, 5 Sep 2010 16:14:25 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEAB9fg0yDaFvO/2dsb2JhbACDGJ5xqBGQeIEigyd0BIoY X-IronPort-AV: E=Sophos;i="4.56,321,1280721600"; d="scan'208";a="92881407" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 05 Sep 2010 12:14:24 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id D3B29B3F20; Sun, 5 Sep 2010 12:14:24 -0400 (EDT) Date: Sun, 5 Sep 2010 12:14:24 -0400 (EDT) From: Rick Macklem To: John Baldwin Message-ID: <1589618736.502674.1283703264801.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <201009050846.14288.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [24.65.230.102] X-Mailer: Zimbra 6.0.7_GA_2476.RHEL4 (ZimbraWebClient - SAF3 (Mac)/6.0.7_GA_2473.RHEL4_64) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, dfr@freebsd.org Subject: Re: svn commit: r212216 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 16:14:26 -0000 > On Saturday 04 September 2010 08:10:18 pm Rick Macklem wrote: > > Author: rmacklem > > Date: Sun Sep 5 00:10:18 2010 > > New Revision: 212216 > > URL: http://svn.freebsd.org/changeset/base/212216 > > > > Log: > > Disable use of the NLM in the experimental NFS client, since > > it will crash the kernel because it uses the nfsmount and > > nfsnode structures of the regular NFS client. > > Hmm, perhaps we could provide new VFS and/or VOP methods for NLM to > use > instead of reaching inside of those structures directly? I think we > really > want to support NLM on the new NFS client as many folks want working > NFS > locking. > Actually, passing the extra information in would just be a matter of adding extra arguments to nlm_advlock(), which is always called by the nfs clients and never as a VOP_ADVLOCK() call. This would be slightly ugly, but not that messy and doesn't require VOP changes. Where it gets ugly is that nlm_advlock() saves "struct nfsmount *nmp" in a structure called "struct nlm_feedback_arg nf" and uses that later to fiddle with fields in *nmp in nlm_down() and nlm_up() called from nlm_feedback(), which is called asynchronously from the krpc layer. (This does need to be fixed someday, since it is badly broken for forced dismounts.) If you look at nlm_down() and nlm_up(), it uses the *nmp to avoid doing a vfs_event_signal() call multiple times for a mount point. Since I don't understand what vfs_event_signal(fsid, VQ_NOTRESPLOCK, 0); actually does, I don't know if multiple calls would be a serious problem? I suppose I could add a global/malloc'd list of structures to nlm_advlock() { one for each *nmp } to keep this flag, but then I'm not sure I'd know when to get rid of elements in the list (because I wouldn't know when a mount point is dismounted?). I looked at this some time ago, when kib@ was trying to fix forced dismounts, but never got it fixed then. If this ugly bit is fixed, I think adding extra args to nlm_advlock() would make it work for both clients concurrently. If anyone can help with the ugly part, please pass along any suggestions. Thanks, rick ps: and I don't want to "own" the nlm:-) From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 18:47:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5669F10656D1; Sun, 5 Sep 2010 18:47:05 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 458D88FC0A; Sun, 5 Sep 2010 18:47: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 o85Il5hS095026; Sun, 5 Sep 2010 18:47:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85Il5UE095023; Sun, 5 Sep 2010 18:47:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009051847.o85Il5UE095023@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 5 Sep 2010 18:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212236 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 18:47:05 -0000 Author: nwhitehorn Date: Sun Sep 5 18:47:04 2010 New Revision: 212236 URL: http://svn.freebsd.org/changeset/base/212236 Log: Please welcome Andreas Tobler (andreast@) to the ranks of the src committers. He will be working mostly on the PowerPC port under my mentorship. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Sun Sep 5 16:12:10 2010 (r212235) +++ svnadmin/conf/access Sun Sep 5 18:47:04 2010 (r212236) @@ -25,6 +25,7 @@ alfred ambrisko anchie andre +andreast andrew antoine ariff Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Sun Sep 5 16:12:10 2010 (r212235) +++ svnadmin/conf/mentors Sun Sep 5 18:47:04 2010 (r212236) @@ -12,6 +12,7 @@ # Mentee Mentor Optional comment ae mav Co-mentor: kib anchie bz +andreast nwhitehorn andrew imp brucec rrs dchagin kib From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 19:24:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E13D410656D9; Sun, 5 Sep 2010 19:24:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFE678FC0A; Sun, 5 Sep 2010 19:24: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 o85JOWwU096146; Sun, 5 Sep 2010 19:24:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85JOWWO096144; Sun, 5 Sep 2010 19:24:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009051924.o85JOWWO096144@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Sep 2010 19:24: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: r212238 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 19:24:33 -0000 Author: mav Date: Sun Sep 5 19:24:32 2010 New Revision: 212238 URL: http://svn.freebsd.org/changeset/base/212238 Log: Several improvements to HPET driver: - Add special check for case when time expires before being programmed. This fixes interrupt loss and respectively timer death on attempt to program very short interval. Increase minimal supported period to more realistic value. - Add support for hint.hpet.X.allowed_irqs tunable, allowing manually specify which interrupts driver allowed to use. Unluckily, many BIOSes program wrong allowed interrupts mask, so driver tries to stay on safe side by not using unshareable ISA IRQs. This option gives control over this limitation, allowing more per-CPU timers to be provided, when FSB interrupts are not supported. Value of this tunable is bitmask. - Do not use regular interrupts on virtual machines. QEMU and VirtualBox do not support them properly, that may cause problems. Stay safe by default. Same time both QEMU and VirtualBox work fine in legacy_route mode. VirtualBox also works fine if manually specify allowed ISA IRQs with above. Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Sun Sep 5 18:56:24 2010 (r212237) +++ head/sys/dev/acpica/acpi_hpet.c Sun Sep 5 19:24:32 2010 (r212238) @@ -74,6 +74,7 @@ struct hpet_softc { int irq; int useirq; int legacy_route; + uint32_t allowed_irqs; struct resource *mem_res; struct resource *intr_res; void *intr_handle; @@ -146,7 +147,7 @@ hpet_start(struct eventtimer *et, struct hpet_timer *mt = (struct hpet_timer *)et->et_priv; struct hpet_timer *t; struct hpet_softc *sc = mt->sc; - uint32_t fdiv; + uint32_t fdiv, cmp; t = (mt->pcpu_master < 0) ? mt : &sc->t[mt->pcpu_slaves[curcpu]]; if (period != NULL) { @@ -164,23 +165,31 @@ hpet_start(struct eventtimer *et, fdiv += sc->freq * first->sec; } else fdiv = t->div; + if (t->irq < 0) + bus_write_4(sc->mem_res, HPET_ISR, 1 << t->num); + t->caps |= HPET_TCNF_INT_ENB; t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); +restart: + cmp = t->last + fdiv; if (t->mode == 1 && (t->caps & HPET_TCAP_PER_INT)) { t->caps |= HPET_TCNF_TYPE; bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(t->num), t->caps | HPET_TCNF_VAL_SET); - bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), - t->last + fdiv); - bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); - bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), - t->div); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), cmp); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), t->div); } else { - bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), - t->last + fdiv); + t->caps &= ~HPET_TCNF_TYPE; + bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(t->num), t->caps); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), cmp); + } + if (fdiv < 5000) { + bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); + t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); + if ((int32_t)(t->last - cmp) < 0) { + fdiv *= 2; + goto restart; + } } - t->caps |= HPET_TCNF_INT_ENB; - bus_write_4(sc->mem_res, HPET_ISR, 1 << t->num); - bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(t->num), t->caps); return (0); } @@ -321,7 +330,7 @@ hpet_attach(device_t dev) int i, j, num_msi, num_timers, num_percpu_et, num_percpu_t, cur_cpu; int pcpu_master; static int maxhpetet = 0; - uint32_t val, val2, cvectors; + uint32_t val, val2, cvectors, dvectors; uint16_t vendor, rev; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -438,10 +447,9 @@ hpet_attach(device_t dev) sc->t[1].vectors = 0; } - num_msi = 0; - sc->useirq = 0; - /* Find common legacy IRQ vectors for all timers. */ - cvectors = 0xffff0000; + /* Check what IRQs we want use. */ + /* By default allow any PCI IRQs. */ + sc->allowed_irqs = 0xffff0000; /* * HPETs in AMD chipsets before SB800 have problems with IRQs >= 16 * Lower are also not always working for different reasons. @@ -450,7 +458,25 @@ hpet_attach(device_t dev) * interrupt loss. Avoid legacy IRQs for AMD. */ if (vendor == HPET_VENDID_AMD) - cvectors = 0x00000000; + sc->allowed_irqs = 0x00000000; + /* + * Neither QEMU nor VirtualBox report supported IRQs correctly. + * The only way to use HPET there is to specify IRQs manually + * and/or use legacy_route. Legacy_route mode work on both. + */ + if (vm_guest) + sc->allowed_irqs = 0x00000000; + /* Let user override. */ + resource_int_value(device_get_name(dev), device_get_unit(dev), + "allowed_irqs", &sc->allowed_irqs); + + num_msi = 0; + sc->useirq = 0; + /* Find IRQ vectors for all timers. */ + cvectors = sc->allowed_irqs & 0xffff0000; + dvectors = sc->allowed_irqs & 0x0000ffff; + if (sc->legacy_route) + dvectors &= 0x0000fefe; for (i = 0; i < num_timers; i++) { t = &sc->t[i]; if (sc->legacy_route && i < 2) @@ -465,6 +491,10 @@ hpet_attach(device_t dev) } } #endif + else if (dvectors & t->vectors) { + t->irq = ffs(dvectors & t->vectors) - 1; + dvectors &= ~(1 << t->irq); + } if (t->irq >= 0) { if (!(t->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, &t->intr_rid, @@ -495,7 +525,7 @@ hpet_attach(device_t dev) if (sc->legacy_route) hpet_enable(sc); /* Group timers for per-CPU operation. */ - num_percpu_et = min(num_msi / mp_ncpus, 2); + num_percpu_et = min(num_msi / mp_ncpus, 1); num_percpu_t = num_percpu_et * mp_ncpus; pcpu_master = 0; cur_cpu = CPU_FIRST(); @@ -510,7 +540,8 @@ hpet_attach(device_t dev) bus_bind_intr(dev, t->intr_res, cur_cpu); cur_cpu = CPU_NEXT(cur_cpu); num_percpu_t--; - } + } else if (t->irq >= 0) + bus_bind_intr(dev, t->intr_res, CPU_FIRST()); } bus_write_4(sc->mem_res, HPET_ISR, 0xffffffff); sc->irq = -1; @@ -545,7 +576,7 @@ hpet_attach(device_t dev) /* Legacy route doesn't need more configuration. */ } else #ifdef DEV_APIC - if (t->irq >= 0) { + if ((t->caps & HPET_TCAP_FSB_INT_DEL) && t->irq >= 0) { uint64_t addr; uint32_t data; @@ -561,7 +592,9 @@ hpet_attach(device_t dev) t->irq = -2; } else #endif - if (sc->irq >= 0 && (t->vectors & (1 << sc->irq))) + if (t->irq >= 0) + t->caps |= (t->irq << 9); + else if (sc->irq >= 0 && (t->vectors & (1 << sc->irq))) t->caps |= (sc->irq << 9) | HPET_TCNF_INT_TYPE; bus_write_4(sc->mem_res, HPET_TIMER_CAP_CNF(i), t->caps); /* Skip event timers without set up IRQ. */ @@ -585,7 +618,7 @@ hpet_attach(device_t dev) t->et.et_quality -= 10; t->et.et_frequency = sc->freq; t->et.et_min_period.sec = 0; - t->et.et_min_period.frac = 0x00004000LLU << 32; + t->et.et_min_period.frac = 0x00008000LLU << 32; t->et.et_max_period.sec = 0xfffffffeLLU / sc->freq; t->et.et_max_period.frac = ((0xfffffffeLLU << 32) / sc->freq) << 32; From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 19:57:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11F351065694; Sun, 5 Sep 2010 19:57:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01C798FC17; Sun, 5 Sep 2010 19:57: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 o85JvO2b097055; Sun, 5 Sep 2010 19:57:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85JvOvA097053; Sun, 5 Sep 2010 19:57:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009051957.o85JvOvA097053@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Sep 2010 19:57: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: r212239 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 19:57:25 -0000 Author: mav Date: Sun Sep 5 19:57:24 2010 New Revision: 212239 URL: http://svn.freebsd.org/changeset/base/212239 Log: Make nexus report name and compat fields as pnpinfo for devices on the first level of hierarchy, same as done on deeper levels. Modified: head/sys/powerpc/aim/nexus.c Modified: head/sys/powerpc/aim/nexus.c ============================================================================== --- head/sys/powerpc/aim/nexus.c Sun Sep 5 19:24:32 2010 (r212238) +++ head/sys/powerpc/aim/nexus.c Sun Sep 5 19:57:24 2010 (r212239) @@ -63,6 +63,7 @@ #include #include +#include #include #include @@ -162,6 +163,7 @@ static device_method_t nexus_methods[] = /* Bus interface. Resource management is business of the children... */ DEVMETHOD(bus_add_child, nexus_add_child), DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), DEVMETHOD(bus_probe_nomatch, nexus_probe_nomatch), DEVMETHOD(bus_read_ivar, nexus_read_ivar), DEVMETHOD(bus_write_ivar, nexus_write_ivar), From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 20:04:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAF2610656B0; Sun, 5 Sep 2010 20:04:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B97DF8FC17; Sun, 5 Sep 2010 20:04: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 o85K42e4097268; Sun, 5 Sep 2010 20:04:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85K429X097264; Sun, 5 Sep 2010 20:04:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009052004.o85K429X097264@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Sep 2010 20:04: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: r212240 - in head: share/man/man4/man4.powerpc sys/dev/powermac_nvram X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 20:04:02 -0000 Author: mav Date: Sun Sep 5 20:04:02 2010 New Revision: 212240 URL: http://svn.freebsd.org/changeset/base/212240 Log: Add support for the Sharp/Micron flash chips to powermac_mvram(4). Tested on PowerMac G4 AGP. Reviewed by: nwhitehorn Modified: head/share/man/man4/man4.powerpc/powermac_nvram.4 head/sys/dev/powermac_nvram/powermac_nvram.c head/sys/dev/powermac_nvram/powermac_nvramvar.h Modified: head/share/man/man4/man4.powerpc/powermac_nvram.4 ============================================================================== --- head/share/man/man4/man4.powerpc/powermac_nvram.4 Sun Sep 5 19:57:24 2010 (r212239) +++ head/share/man/man4/man4.powerpc/powermac_nvram.4 Sun Sep 5 20:04:02 2010 (r212240) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2006 +.Dd September 5, 2010 .Dt POWERMAC_NVRAM 4 powerpc .Os .Sh NAME @@ -63,8 +63,3 @@ The .Nm driver was written by .An Maxim Sobolev Aq sobomax@FreeBSD.org . -.Sh BUGS -Currently, the -.Nm -driver only supports systems equipped with an AMD flash part and is only -tested on Apple G4-based Mac Mini machines. Modified: head/sys/dev/powermac_nvram/powermac_nvram.c ============================================================================== --- head/sys/dev/powermac_nvram/powermac_nvram.c Sun Sep 5 19:57:24 2010 (r212239) +++ head/sys/dev/powermac_nvram/powermac_nvram.c Sun Sep 5 20:04:02 2010 (r212240) @@ -115,7 +115,10 @@ powermac_nvram_probe(device_t dev) if (type == NULL || compatible == NULL) return ENXIO; - if (strcmp(type, "nvram") != 0 || strcmp(compatible, "amd-0137") != 0) + if (strcmp(type, "nvram") != 0) + return ENXIO; + if (strcmp(compatible, "amd-0137") != 0 && + strcmp(compatible, "nvram,flash") != 0) return ENXIO; device_set_desc(dev, "Apple NVRAM"); @@ -126,6 +129,7 @@ static int powermac_nvram_attach(device_t dev) { struct powermac_nvram_softc *sc; + const char *compatible; phandle_t node; u_int32_t reg[3]; int gen0, gen1, i; @@ -139,6 +143,12 @@ powermac_nvram_attach(device_t dev) sc->sc_dev = dev; sc->sc_node = node; + compatible = ofw_bus_get_compat(dev); + if (strcmp(compatible, "amd-0137") == 0) + sc->sc_type = FLASH_TYPE_AMD; + else + sc->sc_type = FLASH_TYPE_SM; + /* * Find which byte of reg corresponds to the 32-bit physical address. * We should probably read #address-cells from /chosen instead. @@ -342,7 +352,7 @@ adler_checksum(uint8_t *data, int len) #define OUTB_DELAY(a, v) outb(a, v); DELAY(1); static int -wait_operation_complete(uint8_t *bank) +wait_operation_complete_amd(uint8_t *bank) { int i; @@ -353,7 +363,7 @@ wait_operation_complete(uint8_t *bank) } static int -erase_bank(device_t dev, uint8_t *bank) +erase_bank_amd(device_t dev, uint8_t *bank) { unsigned int i; @@ -368,7 +378,7 @@ erase_bank(device_t dev, uint8_t *bank) OUTB_DELAY(bank + 0x2aa, 0x55); OUTB_DELAY(bank, 0x30); - if (wait_operation_complete(bank) != 0) { + if (wait_operation_complete_amd(bank) != 0) { device_printf(dev, "flash erase timeout\n"); return -1; } @@ -386,7 +396,7 @@ erase_bank(device_t dev, uint8_t *bank) } static int -write_bank(device_t dev, uint8_t *bank, uint8_t *data) +write_bank_amd(device_t dev, uint8_t *bank, uint8_t *data) { unsigned int i; @@ -399,7 +409,7 @@ write_bank(device_t dev, uint8_t *bank, /* Write single word */ OUTB_DELAY(bank + 0x555, 0xa0); OUTB_DELAY(bank + i, data[i]); - if (wait_operation_complete(bank) != 0) { + if (wait_operation_complete_amd(bank) != 0) { device_printf(dev, "flash write timeout\n"); return -1; } @@ -416,3 +426,91 @@ write_bank(device_t dev, uint8_t *bank, } return 0; } + +static int +wait_operation_complete_sm(uint8_t *bank) +{ + int i; + + for (i = 1000000; i != 0; i--) { + outb(bank, SM_FLASH_CMD_READ_STATUS); + if (inb(bank) & SM_FLASH_STATUS_DONE) + return (0); + } + return (-1); +} + +static int +erase_bank_sm(device_t dev, uint8_t *bank) +{ + unsigned int i; + + outb(bank, SM_FLASH_CMD_ERASE_SETUP); + outb(bank, SM_FLASH_CMD_ERASE_CONFIRM); + + if (wait_operation_complete_sm(bank) != 0) { + device_printf(dev, "flash erase timeout\n"); + return (-1); + } + + outb(bank, SM_FLASH_CMD_CLEAR_STATUS); + outb(bank, SM_FLASH_CMD_RESET); + + for (i = 0; i < NVRAM_SIZE; i++) { + if (bank[i] != 0xff) { + device_printf(dev, "flash write has failed\n"); + return (-1); + } + } + return (0); +} + +static int +write_bank_sm(device_t dev, uint8_t *bank, uint8_t *data) +{ + unsigned int i; + + for (i = 0; i < NVRAM_SIZE; i++) { + OUTB_DELAY(bank + i, SM_FLASH_CMD_WRITE_SETUP); + outb(bank + i, data[i]); + if (wait_operation_complete_sm(bank) != 0) { + device_printf(dev, "flash write error/timeout\n"); + break; + } + } + + outb(bank, SM_FLASH_CMD_CLEAR_STATUS); + outb(bank, SM_FLASH_CMD_RESET); + + for (i = 0; i < NVRAM_SIZE; i++) { + if (bank[i] != data[i]) { + device_printf(dev, "flash write has failed\n"); + return (-1); + } + } + return (0); +} + +static int +erase_bank(device_t dev, uint8_t *bank) +{ + struct powermac_nvram_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_type == FLASH_TYPE_AMD) + return (erase_bank_amd(dev, bank)); + else + return (erase_bank_sm(dev, bank)); +} + +static int +write_bank(device_t dev, uint8_t *bank, uint8_t *data) +{ + struct powermac_nvram_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_type == FLASH_TYPE_AMD) + return (write_bank_amd(dev, bank, data)); + else + return (write_bank_sm(dev, bank, data)); +} Modified: head/sys/dev/powermac_nvram/powermac_nvramvar.h ============================================================================== --- head/sys/dev/powermac_nvram/powermac_nvramvar.h Sun Sep 5 19:57:24 2010 (r212239) +++ head/sys/dev/powermac_nvram/powermac_nvramvar.h Sun Sep 5 20:04:02 2010 (r212240) @@ -33,6 +33,16 @@ #define CORE99_SIGNATURE 0x5a +#define SM_FLASH_CMD_ERASE_CONFIRM 0xd0 +#define SM_FLASH_CMD_ERASE_SETUP 0x20 +#define SM_FLASH_CMD_RESET 0xff +#define SM_FLASH_CMD_WRITE_SETUP 0x40 +#define SM_FLASH_CMD_CLEAR_STATUS 0x50 +#define SM_FLASH_CMD_READ_STATUS 0x70 + +#define SM_FLASH_STATUS_DONE 0x80 +#define SM_FLASH_STATUS_ERR 0x38 + #ifdef _KERNEL struct powermac_nvram_softc { @@ -44,6 +54,9 @@ struct powermac_nvram_softc { uint8_t sc_data[NVRAM_SIZE]; struct cdev * sc_cdev; + int sc_type; +#define FLASH_TYPE_SM 0 +#define FLASH_TYPE_AMD 1 int sc_isopen; int sc_rpos; int sc_wpos; From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 20:04:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3386D10656D0; Sun, 5 Sep 2010 20:04:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 235E68FC26; Sun, 5 Sep 2010 20:04: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 o85K4tPY097317; Sun, 5 Sep 2010 20:04:55 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85K4tH6097315; Sun, 5 Sep 2010 20:04:55 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201009052004.o85K4tH6097315@svn.freebsd.org> From: Glen Barber Date: Sun, 5 Sep 2010 20:04: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: r212241 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 20:04:55 -0000 Author: gjb (doc committer) Date: Sun Sep 5 20:04:54 2010 New Revision: 212241 URL: http://svn.freebsd.org/changeset/base/212241 Log: Note in rc.conf(5) that jail_list should contain only alphanumeric characters. PR: 150098 Submitted by: cc (cpt_complain at yahoo dot com) Approved by: keramida (mentor) MFC after: 1 week Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Sun Sep 5 20:04:02 2010 (r212240) +++ head/share/man/man5/rc.conf.5 Sun Sep 5 20:04:54 2010 (r212241) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2010 +.Dd September 4, 2010 .Dt RC.CONF 5 .Os .Sh NAME @@ -3503,7 +3503,8 @@ A space separated list of names for jail This is purely a configuration aid to help identify and configure multiple jails. The names specified in this list will be used to -identify settings common to an instance of a jail. +identify settings common to an instance of a jail, +and should contain alphanumeric characters only. Assuming that the jail in question was named .Li vjail , you would have the following dependent variables: From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 20:13:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEE2710656AD; Sun, 5 Sep 2010 20:13:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD9308FC17; Sun, 5 Sep 2010 20:13: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 o85KD71w097627; Sun, 5 Sep 2010 20:13:07 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85KD77V097623; Sun, 5 Sep 2010 20:13:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201009052013.o85KD77V097623@svn.freebsd.org> From: Michael Tuexen Date: Sun, 5 Sep 2010 20:13: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: r212242 - in head/sys: kern netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 20:13:08 -0000 Author: tuexen Date: Sun Sep 5 20:13:07 2010 New Revision: 212242 URL: http://svn.freebsd.org/changeset/base/212242 Log: Implement correct handling of address parameter and sendinfo for SCTP send calls. MFC after: 4 weeks. Modified: head/sys/kern/uipc_syscalls.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_uio.h Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sun Sep 5 20:04:54 2010 (r212241) +++ head/sys/kern/uipc_syscalls.c Sun Sep 5 20:13:07 2010 (r212242) @@ -2381,7 +2381,6 @@ sctp_generic_sendmsg (td, uap) struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; struct file *fp = NULL; - int use_rcvinfo = 1; int error = 0, len; struct sockaddr *to = NULL; #ifdef KTRACE @@ -2434,7 +2433,7 @@ sctp_generic_sendmsg (td, uap) CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, (struct mbuf *)NULL, - uap->flags, use_rcvinfo, u_sinfo, td); + uap->flags, u_sinfo, td); CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len && (error == ERESTART || @@ -2485,7 +2484,6 @@ sctp_generic_sendmsg_iov(td, uap) struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; struct file *fp = NULL; - int use_rcvinfo = 1; int error=0, len, i; struct sockaddr *to = NULL; #ifdef KTRACE @@ -2552,7 +2550,7 @@ sctp_generic_sendmsg_iov(td, uap) CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, (struct mbuf *)NULL, - uap->flags, use_rcvinfo, u_sinfo, td); + uap->flags, u_sinfo, td); CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len && (error == ERESTART || Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Sep 5 20:04:54 2010 (r212241) +++ head/sys/netinet/sctp_output.c Sun Sep 5 20:13:07 2010 (r212242) @@ -12158,7 +12158,7 @@ sctp_sosend(struct socket *so, error = sctp_lower_sosend(so, addr_to_use, uio, top, control, flags, - use_rcvinfo, &srcv + use_rcvinfo ? &srcv : NULL ,p ); return (error); @@ -12172,7 +12172,6 @@ sctp_lower_sosend(struct socket *so, struct mbuf *i_pak, struct mbuf *control, int flags, - int use_rcvinfo, struct sctp_sndrcvinfo *srcv , struct thread *p @@ -12200,8 +12199,10 @@ sctp_lower_sosend(struct socket *so, int got_all_of_the_send = 0; int hold_tcblock = 0; int non_blocking = 0; - int temp_flags = 0; uint32_t local_add_more, local_soresv = 0; + uint16_t port; + uint16_t sinfo_flags; + sctp_assoc_t sinfo_assoc_id; error = 0; net = NULL; @@ -12236,28 +12237,39 @@ sctp_lower_sosend(struct socket *so, SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %d\n", addr, sndlen); + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && + (inp->sctp_socket->so_qlimit)) { + /* The listener can NOT send */ + SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOTCONN); + error = ENOTCONN; + goto out_unlocked; + } /** * Pre-screen address, if one is given the sin-len * must be set correctly! */ if (addr) { - switch (addr->sa_family) { + union sctp_sockstore *raddr = (union sctp_sockstore *)addr; + + switch (raddr->sa.sa_family) { #if defined(INET) case AF_INET: - if (addr->sa_len != sizeof(struct sockaddr_in)) { + if (raddr->sin.sin_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } + port = raddr->sin.sin_port; break; #endif #if defined(INET6) case AF_INET6: - if (addr->sa_len != sizeof(struct sockaddr_in6)) { + if (raddr->sin6.sin6_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } + port = raddr->sin6.sin6_port; break; #endif default: @@ -12265,32 +12277,34 @@ sctp_lower_sosend(struct socket *so, error = EAFNOSUPPORT; goto out_unlocked; } - } - hold_tcblock = 0; + } else + port = 0; - if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && - (inp->sctp_socket->so_qlimit)) { - /* The listener can NOT send */ - SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOTCONN); - error = ENOTCONN; - goto out_unlocked; - } - if ((use_rcvinfo) && srcv) { - if (INVALID_SINFO_FLAG(srcv->sinfo_flags) || - PR_SCTP_INVALID_POLICY(srcv->sinfo_flags)) { + if (srcv) { + sinfo_flags = srcv->sinfo_flags; + sinfo_assoc_id = srcv->sinfo_assoc_id; + if (INVALID_SINFO_FLAG(sinfo_flags) || + PR_SCTP_INVALID_POLICY(sinfo_flags)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } if (srcv->sinfo_flags) SCTP_STAT_INCR(sctps_sends_with_flags); - - if (srcv->sinfo_flags & SCTP_SENDALL) { - /* its a sendall */ - error = sctp_sendall(inp, uio, top, srcv); - top = NULL; - goto out_unlocked; - } + } else { + sinfo_flags = inp->def_send.sinfo_flags; + sinfo_assoc_id = inp->def_send.sinfo_assoc_id; + } + if (sinfo_flags & SCTP_SENDALL) { + /* its a sendall */ + error = sctp_sendall(inp, uio, top, srcv); + top = NULL; + goto out_unlocked; + } + if ((sinfo_flags & SCTP_ADDR_OVER) && (addr == NULL)) { + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out_unlocked; } /* now we must find the assoc */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) || @@ -12306,80 +12320,8 @@ sctp_lower_sosend(struct socket *so, SCTP_TCB_LOCK(stcb); hold_tcblock = 1; SCTP_INP_RUNLOCK(inp); - if (addr) { - /* Must locate the net structure if addr given */ - net = sctp_findnet(stcb, addr); - if (net) { - /* validate port was 0 or correct */ - struct sockaddr_in *sin; - - sin = (struct sockaddr_in *)addr; - if ((sin->sin_port != 0) && - (sin->sin_port != stcb->rport)) { - net = NULL; - } - } - temp_flags |= SCTP_ADDR_OVER; - } else - net = stcb->asoc.primary_destination; - if (addr && (net == NULL)) { - /* Could not find address, was it legal */ - if (addr->sa_family == AF_INET) { - struct sockaddr_in *sin; - - sin = (struct sockaddr_in *)addr; - if (sin->sin_addr.s_addr == 0) { - if ((sin->sin_port == 0) || - (sin->sin_port == stcb->rport)) { - net = stcb->asoc.primary_destination; - } - } - } else { - struct sockaddr_in6 *sin6; - - sin6 = (struct sockaddr_in6 *)addr; - if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - if ((sin6->sin6_port == 0) || - (sin6->sin6_port == stcb->rport)) { - net = stcb->asoc.primary_destination; - } - } - } - } - if (net == NULL) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out_unlocked; - } - } else if (use_rcvinfo && srcv && srcv->sinfo_assoc_id) { - stcb = sctp_findassociation_ep_asocid(inp, srcv->sinfo_assoc_id, 0); - if (stcb) { - if (addr) - /* - * Must locate the net structure if addr - * given - */ - net = sctp_findnet(stcb, addr); - else - net = stcb->asoc.primary_destination; - if ((srcv->sinfo_flags & SCTP_ADDR_OVER) && - ((net == NULL) || (addr == NULL))) { - struct sockaddr_in *sin; - - if (addr == NULL) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out_unlocked; - } - sin = (struct sockaddr_in *)addr; - /* Validate port is 0 or correct */ - if ((sin->sin_port != 0) && - (sin->sin_port != stcb->rport)) { - net = NULL; - } - } - } - hold_tcblock = 0; + } else if (sinfo_assoc_id) { + stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 0); } else if (addr) { /*- * Since we did not use findep we must @@ -12452,10 +12394,8 @@ sctp_lower_sosend(struct socket *so, */ uint32_t vrf_id; - if ((use_rcvinfo) && (srcv) && - ((srcv->sinfo_flags & SCTP_ABORT) || - ((srcv->sinfo_flags & SCTP_EOF) && - (sndlen == 0)))) { + if ((sinfo_flags & SCTP_ABORT) || + ((sinfo_flags & SCTP_EOF) && (sndlen == 0))) { /*- * User asks to abort a non-existant assoc, * or EOF a non-existant assoc with no data @@ -12584,10 +12524,25 @@ sctp_lower_sosend(struct socket *so, * structure may now have an update and thus we may need to * change it BEFORE we append the message. */ - net = stcb->asoc.primary_destination; - asoc = &stcb->asoc; } } + if (srcv == NULL) + srcv = (struct sctp_sndrcvinfo *)&stcb->asoc.def_send; + if (srcv->sinfo_flags & SCTP_ADDR_OVER) { + if (addr) + net = sctp_findnet(stcb, addr); + else + net = NULL; + if ((net == NULL) || + ((port != 0) && (port != stcb->rport))) { + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out_unlocked; + } + } else { + net = stcb->asoc.primary_destination; + } + if ((SCTP_SO_IS_NBIO(so) || (flags & MSG_NBIO) )) { @@ -12658,10 +12613,6 @@ sctp_lower_sosend(struct socket *so, (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) { queue_only = 1; } - if ((use_rcvinfo == 0) || (srcv == NULL)) { - /* Grab the default stuff from the asoc */ - srcv = (struct sctp_sndrcvinfo *)&stcb->asoc.def_send; - } /* we are now done with all control */ if (control) { sctp_m_freem(control); @@ -12671,8 +12622,7 @@ sctp_lower_sosend(struct socket *so, (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) || (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) { - if ((use_rcvinfo) && - (srcv->sinfo_flags & SCTP_ABORT)) { + if (srcv->sinfo_flags & SCTP_ABORT) { ; } else { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); @@ -12684,16 +12634,6 @@ sctp_lower_sosend(struct socket *so, if (p) { p->td_ru.ru_msgsnd++; } - if (stcb) { - if (((srcv->sinfo_flags | temp_flags) & SCTP_ADDR_OVER) == 0) { - net = stcb->asoc.primary_destination; - } - } - if (net == NULL) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out_unlocked; - } if ((net->flight_size > net->cwnd) && (asoc->sctp_cmt_on_off == 0)) { /*- Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Sun Sep 5 20:04:54 2010 (r212241) +++ head/sys/netinet/sctp_uio.h Sun Sep 5 20:13:07 2010 (r212242) @@ -982,6 +982,23 @@ union sctp_sockstore { struct sockaddr sa; }; + +/***********************************/ +/* And something for us old timers */ +/***********************************/ + +#ifndef ntohll +#include +#define ntohll(x) be64toh(x) +#endif + +#ifndef htonll +#include +#define htonll(x) htobe64(x) +#endif +/***********************************/ + + struct xsctp_inpcb { uint32_t last; uint32_t flags; @@ -1079,7 +1096,6 @@ sctp_lower_sosend(struct socket *so, struct mbuf *i_pak, struct mbuf *control, int flags, - int use_rcvinfo, struct sctp_sndrcvinfo *srcv ,struct thread *p ); From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 21:12:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 711C51065787; Sun, 5 Sep 2010 21:12:48 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 601688FC23; Sun, 5 Sep 2010 21:12: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 o85LCmQ1099275; Sun, 5 Sep 2010 21:12:48 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85LCmOk099273; Sun, 5 Sep 2010 21:12:48 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009052112.o85LCmOk099273@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 5 Sep 2010 21:12:48 +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: r212243 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 21:12:48 -0000 Author: jilles Date: Sun Sep 5 21:12:48 2010 New Revision: 212243 URL: http://svn.freebsd.org/changeset/base/212243 Log: sh: Improve comments in expand.c. Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun Sep 5 20:13:07 2010 (r212242) +++ head/bin/sh/expand.c Sun Sep 5 21:12:48 2010 (r212243) @@ -138,12 +138,18 @@ expandhere(union node *arg, int fd) /* - * Perform variable substitution and command substitution on an argument, - * placing the resulting list of arguments in arglist. If EXP_FULL is true, - * perform splitting and file name expansion. When arglist is NULL, perform - * here document expansion. + * Perform expansions on an argument, placing the resulting list of arguments + * in arglist. Parameter expansion, command substitution and arithmetic + * expansion are always performed; additional expansions can be requested + * via flag (EXP_*). + * The result is left in the stack string. + * When arglist is NULL, perform here document expansion. A partial result + * may be written to herefd, which is then not included in the stack string. + * + * Caution: this function uses global state and is not reentrant. + * However, a new invocation after an interrupted invocation is safe + * and will reset the global state for the new call. */ - void expandarg(union node *arg, struct arglist *arglist, int flag) { @@ -195,11 +201,14 @@ expandarg(union node *arg, struct arglis /* - * Perform variable and command substitution. If EXP_FULL is set, output CTLESC - * characters to allow for further processing. Otherwise treat - * $@ like $* since no splitting will be performed. + * Perform parameter expansion, command substitution and arithmetic + * expansion, and tilde expansion if requested via EXP_TILDE/EXP_VARTILDE. + * Processing ends at a CTLENDVAR character as well as '\0'. + * This is used to expand word in ${var+word} etc. + * If EXP_FULL, EXP_CASE or EXP_REDIR are set, keep and/or generate CTLESC + * characters to allow for further processing. + * If EXP_FULL is set, also preserve CTLQUOTEMARK characters. */ - STATIC void argstr(char *p, int flag) { @@ -212,7 +221,7 @@ argstr(char *p, int flag) for (;;) { switch (c = *p++) { case '\0': - case CTLENDVAR: /* ??? */ + case CTLENDVAR: goto breakloop; case CTLQUOTEMARK: /* "$@" syntax adherence hack */ @@ -262,6 +271,10 @@ argstr(char *p, int flag) breakloop:; } +/* + * Perform tilde expansion, placing the result in the stack string and + * returning the next position in the input string to process. + */ STATIC char * exptilde(char *p, int flag) { @@ -367,12 +380,11 @@ expari(int flag) int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR); int quoted; - /* * This routine is slightly over-complicated for * efficiency. First we make sure there is * enough space for the result, which may be bigger - * than the expression if we add exponentiation. Next we + * than the expression. Next we * scan backwards looking for the start of arithmetic. If the * next previous character is a CTLESC character, then we * have to rescan starting from the beginning since CTLESC @@ -413,9 +425,8 @@ expari(int flag) /* - * Expand stuff in backwards quotes. + * Perform command substitution. */ - STATIC void expbackq(union node *cmd, int quoted, int flag) { @@ -974,6 +985,12 @@ recordregion(int start, int end, int inq * Break the argument string into pieces based upon IFS and add the * strings to the argument list. The regions of the string to be * searched for IFS characters have been stored by recordregion. + * CTLESC characters are preserved but have little effect in this pass + * other than escaping CTL* characters. In particular, they do not escape + * IFS characters: that should be done with the ifsregion mechanism. + * CTLQUOTEMARK characters are used to preserve empty quoted strings. + * This pass treats them as a regular character, making the string non-empty. + * Later, they are removed along with the other CTL* characters. */ STATIC void ifsbreakup(char *string, struct arglist *arglist) @@ -1075,15 +1092,14 @@ ifsbreakup(char *string, struct arglist } - -/* - * Expand shell metacharacters. At this point, the only control characters - * should be escapes. The results are stored in the list exparg. - */ - STATIC char expdir[PATH_MAX]; #define expdir_end (expdir + sizeof(expdir)) +/* + * Perform pathname generation and remove control characters. + * At this point, the only control characters should be CTLESC and CTLQUOTEMARK. + * The results are stored in the list exparg. + */ STATIC void expandmeta(struct strlist *str, int flag __unused) { @@ -1469,7 +1485,7 @@ breakloop: /* - * Remove any CTLESC characters from a string. + * Remove any CTLESC and CTLQUOTEMARK characters from a string. */ void From owner-svn-src-all@FreeBSD.ORG Sun Sep 5 21:44:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1394110656C0; Sun, 5 Sep 2010 21:44:51 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0314A8FC14; Sun, 5 Sep 2010 21:44: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 o85LioaD000229; Sun, 5 Sep 2010 21:44:50 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o85LioHp000227; Sun, 5 Sep 2010 21:44:50 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009052144.o85LioHp000227@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 5 Sep 2010 21:44: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: r212244 - head/usr.bin/printf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2010 21:44:51 -0000 Author: jilles Date: Sun Sep 5 21:44:50 2010 New Revision: 212244 URL: http://svn.freebsd.org/changeset/base/212244 Log: printf(1): Clarify that \OOO produces a byte, different %b escape sequences. Octal escape sequences are expanded to bytes, not characters, and multiple are required for a multibyte character. The valid escape sequences in %b strings are slightly different from the escape sequences in the format string. Modified: head/usr.bin/printf/printf.1 Modified: head/usr.bin/printf/printf.1 ============================================================================== --- head/usr.bin/printf/printf.1 Sun Sep 5 21:12:48 2010 (r212243) +++ head/usr.bin/printf/printf.1 Sun Sep 5 21:44:50 2010 (r212244) @@ -35,7 +35,7 @@ .\" @(#)printf.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd April 14, 2005 +.Dd September 5, 2010 .Dt PRINTF 1 .Os .Sh NAME @@ -109,12 +109,13 @@ Write a character. .It Cm \e\e Write a backslash character. .It Cm \e Ns Ar num -.It Cm \e0 Ns Ar num -Write an 8-bit character whose -.Tn ASCII +Write a byte whose value is the 1-, 2-, or 3-digit octal number .Ar num . +Multibyte characters can be constructed using multiple +.Cm \e Ns Ar num +sequences. .El .Pp Each format specification is introduced by the percent character @@ -289,6 +290,11 @@ As for .Cm s , but interpret character escapes in backslash notation in the string .Ar argument . +The permitted escape sequences are slightly different in that +octal escapes are +.Cm \e0 Ns Ar num +instead of +.Cm \e Ns Ar num . .It Cm \&% Print a `%'; no argument is used. .El From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 03:00:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F1121065698; Mon, 6 Sep 2010 03:00:54 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E0E78FC14; Mon, 6 Sep 2010 03:00: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 o8630sZd008824; Mon, 6 Sep 2010 03:00:54 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8630sWI008822; Mon, 6 Sep 2010 03:00:54 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009060300.o8630sWI008822@svn.freebsd.org> From: David Xu Date: Mon, 6 Sep 2010 03:00: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: r212245 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 03:00:54 -0000 Author: davidxu Date: Mon Sep 6 03:00:54 2010 New Revision: 212245 URL: http://svn.freebsd.org/changeset/base/212245 Log: Fix off-by-one error in function _thr_sigact_unload, also disable the function, it seems some gnome application tends to crash if we unregister sigaction automatically. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Sun Sep 5 21:44:50 2010 (r212244) +++ head/lib/libthr/thread/thr_sig.c Mon Sep 6 03:00:54 2010 (r212245) @@ -418,6 +418,7 @@ _thr_signal_init(void) void _thr_sigact_unload(struct dl_phdr_info *phdr_info) { +#if 0 struct pthread *curthread = _get_curthread(); struct urwlock *rwlp; struct sigaction *actp; @@ -426,13 +427,13 @@ _thr_sigact_unload(struct dl_phdr_info * int sig; _thr_signal_block(curthread); - for (sig = 1; sig < _SIG_MAXSIG; sig++) { - actp = &_thr_sigact[sig].sigact; + for (sig = 1; sig <= _SIG_MAXSIG; sig++) { + actp = &_thr_sigact[sig-1].sigact; retry: handler = actp->sa_handler; if (handler != SIG_DFL && handler != SIG_IGN && __elf_phdr_match_addr(phdr_info, handler)) { - rwlp = &_thr_sigact[sig].lock; + rwlp = &_thr_sigact[sig-1].lock; _thr_rwl_wrlock(rwlp); if (handler != actp->sa_handler) { _thr_rwl_unlock(rwlp); @@ -449,6 +450,7 @@ retry: } } _thr_signal_unblock(curthread); +#endif } void From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 04:15:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B72410656B2; Mon, 6 Sep 2010 04:15:50 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A66F8FC1D; Mon, 6 Sep 2010 04:15: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 o864Fnw3011180; Mon, 6 Sep 2010 04:15:49 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o864Fntq011178; Mon, 6 Sep 2010 04:15:49 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009060415.o864Fntq011178@svn.freebsd.org> From: Brian Somers Date: Mon, 6 Sep 2010 04:15: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: r212247 - head/sbin/fdisk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 04:15:50 -0000 Author: brian Date: Mon Sep 6 04:15:49 2010 New Revision: 212247 URL: http://svn.freebsd.org/changeset/base/212247 Log: Handle geli-encrypted root disk devices. MFC after: 2 weeks Modified: head/sbin/fdisk/fdisk.c Modified: head/sbin/fdisk/fdisk.c ============================================================================== --- head/sbin/fdisk/fdisk.c Mon Sep 6 04:14:59 2010 (r212246) +++ head/sbin/fdisk/fdisk.c Mon Sep 6 04:15:49 2010 (r212247) @@ -1461,6 +1461,7 @@ sanitize_partition(struct dos_partition * /dev/ad0s1a => /dev/ad0 * /dev/da0a => /dev/da0 * /dev/vinum/root => /dev/vinum/root + * A ".eli" part is removed if it exists (see geli(8)). */ static char * get_rootdisk(void) @@ -1469,7 +1470,7 @@ get_rootdisk(void) regex_t re; #define NMATCHES 2 regmatch_t rm[NMATCHES]; - char *s; + char dev[PATH_MAX], *s; int rv; if (statfs("/", &rootfs) == -1) @@ -1478,7 +1479,11 @@ get_rootdisk(void) if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$", REG_EXTENDED)) != 0) errx(1, "regcomp() failed (%d)", rv); - if ((rv = regexec(&re, rootfs.f_mntfromname, NMATCHES, rm, 0)) != 0) + strlcpy(dev, rootfs.f_mntfromname, sizeof (dev)); + if ((s = strstr(dev, ".eli")) != NULL) + memmove(s, s+4, strlen(s + 4) + 1); + + if ((rv = regexec(&re, dev, NMATCHES, rm, 0)) != 0) errx(1, "mounted root fs resource doesn't match expectations (regexec returned %d)", rv); From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 06:18:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD0C6106566C; Mon, 6 Sep 2010 06:18:49 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB2858FC0C; Mon, 6 Sep 2010 06:18: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 o866InHA015913; Mon, 6 Sep 2010 06:18:49 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o866InMf015909; Mon, 6 Sep 2010 06:18:49 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009060618.o866InMf015909@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 6 Sep 2010 06:18: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: r212248 - head/sys/mips/rmi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 06:18:50 -0000 Author: jchandra Date: Mon Sep 6 06:18:49 2010 New Revision: 212248 URL: http://svn.freebsd.org/changeset/base/212248 Log: XLR/XLS hardware interrupts should be programmed level triggered at the PIC. This should fix the interrupt releated issues seen after the interrupt handling re-write for SMP. Modified: head/sys/mips/rmi/iodi.c head/sys/mips/rmi/xlr_machdep.c head/sys/mips/rmi/xlr_pci.c Modified: head/sys/mips/rmi/iodi.c ============================================================================== --- head/sys/mips/rmi/iodi.c Mon Sep 6 04:15:49 2010 (r212247) +++ head/sys/mips/rmi/iodi.c Mon Sep 6 06:18:49 2010 (r212248) @@ -104,7 +104,7 @@ iodi_setup_intr(device_t dev, device_t c /* FIXME uart 1? */ cpu_establish_hardintr("uart", filt, intr, arg, PIC_UART_0_IRQ, flags, cookiep); - pic_setup_intr(PIC_IRT_UART_0_INDEX, PIC_UART_0_IRQ, 0x1, 0); + pic_setup_intr(PIC_IRT_UART_0_INDEX, PIC_UART_0_IRQ, 0x1, 1); } else if (strcmp(name, "rge") == 0 || strcmp(name, "nlge") == 0) { int irq; @@ -112,15 +112,15 @@ iodi_setup_intr(device_t dev, device_t c irq = (intptr_t)ires->__r_i; cpu_establish_hardintr("rge", filt, intr, arg, irq, flags, cookiep); - pic_setup_intr(irq - PIC_IRQ_BASE, irq, 0x1, 0); + pic_setup_intr(irq - PIC_IRQ_BASE, irq, 0x1, 1); } else if (strcmp(name, "ehci") == 0) { cpu_establish_hardintr("ehci", filt, intr, arg, PIC_USB_IRQ, flags, cookiep); - pic_setup_intr(PIC_USB_IRQ - PIC_IRQ_BASE, PIC_USB_IRQ, 0x1, 0); + pic_setup_intr(PIC_USB_IRQ - PIC_IRQ_BASE, PIC_USB_IRQ, 0x1, 1); } else if (strcmp(name, "ata") == 0) { xlr_establish_intr("ata", filt, intr, arg, PIC_PCMCIA_IRQ, flags, cookiep, bridge_pcmcia_ack); - pic_setup_intr(PIC_PCMCIA_IRQ - PIC_IRQ_BASE, PIC_PCMCIA_IRQ, 0x1, 0); + pic_setup_intr(PIC_PCMCIA_IRQ - PIC_IRQ_BASE, PIC_PCMCIA_IRQ, 0x1, 1); } return (0); } Modified: head/sys/mips/rmi/xlr_machdep.c ============================================================================== --- head/sys/mips/rmi/xlr_machdep.c Mon Sep 6 04:15:49 2010 (r212247) +++ head/sys/mips/rmi/xlr_machdep.c Mon Sep 6 06:18:49 2010 (r212248) @@ -297,7 +297,7 @@ xlr_pic_init(void) 2000, /* quality (adjusted in code) */ }; xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); - int i, level, irq; + int i, irq; write_c0_eimr64(0ULL); mtx_init(&xlr_pic_lock, "pic", NULL, MTX_SPIN); @@ -306,17 +306,14 @@ xlr_pic_init(void) /* Initialize all IRT entries */ for (i = 0; i < PIC_NUM_IRTS; i++) { irq = PIC_INTR_TO_IRQ(i); - level = PIC_IS_EDGE_TRIGGERED(i); - - /* Bind all PIC irqs to cpu 0 */ - xlr_write_reg(mmio, PIC_IRT_0(i), 0x01); /* - * Use local scheduling and high polarity for all IRTs - * Invalidate all IRTs, by default + * Disable all IRTs. Set defaults (local scheduling, high + * polarity, level * triggered, and CPU irq) */ - xlr_write_reg(mmio, PIC_IRT_1(i), (level << 30) | (1 << 6) | - irq); + xlr_write_reg(mmio, PIC_IRT_1(i), (1 << 30) | (1 << 6) | irq); + /* Bind all PIC irqs to cpu 0 */ + xlr_write_reg(mmio, PIC_IRT_0(i), 0x01); } /* Setup timer 7 of PIC as a timestamp, no interrupts */ Modified: head/sys/mips/rmi/xlr_pci.c ============================================================================== --- head/sys/mips/rmi/xlr_pci.c Mon Sep 6 04:15:49 2010 (r212247) +++ head/sys/mips/rmi/xlr_pci.c Mon Sep 6 06:18:49 2010 (r212248) @@ -461,11 +461,11 @@ mips_platform_pci_setup_intr(device_t de if (xlr_board_info.is_xls == 0) { xlr_establish_intr(device_get_name(child), filt, intr, arg, PIC_PCIX_IRQ, flags, cookiep, bridge_pcix_ack); - pic_setup_intr(PIC_IRT_PCIX_INDEX, PIC_PCIX_IRQ, 0x1, 0); + pic_setup_intr(PIC_IRT_PCIX_INDEX, PIC_PCIX_IRQ, 0x1, 1); } else { xlr_establish_intr(device_get_name(child), filt, intr, arg, xlrirq, flags, cookiep, bridge_pcie_ack); - pic_setup_intr(xlrirq - PIC_IRQ_BASE, xlrirq, 0x1, 0); + pic_setup_intr(xlrirq - PIC_IRQ_BASE, xlrirq, 0x1, 1); } return (bus_generic_setup_intr(dev, child, irq, flags, filt, intr, From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 06:42:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A10C010656B0; Mon, 6 Sep 2010 06:42:15 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 0344C8FC0A; Mon, 6 Sep 2010 06:42:04 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id F3E3645CD8; Mon, 6 Sep 2010 08:42:01 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 0253045C9C; Mon, 6 Sep 2010 08:41:56 +0200 (CEST) Date: Mon, 6 Sep 2010 08:41:42 +0200 From: Pawel Jakub Dawidek To: Brian Somers Message-ID: <20100906064142.GF1900@garage.freebsd.pl> References: <201009060415.o864Fntq011178@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DNUSDXU7R7AVVM8C" Content-Disposition: inline In-Reply-To: <201009060415.o864Fntq011178@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212247 - head/sbin/fdisk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 06:42:15 -0000 --DNUSDXU7R7AVVM8C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 06, 2010 at 04:15:49AM +0000, Brian Somers wrote: > Author: brian > Date: Mon Sep 6 04:15:49 2010 > New Revision: 212247 > URL: http://svn.freebsd.org/changeset/base/212247 >=20 > Log: > Handle geli-encrypted root disk devices. [...] > if ((rv =3D regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$", > REG_EXTENDED)) !=3D 0) > errx(1, "regcomp() failed (%d)", rv); > - if ((rv =3D regexec(&re, rootfs.f_mntfromname, NMATCHES, rm, 0)) !=3D 0) > + strlcpy(dev, rootfs.f_mntfromname, sizeof (dev)); > + if ((s =3D strstr(dev, ".eli")) !=3D NULL) > + memmove(s, s+4, strlen(s + 4) + 1); > + > + if ((rv =3D regexec(&re, dev, NMATCHES, rm, 0)) !=3D 0) > errx(1, > "mounted root fs resource doesn't match expectations (regexec returned %= d)", > rv); Your assumption that .eli can only be present at the end of provider name is incorrect. It can be eg. /dev/ad0s1a.eli.journal. Another problem is that in memmove you cut the first 4 characters, not the last 4 characters. I'm not sure, but can't you simply extend regular expression to: "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\.eli)?$" --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --DNUSDXU7R7AVVM8C Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyEjSUACgkQForvXbEpPzRmwwCeOC5ba4WlfmGirPXY7nOTOrwl UIsAoNnODx5+1P9APsXYqMqc5YsEn3T+ =xKD+ -----END PGP SIGNATURE----- --DNUSDXU7R7AVVM8C-- From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 07:24:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13F9110656A6; Mon, 6 Sep 2010 07:24:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 023F88FC0A; Mon, 6 Sep 2010 07:24: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 o867OhJR021822; Mon, 6 Sep 2010 07:24:43 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o867OhJ5021820; Mon, 6 Sep 2010 07:24:43 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009060724.o867OhJ5021820@svn.freebsd.org> From: Andriy Gapon Date: Mon, 6 Sep 2010 07:24:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212250 - stable/8/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 07:24:44 -0000 Author: avg Date: Mon Sep 6 07:24:43 2010 New Revision: 212250 URL: http://svn.freebsd.org/changeset/base/212250 Log: MFC r212172: acpi: update stale comments about order of cpu devices probing Modified: stable/8/sys/dev/acpica/acpi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/acpica/acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi.c Mon Sep 6 07:24:28 2010 (r212249) +++ stable/8/sys/dev/acpica/acpi.c Mon Sep 6 07:24:43 2010 (r212250) @@ -1699,10 +1699,10 @@ acpi_probe_order(ACPI_HANDLE handle, int ACPI_OBJECT_TYPE type; /* - * 1. I/O port and memory system resource holders - * 2. Embedded controllers (to handle early accesses) - * 3. PCI Link Devices - * 100000. CPUs + * 1. CPUs + * 2. I/O port and memory system resource holders + * 3. Embedded controllers (to handle early accesses) + * 4. PCI Link Devices */ AcpiGetType(handle, &type); if (type == ACPI_TYPE_PROCESSOR) @@ -1762,8 +1762,7 @@ acpi_probe_child(ACPI_HANDLE handle, UIN * placeholder so that the probe/attach passes will run * breadth-first. Orders less than ACPI_DEV_BASE_ORDER * are reserved for special objects (i.e., system - * resources). CPU devices have a very high order to - * ensure they are probed after other devices. + * resources). */ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "scanning '%s'\n", handle_str)); order = level * 10 + 100; From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 07:34:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1100E10656CA; Mon, 6 Sep 2010 07:34:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3C808FC13; Mon, 6 Sep 2010 07:34: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 o867YWQo022848; Mon, 6 Sep 2010 07:34:32 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o867YWH8022846; Mon, 6 Sep 2010 07:34:32 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009060734.o867YWH8022846@svn.freebsd.org> From: Andriy Gapon Date: Mon, 6 Sep 2010 07:34: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: r212251 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 07:34:33 -0000 Author: avg Date: Mon Sep 6 07:34:32 2010 New Revision: 212251 URL: http://svn.freebsd.org/changeset/base/212251 Log: acpi_hp: fix bus attachment code - add identify method to create driver's own device_t - successfully probe only driver's own device_t instead of any device_t - (ab)use device order to hopefully be probed/attached after acpi_wmi PR: kern/147858 Tested by: Maciej Suszko MFC after: 1 week Modified: head/sys/dev/acpi_support/acpi_hp.c Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Mon Sep 6 07:24:43 2010 (r212250) +++ head/sys/dev/acpi_support/acpi_hp.c Mon Sep 6 07:34:32 2010 (r212251) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -116,7 +117,6 @@ struct acpi_hp_inst_seq_pair { struct acpi_hp_softc { device_t dev; - ACPI_HANDLE handle; device_t wmi_dev; int has_notify; /* notification GUID found */ int has_cmi; /* CMI GUID found */ @@ -289,6 +289,7 @@ static struct { ACPI_SERIAL_DECL(hp, "HP ACPI-WMI Mapping"); +static void acpi_hp_identify(driver_t *driver, device_t parent); static int acpi_hp_probe(device_t dev); static int acpi_hp_attach(device_t dev); static int acpi_hp_detach(device_t dev); @@ -320,6 +321,7 @@ static struct cdevsw hpcmi_cdevsw = { }; static device_method_t acpi_hp_methods[] = { + DEVMETHOD(device_identify, acpi_hp_identify), DEVMETHOD(device_probe, acpi_hp_probe), DEVMETHOD(device_attach, acpi_hp_attach), DEVMETHOD(device_detach, acpi_hp_detach), @@ -405,7 +407,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WLAN on air changed to %i " "(new_wlan_status is %i)\n", sc->was_wlan_on_air, new_wlan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xc0+sc->was_wlan_on_air); } } @@ -420,7 +422,7 @@ acpi_hp_evaluate_auto_on_off(struct acpi " to %i (new_bluetooth_status is %i)\n", sc->was_bluetooth_on_air, new_bluetooth_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xd0+sc->was_bluetooth_on_air); } } @@ -433,16 +435,43 @@ acpi_hp_evaluate_auto_on_off(struct acpi "WWAN on air changed to %i" " (new_wwan_status is %i)\n", sc->was_wwan_on_air, new_wwan_status); - acpi_UserNotify("HP", sc->handle, + acpi_UserNotify("HP", ACPI_ROOT_OBJECT, 0xe0+sc->was_wwan_on_air); } } } +static void +acpi_hp_identify(driver_t *driver, device_t parent) +{ + + /* Don't do anything if driver is disabled. */ + if (acpi_disabled("hp")) + return; + + /* Add only a single device instance. */ + if (device_find_child(parent, "acpi_hp", -1) != NULL) + return; + + /* Make sure acpi_wmi driver is present. */ + if (devclass_find("acpi_wmi") == NULL) + return; + + /* + * Add our device with late order, so that it is hopefully + * probed after acpi_wmi. + * XXX User proper constant instead of UINT_MAX for order. + */ + if (BUS_ADD_CHILD(parent, UINT_MAX, "acpi_hp", -1) == NULL) + device_printf(parent, "add acpi_hp child failed\n"); +} + static int acpi_hp_probe(device_t dev) { - if (acpi_disabled("hp") || device_get_unit(dev) != 0) + + /* Skip auto-enumerated devices from ACPI namespace. */ + if (acpi_get_handle(dev) != NULL) return (ENXIO); device_set_desc(dev, "HP ACPI-WMI Mapping"); @@ -460,7 +489,6 @@ acpi_hp_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - sc->handle = acpi_get_handle(dev); sc->has_notify = 0; sc->has_cmi = 0; sc->bluetooth_enable_if_radio_on = 0; @@ -477,7 +505,7 @@ acpi_hp_attach(device_t dev) sc->verbose = 0; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); - if (!(wmi_devclass = devclass_find ("acpi_wmi"))) { + if (!(wmi_devclass = devclass_find("acpi_wmi"))) { device_printf(dev, "Couldn't find acpi_wmi devclass\n"); return (EINVAL); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 08:31:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D4AF1065673; Mon, 6 Sep 2010 08:31:07 +0000 (UTC) (envelope-from prvs=1858bec45e=brian@FreeBSD.org) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by mx1.freebsd.org (Postfix) with ESMTP id 356E68FC13; Mon, 6 Sep 2010 08:31:06 +0000 (UTC) Received: from pd7ml1no-ssvc.prod.shaw.ca ([10.0.153.161]) by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 06 Sep 2010 02:16:05 -0600 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=AcJjKCdO+C1gfaz5PU+ZhOHJ3th58JHw7dR6QJZP96w= c=1 sm=1 a=vqC7KvwytMoA:10 a=VphdPIyG4kEA:10 a=MJPcHhXccCG8eBs0us8XwA==:17 a=6I5d2MoRAAAA:8 a=MMwg4So0AAAA:8 a=e1ekEgTtaHhNCCMSWWsA:9 a=KiRZqFuAG0I83v7jRoFa5SxRLwYA:4 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=WJ3hkfHDukgA:10 a=duOM1DhI603l9pXQBbIA:9 a=0GY1c-86W7Ef1ToZwOwrUyCg8T8A:4 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO store.lan.Awfulhak.org) ([70.79.162.198]) by pd7ml1no-dmz.prod.shaw.ca with ESMTP; 06 Sep 2010 02:16:04 -0600 Received: from store.lan.Awfulhak.org (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 9B3D5C433AC_C84A2A9B; Mon, 6 Sep 2010 08:13:29 +0000 (GMT) Received: from gw.Awfulhak.org (gw.lan.Awfulhak.org [172.16.0.1]) by store.lan.Awfulhak.org (Sophos Email Appliance) with ESMTP id 31E83C46125_C84A2A6F; Mon, 6 Sep 2010 08:13:26 +0000 (GMT) Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5]) by gw.Awfulhak.org (8.14.4/8.14.4) with ESMTP id o868DP33002825; Mon, 6 Sep 2010 01:13:25 -0700 (PDT) (envelope-from brian@FreeBSD.org) Date: Mon, 6 Sep 2010 01:13:18 -0700 From: Brian Somers To: Pawel Jakub Dawidek Message-ID: <20100906011318.3d5c0bb6@dev.lan.Awfulhak.org> In-Reply-To: <20100906064142.GF1900@garage.freebsd.pl> References: <201009060415.o864Fntq011178@svn.freebsd.org> <20100906064142.GF1900@garage.freebsd.pl> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/j2cXCpszxfWZhQdr56FEFYh"; protocol="application/pgp-signature" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212247 - head/sbin/fdisk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 08:31:07 -0000 --Sig_/j2cXCpszxfWZhQdr56FEFYh Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 6 Sep 2010 08:41:42 +0200 Pawel Jakub Dawidek wro= te: > On Mon, Sep 06, 2010 at 04:15:49AM +0000, Brian Somers wrote: > > Author: brian > > Date: Mon Sep 6 04:15:49 2010 > > New Revision: 212247 > > URL: http://svn.freebsd.org/changeset/base/212247 > >=20 > > Log: > > Handle geli-encrypted root disk devices. > [...] > > if ((rv =3D regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$", > > REG_EXTENDED)) !=3D 0) > > errx(1, "regcomp() failed (%d)", rv); > > - if ((rv =3D regexec(&re, rootfs.f_mntfromname, NMATCHES, rm, 0)) !=3D= 0) > > + strlcpy(dev, rootfs.f_mntfromname, sizeof (dev)); > > + if ((s =3D strstr(dev, ".eli")) !=3D NULL) > > + memmove(s, s+4, strlen(s + 4) + 1); > > + > > + if ((rv =3D regexec(&re, dev, NMATCHES, rm, 0)) !=3D 0) > > errx(1, > > "mounted root fs resource doesn't match expectations (regexec returned= %d)", > > rv); >=20 > Your assumption that .eli can only be present at the end of provider name > is incorrect. It can be eg. /dev/ad0s1a.eli.journal. >=20 > Another problem is that in memmove you cut the first 4 characters, not > the last 4 characters. >=20 > I'm not sure, but can't you simply extend regular expression to: >=20 > "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\.eli)?$" You've lost me here. I remove .eli from the device name specifically so th= at we handle it being *anywhere* in the string. Your suggestion only handles it = being at the end of the string. The memmove doesn't cut the first four characters, it cuts the ".eli" strin= g.... doesn't it? --=20 Brian Somers Don't _EVER_ lose your sense of humour ! --Sig_/j2cXCpszxfWZhQdr56FEFYh Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iQCVAwUBTISipQ7tvOdmanQhAQJd2QP/fWXS6diqEolCAG9LCj7D5JjN07i9RUpO jAl+aMan8wY1iFhJxt+DBuR5s1y7NC7OTldZRkWzG4CKC/d3RhkPOVrsq5X191JZ O4LFxfJpg++VEGqJM1ciUQQMYRKxYoM5az5ANoOhkvnucUWXLLPnupc0wtuhDTRf vmnC4yPhYCw= =wrh8 -----END PGP SIGNATURE----- --Sig_/j2cXCpszxfWZhQdr56FEFYh-- From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 09:59:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2209D10656D3; Mon, 6 Sep 2010 09:59:11 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1147D8FC1B; Mon, 6 Sep 2010 09:59: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 o869xARV037200; Mon, 6 Sep 2010 09:59:10 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o869xAVq037198; Mon, 6 Sep 2010 09:59:10 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009060959.o869xAVq037198@svn.freebsd.org> From: Brian Somers Date: Mon, 6 Sep 2010 09:59: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: r212253 - head/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 09:59:11 -0000 Author: brian Date: Mon Sep 6 09:59:10 2010 New Revision: 212253 URL: http://svn.freebsd.org/changeset/base/212253 Log: Document dhclient-enter-hooks and dhclient-exit-hooks and mention how to configure dhclient to clear the interface of IP numbers prior to configuring it. PR: 149351 MFC after: 2 weeks Modified: head/sbin/dhclient/dhclient-script.8 Modified: head/sbin/dhclient/dhclient-script.8 ============================================================================== --- head/sbin/dhclient/dhclient-script.8 Mon Sep 6 07:35:13 2010 (r212252) +++ head/sbin/dhclient/dhclient-script.8 Mon Sep 6 09:59:10 2010 (r212253) @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 1, 1997 +.Dd September 6, 2010 .Dt DHCLIENT-SCRIPT 8 .Os .Sh NAME @@ -218,6 +218,29 @@ if it has reason to believe they are val If not, it should exit with a nonzero value. .El .Pp +Before taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-enter-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +After taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-exit-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +These hooks scripts can be used to dynamically modify the enviornment at +appropriate times during the DHCP negotiations. +For example, if the administrator wishes to disable alias IP numbers on +the DHCP interface, they might want to put the following in +.Pa /etc/dhclient-enter-hooks : +.Bd -literal -offset indent +[ ."$reason" = .PREINIT ] && ifconfig $interface 0.0.0.0 +.Ed +.Pp The usual way to test a lease is to set up the network as with .Li REBIND (since this may be called to test more than one lease) and then ping @@ -239,6 +262,7 @@ but current scripts do not do this. .\" and bear the names of the operating systems on which they are intended .\" to work. .Sh SEE ALSO +.Xr sh 1 , .Xr dhclient.conf 5 , .Xr dhclient.leases 5 , .Xr dhclient 8 , From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 11:02:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AE1610656C6; Mon, 6 Sep 2010 11:02:51 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE1DF8FC0A; Mon, 6 Sep 2010 11:02: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 o86B2oDn044132; Mon, 6 Sep 2010 11:02:50 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86B2oA3044130; Mon, 6 Sep 2010 11:02:50 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201009061102.o86B2oA3044130@svn.freebsd.org> From: Christian Brueffer Date: Mon, 6 Sep 2010 11:02: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: r212254 - head/release/doc/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 11:02:51 -0000 Author: brueffer Date: Mon Sep 6 11:02:50 2010 New Revision: 212254 URL: http://svn.freebsd.org/changeset/base/212254 Log: sis(4) should work on all architectures now. Modified: head/release/doc/share/misc/dev.archlist.txt Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Mon Sep 6 09:59:10 2010 (r212253) +++ head/release/doc/share/misc/dev.archlist.txt Mon Sep 6 11:02:50 2010 (r212254) @@ -107,7 +107,6 @@ rum i386,amd64 run i386,amd64 safe i386,pc98,amd64 sbp i386,sparc64,ia64,amd64 -sis i386,pc98,ia64,amd64 sn i386,amd64 snc pc98 snd_ad1816 i386,amd64 From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 11:18:55 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F8C91065696; Mon, 6 Sep 2010 11:18:55 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 273EA8FC1F; Mon, 6 Sep 2010 11:18:54 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 9867B45CA0; Mon, 6 Sep 2010 13:18:53 +0200 (CEST) Received: from localhost (pdawidek.whl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id E522245C98; Mon, 6 Sep 2010 13:18:48 +0200 (CEST) Date: Mon, 6 Sep 2010 13:18:39 +0200 From: Pawel Jakub Dawidek To: Brian Somers Message-ID: <20100906111839.GB1851@garage.freebsd.pl> References: <201009060415.o864Fntq011178@svn.freebsd.org> <20100906064142.GF1900@garage.freebsd.pl> <20100906011318.3d5c0bb6@dev.lan.Awfulhak.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JgQwtEuHJzHdouWu" Content-Disposition: inline In-Reply-To: <20100906011318.3d5c0bb6@dev.lan.Awfulhak.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212247 - head/sbin/fdisk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 11:18:55 -0000 --JgQwtEuHJzHdouWu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 06, 2010 at 01:13:18AM -0700, Brian Somers wrote: > On Mon, 6 Sep 2010 08:41:42 +0200 Pawel Jakub Dawidek w= rote: > > Your assumption that .eli can only be present at the end of provider na= me > > is incorrect. It can be eg. /dev/ad0s1a.eli.journal. > >=20 > > Another problem is that in memmove you cut the first 4 characters, not > > the last 4 characters. > >=20 > > I'm not sure, but can't you simply extend regular expression to: > >=20 > > "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\.eli)?$" >=20 > You've lost me here. I remove .eli from the device name specifically so = that we > handle it being *anywhere* in the string. Your suggestion only handles i= t being > at the end of the string. >=20 > The memmove doesn't cut the first four characters, it cuts the ".eli" str= ing.... > doesn't it? Yes, sorry for the noice, my reading of the code was incorrect. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --JgQwtEuHJzHdouWu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyEzg4ACgkQForvXbEpPzQHHQCfZpO7tjgzY4JlOe6WXazO5CzZ /zYAnjoqf+i5vk9+fQa+9aDGymlNmhIg =6lkV -----END PGP SIGNATURE----- --JgQwtEuHJzHdouWu-- From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 12:55:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7559310656D1; Mon, 6 Sep 2010 12:55:08 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 452F68FC0A; Mon, 6 Sep 2010 12: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 o86Ct8sB049176; Mon, 6 Sep 2010 12:55:08 GMT (envelope-from philip@svn.freebsd.org) Received: (from philip@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86Ct8oN049174; Mon, 6 Sep 2010 12:55:08 GMT (envelope-from philip@svn.freebsd.org) Message-Id: <201009061255.o86Ct8oN049174@svn.freebsd.org> From: Philip Paeps Date: Mon, 6 Sep 2010 12:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212255 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 12:55:08 -0000 Author: philip Date: Mon Sep 6 12:55:07 2010 New Revision: 212255 URL: http://svn.freebsd.org/changeset/base/212255 Log: Restore Thomas Quinot's (thomas) commit bit per his request. Approved by: core Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Mon Sep 6 11:02:50 2010 (r212254) +++ svnadmin/conf/access Mon Sep 6 12:55:07 2010 (r212255) @@ -221,6 +221,7 @@ suz syrinx takawata tanimura +thomas thompsa ticso tijl From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 13:17:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FC8710656A3; Mon, 6 Sep 2010 13:17:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F23A8FC1C; Mon, 6 Sep 2010 13:17: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 o86DH2GP049821; Mon, 6 Sep 2010 13:17:02 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86DH2ue049818; Mon, 6 Sep 2010 13:17:02 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201009061317.o86DH2ue049818@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 6 Sep 2010 13:17: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: r212256 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 13:17:02 -0000 Author: glebius Date: Mon Sep 6 13:17:01 2010 New Revision: 212256 URL: http://svn.freebsd.org/changeset/base/212256 Log: in_delayed_cksum() requires host byte order. Reported by: Alexander Levin MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_fw_nat.c Modified: head/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_nat.c Mon Sep 6 12:55:07 2010 (r212255) +++ head/sys/netinet/ipfw/ip_fw_nat.c Mon Sep 6 13:17:01 2010 (r212256) @@ -295,12 +295,9 @@ ipfw_nat(struct ip_fw_args *args, struct struct udphdr *uh; u_short cksum; - /* XXX check if ip_len can stay in net format */ - cksum = in_pseudo( - ip->ip_src.s_addr, - ip->ip_dst.s_addr, - htons(ip->ip_p + ntohs(ip->ip_len) - (ip->ip_hl << 2)) - ); + ip->ip_len = ntohs(ip->ip_len); + cksum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons(ip->ip_p + ip->ip_len - (ip->ip_hl << 2))); switch (ip->ip_p) { case IPPROTO_TCP: @@ -326,6 +323,7 @@ ipfw_nat(struct ip_fw_args *args, struct in_delayed_cksum(mcl); mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } + ip->ip_len = htons(ip->ip_len); } args->m = mcl; return (IP_FW_NAT); From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 13:45:22 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E25A10656C1; Mon, 6 Sep 2010 13:45:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id AAD1A8FC08; Mon, 6 Sep 2010 13:45:21 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o86DjI8l022156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 6 Sep 2010 23:45:19 +1000 Date: Mon, 6 Sep 2010 23:45:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: pluknet In-Reply-To: Message-ID: <20100906234057.O954@delplex.bde.org> References: <201009031723.o83HNR7k056625@svn.freebsd.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-78721968-1283780718=:954" Cc: svn-src-head@FreeBSD.org, Matthew D Fleming , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212182 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 13:45:22 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-78721968-1283780718=:954 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 3 Sep 2010, pluknet wrote: > On 3 September 2010 21:23, Matthew D Fleming wrote: >> Log: >> =A0Fix user-space libsbuf build. =A0Why isn't CTASSERT available to >> =A0user-space? Well, user headers shouldn't be enlisted to check for kernel bugs that can be checked well enough in the kernel. >> Modified: >> =A0head/sys/kern/subr_sbuf.c >> >> Modified: head/sys/kern/subr_sbuf.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/kern/subr_sbuf.c =A0 Fri Sep =A03 16:12:39 2010 =A0 =A0 =A0= =A0(r212181) >> +++ head/sys/kern/subr_sbuf.c =A0 Fri Sep =A03 17:23:26 2010 =A0 =A0 =A0= =A0(r212182) >> @@ -116,8 +116,10 @@ _assert_sbuf_state(const char *fun, stru >> >> =A0#endif /* _KERNEL && INVARIANTS */ >> >> +#ifdef _KERNEL >> =A0CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); >> =A0CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); >> +#endif >> >> =A0static int >> =A0sbuf_extendsize(int size) > > Hi, > > as I can see, the next (and maybe preferred) model is used in system head= ers: > > #ifdef CTASSERT > CTASSERT(...); > #endif Needed, even in the kernel, since CTASSERT() is only defined if the kernel-only header has been included. If this macro were defined in a user header, then it would have to be more global (probably defined in ) but not in the application namespace (probably spelled __CTASSERT()), so it would be uglier. Bruce --0-78721968-1283780718=:954-- From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 15:48:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E57F51065694; Mon, 6 Sep 2010 15:48:06 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D42FE8FC0A; Mon, 6 Sep 2010 15:48: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 o86Fm6qx054951; Mon, 6 Sep 2010 15:48:06 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86Fm6QM054949; Mon, 6 Sep 2010 15:48:06 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009061548.o86Fm6QM054949@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 6 Sep 2010 15:48:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212258 - stable/7/sbin/bsdlabel X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 15:48:07 -0000 Author: jh Date: Mon Sep 6 15:48:06 2010 New Revision: 212258 URL: http://svn.freebsd.org/changeset/base/212258 Log: MFC r211342: - Check that strtoul(3) succeeds to convert the entire string in a few places. - In getasciilabel(), set the disk type only when a valid type is given. PR: bin/86765 Modified: stable/7/sbin/bsdlabel/bsdlabel.c Directory Properties: stable/7/sbin/bsdlabel/ (props changed) Modified: stable/7/sbin/bsdlabel/bsdlabel.c ============================================================================== --- stable/7/sbin/bsdlabel/bsdlabel.c Mon Sep 6 13:47:11 2010 (r212257) +++ stable/7/sbin/bsdlabel/bsdlabel.c Mon Sep 6 15:48:06 2010 (r212258) @@ -727,7 +727,7 @@ word(char *cp) static int getasciilabel(FILE *f, struct disklabel *lp) { - char *cp; + char *cp, *endp; const char **cpp; u_int part; char *tp, line[BUFSIZ]; @@ -766,11 +766,15 @@ getasciilabel(FILE *f, struct disklabel } if (cpp < &dktypenames[DKMAXTYPES]) continue; - v = strtoul(tp, NULL, 10); + errno = 0; + v = strtoul(tp, &endp, 10); + if (errno != 0 || *endp != '\0') + v = DKMAXTYPES; if (v >= DKMAXTYPES) fprintf(stderr, "line %d:%s %lu\n", lineno, "Warning, unknown disk type", v); - lp->d_type = v; + else + lp->d_type = v; continue; } if (!strcmp(cp, "flags")) { @@ -995,7 +999,7 @@ static int getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno) { struct partition *pp; - char *cp; + char *cp, *endp; const char **cpp; u_long v; @@ -1031,9 +1035,12 @@ getasciipartspec(char *tp, struct diskla if (*cpp != NULL) { pp->p_fstype = cpp - fstypenames; } else { - if (isdigit(*cp)) - v = strtoul(cp, NULL, 10); - else + if (isdigit(*cp)) { + errno = 0; + v = strtoul(cp, &endp, 10); + if (errno != 0 || *endp != '\0') + v = FSMAXTYPES; + } else v = FSMAXTYPES; if (v >= FSMAXTYPES) { fprintf(stderr, From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 15:49:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9547B10656CB; Mon, 6 Sep 2010 15:49:06 +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 66A0D8FC1B; Mon, 6 Sep 2010 15:49:06 +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 022EE46B09; Mon, 6 Sep 2010 11:49:06 -0400 (EDT) Received: from zion.baldwin.cx (c-68-45-19-154.hsd1.nj.comcast.net [68.45.19.154]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C3EE68A04E; Mon, 6 Sep 2010 11:48:55 -0400 (EDT) From: John Baldwin To: Andriy Gapon Date: Mon, 6 Sep 2010 11:28:40 -0400 User-Agent: KMail/1.12.4 (FreeBSD/7.3-STABLE; KDE/4.3.4; i386; ; ) References: <201009060734.o867YWH8022846@svn.freebsd.org> In-Reply-To: <201009060734.o867YWH8022846@svn.freebsd.org> MIME-Version: 1.0 Message-Id: <201009061128.40344.jhb@freebsd.org> Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 06 Sep 2010 11:48:55 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no 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: r212251 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 15:49:06 -0000 On Monday 06 September 2010 03:34:32 am Andriy Gapon wrote: > Author: avg > Date: Mon Sep 6 07:34:32 2010 > New Revision: 212251 > URL: http://svn.freebsd.org/changeset/base/212251 > > Log: > acpi_hp: fix bus attachment code > > - add identify method to create driver's own device_t > - successfully probe only driver's own device_t instead of any device_t > - (ab)use device order to hopefully be probed/attached after acpi_wmi Perhaps this should be a child of acpi_wmi0 instead? That would fix the ordering issue as well as remove the need to avoid "real" ACPI devices in the attach routine. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 19:00:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABA4610656FC; Mon, 6 Sep 2010 19:00:00 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E4888FC1E; Mon, 6 Sep 2010 19:00: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 o86J00kq060928; Mon, 6 Sep 2010 19:00:00 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86J00AU060925; Mon, 6 Sep 2010 19:00:00 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201009061900.o86J00AU060925@svn.freebsd.org> From: Andreas Tobler Date: Mon, 6 Sep 2010 19:00: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: r212260 - in head: share/misc usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 19:00:00 -0000 Author: andreast Date: Mon Sep 6 19:00:00 2010 New Revision: 212260 URL: http://svn.freebsd.org/changeset/base/212260 Log: Add myself to calendar.freebsd and committers-src.dot. Approved by: nwhitehorn (mentor) Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Mon Sep 6 16:33:46 2010 (r212259) +++ head/share/misc/committers-src.dot Mon Sep 6 19:00:00 2010 (r212260) @@ -58,6 +58,7 @@ akiyama [label="Shunsuke Akiyama\nakiyam ambrisko [label="Doug Ambrisko\nambrisko@FreeBSD.org\n2001/12/19"] anchie [label="Ana Kukec\nanchie@FreeBSD.org\n2010/04/14"] andre [label="Andre Oppermann\nandre@FreeBSD.org\n2003/11/12"] +andreast [label="Andreas Tobler\nandreast@FreeBSD.org\n2010/09/05"] andrew [label="Andrew Turner\nandrew@FreeBSD.org\n2010/07/19"] anholt [label="Eric Anholt\nanholt@FreeBSD.org\n2002/04/22"] antoine [label="Antoine Brodin\nantoine@FreeBSD.org\n2008/02/03"] Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Sep 6 16:33:46 2010 (r212259) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Sep 6 19:00:00 2010 (r212260) @@ -180,6 +180,7 @@ 06/19 Charlie Root born in Portland, Oregon, United States, 1993 06/21 Ganbold Tsagaankhuu born in Ulaanbaatar, Mongolia, 1971 06/21 Niels Heinen born in Markelo, the Netherlands, 1978 +06/22 Andreas Tobler born in Heiden, Switzerland, 1968 06/24 Chris Faulhaber born in Springfield, Illinois, United States, 1971 06/26 Brian Somers born in Dundrum, Dublin, Ireland, 1967 06/28 Mark Santcroos born in Rotterdam, the Netherlands, 1979 From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 20:16:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 297D710656AC; Mon, 6 Sep 2010 20:16:11 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18F958FC15; Mon, 6 Sep 2010 20:16: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 o86KGAhI063514; Mon, 6 Sep 2010 20:16:10 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86KGAGt063512; Mon, 6 Sep 2010 20:16:10 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201009062016.o86KGAGt063512@svn.freebsd.org> From: Andreas Tobler Date: Mon, 6 Sep 2010 20:16: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: r212261 - head/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 20:16:11 -0000 Author: andreast Date: Mon Sep 6 20:16:10 2010 New Revision: 212261 URL: http://svn.freebsd.org/changeset/base/212261 Log: Point out who is my mentor. Approved by: nwhitehorn (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Mon Sep 6 19:00:00 2010 (r212260) +++ head/share/misc/committers-src.dot Mon Sep 6 20:16:10 2010 (r212261) @@ -411,6 +411,8 @@ njl -> philip njl -> rpaulo njl -> sepotvin +nwhitehorn -> andreast + obrien -> benno obrien -> groudier obrien -> gshapiro From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 20:35:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A16C10656D7; Mon, 6 Sep 2010 20:35:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 891A48FC16; Mon, 6 Sep 2010 20:35: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 o86KZmQq064313; Mon, 6 Sep 2010 20:35:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86KZm9f064310; Mon, 6 Sep 2010 20:35:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009062035.o86KZm9f064310@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 6 Sep 2010 20:35:48 +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: r212262 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 20:35:48 -0000 Author: kib Date: Mon Sep 6 20:35:48 2010 New Revision: 212262 URL: http://svn.freebsd.org/changeset/base/212262 Log: Add aesni(4) manpage. Added: head/share/man/man4/aesni.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Sep 6 20:16:10 2010 (r212261) +++ head/share/man/man4/Makefile Mon Sep 6 20:35:48 2010 (r212262) @@ -18,6 +18,7 @@ MAN= aac.4 \ adv.4 \ adw.4 \ ae.4 \ + ${_aesni.4} \ age.4 \ agp.4 \ aha.4 \ @@ -638,6 +639,7 @@ _acpi_panasonic.4=acpi_panasonic.4 _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 _acpi_wmi.4= acpi_wmi.4 +_aesni.4= aesni.4 _aibs.4= aibs.4 _amdsbwd.4= amdsbwd.4 _amdsmb.4= amdsmb.4 Added: head/share/man/man4/aesni.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/aesni.4 Mon Sep 6 20:35:48 2010 (r212262) @@ -0,0 +1,91 @@ +.\" Copyright (c) 2010 Konstantin Belousov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 6, 2010 +.Dt AESNI 4 +.Os +.Sh NAME +.Nm aesni +.Nd "driver for the AES accelerator on Intel CPUs" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device crypto" +.Cd "device aesni" +.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 +aesni_load="YES" +.Ed +.Sh DESCRIPTION +Starting with some models of Core i5/i7, Intel processors implement +new set of instructions called AESNI. +The set of six instructions accelerates the calculation of the key +schedule for key lengths of 128, 192, and 256 of the Advanced +Encryption Standard (AES) symmetric cipher, and provides the hardware +implementation of the regular and the last encryption and decryption +rounds. +.Pp +The processor capability is reported as AESNI in the Features2 line +at the boot. Driver does not attach on the system that lacks the +required CPU capability. +.Pp +The +.Nm +driver registers itself to accelerate AES operations for +.Xr crypto 4 . +Besides speed, advantage of using the driver is that the AESNI operation +is data-independend, thus eliminating some attack vectors based on the +measuring cache use and timings, typically present in the table-driven +implementations. +.Sh SEE ALSO +.Xr crypt 3 , +.Xr crypto 4 , +.Xr intro 4 , +.Xr ipsec 4 , +.Xr padlock 4 , +.Xr random 4 , +.Xr crypto 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 9.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Konstantin Belousov Aq kib@FreeBSD.org . +The key schedule calculation code was adopted from the sample provided +by Intel and used in the analogous +.Ox +driver. From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 20:40:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEB9D10656A6; Mon, 6 Sep 2010 20:40:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE9788FC19; Mon, 6 Sep 2010 20:40: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 o86KecaE064503; Mon, 6 Sep 2010 20:40:38 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86Kecit064501; Mon, 6 Sep 2010 20:40:38 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201009062040.o86Kecit064501@svn.freebsd.org> From: Glen Barber Date: Mon, 6 Sep 2010 20:40: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: r212263 - head/usr.bin/cpio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 20:40:38 -0000 Author: gjb (doc committer) Date: Mon Sep 6 20:40:38 2010 New Revision: 212263 URL: http://svn.freebsd.org/changeset/base/212263 Log: Fix typo in bsdcpio manual: s/libarchive_formats/libarchive-formats PR: 150300 Submitted by: Kurt Jaeger Patch by: Kurt Jaeger Approved by: keramida (mentor) MFC after: 1 week Modified: head/usr.bin/cpio/bsdcpio.1 Modified: head/usr.bin/cpio/bsdcpio.1 ============================================================================== --- head/usr.bin/cpio/bsdcpio.1 Mon Sep 6 20:35:48 2010 (r212262) +++ head/usr.bin/cpio/bsdcpio.1 Mon Sep 6 20:40:38 2010 (r212263) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2007 +.Dd September 5, 2010 .Dt BSDCPIO 1 .Os .Sh NAME @@ -140,7 +140,7 @@ The POSIX.1 tar format. The default format is .Ar odc . See -.Xr libarchive_formats 5 +.Xr libarchive-formats 5 for more complete information about the formats currently supported by the underlying .Xr libarchive 3 From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 21:03:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A911A10656A9; Mon, 6 Sep 2010 21:03:30 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98F4C8FC1D; Mon, 6 Sep 2010 21:03: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 o86L3UTU065252; Mon, 6 Sep 2010 21:03:30 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86L3UHT065250; Mon, 6 Sep 2010 21:03:30 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201009062103.o86L3UHT065250@svn.freebsd.org> From: Will Andrews Date: Mon, 6 Sep 2010 21:03: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: r212265 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 21:03:30 -0000 Author: will Date: Mon Sep 6 21:03:30 2010 New Revision: 212265 URL: http://svn.freebsd.org/changeset/base/212265 Log: Fix static kernel builds with carp(4) by changing its SYSINIT order so that it is initialized after basic protocol initialization, which allows it to register via pf_proto_register(). Reviewed by: bz Approved by: ken (mentor) Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Mon Sep 6 20:51:35 2010 (r212264) +++ head/sys/netinet/ip_carp.c Mon Sep 6 21:03:30 2010 (r212265) @@ -2405,4 +2405,4 @@ static moduledata_t carp_mod = { 0 }; -DECLARE_MODULE(carp, carp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(carp, carp_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 21:06:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AC1C10656C6; Mon, 6 Sep 2010 21:06:06 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AC578FC12; Mon, 6 Sep 2010 21: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 o86L66GJ065392; Mon, 6 Sep 2010 21:06:06 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86L667a065390; Mon, 6 Sep 2010 21:06:06 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201009062106.o86L667a065390@svn.freebsd.org> From: Will Andrews Date: Mon, 6 Sep 2010 21: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: r212266 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 21:06:06 -0000 Author: will Date: Mon Sep 6 21:06:06 2010 New Revision: 212266 URL: http://svn.freebsd.org/changeset/base/212266 Log: Fix CARP in backup mode by properly registering its hooks for INET and INET6 using ipproto_{un,}register() and the newly created ip6proto_{un,}register() so that it can again receive IPPROTO_CARP packets allowing its state machine to work. Reviewed by: bz Approved by: ken (mentor) Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Mon Sep 6 21:03:30 2010 (r212265) +++ head/sys/netinet/ip_carp.c Mon Sep 6 21:06:06 2010 (r212266) @@ -2313,6 +2313,7 @@ carp_mod_cleanup(void) if_clone_detach(&carp_cloner); #ifdef INET if (proto_reg[CARP_INET] == 0) { + (void)ipproto_unregister(IPPROTO_CARP); pf_proto_unregister(PF_INET, IPPROTO_CARP, SOCK_RAW); proto_reg[CARP_INET] = -1; } @@ -2320,6 +2321,7 @@ carp_mod_cleanup(void) #endif #ifdef INET6 if (proto_reg[CARP_INET6] == 0) { + (void)ip6proto_unregister(IPPROTO_CARP); pf_proto_unregister(PF_INET6, IPPROTO_CARP, SOCK_RAW); proto_reg[CARP_INET6] = -1; } @@ -2335,6 +2337,7 @@ carp_mod_cleanup(void) static int carp_mod_load(void) { + int err; if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, carp_ifdetach, NULL, EVENTHANDLER_PRI_ANY); @@ -2357,6 +2360,12 @@ carp_mod_load(void) carp_mod_cleanup(); return (EINVAL); } + err = ip6proto_register(IPPROTO_CARP); + if (err) { + printf("carp: error %d registering with INET6\n", err); + carp_mod_cleanup(); + return (EINVAL); + } #endif #ifdef INET carp_iamatch_p = carp_iamatch; @@ -2367,6 +2376,12 @@ carp_mod_load(void) carp_mod_cleanup(); return (EINVAL); } + err = ipproto_register(IPPROTO_CARP); + if (err) { + printf("carp: error %d registering with INET\n", err); + carp_mod_cleanup(); + return (EINVAL); + } #endif return 0; } From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 21:29:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28EB81065695; Mon, 6 Sep 2010 21:29:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 186928FC18; Mon, 6 Sep 2010 21:29: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 o86LTLHK066256; Mon, 6 Sep 2010 21:29:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86LTLV7066254; Mon, 6 Sep 2010 21:29:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009062129.o86LTLV7066254@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 6 Sep 2010 21:29: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: r212268 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 21:29:22 -0000 Author: kib Date: Mon Sep 6 21:29:21 2010 New Revision: 212268 URL: http://svn.freebsd.org/changeset/base/212268 Log: Grammar fixes. Submitted by: Ben Kaduk , Valentin Nechaev Modified: head/share/man/man4/aesni.4 Modified: head/share/man/man4/aesni.4 ============================================================================== --- head/share/man/man4/aesni.4 Mon Sep 6 21:06:11 2010 (r212267) +++ head/share/man/man4/aesni.4 Mon Sep 6 21:29:21 2010 (r212268) @@ -47,24 +47,23 @@ aesni_load="YES" .Ed .Sh DESCRIPTION Starting with some models of Core i5/i7, Intel processors implement -new set of instructions called AESNI. +a new set of instructions called AESNI. The set of six instructions accelerates the calculation of the key schedule for key lengths of 128, 192, and 256 of the Advanced -Encryption Standard (AES) symmetric cipher, and provides the hardware +Encryption Standard (AES) symmetric cipher, and provides hardware implementation of the regular and the last encryption and decryption rounds. .Pp -The processor capability is reported as AESNI in the Features2 line -at the boot. Driver does not attach on the system that lacks the -required CPU capability. +The processor capability is reported as AESNI in the Features2 line at boot. +Driver does not attach on the system that lacks the required CPU capability. .Pp The .Nm driver registers itself to accelerate AES operations for .Xr crypto 4 . -Besides speed, advantage of using the driver is that the AESNI operation -is data-independend, thus eliminating some attack vectors based on the -measuring cache use and timings, typically present in the table-driven +Besides speed, the advantage of using the driver is that the AESNI operation +is data-independent, thus eliminating some attack vectors based on +measuring cache use and timings typically present in the table-driven implementations. .Sh SEE ALSO .Xr crypt 3 , From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 21:39:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 520981065672; Mon, 6 Sep 2010 21:39:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41C9C8FC18; Mon, 6 Sep 2010 21:39: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 o86LdtSC066579; Mon, 6 Sep 2010 21:39:55 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86LdtlS066577; Mon, 6 Sep 2010 21:39:55 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201009062139.o86LdtlS066577@svn.freebsd.org> From: Glen Barber Date: Mon, 6 Sep 2010 21:39: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: r212269 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 21:39:55 -0000 Author: gjb (doc committer) Date: Mon Sep 6 21:39:54 2010 New Revision: 212269 URL: http://svn.freebsd.org/changeset/base/212269 Log: Add ECONNRESET to list of possible errors in connect(2). PR: 148683 Submitted by: Gennady Proskurin Approved by: keramida (mentor) MFC after: 1 week Modified: head/lib/libc/sys/connect.2 Modified: head/lib/libc/sys/connect.2 ============================================================================== --- head/lib/libc/sys/connect.2 Mon Sep 6 21:29:21 2010 (r212268) +++ head/lib/libc/sys/connect.2 Mon Sep 6 21:39:54 2010 (r212269) @@ -28,7 +28,7 @@ .\" @(#)connect.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 16, 2006 +.Dd September 5, 2010 .Dt CONNECT 2 .Os .Sh NAME @@ -95,6 +95,8 @@ The socket is already connected. Connection establishment timed out without establishing a connection. .It Bq Er ECONNREFUSED The attempt to connect was forcefully rejected. +.It Bq Er ECONNRESET +The connection was reset by the remote host. .It Bq Er ENETUNREACH The network is not reachable from this host. .It Bq Er EHOSTUNREACH From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 22:02:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42A8F10656B8; Mon, 6 Sep 2010 22:02:09 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 325E88FC31; Mon, 6 Sep 2010 22:02: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 o86M29FK067329; Mon, 6 Sep 2010 22:02:09 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86M29b4067327; Mon, 6 Sep 2010 22:02:09 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009062202.o86M29b4067327@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 22:02:09 +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: r212270 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:02:09 -0000 Author: weongyo Date: Mon Sep 6 22:02:08 2010 New Revision: 212270 URL: http://svn.freebsd.org/changeset/base/212270 Log: Adds bwi(4) at SEE ALSO section because some old devices aren't supported by the bwn(4) firmware that as fas as I know the vendor dropped its support. Bumps date also. Modified: head/share/man/man4/bwn.4 Modified: head/share/man/man4/bwn.4 ============================================================================== --- head/share/man/man4/bwn.4 Mon Sep 6 21:39:54 2010 (r212269) +++ head/share/man/man4/bwn.4 Mon Sep 6 22:02:08 2010 (r212270) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2010 +.Dd September 6, 2010 .Dt BWN 4 .Os .Sh NAME @@ -112,6 +112,7 @@ ifconfig wlan create wlandev bwn0 ssid m .Ed .Sh SEE ALSO .Xr arp 4 , +.Xr bwi 4 , .Xr cardbus 4 , .Xr intro 4 , .Xr pci 4 , From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 22:10:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD1D10656A6; Mon, 6 Sep 2010 22:10:57 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAB698FC1E; Mon, 6 Sep 2010 22:10: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 o86MAvqx067693; Mon, 6 Sep 2010 22:10:57 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86MAvxg067691; Mon, 6 Sep 2010 22:10:57 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009062210.o86MAvxg067691@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 22:10: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: r212271 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:10:58 -0000 Author: weongyo Date: Mon Sep 6 22:10:57 2010 New Revision: 212271 URL: http://svn.freebsd.org/changeset/base/212271 Log: Adds a CAVEATS section to mention DMA issues that currently only a solution is using PIO mode. As fas as I know all open source based broadcom drivers for specially LP PHY has this issue because it's a reverse engineered driver from wl(4). Pointed by: Warren Block Modified: head/share/man/man4/bwn.4 Modified: head/share/man/man4/bwn.4 ============================================================================== --- head/share/man/man4/bwn.4 Mon Sep 6 22:02:08 2010 (r212270) +++ head/share/man/man4/bwn.4 Mon Sep 6 22:10:57 2010 (r212271) @@ -125,6 +125,9 @@ The .Nm driver first appeared in .Fx 8.1 . +.Sh CAVEATS +Some LP PHY devices have DMA operation problems that in that case try to +use PIO mode. .Sh AUTHORS .An -nosplit The From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 22:23:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FE291065673; Mon, 6 Sep 2010 22:23:36 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F9068FC14; Mon, 6 Sep 2010 22:23: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 o86MNZnL068126; Mon, 6 Sep 2010 22:23:35 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86MNZQC068124; Mon, 6 Sep 2010 22:23:35 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009062223.o86MNZQC068124@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 22:23: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: r212272 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:23:36 -0000 Author: weongyo Date: Mon Sep 6 22:23:35 2010 New Revision: 212272 URL: http://svn.freebsd.org/changeset/base/212272 Log: Adds LOADER TUNABLES section to mention knobs which could be controlled by loader(8) interface. Modified: head/share/man/man4/bwn.4 Modified: head/share/man/man4/bwn.4 ============================================================================== --- head/share/man/man4/bwn.4 Mon Sep 6 22:10:57 2010 (r212271) +++ head/share/man/man4/bwn.4 Mon Sep 6 22:23:35 2010 (r212272) @@ -110,6 +110,20 @@ Join a specific BSS network with 64-bit ifconfig wlan create wlandev bwn0 ssid my_net \e wepmode on wepkey 0x1234567890 weptxkey 1 up .Ed +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va hw.bwn.msi_disable +This tunable disables MSI support on the hardware. +The default value is 0. +.It Va hw.bwn.usedma +This tunable enables DMA operations on the hardware. +If the value is 0, PIO mode would be used. +The default value is 1. +.El .Sh SEE ALSO .Xr arp 4 , .Xr bwi 4 , From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 22:28:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 984DF10656E7; Mon, 6 Sep 2010 22:28:47 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40B828FC17; Mon, 6 Sep 2010 22:28: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 o86MSlQF068319; Mon, 6 Sep 2010 22:28:47 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86MSl3T068317; Mon, 6 Sep 2010 22:28:47 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009062228.o86MSl3T068317@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 22:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212273 - stable/8/sys/dev/bwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:28:47 -0000 Author: weongyo Date: Mon Sep 6 22:28:46 2010 New Revision: 212273 URL: http://svn.freebsd.org/changeset/base/212273 Log: MFC r210393: Fixes a mistake to calculate CALC_COEFF2() value that tmp[3] is used even if it's unreachable. PR: kern/144505 Submitted by: Henning Petersen Modified: stable/8/sys/dev/bwn/if_bwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bwn/if_bwn.c ============================================================================== --- stable/8/sys/dev/bwn/if_bwn.c Mon Sep 6 22:23:35 2010 (r212272) +++ stable/8/sys/dev/bwn/if_bwn.c Mon Sep 6 22:28:46 2010 (r212273) @@ -12828,9 +12828,9 @@ bwn_phy_lp_calc_rx_iq_comp(struct bwn_ma int _t; \ _t = _x - 11; \ if (_t >= 0) \ - tmp[3] = (_y << (31 - _x)) / (_z >> _t); \ + _v = (_y << (31 - _x)) / (_z >> _t); \ else \ - tmp[3] = (_y << (31 - _x)) / (_z << -_t); \ + _v = (_y << (31 - _x)) / (_z << -_t); \ } while (0) struct bwn_phy_lp_iq_est ie; uint16_t v0, v1; From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 22:31:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5D0C1065674; Mon, 6 Sep 2010 22:31:24 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D49538FC0A; Mon, 6 Sep 2010 22:31: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 o86MVOpH068462; Mon, 6 Sep 2010 22:31:24 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86MVOKH068460; Mon, 6 Sep 2010 22:31:24 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009062231.o86MVOKH068460@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 22:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212274 - stable/8/sys/dev/bwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:31:25 -0000 Author: weongyo Date: Mon Sep 6 22:31:24 2010 New Revision: 212274 URL: http://svn.freebsd.org/changeset/base/212274 Log: MFC r209888: Fixes a bug for LP PHY that some frames have 2 padding bytes at the start so we should adjust the mbuf if the driver is running in PIO mode. Now it should work well with WPA authentication and association for LP PHY devices. Tested by: Warren Block Modified: stable/8/sys/dev/bwn/if_bwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bwn/if_bwn.c ============================================================================== --- stable/8/sys/dev/bwn/if_bwn.c Mon Sep 6 22:28:46 2010 (r212273) +++ stable/8/sys/dev/bwn/if_bwn.c Mon Sep 6 22:31:24 2010 (r212274) @@ -9073,7 +9073,7 @@ bwn_pio_rxeof(struct bwn_pio_rxqueue *pr struct mbuf *m; uint32_t ctl32, macstat, v32; unsigned int i, padding; - uint16_t ctl16, len, v16; + uint16_t ctl16, len, totlen, v16; unsigned char *mp; char *data; @@ -9132,7 +9132,8 @@ ready: } padding = (macstat & BWN_RX_MAC_PADDING) ? 2 : 0; - KASSERT(len + padding <= MCLBYTES, ("too big..\n")); + totlen = len + padding; + KASSERT(totlen <= MCLBYTES, ("too big..\n")); m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { device_printf(sc->sc_dev, "%s: out of memory", __func__); @@ -9140,12 +9141,12 @@ ready: } mp = mtod(m, unsigned char *); if (prq->prq_rev >= 8) { - siba_read_multi_4(sc->sc_dev, mp + padding, (len & ~3), + siba_read_multi_4(sc->sc_dev, mp, (totlen & ~3), prq->prq_base + BWN_PIO8_RXDATA); - if (len & 3) { + if (totlen & 3) { v32 = bwn_pio_rx_read_4(prq, BWN_PIO8_RXDATA); - data = &(mp[len + padding - 1]); - switch (len & 3) { + data = &(mp[totlen - 1]); + switch (totlen & 3) { case 3: *data = (v32 >> 16); data--; @@ -9157,16 +9158,16 @@ ready: } } } else { - siba_read_multi_2(sc->sc_dev, mp + padding, (len & ~1), + siba_read_multi_2(sc->sc_dev, mp, (totlen & ~1), prq->prq_base + BWN_PIO_RXDATA); - if (len & 1) { + if (totlen & 1) { v16 = bwn_pio_rx_read_2(prq, BWN_PIO_RXDATA); - mp[len + padding - 1] = v16; + mp[totlen - 1] = v16; } } m->m_pkthdr.rcvif = ifp; - m->m_len = m->m_pkthdr.len = len + padding; + m->m_len = m->m_pkthdr.len = totlen; bwn_rxeof(prq->prq_mac, m, &rxhdr); From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 22:31:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5F9910656B9; Mon, 6 Sep 2010 22:31:54 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 558E08FC1B; Mon, 6 Sep 2010 22:31:54 +0000 (UTC) Received: by ywt2 with SMTP id 2so2043356ywt.13 for ; Mon, 06 Sep 2010 15:31:53 -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=redaSvLhhIiTmqD7RPshdf487A0lyuS/WlajIyi/wCs=; b=FmHYP81lbITQ7EpiSNsbLLi+1drVvhAq4ZTFJYvY0A7xvw6ZitOxrpYTgo+Om7F0HD TvCprNpeVMwxswIVstyVUh7gqIT+oICLz8tU8n9p082l0/yD6BHmbla8wz+iZ4p8gJFw C2W20K1qRW/n2dGWpY/I3GZEJa9Dm8SLGu788= 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=Z+z3sA6n40IWY6WtlT2E7XALp8rDI48buDM/FyeXzKGoJsbKH8i59s4CHNUv43inAF SaIYxcwoHeDcTFtOKIQVFvngFr+BgRQ8QVH7I+KgnmbqeF3+3ZoNsXD2lo0DHdXcMmSn Bdo0YYuEcX0EMG9WDboyzkPSjpi3ToZoJDUFk= MIME-Version: 1.0 Received: by 10.100.53.30 with SMTP id b30mr302551ana.43.1283812313579; Mon, 06 Sep 2010 15:31:53 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.100.126.20 with HTTP; Mon, 6 Sep 2010 15:31:53 -0700 (PDT) In-Reply-To: <20100906234057.O954@delplex.bde.org> References: <201009031723.o83HNR7k056625@svn.freebsd.org> <20100906234057.O954@delplex.bde.org> Date: Mon, 6 Sep 2010 15:31:53 -0700 X-Google-Sender-Auth: XPwcSz0-XCXb8zdqmNQU09hyKLs Message-ID: From: mdf@FreeBSD.org To: Bruce Evans Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, pluknet , src-committers@freebsd.org Subject: Re: svn commit: r212182 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:31:55 -0000 On Mon, Sep 6, 2010 at 6:45 AM, Bruce Evans wrote: > On Fri, 3 Sep 2010, pluknet wrote: > >> On 3 September 2010 21:23, Matthew D Fleming wrote: >>> >>> Log: >>> =A0Fix user-space libsbuf build. =A0Why isn't CTASSERT available to >>> =A0user-space? > > Well, user headers shouldn't be enlisted to check for kernel bugs that > can be checked well enough in the kernel. I agree, but in this case one could define different constants for user space and kernel space, and the code could be wrong only for user-space, where there isn't a compile-time assert. I do always appreciate style and standards advice from Mr Bruce. It's the only way to learn (usually, hopefully, from other people's mistakes ;-) Thanks, matthew >>> Modified: >>> =A0head/sys/kern/subr_sbuf.c >>> >>> Modified: head/sys/kern/subr_sbuf.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/kern/subr_sbuf.c =A0 Fri Sep =A03 16:12:39 2010 =A0 =A0 = =A0 =A0(r212181) >>> +++ head/sys/kern/subr_sbuf.c =A0 Fri Sep =A03 17:23:26 2010 =A0 =A0 = =A0 =A0(r212182) >>> @@ -116,8 +116,10 @@ _assert_sbuf_state(const char *fun, stru >>> >>> =A0#endif /* _KERNEL && INVARIANTS */ >>> >>> +#ifdef _KERNEL >>> =A0CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); >>> =A0CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); >>> +#endif >>> >>> =A0static int >>> =A0sbuf_extendsize(int size) >> >> Hi, >> >> as I can see, the next (and maybe preferred) model is used in system >> headers: >> >> #ifdef CTASSERT >> CTASSERT(...); >> #endif > > Needed, even in the kernel, since CTASSERT() is only defined if the > kernel-only header has been included. > > If this macro were defined in a user header, then it would have to be > more global (probably defined in ) but not in the applicatio= n > namespace (probably spelled __CTASSERT()), so it would be uglier. > > Bruce From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 22:47:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F56F10656A4; Mon, 6 Sep 2010 22:47:53 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23B258FC1C; Mon, 6 Sep 2010 22:47: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 o86MlrXG068969; Mon, 6 Sep 2010 22:47:53 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86MlrZA068966; Mon, 6 Sep 2010 22:47:53 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009062247.o86MlrZA068966@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 6 Sep 2010 22:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212275 - in stable/8/sys: conf modules X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:47:53 -0000 Author: weongyo Date: Mon Sep 6 22:47:52 2010 New Revision: 212275 URL: http://svn.freebsd.org/changeset/base/212275 Log: MFC r196636: Connect bwi up to the build. While there are some problems with this driver still, it generally works well for most people most of the time. It is still too green for GENERIC, however. Submitted by: many (latest being kwm@) Approved by: imp Requested by: Warren Block Modified: stable/8/sys/conf/NOTES stable/8/sys/modules/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Mon Sep 6 22:31:24 2010 (r212274) +++ stable/8/sys/conf/NOTES Mon Sep 6 22:47:52 2010 (r212275) @@ -1845,6 +1845,7 @@ device miibus # BCM570x family of controllers, including the 3Com 3c996-T, # the Netgear GA302T, the SysKonnect SK-9D21 and SK-9D41, and # the embedded gigE NICs on Dell PowerEdge 2550 servers. +# bwi: Broadcom BCM430* and BCM431* family of wireless adapters. # cas: Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn # cm: Arcnet SMC COM90c26 / SMC COM90c56 # (and SMC COM90c66 in '56 compatibility mode) adapters. @@ -2016,6 +2017,7 @@ device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # PCI Ethernet NICs. +device bwi # Broadcom BCM430* BCM431* device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel Pro/1000 Gigabit Ethernet device igb # Intel Pro/1000 PCIE Gigabit Ethernet Modified: stable/8/sys/modules/Makefile ============================================================================== --- stable/8/sys/modules/Makefile Mon Sep 6 22:31:24 2010 (r212274) +++ stable/8/sys/modules/Makefile Mon Sep 6 22:47:52 2010 (r212275) @@ -42,6 +42,7 @@ SUBDIR= ${_3dfx} \ ${_bktr} \ ${_bm} \ bridgestp \ + bwi \ bwn \ cam \ ${_canbepm} \ From owner-svn-src-all@FreeBSD.ORG Mon Sep 6 23:07:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC7E1065740; Mon, 6 Sep 2010 23:07:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB9A98FC1A; Mon, 6 Sep 2010 23:07: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 o86N7wTf070029; Mon, 6 Sep 2010 23:07:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o86N7wtq070027; Mon, 6 Sep 2010 23:07:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009062307.o86N7wtq070027@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 6 Sep 2010 23:07: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: r212278 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 23:07:59 -0000 Author: nwhitehorn Date: Mon Sep 6 23:07:58 2010 New Revision: 212278 URL: http://svn.freebsd.org/changeset/base/212278 Log: Fix the same race condition on 32-bit AIM CPUs that was fixed for 64-bit ones in r211967 involving VSID allocation. Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Mon Sep 6 23:05:38 2010 (r212277) +++ head/sys/powerpc/aim/mmu_oea.c Mon Sep 6 23:07:58 2010 (r212278) @@ -203,6 +203,7 @@ extern struct pmap ofw_pmap; * Lock for the pteg and pvo tables. */ struct mtx moea_table_mutex; +struct mtx moea_vsid_mutex; /* tlbie instruction synchronization */ static struct mtx tlbie_mtx; @@ -819,6 +820,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k */ mtx_init(&moea_table_mutex, "pmap table", NULL, MTX_DEF | MTX_RECURSE); + mtx_init(&moea_vsid_mutex, "VSID table", NULL, MTX_DEF); mtx_init(&tlbie_mtx, "tlbie", NULL, MTX_SPIN); @@ -1589,6 +1591,7 @@ moea_pinit(mmu_t mmu, pmap_t pmap) } + mtx_lock(&moea_vsid_mutex); /* * Allocate some segment registers for this pmap. */ @@ -1623,9 +1626,11 @@ moea_pinit(mmu_t mmu, pmap_t pmap) moea_vsid_bitmap[n] |= mask; for (i = 0; i < 16; i++) pmap->pm_sr[i] = VSID_MAKE(i, hash); + mtx_unlock(&moea_vsid_mutex); return; } + mtx_unlock(&moea_vsid_mutex); panic("moea_pinit: out of segments"); } @@ -1737,10 +1742,12 @@ moea_release(mmu_t mmu, pmap_t pmap) if (pmap->pm_sr[0] == 0) panic("moea_release"); + mtx_lock(&moea_vsid_mutex); idx = VSID_TO_HASH(pmap->pm_sr[0]) & (NPMAPS-1); mask = 1 << (idx % VSID_NBPW); idx /= VSID_NBPW; moea_vsid_bitmap[idx] &= ~mask; + mtx_unlock(&moea_vsid_mutex); PMAP_LOCK_DESTROY(pmap); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 00:23:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 412BF10656BA; Tue, 7 Sep 2010 00:23:46 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 163798FC0C; Tue, 7 Sep 2010 00:23: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 o870NjOh072609; Tue, 7 Sep 2010 00:23:45 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o870Njtg072607; Tue, 7 Sep 2010 00:23:45 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201009070023.o870Njtg072607@svn.freebsd.org> From: Ryan Stone Date: Tue, 7 Sep 2010 00:23: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: r212281 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 00:23:46 -0000 Author: rstone Date: Tue Sep 7 00:23:45 2010 New Revision: 212281 URL: http://svn.freebsd.org/changeset/base/212281 Log: In munmap() downgrade the vm_map_lock to a read lock before taking a read lock on the pmc-sx lock. This prevents a deadlock with pmc_log_process_mappings, which has an exclusive lock on pmc-sx and tries to get a read lock on a vm_map. Downgrading the vm_map_lock in munmap allows pmc_log_process_mappings to continue, preventing the deadlock. Without this change I could cause a deadlock on a multicore 8.1-RELEASE system by having one thread constantly mmap'ing and then munmap'ing a PROT_EXEC mapping in a loop while I repeatedly invoked and stopped pmcstat in system-wide sampling mode. Reviewed by: fabient Approved by: emaste (mentor) MFC after: 2 weeks Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Mon Sep 6 23:52:04 2010 (r212280) +++ head/sys/vm/vm_mmap.c Tue Sep 7 00:23:45 2010 (r212281) @@ -579,6 +579,7 @@ munmap(td, uap) * Inform hwpmc if the address range being unmapped contains * an executable region. */ + pkm.pm_address = (uintptr_t) NULL; if (vm_map_lookup_entry(map, addr, &entry)) { for (; entry != &map->header && entry->start < addr + size; @@ -587,16 +588,23 @@ munmap(td, uap) entry->end, VM_PROT_EXECUTE) == TRUE) { pkm.pm_address = (uintptr_t) addr; pkm.pm_size = (size_t) size; - PMC_CALL_HOOK(td, PMC_FN_MUNMAP, - (void *) &pkm); break; } } } #endif - /* returns nothing but KERN_SUCCESS anyway */ vm_map_delete(map, addr, addr + size); + +#ifdef HWPMC_HOOKS + /* downgrade the lock to prevent a LOR with the pmc-sx lock */ + vm_map_lock_downgrade(map); + if (pkm.pm_address != (uintptr) NULL) + PMC_CALL_HOOK(td, PMC_FN_MUNMAP, (void *) &pkm); + vm_map_unlock_read(map); +#else vm_map_unlock(map); +#endif + /* vm_map_delete returns nothing but KERN_SUCCESS anyway */ return (0); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 02:51:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8895710656BA; Tue, 7 Sep 2010 02:51:11 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 780028FC12; Tue, 7 Sep 2010 02:51: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 o872pBWI077227; Tue, 7 Sep 2010 02:51:11 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o872pBGv077225; Tue, 7 Sep 2010 02:51:11 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201009070251.o872pBGv077225@svn.freebsd.org> From: Ryan Stone Date: Tue, 7 Sep 2010 02:51: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: r212282 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 02:51:11 -0000 Author: rstone Date: Tue Sep 7 02:51:11 2010 New Revision: 212282 URL: http://svn.freebsd.org/changeset/base/212282 Log: Fix a typo in r212281. uintptr -> uintptr_t Pointy hat to: rstone Approved by: emaste (mentor) MFC after: 2 weeks Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Tue Sep 7 00:23:45 2010 (r212281) +++ head/sys/vm/vm_mmap.c Tue Sep 7 02:51:11 2010 (r212282) @@ -598,7 +598,7 @@ munmap(td, uap) #ifdef HWPMC_HOOKS /* downgrade the lock to prevent a LOR with the pmc-sx lock */ vm_map_lock_downgrade(map); - if (pkm.pm_address != (uintptr) NULL) + if (pkm.pm_address != (uintptr_t) NULL) PMC_CALL_HOOK(td, PMC_FN_MUNMAP, (void *) &pkm); vm_map_unlock_read(map); #else From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 03:10:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0786A10656A4; Tue, 7 Sep 2010 03:10:12 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3C0068FC0A; Tue, 7 Sep 2010 03:10:10 +0000 (UTC) Received: by ewy4 with SMTP id 4so2466116ewy.13 for ; Mon, 06 Sep 2010 20:10:10 -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 :content-transfer-encoding; bh=u2JdRWcEt5mp13YTTjdaeLanG9D7/5yWP0PwcSmjUx8=; b=Ud6Zmo0d5XLLLaqlGJtGdn1FY4N78g0XZeTgOtN1Oaf4pXEyzJxX782ijE1FGwWMGY 2XrZB3cCrYwKfFRK5hh+9yBkSQLqDkTf9GZAICvlu7VyUqNBm0O5EcDndLvXDQgM7e0F KAyerXeIxxoKKK0E5XKHECKw1E6+gFhL3VQOM= 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:content-transfer-encoding; b=r/Wgdc4qI2mV4LeCiZxNAQuFFbOX3sNLjDZYvk4U4CcBAGH28zMA7ljOtUOWtQ7S7U LG4DEQhF/HXwefW+jG1rfKxdqvISUGrSnBtuIie2c10+RKu4LkQP0BvSOG8uy4I1hAU9 Zfv7j6uTVZeeVdkc1RyWwLKd7YWQ55a363c/c= MIME-Version: 1.0 Received: by 10.213.9.147 with SMTP id l19mr2239044ebl.94.1283827515541; Mon, 06 Sep 2010 19:45:15 -0700 (PDT) Received: by 10.213.28.19 with HTTP; Mon, 6 Sep 2010 19:45:15 -0700 (PDT) In-Reply-To: <201009070023.o870Njtg072607@svn.freebsd.org> References: <201009070023.o870Njtg072607@svn.freebsd.org> Date: Mon, 6 Sep 2010 22:45:15 -0400 Message-ID: From: Ryan Stone To: Ryan Stone Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212281 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 03:10:12 -0000 On Mon, Sep 6, 2010 at 8:23 PM, Ryan Stone wrote: > + =A0 =A0 =A0 if (pkm.pm_address !=3D (uintptr) NULL) I have no idea how this snuck past me. I must have deleted some characters after building and testing this. I'll fix it as soon as I can track down one of my mentors, but if somebody wants to fix it before then please do so. The fix is to replace uintptr with uintptr_t. Sorry. From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 05:39:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B82EA10656AA; Tue, 7 Sep 2010 05:39:24 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D3108FC19; Tue, 7 Sep 2010 05:39: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 o875dOQU082903; Tue, 7 Sep 2010 05:39:24 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o875dO6A082901; Tue, 7 Sep 2010 05:39:24 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009070539.o875dO6A082901@svn.freebsd.org> From: "Jayachandran C." Date: Tue, 7 Sep 2010 05:39: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: r212283 - head/sys/mips/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 05:39:24 -0000 Author: jchandra Date: Tue Sep 7 05:39:24 2010 New Revision: 212283 URL: http://svn.freebsd.org/changeset/base/212283 Log: On boards with >512MB memory, the result of vtophys cannot be converted to KSEG1 address - use pmap_mapdev/pmap_unmapdev instead. Remove unused variable maxphys. Modified: head/sys/mips/mips/busdma_machdep.c Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Tue Sep 7 02:51:11 2010 (r212282) +++ head/sys/mips/mips/busdma_machdep.c Tue Sep 7 05:39:24 2010 (r212283) @@ -425,7 +425,6 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) #endif if (dmat != NULL) { - if (dmat->map_count != 0) return (EBUSY); @@ -602,20 +601,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * and handles multi-seg allocations. Nobody is doing * multi-seg allocations yet though. */ - vm_paddr_t maxphys; - if((uint32_t)dmat->lowaddr >= MIPS_KSEG0_LARGEST_PHYS) { - /* Note in the else case I just put in what was already - * being passed in dmat->lowaddr. I am not sure - * how this would have worked. Since lowaddr is in the - * max address postion. I would have thought that the - * caller would have wanted dmat->highaddr. That is - * presuming they are asking for physical addresses - * which is what contigmalloc takes. - RRS - */ - maxphys = MIPS_KSEG0_LARGEST_PHYS - 1; - } else { - maxphys = dmat->lowaddr; - } *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); @@ -633,7 +618,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi void *tmpaddr = (void *)*vaddr; if (tmpaddr) { - tmpaddr = (void *)MIPS_PHYS_TO_KSEG1(vtophys(tmpaddr)); + tmpaddr = (void *)pmap_mapdev(vtophys(tmpaddr), + dmat->maxsize); newmap->origbuffer = *vaddr; newmap->allocbuffer = tmpaddr; mips_dcache_wbinv_range((vm_offset_t)*vaddr, @@ -660,6 +646,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void vaddr = map->origbuffer; } + if (map->flags & DMAMAP_UNCACHEABLE) + pmap_unmapdev((vm_offset_t)map->allocbuffer, dmat->maxsize); if (map->flags & DMAMAP_MALLOCUSED) free(vaddr, M_DEVBUF); else @@ -1360,7 +1348,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u } bpage->busaddr = pmap_kextract(bpage->vaddr); bpage->vaddr_nocache = - (vm_offset_t)MIPS_PHYS_TO_KSEG1(bpage->busaddr); + (vm_offset_t)pmap_mapdev(bpage->busaddr, PAGE_SIZE); mtx_lock(&bounce_lock); STAILQ_INSERT_TAIL(&bz->bounce_page_list, bpage, links); total_bpages++; From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 06:02:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AC3A106580D; Tue, 7 Sep 2010 06:02:43 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 798E58FC23; Tue, 7 Sep 2010 06:02: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 o8762hA5083644; Tue, 7 Sep 2010 06:02:43 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8762hvg083642; Tue, 7 Sep 2010 06:02:43 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009070602.o8762hvg083642@svn.freebsd.org> From: "Jayachandran C." Date: Tue, 7 Sep 2010 06:02: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: r212284 - head/sys/mips/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 06:02:43 -0000 Author: jchandra Date: Tue Sep 7 06:02:43 2010 New Revision: 212284 URL: http://svn.freebsd.org/changeset/base/212284 Log: Whitespace fixes - indent with tabs instead of spaces. Few other style(9) changes. Modified: head/sys/mips/mips/busdma_machdep.c Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Tue Sep 7 05:39:24 2010 (r212283) +++ head/sys/mips/mips/busdma_machdep.c Tue Sep 7 06:02:43 2010 (r212284) @@ -133,7 +133,7 @@ struct bus_dmamap { struct bp_list bpages; int pagesneeded; int pagesreserved; - bus_dma_tag_t dmat; + bus_dma_tag_t dmat; int flags; void *buffer; void *origbuffer; @@ -142,7 +142,7 @@ struct bus_dmamap { int len; STAILQ_ENTRY(bus_dmamap) links; bus_dmamap_callback_t *callback; - void *callback_arg; + void *callback_arg; }; @@ -310,11 +310,11 @@ _busdma_free_dmamap(bus_dmamap_t map) int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, - bus_addr_t highaddr, bus_dma_filter_t *filter, - void *filterarg, bus_size_t maxsize, int nsegments, - bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) + bus_size_t boundary, bus_addr_t lowaddr, + bus_addr_t highaddr, bus_dma_filter_t *filter, + void *filterarg, bus_size_t maxsize, int nsegments, + bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, + void *lockfuncarg, bus_dma_tag_t *dmat) { bus_dma_tag_t newtag; int error = 0; @@ -337,8 +337,8 @@ bus_dma_tag_create(bus_dma_tag_t parent, newtag->highaddr = trunc_page((vm_offset_t)highaddr) + (PAGE_SIZE - 1); newtag->filter = filter; newtag->filterarg = filterarg; - newtag->maxsize = maxsize; - newtag->nsegments = nsegments; + newtag->maxsize = maxsize; + newtag->nsegments = nsegments; newtag->maxsegsz = maxsegsz; newtag->flags = flags; if (cpuinfo.cache_coherent_dma) @@ -352,28 +352,28 @@ bus_dma_tag_create(bus_dma_tag_t parent, newtag->lockfunc = dflt_lock; newtag->lockfuncarg = NULL; } - /* + /* * Take into account any restrictions imposed by our parent tag */ - if (parent != NULL) { - newtag->lowaddr = min(parent->lowaddr, newtag->lowaddr); - newtag->highaddr = max(parent->highaddr, newtag->highaddr); + if (parent != NULL) { + newtag->lowaddr = min(parent->lowaddr, newtag->lowaddr); + newtag->highaddr = max(parent->highaddr, newtag->highaddr); if (newtag->boundary == 0) newtag->boundary = parent->boundary; else if (parent->boundary != 0) - newtag->boundary = min(parent->boundary, - newtag->boundary); + newtag->boundary = + min(parent->boundary, newtag->boundary); if ((newtag->filter != NULL) || ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) newtag->flags |= BUS_DMA_COULD_BOUNCE; - if (newtag->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - newtag->filter = parent->filter; - newtag->filterarg = parent->filterarg; - newtag->parent = parent->parent; + if (newtag->filter == NULL) { + /* + * Short circuit looking at our parent directly + * since we have encapsulated all of its information + */ + newtag->filter = parent->filter; + newtag->filterarg = parent->filterarg; + newtag->parent = parent->parent; } if (newtag->parent != NULL) atomic_add_int(&parent->ref_count, 1); @@ -425,29 +425,29 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) #endif if (dmat != NULL) { - if (dmat->map_count != 0) - return (EBUSY); + if (dmat->map_count != 0) + return (EBUSY); - while (dmat != NULL) { - bus_dma_tag_t parent; + while (dmat != NULL) { + bus_dma_tag_t parent; - parent = dmat->parent; - atomic_subtract_int(&dmat->ref_count, 1); - if (dmat->ref_count == 0) { - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } - } + parent = dmat->parent; + atomic_subtract_int(&dmat->ref_count, 1); + if (dmat->ref_count == 0) { + free(dmat, M_DEVBUF); + /* + * Last reference count, so + * release our reference + * count on our parent. + */ + dmat = parent; + } else + dmat = NULL; + } + } CTR2(KTR_BUSDMA, "%s tag %p", __func__, dmat_copy); - return (0); + return (0); } #include @@ -553,7 +553,7 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, b */ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, - bus_dmamap_t *mapp) + bus_dmamap_t *mapp) { bus_dmamap_t newmap = NULL; @@ -589,29 +589,29 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi if (flags & BUS_DMA_COHERENT) newmap->flags |= DMAMAP_UNCACHEABLE; - if (dmat->maxsize <= PAGE_SIZE && + if (dmat->maxsize <= PAGE_SIZE && (dmat->alignment < dmat->maxsize) && !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr) && !(newmap->flags & DMAMAP_UNCACHEABLE)) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); newmap->flags |= DMAMAP_MALLOCUSED; - } else { - /* - * XXX Use Contigmalloc until it is merged into this facility - * and handles multi-seg allocations. Nobody is doing - * multi-seg allocations yet though. - */ - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); - } - if (*vaddr == NULL) { + } else { + /* + * XXX Use Contigmalloc until it is merged into this facility + * and handles multi-seg allocations. Nobody is doing + * multi-seg allocations yet though. + */ + *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, + 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, + dmat->boundary); + } + if (*vaddr == NULL) { if (newmap != NULL) { _busdma_free_dmamap(newmap); dmat->map_count--; } *mapp = NULL; - return (ENOMEM); + return (ENOMEM); } if (newmap->flags & DMAMAP_UNCACHEABLE) { @@ -630,7 +630,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi } else newmap->origbuffer = newmap->allocbuffer = NULL; - return (0); + return (0); } /* @@ -648,9 +648,9 @@ bus_dmamem_free(bus_dma_tag_t dmat, void if (map->flags & DMAMAP_UNCACHEABLE) pmap_unmapdev((vm_offset_t)map->allocbuffer, dmat->maxsize); - if (map->flags & DMAMAP_MALLOCUSED) + if (map->flags & DMAMAP_MALLOCUSED) free(vaddr, M_DEVBUF); - else + else contigfree(vaddr, dmat->maxsize, M_DEVBUF); dmat->map_count--; @@ -819,10 +819,10 @@ segdone: */ int bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, - bus_size_t buflen, bus_dmamap_callback_t *callback, - void *callback_arg, int flags) + bus_size_t buflen, bus_dmamap_callback_t *callback, + void *callback_arg, int flags) { - vm_offset_t lastaddr = 0; + vm_offset_t lastaddr = 0; int error, nsegs = -1; #ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT bus_dma_segment_t dm_segments[dmat->nsegments]; @@ -859,8 +859,8 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_ */ int bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0, - bus_dmamap_callback2_t *callback, void *callback_arg, - int flags) + bus_dmamap_callback2_t *callback, void *callback_arg, + int flags) { #ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT bus_dma_segment_t dm_segments[dmat->nsegments]; From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 07:31:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B5461065693; Tue, 7 Sep 2010 07:31:58 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A29F8FC08; Tue, 7 Sep 2010 07:31: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 o877Vwpn086529; Tue, 7 Sep 2010 07:31:58 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o877VwfN086527; Tue, 7 Sep 2010 07:31:58 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009070731.o877VwfN086527@svn.freebsd.org> From: "Jayachandran C." Date: Tue, 7 Sep 2010 07:31: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: r212285 - head/sys/mips/rmi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 07:31:58 -0000 Author: jchandra Date: Tue Sep 7 07:31:58 2010 New Revision: 212285 URL: http://svn.freebsd.org/changeset/base/212285 Log: PCIe updates for XLS. Fix interrupt routing so that the irq returned is correct for XLR and XLS. This also updates the MSI hack we had earlier - we still don't really support MSI, but we support some drivers that use MSI, by providing support for allocating one MSI per pci link - this MSI is directly mapped to the link IRQ. Modified: head/sys/mips/rmi/xlr_pci.c Modified: head/sys/mips/rmi/xlr_pci.c ============================================================================== --- head/sys/mips/rmi/xlr_pci.c Tue Sep 7 06:02:43 2010 (r212284) +++ head/sys/mips/rmi/xlr_pci.c Tue Sep 7 07:31:58 2010 (r212285) @@ -326,51 +326,77 @@ xlr_pcib_identify(driver_t * driver, dev BUS_ADD_CHILD(parent, 0, "pcib", 0); } +/* + * XLS PCIe can have upto 4 links, and each link has its on IRQ + * Find the link on which the device is on + */ static int -xlr_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs) +xls_pcie_link(device_t pcib, device_t dev) { - int pciirq; - int i; device_t parent, tmp; /* find the lane on which the slot is connected to */ + printf("xls_pcie_link : bus %s dev %s\n", device_get_nameunit(pcib), + device_get_nameunit(dev)); tmp = dev; while (1) { parent = device_get_parent(tmp); if (parent == NULL || parent == pcib) { device_printf(dev, "Cannot find parent bus\n"); - return (ENXIO); + return (-1); } if (strcmp(device_get_nameunit(parent), "pci0") == 0) break; tmp = parent; } + return (pci_get_slot(tmp)); +} + +/* + * Find the IRQ for the link, each link has a different interrupt + * at the XLS pic + */ +static int +xls_pcie_link_irq(int link) +{ - switch (pci_get_slot(tmp)) { + switch (link) { case 0: - pciirq = PIC_PCIE_LINK0_IRQ; - break; + return (PIC_PCIE_LINK0_IRQ); case 1: - pciirq = PIC_PCIE_LINK1_IRQ; - break; + return (PIC_PCIE_LINK1_IRQ); case 2: - pciirq = PIC_PCIE_LINK2_IRQ; - break; + return (PIC_PCIE_LINK2_IRQ); case 3: - pciirq = PIC_PCIE_LINK3_IRQ; - break; - default: - return (ENXIO); + return (PIC_PCIE_LINK3_IRQ); } + return (-1); +} + +static int +xlr_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs) +{ + int i, link; - irqs[0] = pciirq; /* - * For now put in some fixed values for the other requested MSI, - * TODO handle multiple messages + * Each link has 32 MSIs that can be allocated, but for now + * we only support one device per link. + * msi_alloc() equivalent is needed when we start supporting + * bridges on the PCIe link. */ - for (i = 1; i < count; i++) - irqs[i] = pciirq + 64 * i; + link = xls_pcie_link(pcib, dev); + if (link == -1) + return (ENXIO); + + /* + * encode the irq so that we know it is a MSI interrupt when we + * setup interrupts + */ + for (i = 0; i < count; i++) + irqs[i] = 64 + link * 32 + i; + device_printf(dev, "Alloc MSI count %d maxcount %d irq %d link %d\n", + count, maxcount, i, link); return (0); } @@ -383,20 +409,18 @@ xlr_release_msi(device_t pcib, device_t } static int -xlr_map_msi(device_t pcib, device_t dev, int irq, uint64_t * addr, - uint32_t * data) +xlr_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, + uint32_t *data) { + int msi; - switch (irq) { - case PIC_PCIE_LINK0_IRQ: - case PIC_PCIE_LINK1_IRQ: - case PIC_PCIE_LINK2_IRQ: - case PIC_PCIE_LINK3_IRQ: + device_printf(dev, "MAP MSI irq %d\n", irq); + if (irq >= 64) { + msi = irq - 64; *addr = MIPS_MSI_ADDR(0); - *data = MIPS_MSI_DATA(irq); + *data = MIPS_MSI_DATA(msi); return (0); - - default: + } else { device_printf(dev, "%s: map_msi for irq %d - ignored", device_get_nameunit(pcib), irq); return (ENXIO); @@ -437,10 +461,8 @@ bridge_pcie_ack(int irq) static int mips_platform_pci_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_filter_t * filt, - driver_intr_t * intr, void *arg, - void **cookiep) + struct resource *irq, int flags, driver_filter_t *filt, + driver_intr_t *intr, void *arg, void **cookiep) { int error = 0; int xlrirq; @@ -454,6 +476,8 @@ mips_platform_pci_setup_intr(device_t de return (EINVAL); } xlrirq = rman_get_start(irq); + device_printf(dev, "%s: setup intr %d\n", device_get_nameunit(child), + xlrirq); if (strcmp(device_get_name(dev), "pcib") != 0) return (0); @@ -463,6 +487,18 @@ mips_platform_pci_setup_intr(device_t de intr, arg, PIC_PCIX_IRQ, flags, cookiep, bridge_pcix_ack); pic_setup_intr(PIC_IRT_PCIX_INDEX, PIC_PCIX_IRQ, 0x1, 1); } else { + /* + * temporary hack for MSI, we support just one device per + * link, and assign the link interrupt to the device interrupt + */ + if (xlrirq >= 64) { + xlrirq -= 64; + if (xlrirq % 32 != 0) + return (0); + xlrirq = xls_pcie_link_irq(xlrirq / 32); + if (xlrirq == -1) + return (EINVAL); + } xlr_establish_intr(device_get_name(child), filt, intr, arg, xlrirq, flags, cookiep, bridge_pcie_ack); pic_setup_intr(xlrirq - PIC_IRQ_BASE, xlrirq, 0x1, 1); @@ -492,6 +528,9 @@ xlr_pci_alloc_resource(device_t bus, dev vm_offset_t va; int needactivate = flags & RF_ACTIVE; + device_printf(child, "Alloc res type %d, rid %d, start %lx, end %lx, count %lx flags %u\n", + type, *rid, start, end, count, flags); + switch (type) { case SYS_RES_IRQ: rm = &irq_rman; @@ -559,28 +598,24 @@ xlr_pci_deactivate_resource(device_t bus static int mips_pci_route_interrupt(device_t bus, device_t dev, int pin) { + int irq, link; /* * Validate requested pin number. */ + device_printf(dev, "route intr pin %d (bus %d, slot %d)\n", + pin, pci_get_bus(dev), pci_get_slot(dev)); if ((pin < 1) || (pin > 4)) return (255); if (xlr_board_info.is_xls) { - switch (pin) { - case 1: - return (PIC_PCIE_LINK0_IRQ); - case 2: - return (PIC_PCIE_LINK1_IRQ); - case 3: - return (PIC_PCIE_LINK2_IRQ); - case 4: - return (PIC_PCIE_LINK3_IRQ); - } + link = xls_pcie_link(bus, dev); + irq = xls_pcie_link_irq(link); + if (irq != -1) + return (irq); } else { - if (pin == 1) { - return (16); - } + if (pin == 1) + return (PIC_PCIX_IRQ); } return (255); From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 07:50:01 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E445D1065693; Tue, 7 Sep 2010 07:50:01 +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 694E78FC12; Tue, 7 Sep 2010 07:50:01 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o877nksP018776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Sep 2010 17:49:59 +1000 Date: Tue, 7 Sep 2010 17:49:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Roman Divacky In-Reply-To: <201009031425.o83EPHCI050877@svn.freebsd.org> Message-ID: <20100907160928.Y2080@delplex.bde.org> References: <201009031425.o83EPHCI050877@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: r212177 - in head/sys: amd64/include i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 07:50:02 -0000 On Fri, 3 Sep 2010, Roman Divacky wrote: > Log: > Change the parameter passed to the inline assembly to u_short > as we are dealing with 16bit segment registers. Change mov > to movw. u_ints were used intentionally to avoid operand size prefixes here and extra code for promotions in callers. Segment registers are always stored as 32 bits in trap frames, pcbs and regs structs, to avoid the operand size prefixes in pure assembler code for at least the trap frames and to avoid packing problems. Why break this? This was last broken in 2003, in rev.1.131 for i386, and last backed out soon after. Then the reason for breaking it was stated in the log message -- it was to avoid returning garbage in the top bits. The garbage, if any, is due to not wasting time to remove it. Instead, we always used 32-bit accesses to segment registers and depended on the CPU supplying harmless garbage. This depended on undocumented features and on avoidance of gas bugs in this area when it was first used. Some of the gas bugs seem to be still there: (1) the original i486 manual only documents mov of a segreg to/from memory as being 16 bits. Gas bugs required writing 32-bit mov's to get 16-bit ones. Now, the operand size can be left for gas to determine, but gas still produces a spurious operand size prefixs for movw in 1 case: %%% GAS LISTING z.s page 1 1 0000 8C1D0000 mov %ds,mem 1 0000 2 0006 8C1D0000 movl %ds,mem 2 0000 3 000c 668C1D00 movw %ds,mem <--- spurious 66 3 000000 4 0013 8E1D0000 mov mem,%ds 4 0000 5 0019 8E1D0000 movl mem,%ds 5 0000 6 001f 8E1D0000 movw mem,%ds 6 0000 %%% For loads there is no problem now -- the operand size prefix is never generated now, and the contents of the upper 16 bits is irrelevant. There is a problem with stores -- the above spurious 66 has no effect, at least on an Athlon64, and the upper 16 bits of `mem' are not changed by the store. Thus the optimization is broken for the "m" case of rgs() etc. I think there is no problem in practice since the "m" case is never used, except possibly with -O0 (the "r" case is always preferred). (2) mov of a segreg to a general register is quite different (mov of a segreg _from_ a general register is unproblematic, as above, so its details are not given here). 32-bit movs change the top bits, but the details of this are not documented in the original i486 manual. Later manuals give the details, and they are CPU-dependent (IIRC, in general newer CPUs (Athlon64 at least) zero the top bits, while older CPUs set them to garbage). Gas bugs in this area seem to be fixed: %%% GAS LISTING z.s page 1 1 0000 668CD8 mov %ds,%ax 2 0003 668CD8 movw %ds,%ax 3 0006 8CD8 mov %ds,%eax 4 0008 8CD8 movl %ds,%eax %%% Now the operand size prefix is not spurious, and it is generated as necessary without an explicit `w' in the opcode -- it forces the CPU to do extra decoding and Icache work (for the prefix) in order for the instruction to do less (not touch the top bits of the target registers). This is the main pessimization in this commit -- we do extra work here so that we can do even more extra work in callers, to promote the result to the 32-bit one that is needed for storing in the pcb or similar. (3) push of a segreg is like mov of a segreg to a general register. Again, it is important to write sufficiently secure garbage to the top bits. FreeBSD has always used pushl for segment registers in the trap frame and dependent on this to write something harmless, since the registers in the trap frame are copied without cleaning by ptrace() etc. You can also see the "garbage" in the segment registers in the trap frame using debuggers, and doing extra work to clean it in rgs() etc. won't even affect it there. Gas didn't have any problems with push of a segreg AFAIR, but my assembler does. My assembler doesn't even know that 32-bit movs of segregs exist, so it mis-assembles "push %ds" as a 16-bit push in both 16-bit and 32-bit mode. I used this in the first 386 protected mode version of Minix to give bad packing for segment registers in the trap frame. > Modified: head/sys/amd64/include/cpufunc.h > ============================================================================== > --- head/sys/amd64/include/cpufunc.h Fri Sep 3 13:54:02 2010 (r212176) > +++ head/sys/amd64/include/cpufunc.h Fri Sep 3 14:25:17 2010 (r212177) > @@ -421,40 +421,40 @@ invlpg(u_long addr) > __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); > } > > -static __inline u_int > +static __inline u_short > rfs(void) > { > - u_int sel; > - __asm __volatile("mov %%fs,%0" : "=rm" (sel)); > + u_short sel; > + __asm __volatile("movw %%fs,%0" : "=rm" (sel)); > return (sel); > } The change from u_int to u_short is a pessimization, except in fixes the "m" case -- see above. A better fix for the "m" case is to remove it. The change from mov to movw has no effect except to step on the gas bug to get an extra operand size prefix that has no effect in the "m" case. > ... > static __inline void > -load_ds(u_int sel) > +load_ds(u_short sel) > { > - __asm __volatile("mov %0,%%ds" : : "rm" (sel)); > + __asm __volatile("movw %0,%%ds" : : "rm" (sel)); > } The pessimizations for the load operations are hopefully optimized away in all cases. Normally we start with an int in the trap frame. [Oops, on amd64 most things in the trap frame are actually long (register_t == __int64_t). This includes tf_cs and tf_ss which are pushed by hardware. But tf_[defg]s are uint16_t.] Then we downcast to u_short for calling load_*s(). [But on amd64 it is only a downcast for ss.] On i386, everything in the trap frame is an int and we used to sidecast to u_int; now we downcast to u_short. But the downcast doesn't take any instructions, and the change from mov to movw also has no uffect. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 08:04:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B99A810656C1; Tue, 7 Sep 2010 08:04:51 +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 4CF718FC14; Tue, 7 Sep 2010 08:04:50 +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 o8784lB6028571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Sep 2010 11:04:47 +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 o8784kLb003055; Tue, 7 Sep 2010 11:04:46 +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 o8784kvL003054; Tue, 7 Sep 2010 11:04:46 +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: Tue, 7 Sep 2010 11:04:46 +0300 From: Kostik Belousov To: Ryan Stone Message-ID: <20100907080446.GA2853@deviant.kiev.zoral.com.ua> References: <201009070023.o870Njtg072607@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline In-Reply-To: <201009070023.o870Njtg072607@svn.freebsd.org> 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.2 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: r212281 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 08:04:51 -0000 --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 07, 2010 at 12:23:45AM +0000, Ryan Stone wrote: > Author: rstone > Date: Tue Sep 7 00:23:45 2010 > New Revision: 212281 > URL: http://svn.freebsd.org/changeset/base/212281 >=20 > Log: > In munmap() downgrade the vm_map_lock to a read lock before taking a re= ad > lock on the pmc-sx lock. This prevents a deadlock with > pmc_log_process_mappings, which has an exclusive lock on pmc-sx and tri= es > to get a read lock on a vm_map. Downgrading the vm_map_lock in munmap > allows pmc_log_process_mappings to continue, preventing the deadlock. > =20 > Without this change I could cause a deadlock on a multicore 8.1-RELEASE > system by having one thread constantly mmap'ing and then munmap'ing a > PROT_EXEC mapping in a loop while I repeatedly invoked and stopped pmcs= tat > in system-wide sampling mode. > =20 > Reviewed by: fabient > Approved by: emaste (mentor) > MFC after: 2 weeks >=20 > Modified: > head/sys/vm/vm_mmap.c >=20 > Modified: head/sys/vm/vm_mmap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/vm/vm_mmap.c Mon Sep 6 23:52:04 2010 (r212280) > +++ head/sys/vm/vm_mmap.c Tue Sep 7 00:23:45 2010 (r212281) > @@ -579,6 +579,7 @@ munmap(td, uap) > * Inform hwpmc if the address range being unmapped contains > * an executable region. > */ > + pkm.pm_address =3D (uintptr_t) NULL; > if (vm_map_lookup_entry(map, addr, &entry)) { > for (; > entry !=3D &map->header && entry->start < addr + size; > @@ -587,16 +588,23 @@ munmap(td, uap) > entry->end, VM_PROT_EXECUTE) =3D=3D TRUE) { > pkm.pm_address =3D (uintptr_t) addr; > pkm.pm_size =3D (size_t) size; > - PMC_CALL_HOOK(td, PMC_FN_MUNMAP, > - (void *) &pkm); > break; > } > } > } > #endif > - /* returns nothing but KERN_SUCCESS anyway */ > vm_map_delete(map, addr, addr + size); > + > +#ifdef HWPMC_HOOKS > + /* downgrade the lock to prevent a LOR with the pmc-sx lock */ > + vm_map_lock_downgrade(map); > + if (pkm.pm_address !=3D (uintptr) NULL) > + PMC_CALL_HOOK(td, PMC_FN_MUNMAP, (void *) &pkm); > + vm_map_unlock_read(map); > +#else > vm_map_unlock(map); > +#endif > + /* vm_map_delete returns nothing but KERN_SUCCESS anyway */ > return (0); > } > =20 Note that vm_map_unlock() is more then just dropping the lock on the map. Due to ordering of the vnode lock before vm map lock, vm_map_unlock() processes the deferred free entries after map lock is dropped. After your change, the deferred list might keep entries for some time until next unlock is performed. I think the two changes could be done: - only perform downgrade when hook is indeed going to be called; - before vm_map_unlock_read, check for deferred_freelist being not NULL, and if so, do vm_map_lock()/vm_map_unlock() after unlock_read. --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyF8h4ACgkQC3+MBN1Mb4ifPgCeJ7DecLEIMBMWNZLqwDHMBOBg ip8AoLFiD46h+Q3vTMegW2GEkh20wT+V =9IsU -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP-- From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 08:33:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97EFE106566B; Tue, 7 Sep 2010 08:33:17 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8772B8FC1D; Tue, 7 Sep 2010 08:33: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 o878XH5L088548; Tue, 7 Sep 2010 08:33:17 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o878XH3x088545; Tue, 7 Sep 2010 08:33:17 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201009070833.o878XH3x088545@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 7 Sep 2010 08:33: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: r212286 - head/gnu/lib/libstdc++ X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 08:33:17 -0000 Author: tijl Date: Tue Sep 7 08:33:17 2010 New Revision: 212286 URL: http://svn.freebsd.org/changeset/base/212286 Log: GCC defines built-ins for atomic instructions found on i486 and higher. Because FreeBSD no longer supports the 80386 cpu all code targeting FreeBSD/i386 necessarily runs on i486 or higher so the compiler built-ins can be used by default inside libstdc++ and in C++ headers. This allows newly compiled C++ code to inline some atomic operations. Old binaries continue to use libstdc++ functions. PR: 148926 Tested by: Yuri Karaban Reviewed by: kan Approved by: kib (mentor) MFC after: 2 weeks Modified: head/gnu/lib/libstdc++/Makefile head/gnu/lib/libstdc++/config.h Modified: head/gnu/lib/libstdc++/Makefile ============================================================================== --- head/gnu/lib/libstdc++/Makefile Tue Sep 7 07:31:58 2010 (r212285) +++ head/gnu/lib/libstdc++/Makefile Tue Sep 7 08:33:17 2010 (r212286) @@ -83,7 +83,7 @@ ATOMICITY_H= ${SRCDIR}/config/cpu/${MARC ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_mutex/atomicity.h .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" .if exists(${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h) ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h .endif Modified: head/gnu/lib/libstdc++/config.h ============================================================================== --- head/gnu/lib/libstdc++/config.h Tue Sep 7 07:31:58 2010 (r212285) +++ head/gnu/lib/libstdc++/config.h Tue Sep 7 08:33:17 2010 (r212286) @@ -671,7 +671,7 @@ /* #undef VERSION */ /* Define if builtin atomic operations are supported on this host. */ -#if defined(__amd64__) +#if defined(__amd64__) || defined(__i386__) #define _GLIBCXX_ATOMIC_BUILTINS 1 #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 11:46:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1D8D10656B4; Tue, 7 Sep 2010 11:46:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0D8C8FC20; Tue, 7 Sep 2010 11:46: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 o87Bk9nM096323; Tue, 7 Sep 2010 11:46:09 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87Bk9w0096321; Tue, 7 Sep 2010 11:46:09 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009071146.o87Bk9w0096321@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 7 Sep 2010 11:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212287 - stable/8/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 11:46:09 -0000 Author: bz Date: Tue Sep 7 11:46:09 2010 New Revision: 212287 URL: http://svn.freebsd.org/changeset/base/212287 Log: MFC r212152: MFp4 CH=183259: No reason to use if_free_type() as we don't change our type. Just if_free() is fine. Modified: stable/8/sys/net/if_epair.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/if_epair.c ============================================================================== --- stable/8/sys/net/if_epair.c Tue Sep 7 08:33:17 2010 (r212286) +++ stable/8/sys/net/if_epair.c Tue Sep 7 11:46:09 2010 (r212287) @@ -901,9 +901,9 @@ epair_clone_destroy(struct if_clone *ifc * we need to switch before freeing them. */ CURVNET_SET_QUIET(oifp->if_vnet); - if_free_type(oifp, IFT_ETHER); + if_free(oifp); CURVNET_RESTORE(); - if_free_type(ifp, IFT_ETHER); + if_free(ifp); free(scb, M_EPAIR); free(sca, M_EPAIR); ifc_free_unit(ifc, unit); From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 12:02:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 845AB10656B4; Tue, 7 Sep 2010 12:02:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BA3F8FC1F; Tue, 7 Sep 2010 12: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 o87C2YqD096989; Tue, 7 Sep 2010 12:02:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87C2Ynq096987; Tue, 7 Sep 2010 12:02:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009071202.o87C2Ynq096987@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 7 Sep 2010 12:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212288 - stable/8/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 12:02:36 -0000 Author: kib Date: Tue Sep 7 12:02:34 2010 New Revision: 212288 URL: http://svn.freebsd.org/changeset/base/212288 Log: MFC r211742: The __hidden definition is provided by sys/cdefs.h. Modified: stable/8/lib/libthr/thread/thr_private.h Directory Properties: stable/8/lib/libthr/ (props changed) Modified: stable/8/lib/libthr/thread/thr_private.h ============================================================================== --- stable/8/lib/libthr/thread/thr_private.h Tue Sep 7 11:46:09 2010 (r212287) +++ stable/8/lib/libthr/thread/thr_private.h Tue Sep 7 12:02:34 2010 (r212288) @@ -52,10 +52,6 @@ #include #include -#ifndef __hidden -#define __hidden __attribute__((visibility("hidden"))) -#endif - #include "pthread_md.h" #include "thr_umtx.h" #include "thread_db.h" From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 12:04:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B0F91065698; Tue, 7 Sep 2010 12:04:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3C748FC08; Tue, 7 Sep 2010 12:04: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 o87C47E2097085; Tue, 7 Sep 2010 12:04:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87C47Du097084; Tue, 7 Sep 2010 12:04:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009071204.o87C47Du097084@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 7 Sep 2010 12:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212289 - stable/8/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 12:04:08 -0000 Author: kib Date: Tue Sep 7 12:04:07 2010 New Revision: 212289 URL: http://svn.freebsd.org/changeset/base/212289 Log: MFC r211743: Remove unused source. Deleted: stable/8/lib/libthr/thread/thr_atfork.c Modified: Directory Properties: stable/8/lib/libthr/ (props changed) From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 12:06:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 014F01065694; Tue, 7 Sep 2010 12:06:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9DB28FC18; Tue, 7 Sep 2010 12:06: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 o87C6fGE097197; Tue, 7 Sep 2010 12:06:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87C6fBP097193; Tue, 7 Sep 2010 12:06:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009071206.o87C6fBP097193@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 7 Sep 2010 12:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212290 - stable/8/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 12:06:42 -0000 Author: kib Date: Tue Sep 7 12:06:41 2010 New Revision: 212290 URL: http://svn.freebsd.org/changeset/base/212290 Log: MFC r211748: Move the __stack_chk_fail_local@FBSD_1.0 compat symbol definition into the separate .o for libc_pic.a. This prevents rtld from making the symbol global. Added: stable/8/lib/libc/sys/stack_protector_compat.c - copied unchanged from r211748, head/lib/libc/sys/stack_protector_compat.c Modified: stable/8/lib/libc/sys/Makefile.inc stable/8/lib/libc/sys/stack_protector.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/sys/Makefile.inc ============================================================================== --- stable/8/lib/libc/sys/Makefile.inc Tue Sep 7 12:04:07 2010 (r212289) +++ stable/8/lib/libc/sys/Makefile.inc Tue Sep 7 12:06:41 2010 (r212290) @@ -18,7 +18,7 @@ .endif # Sources common to both syscall interfaces: -SRCS+= stack_protector.c __error.c +SRCS+= stack_protector.c stack_protector_compat.c __error.c .if !defined(WITHOUT_SYSCALL_COMPAT) SRCS+= fcntl.c ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c PSEUDO+= _fcntl.o Modified: stable/8/lib/libc/sys/stack_protector.c ============================================================================== --- stable/8/lib/libc/sys/stack_protector.c Tue Sep 7 12:04:07 2010 (r212289) +++ stable/8/lib/libc/sys/stack_protector.c Tue Sep 7 12:06:41 2010 (r212290) @@ -107,8 +107,6 @@ __chk_fail(void) __fail("buffer overflow detected; terminated"); } -#ifdef PIC -__sym_compat(__stack_chk_fail_local, __stack_chk_fail, FBSD_1.0); -#else +#ifndef PIC __weak_reference(__stack_chk_fail, __stack_chk_fail_local); #endif Copied: stable/8/lib/libc/sys/stack_protector_compat.c (from r211748, head/lib/libc/sys/stack_protector_compat.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libc/sys/stack_protector_compat.c Tue Sep 7 12:06:41 2010 (r212290, copy of r211748, head/lib/libc/sys/stack_protector_compat.c) @@ -0,0 +1,20 @@ +/* + * Written by Alexander Kabaev + * The file is in public domain. + */ + +#include +__FBSDID("$FreeBSD$"); + +void __stack_chk_fail(void); + +#ifdef PIC +void +__stack_chk_fail_local_hidden(void) +{ + + __stack_chk_fail(); +} + +__sym_compat(__stack_chk_fail_local, __stack_chk_fail_local_hidden, FBSD_1.0); +#endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 13:10:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6FFD1065695; Tue, 7 Sep 2010 13:10:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5F678FC08; Tue, 7 Sep 2010 13:10: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 o87DAkEJ099621; Tue, 7 Sep 2010 13:10:46 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87DAk66099619; Tue, 7 Sep 2010 13:10:46 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009071310.o87DAk66099619@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 7 Sep 2010 13:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212291 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 13:10:46 -0000 Author: bz Date: Tue Sep 7 13:10:46 2010 New Revision: 212291 URL: http://svn.freebsd.org/changeset/base/212291 Log: MFC r212209: In case of RADIX_MPATH do not leak the IN_IFADDR read lock on early return. Modified: stable/8/sys/netinet/in.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Tue Sep 7 12:06:41 2010 (r212290) +++ stable/8/sys/netinet/in.c Tue Sep 7 13:10:46 2010 (r212291) @@ -1042,9 +1042,10 @@ in_addprefix(struct in_ifaddr *target, i if (ia->ia_flags & IFA_ROUTE) { #ifdef RADIX_MPATH if (ia->ia_addr.sin_addr.s_addr == - target->ia_addr.sin_addr.s_addr) + target->ia_addr.sin_addr.s_addr) { + IN_IFADDR_RUNLOCK(); return (EEXIST); - else + } else break; #endif if (V_sameprefixcarponly && From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 13:50:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 604CA1065670; Tue, 7 Sep 2010 13:50:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 357668FC16; Tue, 7 Sep 2010 13:50: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 o87Do3fh001115; Tue, 7 Sep 2010 13:50:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87Do3K7001113; Tue, 7 Sep 2010 13:50:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009071350.o87Do3K7001113@svn.freebsd.org> From: John Baldwin Date: Tue, 7 Sep 2010 13:50: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: r212292 - head/sys/x86/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 13:50:03 -0000 Author: jhb Date: Tue Sep 7 13:50:02 2010 New Revision: 212292 URL: http://svn.freebsd.org/changeset/base/212292 Log: Each processor socket in a QPI system has a special PCI bus for the "uncore" devices (such as the memory controller) in that socket. Stop hardcoding support for two busses, but instead start probing buses at domain 0, bus 255 and walk down until a bus probe fails. Also, do not probe a bus if it has already been enumerated elsewhere (e.g. if ACPI ever enumerates these buses in the future). Modified: head/sys/x86/pci/qpi.c Modified: head/sys/x86/pci/qpi.c ============================================================================== --- head/sys/x86/pci/qpi.c Tue Sep 7 13:10:46 2010 (r212291) +++ head/sys/x86/pci/qpi.c Tue Sep 7 13:50:02 2010 (r212292) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include "pcib_if.h" @@ -84,31 +85,62 @@ qpi_probe(device_t dev) return (BUS_PROBE_SPECIFIC); } +/* + * Look for a PCI bus with the specified bus address. If one is found, + * add a pcib device and return 0. Otherwise, return an error code. + */ static int -qpi_attach(device_t dev) +qpi_probe_pcib(device_t dev, int bus) { struct qpi_device *qdev; device_t child; + uint32_t devid; /* - * Add two Host-PCI bridge devices, one for PCI bus 254 and - * one for PCI bus 255. + * If a PCI bus already exists for this bus number, then + * fail. */ - child = BUS_ADD_CHILD(dev, 0, "pcib", -1); - if (child == NULL) - panic("%s: failed to add pci bus 254", - device_get_nameunit(dev)); - qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK); - qdev->qd_pcibus = 254; - device_set_ivars(child, qdev); + if (pci_find_bsf(bus, 0, 0) != NULL) + return (EEXIST); + + /* + * Attempt to read the device id for device 0, function 0 on + * the bus. A value of 0xffffffff means that the bus is not + * present. + */ + devid = pci_cfgregread(bus, 0, 0, PCIR_DEVVENDOR, 4); + if (devid == 0xffffffff) + return (ENOENT); + + if ((devid & 0xffff) != 0x8086) { + device_printf(dev, + "Device at pci%d.0.0 has non-Intel vendor 0x%x\n", bus, + devid & 0xffff); + return (ENXIO); + } child = BUS_ADD_CHILD(dev, 0, "pcib", -1); if (child == NULL) - panic("%s: failed to add pci bus 255", - device_get_nameunit(dev)); + panic("%s: failed to add pci bus %d", device_get_nameunit(dev), + bus); qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK); - qdev->qd_pcibus = 255; + qdev->qd_pcibus = bus; device_set_ivars(child, qdev); + return (0); +} + +static int +qpi_attach(device_t dev) +{ + int bus; + + /* + * Each processor socket has a dedicated PCI bus counting down from + * 255. We keep probing buses until one fails. + */ + for (bus = 255;; bus--) + if (qpi_probe_pcib(dev, bus) != 0) + break; return (bus_generic_attach(dev)); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 14:29:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86E5D10656C0; Tue, 7 Sep 2010 14:29:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BDBE8FC21; Tue, 7 Sep 2010 14:29: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 o87ETjVa002404; Tue, 7 Sep 2010 14:29:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87ETjLq002398; Tue, 7 Sep 2010 14:29:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009071429.o87ETjLq002398@svn.freebsd.org> From: John Baldwin Date: Tue, 7 Sep 2010 14:29: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: r212293 - in head/sys: fs/nfsclient nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 14:29:45 -0000 Author: jhb Date: Tue Sep 7 14:29:45 2010 New Revision: 212293 URL: http://svn.freebsd.org/changeset/base/212293 Log: Store the full timestamp when caching timestamps of files and directories for purposes of validating name cache entries. This closes races where two updates to a file or directory within the same second could result in stale entries in the name cache. While here, remove the 'n_expiry' field as it is no longer used. Reviewed by: rmacklem MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsnode.h head/sys/nfsclient/nfs_vnops.c head/sys/nfsclient/nfsnode.h Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Tue Sep 7 13:50:02 2010 (r212292) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Tue Sep 7 14:29:45 2010 (r212293) @@ -3293,8 +3293,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); if (cnp->cn_namelen <= NCHNAMLEN) { - np->n_ctime = - np->n_vattr.na_ctime.tv_sec; + np->n_ctime = np->n_vattr.na_ctime; cache_enter(ndp->ni_dvp,ndp->ni_vp,cnp); } if (unlocknewvp) Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue Sep 7 13:50:02 2010 (r212292) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Sep 7 14:29:45 2010 (r212293) @@ -988,7 +988,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct nfsfh *nfhp; struct nfsvattr dnfsva, nfsva; struct vattr vattr; - time_t dmtime; + struct timespec dmtime; *vpp = NULLVP; if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) && @@ -1038,7 +1038,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (nfscl_nodeleg(newvp, 0) == 0 || (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_ctime.tv_sec == newnp->n_ctime)) { + timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -1065,13 +1065,13 @@ nfs_lookup(struct vop_lookup_args *ap) if ((u_int)(ticks - np->n_dmtime_ticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_mtime.tv_sec == np->n_dmtime) { + timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); return (ENOENT); } cache_purge_negative(dvp); mtx_lock(&np->n_mtx); - np->n_dmtime = 0; + timespecclear(&np->n_dmtime); mtx_unlock(&np->n_mtx); } @@ -1086,7 +1086,7 @@ nfs_lookup(struct vop_lookup_args *ap) * the lookup RPC has been performed on the server but before * n_dmtime is set at the end of this function. */ - dmtime = np->n_vattr.na_mtime.tv_sec; + dmtime = np->n_vattr.na_mtime; error = 0; newvp = NULLVP; NFSINCRGLOBAL(newnfsstats.lookupcache_misses); @@ -1139,8 +1139,8 @@ nfs_lookup(struct vop_lookup_args *ap) * lookup. */ mtx_lock(&np->n_mtx); - if (np->n_dmtime <= dmtime) { - if (np->n_dmtime == 0) { + if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { + if (!timespecisset(&np->n_dmtime)) { np->n_dmtime = dmtime; np->n_dmtime_ticks = ticks; } @@ -1241,7 +1241,7 @@ nfs_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.na_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.na_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; Modified: head/sys/fs/nfsclient/nfsnode.h ============================================================================== --- head/sys/fs/nfsclient/nfsnode.h Tue Sep 7 13:50:02 2010 (r212292) +++ head/sys/fs/nfsclient/nfsnode.h Tue Sep 7 14:29:45 2010 (r212293) @@ -96,10 +96,9 @@ struct nfsnode { time_t n_attrstamp; /* Attr. cache timestamp */ struct nfs_accesscache n_accesscache[NFS_ACCESSCACHESIZE]; struct timespec n_mtime; /* Prev modify time. */ - time_t n_ctime; /* Prev create time. */ - time_t n_dmtime; /* Prev dir modify time. */ + struct timespec n_ctime; /* Prev create time. */ + struct timespec n_dmtime; /* Prev dir modify time. */ int n_dmtime_ticks; /* Tick of -ve cache entry */ - time_t n_expiry; /* Lease expiry time */ struct nfsfh *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ struct vnode *n_dvp; /* parent vnode */ Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Tue Sep 7 13:50:02 2010 (r212292) +++ head/sys/nfsclient/nfs_vnops.c Tue Sep 7 14:29:45 2010 (r212293) @@ -916,7 +916,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode **vpp = ap->a_vpp; struct mount *mp = dvp->v_mount; struct vattr vattr; - time_t dmtime; + struct timespec dmtime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -970,7 +970,7 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_ctime.tv_sec == newnp->n_ctime) { + timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -997,13 +997,13 @@ nfs_lookup(struct vop_lookup_args *ap) if ((u_int)(ticks - np->n_dmtime_ticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_mtime.tv_sec == np->n_dmtime) { + timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { nfsstats.lookupcache_hits++; return (ENOENT); } cache_purge_negative(dvp); mtx_lock(&np->n_mtx); - np->n_dmtime = 0; + timespecclear(&np->n_dmtime); mtx_unlock(&np->n_mtx); } @@ -1018,7 +1018,7 @@ nfs_lookup(struct vop_lookup_args *ap) * the lookup RPC has been performed on the server but before * n_dmtime is set at the end of this function. */ - dmtime = np->n_vattr.va_mtime.tv_sec; + dmtime = np->n_vattr.va_mtime; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1137,7 +1137,7 @@ nfs_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; @@ -1183,8 +1183,8 @@ nfsmout: * lookup. */ mtx_lock(&np->n_mtx); - if (np->n_dmtime <= dmtime) { - if (np->n_dmtime == 0) { + if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { + if (!timespecisset(&np->n_dmtime)) { np->n_dmtime = dmtime; np->n_dmtime_ticks = ticks; } @@ -2657,8 +2657,11 @@ nfs_readdirplusrpc(struct vnode *vp, str dp->d_type = IFTODT(VTTOIF(np->n_vattr.va_type)); ndp->ni_vp = newvp; - /* Update n_ctime, so subsequent lookup doesn't purge entry */ - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + /* + * Update n_ctime so subsequent lookup + * doesn't purge entry. + */ + np->n_ctime = np->n_vattr.va_ctime; cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); } } else { Modified: head/sys/nfsclient/nfsnode.h ============================================================================== --- head/sys/nfsclient/nfsnode.h Tue Sep 7 13:50:02 2010 (r212292) +++ head/sys/nfsclient/nfsnode.h Tue Sep 7 14:29:45 2010 (r212293) @@ -102,10 +102,9 @@ struct nfsnode { time_t n_attrstamp; /* Attr. cache timestamp */ struct nfs_accesscache n_accesscache[NFS_ACCESSCACHESIZE]; struct timespec n_mtime; /* Prev modify time. */ - time_t n_ctime; /* Prev create time. */ - time_t n_dmtime; /* Prev dir modify time. */ + struct timespec n_ctime; /* Prev create time. */ + struct timespec n_dmtime; /* Prev dir modify time. */ int n_dmtime_ticks; /* Tick of -ve cache entry */ - time_t n_expiry; /* Lease expiry time */ nfsfh_t *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ struct vnode *n_dvp; /* parent vnode */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 16:36:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD5601065672; Tue, 7 Sep 2010 16:36:03 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CB098FC16; Tue, 7 Sep 2010 16:36: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 o87Ga3mv006523; Tue, 7 Sep 2010 16:36:03 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87Ga3IN006521; Tue, 7 Sep 2010 16:36:03 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201009071636.o87Ga3IN006521@svn.freebsd.org> From: Maksim Yevmenkin Date: Tue, 7 Sep 2010 16:36: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: r212296 - head/usr.sbin/bluetooth/bthidcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 16:36:03 -0000 Author: emax Date: Tue Sep 7 16:36:03 2010 New Revision: 212296 URL: http://svn.freebsd.org/changeset/base/212296 Log: Do not request SDP attributes using ranges. Apparently some devices do not like it. MFC after: 1 week Tested by: Buganini < buganini at gmail dot com > Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c ============================================================================== --- head/usr.sbin/bluetooth/bthidcontrol/sdp.c Tue Sep 7 15:23:00 2010 (r212295) +++ head/usr.sbin/bluetooth/bthidcontrol/sdp.c Tue Sep 7 16:36:03 2010 (r212296) @@ -54,7 +54,9 @@ SDP_ATTR_RANGE( SDP_ATTR_PROTOCOL_DESCRI SDP_ATTR_RANGE (SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS, SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS), SDP_ATTR_RANGE( 0x0205, /* HIDReconnectInitiate */ - 0x0206), /* HIDDescriptorList */ + 0x0205), +SDP_ATTR_RANGE( 0x0206, /* HIDDescriptorList */ + 0x0206), SDP_ATTR_RANGE( 0x0209, /* HIDBatteryPower */ 0x0209), SDP_ATTR_RANGE( 0x020d, /* HIDNormallyConnectable */ @@ -149,7 +151,7 @@ hid_sdp_query(bdaddr_t const *local, str } if (control_psm == -1 || interrupt_psm == -1 || - reconnect_initiate == -1 || normally_connectable == -1 || + reconnect_initiate == -1 || hid_descriptor == NULL || hid_descriptor_length == -1) hid_sdp_query_exit(ENOATTR); From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 18:09:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D19A10656C4; Tue, 7 Sep 2010 18:09:57 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1DE0D8FC26; Tue, 7 Sep 2010 18:09:56 +0000 (UTC) Received: by pvg4 with SMTP id 4so2217532pvg.13 for ; Tue, 07 Sep 2010 11:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=LETa/hoEBe7w9ygIBNMR0PpkDP24iDTsP3C2aRsE7jw=; b=VUUEOI8XRnJHE3T0hewGRTwmxRweeYByjoUx6aonTiMWUppGQ78EZV99BUDmHglicc bJ46CYlo6c3z7DVWjX1VqLURe2VzEAe47+3S3xKvLQWlCjYYW/AdZT8UT6G/pNELWt2O F/BAVX3KgTq8ytKH9mP649RuxnnHRI8U1f2UQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=mgY4+YX8x9p3OZiPMY2gy7pblXaIpSjxr7ru5/Vhtp0CuNV39jNxqfR5iQSbFYkf7p 8lqnI7QlHn4/yJ4oiQIVGrWMoPXilS8FvegJsDGyPKTuEG9QNhMJfF45idka/kPX1L3P vwgOuEbykUaPkAvkMU8FP42iO9vQZ3pJT07QE= Received: by 10.142.14.21 with SMTP id 21mr171873wfn.198.1283882994790; Tue, 07 Sep 2010 11:09:54 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id 9sm6080631wfd.0.2010.09.07.11.09.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Sep 2010 11:09:53 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Tue, 7 Sep 2010 11:09:34 -0700 From: Pyun YongHyeon Date: Tue, 7 Sep 2010 11:09:34 -0700 To: Christian Brueffer Message-ID: <20100907180934.GD1439@michelle.cdnetworks.com> References: <201009061102.o86B2oA3044130@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201009061102.o86B2oA3044130@svn.freebsd.org> 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: r212254 - head/release/doc/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 18:09:57 -0000 On Mon, Sep 06, 2010 at 11:02:50AM +0000, Christian Brueffer wrote: > Author: brueffer > Date: Mon Sep 6 11:02:50 2010 > New Revision: 212254 > URL: http://svn.freebsd.org/changeset/base/212254 > > Log: > sis(4) should work on all architectures now. > Thanks a lot! From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 18:14:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 291AF1065672; Tue, 7 Sep 2010 18:14:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16D6E8FC1C; Tue, 7 Sep 2010 18:14: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 o87IEoY4014273; Tue, 7 Sep 2010 18:14:50 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87IEolf014267; Tue, 7 Sep 2010 18:14:50 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009071814.o87IEolf014267@svn.freebsd.org> From: Xin LI Date: Tue, 7 Sep 2010 18:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212300 - in stable/7/sys/boot/i386: boot2 gptboot loader zfsboot zfsloader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 18:14:51 -0000 Author: delphij Date: Tue Sep 7 18:14:50 2010 New Revision: 212300 URL: http://svn.freebsd.org/changeset/base/212300 Log: MFC r205662 + r212066 (except efi part): Our boot loader is capable of booting both i386 and amd64 kernels so call it "x86" instead of "i386". Modified: stable/7/sys/boot/i386/boot2/boot2.c stable/7/sys/boot/i386/gptboot/gptboot.c stable/7/sys/boot/i386/loader/Makefile stable/7/sys/boot/i386/zfsboot/zfsboot.c stable/7/sys/boot/i386/zfsloader/Makefile Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/7/sys/boot/i386/boot2/boot2.c Tue Sep 7 17:56:29 2010 (r212299) +++ stable/7/sys/boot/i386/boot2/boot2.c Tue Sep 7 18:14:50 2010 (r212300) @@ -283,7 +283,7 @@ main(void) for (;;) { if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/i386 boot\n" + printf("\nFreeBSD/x86 boot\n" "Default: %u:%s(%u,%c)%s\n" "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, Modified: stable/7/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- stable/7/sys/boot/i386/gptboot/gptboot.c Tue Sep 7 17:56:29 2010 (r212299) +++ stable/7/sys/boot/i386/gptboot/gptboot.c Tue Sep 7 18:14:50 2010 (r212300) @@ -281,7 +281,7 @@ main(void) for (;;) { if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/i386 boot\n" + printf("\nFreeBSD/x86 boot\n" "Default: %u:%s(%up%u)%s\n" "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, Modified: stable/7/sys/boot/i386/loader/Makefile ============================================================================== --- stable/7/sys/boot/i386/loader/Makefile Tue Sep 7 17:56:29 2010 (r212299) +++ stable/7/sys/boot/i386/loader/Makefile Tue Sep 7 18:14:50 2010 (r212300) @@ -5,7 +5,7 @@ LOADER?= loader PROG= ${LOADER}.sym INTERNALPROG= -NEWVERSWHAT?= "bootstrap loader" i386 +NEWVERSWHAT?= "bootstrap loader" x86 # architecture-specific loader code SRCS= main.c conf.c vers.c Modified: stable/7/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/7/sys/boot/i386/zfsboot/zfsboot.c Tue Sep 7 17:56:29 2010 (r212299) +++ stable/7/sys/boot/i386/zfsboot/zfsboot.c Tue Sep 7 18:14:50 2010 (r212300) @@ -731,7 +731,7 @@ main(void) for (;;) { if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/i386 boot\n" + printf("\nFreeBSD/x86 boot\n" "Default: %s:%s\n" "boot: ", spa->spa_name, kname); Modified: stable/7/sys/boot/i386/zfsloader/Makefile ============================================================================== --- stable/7/sys/boot/i386/zfsloader/Makefile Tue Sep 7 17:56:29 2010 (r212299) +++ stable/7/sys/boot/i386/zfsloader/Makefile Tue Sep 7 18:14:50 2010 (r212300) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../loader LOADER= zfsloader -NEWVERSWHAT= "ZFS enabled bootstrap loader" i386 +NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 LOADER_ZFS_SUPPORT=yes LOADER_ONLY= yes NO_MAN= yes From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 18:14:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92D251065811; Tue, 7 Sep 2010 18:14:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80D5E8FC26; Tue, 7 Sep 2010 18:14: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 o87IExmI014328; Tue, 7 Sep 2010 18:14:59 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87IEx4h014322; Tue, 7 Sep 2010 18:14:59 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009071814.o87IEx4h014322@svn.freebsd.org> From: Xin LI Date: Tue, 7 Sep 2010 18:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212301 - in stable/8/sys/boot/i386: boot2 gptboot loader zfsboot zfsloader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 18:14:59 -0000 Author: delphij Date: Tue Sep 7 18:14:59 2010 New Revision: 212301 URL: http://svn.freebsd.org/changeset/base/212301 Log: MFC r205662 + r212066 (except efi part): Our boot loader is capable of booting both i386 and amd64 kernels so call it "x86" instead of "i386". Modified: stable/8/sys/boot/i386/boot2/boot2.c stable/8/sys/boot/i386/gptboot/gptboot.c stable/8/sys/boot/i386/loader/Makefile stable/8/sys/boot/i386/zfsboot/zfsboot.c stable/8/sys/boot/i386/zfsloader/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/i386/boot2/boot2.c Tue Sep 7 18:14:50 2010 (r212300) +++ stable/8/sys/boot/i386/boot2/boot2.c Tue Sep 7 18:14:59 2010 (r212301) @@ -283,7 +283,7 @@ main(void) for (;;) { if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/i386 boot\n" + printf("\nFreeBSD/x86 boot\n" "Default: %u:%s(%u,%c)%s\n" "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, Modified: stable/8/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- stable/8/sys/boot/i386/gptboot/gptboot.c Tue Sep 7 18:14:50 2010 (r212300) +++ stable/8/sys/boot/i386/gptboot/gptboot.c Tue Sep 7 18:14:59 2010 (r212301) @@ -281,7 +281,7 @@ main(void) for (;;) { if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/i386 boot\n" + printf("\nFreeBSD/x86 boot\n" "Default: %u:%s(%up%u)%s\n" "boot: ", dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, Modified: stable/8/sys/boot/i386/loader/Makefile ============================================================================== --- stable/8/sys/boot/i386/loader/Makefile Tue Sep 7 18:14:50 2010 (r212300) +++ stable/8/sys/boot/i386/loader/Makefile Tue Sep 7 18:14:59 2010 (r212301) @@ -6,7 +6,7 @@ MK_SSP= no LOADER?= loader PROG= ${LOADER}.sym INTERNALPROG= -NEWVERSWHAT?= "bootstrap loader" i386 +NEWVERSWHAT?= "bootstrap loader" x86 # architecture-specific loader code SRCS= main.c conf.c vers.c Modified: stable/8/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/8/sys/boot/i386/zfsboot/zfsboot.c Tue Sep 7 18:14:50 2010 (r212300) +++ stable/8/sys/boot/i386/zfsboot/zfsboot.c Tue Sep 7 18:14:59 2010 (r212301) @@ -731,7 +731,7 @@ main(void) for (;;) { if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/i386 boot\n" + printf("\nFreeBSD/x86 boot\n" "Default: %s:%s\n" "boot: ", spa->spa_name, kname); Modified: stable/8/sys/boot/i386/zfsloader/Makefile ============================================================================== --- stable/8/sys/boot/i386/zfsloader/Makefile Tue Sep 7 18:14:50 2010 (r212300) +++ stable/8/sys/boot/i386/zfsloader/Makefile Tue Sep 7 18:14:59 2010 (r212301) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../loader LOADER= zfsloader -NEWVERSWHAT= "ZFS enabled bootstrap loader" i386 +NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 LOADER_ZFS_SUPPORT=yes LOADER_ONLY= yes NO_MAN= yes From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 18:29:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C353110656C5; Tue, 7 Sep 2010 18:29:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2C5A8FC1E; Tue, 7 Sep 2010 18:29:29 +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 o87ITTJ5016470; Tue, 7 Sep 2010 18:29:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87ITTST016468; Tue, 7 Sep 2010 18:29:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009071829.o87ITTST016468@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 7 Sep 2010 18:29:29 +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: r212302 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 18:29:29 -0000 Author: yongari Date: Tue Sep 7 18:29:29 2010 New Revision: 212302 URL: http://svn.freebsd.org/changeset/base/212302 Log: Make sure to create DMA'able memory for statistics block. This was missed in r212061 and it caused crashes for 570x controllers as controller DMAed statistics to physical address 0. Reported by: kan Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Sep 7 18:14:59 2010 (r212301) +++ head/sys/dev/bge/if_bge.c Tue Sep 7 18:29:29 2010 (r212302) @@ -2258,6 +2258,15 @@ bge_dma_alloc(struct bge_softc *sc) if (error) return (error); + /* Create tag for statistics block. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_STATS_SZ, + &sc->bge_cdata.bge_stats_tag, + (uint8_t **)&sc->bge_ldata.bge_stats, + &sc->bge_cdata.bge_stats_map, + &sc->bge_ldata.bge_stats_paddr, "statistics block"); + if (error) + return (error); + /* Create tag for jumbo RX ring. */ if (BGE_IS_JUMBO_CAPABLE(sc)) { error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_JUMBO_RX_RING_SZ, From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 18:31:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC58410656A9; Tue, 7 Sep 2010 18:31:10 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id A5D138FC14; Tue, 7 Sep 2010 18:31:10 +0000 (UTC) Received: by pxi17 with SMTP id 17so1713509pxi.13 for ; Tue, 07 Sep 2010 11:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=sCROuf1W2SYba8yA0e1JT4oFw33jXHei2Ex+VKmTFFw=; b=MrT5rKp3UpvRZa3QorubJTq5fL3HZHM3fM9T7F1a9ESiEM0CqaJT6GtiVaMwFw/7Gk nuf8+whJdL9K90yITGpktv2IyBxcjQVtCDYNt/I77Kwp3+Nz/w9HDFDobvgSBiwJbrLL 8jyY7w3cBbl++e/4XjeB12AvgNgLEYVuKV0PE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=mADFHAWT3EuVRLQXSCL8quggi0zzl5S6kXJ6l47D7UjLfvreJjtS7VMa1nyzawFtmX NXKX8GATBUyxdFwzq6uNo9NEHK0iazYb8Pifwch7RenapLzVR5hFtgJ/jUrogtqHvKdx +y413QOCvrrbAi4j3E066tj7q9y++BGOPZeOY= Received: by 10.142.60.21 with SMTP id i21mr12351wfa.175.1283884269989; Tue, 07 Sep 2010 11:31:09 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id l41sm6100174wfa.1.2010.09.07.11.31.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Sep 2010 11:31:08 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Tue, 7 Sep 2010 11:30:49 -0700 From: Pyun YongHyeon Date: Tue, 7 Sep 2010 11:30:49 -0700 To: Alexander Kabaev Message-ID: <20100907183049.GE1439@michelle.cdnetworks.com> References: <201008311733.o7VHXmxX037013@svn.freebsd.org> <20100904002933.6fb53534@kan.dnsalias.net> 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, Pyun YongHyeon Subject: Re: svn commit: r212061 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 18:31:11 -0000 On Fri, Sep 03, 2010 at 11:27:14PM -0700, Pyun YongHyeon wrote: > On Fri, Sep 3, 2010 at 9:29 PM, Alexander Kabaev wrote: > > On Tue, 31 Aug 2010 17:33:48 +0000 (UTC) > > Pyun YongHyeon wrote: > > > >> Author: yongari > >> Date: Tue Aug 31 17:33:48 2010 > >> New Revision: 212061 > >> URL: http://svn.freebsd.org/changeset/base/212061 > >> > >> Log: > >> ? Split common parent DMA tag into ring DMA tag and TX/RX mbuf DMA > >> ? tag. All controllers that are not BCM5755 or higher have 4GB > >> ? boundary DMA bug. Previously bge(4) used 32bit DMA address to > >> ? workaround the bug(r199670). However this caused the use of bounce > >> ? buffers such that it resulted in poor performance for systems which > >> ? have more than 4GB memory. Because bus_dma(9) honors boundary > >> ? restriction requirement of DMA tag for dynamic buffers, having a > >> ? separate TX/RX mbuf DMA tag will greatly reduce the possibility of > >> ? using bounce buffers. For DMA buffers allocated with > >> ? bus_dmamem_alloc(9), now bge(4) explicitly checks whether the > >> ? requested memory region crossed the boundary or not. > >> ? With this change, only the DMA buffer that crossed the boundary > >> ? will use 32bit DMA address. Other DMA buffers are not affected as > >> ? separate DMA tag is created for each DMA buffer. > >> ? Even if 32bit DMA address space is used for a buffer, the chance to > >> ? use bounce buffer is still very low as the size of buffer is small. > >> ? This change should eliminate most usage of bounce buffers on > >> ? systems that have more than 4GB memory. > >> > >> ? More correct fix would be teaching bus_dma(9) to honor boundary > >> ? restriction for buffers created with bus_dmamem_alloc(9) but it > >> ? seems that is not easy. > >> > >> ? While I'm here cleanup bge_dma_map_addr() and remove unnecessary > >> ? member variables in bge_dmamap_arg structure. > >> > >> ? Tested by: ?marcel > >> > >> Modified: > >> ? head/sys/dev/bge/if_bge.c > >> ? head/sys/dev/bge/if_bgereg.h > >> > > > > Hi, > > > > with this commit my AMD64 machine reliably reboots after several > > minutes of uptime. Attempting cvs update of ports from repository > > located on NFS server seems to make it happen sooner. > > > > > > bge0: > ?0x001002> mem 0xfd8f0000-0xfd8fffff irq 24 at device 9.0 on pci2 > > miibus0: on bge0 > > brgphy0: PHY 1 on miibus0 > > brgphy0: ?10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, > > 1000baseT-FDX, auto > > bge0: Ethernet address: 00:e0:81:28:24:e7 > > bge0: [ITHREAD] > > > > Booting kernel tree from just before this commit makes everything work > > again. > > Sorry, it seems I forgot allocating statistics block. This may cause > issues for controllers(e.g. 570x) that support hardware MAC statistics > counters. This could be the reason why I couldn't see the issue on 5761. > I'm on vacation so I'll fix it Tuesday. If it's urgent please back out this > change. > Fix committed in r212302. From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 20:13:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3514E1065698; Tue, 7 Sep 2010 20:13:09 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23E9C8FC14; Tue, 7 Sep 2010 20:13: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 o87KD97K031106; Tue, 7 Sep 2010 20:13:09 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87KD8rW031103; Tue, 7 Sep 2010 20:13:08 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201009072013.o87KD8rW031103@svn.freebsd.org> From: Jack F Vogel Date: Tue, 7 Sep 2010 20:13: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: r212303 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 20:13:09 -0000 Author: jfv Date: Tue Sep 7 20:13:08 2010 New Revision: 212303 URL: http://svn.freebsd.org/changeset/base/212303 Log: Tighten up the rx mbuf refresh code, there were some discrepencies from the igb version which was the target. Change the message when neither MSI or MSIX are enabled and a fallback to Legacy interrupts happen, the existing message was confusing. Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Sep 7 18:29:29 2010 (r212302) +++ head/sys/dev/e1000/if_em.c Tue Sep 7 20:13:08 2010 (r212303) @@ -93,7 +93,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.0.5"; +char em_driver_version[] = "7.0.6"; /********************************************************************* @@ -281,6 +281,8 @@ static void em_handle_link(void *context static void em_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); +static __inline void em_rx_discard(struct rx_ring *, int); + #ifdef DEVICE_POLLING static poll_handler_t em_poll; #endif /* POLLING */ @@ -2563,11 +2565,11 @@ msi: val = pci_msi_count(dev); if (val == 1 && pci_alloc_msi(dev, &val) == 0) { adapter->msix = 1; - device_printf(adapter->dev,"Using MSI interrupt\n"); + device_printf(adapter->dev,"Using an MSI interrupt\n"); return (val); } - /* Should only happen due to manual invention */ - device_printf(adapter->dev,"Setup MSIX failure\n"); + /* Should only happen due to manual configuration */ + device_printf(adapter->dev,"No MSI/MSIX using a Legacy IRQ\n"); return (0); } @@ -3681,14 +3683,27 @@ em_refresh_mbufs(struct rx_ring *rxr, in struct adapter *adapter = rxr->adapter; struct mbuf *m; bus_dma_segment_t segs[1]; - bus_dmamap_t map; struct em_buffer *rxbuf; int i, error, nsegs, cleaned; i = rxr->next_to_refresh; cleaned = -1; while (i != limit) { + rxbuf = &rxr->rx_buffers[i]; + /* + ** Just skip entries with a buffer, + ** they can only be due to an error + ** and are to be reused. + */ + if (rxbuf->m_head != NULL) + continue; m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + /* + ** If we have a temporary resource shortage + ** that causes a failure, just abort refresh + ** for now, we will return to this point when + ** reinvoked from em_rxeof. + */ if (m == NULL) goto update; m->m_len = m->m_pkthdr.len = MCLBYTES; @@ -3696,11 +3711,8 @@ em_refresh_mbufs(struct rx_ring *rxr, in if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) m_adj(m, ETHER_ALIGN); - /* - * Using memory from the mbuf cluster pool, invoke the - * bus_dma machinery to arrange the memory mapping. - */ - error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxr->rx_sparemap, + /* Use bus_dma machinery to setup the memory mapping */ + error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { m_free(m); @@ -3710,13 +3722,6 @@ em_refresh_mbufs(struct rx_ring *rxr, in /* If nsegs is wrong then the stack is corrupt. */ KASSERT(nsegs == 1, ("Too many segments returned!")); - rxbuf = &rxr->rx_buffers[i]; - if (rxbuf->m_head != NULL) - bus_dmamap_unload(rxr->rxtag, rxbuf->map); - - map = rxbuf->map; - rxbuf->map = rxr->rx_sparemap; - rxr->rx_sparemap = map; bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); rxbuf->m_head = m; @@ -3730,8 +3735,10 @@ em_refresh_mbufs(struct rx_ring *rxr, in rxr->next_to_refresh = i; } update: - bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* + ** Update the tail pointer only if, + ** and as far as we have refreshed. + */ if (cleaned != -1) /* Update tail index */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), cleaned); @@ -3781,15 +3788,6 @@ em_allocate_receive_buffers(struct rx_ri goto fail; } - /* Create the spare map (used by getbuf) */ - error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT, - &rxr->rx_sparemap); - if (error) { - device_printf(dev, "%s: bus_dmamap_create failed: %d\n", - __func__, error); - goto fail; - } - rxbuf = rxr->rx_buffers; for (int i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { rxbuf = &rxr->rx_buffers[i]; @@ -3956,11 +3954,6 @@ em_free_receive_buffers(struct rx_ring * INIT_DEBUGOUT("free_receive_buffers: begin"); - if (rxr->rx_sparemap) { - bus_dmamap_destroy(rxr->rxtag, rxr->rx_sparemap); - rxr->rx_sparemap = NULL; - } - if (rxr->rx_buffers != NULL) { for (int i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; @@ -4132,12 +4125,16 @@ em_rxeof(struct rx_ring *rxr, int count, eop = (status & E1000_RXD_STAT_EOP) != 0; count--; - if ((cur->errors & E1000_RXD_ERR_FRAME_ERR_MASK) == 0) { + if (((cur->errors & E1000_RXD_ERR_FRAME_ERR_MASK) == 0) && + (rxr->discard == FALSE)) { /* Assign correct length to the current fragment */ mp = rxr->rx_buffers[i].m_head; mp->m_len = len; + /* Trigger for refresh */ + rxr->rx_buffers[i].m_head = NULL; + if (rxr->fmp == NULL) { mp->m_pkthdr.len = len; rxr->fmp = mp; /* Store the first mbuf */ @@ -4179,19 +4176,12 @@ skip: } } else { ifp->if_ierrors++; - /* Reuse loaded DMA map and just update mbuf chain */ - mp = rxr->rx_buffers[i].m_head; - mp->m_len = mp->m_pkthdr.len = MCLBYTES; - mp->m_data = mp->m_ext.ext_buf; - mp->m_next = NULL; - if (adapter->max_frame_size <= - (MCLBYTES - ETHER_ALIGN)) - m_adj(mp, ETHER_ALIGN); - if (rxr->fmp != NULL) { - m_freem(rxr->fmp); - rxr->fmp = NULL; - rxr->lmp = NULL; - } + ++rxr->rx_discarded; + if (!eop) /* Catch subsequent segs */ + rxr->discard = TRUE; + else + rxr->discard = FALSE; + em_rx_discard(rxr, i); sendmp = NULL; } @@ -4234,6 +4224,31 @@ skip: return ((status & E1000_RXD_STAT_DD) ? TRUE : FALSE); } +static __inline void +em_rx_discard(struct rx_ring *rxr, int i) +{ + struct em_buffer *rbuf; + struct mbuf *m; + + rbuf = &rxr->rx_buffers[i]; + /* Free any previous pieces */ + if (rxr->fmp != NULL) { + rxr->fmp->m_flags |= M_PKTHDR; + m_freem(rxr->fmp); + rxr->fmp = NULL; + rxr->lmp = NULL; + } + + /* Reset state, keep loaded DMA map and reuse */ + m = rbuf->m_head; + m->m_len = m->m_pkthdr.len = MCLBYTES; + m->m_flags |= M_PKTHDR; + m->m_data = m->m_ext.ext_buf; + m->m_next = NULL; + + return; +} + #ifndef __NO_STRICT_ALIGNMENT /* * When jumbo frames are enabled we should realign entire payload on @@ -5159,8 +5174,6 @@ em_add_hw_stats(struct adapter *adapter) CTLFLAG_RD, &adapter->stats.hrmpc, "Header Redirection Missed Packet Count"); - - } /********************************************************************** @@ -5170,7 +5183,6 @@ em_add_hw_stats(struct adapter *adapter) * 32 words, stuff that matters is in that extent. * **********************************************************************/ - static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) { Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Tue Sep 7 18:29:29 2010 (r212302) +++ head/sys/dev/e1000/if_em.h Tue Sep 7 20:13:08 2010 (r212303) @@ -320,10 +320,11 @@ struct rx_ring { void *tag; struct resource *res; bus_dma_tag_t rxtag; - bus_dmamap_t rx_sparemap; + bool discard; /* Soft stats */ unsigned long rx_irq; + unsigned long rx_discarded; unsigned long rx_packets; unsigned long rx_bytes; }; @@ -393,6 +394,7 @@ struct adapter { /* Multicast array memory */ u8 *mta; + /* Info about the board itself */ uint8_t link_active; uint16_t link_speed; From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 21:28:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63BBB10656D7; Tue, 7 Sep 2010 21:28:45 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5382B8FC17; Tue, 7 Sep 2010 21:28: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 o87LSjXc036441; Tue, 7 Sep 2010 21:28:45 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87LSjWB036439; Tue, 7 Sep 2010 21:28:45 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201009072128.o87LSjWB036439@svn.freebsd.org> From: Jack F Vogel Date: Tue, 7 Sep 2010 21:28: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: r212304 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 21:28:45 -0000 Author: jfv Date: Tue Sep 7 21:28:45 2010 New Revision: 212304 URL: http://svn.freebsd.org/changeset/base/212304 Log: Code correction in refresh_mbufs, just continuing without index recalc was wrong. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Sep 7 20:13:08 2010 (r212303) +++ head/sys/dev/e1000/if_em.c Tue Sep 7 21:28:45 2010 (r212304) @@ -3696,7 +3696,7 @@ em_refresh_mbufs(struct rx_ring *rxr, in ** and are to be reused. */ if (rxbuf->m_head != NULL) - continue; + goto reuse; m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); /* ** If we have a temporary resource shortage @@ -3726,7 +3726,7 @@ em_refresh_mbufs(struct rx_ring *rxr, in rxbuf->map, BUS_DMASYNC_PREREAD); rxbuf->m_head = m; rxr->rx_base[i].buffer_addr = htole64(segs[0].ds_addr); - +reuse: cleaned = i; /* Calculate next index */ if (++i == adapter->num_rx_desc) From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 21:38:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 85C9610656A4; Tue, 7 Sep 2010 21:38:37 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Tue, 7 Sep 2010 17:38:17 -0400 User-Agent: KMail/1.6.2 References: <201009060734.o867YWH8022846@svn.freebsd.org> <201009061128.40344.jhb@freebsd.org> In-Reply-To: <201009061128.40344.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009071738.22600.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212251 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 21:38:38 -0000 On Monday 06 September 2010 11:28 am, John Baldwin wrote: > On Monday 06 September 2010 03:34:32 am Andriy Gapon wrote: > > Author: avg > > Date: Mon Sep 6 07:34:32 2010 > > New Revision: 212251 > > URL: http://svn.freebsd.org/changeset/base/212251 > > > > Log: > > acpi_hp: fix bus attachment code > > > > - add identify method to create driver's own device_t > > - successfully probe only driver's own device_t instead of any > > device_t - (ab)use device order to hopefully be probed/attached > > after acpi_wmi > > Perhaps this should be a child of acpi_wmi0 instead? That would > fix the ordering issue as well as remove the need to avoid "real" > ACPI devices in the attach routine. +1 Jung-uk Kim From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 22:40:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 869D110656E0; Tue, 7 Sep 2010 22:40:45 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7654D8FC0A; Tue, 7 Sep 2010 22:40: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 o87MejDP041544; Tue, 7 Sep 2010 22:40:45 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87MejNN041542; Tue, 7 Sep 2010 22:40:45 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201009072240.o87MejNN041542@svn.freebsd.org> From: Ivan Voras Date: Tue, 7 Sep 2010 22:40: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: r212305 - head/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 22:40:45 -0000 Author: ivoras Date: Tue Sep 7 22:40:45 2010 New Revision: 212305 URL: http://svn.freebsd.org/changeset/base/212305 Log: Avoid "Entry can disappear before we lock fdvp" panic. PR: 150143 Submitted by: Gleb Kurtsou Pretty sure it won't blow up: mckusick MFC after: 2 weeks Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep 7 21:28:45 2010 (r212304) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep 7 22:40:45 2010 (r212305) @@ -981,10 +981,14 @@ tmpfs_rename(struct vop_rename_args *v) fnode = VP_TO_TMPFS_NODE(fvp); de = tmpfs_dir_lookup(fdnode, fnode, fcnp); - /* Avoid manipulating '.' and '..' entries. */ + /* Entry can disappear before we lock fdvp, + * also avoid manipulating '.' and '..' entries. */ if (de == NULL) { - MPASS(fvp->v_type == VDIR); - error = EINVAL; + if ((fcnp->cn_flags & ISDOTDOT) != 0 || + (fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.')) + error = EINVAL; + else + error = ENOENT; goto out_locked; } MPASS(de->td_node == fnode); From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 22:44:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40A1210656BA; Tue, 7 Sep 2010 22:44:30 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FF998FC08; Tue, 7 Sep 2010 22:44: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 o87MiUMr041961; Tue, 7 Sep 2010 22:44:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87MiUHS041959; Tue, 7 Sep 2010 22:44:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009072244.o87MiUHS041959@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 7 Sep 2010 22:44: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: r212306 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 22:44:30 -0000 Author: yongari Date: Tue Sep 7 22:44:29 2010 New Revision: 212306 URL: http://svn.freebsd.org/changeset/base/212306 Log: Remove trailing CR at EOL. Modified: head/sys/dev/mii/brgphyreg.h Modified: head/sys/dev/mii/brgphyreg.h ============================================================================== --- head/sys/dev/mii/brgphyreg.h Tue Sep 7 22:40:45 2010 (r212305) +++ head/sys/dev/mii/brgphyreg.h Tue Sep 7 22:44:29 2010 (r212306) @@ -262,103 +262,103 @@ #define BRGPHY_IMR_LNK_CHG 0x0002 /* Link status change */ #define BRGPHY_IMR_CRCERR 0x0001 /* CRC error */ -/*******************************************************/ -/* Begin: Shared SerDes PHY register definitions */ -/*******************************************************/ - -/* SerDes autoneg is different from copper */ -#define BRGPHY_SERDES_ANAR 0x04 -#define BRGPHY_SERDES_ANAR_FDX 0x0020 -#define BRGPHY_SERDES_ANAR_HDX 0x0040 -#define BRGPHY_SERDES_ANAR_NO_PAUSE (0x0 << 7) -#define BRGPHY_SERDES_ANAR_SYM_PAUSE (0x1 << 7) -#define BRGPHY_SERDES_ANAR_ASYM_PAUSE (0x2 << 7) -#define BRGPHY_SERDES_ANAR_BOTH_PAUSE (0x3 << 7) - -#define BRGPHY_SERDES_ANLPAR 0x05 -#define BRGPHY_SERDES_ANLPAR_FDX 0x0020 -#define BRGPHY_SERDES_ANLPAR_HDX 0x0040 -#define BRGPHY_SERDES_ANLPAR_NO_PAUSE (0x0 << 7) -#define BRGPHY_SERDES_ANLPAR_SYM_PAUSE (0x1 << 7) -#define BRGPHY_SERDES_ANLPAR_ASYM_PAUSE (0x2 << 7) -#define BRGPHY_SERDES_ANLPAR_BOTH_PAUSE (0x3 << 7) - -/*******************************************************/ -/* End: Shared SerDes PHY register definitions */ -/*******************************************************/ - -/*******************************************************/ -/* Begin: PHY register values for the 5706 PHY */ -/*******************************************************/ - -/* - * Shadow register 0x1C, bit 15 is write enable, - * bits 14-10 select function (0x00 to 0x1F). - */ -#define BRGPHY_MII_SHADOW_1C 0x1C +/*******************************************************/ +/* Begin: Shared SerDes PHY register definitions */ +/*******************************************************/ + +/* SerDes autoneg is different from copper */ +#define BRGPHY_SERDES_ANAR 0x04 +#define BRGPHY_SERDES_ANAR_FDX 0x0020 +#define BRGPHY_SERDES_ANAR_HDX 0x0040 +#define BRGPHY_SERDES_ANAR_NO_PAUSE (0x0 << 7) +#define BRGPHY_SERDES_ANAR_SYM_PAUSE (0x1 << 7) +#define BRGPHY_SERDES_ANAR_ASYM_PAUSE (0x2 << 7) +#define BRGPHY_SERDES_ANAR_BOTH_PAUSE (0x3 << 7) + +#define BRGPHY_SERDES_ANLPAR 0x05 +#define BRGPHY_SERDES_ANLPAR_FDX 0x0020 +#define BRGPHY_SERDES_ANLPAR_HDX 0x0040 +#define BRGPHY_SERDES_ANLPAR_NO_PAUSE (0x0 << 7) +#define BRGPHY_SERDES_ANLPAR_SYM_PAUSE (0x1 << 7) +#define BRGPHY_SERDES_ANLPAR_ASYM_PAUSE (0x2 << 7) +#define BRGPHY_SERDES_ANLPAR_BOTH_PAUSE (0x3 << 7) + +/*******************************************************/ +/* End: Shared SerDes PHY register definitions */ +/*******************************************************/ + +/*******************************************************/ +/* Begin: PHY register values for the 5706 PHY */ +/*******************************************************/ + +/* + * Shadow register 0x1C, bit 15 is write enable, + * bits 14-10 select function (0x00 to 0x1F). + */ +#define BRGPHY_MII_SHADOW_1C 0x1C #define BRGPHY_SHADOW_1C_WRITE_EN 0x8000 #define BRGPHY_SHADOW_1C_SELECT_MASK 0x7C00 - + /* Shadow 0x1C Mode Control Register (select value 0x1F) */ #define BRGPHY_SHADOW_1C_MODE_CTRL (0x1F << 10) /* When set, Regs 0-0x0F are 1000X, else 1000T */ -#define BRGPHY_SHADOW_1C_ENA_1000X 0x0001 +#define BRGPHY_SHADOW_1C_ENA_1000X 0x0001 #define BRGPHY_MII_TEST1 0x1E #define BRGPHY_TEST1_TRIM_EN 0x0010 #define BRGPHY_TEST1_CRC_EN 0x8000 #define BRGPHY_MII_TEST2 0x1F - -/*******************************************************/ -/* End: PHY register values for the 5706 PHY */ -/*******************************************************/ - -/*******************************************************/ -/* Begin: PHY register values for the 5708S SerDes PHY */ -/*******************************************************/ - -/* Autoneg Next Page Transmit 1 Regiser */ -#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1 0x0B -#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G 0x0001 - -/* Use the BLOCK_ADDR register to select the page for registers 0x10 to 0x1E */ -#define BRGPHY_5708S_BLOCK_ADDR 0x1f + +/*******************************************************/ +/* End: PHY register values for the 5706 PHY */ +/*******************************************************/ + +/*******************************************************/ +/* Begin: PHY register values for the 5708S SerDes PHY */ +/*******************************************************/ + +/* Autoneg Next Page Transmit 1 Regiser */ +#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1 0x0B +#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G 0x0001 + +/* Use the BLOCK_ADDR register to select the page for registers 0x10 to 0x1E */ +#define BRGPHY_5708S_BLOCK_ADDR 0x1f #define BRGPHY_5708S_DIG_PG0 0x0000 #define BRGPHY_5708S_DIG3_PG2 0x0002 #define BRGPHY_5708S_TX_MISC_PG5 0x0005 - -/* 5708S SerDes "Digital" Registers (page 0) */ -#define BRGPHY_5708S_PG0_1000X_CTL1 0x10 -#define BRGPHY_5708S_PG0_1000X_CTL1_AUTODET_EN 0x0010 -#define BRGPHY_5708S_PG0_1000X_CTL1_FIBER_MODE 0x0001 - -#define BRGPHY_5708S_PG0_1000X_STAT1 0x14 -#define BRGPHY_5708S_PG0_1000X_STAT1_LINK 0x0002 -#define BRGPHY_5708S_PG0_1000X_STAT1_FDX 0x0004 -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK 0x0018 -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10 (0x0 << 3) -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_100 (0x1 << 3) -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_1G (0x2 << 3) -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_25G (0x3 << 3) - - -#define BRGPHY_5708S_PG0_1000X_CTL2 0x11 -#define BRGPHY_5708S_PG0_1000X_CTL2_PAR_DET_EN 0x0001 - -/* 5708S SerDes "Digital 3" Registers (page 2) */ -#define BRGPHY_5708S_PG2_DIGCTL_3_0 0x10 -#define BRGPHY_5708S_PG2_DIGCTL_3_0_USE_IEEE 0x0001 - -/* 5708S SerDes "TX Misc" Registers (page 5) */ -#define BRGPHY_5708S_PG5_2500STATUS1 0x10 -#define BRGPHY_5708S_PG5_TXACTL1 0x15 -#define BRGPHY_5708S_PG5_TXACTL3 0x17 - -/*******************************************************/ -/* End: PHY register values for the 5708S SerDes PHY */ -/*******************************************************/ - + +/* 5708S SerDes "Digital" Registers (page 0) */ +#define BRGPHY_5708S_PG0_1000X_CTL1 0x10 +#define BRGPHY_5708S_PG0_1000X_CTL1_AUTODET_EN 0x0010 +#define BRGPHY_5708S_PG0_1000X_CTL1_FIBER_MODE 0x0001 + +#define BRGPHY_5708S_PG0_1000X_STAT1 0x14 +#define BRGPHY_5708S_PG0_1000X_STAT1_LINK 0x0002 +#define BRGPHY_5708S_PG0_1000X_STAT1_FDX 0x0004 +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK 0x0018 +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10 (0x0 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_100 (0x1 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_1G (0x2 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_25G (0x3 << 3) + + +#define BRGPHY_5708S_PG0_1000X_CTL2 0x11 +#define BRGPHY_5708S_PG0_1000X_CTL2_PAR_DET_EN 0x0001 + +/* 5708S SerDes "Digital 3" Registers (page 2) */ +#define BRGPHY_5708S_PG2_DIGCTL_3_0 0x10 +#define BRGPHY_5708S_PG2_DIGCTL_3_0_USE_IEEE 0x0001 + +/* 5708S SerDes "TX Misc" Registers (page 5) */ +#define BRGPHY_5708S_PG5_2500STATUS1 0x10 +#define BRGPHY_5708S_PG5_TXACTL1 0x15 +#define BRGPHY_5708S_PG5_TXACTL3 0x17 + +/*******************************************************/ +/* End: PHY register values for the 5708S SerDes PHY */ +/*******************************************************/ + /*******************************************************/ /* Begin: PHY register values for the 5709S SerDes PHY */ /*******************************************************/ From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 23:08:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF27A10656B0; Tue, 7 Sep 2010 23:08:38 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD5FE8FC0C; Tue, 7 Sep 2010 23:08: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 o87N8ccP044247; Tue, 7 Sep 2010 23:08:38 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87N8cai044243; Tue, 7 Sep 2010 23:08:38 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009072308.o87N8cai044243@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 7 Sep 2010 23:08: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: r212307 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 23:08:38 -0000 Author: yongari Date: Tue Sep 7 23:08:38 2010 New Revision: 212307 URL: http://svn.freebsd.org/changeset/base/212307 Log: Consistently use tab characters instead of tab + space characters. No functional changes. Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/brgphyreg.h Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Tue Sep 7 22:44:29 2010 (r212306) +++ head/sys/dev/mii/brgphy.c Tue Sep 7 23:08:38 2010 (r212307) @@ -140,7 +140,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5784), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761), - MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; @@ -242,11 +242,12 @@ brgphy_attach(device_t dev) bsc->serdes_flags |= BRGPHY_5708S; sc->mii_flags |= MIIF_HAVEFIBER; break; - case MII_MODEL_xxBROADCOM_ALT1_BCM5709S: - bsc->serdes_flags |= BRGPHY_5709S; - sc->mii_flags |= MIIF_HAVEFIBER; - break; - } break; + case MII_MODEL_xxBROADCOM_ALT1_BCM5709S: + bsc->serdes_flags |= BRGPHY_5709S; + sc->mii_flags |= MIIF_HAVEFIBER; + break; + } + break; default: device_printf(dev, "Unrecognized OUI for PHY!\n"); } @@ -637,7 +638,7 @@ brgphy_status(struct mii_softc *sc) PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, BRGPHY_5708S_DIG_PG0); xstat = PHY_READ(sc, BRGPHY_5708S_PG0_1000X_STAT1); - /* Check for MRBE auto-negotiated speed results. */ + /* Check for MRBE auto-negotiated speed results. */ switch (xstat & BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK) { case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10: mii->mii_media_active |= IFM_10_FL; break; @@ -649,39 +650,39 @@ brgphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_2500_SX; break; } - /* Check for MRBE auto-negotiated duplex results. */ + /* Check for MRBE auto-negotiated duplex results. */ if (xstat & BRGPHY_5708S_PG0_1000X_STAT1_FDX) mii->mii_media_active |= IFM_FDX; else mii->mii_media_active |= IFM_HDX; - } else if (bsc->serdes_flags & BRGPHY_5709S) { + } else if (bsc->serdes_flags & BRGPHY_5709S) { - /* Select GP Status Block of the AN MMD, get autoneg results. */ - PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_GP_STATUS); + /* Select GP Status Block of the AN MMD, get autoneg results. */ + PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_GP_STATUS); xstat = PHY_READ(sc, BRGPHY_GP_STATUS_TOP_ANEG_STATUS); - /* Restore IEEE0 block (assumed in all brgphy(4) code). */ - PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_COMBO_IEEE0); + /* Restore IEEE0 block (assumed in all brgphy(4) code). */ + PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_COMBO_IEEE0); - /* Check for MRBE auto-negotiated speed results. */ - switch (xstat & BRGPHY_GP_STATUS_TOP_ANEG_SPEED_MASK) { - case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_10: - mii->mii_media_active |= IFM_10_FL; break; - case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_100: - mii->mii_media_active |= IFM_100_FX; break; - case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1G: - mii->mii_media_active |= IFM_1000_SX; break; - case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_25G: - mii->mii_media_active |= IFM_2500_SX; break; + /* Check for MRBE auto-negotiated speed results. */ + switch (xstat & BRGPHY_GP_STATUS_TOP_ANEG_SPEED_MASK) { + case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_10: + mii->mii_media_active |= IFM_10_FL; break; + case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_100: + mii->mii_media_active |= IFM_100_FX; break; + case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1G: + mii->mii_media_active |= IFM_1000_SX; break; + case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_25G: + mii->mii_media_active |= IFM_2500_SX; break; } - /* Check for MRBE auto-negotiated duplex results. */ + /* Check for MRBE auto-negotiated duplex results. */ if (xstat & BRGPHY_GP_STATUS_TOP_ANEG_FDX) mii->mii_media_active |= IFM_FDX; else mii->mii_media_active |= IFM_HDX; - } + } } @@ -1127,50 +1128,50 @@ brgphy_reset(struct mii_softc *sc) } else if (BCE_CHIP_NUM(bce_sc) == BCE_CHIP_NUM_5709 && (bce_sc->bce_phy_flags & BCE_PHY_SERDES_FLAG)) { - /* Select the SerDes Digital block of the AN MMD. */ - PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_SERDES_DIG); + /* Select the SerDes Digital block of the AN MMD. */ + PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_SERDES_DIG); val = PHY_READ(sc, BRGPHY_SERDES_DIG_1000X_CTL1); val &= ~BRGPHY_SD_DIG_1000X_CTL1_AUTODET; val |= BRGPHY_SD_DIG_1000X_CTL1_FIBER; PHY_WRITE(sc, BRGPHY_SERDES_DIG_1000X_CTL1, val); - /* Select the Over 1G block of the AN MMD. */ + /* Select the Over 1G block of the AN MMD. */ PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_OVER_1G); - /* Enable autoneg "Next Page" to advertise 2.5G support. */ - val = PHY_READ(sc, BRGPHY_OVER_1G_UNFORMAT_PG1); + /* Enable autoneg "Next Page" to advertise 2.5G support. */ + val = PHY_READ(sc, BRGPHY_OVER_1G_UNFORMAT_PG1); if (bce_sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) val |= BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G; else val &= ~BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G; PHY_WRITE(sc, BRGPHY_OVER_1G_UNFORMAT_PG1, val); - /* Select the Multi-Rate Backplane Ethernet block of the AN MMD. */ + /* Select the Multi-Rate Backplane Ethernet block of the AN MMD. */ PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_MRBE); - /* Enable MRBE speed autoneg. */ - val = PHY_READ(sc, BRGPHY_MRBE_MSG_PG5_NP); + /* Enable MRBE speed autoneg. */ + val = PHY_READ(sc, BRGPHY_MRBE_MSG_PG5_NP); val |= BRGPHY_MRBE_MSG_PG5_NP_MBRE | BRGPHY_MRBE_MSG_PG5_NP_T2; PHY_WRITE(sc, BRGPHY_MRBE_MSG_PG5_NP, val); - /* Select the Clause 73 User B0 block of the AN MMD. */ - PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_CL73_USER_B0); + /* Select the Clause 73 User B0 block of the AN MMD. */ + PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_CL73_USER_B0); - /* Enable MRBE speed autoneg. */ + /* Enable MRBE speed autoneg. */ PHY_WRITE(sc, BRGPHY_CL73_USER_B0_MBRE_CTL1, BRGPHY_CL73_USER_B0_MBRE_CTL1_NP_AFT_BP | BRGPHY_CL73_USER_B0_MBRE_CTL1_STA_MGR | BRGPHY_CL73_USER_B0_MBRE_CTL1_ANEG); - /* Restore IEEE0 block (assumed in all brgphy(4) code). */ - PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_COMBO_IEEE0); + /* Restore IEEE0 block (assumed in all brgphy(4) code). */ + PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_COMBO_IEEE0); } else if (BCE_CHIP_NUM(bce_sc) == BCE_CHIP_NUM_5709) { if ((BCE_CHIP_REV(bce_sc) == BCE_CHIP_REV_Ax) || (BCE_CHIP_REV(bce_sc) == BCE_CHIP_REV_Bx)) brgphy_fixup_disable_early_dac(sc); - + brgphy_jumbo_settings(sc, ifp->if_mtu); brgphy_ethernet_wirespeed(sc); } else { Modified: head/sys/dev/mii/brgphyreg.h ============================================================================== --- head/sys/dev/mii/brgphyreg.h Tue Sep 7 22:44:29 2010 (r212306) +++ head/sys/dev/mii/brgphyreg.h Tue Sep 7 23:08:38 2010 (r212307) @@ -39,21 +39,21 @@ * Broadcom BCM5400 registers */ -#define BRGPHY_MII_BMCR 0x00 -#define BRGPHY_BMCR_RESET 0x8000 -#define BRGPHY_BMCR_LOOP 0x4000 -#define BRGPHY_BMCR_SPD0 0x2000 /* Speed select, lower bit */ -#define BRGPHY_BMCR_AUTOEN 0x1000 /* Autoneg enabled */ -#define BRGPHY_BMCR_PDOWN 0x0800 /* Power down */ -#define BRGPHY_BMCR_ISO 0x0400 /* Isolate */ +#define BRGPHY_MII_BMCR 0x00 +#define BRGPHY_BMCR_RESET 0x8000 +#define BRGPHY_BMCR_LOOP 0x4000 +#define BRGPHY_BMCR_SPD0 0x2000 /* Speed select, lower bit */ +#define BRGPHY_BMCR_AUTOEN 0x1000 /* Autoneg enabled */ +#define BRGPHY_BMCR_PDOWN 0x0800 /* Power down */ +#define BRGPHY_BMCR_ISO 0x0400 /* Isolate */ #define BRGPHY_BMCR_STARTNEG 0x0200 /* Restart autoneg */ -#define BRGPHY_BMCR_FDX 0x0100 /* Duplex mode */ -#define BRGPHY_BMCR_CTEST 0x0080 /* Collision test enable */ -#define BRGPHY_BMCR_SPD1 0x0040 /* Speed select, upper bit */ - -#define BRGPHY_S1000 BRGPHY_BMCR_SPD1 /* 1000mbps */ -#define BRGPHY_S100 BRGPHY_BMCR_SPD0 /* 100mpbs */ -#define BRGPHY_S10 0 /* 10mbps */ +#define BRGPHY_BMCR_FDX 0x0100 /* Duplex mode */ +#define BRGPHY_BMCR_CTEST 0x0080 /* Collision test enable */ +#define BRGPHY_BMCR_SPD1 0x0040 /* Speed select, upper bit */ + +#define BRGPHY_S1000 BRGPHY_BMCR_SPD1 /* 1000mbps */ +#define BRGPHY_S100 BRGPHY_BMCR_SPD0 /* 100mpbs */ +#define BRGPHY_S10 0 /* 10mbps */ #define BRGPHY_MII_BMSR 0x01 #define BRGPHY_BMSR_EXTSTS 0x0100 /* Extended status present */ @@ -267,21 +267,21 @@ /*******************************************************/ /* SerDes autoneg is different from copper */ -#define BRGPHY_SERDES_ANAR 0x04 -#define BRGPHY_SERDES_ANAR_FDX 0x0020 -#define BRGPHY_SERDES_ANAR_HDX 0x0040 -#define BRGPHY_SERDES_ANAR_NO_PAUSE (0x0 << 7) -#define BRGPHY_SERDES_ANAR_SYM_PAUSE (0x1 << 7) -#define BRGPHY_SERDES_ANAR_ASYM_PAUSE (0x2 << 7) -#define BRGPHY_SERDES_ANAR_BOTH_PAUSE (0x3 << 7) - -#define BRGPHY_SERDES_ANLPAR 0x05 -#define BRGPHY_SERDES_ANLPAR_FDX 0x0020 -#define BRGPHY_SERDES_ANLPAR_HDX 0x0040 -#define BRGPHY_SERDES_ANLPAR_NO_PAUSE (0x0 << 7) -#define BRGPHY_SERDES_ANLPAR_SYM_PAUSE (0x1 << 7) -#define BRGPHY_SERDES_ANLPAR_ASYM_PAUSE (0x2 << 7) -#define BRGPHY_SERDES_ANLPAR_BOTH_PAUSE (0x3 << 7) +#define BRGPHY_SERDES_ANAR 0x04 +#define BRGPHY_SERDES_ANAR_FDX 0x0020 +#define BRGPHY_SERDES_ANAR_HDX 0x0040 +#define BRGPHY_SERDES_ANAR_NO_PAUSE (0x0 << 7) +#define BRGPHY_SERDES_ANAR_SYM_PAUSE (0x1 << 7) +#define BRGPHY_SERDES_ANAR_ASYM_PAUSE (0x2 << 7) +#define BRGPHY_SERDES_ANAR_BOTH_PAUSE (0x3 << 7) + +#define BRGPHY_SERDES_ANLPAR 0x05 +#define BRGPHY_SERDES_ANLPAR_FDX 0x0020 +#define BRGPHY_SERDES_ANLPAR_HDX 0x0040 +#define BRGPHY_SERDES_ANLPAR_NO_PAUSE (0x0 << 7) +#define BRGPHY_SERDES_ANLPAR_SYM_PAUSE (0x1 << 7) +#define BRGPHY_SERDES_ANLPAR_ASYM_PAUSE (0x2 << 7) +#define BRGPHY_SERDES_ANLPAR_BOTH_PAUSE (0x3 << 7) /*******************************************************/ /* End: Shared SerDes PHY register definitions */ @@ -295,20 +295,20 @@ * Shadow register 0x1C, bit 15 is write enable, * bits 14-10 select function (0x00 to 0x1F). */ -#define BRGPHY_MII_SHADOW_1C 0x1C -#define BRGPHY_SHADOW_1C_WRITE_EN 0x8000 -#define BRGPHY_SHADOW_1C_SELECT_MASK 0x7C00 +#define BRGPHY_MII_SHADOW_1C 0x1C +#define BRGPHY_SHADOW_1C_WRITE_EN 0x8000 +#define BRGPHY_SHADOW_1C_SELECT_MASK 0x7C00 /* Shadow 0x1C Mode Control Register (select value 0x1F) */ -#define BRGPHY_SHADOW_1C_MODE_CTRL (0x1F << 10) +#define BRGPHY_SHADOW_1C_MODE_CTRL (0x1F << 10) /* When set, Regs 0-0x0F are 1000X, else 1000T */ -#define BRGPHY_SHADOW_1C_ENA_1000X 0x0001 +#define BRGPHY_SHADOW_1C_ENA_1000X 0x0001 -#define BRGPHY_MII_TEST1 0x1E -#define BRGPHY_TEST1_TRIM_EN 0x0010 -#define BRGPHY_TEST1_CRC_EN 0x8000 +#define BRGPHY_MII_TEST1 0x1E +#define BRGPHY_TEST1_TRIM_EN 0x0010 +#define BRGPHY_TEST1_CRC_EN 0x8000 -#define BRGPHY_MII_TEST2 0x1F +#define BRGPHY_MII_TEST2 0x1F /*******************************************************/ /* End: PHY register values for the 5706 PHY */ @@ -319,41 +319,41 @@ /*******************************************************/ /* Autoneg Next Page Transmit 1 Regiser */ -#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1 0x0B -#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G 0x0001 +#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1 0x0B +#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G 0x0001 /* Use the BLOCK_ADDR register to select the page for registers 0x10 to 0x1E */ -#define BRGPHY_5708S_BLOCK_ADDR 0x1f -#define BRGPHY_5708S_DIG_PG0 0x0000 -#define BRGPHY_5708S_DIG3_PG2 0x0002 -#define BRGPHY_5708S_TX_MISC_PG5 0x0005 +#define BRGPHY_5708S_BLOCK_ADDR 0x1f +#define BRGPHY_5708S_DIG_PG0 0x0000 +#define BRGPHY_5708S_DIG3_PG2 0x0002 +#define BRGPHY_5708S_TX_MISC_PG5 0x0005 /* 5708S SerDes "Digital" Registers (page 0) */ -#define BRGPHY_5708S_PG0_1000X_CTL1 0x10 -#define BRGPHY_5708S_PG0_1000X_CTL1_AUTODET_EN 0x0010 -#define BRGPHY_5708S_PG0_1000X_CTL1_FIBER_MODE 0x0001 - -#define BRGPHY_5708S_PG0_1000X_STAT1 0x14 -#define BRGPHY_5708S_PG0_1000X_STAT1_LINK 0x0002 -#define BRGPHY_5708S_PG0_1000X_STAT1_FDX 0x0004 -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK 0x0018 -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10 (0x0 << 3) -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_100 (0x1 << 3) -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_1G (0x2 << 3) -#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_25G (0x3 << 3) +#define BRGPHY_5708S_PG0_1000X_CTL1 0x10 +#define BRGPHY_5708S_PG0_1000X_CTL1_AUTODET_EN 0x0010 +#define BRGPHY_5708S_PG0_1000X_CTL1_FIBER_MODE 0x0001 + +#define BRGPHY_5708S_PG0_1000X_STAT1 0x14 +#define BRGPHY_5708S_PG0_1000X_STAT1_LINK 0x0002 +#define BRGPHY_5708S_PG0_1000X_STAT1_FDX 0x0004 +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK 0x0018 +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10 (0x0 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_100 (0x1 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_1G (0x2 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_25G (0x3 << 3) -#define BRGPHY_5708S_PG0_1000X_CTL2 0x11 -#define BRGPHY_5708S_PG0_1000X_CTL2_PAR_DET_EN 0x0001 +#define BRGPHY_5708S_PG0_1000X_CTL2 0x11 +#define BRGPHY_5708S_PG0_1000X_CTL2_PAR_DET_EN 0x0001 /* 5708S SerDes "Digital 3" Registers (page 2) */ -#define BRGPHY_5708S_PG2_DIGCTL_3_0 0x10 -#define BRGPHY_5708S_PG2_DIGCTL_3_0_USE_IEEE 0x0001 +#define BRGPHY_5708S_PG2_DIGCTL_3_0 0x10 +#define BRGPHY_5708S_PG2_DIGCTL_3_0_USE_IEEE 0x0001 /* 5708S SerDes "TX Misc" Registers (page 5) */ -#define BRGPHY_5708S_PG5_2500STATUS1 0x10 -#define BRGPHY_5708S_PG5_TXACTL1 0x15 -#define BRGPHY_5708S_PG5_TXACTL3 0x17 +#define BRGPHY_5708S_PG5_2500STATUS1 0x10 +#define BRGPHY_5708S_PG5_TXACTL1 0x15 +#define BRGPHY_5708S_PG5_TXACTL3 0x17 /*******************************************************/ /* End: PHY register values for the 5708S SerDes PHY */ @@ -364,51 +364,51 @@ /*******************************************************/ /* 5709S SerDes "General Purpose Status" Registers */ -#define BRGPHY_BLOCK_ADDR_GP_STATUS 0x8120 -#define BRGPHY_GP_STATUS_TOP_ANEG_STATUS 0x1B -#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_MASK 0x3F00 -#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_10 0x0000 -#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_100 0x0100 -#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1G 0x0200 -#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_25G 0x0300 -#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1GKX 0x0D00 -#define BRGPHY_GP_STATUS_TOP_ANEG_FDX 0x0008 -#define BRGPHY_GP_STATUS_TOP_ANEG_LINK_UP 0x0004 -#define BRGPHY_GP_STATUS_TOP_ANEG_CL73_COMP 0x0001 +#define BRGPHY_BLOCK_ADDR_GP_STATUS 0x8120 +#define BRGPHY_GP_STATUS_TOP_ANEG_STATUS 0x1B +#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_MASK 0x3F00 +#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_10 0x0000 +#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_100 0x0100 +#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1G 0x0200 +#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_25G 0x0300 +#define BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1GKX 0x0D00 +#define BRGPHY_GP_STATUS_TOP_ANEG_FDX 0x0008 +#define BRGPHY_GP_STATUS_TOP_ANEG_LINK_UP 0x0004 +#define BRGPHY_GP_STATUS_TOP_ANEG_CL73_COMP 0x0001 /* 5709S SerDes "SerDes Digital" Registers */ -#define BRGPHY_BLOCK_ADDR_SERDES_DIG 0x8300 -#define BRGPHY_SERDES_DIG_1000X_CTL1 0x0010 -#define BRGPHY_SD_DIG_1000X_CTL1_AUTODET 0x0010 -#define BRGPHY_SD_DIG_1000X_CTL1_FIBER 0x0001 +#define BRGPHY_BLOCK_ADDR_SERDES_DIG 0x8300 +#define BRGPHY_SERDES_DIG_1000X_CTL1 0x0010 +#define BRGPHY_SD_DIG_1000X_CTL1_AUTODET 0x0010 +#define BRGPHY_SD_DIG_1000X_CTL1_FIBER 0x0001 /* 5709S SerDes "Over 1G" Registers */ -#define BRGPHY_BLOCK_ADDR_OVER_1G 0x8320 -#define BRGPHY_OVER_1G_UNFORMAT_PG1 0x19 +#define BRGPHY_BLOCK_ADDR_OVER_1G 0x8320 +#define BRGPHY_OVER_1G_UNFORMAT_PG1 0x19 /* 5709S SerDes "Multi-Rate Backplane Ethernet" Registers */ -#define BRGPHY_BLOCK_ADDR_MRBE 0x8350 -#define BRGPHY_MRBE_MSG_PG5_NP 0x10 -#define BRGPHY_MRBE_MSG_PG5_NP_MBRE 0x0001 -#define BRGPHY_MRBE_MSG_PG5_NP_T2 0x0001 +#define BRGPHY_BLOCK_ADDR_MRBE 0x8350 +#define BRGPHY_MRBE_MSG_PG5_NP 0x10 +#define BRGPHY_MRBE_MSG_PG5_NP_MBRE 0x0001 +#define BRGPHY_MRBE_MSG_PG5_NP_T2 0x0001 /* 5709S SerDes "IEEE Clause 73 User B0" Registers */ -#define BRGPHY_BLOCK_ADDR_CL73_USER_B0 0x8370 -#define BRGPHY_CL73_USER_B0_MBRE_CTL1 0x12 +#define BRGPHY_BLOCK_ADDR_CL73_USER_B0 0x8370 +#define BRGPHY_CL73_USER_B0_MBRE_CTL1 0x12 #define BRGPHY_CL73_USER_B0_MBRE_CTL1_NP_AFT_BP 0x2000 #define BRGPHY_CL73_USER_B0_MBRE_CTL1_STA_MGR 0x4000 -#define BRGPHY_CL73_USER_B0_MBRE_CTL1_ANEG 0x8000 +#define BRGPHY_CL73_USER_B0_MBRE_CTL1_ANEG 0x8000 /* 5709S SerDes "IEEE Clause 73 User B0" Registers */ -#define BRGPHY_BLOCK_ADDR_ADDR_EXT 0xFFD0 +#define BRGPHY_BLOCK_ADDR_ADDR_EXT 0xFFD0 /* 5709S SerDes "Combo IEEE 0" Registers */ -#define BRGPHY_BLOCK_ADDR_COMBO_IEEE0 0xFFE0 +#define BRGPHY_BLOCK_ADDR_COMBO_IEEE0 0xFFE0 -#define BRGPHY_ADDR_EXT 0x1E -#define BRGPHY_BLOCK_ADDR 0x1F +#define BRGPHY_ADDR_EXT 0x1E +#define BRGPHY_BLOCK_ADDR 0x1F -#define BRGPHY_ADDR_EXT_AN_MMD 0x3800 +#define BRGPHY_ADDR_EXT_AN_MMD 0x3800 /*******************************************************/ /* End: PHY register values for the 5709S SerDes PHY */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 7 23:31:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4571A10656B4; Tue, 7 Sep 2010 23:31:49 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34B478FC12; Tue, 7 Sep 2010 23:31: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 o87NVnKR046486; Tue, 7 Sep 2010 23:31:49 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o87NVnvm046484; Tue, 7 Sep 2010 23:31:49 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009072331.o87NVnvm046484@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 7 Sep 2010 23:31: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: r212308 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 23:31:49 -0000 Author: nwhitehorn Date: Tue Sep 7 23:31:48 2010 New Revision: 212308 URL: http://svn.freebsd.org/changeset/base/212308 Log: Fix an error made in r209975 related to context ID allocation for 64-bit PowerPC CPUs running a 32-bit kernel. This bug could cause in-use VSIDs to be allocated again to another process, causing memory space overlaps and corruption. Reported by: linimon Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Sep 7 23:08:38 2010 (r212307) +++ head/sys/powerpc/aim/mmu_oea64.c Tue Sep 7 23:31:48 2010 (r212308) @@ -2108,7 +2108,7 @@ void moea64_pinit(mmu_t mmu, pmap_t pmap) { int i; - register_t hash; + uint32_t hash; PMAP_LOCK_INIT(pmap); @@ -2125,6 +2125,8 @@ moea64_pinit(mmu_t mmu, pmap_t pmap) for (i = 0; i < 16; i++) pmap->pm_sr[i] = VSID_MAKE(i, hash); + + KASSERT(pmap->pm_sr[0] != 0, ("moea64_pinit: pm_sr[0] = 0")); } #endif @@ -2238,6 +2240,8 @@ moea64_release_vsid(uint64_t vsid) idx = vsid & (NVSIDS-1); mask = 1 << (idx % VSID_NBPW); idx /= VSID_NBPW; + KASSERT(moea64_vsid_bitmap[idx] & mask, + ("Freeing unallocated VSID %#jx", vsid)); moea64_vsid_bitmap[idx] &= ~mask; mtx_unlock(&moea64_slb_mutex); } @@ -2254,10 +2258,9 @@ moea64_release(mmu_t mmu, pmap_t pmap) free_vsids(pmap); slb_free_user_cache(pmap->pm_slb); #else - if (pmap->pm_sr[0] == 0) - panic("moea64_release: pm_sr[0] = 0"); + KASSERT(pmap->pm_sr[0] != 0, ("moea64_release: pm_sr[0] = 0")); - moea64_release_vsid(pmap->pm_sr[0]); + moea64_release_vsid(VSID_TO_HASH(pmap->pm_sr[0])); #endif PMAP_LOCK_DESTROY(pmap); From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 01:18:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA8A210656B8; Wed, 8 Sep 2010 01:18:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D915E8FC17; Wed, 8 Sep 2010 01:18: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 o881I9XS056427; Wed, 8 Sep 2010 01:18:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o881I9GV056425; Wed, 8 Sep 2010 01:18:09 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009080118.o881I9GV056425@svn.freebsd.org> From: Rick Macklem Date: Wed, 8 Sep 2010 01:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212309 - stable/8/sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 01:18:10 -0000 Author: rmacklem Date: Wed Sep 8 01:18:09 2010 New Revision: 212309 URL: http://svn.freebsd.org/changeset/base/212309 Log: MFC: r211789 If the first iteration of the do loop in replay_prune() succeeded and a subsequent interation failed to find an entry to prune, it could loop infinitely, since the "freed" variable wasn't reset to FALSE. This patch moves setting freed FALSE to inside the loop to fix the problem. Modified: stable/8/sys/rpc/replay.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/rpc/replay.c ============================================================================== --- stable/8/sys/rpc/replay.c Tue Sep 7 23:31:48 2010 (r212308) +++ stable/8/sys/rpc/replay.c Wed Sep 8 01:18:09 2010 (r212309) @@ -144,8 +144,8 @@ replay_prune(struct replay_cache *rc) bool_t freed_one; if (rc->rc_count >= REPLAY_MAX || rc->rc_size > rc->rc_maxsize) { - freed_one = FALSE; do { + freed_one = FALSE; /* * Try to free an entry. Don't free in-progress entries */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 01:41:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7191810656B1; Wed, 8 Sep 2010 01:41:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 601A38FC13; Wed, 8 Sep 2010 01:41: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 o881fNAh059034; Wed, 8 Sep 2010 01:41:23 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o881fMXS059032; Wed, 8 Sep 2010 01:41:22 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009080141.o881fMXS059032@svn.freebsd.org> From: Rick Macklem Date: Wed, 8 Sep 2010 01:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212310 - stable/8/sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 01:41:23 -0000 Author: rmacklem Date: Wed Sep 8 01:41:22 2010 New Revision: 212310 URL: http://svn.freebsd.org/changeset/base/212310 Log: MFC: r211830 Add mutex locking for the call to replay_prune() in replay_setsize(), since replay_prune() expects the rc_lock to be held when it is called. Modified: stable/8/sys/rpc/replay.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/rpc/replay.c ============================================================================== --- stable/8/sys/rpc/replay.c Wed Sep 8 01:18:09 2010 (r212309) +++ stable/8/sys/rpc/replay.c Wed Sep 8 01:41:22 2010 (r212310) @@ -90,8 +90,10 @@ void replay_setsize(struct replay_cache *rc, size_t newmaxsize) { + mtx_lock(&rc->rc_lock); rc->rc_maxsize = newmaxsize; replay_prune(rc); + mtx_unlock(&rc->rc_lock); } void From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 01:55:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A26BA10656C8; Wed, 8 Sep 2010 01:55:03 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76B7D8FC16; Wed, 8 Sep 2010 01:55: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 o881t3SF060497; Wed, 8 Sep 2010 01:55:03 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o881t3oG060495; Wed, 8 Sep 2010 01:55:03 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009080155.o881t3oG060495@svn.freebsd.org> From: David Xu Date: Wed, 8 Sep 2010 01:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212311 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 01:55:03 -0000 Author: davidxu Date: Wed Sep 8 01:55:03 2010 New Revision: 212311 URL: http://svn.freebsd.org/changeset/base/212311 Log: MFC: r212047 If a process is being debugged, skips job control caused by SIGSTOP/SIGCONT signals, because it is managed by debugger, however a normal signal sent to a interruptibly sleeping thread wakes up the thread so it will handle the signal when the process leaves the stopped state. Modified: stable/8/sys/kern/kern_sig.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_sig.c ============================================================================== --- stable/8/sys/kern/kern_sig.c Wed Sep 8 01:41:22 2010 (r212310) +++ stable/8/sys/kern/kern_sig.c Wed Sep 8 01:55:03 2010 (r212311) @@ -2129,20 +2129,13 @@ tdsignal(struct proc *p, struct thread * * We try do the per-process part here. */ if (P_SHOULDSTOP(p)) { - /* - * The process is in stopped mode. All the threads should be - * either winding down or already on the suspended queue. - */ - if (p->p_flag & P_TRACED) { + if (sig == SIGKILL) { /* - * The traced process is already stopped, - * so no further action is necessary. - * No signal can restart us. + * If traced process is already stopped, + * then no further action is necessary. */ - goto out; - } - - if (sig == SIGKILL) { + if (p->p_flag & P_TRACED) + goto out; /* * SIGKILL sets process running. * It will die elsewhere. @@ -2154,6 +2147,12 @@ tdsignal(struct proc *p, struct thread * if (prop & SA_CONT) { /* + * If traced process is already stopped, + * then no further action is necessary. + */ + if (p->p_flag & P_TRACED) + goto out; + /* * If SIGCONT is default (or ignored), we continue the * process but don't leave the signal in sigqueue as * it has no further action. If SIGCONT is held, we @@ -2198,6 +2197,12 @@ tdsignal(struct proc *p, struct thread * if (prop & SA_STOP) { /* + * If traced process is already stopped, + * then no further action is necessary. + */ + if (p->p_flag & P_TRACED) + goto out; + /* * Already stopped, don't need to stop again * (If we did the shell could get confused). * Just make sure the signal STOP bit set. From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 02:18:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 248FF10656C8; Wed, 8 Sep 2010 02:18:21 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13D0C8FC18; Wed, 8 Sep 2010 02:18: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 o882IKvq062615; Wed, 8 Sep 2010 02:18:20 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o882IKsn062613; Wed, 8 Sep 2010 02:18:20 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009080218.o882IKsn062613@svn.freebsd.org> From: David Xu Date: Wed, 8 Sep 2010 02:18: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: r212312 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 02:18:21 -0000 Author: davidxu Date: Wed Sep 8 02:18:20 2010 New Revision: 212312 URL: http://svn.freebsd.org/changeset/base/212312 Log: To avoid possible race condition, SIGCANCEL is always sent except the thread is dead. Modified: head/lib/libthr/thread/thr_cancel.c Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Wed Sep 8 01:55:03 2010 (r212311) +++ head/lib/libthr/thread/thr_cancel.c Wed Sep 8 02:18:20 2010 (r212312) @@ -67,7 +67,7 @@ _pthread_cancel(pthread_t pthread) THR_THREAD_LOCK(curthread, pthread); if (!pthread->cancel_pending) { pthread->cancel_pending = 1; - if (pthread->cancel_enable) + if (pthread->state != PS_DEAD) _thr_send_sig(pthread, SIGCANCEL); } THR_THREAD_UNLOCK(curthread, pthread); From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 06:45:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18E6510656D8; Wed, 8 Sep 2010 06:45:40 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id AF0CF8FC1A; Wed, 8 Sep 2010 06:45:38 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA06543; Wed, 08 Sep 2010 09:45:36 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OtEPY-0000MJ-Fk; Wed, 08 Sep 2010 09:45:36 +0300 Message-ID: <4C87310F.8020505@freebsd.org> Date: Wed, 08 Sep 2010 09:45:35 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.8) Gecko/20100822 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Jung-uk Kim , John Baldwin References: <201009060734.o867YWH8022846@svn.freebsd.org> <201009061128.40344.jhb@freebsd.org> <201009071738.22600.jkim@FreeBSD.org> In-Reply-To: <201009071738.22600.jkim@FreeBSD.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212251 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 06:45:40 -0000 on 08/09/2010 00:38 Jung-uk Kim said the following: > On Monday 06 September 2010 11:28 am, John Baldwin wrote: >> On Monday 06 September 2010 03:34:32 am Andriy Gapon wrote: >>> Author: avg >>> Date: Mon Sep 6 07:34:32 2010 >>> New Revision: 212251 >>> URL: http://svn.freebsd.org/changeset/base/212251 >>> >>> Log: >>> acpi_hp: fix bus attachment code >>> >>> - add identify method to create driver's own device_t >>> - successfully probe only driver's own device_t instead of any >>> device_t - (ab)use device order to hopefully be probed/attached >>> after acpi_wmi >> >> Perhaps this should be a child of acpi_wmi0 instead? That would >> fix the ordering issue as well as remove the need to avoid "real" >> ACPI devices in the attach routine. > > +1 I am working on this. Thanks to John for guidance. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 07:30:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0749910656A4; Wed, 8 Sep 2010 07:30:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAC9F8FC0C; Wed, 8 Sep 2010 07:30: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 o887Ukng090453; Wed, 8 Sep 2010 07:30:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o887UkR6090451; Wed, 8 Sep 2010 07:30:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009080730.o887UkR6090451@svn.freebsd.org> From: Alexander Motin Date: Wed, 8 Sep 2010 07:30: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: r212313 - head/usr.bin/systat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 07:30:47 -0000 Author: mav Date: Wed Sep 8 07:30:46 2010 New Revision: 212313 URL: http://svn.freebsd.org/changeset/base/212313 Log: For total interrupt count on -vm screen count all interrupts, but not only those which fit the screen. Modified: head/usr.bin/systat/vmstat.c Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Wed Sep 8 02:18:20 2010 (r212312) +++ head/usr.bin/systat/vmstat.c Wed Sep 8 07:30:46 2010 (r212313) @@ -443,6 +443,9 @@ showkre(void) for (i = 0; i < nintr; i++) { if (s.intrcnt[i] == 0) continue; + X(intrcnt); + l = (int)((float)s.intrcnt[i]/etime + 0.5); + inttotal += l; if (intrloc[i] == 0) { if (nextintsrow == LINES) continue; @@ -450,9 +453,6 @@ showkre(void) mvprintw(intrloc[i], INTSCOL + 6, "%-10.10s", intrname[i]); } - X(intrcnt); - l = (int)((float)s.intrcnt[i]/etime + 0.5); - inttotal += l; putint(l, intrloc[i], INTSCOL, 5); } putint(inttotal, INTSROW + 1, INTSCOL, 5); From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 07:35:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02EF81065695; Wed, 8 Sep 2010 07:35:23 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id DC27E8FC08; Wed, 8 Sep 2010 07:35:21 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA07403; Wed, 08 Sep 2010 10:35:20 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OtFBg-0000Qc-4j; Wed, 08 Sep 2010 10:35:20 +0300 Message-ID: <4C873CB7.60204@freebsd.org> Date: Wed, 08 Sep 2010 10:35:19 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.8) Gecko/20100822 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201009031040.o83AerfK046157@svn.freebsd.org> In-Reply-To: <201009031040.o83AerfK046157@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r212174 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 07:35:23 -0000 on 03/09/2010 13:40 Andriy Gapon said the following: > Author: avg > Date: Fri Sep 3 10:40:53 2010 > New Revision: 212174 > URL: http://svn.freebsd.org/changeset/base/212174 > > Log: > vm_page.c: include opt_msgbuf.h for MSGBUF_SIZE use in vm_page_startup > > vm_page_startup uses MSGBUF_SIZE value for adding msgbuf pages to minidump. > If opt_msgbuf.h is not included and MSGBUF_SIZE is overriden in kernel > config, then not all msgbuf pages will be dumped. And most importantly, > struct msgbuf itself will not be included. Thus the dump would look > corrupted/incomplete to tools like kgdb, dmesg, etc that try to access > struct msgbuf as one of the first things they do when working on a crash > dump. > > MFC after: 5 days Actually, not MFC is needed unless/until new way of allocating message buffer on amd64 (via direct map) is MFC-ed. In particular, r208164. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 08:03:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0B5F10656C3; Wed, 8 Sep 2010 08:03:08 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF8B58FC1E; Wed, 8 Sep 2010 08:03: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 o88838gY093668; Wed, 8 Sep 2010 08:03:08 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o888385g093666; Wed, 8 Sep 2010 08:03:08 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009080803.o888385g093666@svn.freebsd.org> From: Ed Schouten Date: Wed, 8 Sep 2010 08:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212314 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 08:03:09 -0000 Author: ed Date: Wed Sep 8 08:03:08 2010 New Revision: 212314 URL: http://svn.freebsd.org/changeset/base/212314 Log: MFC r212087: Remove reference to device minor numbers in psm(4) man page. The number returned by stat(2) is generated automatically, so it is not possible to deduce whether the device is blocking or not. Modified: stable/8/share/man/man4/psm.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/psm.4 ============================================================================== --- stable/8/share/man/man4/psm.4 Wed Sep 8 07:30:46 2010 (r212313) +++ stable/8/share/man/man4/psm.4 Wed Sep 8 08:03:08 2010 (r212314) @@ -179,22 +179,6 @@ The driver has an internal variable whic the acceleration. Its value can be modified via the driver flag or via an ioctl call. -.Ss Device Number -The minor device number of the -.Nm -is made up of: -.Bd -literal -offset indent -minor = (`unit' << 1) | `non-blocking' -.Ed -.Pp -where `unit' is the device number (usually 0) and the `non-blocking' bit -is set to indicate ``do not block waiting for mouse input, -return immediately''. -The `non-blocking' bit should be set for \fIXFree86\fP, -therefore the minor device number usually used for \fIXFree86\fP is 1. -See -.Sx FILES -for device node names. .Sh DRIVER CONFIGURATION .Ss Kernel Configuration Options There are following kernel configuration options to control the @@ -670,8 +654,7 @@ movement counts as described in .It Pa /dev/psm0 `non-blocking' device node .It Pa /dev/bpsm0 -`blocking' device node under -.Em devfs . +`blocking' device node .El .Sh EXAMPLES In order to install the From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 09:51:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45F8210656BD; Wed, 8 Sep 2010 09:51:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34C2E8FC19; Wed, 8 Sep 2010 09:51: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 o889p494004298; Wed, 8 Sep 2010 09:51:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o889p4Rd004296; Wed, 8 Sep 2010 09:51:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009080951.o889p4Rd004296@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 8 Sep 2010 09:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212315 - stable/8/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 09:51:04 -0000 Author: kib Date: Wed Sep 8 09:51:03 2010 New Revision: 212315 URL: http://svn.freebsd.org/changeset/base/212315 Log: MFC r212233: Document MAKEDEV_ETERNAL. Modified: stable/8/share/man/man9/make_dev.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/make_dev.9 ============================================================================== --- stable/8/share/man/man9/make_dev.9 Wed Sep 8 08:03:08 2010 (r212314) +++ stable/8/share/man/man9/make_dev.9 Wed Sep 8 09:51:03 2010 (r212315) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 6, 2010 +.Dd September 5, 2010 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -135,6 +135,7 @@ The following values are currently accep MAKEDEV_REF reference the created device MAKEDEV_NOWAIT do not sleep, may return NULL MAKEDEV_WAITOK allow the function to sleep to satisfy malloc +MAKEDEV_ETERNAL created device will be never destroyed .Ed .Pp The @@ -154,6 +155,18 @@ the device created is destroyed immediat drops his reference to cdev. .Pp The +.Dv MAKEDEV_ETERNAL +flag allows the kernel to not acquire some locks when translating system +calls into the cdevsw methods calls. +It is responsibility of the driver author to make sure that +.Fn destroy_dev +is never called on the returned cdev. +For the convenience, use the +.Dv MAKEDEV_ETERNAL_KLD +flag for the code that can be compiled into kernel or loaded +(and unloaded) as loadable module. +.Pp +The .Fn make_dev_cred function is equivalent to the call .Bd -literal -offset indent From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 09:53:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64D2710656BD; Wed, 8 Sep 2010 09:53:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53C258FC15; Wed, 8 Sep 2010 09:53: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 o889roOu004589; Wed, 8 Sep 2010 09:53:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o889roO5004587; Wed, 8 Sep 2010 09:53:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009080953.o889roO5004587@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 8 Sep 2010 09:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212316 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 09:53:50 -0000 Author: kib Date: Wed Sep 8 09:53:50 2010 New Revision: 212316 URL: http://svn.freebsd.org/changeset/base/212316 Log: MFC r212234: Document "show cdev" command. Modified: stable/8/share/man/man4/ddb.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ddb.4 ============================================================================== --- stable/8/share/man/man4/ddb.4 Wed Sep 8 09:51:03 2010 (r212315) +++ stable/8/share/man/man4/ddb.4 Wed Sep 8 09:53:50 2010 (r212316) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2010 +.Dd September 5, 2010 .Dt DDB 4 .Os .Sh NAME @@ -589,6 +589,12 @@ header file. Show brief information about the TTY subsystem. .\" .Pp +.It Ic show Cm cdev +Without argument, show the list of all created cdev's, consisting of devfs +node name and struct cdev address. +When address of cdev is supplied, show some internal devfs state of the cdev. +.\" +.Pp .It Ic show Cm conifhk Lists hooks currently waiting for completion in run_interrupt_driven_config_hooks(). From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 12:42:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92DF710656C4; Wed, 8 Sep 2010 12:42:34 +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 627DA8FC1C; Wed, 8 Sep 2010 12:42:34 +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 04F9046BA2; Wed, 8 Sep 2010 08:42:34 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2437C8A04F; Wed, 8 Sep 2010 08:42:33 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Wed, 8 Sep 2010 08:18:58 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009071429.o87ETjLq002398@svn.freebsd.org> In-Reply-To: <201009071429.o87ETjLq002398@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009080818.58374.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 08 Sep 2010 08:42:33 -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 Subject: Re: svn commit: r212293 - in head/sys: fs/nfsclient nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 12:42:34 -0000 On Tuesday, September 07, 2010 10:29:45 am John Baldwin wrote: > Author: jhb > Date: Tue Sep 7 14:29:45 2010 > New Revision: 212293 > URL: http://svn.freebsd.org/changeset/base/212293 > > Log: > Store the full timestamp when caching timestamps of files and > directories for purposes of validating name cache entries. This > closes races where two updates to a file or directory within the same > second could result in stale entries in the name cache. While here, > remove the 'n_expiry' field as it is no longer used. > > Reviewed by: rmacklem > MFC after: 1 week Note that this only reduces races if the NFS server supports sub-second timestamps. FreeBSD NFS servers do not by default since the global vfs timestamp is only updated once a second by default. In particular, the name cache entries in the NFS client can become stale any time that multiple updates can happen to a directory within the same timestamp. Put another way, if a directory has multiple "states" that share the same timestamp, the NFS client may cache the earlier state until the next directory update. It may be worth adding an optional timeout on positive cache entries in the NFS client just as we support having a timeout on negative cache entries to limit the extent of such races at the expense of increased LOOKUP RPCs. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 13:26:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E3C010656A6; Wed, 8 Sep 2010 13:26:19 +0000 (UTC) (envelope-from sanpei@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DE4D8FC0A; Wed, 8 Sep 2010 13:26: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 o88DQJN7028984; Wed, 8 Sep 2010 13:26:19 GMT (envelope-from sanpei@svn.freebsd.org) Received: (from sanpei@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88DQJU2028982; Wed, 8 Sep 2010 13:26:19 GMT (envelope-from sanpei@svn.freebsd.org) Message-Id: <201009081326.o88DQJU2028982@svn.freebsd.org> From: MIHIRA Sanpei Yoshiro Date: Wed, 8 Sep 2010 13:26: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: r212317 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 13:26:19 -0000 Author: sanpei Date: Wed Sep 8 13:26:19 2010 New Revision: 212317 URL: http://svn.freebsd.org/changeset/base/212317 Log: Add Buffalo (Melco Inc.) LUA3-U2-ATX to list of supported devices. Submitted by: nork at FreeBSD.org MFC after: 3 days Modified: head/share/man/man4/axe.4 Modified: head/share/man/man4/axe.4 ============================================================================== --- head/share/man/man4/axe.4 Wed Sep 8 09:53:50 2010 (r212316) +++ head/share/man/man4/axe.4 Wed Sep 8 13:26:19 2010 (r212317) @@ -177,6 +177,8 @@ Sitecom Europe LN-028 AX88772: .Bl -bullet -compact .It +Buffalo (Melco Inc.) LUA3-U2-ATX +.It Cisco-Linksys USB200Mv2 .It D-Link DUBE100B1 From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 14:03:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23EBA106566B; Wed, 8 Sep 2010 14:03:32 +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 C23A88FC0A; Wed, 8 Sep 2010 14:03:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o88Dnfoa095882; Wed, 8 Sep 2010 07:49:41 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 08 Sep 2010 07:49:54 -0600 (MDT) Message-Id: <20100908.074954.895640246715730176.imp@bsdimp.com> To: weongyo@freebsd.org From: "M. Warner Losh" In-Reply-To: <201009062202.o86M29b4067327@svn.freebsd.org> References: <201009062202.o86M29b4067327@svn.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 Subject: Re: svn commit: r212270 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 14:03:32 -0000 In message: <201009062202.o86M29b4067327@svn.freebsd.org> Weongyo Jeong writes: : Author: weongyo : Date: Mon Sep 6 22:02:08 2010 : New Revision: 212270 : URL: http://svn.freebsd.org/changeset/base/212270 : : Log: : Adds bwi(4) at SEE ALSO section because some old devices aren't : supported by the bwn(4) firmware that as fas as I know the vendor : dropped its support. Bumps date also. Should we list them, at least by description? These are the 802.11b-only cards from what I've read in the Linux lists. They don't have enough RAM... Warner From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 14:19:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E4E510656DE; Wed, 8 Sep 2010 14:19:33 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D8978FC14; Wed, 8 Sep 2010 14:19: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 o88EJXR2034199; Wed, 8 Sep 2010 14:19:33 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88EJXDi034197; Wed, 8 Sep 2010 14:19:33 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201009081419.o88EJXDi034197@svn.freebsd.org> From: Marko Zec Date: Wed, 8 Sep 2010 14:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212318 - stable/8/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 14:19:33 -0000 Author: zec Date: Wed Sep 8 14:19:33 2010 New Revision: 212318 URL: http://svn.freebsd.org/changeset/base/212318 Log: MFC r208743: Provide a macro for registering a virtualized sysctl handler for VNET opaque data. Modified: stable/8/sys/net/vnet.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/vnet.h ============================================================================== --- stable/8/sys/net/vnet.h Wed Sep 8 13:26:19 2010 (r212317) +++ stable/8/sys/net/vnet.h Wed Sep 8 14:19:33 2010 (r212318) @@ -236,6 +236,11 @@ int vnet_sysctl_handle_uint(SYSCTL_HANDL fmt, descr) \ SYSCTL_OID(parent, nbr, name, CTLFLAG_VNET|(access), ptr, arg, \ handler, fmt, descr) +#define SYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt, \ + descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr, len, \ + vnet_sysctl_handle_opaque, fmt, descr) #define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_STRING|CTLFLAG_VNET|(access), \ @@ -389,6 +394,9 @@ do { \ fmt, descr) \ SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, \ descr) +#define SYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt, \ + descr) \ + SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) #define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) #define SYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr) \ From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 14:21:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00BF310656A3; Wed, 8 Sep 2010 14:21:13 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2DFE8FC1D; Wed, 8 Sep 2010 14:21: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 o88ELCYx034371; Wed, 8 Sep 2010 14:21:12 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88ELCiO034368; Wed, 8 Sep 2010 14:21:12 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201009081421.o88ELCiO034368@svn.freebsd.org> From: Marko Zec Date: Wed, 8 Sep 2010 14:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212319 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 14:21:13 -0000 Author: zec Date: Wed Sep 8 14:21:12 2010 New Revision: 212319 URL: http://svn.freebsd.org/changeset/base/212319 Log: MFC r208744: Virtualize the IPv4 multicast routing code. Submitted by: iprebeg Reviewed by: bms, bz, Pavlin Radoslavov Modified: stable/8/sys/netinet/ip_mroute.c stable/8/sys/netinet/ip_mroute.h stable/8/sys/netinet/pim_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/ip_mroute.c ============================================================================== --- stable/8/sys/netinet/ip_mroute.c Wed Sep 8 14:19:33 2010 (r212318) +++ stable/8/sys/netinet/ip_mroute.c Wed Sep 8 14:21:12 2010 (r212319) @@ -123,6 +123,9 @@ __FBSDID("$FreeBSD$"); #define VIFI_INVALID ((vifi_t) -1) #define M_HASCL(m) ((m)->m_flags & M_EXT) +static VNET_DEFINE(uint32_t, last_tv_sec); /* last time we processed this */ +#define V_last_tv_sec VNET(last_tv_sec) + static MALLOC_DEFINE(M_MRTABLE, "mroutetbl", "multicast forwarding cache"); /* @@ -141,21 +144,28 @@ static struct mtx mrouter_mtx; mtx_init(&mrouter_mtx, "IPv4 multicast forwarding", NULL, MTX_DEF) #define MROUTER_LOCK_DESTROY() mtx_destroy(&mrouter_mtx) -static struct mrtstat mrtstat; -SYSCTL_STRUCT(_net_inet_ip, OID_AUTO, mrtstat, CTLFLAG_RW, - &mrtstat, mrtstat, +static int ip_mrouter_cnt; /* # of vnets with active mrouters */ +static int ip_mrouter_unloading; /* Allow no more V_ip_mrouter sockets */ + +static VNET_DEFINE(struct mrtstat, mrtstat); +#define V_mrtstat VNET(mrtstat) +SYSCTL_VNET_STRUCT(_net_inet_ip, OID_AUTO, mrtstat, CTLFLAG_RW, + &VNET_NAME(mrtstat), mrtstat, "IPv4 Multicast Forwarding Statistics (struct mrtstat, " "netinet/ip_mroute.h)"); -static u_long mfchash; -#define MFCHASH(a, g) \ +static VNET_DEFINE(u_long, mfchash); +#define V_mfchash VNET(mfchash) +#define MFCHASH(a, g) \ ((((a).s_addr >> 20) ^ ((a).s_addr >> 10) ^ (a).s_addr ^ \ - ((g).s_addr >> 20) ^ ((g).s_addr >> 10) ^ (g).s_addr) & mfchash) -#define MFCHASHSIZE 256 + ((g).s_addr >> 20) ^ ((g).s_addr >> 10) ^ (g).s_addr) & V_mfchash) +#define MFCHASHSIZE 256 -static u_char *nexpire; /* 0..mfchashsize-1 */ -static u_long mfchashsize; /* Hash size */ -LIST_HEAD(mfchashhdr, mfc) *mfchashtbl; +static u_long mfchashsize; /* Hash size */ +static VNET_DEFINE(u_char *, nexpire); /* 0..mfchashsize-1 */ +#define V_nexpire VNET(nexpire) +static VNET_DEFINE(LIST_HEAD(mfchashhdr, mfc)*, mfchashtbl); +#define V_mfchashtbl VNET(mfchashtbl) static struct mtx mfc_mtx; #define MFC_LOCK() mtx_lock(&mfc_mtx) @@ -165,10 +175,12 @@ static struct mtx mfc_mtx; mtx_init(&mfc_mtx, "IPv4 multicast forwarding cache", NULL, MTX_DEF) #define MFC_LOCK_DESTROY() mtx_destroy(&mfc_mtx) -static vifi_t numvifs; -static struct vif viftable[MAXVIFS]; -SYSCTL_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_RD, - &viftable, sizeof(viftable), "S,vif[MAXVIFS]", +static VNET_DEFINE(vifi_t, numvifs); +#define V_numvifs VNET(numvifs) +static VNET_DEFINE(struct vif, viftable[MAXVIFS]); +#define V_viftable VNET(viftable) +SYSCTL_VNET_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_RD, + &VNET_NAME(viftable), sizeof(V_viftable), "S,vif[MAXVIFS]", "IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)"); static struct mtx vif_mtx; @@ -181,7 +193,9 @@ static struct mtx vif_mtx; static eventhandler_tag if_detach_event_tag = NULL; -static struct callout expire_upcalls_ch; +static VNET_DEFINE(struct callout, expire_upcalls_ch); +#define V_expire_upcalls_ch VNET(expire_upcalls_ch) + #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ #define UPCALL_EXPIRE 6 /* number of timeouts */ @@ -193,25 +207,32 @@ static MALLOC_DEFINE(M_BWMETER, "bwmeter * Pending timeouts are stored in a hash table, the key being the * expiration time. Periodically, the entries are analysed and processed. */ -#define BW_METER_BUCKETS 1024 -static struct bw_meter *bw_meter_timers[BW_METER_BUCKETS]; -static struct callout bw_meter_ch; -#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ +#define BW_METER_BUCKETS 1024 +static VNET_DEFINE(struct bw_meter*, bw_meter_timers[BW_METER_BUCKETS]); +#define V_bw_meter_timers VNET(bw_meter_timers) +static VNET_DEFINE(struct callout, bw_meter_ch); +#define V_bw_meter_ch VNET(bw_meter_ch) +#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ /* * Pending upcalls are stored in a vector which is flushed when * full, or periodically */ -static struct bw_upcall bw_upcalls[BW_UPCALLS_MAX]; -static u_int bw_upcalls_n; /* # of pending upcalls */ -static struct callout bw_upcalls_ch; +static VNET_DEFINE(struct bw_upcall, bw_upcalls[BW_UPCALLS_MAX]); +#define V_bw_upcalls VNET(bw_upcalls) +static VNET_DEFINE(u_int, bw_upcalls_n); /* # of pending upcalls */ +#define V_bw_upcalls_n VNET(bw_upcalls_n) +static VNET_DEFINE(struct callout, bw_upcalls_ch); +#define V_bw_upcalls_ch VNET(bw_upcalls_ch) + #define BW_UPCALLS_PERIOD (hz) /* periodical flush of bw upcalls */ -static struct pimstat pimstat; +static VNET_DEFINE(struct pimstat, pimstat); +#define V_pimstat VNET(pimstat) SYSCTL_NODE(_net_inet, IPPROTO_PIM, pim, CTLFLAG_RW, 0, "PIM"); -SYSCTL_STRUCT(_net_inet_pim, PIMCTL_STATS, stats, CTLFLAG_RD, - &pimstat, pimstat, +SYSCTL_VNET_STRUCT(_net_inet_pim, PIMCTL_STATS, stats, CTLFLAG_RD, + &VNET_NAME(pimstat), pimstat, "PIM Statistics (struct pimstat, netinet/pim_var.h)"); static u_long pim_squelch_wholepkt = 0; @@ -277,8 +298,10 @@ static struct pim_encap_pimhdr pim_encap 0 /* flags */ }; -static struct ifnet multicast_register_if; -static vifi_t reg_vif_num = VIFI_INVALID; +static VNET_DEFINE(vifi_t, reg_vif_num) = VIFI_INVALID; +#define V_reg_vif_num VNET(reg_vif_num) +static VNET_DEFINE(struct ifnet, multicast_register_if); +#define V_multicast_register_if VNET(multicast_register_if) /* * Private variables. @@ -346,9 +369,10 @@ static const uint32_t mrt_api_support = MRT_MFC_FLAGS_BORDER_VIF | MRT_MFC_RP | MRT_MFC_BW_UPCALL); -static uint32_t mrt_api_config = 0; - -static int pim_assert_enabled; +static VNET_DEFINE(uint32_t, mrt_api_config); +#define V_mrt_api_config VNET(mrt_api_config) +static VNET_DEFINE(int, pim_assert_enabled); +#define V_pim_assert_enabled VNET(pim_assert_enabled) static struct timeval pim_assert_interval = { 3, 0 }; /* Rate limit */ /* @@ -362,7 +386,7 @@ mfc_find(struct in_addr *o, struct in_ad MFC_LOCK_ASSERT(); - LIST_FOREACH(rt, &mfchashtbl[MFCHASH(*o, *g)], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[MFCHASH(*o, *g)], mfc_hash) { if (in_hosteq(rt->mfc_origin, *o) && in_hosteq(rt->mfc_mcastgrp, *g) && TAILQ_EMPTY(&rt->mfc_stall)) @@ -421,7 +445,7 @@ X_ip_mrouter_set(struct socket *so, stru * select data size depending on API version. */ if (sopt->sopt_name == MRT_ADD_MFC && - mrt_api_config & MRT_API_FLAGS_ALL) { + V_mrt_api_config & MRT_API_FLAGS_ALL) { error = sooptcopyin(sopt, &mfc, sizeof(struct mfcctl2), sizeof(struct mfcctl2)); } else { @@ -486,8 +510,8 @@ X_ip_mrouter_get(struct socket *so, stru break; case MRT_ASSERT: - error = sooptcopyout(sopt, &pim_assert_enabled, - sizeof pim_assert_enabled); + error = sooptcopyout(sopt, &V_pim_assert_enabled, + sizeof V_pim_assert_enabled); break; case MRT_API_SUPPORT: @@ -495,7 +519,7 @@ X_ip_mrouter_get(struct socket *so, stru break; case MRT_API_CONFIG: - error = sooptcopyout(sopt, &mrt_api_config, sizeof mrt_api_config); + error = sooptcopyout(sopt, &V_mrt_api_config, sizeof V_mrt_api_config); break; default: @@ -568,36 +592,21 @@ get_vif_cnt(struct sioc_vif_req *req) vifi_t vifi = req->vifi; VIF_LOCK(); - if (vifi >= numvifs) { + if (vifi >= V_numvifs) { VIF_UNLOCK(); return EINVAL; } - req->icount = viftable[vifi].v_pkt_in; - req->ocount = viftable[vifi].v_pkt_out; - req->ibytes = viftable[vifi].v_bytes_in; - req->obytes = viftable[vifi].v_bytes_out; + req->icount = V_viftable[vifi].v_pkt_in; + req->ocount = V_viftable[vifi].v_pkt_out; + req->ibytes = V_viftable[vifi].v_bytes_in; + req->obytes = V_viftable[vifi].v_bytes_out; VIF_UNLOCK(); return 0; } static void -ip_mrouter_reset(void) -{ - - pim_assert_enabled = 0; - mrt_api_config = 0; - - callout_init(&expire_upcalls_ch, CALLOUT_MPSAFE); - - bw_upcalls_n = 0; - bzero((caddr_t)bw_meter_timers, sizeof(bw_meter_timers)); - callout_init(&bw_upcalls_ch, CALLOUT_MPSAFE); - callout_init(&bw_meter_ch, CALLOUT_MPSAFE); -} - -static void if_detached_event(void *arg __unused, struct ifnet *ifp) { vifi_t vifi; @@ -621,12 +630,12 @@ if_detached_event(void *arg __unused, st * 3. Expire any matching multicast forwarding cache entries. * 4. Free vif state. This should disable ALLMULTI on the interface. */ - for (vifi = 0; vifi < numvifs; vifi++) { - if (viftable[vifi].v_ifp != ifp) + for (vifi = 0; vifi < V_numvifs; vifi++) { + if (V_viftable[vifi].v_ifp != ifp) continue; for (i = 0; i < mfchashsize; i++) { struct mfc *rt, *nrt; - for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { + for (rt = LIST_FIRST(&V_mfchashtbl[i]); rt; rt = nrt) { nrt = LIST_NEXT(rt, mfc_hash); if (rt->mfc_parent == vifi) { expire_mfc(rt); @@ -660,27 +669,28 @@ ip_mrouter_init(struct socket *so, int v MROUTER_LOCK(); - if (V_ip_mrouter != NULL) { + if (ip_mrouter_unloading) { MROUTER_UNLOCK(); - return EADDRINUSE; + return ENOPROTOOPT; } - if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, - if_detached_event, NULL, EVENTHANDLER_PRI_ANY); - if (if_detach_event_tag == NULL) { + if (V_ip_mrouter != NULL) { MROUTER_UNLOCK(); - return (ENOMEM); + return EADDRINUSE; } - mfchashtbl = hashinit_flags(mfchashsize, M_MRTABLE, &mfchash, HASH_NOWAIT); - - callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); + V_mfchashtbl = hashinit_flags(mfchashsize, M_MRTABLE, &V_mfchash, + HASH_NOWAIT); - callout_reset(&bw_upcalls_ch, BW_UPCALLS_PERIOD, - expire_bw_upcalls_send, NULL); - callout_reset(&bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, NULL); + callout_reset(&V_expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, + curvnet); + callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, + curvnet); + callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, + curvnet); V_ip_mrouter = so; + ip_mrouter_cnt++; MROUTER_UNLOCK(); @@ -711,7 +721,8 @@ X_ip_mrouter_done(void) * Detach/disable hooks to the reset of the system. */ V_ip_mrouter = NULL; - mrt_api_config = 0; + ip_mrouter_cnt--; + V_mrt_api_config = 0; VIF_LOCK(); @@ -719,29 +730,27 @@ X_ip_mrouter_done(void) * For each phyint in use, disable promiscuous reception of all IP * multicasts. */ - for (vifi = 0; vifi < numvifs; vifi++) { - if (!in_nullhost(viftable[vifi].v_lcl_addr) && - !(viftable[vifi].v_flags & (VIFF_TUNNEL | VIFF_REGISTER))) { + for (vifi = 0; vifi < V_numvifs; vifi++) { + if (!in_nullhost(V_viftable[vifi].v_lcl_addr) && + !(V_viftable[vifi].v_flags & (VIFF_TUNNEL | VIFF_REGISTER))) { struct sockaddr_in *so = (struct sockaddr_in *)&(ifr.ifr_addr); so->sin_len = sizeof(struct sockaddr_in); so->sin_family = AF_INET; so->sin_addr.s_addr = INADDR_ANY; - ifp = viftable[vifi].v_ifp; + ifp = V_viftable[vifi].v_ifp; if_allmulti(ifp, 0); } } - bzero((caddr_t)viftable, sizeof(viftable)); - numvifs = 0; - pim_assert_enabled = 0; - + bzero((caddr_t)V_viftable, sizeof(V_viftable)); + V_numvifs = 0; + V_pim_assert_enabled = 0; + VIF_UNLOCK(); - EVENTHANDLER_DEREGISTER(ifnet_departure_event, if_detach_event_tag); - - callout_stop(&expire_upcalls_ch); - callout_stop(&bw_upcalls_ch); - callout_stop(&bw_meter_ch); + callout_stop(&V_expire_upcalls_ch); + callout_stop(&V_bw_upcalls_ch); + callout_stop(&V_bw_meter_ch); MFC_LOCK(); @@ -751,22 +760,22 @@ X_ip_mrouter_done(void) */ for (i = 0; i < mfchashsize; i++) { struct mfc *rt, *nrt; - for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { + for (rt = LIST_FIRST(&V_mfchashtbl[i]); rt; rt = nrt) { nrt = LIST_NEXT(rt, mfc_hash); expire_mfc(rt); } } - free(mfchashtbl, M_MRTABLE); - mfchashtbl = NULL; + free(V_mfchashtbl, M_MRTABLE); + V_mfchashtbl = NULL; - bzero(nexpire, sizeof(nexpire[0]) * mfchashsize); + bzero(V_nexpire, sizeof(V_nexpire[0]) * mfchashsize); - bw_upcalls_n = 0; - bzero(bw_meter_timers, sizeof(bw_meter_timers)); + V_bw_upcalls_n = 0; + bzero(V_bw_meter_timers, sizeof(V_bw_meter_timers)); MFC_UNLOCK(); - reg_vif_num = VIFI_INVALID; + V_reg_vif_num = VIFI_INVALID; MROUTER_UNLOCK(); @@ -784,7 +793,7 @@ set_assert(int i) if ((i != 1) && (i != 0)) return EINVAL; - pim_assert_enabled = i; + V_pim_assert_enabled = i; return 0; } @@ -804,11 +813,11 @@ set_api_config(uint32_t *apival) * - pim_assert is not enabled * - the MFC table is empty */ - if (numvifs > 0) { + if (V_numvifs > 0) { *apival = 0; return EPERM; } - if (pim_assert_enabled) { + if (V_pim_assert_enabled) { *apival = 0; return EPERM; } @@ -816,7 +825,7 @@ set_api_config(uint32_t *apival) MFC_LOCK(); for (i = 0; i < mfchashsize; i++) { - if (LIST_FIRST(&mfchashtbl[i]) != NULL) { + if (LIST_FIRST(&V_mfchashtbl[i]) != NULL) { *apival = 0; return EPERM; } @@ -824,8 +833,8 @@ set_api_config(uint32_t *apival) MFC_UNLOCK(); - mrt_api_config = *apival & mrt_api_support; - *apival = mrt_api_config; + V_mrt_api_config = *apival & mrt_api_support; + *apival = V_mrt_api_config; return 0; } @@ -836,7 +845,7 @@ set_api_config(uint32_t *apival) static int add_vif(struct vifctl *vifcp) { - struct vif *vifp = viftable + vifcp->vifc_vifi; + struct vif *vifp = V_viftable + vifcp->vifc_vifi; struct sockaddr_in sin = {sizeof sin, AF_INET}; struct ifaddr *ifa; struct ifnet *ifp; @@ -886,12 +895,12 @@ add_vif(struct vifctl *vifcp) VIF_UNLOCK(); return EOPNOTSUPP; } else if (vifcp->vifc_flags & VIFF_REGISTER) { - ifp = &multicast_register_if; + ifp = &V_multicast_register_if; CTR2(KTR_IPMF, "%s: add register vif for ifp %p", __func__, ifp); - if (reg_vif_num == VIFI_INVALID) { - if_initname(&multicast_register_if, "register_vif", 0); - multicast_register_if.if_flags = IFF_LOOPBACK; - reg_vif_num = vifcp->vifc_vifi; + if (V_reg_vif_num == VIFI_INVALID) { + if_initname(&V_multicast_register_if, "register_vif", 0); + V_multicast_register_if.if_flags = IFF_LOOPBACK; + V_reg_vif_num = vifcp->vifc_vifi; } } else { /* Make sure the interface supports multicast */ if ((ifp->if_flags & IFF_MULTICAST) == 0) { @@ -920,8 +929,8 @@ add_vif(struct vifctl *vifcp) bzero(&vifp->v_route, sizeof(vifp->v_route)); /* Adjust numvifs up if the vifi is higher than numvifs */ - if (numvifs <= vifcp->vifc_vifi) - numvifs = vifcp->vifc_vifi + 1; + if (V_numvifs <= vifcp->vifc_vifi) + V_numvifs = vifcp->vifc_vifi + 1; VIF_UNLOCK(); @@ -942,10 +951,10 @@ del_vif_locked(vifi_t vifi) VIF_LOCK_ASSERT(); - if (vifi >= numvifs) { + if (vifi >= V_numvifs) { return EINVAL; } - vifp = &viftable[vifi]; + vifp = &V_viftable[vifi]; if (in_nullhost(vifp->v_lcl_addr)) { return EADDRNOTAVAIL; } @@ -954,17 +963,17 @@ del_vif_locked(vifi_t vifi) if_allmulti(vifp->v_ifp, 0); if (vifp->v_flags & VIFF_REGISTER) - reg_vif_num = VIFI_INVALID; + V_reg_vif_num = VIFI_INVALID; bzero((caddr_t)vifp, sizeof (*vifp)); CTR2(KTR_IPMF, "%s: delete vif %d", __func__, (int)vifi); /* Adjust numvifs down */ - for (vifi = numvifs; vifi > 0; vifi--) - if (!in_nullhost(viftable[vifi-1].v_lcl_addr)) + for (vifi = V_numvifs; vifi > 0; vifi--) + if (!in_nullhost(V_viftable[vifi-1].v_lcl_addr)) break; - numvifs = vifi; + V_numvifs = vifi; return 0; } @@ -990,13 +999,13 @@ update_mfc_params(struct mfc *rt, struct int i; rt->mfc_parent = mfccp->mfcc_parent; - for (i = 0; i < numvifs; i++) { + for (i = 0; i < V_numvifs; i++) { rt->mfc_ttls[i] = mfccp->mfcc_ttls[i]; - rt->mfc_flags[i] = mfccp->mfcc_flags[i] & mrt_api_config & + rt->mfc_flags[i] = mfccp->mfcc_flags[i] & V_mrt_api_config & MRT_MFC_FLAGS_ALL; } /* set the RP address */ - if (mrt_api_config & MRT_MFC_RP) + if (V_mrt_api_config & MRT_MFC_RP) rt->mfc_rp = mfccp->mfcc_rp; else rt->mfc_rp.s_addr = INADDR_ANY; @@ -1070,7 +1079,7 @@ add_mfc(struct mfcctl2 *mfccp) */ nstl = 0; hash = MFCHASH(mfccp->mfcc_origin, mfccp->mfcc_mcastgrp); - LIST_FOREACH(rt, &mfchashtbl[hash], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { if (in_hosteq(rt->mfc_origin, mfccp->mfcc_origin) && in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp) && !TAILQ_EMPTY(&rt->mfc_stall)) { @@ -1085,7 +1094,7 @@ add_mfc(struct mfcctl2 *mfccp) init_mfc_params(rt, mfccp); rt->mfc_expire = 0; /* Don't clean this guy up */ - nexpire[hash]--; + V_nexpire[hash]--; /* Free queued packets, but attempt to forward them first. */ TAILQ_FOREACH_SAFE(rte, &rt->mfc_stall, rte_link, nrte) { @@ -1104,12 +1113,12 @@ add_mfc(struct mfcctl2 *mfccp) */ if (nstl == 0) { CTR1(KTR_IPMF, "%s: adding mfc w/o upcall", __func__); - LIST_FOREACH(rt, &mfchashtbl[hash], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { if (in_hosteq(rt->mfc_origin, mfccp->mfcc_origin) && in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp)) { init_mfc_params(rt, mfccp); if (rt->mfc_expire) - nexpire[hash]--; + V_nexpire[hash]--; rt->mfc_expire = 0; break; /* XXX */ } @@ -1131,7 +1140,7 @@ add_mfc(struct mfcctl2 *mfccp) rt->mfc_bw_meter = NULL; /* insert new entry at head of hash chain */ - LIST_INSERT_HEAD(&mfchashtbl[hash], rt, mfc_hash); + LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); } } @@ -1238,7 +1247,7 @@ X_ip_mforward(struct ip *ip, struct ifne VIF_LOCK(); MFC_LOCK(); - if (imo && ((vifi = imo->imo_multicast_vif) < numvifs)) { + if (imo && ((vifi = imo->imo_multicast_vif) < V_numvifs)) { if (ip->ip_ttl < MAXTTL) ip->ip_ttl++; /* compensate for -1 in *_send routines */ error = ip_mdq(m, ifp, NULL, vifi); @@ -1310,7 +1319,7 @@ X_ip_mforward(struct ip *ip, struct ifne /* is there an upcall waiting for this flow ? */ hash = MFCHASH(ip->ip_src, ip->ip_dst); - LIST_FOREACH(rt, &mfchashtbl[hash], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { if (in_hosteq(ip->ip_src, rt->mfc_origin) && in_hosteq(ip->ip_dst, rt->mfc_mcastgrp) && !TAILQ_EMPTY(&rt->mfc_stall)) @@ -1327,10 +1336,10 @@ X_ip_mforward(struct ip *ip, struct ifne * Locate the vifi for the incoming interface for this packet. * If none found, drop packet. */ - for (vifi = 0; vifi < numvifs && - viftable[vifi].v_ifp != ifp; vifi++) + for (vifi = 0; vifi < V_numvifs && + V_viftable[vifi].v_ifp != ifp; vifi++) ; - if (vifi >= numvifs) /* vif not found, drop packet */ + if (vifi >= V_numvifs) /* vif not found, drop packet */ goto non_fatal; /* no upcall, so make a new entry */ @@ -1373,8 +1382,8 @@ fail: rt->mfc_origin.s_addr = ip->ip_src.s_addr; rt->mfc_mcastgrp.s_addr = ip->ip_dst.s_addr; rt->mfc_expire = UPCALL_EXPIRE; - nexpire[hash]++; - for (i = 0; i < numvifs; i++) { + V_nexpire[hash]++; + for (i = 0; i < V_numvifs; i++) { rt->mfc_ttls[i] = 0; rt->mfc_flags[i] = 0; } @@ -1394,7 +1403,7 @@ fail: rt->mfc_nstall = 0; /* link into table */ - LIST_INSERT_HEAD(&mfchashtbl[hash], rt, mfc_hash); + LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); TAILQ_INSERT_HEAD(&rt->mfc_stall, rte, rte_link); rt->mfc_nstall++; @@ -1427,19 +1436,21 @@ non_fatal: * Clean up the cache entry if upcall is not serviced */ static void -expire_upcalls(void *unused) +expire_upcalls(void *arg) { int i; + CURVNET_SET((struct vnet *) arg); + MFC_LOCK(); for (i = 0; i < mfchashsize; i++) { struct mfc *rt, *nrt; - if (nexpire[i] == 0) + if (V_nexpire[i] == 0) continue; - for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { + for (rt = LIST_FIRST(&V_mfchashtbl[i]); rt; rt = nrt) { nrt = LIST_NEXT(rt, mfc_hash); if (TAILQ_EMPTY(&rt->mfc_stall)) @@ -1469,7 +1480,10 @@ expire_upcalls(void *unused) MFC_UNLOCK(); - callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); + callout_reset(&V_expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, + curvnet); + + CURVNET_RESTORE(); } /* @@ -1489,11 +1503,11 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * * (since vifi_t is u_short, -1 becomes MAXUSHORT, which > numvifs.) */ - if (xmt_vif < numvifs) { - if (viftable[xmt_vif].v_flags & VIFF_REGISTER) - pim_register_send(ip, viftable + xmt_vif, m, rt); + if (xmt_vif < V_numvifs) { + if (V_viftable[xmt_vif].v_flags & VIFF_REGISTER) + pim_register_send(ip, V_viftable + xmt_vif, m, rt); else - phyint_send(ip, viftable + xmt_vif, m); + phyint_send(ip, V_viftable + xmt_vif, m); return 1; } @@ -1501,9 +1515,9 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * Don't forward if it didn't arrive from the parent vif for its origin. */ vifi = rt->mfc_parent; - if ((vifi >= numvifs) || (viftable[vifi].v_ifp != ifp)) { + if ((vifi >= V_numvifs) || (V_viftable[vifi].v_ifp != ifp)) { CTR4(KTR_IPMF, "%s: rx on wrong ifp %p (vifi %d, v_ifp %p)", - __func__, ifp, (int)vifi, viftable[vifi].v_ifp); + __func__, ifp, (int)vifi, V_viftable[vifi].v_ifp); MRTSTAT_INC(mrts_wrong_if); ++rt->mfc_wrong_if; /* @@ -1514,15 +1528,17 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * can complete the SPT switch, regardless of the type * of the iif (broadcast media, GRE tunnel, etc). */ - if (pim_assert_enabled && (vifi < numvifs) && viftable[vifi].v_ifp) { + if (V_pim_assert_enabled && (vifi < V_numvifs) && + V_viftable[vifi].v_ifp) { - if (ifp == &multicast_register_if) + if (ifp == &V_multicast_register_if) PIMSTAT_INC(pims_rcv_registers_wrongiif); /* Get vifi for the incoming packet */ - for (vifi=0; vifi < numvifs && viftable[vifi].v_ifp != ifp; vifi++) + for (vifi = 0; vifi < V_numvifs && V_viftable[vifi].v_ifp != ifp; + vifi++) ; - if (vifi >= numvifs) + if (vifi >= V_numvifs) return 0; /* The iif is not found: ignore the packet. */ if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_DISABLE_WRONGVIF) @@ -1559,12 +1575,12 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp /* If I sourced this packet, it counts as output, else it was input. */ - if (in_hosteq(ip->ip_src, viftable[vifi].v_lcl_addr)) { - viftable[vifi].v_pkt_out++; - viftable[vifi].v_bytes_out += plen; + if (in_hosteq(ip->ip_src, V_viftable[vifi].v_lcl_addr)) { + V_viftable[vifi].v_pkt_out++; + V_viftable[vifi].v_bytes_out += plen; } else { - viftable[vifi].v_pkt_in++; - viftable[vifi].v_bytes_in += plen; + V_viftable[vifi].v_pkt_in++; + V_viftable[vifi].v_bytes_in += plen; } rt->mfc_pkt_cnt++; rt->mfc_byte_cnt += plen; @@ -1575,14 +1591,14 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * - the ttl exceeds the vif's threshold * - there are group members downstream on interface */ - for (vifi = 0; vifi < numvifs; vifi++) + for (vifi = 0; vifi < V_numvifs; vifi++) if ((rt->mfc_ttls[vifi] > 0) && (ip->ip_ttl > rt->mfc_ttls[vifi])) { - viftable[vifi].v_pkt_out++; - viftable[vifi].v_bytes_out += plen; - if (viftable[vifi].v_flags & VIFF_REGISTER) - pim_register_send(ip, viftable + vifi, m, rt); + V_viftable[vifi].v_pkt_out++; + V_viftable[vifi].v_bytes_out += plen; + if (V_viftable[vifi].v_flags & VIFF_REGISTER) + pim_register_send(ip, V_viftable + vifi, m, rt); else - phyint_send(ip, viftable + vifi, m); + phyint_send(ip, V_viftable + vifi, m); } /* @@ -1614,7 +1630,7 @@ X_legal_vif_num(int vif) return (ret); VIF_LOCK(); - if (vif < numvifs) + if (vif < V_numvifs) ret = 1; VIF_UNLOCK(); @@ -1634,8 +1650,8 @@ X_ip_mcast_src(int vifi) return (addr); VIF_LOCK(); - if (vifi < numvifs) - addr = viftable[vifi].v_lcl_addr.s_addr; + if (vifi < V_numvifs) + addr = V_viftable[vifi].v_lcl_addr.s_addr; VIF_UNLOCK(); return (addr); @@ -1688,7 +1704,7 @@ send_packet(struct vif *vifp, struct mbu */ error = ip_output(m, NULL, &vifp->v_route, IP_FORWARDING, &imo, NULL); CTR3(KTR_IPMF, "%s: vif %td err %d", __func__, - (ptrdiff_t)(vifp - viftable), error); + (ptrdiff_t)(vifp - V_viftable), error); } /* @@ -1757,7 +1773,7 @@ add_bw_upcall(struct bw_upcall *req) struct bw_meter *x; uint32_t flags; - if (!(mrt_api_config & MRT_MFC_BW_UPCALL)) + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; /* Test if the flags are valid */ @@ -1845,7 +1861,7 @@ del_bw_upcall(struct bw_upcall *req) struct mfc *mfc; struct bw_meter *x; - if (!(mrt_api_config & MRT_MFC_BW_UPCALL)) + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; MFC_LOCK(); @@ -2013,13 +2029,13 @@ bw_meter_prepare_upcall(struct bw_meter /* * If there are too many pending upcalls, deliver them now */ - if (bw_upcalls_n >= BW_UPCALLS_MAX) + if (V_bw_upcalls_n >= BW_UPCALLS_MAX) bw_upcalls_send(); /* * Set the bw_upcall entry */ - u = &bw_upcalls[bw_upcalls_n++]; + u = &V_bw_upcalls[V_bw_upcalls_n++]; u->bu_src = x->bm_mfc->mfc_origin; u->bu_dst = x->bm_mfc->mfc_mcastgrp; u->bu_threshold.b_time = x->bm_threshold.b_time; @@ -2046,7 +2062,7 @@ static void bw_upcalls_send(void) { struct mbuf *m; - int len = bw_upcalls_n * sizeof(bw_upcalls[0]); + int len = V_bw_upcalls_n * sizeof(V_bw_upcalls[0]); struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET }; static struct igmpmsg igmpmsg = { 0, /* unused1 */ 0, /* unused2 */ @@ -2059,10 +2075,10 @@ bw_upcalls_send(void) MFC_LOCK_ASSERT(); - if (bw_upcalls_n == 0) + if (V_bw_upcalls_n == 0) return; /* No pending upcalls */ - bw_upcalls_n = 0; + V_bw_upcalls_n = 0; /* * Allocate a new mbuf, initialize it with the header and @@ -2076,7 +2092,7 @@ bw_upcalls_send(void) m->m_len = m->m_pkthdr.len = 0; m_copyback(m, 0, sizeof(struct igmpmsg), (caddr_t)&igmpmsg); - m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&bw_upcalls[0]); + m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&V_bw_upcalls[0]); /* * Send the upcalls @@ -2129,8 +2145,8 @@ schedule_bw_meter(struct bw_meter *x, st * Compute the timeout hash value and insert the entry */ BW_METER_TIMEHASH(x, time_hash); - x->bm_time_next = bw_meter_timers[time_hash]; - bw_meter_timers[time_hash] = x; + x->bm_time_next = V_bw_meter_timers[time_hash]; + V_bw_meter_timers[time_hash] = x; x->bm_time_hash = time_hash; } @@ -2156,7 +2172,7 @@ unschedule_bw_meter(struct bw_meter *x) if (time_hash >= BW_METER_BUCKETS) return; /* Entry was not scheduled */ - for (prev = NULL, tmp = bw_meter_timers[time_hash]; + for (prev = NULL, tmp = V_bw_meter_timers[time_hash]; tmp != NULL; prev = tmp, tmp = tmp->bm_time_next) if (tmp == x) break; @@ -2167,7 +2183,7 @@ unschedule_bw_meter(struct bw_meter *x) if (prev != NULL) prev->bm_time_next = x->bm_time_next; else - bw_meter_timers[time_hash] = x->bm_time_next; + V_bw_meter_timers[time_hash] = x->bm_time_next; x->bm_time_next = NULL; x->bm_time_hash = BW_METER_BUCKETS; @@ -2186,18 +2202,16 @@ unschedule_bw_meter(struct bw_meter *x) static void bw_meter_process() { - static uint32_t last_tv_sec; /* last time we processed this */ - uint32_t loops; int i; struct timeval now, process_endtime; microtime(&now); - if (last_tv_sec == now.tv_sec) + if (V_last_tv_sec == now.tv_sec) return; /* nothing to do */ - loops = now.tv_sec - last_tv_sec; - last_tv_sec = now.tv_sec; + loops = now.tv_sec - V_last_tv_sec; + V_last_tv_sec = now.tv_sec; if (loops > BW_METER_BUCKETS) loops = BW_METER_BUCKETS; @@ -2214,8 +2228,8 @@ bw_meter_process() i = 0; /* Disconnect the list of bw_meter entries from the bin */ - tmp_list = bw_meter_timers[i]; - bw_meter_timers[i] = NULL; + tmp_list = V_bw_meter_timers[i]; + V_bw_meter_timers[i] = NULL; /* Process the list of bw_meter entries */ while (tmp_list != NULL) { @@ -2238,8 +2252,8 @@ bw_meter_process() if (++time_hash >= BW_METER_BUCKETS) time_hash = 0; } - x->bm_time_next = bw_meter_timers[time_hash]; - bw_meter_timers[time_hash] = x; + x->bm_time_next = V_bw_meter_timers[time_hash]; + V_bw_meter_timers[time_hash] = x; x->bm_time_hash = time_hash; continue; @@ -2273,14 +2287,17 @@ bw_meter_process() * A periodic function for sending all upcalls that are pending delivery */ static void -expire_bw_upcalls_send(void *unused) +expire_bw_upcalls_send(void *arg) { + CURVNET_SET((struct vnet *) arg); + MFC_LOCK(); bw_upcalls_send(); MFC_UNLOCK(); - callout_reset(&bw_upcalls_ch, BW_UPCALLS_PERIOD, - expire_bw_upcalls_send, NULL); + callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, + curvnet); + CURVNET_RESTORE(); } /* @@ -2288,12 +2305,16 @@ expire_bw_upcalls_send(void *unused) * table for processing all "<=" bw_meter entries. */ static void -expire_bw_meter_process(void *unused) +expire_bw_meter_process(void *arg) { - if (mrt_api_config & MRT_MFC_BW_UPCALL) + CURVNET_SET((struct vnet *) arg); + + if (V_mrt_api_config & MRT_MFC_BW_UPCALL) bw_meter_process(); - callout_reset(&bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, NULL); + callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, + curvnet); + CURVNET_RESTORE(); } /* @@ -2314,7 +2335,7 @@ pim_register_send(struct ip *ip, struct * Do not send IGMP_WHOLEPKT notifications to userland, if the * rendezvous point was unspecified, and we were told not to. */ - if (pim_squelch_wholepkt != 0 && (mrt_api_config & MRT_MFC_RP) && + if (pim_squelch_wholepkt != 0 && (V_mrt_api_config & MRT_MFC_RP) && in_nullhost(rt->mfc_rp)) return 0; @@ -2332,7 +2353,7 @@ pim_register_send(struct ip *ip, struct mm = m_pullup(mm, sizeof(struct ip)); if (mm != NULL) { ip = mtod(mm, struct ip *); - if ((mrt_api_config & MRT_MFC_RP) && !in_nullhost(rt->mfc_rp)) { + if ((V_mrt_api_config & MRT_MFC_RP) && !in_nullhost(rt->mfc_rp)) { pim_register_send_rp(ip, vifp, mm, rt); } else { pim_register_send_upcall(ip, vifp, mm, rt); @@ -2425,7 +2446,7 @@ pim_register_send_upcall(struct ip *ip, im = mtod(mb_first, struct igmpmsg *); im->im_msgtype = IGMPMSG_WHOLEPKT; im->im_mbz = 0; - im->im_vif = vifp - viftable; + im->im_vif = vifp - V_viftable; im->im_src = ip->ip_src; im->im_dst = ip->ip_dst; @@ -2461,7 +2482,7 @@ pim_register_send_rp(struct ip *ip, stru VIF_LOCK_ASSERT(); - if ((vifi >= numvifs) || in_nullhost(viftable[vifi].v_lcl_addr)) { + if ((vifi >= V_numvifs) || in_nullhost(V_viftable[vifi].v_lcl_addr)) { m_freem(mb_copy); return EADDRNOTAVAIL; /* The iif vif is invalid */ } @@ -2487,7 +2508,7 @@ pim_register_send_rp(struct ip *ip, stru *ip_outer = pim_encap_iphdr; ip_outer->ip_id = ip_newid(); ip_outer->ip_len = len + sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr); - ip_outer->ip_src = viftable[vifi].v_lcl_addr; + ip_outer->ip_src = V_viftable[vifi].v_lcl_addr; ip_outer->ip_dst = rt->mfc_rp; /* * Copy the inner header TOS to the outer header, and take care of the @@ -2500,7 +2521,7 @@ pim_register_send_rp(struct ip *ip, stru + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; /* If the iif crosses a border, set the Border-bit */ - if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & mrt_api_config) + if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & V_mrt_api_config) pimhdr->flags |= htonl(PIM_BORDER_REGISTER); mb_first->m_data += sizeof(pim_encap_iphdr); @@ -2637,15 +2658,15 @@ pim_input(struct mbuf *m, int off) struct ifnet *vifp; VIF_LOCK(); - if ((reg_vif_num >= numvifs) || (reg_vif_num == VIFI_INVALID)) { + if ((V_reg_vif_num >= V_numvifs) || (V_reg_vif_num == VIFI_INVALID)) { VIF_UNLOCK(); CTR2(KTR_IPMF, "%s: register vif not set: %d", __func__, - (int)reg_vif_num); + (int)V_reg_vif_num); m_freem(m); return; } /* XXX need refcnt? */ - vifp = viftable[reg_vif_num].v_ifp; + vifp = V_viftable[V_reg_vif_num].v_ifp; VIF_UNLOCK(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 14:22:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18CFD10656A5; Wed, 8 Sep 2010 14:22:36 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F261A8FC13; Wed, 8 Sep 2010 14:22:35 +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 o88EMZog034506; Wed, 8 Sep 2010 14:22:35 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88EMZZH034502; Wed, 8 Sep 2010 14:22:35 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201009081422.o88EMZZH034502@svn.freebsd.org> From: Marko Zec Date: Wed, 8 Sep 2010 14:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212320 - stable/8/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 14:22:36 -0000 Author: zec Date: Wed Sep 8 14:22:35 2010 New Revision: 212320 URL: http://svn.freebsd.org/changeset/base/212320 Log: MFC r211283: When moving an ethernet ifnet from one vnet to another, destroy the associated ng_ether netgraph node in the current vnet, and create a new one in the target vnet. Reviewed by: julian Modified: stable/8/sys/net/if.c stable/8/sys/net/if_ethersubr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Wed Sep 8 14:21:12 2010 (r212319) +++ stable/8/sys/net/if.c Wed Sep 8 14:22:35 2010 (r212320) @@ -974,12 +974,21 @@ if_vmove(struct ifnet *ifp, struct vnet */ IFNET_WLOCK(); ifindex_free_locked(ifp->if_index); + IFNET_WUNLOCK(); + + /* + * Perform interface-specific reassignment tasks, if provided by + * the driver. + */ + if (ifp->if_reassign != NULL) + ifp->if_reassign(ifp, new_vnet, NULL); /* * Switch to the context of the target vnet. */ CURVNET_SET_QUIET(new_vnet); + IFNET_WLOCK(); if (ifindex_alloc_locked(&idx) != 0) { IFNET_WUNLOCK(); panic("if_index overflow"); Modified: stable/8/sys/net/if_ethersubr.c ============================================================================== --- stable/8/sys/net/if_ethersubr.c Wed Sep 8 14:21:12 2010 (r212319) +++ stable/8/sys/net/if_ethersubr.c Wed Sep 8 14:22:35 2010 (r212320) @@ -135,6 +135,9 @@ static const u_char etherbroadcastaddr[E static int ether_resolvemulti(struct ifnet *, struct sockaddr **, struct sockaddr *); +#ifdef VIMAGE +static void ether_reassign(struct ifnet *, struct vnet *, char *); +#endif /* XXX: should be in an arp support file, not here */ MALLOC_DEFINE(M_ARPCOM, "arpcom", "802.* interface internals"); @@ -954,6 +957,9 @@ ether_ifattach(struct ifnet *ifp, const ifp->if_output = ether_output; ifp->if_input = ether_input; ifp->if_resolvemulti = ether_resolvemulti; +#ifdef VIMAGE + ifp->if_reassign = ether_reassign; +#endif if (ifp->if_baudrate == 0) ifp->if_baudrate = IF_Mbps(10); /* just a default */ ifp->if_broadcastaddr = etherbroadcastaddr; @@ -993,6 +999,25 @@ ether_ifdetach(struct ifnet *ifp) if_detach(ifp); } +#ifdef VIMAGE +void +ether_reassign(struct ifnet *ifp, struct vnet *new_vnet, char *unused __unused) +{ + + if (IFP2AC(ifp)->ac_netgraph != NULL) { + KASSERT(ng_ether_detach_p != NULL, + ("ng_ether_detach_p is NULL")); + (*ng_ether_detach_p)(ifp); + } + + if (ng_ether_attach_p != NULL) { + CURVNET_SET_QUIET(new_vnet); + (*ng_ether_attach_p)(ifp); + CURVNET_RESTORE(); + } +} +#endif + SYSCTL_DECL(_net_link); SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet"); #if defined(INET) || defined(INET6) From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 16:34:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F390310656A8; Wed, 8 Sep 2010 16:34:08 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E17138FC1A; Wed, 8 Sep 2010 16:34: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 o88GY8wd047451; Wed, 8 Sep 2010 16:34:08 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88GY8w0047447; Wed, 8 Sep 2010 16:34:08 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009081634.o88GY8w0047447@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 8 Sep 2010 16:34: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: r212321 - in head/sys/mips/rmi: . dev/xlr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 16:34:09 -0000 Author: jchandra Date: Wed Sep 8 16:34:08 2010 New Revision: 212321 URL: http://svn.freebsd.org/changeset/base/212321 Log: Clean up fast message ring code for XLR. Fix message ring send path: - define msgrng_access_enable() which disables local interrupts and enables message ring access. Also define msgrng_restore() which restores interrupts - remove all other msgrng enable/disable macros, no need of critical_enter and other locking here. - message_send() fixup: re-read status until pending bit clears - message_send_retry() fixup: retry only few times with interrupts disabled - Fix up message_send/message_send_retry callers - call msgrng_access_enable() and msgrng_restore() correctly so that interrupts are not disabled for long. - removed unused and obsolete code from sys/mips/rmi/msgring.h - some style fixes - more later rge.c (XLR GMAC driver): - updated for the message ring changes - remove unused message_send_block() - retry on credit failure, this is not a permanent failure when credits are configured correctly. Add panic if credits are not available to send for a long time. Modified: head/sys/mips/rmi/dev/xlr/rge.c head/sys/mips/rmi/fmn.c head/sys/mips/rmi/msgring.h Modified: head/sys/mips/rmi/dev/xlr/rge.c ============================================================================== --- head/sys/mips/rmi/dev/xlr/rge.c Wed Sep 8 14:22:35 2010 (r212320) +++ head/sys/mips/rmi/dev/xlr/rge.c Wed Sep 8 16:34:08 2010 (r212321) @@ -711,21 +711,27 @@ static __inline__ int xlr_mac_send_fr(struct driver_data *priv, vm_paddr_t addr, int len) { - int stid = priv->rfrbucket; struct msgrng_msg msg; - int vcpu = xlr_cpu_id(); + int stid = priv->rfrbucket; + int i = 0, code, ret; + uint32_t msgrng_flags; mac_make_desc_rfr(&msg, addr); /* Send the packet to MAC */ dbg_msg("mac_%d: Sending free packet %lx to stid %d\n", priv->instance, (u_long)addr, stid); - if (priv->type == XLR_XGMAC) { - while (message_send(1, MSGRNG_CODE_XGMAC, stid, &msg)); - } else { - while (message_send(1, MSGRNG_CODE_MAC, stid, &msg)); - xlr_rge_repl_done[vcpu]++; - } + if (priv->type == XLR_XGMAC) + code = MSGRNG_CODE_XGMAC; /* WHY? */ + else + code = MSGRNG_CODE_MAC; + + do { + msgrng_flags = msgrng_access_enable(); + ret = message_send_retry(1, code, stid, &msg); + msgrng_restore(msgrng_flags); + KASSERT(i++ < 100000, ("Too many credit fails\n")); + } while (ret != 0); return 0; } @@ -1439,37 +1445,16 @@ rmi_xlr_mac_set_duplex(struct driver_dat #define MAC_TX_PASS 0 #define MAC_TX_RETRY 1 -static __inline__ void -message_send_block(unsigned int size, unsigned int code, - unsigned int stid, struct msgrng_msg *msg) -{ - unsigned int dest = 0; - unsigned long long status = 0; - - msgrng_load_tx_msg0(msg->msg0); - msgrng_load_tx_msg1(msg->msg1); - msgrng_load_tx_msg2(msg->msg2); - msgrng_load_tx_msg3(msg->msg3); - - dest = ((size - 1) << 16) | (code << 8) | (stid); - - do { - msgrng_send(dest); - status = msgrng_read_status(); - } while (status & 0x6); - -} - int xlr_dev_queue_xmit_hack = 0; static int mac_xmit(struct mbuf *m, struct rge_softc *sc, struct driver_data *priv, int len, struct p2d_tx_desc *tx_desc) { - struct msgrng_msg msg; + struct msgrng_msg msg = {0,0,0,0}; int stid = priv->txbucket; uint32_t tx_cycles = 0; - unsigned long mflags = 0; + uint32_t mflags; int vcpu = xlr_cpu_id(); int rv; @@ -1479,17 +1464,17 @@ mac_xmit(struct mbuf *m, struct rge_soft return MAC_TX_FAIL; else { - msgrng_access_enable(mflags); + mflags = msgrng_access_enable(); if ((rv = message_send_retry(1, MSGRNG_CODE_MAC, stid, &msg)) != 0) { msg_snd_failed++; - msgrng_access_disable(mflags); + msgrng_restore(mflags); release_tx_desc(&msg, 0); xlr_rge_msg_snd_failed[vcpu]++; dbg_msg("Failed packet to cpu %d, rv = %d, stid %d, msg0=%jx\n", vcpu, rv, stid, (uintmax_t)msg.msg0); return MAC_TX_FAIL; } - msgrng_access_disable(mflags); + msgrng_restore(mflags); port_inc_counter(priv->instance, PORT_TX); } @@ -1559,7 +1544,6 @@ mac_frin_replenish(void *args /* ignored for (i = 0; i < XLR_MAX_MACS; i++) { /* int offset = 0; */ - unsigned long msgrng_flags; void *m; uint32_t cycles; struct rge_softc *sc; @@ -1592,14 +1576,11 @@ mac_frin_replenish(void *args /* ignored } } xlr_inc_counter(REPLENISH_FRIN); - msgrng_access_enable(msgrng_flags); if (xlr_mac_send_fr(priv, vtophys(m), MAX_FRAME_SIZE)) { free_buf(vtophys(m)); printf("[%s]: rx free message_send failed!\n", __FUNCTION__); - msgrng_access_disable(msgrng_flags); break; } - msgrng_access_disable(msgrng_flags); xlr_set_counter(REPLENISH_CYCLES, (read_c0_count() - cycles)); atomic_subtract_int((&priv->frin_to_be_sent[cpu]), 1); @@ -2427,7 +2408,6 @@ static int rmi_xlr_mac_fill_rxfr(struct rge_softc *sc) { struct driver_data *priv = &(sc->priv); - unsigned long msgrng_flags; int i; int ret = 0; void *ptr; @@ -2445,9 +2425,7 @@ rmi_xlr_mac_fill_rxfr(struct rge_softc * break; } /* Send the free Rx desc to the MAC */ - msgrng_access_enable(msgrng_flags); xlr_mac_send_fr(priv, vtophys(ptr), MAX_FRAME_SIZE); - msgrng_access_disable(msgrng_flags); } return ret; Modified: head/sys/mips/rmi/fmn.c ============================================================================== --- head/sys/mips/rmi/fmn.c Wed Sep 8 14:22:35 2010 (r212320) +++ head/sys/mips/rmi/fmn.c Wed Sep 8 16:34:08 2010 (r212321) @@ -115,7 +115,7 @@ xlr_msgring_cpu_init(void) struct stn_cc *cc_config; struct bucket_size *bucket_sizes; int id; - unsigned long flags; + uint32_t flags; KASSERT(xlr_thr_id() == 0, ("xlr_msgring_cpu_init from non-zero thread\n")); @@ -125,13 +125,14 @@ xlr_msgring_cpu_init(void) bucket_sizes = xlr_board_info.bucket_sizes; cc_config = xlr_board_info.credit_configs[id]; - msgrng_flags_save(flags); /* * Message Stations are shared among all threads in a cpu core * Assume, thread 0 on all cores are always active when more than 1 * thread is active in a core */ + flags = msgrng_access_enable(); + msgrng_write_bucksize(0, bucket_sizes->bucket[id * 8 + 0]); msgrng_write_bucksize(1, bucket_sizes->bucket[id * 8 + 1]); msgrng_write_bucksize(2, bucket_sizes->bucket[id * 8 + 2]); @@ -158,7 +159,7 @@ xlr_msgring_cpu_init(void) MSGRNG_CC_INIT_CPU_DEST(14, cc_config->counters); MSGRNG_CC_INIT_CPU_DEST(15, cc_config->counters); - msgrng_flags_restore(flags); + msgrng_restore(flags); } void @@ -183,8 +184,7 @@ xlr_msgring_handler(struct trapframe *tf unsigned int bucket_empty_bm = 0; unsigned int status = 0; - /* TODO: not necessary to disable preemption */ - msgrng_flags_save(mflags); + mflags = msgrng_access_enable(); /* First Drain all the high priority messages */ for (;;) { @@ -210,39 +210,37 @@ xlr_msgring_handler(struct trapframe *tf __FUNCTION__, tx_stid, bucket, size, (uintmax_t)msg.msg0); } else { //printf("[%s]: rx_stid = %d\n", __FUNCTION__, rx_stid); - msgrng_flags_restore(mflags); + msgrng_restore(mflags); (*tx_stn_handlers[tx_stid].action) (bucket, size, code, rx_stid, &msg, tx_stn_handlers[tx_stid].dev_id); - msgrng_flags_save(mflags); + mflags = msgrng_access_enable(); } } } - msgrng_flags_restore(mflags); + msgrng_restore(mflags); } void enable_msgring_int(void *arg) { - unsigned long mflags = 0; + uint32_t config, mflags; - msgrng_access_save(&msgrng_lock, mflags); - /* enable the message ring interrupts */ - msgrng_write_config((msgring_watermark_count << 24) | (IRQ_MSGRING << 16) - | (msgring_thread_mask << 8) | msgring_int_type); - msgrng_access_restore(&msgrng_lock, mflags); + config = (msgring_watermark_count << 24) | (IRQ_MSGRING << 16) | + (msgring_thread_mask << 8) | msgring_int_type; + mflags = msgrng_access_enable(); + msgrng_write_config(config); + msgrng_restore(mflags); } void disable_msgring_int(void *arg) { - unsigned long mflags = 0; - uint32_t config; + uint32_t config, mflags; - msgrng_access_save(&msgrng_lock, mflags); - config = msgrng_read_config(); - config &= ~0x3; + mflags = msgrng_access_enable(); + config = msgrng_read_config() & ~0x3; msgrng_write_config(config); - msgrng_access_restore(&msgrng_lock, mflags); + msgrng_restore(mflags); } static int Modified: head/sys/mips/rmi/msgring.h ============================================================================== --- head/sys/mips/rmi/msgring.h Wed Sep 8 14:22:35 2010 (r212320) +++ head/sys/mips/rmi/msgring.h Wed Sep 8 16:34:08 2010 (r212321) @@ -32,54 +32,36 @@ #ifndef _RMI_MSGRING_H_ #define _RMI_MSGRING_H_ +#include +#include #include -#include - -#define MSGRNG_TX_BUF_REG 0 -#define MSGRNG_RX_BUF_REG 1 - -#define MSGRNG_MSG_STATUS_REG 2 -#define MSGRNG_MSG_CONFIG_REG 3 - -#define MSGRNG_MSG_BUCKSIZE_REG 4 - -#define MSGRNG_CC_0_REG 16 -#define MSGRNG_CC_1_REG 17 -#define MSGRNG_CC_2_REG 18 -#define MSGRNG_CC_3_REG 19 -#define MSGRNG_CC_4_REG 20 -#define MSGRNG_CC_5_REG 21 -#define MSGRNG_CC_6_REG 22 -#define MSGRNG_CC_7_REG 23 -#define MSGRNG_CC_8_REG 24 -#define MSGRNG_CC_9_REG 25 -#define MSGRNG_CC_10_REG 26 -#define MSGRNG_CC_11_REG 27 -#define MSGRNG_CC_12_REG 28 -#define MSGRNG_CC_13_REG 29 -#define MSGRNG_CC_14_REG 30 -#define MSGRNG_CC_15_REG 31 - -#define msgrng_read_status() read_c2_register32(MSGRNG_MSG_STATUS_REG, 0) - -#define msgrng_read_config() read_c2_register32(MSGRNG_MSG_CONFIG_REG, 0) -#define msgrng_write_config(value) write_c2_register32(MSGRNG_MSG_CONFIG_REG, 0, value) -#define msgrng_read_bucksize(bucket) read_c2_register32(MSGRNG_MSG_BUCKSIZE_REG, bucket) -#define msgrng_write_bucksize(bucket, value) write_c2_register32(MSGRNG_MSG_BUCKSIZE_REG, bucket, value) - -#define msgrng_read_cc(reg, pri) read_c2_register32(reg, pri) -#define msgrng_write_cc(reg, value, pri) write_c2_register32(reg, pri, value) - -#define msgrng_load_rx_msg0() read_c2_register64(MSGRNG_RX_BUF_REG, 0) -#define msgrng_load_rx_msg1() read_c2_register64(MSGRNG_RX_BUF_REG, 1) -#define msgrng_load_rx_msg2() read_c2_register64(MSGRNG_RX_BUF_REG, 2) -#define msgrng_load_rx_msg3() read_c2_register64(MSGRNG_RX_BUF_REG, 3) +#include +#include +#include -#define msgrng_load_tx_msg0(value) write_c2_register64(MSGRNG_TX_BUF_REG, 0, value) -#define msgrng_load_tx_msg1(value) write_c2_register64(MSGRNG_TX_BUF_REG, 1, value) -#define msgrng_load_tx_msg2(value) write_c2_register64(MSGRNG_TX_BUF_REG, 2, value) -#define msgrng_load_tx_msg3(value) write_c2_register64(MSGRNG_TX_BUF_REG, 3, value) +#define MSGRNG_TX_BUF_REG 0 +#define MSGRNG_RX_BUF_REG 1 +#define MSGRNG_MSG_STATUS_REG 2 +#define MSGRNG_MSG_CONFIG_REG 3 +#define MSGRNG_MSG_BUCKSIZE_REG 4 + +#define MSGRNG_CC_0_REG 16 +#define MSGRNG_CC_1_REG 17 +#define MSGRNG_CC_2_REG 18 +#define MSGRNG_CC_3_REG 19 +#define MSGRNG_CC_4_REG 20 +#define MSGRNG_CC_5_REG 21 +#define MSGRNG_CC_6_REG 22 +#define MSGRNG_CC_7_REG 23 +#define MSGRNG_CC_8_REG 24 +#define MSGRNG_CC_9_REG 25 +#define MSGRNG_CC_10_REG 26 +#define MSGRNG_CC_11_REG 27 +#define MSGRNG_CC_12_REG 28 +#define MSGRNG_CC_13_REG 29 +#define MSGRNG_CC_14_REG 30 +#define MSGRNG_CC_15_REG 31 /* Station IDs */ #define MSGRNG_STNID_CPU0 0x00 @@ -189,54 +171,26 @@ #define MSGRNG_CODE_SEC 0 #define MSGRNG_CODE_BOOT_WAKEUP 200 #define MSGRNG_CODE_SPI4 3 +#define msgrng_read_status() read_c2_register32(MSGRNG_MSG_STATUS_REG, 0) -static inline int -msgrng_xgmac_stid_rfr(int id) -{ - return !id ? MSGRNG_STNID_XMAC0RFR : MSGRNG_STNID_XMAC1RFR; -} - -static inline int -msgrng_xgmac_stid_jfr(int id) -{ - return !id ? MSGRNG_STNID_XMAC0JFR : MSGRNG_STNID_XMAC1JFR; -} - -static inline int -msgrng_xgmac_stid_tx(int id) -{ - return !id ? MSGRNG_STNID_XMAC0_00_TX : MSGRNG_STNID_XMAC1_00_TX; -} - -static inline int -msgrng_gmac_stid_rfr(int id) -{ - return (MSGRNG_STNID_GMACRFR_0); -} +#define msgrng_read_config() read_c2_register32(MSGRNG_MSG_CONFIG_REG, 0) +#define msgrng_write_config(value) write_c2_register32(MSGRNG_MSG_CONFIG_REG, 0, value) -static inline int -msgrng_gmac_stid_rfr_split_mode(int id) -{ - return ((id >> 1) ? MSGRNG_STNID_GMACRFR_1 : MSGRNG_STNID_GMACRFR_0); -} +#define msgrng_read_bucksize(bucket) read_c2_register32(MSGRNG_MSG_BUCKSIZE_REG, bucket) +#define msgrng_write_bucksize(bucket, value) write_c2_register32(MSGRNG_MSG_BUCKSIZE_REG, bucket, value) -static inline int -msgrng_gmac_stid_jfr(int id) -{ - return MSGRNG_STNID_GMACJFR_0; -} +#define msgrng_read_cc(reg, pri) read_c2_register32(reg, pri) +#define msgrng_write_cc(reg, value, pri) write_c2_register32(reg, pri, value) -static inline int -msgrng_gmac_stid_jfr_split_mode(int id) -{ - return ((id >> 1) ? MSGRNG_STNID_GMACJFR_1 : MSGRNG_STNID_GMACJFR_0); -} +#define msgrng_load_rx_msg0() read_c2_register64(MSGRNG_RX_BUF_REG, 0) +#define msgrng_load_rx_msg1() read_c2_register64(MSGRNG_RX_BUF_REG, 1) +#define msgrng_load_rx_msg2() read_c2_register64(MSGRNG_RX_BUF_REG, 2) +#define msgrng_load_rx_msg3() read_c2_register64(MSGRNG_RX_BUF_REG, 3) -static inline int -msgrng_gmac_stid_tx(int id) -{ - return (MSGRNG_STNID_GMACTX0 + id); -} +#define msgrng_load_tx_msg0(value) write_c2_register64(MSGRNG_TX_BUF_REG, 0, value) +#define msgrng_load_tx_msg1(value) write_c2_register64(MSGRNG_TX_BUF_REG, 1, value) +#define msgrng_load_tx_msg2(value) write_c2_register64(MSGRNG_TX_BUF_REG, 2, value) +#define msgrng_load_tx_msg3(value) write_c2_register64(MSGRNG_TX_BUF_REG, 3, value) static inline void msgrng_send(unsigned int stid) @@ -280,30 +234,21 @@ msgrng_wait(unsigned int mask) ); } -#define msgrng_enable(flags) \ -do { \ - __asm__ volatile ( \ - ".set push\n\t" \ - ".set reorder\n\t" \ - ".set noat\n\t" \ - "mfc0 %0, $12\n\t" \ - "li $8, 0x40000001\n\t" \ - "or $1, %0, $8\n\t" \ - "xori $1, 1\n\t" \ - ".set noreorder\n\t" \ - "mtc0 $1, $12\n\t" \ - ".set\tpop\n\t" \ - : "=r" (flags) \ - : \ - : "$8" \ - ); \ -} while (0) +static __inline uint32_t +msgrng_access_enable(void) +{ + uint32_t sr = mips_rd_status(); -#define msgrng_disable(flags) __asm__ volatile ( \ - "mtc0 %0, $12" : : "r" (flags)) + mips_wr_status((sr & ~MIPS_SR_INT_IE) | MIPS_SR_COP_2_BIT); + return (sr); +} -#define msgrng_flags_save(flags) msgrng_enable(flags) -#define msgrng_flags_restore(flags) msgrng_disable(flags) +static __inline void +msgrng_restore(uint32_t sr) +{ + + mips_wr_status(sr); +} struct msgrng_msg { __uint64_t msg0; @@ -355,7 +300,7 @@ message_send_block_fast(int size, unsign _tmp; \ } ) -static __inline__ int +static __inline int message_send(unsigned int size, unsigned int code, unsigned int stid, struct msgrng_msg *msg) { @@ -369,42 +314,35 @@ message_send(unsigned int size, unsigned msgrng_load_tx_msg3(msg->msg3); dest = ((size - 1) << 16) | (code << 8) | (stid); - msgrng_send(dest); - for (i = 0; i < 16; i++) { + /* Wait for the thread pending to clear */ + do { status = msgrng_read_status(); + KASSERT(i++ < 10000, ("Too many fails\n")); + } while ((status & 0x2) != 0); - if (status & 0x6) { - continue; - } else - break; - } - return msgrng_read_status() & 0x06; + /* If there is a credit failure, return error */ + return status & 0x06; } -static __inline__ int +static __inline int message_send_retry(unsigned int size, unsigned int code, unsigned int stid, struct msgrng_msg *msg) { - int res = 0; - int retry = 0; + int i, ret; - for (;;) { - res = message_send(size, code, stid, msg); - /* retry a pending fail */ - if (res & 0x02) - continue; - /* credit fail */ - if (res & 0x04) - retry++; - else - break; - if (retry == 4) - return res & 0x06; + /* + * we are in with interrupt disabled, retrying too many + * times is not good + */ + for (i = 0; i < 16; i++) { + ret = message_send(size, code, stid, msg); + if (ret == 0) + return (0); } - return 0; + return (1); } static __inline__ int @@ -457,27 +395,6 @@ extern struct stn_cc xls_cc_table_pcie; extern struct stn_cc xls_cc_table_dma; extern struct stn_cc xls_cc_table_sec; - -#define msgrng_access_save(lock, mflags) do { \ - mtx_lock_spin(lock); \ - msgrng_flags_save(mflags); \ - }while(0) - -#define msgrng_access_restore(lock, mflags) do { \ - msgrng_flags_restore(mflags); \ - mtx_unlock_spin(lock); \ - }while(0) - -#define msgrng_access_enable(mflags) do { \ - critical_enter(); \ - msgrng_flags_save(mflags); \ -} while(0) - -#define msgrng_access_disable(mflags) do { \ - msgrng_flags_restore(mflags); \ - critical_exit(); \ -} while(0) - /* * NOTE: this is not stationid/8, ie the station numbers below are just * for internal use @@ -504,14 +421,10 @@ enum { MAX_TX_STNS }; -extern int -register_msgring_handler(int major, +extern int register_msgring_handler(int major, void (*action) (int, int, int, int, struct msgrng_msg *, void *), void *dev_id); - extern void xlr_msgring_cpu_init(void); - - extern void xlr_msgring_config(void); - -#define cpu_to_msgring_bucket(cpu) ((((cpu) >> 2)<<3)|((cpu) & 0x03)) +extern void xlr_msgring_cpu_init(void); +extern void xlr_msgring_config(void); #endif From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 16:58:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7435210656C8; Wed, 8 Sep 2010 16:58:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 636878FC20; Wed, 8 Sep 2010 16:58: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 o88Gw6pT050445; Wed, 8 Sep 2010 16:58:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88Gw6H1050442; Wed, 8 Sep 2010 16:58:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009081658.o88Gw6H1050442@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 8 Sep 2010 16:58: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: r212322 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 16:58:06 -0000 Author: nwhitehorn Date: Wed Sep 8 16:58:06 2010 New Revision: 212322 URL: http://svn.freebsd.org/changeset/base/212322 Log: Fix a typo in the original import of this code from NetBSD that caused the wrong element of the VSID bitmap array to be examined after a collision, leading to reallocation of in-use VSIDs under some circumstances, with attendant memory corruption. Also add an assert to check for this kind of problem in the future. MFC after: 4 days Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Wed Sep 8 16:34:08 2010 (r212321) +++ head/sys/powerpc/aim/mmu_oea.c Wed Sep 8 16:58:06 2010 (r212322) @@ -1618,7 +1618,7 @@ moea_pinit(mmu_t mmu, pmap_t pmap) entropy = (moea_vsidcontext >> 20); continue; } - i = ffs(~moea_vsid_bitmap[i]) - 1; + i = ffs(~moea_vsid_bitmap[n]) - 1; mask = 1 << i; hash &= 0xfffff & ~(VSID_NBPW - 1); hash |= i; Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Wed Sep 8 16:34:08 2010 (r212321) +++ head/sys/powerpc/aim/mmu_oea64.c Wed Sep 8 16:58:06 2010 (r212322) @@ -2080,11 +2080,13 @@ moea64_get_unique_vsid(void) { entropy = (moea64_vsidcontext >> 20); continue; } - i = ffs(~moea64_vsid_bitmap[i]) - 1; + i = ffs(~moea64_vsid_bitmap[n]) - 1; mask = 1 << i; hash &= VSID_HASHMASK & ~(VSID_NBPW - 1); hash |= i; } + KASSERT(!(moea64_vsid_bitmap[n] & mask), + ("Allocating in-use VSID %#x\n", hash)); moea64_vsid_bitmap[n] |= mask; mtx_unlock(&moea64_slb_mutex); return (hash); From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 16:59:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A1FE10656AB; Wed, 8 Sep 2010 16:59:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F1CB8FC16; Wed, 8 Sep 2010 16:59: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 o88GxNvO050601; Wed, 8 Sep 2010 16:59:23 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88GxNOn050599; Wed, 8 Sep 2010 16:59:23 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009081659.o88GxNOn050599@svn.freebsd.org> From: Alexander Motin Date: Wed, 8 Sep 2010 16:59: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: r212323 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 16:59:23 -0000 Author: mav Date: Wed Sep 8 16:59:22 2010 New Revision: 212323 URL: http://svn.freebsd.org/changeset/base/212323 Log: During SMP startup there is time window, when SMP started, but interrupts are still bound to BSP. It confuses timer management logic in per-CPU mode and may cause timer not being reloaded. Check such cases on interrupt arival and reload timer to give system some more time to manage proper binding. Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Wed Sep 8 16:58:06 2010 (r212322) +++ head/sys/dev/acpica/acpi_hpet.c Wed Sep 8 16:59:22 2010 (r212323) @@ -89,6 +89,8 @@ struct hpet_softc { int mode; int intr_rid; int irq; + int pcpu_cpu; + int pcpu_misrouted; int pcpu_master; int pcpu_slaves[MAXCPU]; struct resource *intr_res; @@ -185,7 +187,7 @@ restart: if (fdiv < 5000) { bus_read_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num)); t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); - if ((int32_t)(t->last - cmp) < 0) { + if ((int32_t)(t->last - cmp) >= 0) { fdiv *= 2; goto restart; } @@ -215,6 +217,26 @@ hpet_intr_single(void *arg) struct hpet_softc *sc = t->sc; uint32_t now; + /* Check that per-CPU timer interrupt reached right CPU. */ + if (t->pcpu_cpu >= 0 && t->pcpu_cpu != curcpu) { + if ((++t->pcpu_misrouted) % 32 == 0) { + printf("HPET interrupt routed to the wrong CPU" + " (timer %d CPU %d -> %d)!\n", + t->num, t->pcpu_cpu, curcpu); + } + + /* + * Reload timer, hoping that next time may be more lucky + * (system will manage proper interrupt binding). + */ + if ((t->mode == 1 && (t->caps & HPET_TCAP_PER_INT) == 0) || + t->mode == 2) { + t->last = bus_read_4(sc->mem_res, HPET_MAIN_COUNTER); + bus_write_4(sc->mem_res, HPET_TIMER_COMPARATOR(t->num), + t->last + sc->freq / 8); + } + return (FILTER_HANDLED); + } if (t->mode == 1 && (t->caps & HPET_TCAP_PER_INT) == 0) { t->last += t->div; @@ -394,6 +416,8 @@ hpet_attach(device_t dev) t->mode = 0; t->intr_rid = -1; t->irq = -1; + t->pcpu_cpu = -1; + t->pcpu_misrouted = 0; t->pcpu_master = -1; t->caps = bus_read_4(sc->mem_res, HPET_TIMER_CAP_CNF(i)); t->vectors = bus_read_4(sc->mem_res, HPET_TIMER_CAP_CNF(i) + 4); @@ -534,6 +558,7 @@ hpet_attach(device_t dev) if (t->irq >= 0 && num_percpu_t > 0) { if (cur_cpu == CPU_FIRST()) pcpu_master = i; + t->pcpu_cpu = cur_cpu; t->pcpu_master = pcpu_master; sc->t[pcpu_master]. pcpu_slaves[cur_cpu] = i; From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 17:11:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7542210656E0; Wed, 8 Sep 2010 17:11:49 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A5468FC14; Wed, 8 Sep 2010 17:11: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 o88HBnla051655; Wed, 8 Sep 2010 17:11:49 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88HBn8B051653; Wed, 8 Sep 2010 17:11:49 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009081711.o88HBn8B051653@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 8 Sep 2010 17:11: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: r212324 - head/sys/mips/rmi/dev/nlge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 17:11:49 -0000 Author: jchandra Date: Wed Sep 8 17:11:49 2010 New Revision: 212324 URL: http://svn.freebsd.org/changeset/base/212324 Log: nlge (alternate XLR GMAC driver) updates: - Updates for the message ring clean up in r212321. - Instead of dropping Tx packet on credit fail, retry send until it succeeds. - Fix freeing mbufs in case of P2P descriptors: We cannot free the mbuf when the P2P descriptor freeback is received. The mbuf may be still in use by the GMAC, since the P2P freeback indicates that it read the P2D descriptors in the P2P message. Now we free just the P2P descriptor when the P2P freeback message is received. Another freeback P2D message has been added to the end of the packet descriptors, the mbuf will be freed only when we received this. The P2P descriptor issue was reported by srgorti at netlogicmicro dot com. Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Wed Sep 8 16:59:22 2010 (r212323) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Wed Sep 8 17:11:49 2010 (r212324) @@ -207,7 +207,7 @@ static int prepare_fmn_message(struct nl uint64_t fr_stid, struct nlge_tx_desc **tx_desc); static void release_mbuf(uint64_t phy_addr); -static void release_tx_desc(struct msgrng_msg *msg); +static void release_tx_desc(vm_paddr_t phy_addr); static int send_fmn_msg_tx(struct nlge_softc *, struct msgrng_msg *, uint32_t n_entries); @@ -637,7 +637,7 @@ nlge_msgring_handler(int bucket, int siz struct nlna_softc *na_sc; struct nlge_softc *sc; struct ifnet *ifp; - uint64_t phys_addr; + vm_paddr_t phys_addr; unsigned long addr; uint32_t length; int ctrl; @@ -655,14 +655,15 @@ nlge_msgring_handler(int bucket, int siz tx_error = 0; length = (msg->msg0 >> 40) & 0x3fff; na_sc = (struct nlna_softc *)data; - phys_addr = (uint64_t) (msg->msg0 & 0xffffffffe0ULL); if (length == 0) { ctrl = CTRL_REG_FREE; + phys_addr = msg->msg0 & 0xffffffffffULL; port = (msg->msg0 >> 54) & 0x0f; is_p2p = (msg->msg0 >> 62) & 0x1; tx_error = (msg->msg0 >> 58) & 0xf; } else { ctrl = CTRL_SNGL; + phys_addr = msg->msg0 & 0xffffffffe0ULL; length = length - BYTE_OFFSET - MAC_CRC_LEN; port = msg->msg0 & 0x0f; } @@ -676,11 +677,12 @@ nlge_msgring_handler(int bucket, int siz } if (ctrl == CTRL_REG_FREE || ctrl == CTRL_JUMBO_FREE) { - if (is_p2p) - release_tx_desc(msg); - else { - release_mbuf(msg->msg0 & 0xffffffffffULL); + if (is_p2p) { + release_tx_desc(phys_addr); + } else { + release_mbuf(phys_addr); } + ifp = sc->nlge_if; if (ifp->if_drv_flags & IFF_DRV_OACTIVE){ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -742,7 +744,7 @@ nlge_start_locked(struct ifnet *ifp, str goto fail; } sent = send_fmn_msg_tx(sc, &msg, n_entries); - if (!sent) { + if (sent != 0) { goto fail; } } while(1); @@ -1011,28 +1013,27 @@ static __inline__ int nlna_send_free_desc(struct nlna_softc *sc, vm_paddr_t addr) { struct msgrng_msg msg; - int stid; - int code; - int i; + uint32_t msgrng_flags; + int i = 0, stid, code, ret; stid = sc->rfrbucket; memset(&msg, 0, sizeof(msg)); msg.msg0 = (uint64_t) addr & 0xffffffffe0ULL; code = (sc->na_type == XLR_XGMAC) ? MSGRNG_CODE_XGMAC : MSGRNG_CODE_MAC; - for (i = 0; i < MAX_MSG_SND_ATTEMPTS; i++) { - if (message_send(1, code, stid, &msg) == 0) - return (0); - } - printf("Error: failed to send free desc to station %d\n", stid); - return (1); + do { + msgrng_flags = msgrng_access_enable(); + ret = message_send_retry(1, code, stid, &msg); + msgrng_restore(msgrng_flags); + KASSERT(i++ < 100000, ("Too many credit fails\n")); + } while (ret != 0); + return (0); } static void nlna_submit_rx_free_desc(struct nlna_softc *sc, uint32_t n_desc) { void *ptr; - unsigned long msgrng_flags; int i; int ret; @@ -1050,10 +1051,8 @@ nlna_submit_rx_free_desc(struct nlna_sof } /* Send the free Rx desc to the MAC */ - msgrng_access_enable(msgrng_flags); ret = nlna_send_free_desc(sc, vtophys(ptr)); - msgrng_access_disable(msgrng_flags); - if (ret) /* no point trying other descriptors after + if (ret != 0) /* no point trying other descriptors after a failure. */ break; } @@ -1907,9 +1906,10 @@ prepare_fmn_message(struct nlge_softc *s while (len) { if (msg_sz == (FMN_SZ - 1)) { - p2p = uma_zalloc(nl_tx_desc_zone, M_WAITOK); - if (p2p == NULL) + p2p = uma_zalloc(nl_tx_desc_zone, M_NOWAIT); + if (p2p == NULL) { return 2; + } /* * As we currently use xlr_paddr_lw on a 32-bit * OS, both the pointers are laid out in one @@ -1922,7 +1922,7 @@ prepare_fmn_message(struct nlge_softc *s ((vm_offset_t) mbuf_chain); cur_p2d = &p2p->frag[0]; is_p2p = 1; - } else if (msg_sz == (FMN_SZ - 1 + XLR_MAX_TX_FRAGS)) { + } else if (msg_sz == (FMN_SZ - 2 + XLR_MAX_TX_FRAGS)) { uma_zfree(nl_tx_desc_zone, p2p); return 1; } @@ -1940,26 +1940,24 @@ prepare_fmn_message(struct nlge_softc *s } } - if (msg_sz > 0) { - cur_p2d[-1] |= (1ULL << 63); /* set eop in most-recent p2d */ - } else { + if (msg_sz == 0) { printf("Zero-length mbuf chain ??\n"); *n_entries = msg_sz ; return 0; } + cur_p2d[-1] |= (1ULL << 63); /* set eop in most-recent p2d */ + *cur_p2d = (1ULL << 63) | ((uint64_t)fb_stn_id << 54) | + (vm_offset_t) mbuf_chain; *tx_desc = p2p; if (is_p2p) { paddr = vtophys(p2p); - fmn_msg->msg3 = (1ULL << 63) | (1ULL << 62) | - ((uint64_t)fb_stn_id << 54) | + p2p_sz++; + fmn_msg->msg3 = (1ULL << 62) | ((uint64_t)fb_stn_id << 54) | ((uint64_t)(p2p_sz * 8) << 40) | paddr; *n_entries = FMN_SZ; } else { - /* zero-len p2d */ - *cur_p2d = (1ULL << 63) | ((uint64_t)fb_stn_id << 54) | - (vm_offset_t) mbuf_chain; *n_entries = msg_sz + 1; } @@ -1970,15 +1968,17 @@ static int send_fmn_msg_tx(struct nlge_softc *sc, struct msgrng_msg *msg, uint32_t n_entries) { - unsigned long mflags; - int ret; + uint32_t msgrng_flags; + int i = 0, ret; - mflags = 0; - msgrng_access_enable(mflags); - ret = message_send_retry(n_entries, MSGRNG_CODE_MAC, sc->tx_bucket_id, - msg); - msgrng_access_disable(mflags); - return (!ret); + do { + msgrng_flags = msgrng_access_enable(); + ret = message_send_retry(n_entries, MSGRNG_CODE_MAC, + sc->tx_bucket_id, msg); + msgrng_restore(msgrng_flags); + KASSERT(i++ < 100000, ("Too many credit fails\n")); + } while (ret != 0); + return (0); } static void @@ -1991,25 +1991,20 @@ release_mbuf(uint64_t phy_addr) } static void -release_tx_desc(struct msgrng_msg *msg) +release_tx_desc(vm_paddr_t paddr) { - vm_paddr_t paddr; - uint64_t temp; struct nlge_tx_desc *tx_desc; - struct mbuf *m; uint32_t sr; + uint32_t val1, val2; - paddr = msg->msg0 & 0xffffffffffULL; paddr += (XLR_MAX_TX_FRAGS * sizeof(uint64_t)); sr = xlr_enable_kx(); - temp = xlr_paddr_lw(paddr); - tx_desc = (struct nlge_tx_desc*)((intptr_t) temp); + val1 = xlr_paddr_lw(paddr); paddr += sizeof(void *); - temp = xlr_paddr_lw(paddr); + val2 = xlr_paddr_lw(paddr); mips_wr_status(sr); - m = (struct mbuf *)((intptr_t) temp); - m_freem(m); + tx_desc = (struct nlge_tx_desc*)(intptr_t) val1; uma_zfree(nl_tx_desc_zone, tx_desc); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 17:35:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A70710656CB; Wed, 8 Sep 2010 17:35:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A13E8FC0A; Wed, 8 Sep 2010 17:35: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 o88HZ6aC054187; Wed, 8 Sep 2010 17:35:06 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88HZ6O5054185; Wed, 8 Sep 2010 17:35:06 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009081735.o88HZ6O5054185@svn.freebsd.org> From: Andriy Gapon Date: Wed, 8 Sep 2010 17:35: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: r212325 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 17:35:07 -0000 Author: avg Date: Wed Sep 8 17:35:06 2010 New Revision: 212325 URL: http://svn.freebsd.org/changeset/base/212325 Log: subr_bus: use hexadecimal representation for bit flags It seems that this format is more custom in our code, and it is more convenient too. Suggested by: jhb No objection: imp MFC after: 1 week Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Wed Sep 8 17:11:49 2010 (r212324) +++ head/sys/kern/subr_bus.c Wed Sep 8 17:35:06 2010 (r212325) @@ -122,14 +122,14 @@ struct device { device_state_t state; /**< current device state */ uint32_t devflags; /**< api level flags for device_get_flags() */ u_int flags; /**< internal device flags */ -#define DF_ENABLED 1 /* device should be probed/attached */ -#define DF_FIXEDCLASS 2 /* devclass specified at create time */ -#define DF_WILDCARD 4 /* unit was originally wildcard */ -#define DF_DESCMALLOCED 8 /* description was malloced */ -#define DF_QUIET 16 /* don't print verbose attach message */ -#define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ -#define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ -#define DF_REBID 128 /* Can rebid after attach */ +#define DF_ENABLED 0x01 /* device should be probed/attached */ +#define DF_FIXEDCLASS 0x02 /* devclass specified at create time */ +#define DF_WILDCARD 0x04 /* unit was originally wildcard */ +#define DF_DESCMALLOCED 0x08 /* description was malloced */ +#define DF_QUIET 0x10 /* don't print verbose attach message */ +#define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ +#define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ +#define DF_REBID 0x80 /* Can rebid after attach */ u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 17:53:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3611F10656B2; Wed, 8 Sep 2010 17:53:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 247B18FC08; Wed, 8 Sep 2010 17:53:35 +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 o88HrZJQ056120; Wed, 8 Sep 2010 17:53:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88HrZpB056117; Wed, 8 Sep 2010 17:53:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009081753.o88HrZpB056117@svn.freebsd.org> From: John Baldwin Date: Wed, 8 Sep 2010 17:53: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: r212326 - in head: sys/dev/pci usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 17:53:35 -0000 Author: jhb Date: Wed Sep 8 17:53:34 2010 New Revision: 212326 URL: http://svn.freebsd.org/changeset/base/212326 Log: - Add register definitions related to extended capability IDs in PCI-express. I used PCIZ_* for ID constants (plain capability IDs use PCIY_*). - Add register definitions for the Advanced Error Reporting, Virtual Channels, and Device Serial Number extended capabilities. - Teach pciconf -c to list extended as well as plain capabilities. Adds more detailed parsing for AER, VC, and device serial numbers. MFC after: 2 weeks Modified: head/sys/dev/pci/pcireg.h head/usr.sbin/pciconf/cap.c Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Wed Sep 8 17:35:06 2010 (r212325) +++ head/sys/dev/pci/pcireg.h Wed Sep 8 17:53:34 2010 (r212326) @@ -36,6 +36,7 @@ * PCIV_xxx: PCI vendor ID (only required to fixup ancient devices) * PCID_xxx: device ID * PCIY_xxx: capability identification number + * PCIZ_xxx: extended capability identification number */ /* some PCI bus constants */ @@ -117,6 +118,28 @@ #define PCIY_SATA 0x12 /* SATA */ #define PCIY_PCIAF 0x13 /* PCI Advanced Features */ +/* Extended Capability Register Fields */ + +#define PCIR_EXTCAP 0x100 +#define PCIM_EXTCAP_ID 0x0000ffff +#define PCIM_EXTCAP_VER 0x000f0000 +#define PCIM_EXTCAP_NEXTPTR 0xfff00000 +#define PCI_EXTCAP_ID(ecap) ((ecap) & PCIM_EXTCAP_ID) +#define PCI_EXTCAP_VER(ecap) (((ecap) & PCIM_EXTCAP_VER) >> 16) +#define PCI_EXTCAP_NEXTPTR(ecap) (((ecap) & PCIM_EXTCAP_NEXTPTR) >> 20) + +/* Extended Capability Identification Numbers */ + +#define PCIZ_AER 0x0001 /* Advanced Error Reporting */ +#define PCIZ_VC 0x0002 /* Virtual Channel */ +#define PCIZ_SERNUM 0x0003 /* Device Serial Number */ +#define PCIZ_PWRBDGT 0x0004 /* Power Budgeting */ +#define PCIZ_VENDOR 0x000b /* Vendor Unique */ +#define PCIZ_ACS 0x000d /* Access Control Services */ +#define PCIZ_ARI 0x000e /* Alternative Routing-ID Interpretation */ +#define PCIZ_ATS 0x000f /* Address Translation Services */ +#define PCIZ_SRIOV 0x0010 /* Single Root IO Virtualization */ + /* config registers for header type 0 devices */ #define PCIR_BARS 0x10 @@ -663,3 +686,64 @@ #define PCIR_PCIAFCTRL_FLR 0x01 #define PCIR_PCIAF_STATUS 0x5 #define PCIR_PCIAFSTATUS_TP 0x01 + +/* Advanced Error Reporting */ +#define PCIR_AER_UC_STATUS 0x04 +#define PCIR_AER_UC_TRAINING_ERROR 0x00000001 +#define PCIR_AER_UC_DL_PROTOCOL_ERROR 0x00000010 +#define PCIR_AER_UC_POISONED_TLP 0x00001000 +#define PCIR_AER_UC_FC_PROTOCOL_ERROR 0x00002000 +#define PCIR_AER_UC_COMPLETION_TIMEOUT 0x00004000 +#define PCIR_AER_UC_COMPLETER_ABORT 0x00008000 +#define PCIR_AER_UC_UNEXPECTED_COMPLETION 0x00010000 +#define PCIR_AER_UC_RECEIVER_OVERFLOW 0x00020000 +#define PCIR_AER_UC_MALFORMED_TLP 0x00040000 +#define PCIR_AER_UC_ECRC_ERROR 0x00080000 +#define PCIR_AER_UC_UNSUPPORTED_REQUEST 0x00100000 +#define PCIR_AER_UC_ACS_VIOLATION 0x00200000 +#define PCIR_AER_UC_MASK 0x08 /* Shares bits with UC_STATUS */ +#define PCIR_AER_UC_SEVERITY 0x0c /* Shares bits with UC_STATUS */ +#define PCIR_AER_COR_STATUS 0x10 +#define PCIM_AER_COR_RECEIVER_ERROR 0x00000001 +#define PCIM_AER_COR_BAD_TLP 0x00000040 +#define PCIM_AER_COR_BAD_DLLP 0x00000080 +#define PCIM_AER_COR_REPLAY_ROLLOVER 0x00000100 +#define PCIM_AER_COR_REPLAY_TIMEOUT 0x00001000 +#define PCIR_AER_COR_MASK 0x14 /* Shares bits with COR_STATUS */ +#define PCIR_AER_CAP_CONTROL 0x18 +#define PCIM_AER_FIRST_ERROR_PTR 0x0000001f +#define PCIM_AER_ECRC_GEN_CAPABLE 0x00000020 +#define PCIM_AER_ECRC_GEN_ENABLE 0x00000040 +#define PCIM_AER_ECRC_CHECK_CAPABLE 0x00000080 +#define PCIM_AER_ECRC_CHECK_ENABLE 0x00000100 +#define PCIR_AER_HEADER_LOG 0x1c +#define PCIR_AER_ROOTERR_CMD 0x2c /* Only for root complex ports */ +#define PCIR_AER_ROOTERR_COR_ENABLE 0x00000001 +#define PCIR_AER_ROOTERR_NF_ENABLE 0x00000002 +#define PCIR_AER_ROOTERR_F_ENABLE 0x00000004 +#define PCIR_AER_ROOTERR_STATUS 0x30 /* Only for root complex ports */ +#define PCIR_AER_ROOTERR_COR_ERR 0x00000001 +#define PCIR_AER_ROOTERR_MULTI_COR_ERR 0x00000002 +#define PCIR_AER_ROOTERR_UC_ERR 0x00000004 +#define PCIR_AER_ROOTERR_MULTI_UC_ERR 0x00000008 +#define PCIR_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 +#define PCIR_AER_ROOTERR_NF_ERR 0x00000020 +#define PCIR_AER_ROOTERR_F_ERR 0x00000040 +#define PCIR_AER_ROOTERR_INT_MESSAGE 0xf8000000 +#define PCIR_AER_COR_SOURCE_ID 0x34 /* Only for root complex ports */ +#define PCIR_AER_ERR_SOURCE_ID 0x36 /* Only for root complex ports */ + +/* Virtual Channel definitions */ +#define PCIR_VC_CAP1 0x04 +#define PCIM_VC_CAP1_EXT_COUNT 0x00000007 +#define PCIM_VC_CAP1_LOWPRI_EXT_COUNT 0x00000070 +#define PCIR_VC_CAP2 0x08 +#define PCIR_VC_CONTROL 0x0C +#define PCIR_VC_STATUS 0x0E +#define PCIR_VC_RESOURCE_CAP(n) (0x10 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_CTL(n) (0x14 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_STA(n) (0x18 + (n) * 0x0C) + +/* Serial Number definitions */ +#define PCIR_SERIAL_LOW 0x04 +#define PCIR_SERIAL_HIGH 0x08 Modified: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Wed Sep 8 17:35:06 2010 (r212325) +++ head/usr.sbin/pciconf/cap.c Wed Sep 8 17:53:34 2010 (r212326) @@ -45,6 +45,8 @@ static const char rcsid[] = #include "pciconf.h" +static void list_ecaps(int fd, struct pci_conf *p); + static void cap_power(int fd, struct pci_conf *p, uint8_t ptr) { @@ -530,4 +532,97 @@ list_caps(int fd, struct pci_conf *p) printf("\n"); ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1); } + + list_ecaps(fd, p); +} + +/* From . */ +static __inline uint32_t +bitcount32(uint32_t x) +{ + + x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1); + x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2); + x = (x + (x >> 4)) & 0x0f0f0f0f; + x = (x + (x >> 8)); + x = (x + (x >> 16)) & 0x000000ff; + return (x); +} + +static void +ecap_aer(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t sta, mask; + + printf("AER %d", ver); + if (ver != 1) + return; + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_STATUS, 4); + mask = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_SEVERITY, 4); + printf(" %d fatal", bitcount32(sta & mask)); + printf(" %d non-fatal", bitcount32(sta & ~mask)); + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_COR_STATUS, 4); + printf(" %d corrected", bitcount32(sta)); +} + +static void +ecap_vc(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t cap1; + + printf("VC %d", ver); + if (ver != 1) + return; + cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4); + printf(" max VC%d", cap1 & PCIM_VC_CAP1_EXT_COUNT); + if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0) + printf(" lowpri VC0-VC%d", + (cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) >> 4); +} + +static void +ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t high, low; + + printf("Serial %d", ver); + if (ver != 1) + return; + low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4); + high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4); + printf(" %08x%08x", high, low); +} + +static void +list_ecaps(int fd, struct pci_conf *p) +{ + uint32_t ecap; + uint16_t ptr; + + ptr = PCIR_EXTCAP; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + if (ecap == 0xffffffff || ecap == 0) + return; + for (;;) { + printf("ecap %04x[%03x] = ", PCI_EXTCAP_ID(ecap), ptr); + switch (PCI_EXTCAP_ID(ecap)) { + case PCIZ_AER: + ecap_aer(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_VC: + ecap_vc(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_SERNUM: + ecap_sernum(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + default: + printf("unknown %d", PCI_EXTCAP_VER(ecap)); + break; + } + printf("\n"); + ptr = PCI_EXTCAP_NEXTPTR(ecap); + if (ptr == 0) + break; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + } } From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 17:54:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74CB01065672; Wed, 8 Sep 2010 17:54:45 +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 42FE18FC17; Wed, 8 Sep 2010 17:54:45 +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 B7CF246BA7; Wed, 8 Sep 2010 13:54:44 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A918D8A04E; Wed, 8 Sep 2010 13:54:43 -0400 (EDT) From: John Baldwin To: Andriy Gapon Date: Wed, 8 Sep 2010 13:54:37 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009081735.o88HZ6O5054185@svn.freebsd.org> In-Reply-To: <201009081735.o88HZ6O5054185@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009081354.37471.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 08 Sep 2010 13:54:43 -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: r212325 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 17:54:45 -0000 On Wednesday, September 08, 2010 1:35:06 pm Andriy Gapon wrote: > Author: avg > Date: Wed Sep 8 17:35:06 2010 > New Revision: 212325 > URL: http://svn.freebsd.org/changeset/base/212325 > > Log: > subr_bus: use hexadecimal representation for bit flags > > It seems that this format is more custom in our code, and it is more > convenient too. > > Suggested by: jhb > No objection: imp Other way around actually, this was imp's suggestion. :) -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 18:02:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FD9010656BE; Wed, 8 Sep 2010 18:02:28 +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 0EA668FC12; Wed, 8 Sep 2010 18:02:28 +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 A76C246B82; Wed, 8 Sep 2010 14:02:27 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C13E08A04E; Wed, 8 Sep 2010 14:02:26 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Wed, 8 Sep 2010 14:02:26 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009081753.o88HrZpB056117@svn.freebsd.org> In-Reply-To: <201009081753.o88HrZpB056117@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009081402.26292.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 08 Sep 2010 14:02:26 -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 Subject: Re: svn commit: r212326 - in head: sys/dev/pci usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 18:02:28 -0000 On Wednesday, September 08, 2010 1:53:34 pm John Baldwin wrote: > Author: jhb > Date: Wed Sep 8 17:53:34 2010 > New Revision: 212326 > URL: http://svn.freebsd.org/changeset/base/212326 > > Log: > - Add register definitions related to extended capability IDs in > PCI-express. I used PCIZ_* for ID constants (plain capability IDs use > PCIY_*). > - Add register definitions for the Advanced Error Reporting, Virtual > Channels, and Device Serial Number extended capabilities. > - Teach pciconf -c to list extended as well as plain capabilities. Adds > more detailed parsing for AER, VC, and device serial numbers. > > MFC after: 2 weeks Some sample output: igb2@pci0:6:0:0: class=0x020000 card=0xa02b8086 chip=0x10e88086 rev=0x01 hdr=0x00 cap 01[40] = powerspec 3 supports D0 D3 current D0 cap 05[50] = MSI supports 1 message, 64 bit, vector masks cap 11[70] = MSI-X supports 10 messages in map 0x1c enabled cap 10[a0] = PCI-Express 2 endpoint max data 128(512) link x4(x4) ecap 0001[100] = AER 1 0 fatal 0 non-fatal 1 corrected ecap 0003[140] = Serial 1 001b21ffff6bcbce ecap 000e[150] = unknown 1 ecap 0010[160] = unknown 1 -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 18:03:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1E9010656C5; Wed, 8 Sep 2010 18:03:40 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90ABB8FC20; Wed, 8 Sep 2010 18:03: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 o88I3eTW057395; Wed, 8 Sep 2010 18:03:40 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88I3eJI057392; Wed, 8 Sep 2010 18:03:40 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009081803.o88I3eJI057392@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 8 Sep 2010 18:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212327 - in stable/7/contrib/nvi: docs ex X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 18:03:40 -0000 Author: jh Date: Wed Sep 8 18:03:40 2010 New Revision: 212327 URL: http://svn.freebsd.org/changeset/base/212327 Log: MFC r208611: Fix misspelling of "substitution". PR: bin/130874 Modified: stable/7/contrib/nvi/docs/help stable/7/contrib/nvi/ex/ex_cmd.c Directory Properties: stable/7/contrib/nvi/ (props changed) Modified: stable/7/contrib/nvi/docs/help ============================================================================== --- stable/7/contrib/nvi/docs/help Wed Sep 8 17:53:34 2010 (r212326) +++ stable/7/contrib/nvi/docs/help Wed Sep 8 18:03:40 2010 (r212327) @@ -129,7 +129,7 @@ EX COMMANDS: ^D: scroll lines !: filter lines through commands or run commands #: display numbered lines - &: repeat the last subsitution + &: repeat the last substitution *: execute a buffer <: shift lines left =: display line number Modified: stable/7/contrib/nvi/ex/ex_cmd.c ============================================================================== --- stable/7/contrib/nvi/ex/ex_cmd.c Wed Sep 8 17:53:34 2010 (r212326) +++ stable/7/contrib/nvi/ex/ex_cmd.c Wed Sep 8 18:03:40 2010 (r212327) @@ -68,7 +68,7 @@ EXCMDLIST const cmds[] = { {"&", ex_subagain, E_ADDR2, "s", "[line [,line]] & [cgr] [count] [#lp]", - "repeat the last subsitution"}, + "repeat the last substitution"}, /* C_STAR */ {"*", ex_at, 0, "b", From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 18:06:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A07910656DC; Wed, 8 Sep 2010 18:06:06 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 186488FC1E; Wed, 8 Sep 2010 18: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 o88I65u8057711; Wed, 8 Sep 2010 18:06:05 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88I65v5057708; Wed, 8 Sep 2010 18:06:05 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009081806.o88I65v5057708@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 8 Sep 2010 18:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212328 - stable/7/contrib/nvi/vi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 18:06:06 -0000 Author: jh Date: Wed Sep 8 18:06:05 2010 New Revision: 212328 URL: http://svn.freebsd.org/changeset/base/212328 Log: MFC r208612: Fixes from NetBSD for nvi visual mode PR: bin/21089, bin/136393 Modified: stable/7/contrib/nvi/vi/v_ex.c stable/7/contrib/nvi/vi/v_txt.c Directory Properties: stable/7/contrib/nvi/ (props changed) Modified: stable/7/contrib/nvi/vi/v_ex.c ============================================================================== --- stable/7/contrib/nvi/vi/v_ex.c Wed Sep 8 18:03:40 2010 (r212327) +++ stable/7/contrib/nvi/vi/v_ex.c Wed Sep 8 18:06:05 2010 (r212328) @@ -428,6 +428,10 @@ v_ex(sp, vp) if (tp->term == TERM_BS) break; + /* If the user changed their mind, return. */ + if (tp->term != TERM_OK) + break; + /* Log the command. */ if (O_STR(sp, O_CEDIT) != NULL && v_ecl_log(sp, tp)) return (1); Modified: stable/7/contrib/nvi/vi/v_txt.c ============================================================================== --- stable/7/contrib/nvi/vi/v_txt.c Wed Sep 8 18:03:40 2010 (r212327) +++ stable/7/contrib/nvi/vi/v_txt.c Wed Sep 8 18:06:05 2010 (r212328) @@ -510,15 +510,6 @@ next: if (v_event_get(sp, evp, 0, ec_fla case E_EOF: F_SET(sp, SC_EXIT_FORCE); return (1); - case E_INTERRUPT: - /* - * !!! - * Historically, exited the user from text input - * mode or cancelled a colon command, and returned to command - * mode. It also beeped the terminal, but that seems a bit - * excessive. - */ - goto k_escape; case E_REPAINT: if (vs_repaint(sp, &ev)) return (1); @@ -526,10 +517,37 @@ next: if (v_event_get(sp, evp, 0, ec_fla case E_WRESIZE: /* interrupts the input mode. */ v_emsg(sp, NULL, VIM_WRESIZE); - goto k_escape; + /* FALLTHROUGH */ default: - v_event_err(sp, evp); - goto k_escape; + if (evp->e_event != E_INTERRUPT && evp->e_event != E_WRESIZE) + v_event_err(sp, evp); + /* + * !!! + * Historically, exited the user from text input + * mode or cancelled a colon command, and returned to command + * mode. It also beeped the terminal, but that seems a bit + * excessive. + */ + /* + * If we are recording, morph into key so that + * we can repeat the command safely: there is no way to + * invalidate the repetition of an instance of a command, + * which would be the alternative possibility. + * If we are not recording (most likely on the command line), + * simply discard the input and return to command mode + * so that an INTERRUPT doesn't become for example a file + * completion request. -aymeric + */ + if (LF_ISSET(TXT_RECORD)) { + evp->e_event = E_CHARACTER; + evp->e_c = 033; + evp->e_flags = 0; + evp->e_value = K_ESCAPE; + break; + } else { + tp->term = TERM_ESC; + goto k_escape; + } } /* @@ -539,7 +557,7 @@ next: if (v_event_get(sp, evp, 0, ec_fla * This was not documented as far as I know, and is a great test of vi * clones. */ - if (rcol == 0 && !LF_ISSET(TXT_REPLAY) && evp->e_c == '\0') { + if (LF_ISSET(TXT_RECORD) && rcol == 0 && evp->e_c == '\0') { if (vip->rep == NULL) goto done; @@ -1456,6 +1474,7 @@ done: /* Leave input mode. */ err: alloc_err: + F_CLR(sp, SC_TINPUT); txt_err(sp, &sp->tiq); return (1); } @@ -2216,8 +2235,8 @@ txt_fc_col(sp, argc, argv) /* If the largest file name is too large, just print them. */ if (colwidth > sp->cols) { - p = msg_print(sp, av[0]->bp + prefix, &nf); for (ac = argc, av = argv; ac > 0; --ac, ++av) { + p = msg_print(sp, av[0]->bp + prefix, &nf); (void)ex_printf(sp, "%s\n", p); if (F_ISSET(gp, G_INTERRUPTED)) break; From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 18:18:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54BFD1065697; Wed, 8 Sep 2010 18:18:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 094348FC1E; Wed, 8 Sep 2010 18:18: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 o88II17i058974; Wed, 8 Sep 2010 18:18:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88II1af058972; Wed, 8 Sep 2010 18:18:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009081818.o88II1af058972@svn.freebsd.org> From: John Baldwin Date: Wed, 8 Sep 2010 18:18: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: r212329 - head/usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 18:18:02 -0000 Author: jhb Date: Wed Sep 8 18:18:01 2010 New Revision: 212329 URL: http://svn.freebsd.org/changeset/base/212329 Log: Simplify chkattached(). The PCIOCATTACHED ioctl only needs the pi_sel field populated, it ignores the rest of the 'pci_sel' structure. MFC after: 1 week Modified: head/usr.sbin/pciconf/pciconf.c Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Wed Sep 8 18:06:05 2010 (r212328) +++ head/usr.sbin/pciconf/pciconf.c Wed Sep 8 18:18:01 2010 (r212329) @@ -75,7 +75,7 @@ static const char *guess_subclass(struct static int load_vendors(void); static void readit(const char *, const char *, int); static void writeit(const char *, const char *, const char *, int); -static void chkattached(const char *, int); +static void chkattached(const char *); static int exitstatus = 0; @@ -148,8 +148,7 @@ main(int argc, char **argv) if (listmode) { list_devs(verbose, bars, caps); } else if (attachedmode) { - chkattached(argv[optind], - byte ? 1 : isshort ? 2 : 4); + chkattached(argv[optind]); } else if (readmode) { readit(argv[optind], argv[optind + 1], byte ? 1 : isshort ? 2 : 4); @@ -646,15 +645,12 @@ writeit(const char *name, const char *re } static void -chkattached(const char *name, int width) +chkattached(const char *name) { int fd; struct pci_io pi; pi.pi_sel = getsel(name); - pi.pi_reg = 0; - pi.pi_width = width; - pi.pi_data = 0; fd = open(_PATH_DEVPCI, O_RDWR, 0); if (fd < 0) From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 18:32:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6357810656CF; Wed, 8 Sep 2010 18:32:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52C0D8FC2A; Wed, 8 Sep 2010 18:32: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 o88IWNYU060116; Wed, 8 Sep 2010 18:32:23 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88IWNQR060114; Wed, 8 Sep 2010 18:32:23 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009081832.o88IWNQR060114@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 8 Sep 2010 18:32: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: r212330 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 18:32:23 -0000 Author: jilles Date: Wed Sep 8 18:32:23 2010 New Revision: 212330 URL: http://svn.freebsd.org/changeset/base/212330 Log: sh: Add simple tests for backslashes in the read builtin. Added: head/tools/regression/bin/sh/builtins/read3.0 (contents, props changed) head/tools/regression/bin/sh/builtins/read3.0.stdout (contents, props changed) Added: head/tools/regression/bin/sh/builtins/read3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/read3.0 Wed Sep 8 18:32:23 2010 (r212330) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +printf '%s\n' 'a\ b c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' 'a b\ c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' 'a\:b:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' 'a:b\:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\ a' | { read -r a b; printf '%s\n' "x${a}x${b}x"; } Added: head/tools/regression/bin/sh/builtins/read3.0.stdout ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/read3.0.stdout Wed Sep 8 18:32:23 2010 (r212330) @@ -0,0 +1,9 @@ +xa bxcx +xaxb cx +xa:bxcx +xaxb:cx +x axx +x:axx +x\xx +x\ axx +x\\\xax From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 19:28:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0372A10656A4; Wed, 8 Sep 2010 19:28:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6DA18FC08; Wed, 8 Sep 2010 19:28: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 o88JShnK065349; Wed, 8 Sep 2010 19:28:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88JShtM065347; Wed, 8 Sep 2010 19:28:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009081928.o88JShtM065347@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 8 Sep 2010 19:28: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: r212331 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 19:28:44 -0000 Author: nwhitehorn Date: Wed Sep 8 19:28:43 2010 New Revision: 212331 URL: http://svn.freebsd.org/changeset/base/212331 Log: Fix a printf specifier on 64-bit systems. Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Wed Sep 8 18:32:23 2010 (r212330) +++ head/sys/powerpc/aim/mmu_oea64.c Wed Sep 8 19:28:43 2010 (r212331) @@ -2086,7 +2086,7 @@ moea64_get_unique_vsid(void) { hash |= i; } KASSERT(!(moea64_vsid_bitmap[n] & mask), - ("Allocating in-use VSID %#x\n", hash)); + ("Allocating in-use VSID %#zx\n", hash)); moea64_vsid_bitmap[n] |= mask; mtx_unlock(&moea64_slb_mutex); return (hash); From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 19:50:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D252210656CD; Wed, 8 Sep 2010 19:50:47 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0AE98FC14; Wed, 8 Sep 2010 19:50: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 o88JolRE067266; Wed, 8 Sep 2010 19:50:47 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88JolQW067264; Wed, 8 Sep 2010 19:50:47 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201009081950.o88JolQW067264@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 8 Sep 2010 19:50: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: r212332 - in head/sys: arm/conf boot/fdt/dts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 19:50:47 -0000 Author: emax Date: Wed Sep 8 19:50:47 2010 New Revision: 212332 URL: http://svn.freebsd.org/changeset/base/212332 Log: Add custom kernel configuration and device tree source files for Seagate FreeAgent DockStar(tm) device. It seems to be a dumb down version of Marvell SheevaPlug. Device tree source file could use more tweaking, but at least it wll network boot and run FreeBSD/arm. Added: head/sys/arm/conf/DOCKSTAR (contents, props changed) head/sys/boot/fdt/dts/dockstar.dts (contents, props changed) Added: head/sys/arm/conf/DOCKSTAR ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/DOCKSTAR Wed Sep 8 19:50:47 2010 (r212332) @@ -0,0 +1,76 @@ +# +# Custom kernel for Seagate DockStar (Marvell SheevaPlug based) devices. +# +# $FreeBSD$ +# + +ident DOCKSTAR +include "../mv/kirkwood/std.sheevaplug" + +options SOC_MV_KIRKWOOD +makeoptions MODULES_OVERRIDE="" + +#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_COMPAT +options BOOTP_WIRED_TO=mge0 + +# Root fs on USB device +#options ROOTDEVNAME=\"ufs:/dev/da0a\" + +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options MUTEX_NOINLINE +options RWLOCK_NOINLINE +options NO_FFS_SNAPSHOT +options NO_SWAPPING + +# Debugging +options ALT_BREAK_TO_DEBUGGER +options DDB +options KDB + +# Pseudo devices +device md +device random +device pty +device loop + +# Serial ports +device uart + +# Networking +device ether +device mge # Marvell Gigabit Ethernet controller +device mii +device bpf +options HZ=1000 +options DEVICE_POLLING +device vlan + +# USB +options USB_DEBUG # enable debug msgs +device usb +device ehci +device umass +device scbus +device pass +device da + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=dockstar.dts Added: head/sys/boot/fdt/dts/dockstar.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/dockstar.dts Wed Sep 8 19:50:47 2010 (r212332) @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * 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. + * + * Seagate DockStar (Marvell SheevaPlug based) Device Tree Source. + * + * $FreeBSD$ + */ + +/dts-v1/; + +/ { + model = "seagate,DockStar"; + compatible = "DockStar"; + #address-cells = <1>; + #size-cells = <1>; + + aliases { + ethernet0 = &enet0; + mpp = &MPP; + serial0 = &serial0; + serial1 = &serial1; + soc = &SOC; + sram = &SRAM; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "ARM,88FR131"; + reg = <0x0>; + d-cache-line-size = <32>; // 32 bytes + i-cache-line-size = <32>; // 32 bytes + d-cache-size = <0x4000>; // L1, 16K + i-cache-size = <0x4000>; // L1, 16K + timebase-frequency = <0>; + bus-frequency = <0>; + clock-frequency = <0>; + }; + }; + + memory { + device_type = "memory"; + reg = <0x0 0x8000000>; // 128M at 0x0 + }; + + localbus@f1000000 { + #address-cells = <2>; + #size-cells = <1>; + compatible = "mrvl,lbc"; + + /* This reflects CPU decode windows setup. */ + ranges = <0x0 0x0f 0xf9300000 0x00100000 + 0x1 0x1e 0xfa000000 0x00100000 + 0x2 0x1d 0xfa100000 0x02000000 + 0x3 0x1b 0xfc100000 0x00000400>; + + nor@0,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x0 0x0 0x00100000>; + bank-width = <2>; + device-width = <1>; + }; + + led@1,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "led"; + reg = <0x1 0x0 0x00100000>; + }; + + nor@2,0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x2 0x0 0x02000000>; + bank-width = <2>; + device-width = <1>; + }; + + nand@3,0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0x3 0x0 0x00100000>; + bank-width = <2>; + device-width = <1>; + }; + }; + + SOC: soc88f6281@f1000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges = <0x0 0xf1000000 0x00100000>; + bus-frequency = <0>; + + PIC: pic@20200 { + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x20200 0x3c>; + compatible = "mrvl,pic"; + }; + + timer@20300 { + compatible = "mrvl,timer"; + reg = <0x20300 0x30>; + interrupts = <1>; + interrupt-parent = <&PIC>; + mrvl,has-wdt; + }; + + MPP: mpp@10000 { + #pin-cells = <2>; + compatible = "mrvl,mpp"; + reg = <0x10000 0x34>; + pin-count = <50>; + pin-map = < + 0 1 /* MPP[0]: NF_IO[2] */ + 1 1 /* MPP[1]: NF_IO[3] */ + 2 1 /* MPP[2]: NF_IO[4] */ + 3 1 /* MPP[3]: NF_IO[5] */ + 4 1 /* MPP[4]: NF_IO[6] */ + 5 1 /* MPP[5]: NF_IO[7] */ + 6 1 /* MPP[6]: SYSRST_OUTn */ + 8 2 /* MPP[8]: UA0_RTS */ + 9 2 /* MPP[9]: UA0_CTS */ + 10 3 /* MPP[10]: UA0_TXD */ + 11 3 /* MPP[11]: UA0_RXD */ + 12 1 /* MPP[12]: SD_CLK */ + 13 1 /* MPP[13]: SD_CMD */ + 14 1 /* MPP[14]: SD_D[0] */ + 15 1 /* MPP[15]: SD_D[1] */ + 16 1 /* MPP[16]: SD_D[2] */ + 17 1 /* MPP[17]: SD_D[3] */ + 18 1 /* MPP[18]: NF_IO[0] */ + 19 1 /* MPP[19]: NF_IO[1] */ + 29 1 >; /* MPP[29]: TSMP[9] */ + }; + + GPIO: gpio@10100 { + #gpio-cells = <3>; + compatible = "mrvl,gpio"; + reg = <0x10100 0x20>; + gpio-controller; + interrupts = <35 36 37 38 39 40 41>; + interrupt-parent = <&PIC>; + }; + + rtc@10300 { + compatible = "mrvl,rtc"; + reg = <0x10300 0x08>; + }; + + twsi@11000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mrvl,twsi"; + reg = <0x11000 0x20>; + interrupts = <43>; + interrupt-parent = <&PIC>; + }; + + enet0: ethernet@72000 { + #address-cells = <1>; + #size-cells = <1>; + model = "V2"; + compatible = "mrvl,ge"; + reg = <0x72000 0x2000>; + ranges = <0x0 0x72000 0x2000>; + local-mac-address = [ 00 00 00 00 00 00 ]; + interrupts = <12 13 14 11 46>; + interrupt-parent = <&PIC>; + phy-handle = <&phy0>; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mrvl,mdio"; + + phy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; + }; + + serial0: serial@12000 { + compatible = "ns16550"; + reg = <0x12000 0x20>; + reg-shift = <2>; + clock-frequency = <0>; + interrupts = <33>; + interrupt-parent = <&PIC>; + }; + + serial1: serial@12100 { + compatible = "ns16550"; + reg = <0x12100 0x20>; + reg-shift = <2>; + clock-frequency = <0>; + interrupts = <34>; + interrupt-parent = <&PIC>; + }; + + crypto@30000 { + compatible = "mrvl,cesa"; + reg = <0x30000 0x10000>; + interrupts = <22>; + interrupt-parent = <&PIC>; + }; + + usb@50000 { + compatible = "mrvl,usb-ehci", "usb-ehci"; + reg = <0x50000 0x1000>; + interrupts = <48 19>; + interrupt-parent = <&PIC>; + }; + + xor@60000 { + compatible = "mrvl,xor"; + reg = <0x60000 0x1000>; + interrupts = <5 6 7 8>; + interrupt-parent = <&PIC>; + }; + }; + + SRAM: sram@fd000000 { + compatible = "mrvl,cesa-sram"; + reg = <0xfd000000 0x00100000>; + }; + + chosen { + stdin = "serial0"; + stdout = "serial0"; + }; +}; From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 19:53:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7AF210656D9; Wed, 8 Sep 2010 19:53:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C75A48FC18; Wed, 8 Sep 2010 19:53: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 o88JrGlt067474; Wed, 8 Sep 2010 19:53:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88JrGUn067472; Wed, 8 Sep 2010 19:53:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009081953.o88JrGUn067472@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 8 Sep 2010 19:53: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: r212333 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 19:53:16 -0000 Author: nwhitehorn Date: Wed Sep 8 19:53:16 2010 New Revision: 212333 URL: http://svn.freebsd.org/changeset/base/212333 Log: Check TARGET_ARCH as well as TARGET to determine if we are doing a cross build. This is necessary to be able to cross-build 32-bit PowerPC from a 64-bit PowerPC host. Reviewed by: imp Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Sep 8 19:50:47 2010 (r212332) +++ head/Makefile.inc1 Wed Sep 8 19:53:16 2010 (r212333) @@ -161,7 +161,7 @@ BUILD_ARCH!= uname -p .error To cross-build, set TARGET_ARCH. .endif .endif -.if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) +.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) OBJTREE= ${MAKEOBJDIRPREFIX} .else OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 20:00:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A7271065785; Wed, 8 Sep 2010 20:00:28 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29F428FC23; Wed, 8 Sep 2010 20:00: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 o88K0S5d068259; Wed, 8 Sep 2010 20:00:28 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88K0SXu068257; Wed, 8 Sep 2010 20:00:28 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201009082000.o88K0SXu068257@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 8 Sep 2010 20:00: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: r212335 - head/usr.sbin/bluetooth/bthidd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:00:28 -0000 Author: emax Date: Wed Sep 8 20:00:27 2010 New Revision: 212335 URL: http://svn.freebsd.org/changeset/base/212335 Log: Make sure to only pickup hid_input items when parsing input reports. As it turns out, libusbhid(3) also picks up hic_collection items even though we explicitly requested hid_input items only. Tested by: Buganini < buganini at gmail dot com > MFC after: 1 week Modified: head/usr.sbin/bluetooth/bthidd/hid.c Modified: head/usr.sbin/bluetooth/bthidd/hid.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/hid.c Wed Sep 8 20:00:15 2010 (r212334) +++ head/usr.sbin/bluetooth/bthidd/hid.c Wed Sep 8 20:00:27 2010 (r212335) @@ -160,7 +160,8 @@ hid_interrupt(bthid_session_p s, uint8_t for (d = hid_start_parse(hid_device->desc, 1 << hid_input, -1); hid_get_item(d, &h) > 0; ) { - if ((h.flags & HIO_CONST) || (h.report_ID != report_id)) + if ((h.flags & HIO_CONST) || (h.report_ID != report_id) || + (h.kind != hid_input)) continue; page = HID_PAGE(h.usage); From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 20:04:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03FB5106566C; Wed, 8 Sep 2010 20:04:26 +0000 (UTC) (envelope-from weongyo.jeong@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 2DFDE8FC15; Wed, 8 Sep 2010 20:04:24 +0000 (UTC) Received: by fxm4 with SMTP id 4so483295fxm.13 for ; Wed, 08 Sep 2010 13:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:organization:x-operation-sytem; bh=egqiU1RI3fvhJ/ZbtgE6OcOAqSk6QiHOeWKO43mBAjk=; b=X2EPj6gOe+V1/xpoEUfu2OfhfEGZMkx08JIvVmOl89WvK9gYD/bmJvrvwfdk9f6MW0 86ak1hYgsQkSVZSrgs9rBz3uuopgMsv+fkMJ0QzUCci7eRj/VgDAw+p6uyDSMzM5HYB6 SauoxRIr6OpXgM3w7/QVZGDJHjakQmrlBWZrU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:organization:x-operation-sytem; b=jc+pJCiCTRGflgDSEt6l+N6cYoGw/dDZIR//104aqzsnZ6IPX3nxBYrVYoNfjaujqf 3KSZx67sw8/IoJPVigVVY8EINWZG8GGV5vbU79eczwZ1WR+NX453R/kO0OOL2r0ks8mP 8Ky+vnoyyMZdpd8ZQkHwehld6/c6bFAbQdWfY= Received: by 10.223.103.203 with SMTP id l11mr198225fao.82.1283974826877; Wed, 08 Sep 2010 12:40:26 -0700 (PDT) Received: from weongyo ([174.35.1.224]) by mx.google.com with ESMTPS id a7sm278754faa.45.2010.09.08.12.40.24 (version=SSLv3 cipher=RC4-MD5); Wed, 08 Sep 2010 12:40:25 -0700 (PDT) Received: by weongyo (sSMTP sendmail emulation); Wed, 8 Sep 2010 12:40:27 -0700 From: Weongyo Jeong Date: Wed, 8 Sep 2010 12:40:27 -0700 To: "M. Warner Losh" Message-ID: <20100908194027.GE1328@weongyo> Mail-Followup-To: "M. Warner Losh" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201009062202.o86M29b4067327@svn.freebsd.org> <20100908.074954.895640246715730176.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100908.074954.895640246715730176.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i Organization: CDNetworks. X-Operation-Sytem: FreeBSD Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212270 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Weongyo Jeong List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:04:26 -0000 On Wed, Sep 08, 2010 at 07:49:54AM -0600, M. Warner Losh wrote: > In message: <201009062202.o86M29b4067327@svn.freebsd.org> > Weongyo Jeong writes: > : Author: weongyo > : Date: Mon Sep 6 22:02:08 2010 > : New Revision: 212270 > : URL: http://svn.freebsd.org/changeset/base/212270 > : > : Log: > : Adds bwi(4) at SEE ALSO section because some old devices aren't > : supported by the bwn(4) firmware that as fas as I know the vendor > : dropped its support. Bumps date also. > > Should we list them, at least by description? These are the > 802.11b-only cards from what I've read in the Linux lists. They don't > have enough RAM... OK. I'll update the man update after sorting unsupported device lists. regards, Weongyo Jeong From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 20:09:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F07D10656E3; Wed, 8 Sep 2010 20:09:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0ED968FC12; Wed, 8 Sep 2010 20:09: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 o88K9o8M069831; Wed, 8 Sep 2010 20:09:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88K9obu069829; Wed, 8 Sep 2010 20:09:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009082009.o88K9obu069829@svn.freebsd.org> From: Alexander Motin Date: Wed, 8 Sep 2010 20:09: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: r212336 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:09:51 -0000 Author: mav Date: Wed Sep 8 20:09:50 2010 New Revision: 212336 URL: http://svn.freebsd.org/changeset/base/212336 Log: Add few more bintime math macros. Modified: head/sys/sys/time.h Modified: head/sys/sys/time.h ============================================================================== --- head/sys/sys/time.h Wed Sep 8 20:00:27 2010 (r212335) +++ head/sys/sys/time.h Wed Sep 8 20:09:50 2010 (r212336) @@ -90,6 +90,25 @@ bintime_sub(struct bintime *bt, const st bt->sec -= bt2->sec; } +static __inline void +bintime_mul(struct bintime *bt, u_int x) +{ + uint64_t p1, p2; + + p1 = (bt->frac & 0xffffffffllu) * x; + p2 = (bt->frac >> 32) * x + (p1 >> 32); + bt->sec *= x; + bt->sec += (p2 >> 32); + bt->frac = (p2 << 32) | (p1 & 0xffffffffllu); +} + +#define bintime_clear(a) ((a)->sec = (a)->frac = 0) +#define bintime_isset(a) ((a)->sec || (a)->frac) +#define bintime_cmp(a, b, cmp) \ + (((a)->sec == (b)->sec) ? \ + ((a)->frac cmp (b)->frac) : \ + ((a)->sec cmp (b)->sec)) + /*- * Background information: * From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 20:10:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B101810656E7; Wed, 8 Sep 2010 20:10:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9ED8C8FC19; Wed, 8 Sep 2010 20:10: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 o88KAOVY069964; Wed, 8 Sep 2010 20:10:24 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88KAO7E069950; Wed, 8 Sep 2010 20:10:24 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009082010.o88KAO7E069950@svn.freebsd.org> From: Warner Losh Date: Wed, 8 Sep 2010 20:10: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: r212337 - in head/usr.sbin/pc-sysinstall: backend backend-query doc examples pc-sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:10:24 -0000 Author: imp Date: Wed Sep 8 20:10:24 2010 New Revision: 212337 URL: http://svn.freebsd.org/changeset/base/212337 Log: pc-sysinstall(8) patch that allows images to be written to disks This patch creates the "image" directive for the pc-sysinstall config file. This allows disks to be configured with an image instead of partitioning. PR: 150137 Submitted by: John Hixson Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh head/usr.sbin/pc-sysinstall/backend/Makefile head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh head/usr.sbin/pc-sysinstall/backend/functions-disk.sh head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh head/usr.sbin/pc-sysinstall/backend/functions-packages.sh head/usr.sbin/pc-sysinstall/backend/functions-parse.sh head/usr.sbin/pc-sysinstall/backend/functions.sh head/usr.sbin/pc-sysinstall/backend/parseconfig.sh head/usr.sbin/pc-sysinstall/doc/help-index head/usr.sbin/pc-sysinstall/examples/README head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -27,6 +27,7 @@ ARGS=$1 FLAGS_MD="" +FLAGS_CD="" FLAGS_VERBOSE="" shift @@ -39,6 +40,9 @@ do -v) FLAGS_VERBOSE=1 ;; + -c) + FLAGS_CD=1 + ;; esac shift done @@ -62,9 +66,12 @@ do DEV="${i}" # Make sure we don't find any cd devices - case "${DEV}" in - acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; - esac + if [ -z "${FLAGS_CD}" ] + then + case "${DEV}" in + acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; + esac + fi # Check the dmesg output for some more info about this device NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1) Modified: head/usr.sbin/pc-sysinstall/backend/Makefile ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/Makefile Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/Makefile Wed Sep 8 20:10:24 2010 (r212337) @@ -7,7 +7,7 @@ FILES= functions-bsdlabel.sh functions-c functions-newfs.sh functions-packages.sh functions-parse.sh \ functions-runcommands.sh functions-unmount.sh \ functions-upgrade.sh functions-users.sh \ - functions.sh parseconfig.sh startautoinstall.sh + functions.sh parseconfig.sh startautoinstall.sh installimage.sh FILESMODE= ${BINMODE} FILESDIR=${SHAREDIR}/pc-sysinstall/backend NO_OBJ= Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -566,9 +566,8 @@ populate_disk_label() setup_disk_label() { # We are ready to start setting up the label, lets read the config and do the actions - # First confirm that we have a valid WORKINGSLICES - if [ -z "${WORKINGSLICES}" ]; then + if [ -z "${WORKINGSLICES}" -a -z "${WORKINGIMAGES}" ]; then exit_err "ERROR: No slices were setup! Please report this to the maintainers" fi @@ -613,6 +612,12 @@ setup_disk_label() populate_disk_label "${i}" done + for i in $WORKINGIMAGES + do + image=`echo "${i}"|cut -f2 -d:` + check_image_layout "${image}" + done + # Check if we made a root partition if [ "$FOUNDROOT" = "-1" ] then @@ -631,3 +636,166 @@ setup_disk_label() fi }; +check_fstab_mbr() +{ + local SLICE + local FSTAB + + if [ -z "$2" ] + then + return 1 + fi + + SLICE="$1" + FSTAB="$2/etc/fstab" + + if [ -f "${FSTAB}" ] + then + PARTLETTER=`echo "$SLICE" | sed -E 's|^.+([a-h])$|\1|'` + + grep -E '^.+ +/ +' "${FSTAB}" >/dev/null 2>&1 + if [ "$?" = "0" ] + then + if [ "${PARTLETTER}" = "a" ] + then + FOUNDROOT="0" + else + FOUNDROOT="1" + fi + export FOUNDROOT + fi + + grep -E '^.+ +/boot +' "${FSTAB}" >/dev/null 2>&1 + if [ "$?" = "0" ] + then + if [ "${PARTLETTER}" = "a" ] + then + USINGBOOTPART="0" + else + exit_err "/boot partition must be first partition" + fi + export USINGBOOTPART + fi + + return 0 + fi + + return 1 +}; + +check_fstab_gpt() +{ + local SLICE + local FSTAB + + if [ -z "$2" ] + then + return 1 + fi + + SLICE="$1" + FSTAB="$2/etc/fstab" + + if [ -f "${FSTAB}" ] + then + PARTNUMBER=`echo "${SLICE}" | sed -E 's|^.+p([0-9]*)$|\1|'` + + grep -E '^.+ +/ +' "${FSTAB}" >/dev/null 2>&1 + if [ "$?" = "0" ] + then + if [ "${PARTNUMBER}" = "2" ] + then + FOUNDROOT="0" + else + FOUNDROOT="1" + fi + export FOUNDROOT + fi + + grep -E '^.+ +/boot +' "${FSTAB}" >/dev/null 2>&1 + if [ "$?" = "0" ] + then + if [ "${PARTNUMBER}" = "2" ] + then + USINGBOOTPART="0" + else + exit_err "/boot partition must be first partition" + fi + export USINGBOOTPART + fi + + return 0 + fi + + + return 1 +}; + +check_image_layout() +{ + local SLICES + local IMAGE + local TYPE + local RES + local MD + local F + + IMAGE="$1" + TYPE="MBR" + + if [ -z "${IMAGE}" ] + then + return 1 + fi + + MD=`mdconfig -af "${IMAGE}"` + if [ "$?" != "0" ] + then + return 1 + fi + + SLICES=`ls /dev/${MD}s[1-4]*[a-h]* 2>/dev/null` + if [ "$?" != "0" ] + then + SLICES=`ls /dev/${MD}p[0-9]* 2>/dev/null` + if [ -n "${SLICES}" ] + then + TYPE="GPT" + RES=0 + fi + else + RES=0 + fi + + for slice in ${SLICES} + do + F=1 + mount ${slice} /mnt 2>/dev/null + if [ "$?" != "0" ] + then + continue + fi + + if [ "${TYPE}" = "MBR" ] + then + check_fstab_mbr "${slice}" "/mnt" + F="$?" + + elif [ "${TYPE}" = "GPT" ] + then + check_fstab_gpt "${slice}" "/mnt" + F="$?" + fi + + if [ "${F}" = "0" ] + then + umount /mnt + break + fi + + umount /mnt + done + + mdconfig -d -u "${MD}" + return ${RES} +}; Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -231,9 +231,6 @@ get_disk_heads() get_disk_mediasize() { mediasize=`diskinfo -v ${1} | grep "# mediasize in sectors" | tr -s ' ' | cut -f 2` - - # Not sure why this is, memory disks need it though. - mediasize=`expr ${mediasize} - 10` VAL="${mediasize}" ; export VAL }; @@ -336,164 +333,205 @@ setup_disk_slice() # We are ready to start setting up the disks, lets read the config and do the actions while read line do - echo $line | grep "^disk${disknum}=" >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - DISK="$VAL" + echo $line | grep "^disk${disknum}=" >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + + # Found a disk= entry, lets get the disk we are working on + get_value_from_string "${line}" + strip_white_space "$VAL" + DISK="$VAL" - # Before we go further, lets confirm this disk really exists - if [ ! -e "/dev/${DISK}" ] - then - exit_err "ERROR: The disk ${DISK} does not exist!" - fi - - # Make sure we stop any gmirrors on this disk - stop_all_gmirror ${DISK} - - # Make sure we stop any geli stuff on this disk - stop_all_geli ${DISK} - - # Make sure we don't have any zpools loaded - stop_all_zfs - - fi - - # Lets look if this device will be mirrored on another disk - echo $line | grep "^mirror=" >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - MIRRORDISK="$VAL" + # Before we go further, lets confirm this disk really exists + if [ ! -e "/dev/${DISK}" ] + then + exit_err "ERROR: The disk ${DISK} does not exist!" + fi + + # Make sure we stop any gmirrors on this disk + stop_all_gmirror ${DISK} + + # Make sure we stop any geli stuff on this disk + stop_all_geli ${DISK} + + # Make sure we don't have any zpools loaded + stop_all_zfs + + fi + + # Lets look if this device will be mirrored on another disk + echo $line | grep "^mirror=" >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + + # Found a disk= entry, lets get the disk we are working on + get_value_from_string "${line}" + strip_white_space "$VAL" + MIRRORDISK="$VAL" - # Before we go further, lets confirm this disk really exists - if [ ! -e "/dev/${MIRRORDISK}" ] - then - exit_err "ERROR: The mirror disk ${MIRRORDISK} does not exist!" - fi - fi - - # Lets see if we have been given a mirror balance choice - echo $line | grep "^mirrorbal=" >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - - # Found a disk= entry, lets get the disk we are working on - get_value_from_string "${line}" - strip_white_space "$VAL" - MIRRORBAL="$VAL" - fi - - echo $line | grep "^partition=" >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - # Found a partition= entry, lets read / set it - get_value_from_string "${line}" - strip_white_space "$VAL" - PTYPE="$VAL" - - # We are using free space, figure out the slice number - if [ "${PTYPE}" = "free" -o "${PTYPE}" = "FREE" ] - then - # Lets figure out what number this slice will be - LASTSLICE="`gpart show ${DISK} | grep -v ${DISK} | grep -v ' free' |tr -s '\t' ' ' | cut -d ' ' -f 4 | sed '/^$/d' | tail -n 1`" - if [ -z "${LASTSLICE}" ] - then - LASTSLICE="1" - else - LASTSLICE="`expr $LASTSLICE + 1`" - fi - - if [ $LASTSLICE -gt 4 ] - then - exit_err "ERROR: BSD only supports primary partitions, and there are none availble on $DISK" - fi - - fi - fi - - # Check if we have a partscheme specified - echo $line | grep "^partscheme=" >/dev/null 2>/dev/null - if [ "$?" = "0" ] ; then - # Found a partscheme= entry, lets read / set it - get_value_from_string "${line}" - strip_white_space "$VAL" - PSCHEME="$VAL" - if [ "$PSCHEME" != "GPT" -a "$PSCHEME" != "MBR" ] ; then - exit_err "Unknown partition scheme: $PSCHEME" - fi - fi - - echo $line | grep "^bootManager=" >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - # Found a bootManager= entry, lets read /set it - get_value_from_string "${line}" - strip_white_space "$VAL" - BMANAGER="$VAL" - fi - - echo $line | grep "^commitDiskPart" >/dev/null 2>/dev/null - if [ "$?" = "0" ] - then - # Found our flag to commit this disk setup / lets do sanity check and do it - if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ] - then - case ${PTYPE} in - all|ALL) - if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then - PSCHEME="MBR" - tmpSLICE="${DISK}s1" - else - tmpSLICE="${DISK}p1" - fi - - run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}" - ;; - - s1|s2|s3|s4) - tmpSLICE="${DISK}${PTYPE}" - # Get the number of the slice we are working on - s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" - run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" - ;; - - free|FREE) - tmpSLICE="${DISK}s${LASTSLICE}" - run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" - ;; - - *) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;; - esac - - # Now save which disk this is, so we can parse it later during slice partition setup - echo "disk${disknum}" >${SLICECFGDIR}/$tmpSLICE - - # Save any mirror config - if [ ! -z "$MIRRORDISK" ] - then - # Default to round-robin if the user didn't specify - if [ -z "$MIRRORBAL" ] - then - MIRRORBAL="round-robin" - fi - echo "$MIRRORDISK:$MIRRORBAL" >${MIRRORCFGDIR}/$DISK - fi - - - # Increment our disk counter to look for next disk and unset - unset BMANAGER PTYPE DISK MIRRORDISK MIRRORBAL PSCHEME - disknum="`expr $disknum + 1`" - else - exit_err "ERROR: commitDiskPart was called without procceding disk= and partition= entries!!!" - fi - fi + # Before we go further, lets confirm this disk really exists + if [ ! -e "/dev/${MIRRORDISK}" ] + then + exit_err "ERROR: The mirror disk ${MIRRORDISK} does not exist!" + fi + fi + + # Lets see if we have been given a mirror balance choice + echo $line | grep "^mirrorbal=" >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + + # Found a disk= entry, lets get the disk we are working on + get_value_from_string "${line}" + strip_white_space "$VAL" + MIRRORBAL="$VAL" + fi + + echo $line | grep "^partition=" >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + # Found a partition= entry, lets read / set it + get_value_from_string "${line}" + strip_white_space "$VAL" + PTYPE=`echo $VAL|tr A-Z a-z` + + # We are using free space, figure out the slice number + if [ "${PTYPE}" = "free" ] + then + # Lets figure out what number this slice will be + LASTSLICE="`gpart show ${DISK} \ + | grep -v ${DISK} \ + | grep -v ' free' \ + | tr -s '\t' ' ' \ + | cut -d ' ' -f 4 \ + | sed '/^$/d' \ + | tail -n 1`" + + if [ -z "${LASTSLICE}" ] + then + LASTSLICE="1" + else + LASTSLICE="`expr $LASTSLICE + 1`" + fi + + if [ $LASTSLICE -gt 4 ] + then + exit_err "ERROR: BSD only supports primary partitions, and there are none availble on $DISK" + fi + + fi + fi + + # Check if we have an image file defined + echo $line | grep "^image=" >/dev/null 2>/dev/null + if [ "$?" = "0" ] ; then + # Found an image= entry, lets read / set it + get_value_from_string "${line}" + strip_white_space "$VAL" + IMAGE="$VAL" + if [ ! -f "$IMAGE" ] ; then + exit_err "$IMAGE file does not exist" + fi + fi + + # Check if we have a partscheme specified + echo $line | grep "^partscheme=" >/dev/null 2>/dev/null + if [ "$?" = "0" ] ; then + # Found a partscheme= entry, lets read / set it + get_value_from_string "${line}" + strip_white_space "$VAL" + PSCHEME="$VAL" + if [ "$PSCHEME" != "GPT" -a "$PSCHEME" != "MBR" ] ; then + exit_err "Unknown partition scheme: $PSCHEME" + fi + fi + + echo $line | grep "^bootManager=" >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + # Found a bootManager= entry, lets read /set it + get_value_from_string "${line}" + strip_white_space "$VAL" + BMANAGER="$VAL" + fi + + echo $line | grep "^commitDiskPart" >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + # Found our flag to commit this disk setup / lets do sanity check and do it + if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ] + then + case ${PTYPE} in + all) + if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then + PSCHEME="MBR" + tmpSLICE="${DISK}s1" + else + tmpSLICE="${DISK}p1" + fi + + run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}" + ;; + + s1|s2|s3|s4) + tmpSLICE="${DISK}${PTYPE}" + # Get the number of the slice we are working on + s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" + run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" + ;; + + free) + tmpSLICE="${DISK}s${LASTSLICE}" + run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" + ;; + + image) + if [ -n "${IMAGE}" ] + then + write_image "${IMAGE}" "${DISK}" + else + exit_err "ERROR: partition type image specified with no image!" + fi + + IMAGE="${DISK}:${IMAGE}" + if [ -z "${WORKINGIMAGES}" ] + then + WORKINGIMAGES="${IMAGE}" + else + WORKINGIMAGES="${WORKINGIMAGES} ${IMAGE}" + fi + + export WORKINGIMAGES + ;; + + *) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;; + esac + + # Now save which disk this is, so we can parse it later during slice partition setup + if [ -n "${tmpSLICE}" ] + then + echo "disk${disknum}" >${SLICECFGDIR}/$tmpSLICE + fi + + # Save any mirror config + if [ ! -z "$MIRRORDISK" ] + then + # Default to round-robin if the user didn't specify + if [ -z "$MIRRORBAL" ] + then + MIRRORBAL="round-robin" + fi + echo "$MIRRORDISK:$MIRRORBAL" >${MIRRORCFGDIR}/$DISK + fi + + + # Increment our disk counter to look for next disk and unset + unset BMANAGER PTYPE DISK MIRRORDISK MIRRORBAL PSCHEME IMAGE + disknum="`expr $disknum + 1`" + else + exit_err "ERROR: commitDiskPart was called without procceding disk= and partition= entries!!!" + fi + fi done <${CFGF} @@ -590,8 +628,7 @@ init_mbr_full_disk() totalblocks="`expr ${totalblocks} \* ${sec}`" if [ -z "${totalblocks}" ] then - get_disk_mediasize "${_intDISK}" - totalblocks="${VAL}" + totalblocks=`gpart show "${_intDISK}"|tail -2|head -1|awk '{ print $2 }'` fi # Now set the ending block to the total disk block size Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -377,7 +377,7 @@ init_extraction() fi ;; - ftp|sftp) + ftp) if [ "$PACKAGETYPE" = "split" ] then fetch_split_files @@ -390,9 +390,9 @@ init_extraction() fi ;; - rsync) start_rsync_copy ;; - img) - ;; + sftp) ;; + + rsync) start_rsync_copy ;; *) exit_err "ERROR: Unknown install medium" ;; esac Modified: head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -60,7 +60,7 @@ copy_component() RESULT="$?" ;; - ftp|sftp) + ftp) get_value_from_cfg ftpPath if [ -z "$VAL" ] then @@ -71,6 +71,8 @@ copy_component() fetch_file "${FTPPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE}" "${FSMNT}/${COMPTMPDIR}/${CFILE}" "0" RESULT="$?" ;; + + sftp) ;; esac if [ "${RESULT}" != "0" ] Modified: head/usr.sbin/pc-sysinstall/backend/functions-packages.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-packages.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/functions-packages.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -113,7 +113,8 @@ get_package_index() case "${INSTALLMEDIUM}" in usb|dvd) get_package_index_by_fs ;; - ftp|sftp) get_package_index_by_ftp "${FTPPATH}" ;; + ftp) get_package_index_by_ftp "${FTPPATH}" ;; + sftp) ;; *) RES=1 ;; esac @@ -369,6 +370,7 @@ fetch_package() case "${INSTALLMEDIUM}" in usb|dvd) fetch_package_by_fs "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;; - ftp|sftp) fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;; + ftp) fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;; + sftp) ;; esac }; Modified: head/usr.sbin/pc-sysinstall/backend/functions-parse.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-parse.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/functions-parse.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -85,6 +85,7 @@ if_check_value_exists() VALID="1" for i in ${2} do + VAL=`echo "$VAL"|tr A-Z a-z` if [ "$VAL" = "${i}" ] then VALID="0" Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/functions.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -283,3 +283,118 @@ get_zpool_name() return fi }; + +write_image() +{ + IMAGE_FILE="$1" + DEVICE_FILE="$2" + + if [ -z "${IMAGE_FILE}" ] + then + echo "ERROR: Image file not specified!" + exit 1 + fi + + if [ -z "${DEVICE_FILE}" ] + then + echo "ERROR: Device file not specified!" + exit 1 + fi + + if [ ! -f "${IMAGE_FILE}" ] + then + echo "ERROR: '${IMAGE_FILE}' does not exist!" + exit 1 + fi + + DEVICE_FILE="${DEVICE_FILE#/dev/}" + DEVICE_FILE="/dev/${DEVICE_FILE}" + + if [ ! -c "${DEVICE_FILE}" ] + then + echo "ERROR: '${DEVICE_FILE}' is not a character device!" + exit 1 + fi + + if [ "${RES}" = "0" ] + then + rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} ibs=16k obs=16k" + fi + + return 0 +}; + +install_fresh() +{ + # Lets start setting up the disk slices now + setup_disk_slice + + # Disk setup complete, now lets parse WORKINGSLICES and setup the bsdlabels + setup_disk_label + + # Now we've setup the bsdlabels, lets go ahead and run newfs / zfs + # to setup the filesystems + setup_filesystems + + # Lets mount the partitions now + mount_all_filesystems + + # We are ready to begin extraction, lets start now + init_extraction + + # Check if we have any optional modules to load + install_components + + # Check if we have any packages to install + install_packages + + # Do any localization in configuration + run_localize + + # Save any networking config on the installed system + save_networking_install + + # Now add any users + setup_users + + # Now run any commands specified + run_commands + + # Do any last cleanup / setup before unmounting + run_final_cleanup + + # Unmount and finish up + unmount_all_filesystems + + echo_log "Installation finished!" +} + +install_upgrade() +{ + # We're going to do an upgrade, skip all the disk setup + # and start by mounting the target drive/slices + mount_upgrade + + # Start the extraction process + init_extraction + + # Do any localization in configuration + run_localize + + # ow run any commands specified + run_commands + + # Merge any old configuration files + merge_old_configs + + # Check if we have any optional modules to load + install_components + + # Check if we have any packages to install + install_packages + + # All finished, unmount the file-systems + unmount_upgrade + + echo_log "Upgrade finished!" +} Modified: head/usr.sbin/pc-sysinstall/backend/parseconfig.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -73,9 +73,9 @@ file_sanity_check "installMode disk0 ins check_value installMode "fresh upgrade" check_value bootManager "bsd none" check_value installType "PCBSD FreeBSD" -check_value installMedium "dvd usb ftp rsync img" +check_value installMedium "dvd usb ftp rsync" check_value packageType "uzip tar rsync split" -if_check_value_exists partition "all ALL s1 s2 s3 s4 free FREE" +if_check_value_exists partition "all s1 s2 s3 s4 free image" if_check_value_exists mirrorbal "load prefer round-robin split" # We passed all sanity checks! Yay, lets start the install @@ -98,79 +98,18 @@ PACKAGETYPE="${VAL}" ; export PACKAGETYP start_networking # If we are not doing an upgrade, lets go ahead and setup the disk -if [ "${INSTALLMODE}" = "fresh" ] -then - - # Lets start setting up the disk slices now - setup_disk_slice - - # Disk setup complete, now lets parse WORKINGSLICES and setup the bsdlabels - setup_disk_label - - # Now we've setup the bsdlabels, lets go ahead and run newfs / zfs - # to setup the filesystems - setup_filesystems - - # Lets mount the partitions now - mount_all_filesystems - - # We are ready to begin extraction, lets start now - init_extraction - - # Check if we have any optional modules to load - install_components - - # Check if we have any packages to install - install_packages - - # Do any localization in configuration - run_localize - - # Save any networking config on the installed system - save_networking_install - - # Now add any users - setup_users - - # Now run any commands specified - run_commands - - # Do any last cleanup / setup before unmounting - run_final_cleanup - - # Unmount and finish up - unmount_all_filesystems - - echo_log "Installation finished!" - exit 0 - -else - # We're going to do an upgrade, skip all the disk setup - # and start by mounting the target drive/slices - mount_upgrade - - # Start the extraction process - init_extraction - - # Do any localization in configuration - run_localize - - # Now run any commands specified - run_commands - - # Merge any old configuration files - merge_old_configs - - # Check if we have any optional modules to load - install_components - - # Check if we have any packages to install - install_packages - - # All finished, unmount the file-systems - unmount_upgrade - - echo_log "Upgrade finished!" - exit 0 -fi +case "${INSTALLMODE}" in + fresh) + install_fresh + ;; + + upgrade) + install_upgrade + ;; + + *) + exit 1 + ;; +esac +exit 0 Modified: head/usr.sbin/pc-sysinstall/doc/help-index ============================================================================== --- head/usr.sbin/pc-sysinstall/doc/help-index Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/doc/help-index Wed Sep 8 20:10:24 2010 (r212337) @@ -9,6 +9,8 @@ Help Commands Display the help data for the specified command System Query Commands + install-image + Installs an image file to a device file disk-list Provides a listing of the disk drives detected on this system Modified: head/usr.sbin/pc-sysinstall/examples/README ============================================================================== --- head/usr.sbin/pc-sysinstall/examples/README Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/examples/README Wed Sep 8 20:10:24 2010 (r212337) @@ -114,7 +114,7 @@ root zpool of the target system to updat # disk0=ada0s1a -# partition=(all, free, s1, s1, s3, s4) +# partition=(all, free, s1, s1, s3, s4, image) After setting disk[0-9], the partition= variable is used to specify which target partition we will be working with for this device. @@ -124,7 +124,9 @@ Setting this to "all" will setup the dis Setting this to "free" will allow pc-sysinstall to search for the first available primary slice with free space, and create the slice. -Setting this to "s1, s2, s3 or s4" will use the specified MBR slice +Setting this to "s1, s2, s3 or s4" will use the specified MBR slice. + +Setting this to "image" will use an image to configure the disk. (This tag is unused for upgrades) @@ -151,6 +153,11 @@ specified this defaults to "round-robin" Setting this option will instruct pc-sysinstall to install the BSD boot Manager, or leave it empty +# image=(/path/to/image/file) + +Setting this option will instruct pc-sysinstall to write the image file +specified by the path to the disk. + # commitDiskPart This command must be placed at the end of the diskX= section, before starting Modified: head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh Wed Sep 8 20:09:50 2010 (r212336) +++ head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh Wed Sep 8 20:10:24 2010 (r212337) @@ -116,6 +116,10 @@ case $1 in fi ;; + # Install an image file to a device + install-image) ${BACKEND}/installimage.sh "${2}" "${3}" + ;; + # Parse an auto-install directive, and begin the installation start-autoinstall) ${BACKEND}/startautoinstall.sh ${2} ;; From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 20:10:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B9B510656F8; Wed, 8 Sep 2010 20:10:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B8378FC14; Wed, 8 Sep 2010 20:10:29 +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 o88KATGN070012; Wed, 8 Sep 2010 20:10:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88KATYJ070010; Wed, 8 Sep 2010 20:10:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009082010.o88KATYJ070010@svn.freebsd.org> From: John Baldwin Date: Wed, 8 Sep 2010 20:10:29 +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: r212338 - head/sys/boot/forth X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:10:29 -0000 Author: jhb Date: Wed Sep 8 20:10:29 2010 New Revision: 212338 URL: http://svn.freebsd.org/changeset/base/212338 Log: If autoboot_delay is set to -1, boot immediately without checking for a keypress to match the behavior of the loader. PR: docs/108101 Submitted by: Wayne Sierke ws of au.dyndns.ws Tested by: brd MFC after: 1 week Modified: head/sys/boot/forth/beastie.4th Modified: head/sys/boot/forth/beastie.4th ============================================================================== --- head/sys/boot/forth/beastie.4th Wed Sep 8 20:10:24 2010 (r212337) +++ head/sys/boot/forth/beastie.4th Wed Sep 8 20:10:29 2010 (r212338) @@ -240,7 +240,10 @@ set-current drop 10 else - 0 0 2swap >number drop drop drop + 2dup s" -1" compare 0= if + 0 boot + then + 0 s>d 2swap >number 2drop drop then begin dup tkey From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 20:35:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ABD710656C5; Wed, 8 Sep 2010 20:35:44 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D38438FC1F; Wed, 8 Sep 2010 20:35: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 o88KZhMT073740; Wed, 8 Sep 2010 20:35:43 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88KZhIx073736; Wed, 8 Sep 2010 20:35:43 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009082035.o88KZhIx073736@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 8 Sep 2010 20:35: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: r212339 - in head: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:35:44 -0000 Author: jilles Date: Wed Sep 8 20:35:43 2010 New Revision: 212339 URL: http://svn.freebsd.org/changeset/base/212339 Log: sh: Fix 'read' if all chars before the first IFS char are backslash-escaped. Backslash-escaped characters did not set the flag for a non-IFS character. MFC after: 2 weeks Added: head/tools/regression/bin/sh/builtins/read4.0 (contents, props changed) head/tools/regression/bin/sh/builtins/read4.0.stdout (contents, props changed) Modified: head/bin/sh/miscbltin.c Modified: head/bin/sh/miscbltin.c ============================================================================== --- head/bin/sh/miscbltin.c Wed Sep 8 20:10:29 2010 (r212338) +++ head/bin/sh/miscbltin.c Wed Sep 8 20:35:43 2010 (r212339) @@ -174,6 +174,7 @@ readcmd(int argc __unused, char **argv _ continue; if (backslash) { backslash = 0; + startword = 0; if (c != '\n') STPUTC(c, p); continue; Added: head/tools/regression/bin/sh/builtins/read4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/read4.0 Wed Sep 8 20:35:43 2010 (r212339) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +printf '%s\n' '\a\ b c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a b\ c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a\:b:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a:b\:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } Added: head/tools/regression/bin/sh/builtins/read4.0.stdout ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/read4.0.stdout Wed Sep 8 20:35:43 2010 (r212339) @@ -0,0 +1,8 @@ +xa bxcx +xaxb cx +xa:bxcx +xaxb:cx +x\xax +x\xax +x\ axx +x\:axx From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 20:56:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA89210656AB; Wed, 8 Sep 2010 20:56:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA3658FC08; Wed, 8 Sep 2010 20:56: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 o88KuITR078129; Wed, 8 Sep 2010 20:56:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88KuIUd078127; Wed, 8 Sep 2010 20:56:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009082056.o88KuIUd078127@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 8 Sep 2010 20:56: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: r212340 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 20:56:18 -0000 Author: pjd Date: Wed Sep 8 20:56:18 2010 New Revision: 212340 URL: http://svn.freebsd.org/changeset/base/212340 Log: - Log all the problems in devfs_fixup(). - Correct error paths. The system will be useless on devfs_fixup() failure, so why bother? Maybe for the same reason why a dead body is washed and dressed in a nice suit before it is put into a coffin? Maybe system's last will is to panic without any locks held? Reviewed by: kib Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Wed Sep 8 20:35:43 2010 (r212339) +++ head/sys/kern/vfs_mount.c Wed Sep 8 20:56:18 2010 (r212340) @@ -1549,9 +1549,9 @@ static void devfs_fixup(struct thread *td) { struct nameidata nd; - int error; struct vnode *vp, *dvp; struct mount *mp; + int error; /* Remove our devfs mount from the mountlist and purge the cache */ mtx_lock(&mountlist_mtx); @@ -1575,16 +1575,26 @@ devfs_fixup(struct thread *td) error = namei(&nd); if (error) { printf("Lookup of /dev for devfs, error: %d\n", error); + vput(dvp); + vfs_unbusy(mp); return; } NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; if (vp->v_type != VDIR) { + printf("/dev is not a directory\n"); + vput(dvp); vput(vp); + vfs_unbusy(mp); + return; } error = vinvalbuf(vp, V_SAVE, 0, 0); if (error) { + printf("vinvalbuf() of /dev failed, error: %d\n", error); + vput(dvp); vput(vp); + vfs_unbusy(mp); + return; } cache_purge(vp); mp->mnt_vnodecovered = vp; @@ -1597,7 +1607,9 @@ devfs_fixup(struct thread *td) vfs_unbusy(mp); /* Unlink the no longer needed /dev/dev -> / symlink */ - kern_unlink(td, "/dev/dev", UIO_SYSSPACE); + error = kern_unlink(td, "/dev/dev", UIO_SYSSPACE); + if (error) + printf("kern_unlink of /dev/dev failed, error: %d\n", error); } /* From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 21:00:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75C9010656C0; Wed, 8 Sep 2010 21:00:53 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6472B8FC08; Wed, 8 Sep 2010 21:00: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 o88L0rra079064; Wed, 8 Sep 2010 21:00:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88L0rCu079062; Wed, 8 Sep 2010 21:00:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009082100.o88L0rCu079062@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 8 Sep 2010 21:00: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: r212341 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 21:00:53 -0000 Author: pjd Date: Wed Sep 8 21:00:53 2010 New Revision: 212341 URL: http://svn.freebsd.org/changeset/base/212341 Log: Doing first mount and updating mount points are both handled by the same syscall and the same function, but are very different and share almost no code. To make it easier to read and analyze, split vfs_domount() into vfs_domount_first() and vfs_domount_update(). Reviewed by: kib Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Wed Sep 8 20:56:18 2010 (r212340) +++ head/sys/kern/vfs_mount.c Wed Sep 8 21:00:53 2010 (r212341) @@ -704,9 +704,7 @@ vfs_donmount(struct thread *td, int fsfl goto bail; } - mtx_lock(&Giant); error = vfs_domount(td, fstype, fspath, fsflags, optlist); - mtx_unlock(&Giant); bail: /* copyout the errmsg */ if (errmsg_pos != -1 && ((2 * errmsg_pos + 1) < fsoptions->uio_iovcnt) @@ -795,6 +793,257 @@ mount(td, uap) return (error); } +/* + * vfs_domount_first(): first file system mount (not update) + */ +static int +vfs_domount_first( + struct thread *td, /* Calling thread. */ + struct vfsconf *vfsp, /* File system type. */ + char *fspath, /* Mount path. */ + struct vnode *vp, /* Vnode to be covered. */ + int fsflags, /* Flags common to all filesystems. */ + void *fsdata /* Options local to the filesystem. */ + ) +{ + struct vattr va; + struct mount *mp; + struct vnode *newdp; + int error; + + mtx_assert(&Giant, MA_OWNED); + ASSERT_VOP_ELOCKED(vp, __func__); + KASSERT((fsflags & MNT_UPDATE) == 0, ("MNT_UPDATE shouldn't be here")); + + /* + * If the user is not root, ensure that they own the directory + * onto which we are attempting to mount. + */ + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error == 0 && va.va_uid != td->td_ucred->cr_uid) + error = priv_check_cred(td->td_ucred, PRIV_VFS_ADMIN, 0); + if (error == 0) + error = vinvalbuf(vp, V_SAVE, 0, 0); + if (error == 0 && vp->v_type != VDIR) + error = ENOTDIR; + if (error == 0) { + VI_LOCK(vp); + if ((vp->v_iflag & VI_MOUNT) == 0 && vp->v_mountedhere == NULL) + vp->v_iflag |= VI_MOUNT; + else + error = EBUSY; + VI_UNLOCK(vp); + } + if (error != 0) { + vput(vp); + return (error); + } + VOP_UNLOCK(vp, 0); + + /* Allocate and initialize the filesystem. */ + mp = vfs_mount_alloc(vp, vfsp, fspath, td->td_ucred); + /* XXXMAC: pass to vfs_mount_alloc? */ + mp->mnt_optnew = fsdata; + /* Set the mount level flags. */ + mp->mnt_flag = (fsflags & (MNT_UPDATEMASK | MNT_ROOTFS | MNT_RDONLY)); + + /* + * Mount the filesystem. + * XXX The final recipients of VFS_MOUNT just overwrite the ndp they + * get. No freeing of cn_pnbuf. + */ + error = VFS_MOUNT(mp); + if (error != 0) { + vfs_unbusy(mp); + vfs_mount_destroy(mp); + vrele(vp); + return (error); + } + + if (mp->mnt_opt != NULL) + vfs_freeopts(mp->mnt_opt); + mp->mnt_opt = mp->mnt_optnew; + (void)VFS_STATFS(mp, &mp->mnt_stat); + + /* + * Prevent external consumers of mount options from reading mnt_optnew. + */ + mp->mnt_optnew = NULL; + + MNT_ILOCK(mp); + if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) + mp->mnt_kern_flag |= MNTK_ASYNC; + else + mp->mnt_kern_flag &= ~MNTK_ASYNC; + MNT_IUNLOCK(mp); + + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + cache_purge(vp); + VI_LOCK(vp); + vp->v_iflag &= ~VI_MOUNT; + VI_UNLOCK(vp); + vp->v_mountedhere = mp; + /* Place the new filesystem at the end of the mount list. */ + mtx_lock(&mountlist_mtx); + TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); + mtx_unlock(&mountlist_mtx); + vfs_event_signal(NULL, VQ_MOUNT, 0); + if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) + panic("mount: lost mount"); + VOP_UNLOCK(newdp, 0); + VOP_UNLOCK(vp, 0); + mountcheckdirs(vp, newdp); + vrele(newdp); + if ((mp->mnt_flag & MNT_RDONLY) == 0) + vfs_allocate_syncvnode(mp); + vfs_unbusy(mp); + return (0); +} + +/* + * vfs_domount_update(): update of mounted file system + */ +static int +vfs_domount_update( + struct thread *td, /* Calling thread. */ + struct vnode *vp, /* Mount point vnode. */ + int fsflags, /* Flags common to all filesystems. */ + void *fsdata /* Options local to the filesystem. */ + ) +{ + struct oexport_args oexport; + struct export_args export; + struct mount *mp; + int error, flag; + + mtx_assert(&Giant, MA_OWNED); + ASSERT_VOP_ELOCKED(vp, __func__); + KASSERT((fsflags & MNT_UPDATE) != 0, ("MNT_UPDATE should be here")); + + if ((vp->v_vflag & VV_ROOT) == 0) { + vput(vp); + return (EINVAL); + } + mp = vp->v_mount; + /* + * We only allow the filesystem to be reloaded if it + * is currently mounted read-only. + */ + flag = mp->mnt_flag; + if ((fsflags & MNT_RELOAD) != 0 && (flag & MNT_RDONLY) == 0) { + vput(vp); + return (EOPNOTSUPP); /* Needs translation */ + } + /* + * Only privileged root, or (if MNT_USER is set) the user that + * did the original mount is permitted to update it. + */ + error = vfs_suser(mp, td); + if (error != 0) { + vput(vp); + return (error); + } + if (vfs_busy(mp, MBF_NOWAIT)) { + vput(vp); + return (EBUSY); + } + VI_LOCK(vp); + if ((vp->v_iflag & VI_MOUNT) != 0 || vp->v_mountedhere != NULL) { + VI_UNLOCK(vp); + vfs_unbusy(mp); + vput(vp); + return (EBUSY); + } + vp->v_iflag |= VI_MOUNT; + VI_UNLOCK(vp); + VOP_UNLOCK(vp, 0); + + MNT_ILOCK(mp); + mp->mnt_flag &= ~MNT_UPDATEMASK; + mp->mnt_flag |= fsflags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | + MNT_SNAPSHOT | MNT_ROOTFS | MNT_UPDATEMASK | MNT_RDONLY); + if ((mp->mnt_flag & MNT_ASYNC) == 0) + mp->mnt_kern_flag &= ~MNTK_ASYNC; + MNT_IUNLOCK(mp); + mp->mnt_optnew = fsdata; + vfs_mergeopts(mp->mnt_optnew, mp->mnt_opt); + + /* + * Mount the filesystem. + * XXX The final recipients of VFS_MOUNT just overwrite the ndp they + * get. No freeing of cn_pnbuf. + */ + error = VFS_MOUNT(mp); + + if (error == 0) { + /* Process the export option. */ + if (vfs_copyopt(mp->mnt_optnew, "export", &export, + sizeof(export)) == 0) { + error = vfs_export(mp, &export); + } else if (vfs_copyopt(mp->mnt_optnew, "export", &oexport, + sizeof(oexport)) == 0) { + export.ex_flags = oexport.ex_flags; + export.ex_root = oexport.ex_root; + export.ex_anon = oexport.ex_anon; + export.ex_addr = oexport.ex_addr; + export.ex_addrlen = oexport.ex_addrlen; + export.ex_mask = oexport.ex_mask; + export.ex_masklen = oexport.ex_masklen; + export.ex_indexfile = oexport.ex_indexfile; + export.ex_numsecflavors = 0; + error = vfs_export(mp, &export); + } + } + + MNT_ILOCK(mp); + if (error == 0) { + mp->mnt_flag &= ~(MNT_UPDATE | MNT_RELOAD | MNT_FORCE | + MNT_SNAPSHOT); + } else { + /* + * If we fail, restore old mount flags. MNT_QUOTA is special, + * because it is not part of MNT_UPDATEMASK, but it could have + * changed in the meantime if quotactl(2) was called. + * All in all we want current value of MNT_QUOTA, not the old + * one. + */ + mp->mnt_flag = (mp->mnt_flag & MNT_QUOTA) | (flag & ~MNT_QUOTA); + } + if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) + mp->mnt_kern_flag |= MNTK_ASYNC; + else + mp->mnt_kern_flag &= ~MNTK_ASYNC; + MNT_IUNLOCK(mp); + + if (error != 0) + goto end; + + if (mp->mnt_opt != NULL) + vfs_freeopts(mp->mnt_opt); + mp->mnt_opt = mp->mnt_optnew; + (void)VFS_STATFS(mp, &mp->mnt_stat); + /* + * Prevent external consumers of mount options from reading + * mnt_optnew. + */ + mp->mnt_optnew = NULL; + + if ((mp->mnt_flag & MNT_RDONLY) == 0) { + if (mp->mnt_syncer == NULL) + vfs_allocate_syncvnode(mp); + } else { + if (mp->mnt_syncer != NULL) + vrele(mp->mnt_syncer); + mp->mnt_syncer = NULL; + } +end: + vfs_unbusy(mp); + VI_LOCK(vp); + vp->v_iflag &= ~VI_MOUNT; + VI_UNLOCK(vp); + vrele(vp); + return (error); +} /* * vfs_domount(): actually attempt a filesystem mount. @@ -808,16 +1057,11 @@ vfs_domount( void *fsdata /* Options local to the filesystem. */ ) { - struct vnode *vp; - struct mount *mp; struct vfsconf *vfsp; - struct oexport_args oexport; - struct export_args export; - int error, flag = 0; - struct vattr va; struct nameidata nd; + struct vnode *vp; + int error; - mtx_assert(&Giant, MA_OWNED); /* * Be ultra-paranoid about making sure the type and fspath * variables will fit in our mp buffers, including the @@ -865,226 +1109,30 @@ vfs_domount( if (jailed(td->td_ucred) && !(vfsp->vfc_flags & VFCF_JAIL)) return (EPERM); } + /* - * Get vnode to be covered + * Get vnode to be covered or mount point's vnode in case of MNT_UPDATE. */ - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_SYSSPACE, - fspath, td); - if ((error = namei(&nd)) != 0) + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, + UIO_SYSSPACE, fspath, td); + error = namei(&nd); + if (error != 0) return (error); + if (!NDHASGIANT(&nd)) + mtx_lock(&Giant); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; - if (fsflags & MNT_UPDATE) { - if ((vp->v_vflag & VV_ROOT) == 0) { - vput(vp); - return (EINVAL); - } - mp = vp->v_mount; - MNT_ILOCK(mp); - flag = mp->mnt_flag; - /* - * We only allow the filesystem to be reloaded if it - * is currently mounted read-only. - */ - if ((fsflags & MNT_RELOAD) && - ((mp->mnt_flag & MNT_RDONLY) == 0)) { - MNT_IUNLOCK(mp); - vput(vp); - return (EOPNOTSUPP); /* Needs translation */ - } - MNT_IUNLOCK(mp); - /* - * Only privileged root, or (if MNT_USER is set) the user that - * did the original mount is permitted to update it. - */ - error = vfs_suser(mp, td); - if (error) { - vput(vp); - return (error); - } - if (vfs_busy(mp, MBF_NOWAIT)) { - vput(vp); - return (EBUSY); - } - VI_LOCK(vp); - if ((vp->v_iflag & VI_MOUNT) != 0 || - vp->v_mountedhere != NULL) { - VI_UNLOCK(vp); - vfs_unbusy(mp); - vput(vp); - return (EBUSY); - } - vp->v_iflag |= VI_MOUNT; - VI_UNLOCK(vp); - MNT_ILOCK(mp); - mp->mnt_flag |= fsflags & - (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT | MNT_ROOTFS); - MNT_IUNLOCK(mp); - VOP_UNLOCK(vp, 0); - mp->mnt_optnew = fsdata; - vfs_mergeopts(mp->mnt_optnew, mp->mnt_opt); + if ((fsflags & MNT_UPDATE) == 0) { + error = vfs_domount_first(td, vfsp, fspath, vp, fsflags, + fsdata); } else { - /* - * If the user is not root, ensure that they own the directory - * onto which we are attempting to mount. - */ - error = VOP_GETATTR(vp, &va, td->td_ucred); - if (error) { - vput(vp); - return (error); - } - if (va.va_uid != td->td_ucred->cr_uid) { - error = priv_check_cred(td->td_ucred, PRIV_VFS_ADMIN, - 0); - if (error) { - vput(vp); - return (error); - } - } - error = vinvalbuf(vp, V_SAVE, 0, 0); - if (error != 0) { - vput(vp); - return (error); - } - if (vp->v_type != VDIR) { - vput(vp); - return (ENOTDIR); - } - VI_LOCK(vp); - if ((vp->v_iflag & VI_MOUNT) != 0 || - vp->v_mountedhere != NULL) { - VI_UNLOCK(vp); - vput(vp); - return (EBUSY); - } - vp->v_iflag |= VI_MOUNT; - VI_UNLOCK(vp); - VOP_UNLOCK(vp, 0); - - /* - * Allocate and initialize the filesystem. - */ - mp = vfs_mount_alloc(vp, vfsp, fspath, td->td_ucred); - - /* XXXMAC: pass to vfs_mount_alloc? */ - mp->mnt_optnew = fsdata; - } - - /* - * Set the mount level flags. - */ - MNT_ILOCK(mp); - mp->mnt_flag = (mp->mnt_flag & ~MNT_UPDATEMASK) | - (fsflags & (MNT_UPDATEMASK | MNT_FORCE | MNT_ROOTFS | - MNT_RDONLY)); - if ((mp->mnt_flag & MNT_ASYNC) == 0) - mp->mnt_kern_flag &= ~MNTK_ASYNC; - MNT_IUNLOCK(mp); - /* - * Mount the filesystem. - * XXX The final recipients of VFS_MOUNT just overwrite the ndp they - * get. No freeing of cn_pnbuf. - */ - error = VFS_MOUNT(mp); - - /* - * Process the export option only if we are - * updating mount options. - */ - if (!error && (fsflags & MNT_UPDATE)) { - if (vfs_copyopt(mp->mnt_optnew, "export", &export, - sizeof(export)) == 0) - error = vfs_export(mp, &export); - else if (vfs_copyopt(mp->mnt_optnew, "export", &oexport, - sizeof(oexport)) == 0) { - export.ex_flags = oexport.ex_flags; - export.ex_root = oexport.ex_root; - export.ex_anon = oexport.ex_anon; - export.ex_addr = oexport.ex_addr; - export.ex_addrlen = oexport.ex_addrlen; - export.ex_mask = oexport.ex_mask; - export.ex_masklen = oexport.ex_masklen; - export.ex_indexfile = oexport.ex_indexfile; - export.ex_numsecflavors = 0; - error = vfs_export(mp, &export); - } + error = vfs_domount_update(td, vp, fsflags, fsdata); } + mtx_unlock(&Giant); - if (!error) { - if (mp->mnt_opt != NULL) - vfs_freeopts(mp->mnt_opt); - mp->mnt_opt = mp->mnt_optnew; - (void)VFS_STATFS(mp, &mp->mnt_stat); - } - /* - * Prevent external consumers of mount options from reading - * mnt_optnew. - */ - mp->mnt_optnew = NULL; - if (mp->mnt_flag & MNT_UPDATE) { - MNT_ILOCK(mp); - if (error) - mp->mnt_flag = (mp->mnt_flag & MNT_QUOTA) | - (flag & ~MNT_QUOTA); - else - mp->mnt_flag &= ~(MNT_UPDATE | MNT_RELOAD | - MNT_FORCE | MNT_SNAPSHOT); - if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) - mp->mnt_kern_flag |= MNTK_ASYNC; - else - mp->mnt_kern_flag &= ~MNTK_ASYNC; - MNT_IUNLOCK(mp); - if ((mp->mnt_flag & MNT_RDONLY) == 0) { - if (mp->mnt_syncer == NULL) - vfs_allocate_syncvnode(mp); - } else { - if (mp->mnt_syncer != NULL) - vrele(mp->mnt_syncer); - mp->mnt_syncer = NULL; - } - vfs_unbusy(mp); - VI_LOCK(vp); - vp->v_iflag &= ~VI_MOUNT; - VI_UNLOCK(vp); - vrele(vp); - return (error); - } - MNT_ILOCK(mp); - if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) - mp->mnt_kern_flag |= MNTK_ASYNC; - else - mp->mnt_kern_flag &= ~MNTK_ASYNC; - MNT_IUNLOCK(mp); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - /* - * Put the new filesystem on the mount list after root. - */ - cache_purge(vp); - VI_LOCK(vp); - vp->v_iflag &= ~VI_MOUNT; - VI_UNLOCK(vp); - if (!error) { - struct vnode *newdp; + ASSERT_VI_UNLOCKED(vp, __func__); + ASSERT_VOP_UNLOCKED(vp, __func__); - vp->v_mountedhere = mp; - mtx_lock(&mountlist_mtx); - TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); - mtx_unlock(&mountlist_mtx); - vfs_event_signal(NULL, VQ_MOUNT, 0); - if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) - panic("mount: lost mount"); - VOP_UNLOCK(newdp, 0); - VOP_UNLOCK(vp, 0); - mountcheckdirs(vp, newdp); - vrele(newdp); - if ((mp->mnt_flag & MNT_RDONLY) == 0) - vfs_allocate_syncvnode(mp); - vfs_unbusy(mp); - } else { - vfs_unbusy(mp); - vfs_mount_destroy(mp); - vput(vp); - } return (error); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 8 21:08:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 875681065673; Wed, 8 Sep 2010 21:08:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76FF08FC13; Wed, 8 Sep 2010 21:08: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 o88L8sWX080772; Wed, 8 Sep 2010 21:08:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o88L8s3f080770; Wed, 8 Sep 2010 21:08:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009082108.o88L8s3f080770@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 8 Sep 2010 21:08: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: r212342 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 21:08:54 -0000 Author: yongari Date: Wed Sep 8 21:08:54 2010 New Revision: 212342 URL: http://svn.freebsd.org/changeset/base/212342 Log: Correct definition of T2 mode bit of MRBE Message Page 5 Next Page Control Register. Modified: head/sys/dev/mii/brgphyreg.h Modified: head/sys/dev/mii/brgphyreg.h ============================================================================== --- head/sys/dev/mii/brgphyreg.h Wed Sep 8 21:00:53 2010 (r212341) +++ head/sys/dev/mii/brgphyreg.h Wed Sep 8 21:08:54 2010 (r212342) @@ -390,7 +390,7 @@ #define BRGPHY_BLOCK_ADDR_MRBE 0x8350 #define BRGPHY_MRBE_MSG_PG5_NP 0x10 #define BRGPHY_MRBE_MSG_PG5_NP_MBRE 0x0001 -#define BRGPHY_MRBE_MSG_PG5_NP_T2 0x0001 +#define BRGPHY_MRBE_MSG_PG5_NP_T2 0x0002 /* 5709S SerDes "IEEE Clause 73 User B0" Registers */ #define BRGPHY_BLOCK_ADDR_CL73_USER_B0 0x8370 From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 02:52:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82D9C106564A; Thu, 9 Sep 2010 02:52:44 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 710FA8FC08; Thu, 9 Sep 2010 02:52: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 o892qiSY019690; Thu, 9 Sep 2010 02:52:44 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o892qiHM019688; Thu, 9 Sep 2010 02:52:44 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009090252.o892qiHM019688@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 9 Sep 2010 02:52: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: r212347 - head/sys/mips/rmi/dev/nlge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 02:52:44 -0000 Author: jchandra Date: Thu Sep 9 02:52:44 2010 New Revision: 212347 URL: http://svn.freebsd.org/changeset/base/212347 Log: Minor clean up for nlge - nlna_submit_rx_free_desc() can use the same desc every time. Also merge couple of one-line functions into their caller. Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Thu Sep 9 02:29:40 2010 (r212346) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Thu Sep 9 02:52:44 2010 (r212347) @@ -148,7 +148,6 @@ static void nlge_mediastatus(struct ifne /* Other internal/helper functions */ static void *get_buf(void); -static struct mbuf *get_mbuf(void); static void nlna_add_to_port_set(struct nlge_port_set *pset, struct nlge_softc *sc); @@ -170,8 +169,6 @@ static void nlna_reset_ports(struct nln struct xlr_gmac_block_t *blk); static struct nlna_softc *nlna_sc_init(device_t dev, struct xlr_gmac_block_t *blk); -static __inline__ int nlna_send_free_desc(struct nlna_softc *nlna, - vm_paddr_t addr); static void nlna_setup_intr(struct nlna_softc *sc); static void nlna_smp_update_pde(void *dummy __unused); static void nlna_submit_rx_free_desc(struct nlna_softc *sc, @@ -206,7 +203,6 @@ static int prepare_fmn_message(struct nl struct msgrng_msg *msg, uint32_t *n_entries, struct mbuf *m_head, uint64_t fr_stid, struct nlge_tx_desc **tx_desc); -static void release_mbuf(uint64_t phy_addr); static void release_tx_desc(vm_paddr_t phy_addr); static int send_fmn_msg_tx(struct nlge_softc *, struct msgrng_msg *, uint32_t n_entries); @@ -680,7 +676,7 @@ nlge_msgring_handler(int bucket, int siz if (is_p2p) { release_tx_desc(phys_addr); } else { - release_mbuf(phys_addr); + m_freem((struct mbuf *)(uintptr_t)phys_addr); } ifp = sc->nlge_if; @@ -1009,39 +1005,23 @@ nlna_is_last_active_na(struct nlna_softc return (id == 2 || xlr_board_info.gmac_block[id + 1].enabled == 0); } -static __inline__ int -nlna_send_free_desc(struct nlna_softc *sc, vm_paddr_t addr) -{ - struct msgrng_msg msg; - uint32_t msgrng_flags; - int i = 0, stid, code, ret; - - stid = sc->rfrbucket; - memset(&msg, 0, sizeof(msg)); - msg.msg0 = (uint64_t) addr & 0xffffffffe0ULL; - - code = (sc->na_type == XLR_XGMAC) ? MSGRNG_CODE_XGMAC : MSGRNG_CODE_MAC; - do { - msgrng_flags = msgrng_access_enable(); - ret = message_send_retry(1, code, stid, &msg); - msgrng_restore(msgrng_flags); - KASSERT(i++ < 100000, ("Too many credit fails\n")); - } while (ret != 0); - return (0); -} - static void nlna_submit_rx_free_desc(struct nlna_softc *sc, uint32_t n_desc) { + struct msgrng_msg msg; void *ptr; - int i; - int ret; + uint32_t msgrng_flags; + int i, n, stid, ret, code; if (n_desc > 1) { PDEBUG("Sending %d free-in descriptors to station=%d\n", n_desc, sc->rfrbucket); } + stid = sc->rfrbucket; + code = (sc->na_type == XLR_XGMAC) ? MSGRNG_CODE_XGMAC : MSGRNG_CODE_MAC; + memset(&msg, 0, sizeof(msg)); + for (i = 0; i < n_desc; i++) { ptr = get_buf(); if (!ptr) { @@ -1051,10 +1031,14 @@ nlna_submit_rx_free_desc(struct nlna_sof } /* Send the free Rx desc to the MAC */ - ret = nlna_send_free_desc(sc, vtophys(ptr)); - if (ret != 0) /* no point trying other descriptors after - a failure. */ - break; + msg.msg0 = vtophys(ptr) & 0xffffffffe0ULL; + n = 0; + do { + msgrng_flags = msgrng_access_enable(); + ret = message_send_retry(1, code, stid, &msg); + msgrng_restore(msgrng_flags); + KASSERT(n++ < 100000, ("Too many credit fails\n")); + } while (ret != 0); } } @@ -1982,15 +1966,6 @@ send_fmn_msg_tx(struct nlge_softc *sc, s } static void -release_mbuf(uint64_t phy_addr) -{ - struct mbuf *m; - - m = (struct mbuf *)((uint32_t) phy_addr); - m_freem(m); -} - -static void release_tx_desc(vm_paddr_t paddr) { struct nlge_tx_desc *tx_desc; @@ -2008,17 +1983,6 @@ release_tx_desc(vm_paddr_t paddr) uma_zfree(nl_tx_desc_zone, tx_desc); } -static struct mbuf * -get_mbuf(void) -{ - struct mbuf *m_new; - - if ((m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR)) == NULL) - return NULL; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - return (m_new); -} - static void * get_buf(void) { @@ -2026,10 +1990,9 @@ get_buf(void) vm_paddr_t temp1, temp2; unsigned int *md; - m_new = get_mbuf(); - if (m_new == NULL) - return m_new; - + if ((m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR)) == NULL) + return NULL; + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; m_adj(m_new, XLR_CACHELINE_SIZE - ((unsigned int)m_new->m_data & 0x1f)); md = (unsigned int *)m_new->m_data; md[0] = (unsigned int)m_new; /* Back Ptr */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 03:33:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CCFC10656C1; Thu, 9 Sep 2010 03:33:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 216DC8FC0A; Thu, 9 Sep 2010 03:33: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 o893X8tc023072; Thu, 9 Sep 2010 03:33:08 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o893X83p023071; Thu, 9 Sep 2010 03:33:08 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009090333.o893X83p023071@svn.freebsd.org> From: Warner Losh Date: Thu, 9 Sep 2010 03:33: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: r212350 - head/usr.sbin/pc-sysinstall/backend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 03:33:08 -0000 Author: imp Date: Thu Sep 9 03:33:07 2010 New Revision: 212350 URL: http://svn.freebsd.org/changeset/base/212350 Log: Add file missed in r212337, my bad... Added: head/usr.sbin/pc-sysinstall/backend/installimage.sh (contents, props changed) Added: head/usr.sbin/pc-sysinstall/backend/installimage.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pc-sysinstall/backend/installimage.sh Thu Sep 9 03:33:07 2010 (r212350) @@ -0,0 +1,34 @@ +#!/bin/sh +#- +# Copyright (c) 2010 iXsystems, Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# Source our functions scripts +. ${BACKEND}/functions.sh + +IMAGE_FILE="${1}" +DEVICE_FILE="${2}" + +write_image "${IMAGE_FILE}" "${DEVICE_FILE}" From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 06:43:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDBA510656DA; Thu, 9 Sep 2010 06:43:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC2138FC16; Thu, 9 Sep 2010 06:43: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 o896hIet043233; Thu, 9 Sep 2010 06:43:18 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o896hI80043228; Thu, 9 Sep 2010 06:43:18 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009090643.o896hI80043228@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 9 Sep 2010 06:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212351 - in stable/8/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 06:43:18 -0000 Author: bz Date: Thu Sep 9 06:43:18 2010 New Revision: 212351 URL: http://svn.freebsd.org/changeset/base/212351 Log: MFC r212155: MFp4 CH=183052 183053 183258: In protosw we define pr_protocol as short, while on the wire it is an uint8_t. That way we can have "internal" protocols like DIVERT, SEND or gaps for modules (PROTO_SPACER). Switch ipproto_{un,}register to accept a short protocol number(*) and do an upfront check for valid boundries. With this we also consistently report EPROTONOSUPPORT for out of bounds protocols, as we did for proto == 0. This allows a caller to not error for this case, which is especially important if we want to automatically call these from domain handling. (*) the functions have been without any in-tree consumer since the initial introducation, so this is considered save. Implement ip6proto_{un,}register() similarly to their legacy IP counter parts to allow modules to hook up dynamically. Reviewed by: philip, will Modified: stable/8/sys/netinet/ip_input.c stable/8/sys/netinet/ip_var.h stable/8/sys/netinet6/ip6_input.c stable/8/sys/netinet6/ip6_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/ip_input.c ============================================================================== --- stable/8/sys/netinet/ip_input.c Thu Sep 9 03:33:07 2010 (r212350) +++ stable/8/sys/netinet/ip_input.c Thu Sep 9 06:43:18 2010 (r212351) @@ -1293,12 +1293,12 @@ ip_drain(void) * in inetsw[], either statically or through pf_proto_register(). */ int -ipproto_register(u_char ipproto) +ipproto_register(short ipproto) { struct protosw *pr; /* Sanity checks. */ - if (ipproto == 0) + if (ipproto <= 0 || ipproto >= IPPROTO_MAX) return (EPROTONOSUPPORT); /* @@ -1316,24 +1316,20 @@ ipproto_register(u_char ipproto) pr < inetdomain.dom_protoswNPROTOSW; pr++) { if (pr->pr_domain->dom_family == PF_INET && pr->pr_protocol && pr->pr_protocol == ipproto) { - /* Be careful to only index valid IP protocols. */ - if (pr->pr_protocol < IPPROTO_MAX) { - ip_protox[pr->pr_protocol] = pr - inetsw; - return (0); - } else - return (EINVAL); + ip_protox[pr->pr_protocol] = pr - inetsw; + return (0); } } return (EPROTONOSUPPORT); } int -ipproto_unregister(u_char ipproto) +ipproto_unregister(short ipproto) { struct protosw *pr; /* Sanity checks. */ - if (ipproto == 0) + if (ipproto <= 0 || ipproto >= IPPROTO_MAX) return (EPROTONOSUPPORT); /* Check if the protocol was indeed registered. */ Modified: stable/8/sys/netinet/ip_var.h ============================================================================== --- stable/8/sys/netinet/ip_var.h Thu Sep 9 03:33:07 2010 (r212350) +++ stable/8/sys/netinet/ip_var.h Thu Sep 9 06:43:18 2010 (r212351) @@ -220,8 +220,8 @@ extern int int ip_output(struct mbuf *, struct mbuf *, struct route *, int, struct ip_moptions *, struct inpcb *); -int ipproto_register(u_char); -int ipproto_unregister(u_char); +int ipproto_register(short); +int ipproto_unregister(short); struct mbuf * ip_reass(struct mbuf *); struct in_ifaddr * Modified: stable/8/sys/netinet6/ip6_input.c ============================================================================== --- stable/8/sys/netinet6/ip6_input.c Thu Sep 9 03:33:07 2010 (r212350) +++ stable/8/sys/netinet6/ip6_input.c Thu Sep 9 06:43:18 2010 (r212351) @@ -202,6 +202,64 @@ ip6_init(void) netisr_register(&ip6_nh); } +/* + * The protocol to be inserted into ip6_protox[] must be already registered + * in inet6sw[], either statically or through pf_proto_register(). + */ +int +ip6proto_register(short ip6proto) +{ + struct ip6protosw *pr; + + /* Sanity checks. */ + if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX) + return (EPROTONOSUPPORT); + + /* + * The protocol slot must not be occupied by another protocol + * already. An index pointing to IPPROTO_RAW is unused. + */ + pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); + if (pr == NULL) + return (EPFNOSUPPORT); + if (ip6_protox[ip6proto] != pr - inet6sw) /* IPPROTO_RAW */ + return (EEXIST); + + /* + * Find the protocol position in inet6sw[] and set the index. + */ + for (pr = (struct ip6protosw *)inet6domain.dom_protosw; + pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) { + if (pr->pr_domain->dom_family == PF_INET6 && + pr->pr_protocol && pr->pr_protocol == ip6proto) { + ip6_protox[pr->pr_protocol] = pr - inet6sw; + return (0); + } + } + return (EPROTONOSUPPORT); +} + +int +ip6proto_unregister(short ip6proto) +{ + struct ip6protosw *pr; + + /* Sanity checks. */ + if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX) + return (EPROTONOSUPPORT); + + /* Check if the protocol was indeed registered. */ + pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); + if (pr == NULL) + return (EPFNOSUPPORT); + if (ip6_protox[ip6proto] == pr - inet6sw) /* IPPROTO_RAW */ + return (ENOENT); + + /* Reset the protocol slot to IPPROTO_RAW. */ + ip6_protox[ip6proto] = pr - inet6sw; + return (0); +} + #ifdef VIMAGE void ip6_destroy() Modified: stable/8/sys/netinet6/ip6_var.h ============================================================================== --- stable/8/sys/netinet6/ip6_var.h Thu Sep 9 03:33:07 2010 (r212350) +++ stable/8/sys/netinet6/ip6_var.h Thu Sep 9 06:43:18 2010 (r212351) @@ -368,6 +368,9 @@ void ip6_init __P((void)); #ifdef VIMAGE void ip6_destroy __P((void)); #endif +int ip6proto_register(short); +int ip6proto_unregister(short); + void ip6_input __P((struct mbuf *)); struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); void ip6_freepcbopts __P((struct ip6_pktopts *)); From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 06:44:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C398C10656CB; Thu, 9 Sep 2010 06:44:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23C68FC08; Thu, 9 Sep 2010 06:44: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 o896iMch043561; Thu, 9 Sep 2010 06:44:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o896iMoC043556; Thu, 9 Sep 2010 06:44:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009090644.o896iMoC043556@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 9 Sep 2010 06:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212352 - in stable/7/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 06:44:22 -0000 Author: bz Date: Thu Sep 9 06:44:22 2010 New Revision: 212352 URL: http://svn.freebsd.org/changeset/base/212352 Log: MFC r212155: MFp4 CH=183052 183053 183258: In protosw we define pr_protocol as short, while on the wire it is an uint8_t. That way we can have "internal" protocols like DIVERT, SEND or gaps for modules (PROTO_SPACER). Switch ipproto_{un,}register to accept a short protocol number(*) and do an upfront check for valid boundries. With this we also consistently report EPROTONOSUPPORT for out of bounds protocols, as we did for proto == 0. This allows a caller to not error for this case, which is especially important if we want to automatically call these from domain handling. (*) the functions have been without any in-tree consumer since the initial introducation, so this is considered save. Implement ip6proto_{un,}register() similarly to their legacy IP counter parts to allow modules to hook up dynamically. Reviewed by: philip, will Modified: stable/7/sys/netinet/ip_input.c stable/7/sys/netinet/ip_var.h stable/7/sys/netinet6/ip6_input.c stable/7/sys/netinet6/ip6_var.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/ip_input.c ============================================================================== --- stable/7/sys/netinet/ip_input.c Thu Sep 9 06:43:18 2010 (r212351) +++ stable/7/sys/netinet/ip_input.c Thu Sep 9 06:44:22 2010 (r212352) @@ -1137,12 +1137,12 @@ ip_drain(void) * in inetsw[], either statically or through pf_proto_register(). */ int -ipproto_register(u_char ipproto) +ipproto_register(short ipproto) { struct protosw *pr; /* Sanity checks. */ - if (ipproto == 0) + if (ipproto <= 0 || ipproto >= IPPROTO_MAX) return (EPROTONOSUPPORT); /* @@ -1160,24 +1160,20 @@ ipproto_register(u_char ipproto) pr < inetdomain.dom_protoswNPROTOSW; pr++) { if (pr->pr_domain->dom_family == PF_INET && pr->pr_protocol && pr->pr_protocol == ipproto) { - /* Be careful to only index valid IP protocols. */ - if (pr->pr_protocol < IPPROTO_MAX) { - ip_protox[pr->pr_protocol] = pr - inetsw; - return (0); - } else - return (EINVAL); + ip_protox[pr->pr_protocol] = pr - inetsw; + return (0); } } return (EPROTONOSUPPORT); } int -ipproto_unregister(u_char ipproto) +ipproto_unregister(short ipproto) { struct protosw *pr; /* Sanity checks. */ - if (ipproto == 0) + if (ipproto <= 0 || ipproto >= IPPROTO_MAX) return (EPROTONOSUPPORT); /* Check if the protocol was indeed registered. */ Modified: stable/7/sys/netinet/ip_var.h ============================================================================== --- stable/7/sys/netinet/ip_var.h Thu Sep 9 06:43:18 2010 (r212351) +++ stable/7/sys/netinet/ip_var.h Thu Sep 9 06:44:22 2010 (r212352) @@ -204,8 +204,8 @@ extern int int ip_output(struct mbuf *, struct mbuf *, struct route *, int, struct ip_moptions *, struct inpcb *); -int ipproto_register(u_char); -int ipproto_unregister(u_char); +int ipproto_register(short); +int ipproto_unregister(short); struct mbuf * ip_reass(struct mbuf *); struct in_ifaddr * Modified: stable/7/sys/netinet6/ip6_input.c ============================================================================== --- stable/7/sys/netinet6/ip6_input.c Thu Sep 9 06:43:18 2010 (r212351) +++ stable/7/sys/netinet6/ip6_input.c Thu Sep 9 06:44:22 2010 (r212352) @@ -182,6 +182,64 @@ ip6_init(void) ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; } +/* + * The protocol to be inserted into ip6_protox[] must be already registered + * in inet6sw[], either statically or through pf_proto_register(). + */ +int +ip6proto_register(short ip6proto) +{ + struct ip6protosw *pr; + + /* Sanity checks. */ + if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX) + return (EPROTONOSUPPORT); + + /* + * The protocol slot must not be occupied by another protocol + * already. An index pointing to IPPROTO_RAW is unused. + */ + pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); + if (pr == NULL) + return (EPFNOSUPPORT); + if (ip6_protox[ip6proto] != pr - inet6sw) /* IPPROTO_RAW */ + return (EEXIST); + + /* + * Find the protocol position in inet6sw[] and set the index. + */ + for (pr = (struct ip6protosw *)inet6domain.dom_protosw; + pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) { + if (pr->pr_domain->dom_family == PF_INET6 && + pr->pr_protocol && pr->pr_protocol == ip6proto) { + ip6_protox[pr->pr_protocol] = pr - inet6sw; + return (0); + } + } + return (EPROTONOSUPPORT); +} + +int +ip6proto_unregister(short ip6proto) +{ + struct ip6protosw *pr; + + /* Sanity checks. */ + if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX) + return (EPROTONOSUPPORT); + + /* Check if the protocol was indeed registered. */ + pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); + if (pr == NULL) + return (EPFNOSUPPORT); + if (ip6_protox[ip6proto] == pr - inet6sw) /* IPPROTO_RAW */ + return (ENOENT); + + /* Reset the protocol slot to IPPROTO_RAW. */ + ip6_protox[ip6proto] = pr - inet6sw; + return (0); +} + static void ip6_init2(void *dummy) { Modified: stable/7/sys/netinet6/ip6_var.h ============================================================================== --- stable/7/sys/netinet6/ip6_var.h Thu Sep 9 06:43:18 2010 (r212351) +++ stable/7/sys/netinet6/ip6_var.h Thu Sep 9 06:44:22 2010 (r212352) @@ -329,6 +329,9 @@ int icmp6_ctloutput __P((struct socket * struct in6_ifaddr; void ip6_init __P((void)); +int ip6proto_register(short); +int ip6proto_unregister(short); + void ip6_input __P((struct mbuf *)); struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); void ip6_freepcbopts __P((struct ip6_pktopts *)); From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 07:48:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E22EB10656BC; Thu, 9 Sep 2010 07:48:01 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D146D8FC16; Thu, 9 Sep 2010 07:48: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 o897m1T6048496; Thu, 9 Sep 2010 07:48:01 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o897m18J048492; Thu, 9 Sep 2010 07:48:01 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009090748.o897m18J048492@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 9 Sep 2010 07:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212353 - in vendor/tzcode/dist: libc/stdtime unused zic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 07:48:02 -0000 Author: edwin Date: Thu Sep 9 07:48:01 2010 New Revision: 212353 URL: http://svn.freebsd.org/changeset/base/212353 Log: Vendor import of tzcode2010l Modified: vendor/tzcode/dist/libc/stdtime/localtime.c vendor/tzcode/dist/unused/tz-link.htm vendor/tzcode/dist/zic/zdump.c Modified: vendor/tzcode/dist/libc/stdtime/localtime.c ============================================================================== --- vendor/tzcode/dist/libc/stdtime/localtime.c Thu Sep 9 06:44:22 2010 (r212352) +++ vendor/tzcode/dist/libc/stdtime/localtime.c Thu Sep 9 07:48:01 2010 (r212353) @@ -5,7 +5,7 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)localtime.c 8.13"; +static char elsieid[] = "@(#)localtime.c 8.14"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -274,34 +274,28 @@ settzname(void) return; } #endif /* defined ALL_STATE */ - for (i = 0; i < sp->typecnt; ++i) { - register const struct ttinfo * const ttisp = &sp->ttis[i]; + /* + ** And to get the latest zone names into tzname. . . + */ + for (i = 0; i < sp->timecnt; ++i) { + register const struct ttinfo * const ttisp = + &sp->ttis[ + sp->types[i]]; tzname[ttisp->tt_isdst] = &sp->chars[ttisp->tt_abbrind]; #ifdef USG_COMPAT if (ttisp->tt_isdst) daylight = 1; - if (i == 0 || !ttisp->tt_isdst) + if (!ttisp->tt_isdst) timezone = -(ttisp->tt_gmtoff); #endif /* defined USG_COMPAT */ #ifdef ALTZONE - if (i == 0 || ttisp->tt_isdst) + if (ttisp->tt_isdst) altzone = -(ttisp->tt_gmtoff); #endif /* defined ALTZONE */ } /* - ** And to get the latest zone names into tzname. . . - */ - for (i = 0; i < sp->timecnt; ++i) { - register const struct ttinfo * const ttisp = - &sp->ttis[ - sp->types[i]]; - - tzname[ttisp->tt_isdst] = - &sp->chars[ttisp->tt_abbrind]; - } - /* ** Finally, scrub the abbreviations. ** First, replace bogus characters. */ Modified: vendor/tzcode/dist/unused/tz-link.htm ============================================================================== --- vendor/tzcode/dist/unused/tz-link.htm Thu Sep 9 06:44:22 2010 (r212352) +++ vendor/tzcode/dist/unused/tz-link.htm Thu Sep 9 07:48:01 2010 (r212353) @@ -18,7 +18,7 @@

Sources for Time Zone and Daylight Saving Time Data

-@(#)tz-link.htm 8.26 +@(#)tz-link.htm 8.30

This file is in the public domain, so clarified as of @@ -89,6 +89,8 @@ the code is in the file tzcodeC is the code's version; similarly, the data are in tzdataD.tar.gz, where D is the data's version. +Each version is a four-digit year followed by lower-case letters +(a through z, then za through zz, then zza through zzz, and so on). The following shell commands download these files to a GNU/Linux or similar host; @@ -349,6 +351,17 @@ href="http://unicode.org/cldr/data/diff/ → Tzid table maintained by the CLDR data mentioned below. +

  • + +http://code.google.com/p/tzdata/ + +provides programming-language-specific representations of timezone +data. Currently this includes XML, PHP, Ruby, Javascript, JSON and CSV +formatted data. The repository is updated as soon as the FTP +distribution is updated. All data can be downloaded as a zip and/or it +can be obtained/synced via anonymous SVN. Data is made available under +the MIT license. (From Rich Tibbett.) +
  • Maps

      Modified: vendor/tzcode/dist/zic/zdump.c ============================================================================== --- vendor/tzcode/dist/zic/zdump.c Thu Sep 9 06:44:22 2010 (r212352) +++ vendor/tzcode/dist/zic/zdump.c Thu Sep 9 07:48:01 2010 (r212353) @@ -238,7 +238,7 @@ const char * const zone; static void usage(stream, status) FILE * const stream; -const int status +const int status; { (void) fprintf(stream, _("%s: usage is %s [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n\ From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 07:48:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2088C10656D0; Thu, 9 Sep 2010 07:48:57 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA4C78FC08; Thu, 9 Sep 2010 07:48: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 o897muH7048618; Thu, 9 Sep 2010 07:48:56 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o897muI3048617; Thu, 9 Sep 2010 07:48:56 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009090748.o897muI3048617@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 9 Sep 2010 07:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212354 - vendor/tzcode/tzcode2010l X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 07:48:57 -0000 Author: edwin Date: Thu Sep 9 07:48:56 2010 New Revision: 212354 URL: http://svn.freebsd.org/changeset/base/212354 Log: Tag of tzcode2010l Added: vendor/tzcode/tzcode2010l/ - copied from r212353, vendor/tzcode/dist/ From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 07:52:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3EC510656C0; Thu, 9 Sep 2010 07:52:15 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3A258FC28; Thu, 9 Sep 2010 07:52: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 o897qFw9048851; Thu, 9 Sep 2010 07:52:15 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o897qFDt048849; Thu, 9 Sep 2010 07:52:15 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009090752.o897qFDt048849@svn.freebsd.org> From: Ed Schouten Date: Thu, 9 Sep 2010 07:52: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: r212355 - head/sys/dev/atkbdc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 07:52:15 -0000 Author: ed Date: Thu Sep 9 07:52:15 2010 New Revision: 212355 URL: http://svn.freebsd.org/changeset/base/212355 Log: Let psm(4) use si_drv1 to refer to its softc. Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu Sep 9 07:48:56 2010 (r212354) +++ head/sys/dev/atkbdc/psm.c Thu Sep 9 07:52:15 2010 (r212355) @@ -143,11 +143,6 @@ __FBSDID("$FreeBSD$"); #define MOUSE_PS2PLUS_PACKET_TYPE(b) \ (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4)) -/* some macros */ -#define PSM_UNIT(dev) (dev2unit(dev) >> 1) -#define PSM_NBLOCKIO(dev) (dev2unit(dev) & 1) -#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1)) - /* ring buffer */ typedef struct ringbuf { int count; /* # of valid elements in the buffer */ @@ -305,8 +300,6 @@ struct psm_softc { /* Driver status inf struct sigio *async; /* Processes waiting for SIGIO */ }; static devclass_t psm_devclass; -#define PSM_SOFTC(unit) \ - ((struct psm_softc*)devclass_get_softc(psm_devclass, unit)) /* driver state flags (state) */ #define PSM_VALID 0x80 @@ -1457,10 +1450,10 @@ psmattach(device_t dev) } /* Done */ - sc->dev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666, - "psm%d", unit); - sc->bdev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666, - "bpsm%d", unit); + sc->dev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "psm%d", unit); + sc->dev->si_drv1 = sc; + sc->bdev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "bpsm%d", unit); + sc->bdev->si_drv1 = sc; if (!verbose) printf("psm%d: model %s, device ID %d\n", @@ -1504,14 +1497,13 @@ psmdetach(device_t dev) static int psmopen(struct cdev *dev, int flag, int fmt, struct thread *td) { - int unit = PSM_UNIT(dev); struct psm_softc *sc; int command_byte; int err; int s; /* Get device data */ - sc = PSM_SOFTC(unit); + sc = dev->si_drv1; if ((sc == NULL) || (sc->state & PSM_VALID) == 0) { /* the device is no longer valid/functioning */ return (ENXIO); @@ -1521,7 +1513,7 @@ psmopen(struct cdev *dev, int flag, int if (sc->state & PSM_OPEN) return (EBUSY); - device_busy(devclass_get_device(psm_devclass, unit)); + device_busy(devclass_get_device(psm_devclass, sc->unit)); /* Initialize state */ sc->mode.level = sc->dflt_mode.level; @@ -1565,7 +1557,8 @@ psmopen(struct cdev *dev, int flag, int kbdc_lock(sc->kbdc, FALSE); splx(s); log(LOG_ERR, - "psm%d: unable to set the command byte (psmopen).\n", unit); + "psm%d: unable to set the command byte (psmopen).\n", + sc->unit); return (EIO); } /* @@ -1590,8 +1583,7 @@ psmopen(struct cdev *dev, int flag, int static int psmclose(struct cdev *dev, int flag, int fmt, struct thread *td) { - int unit = PSM_UNIT(dev); - struct psm_softc *sc = PSM_SOFTC(unit); + struct psm_softc *sc = dev->si_drv1; int stat[3]; int command_byte; int s; @@ -1615,7 +1607,8 @@ psmclose(struct cdev *dev, int flag, int KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_ENABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { log(LOG_ERR, - "psm%d: failed to disable the aux int (psmclose).\n", unit); + "psm%d: failed to disable the aux int (psmclose).\n", + sc->unit); /* CONTROLLER ERROR; * NOTE: we shall force our way through. Because the only * ill effect we shall see is that we may not be able @@ -1643,12 +1636,13 @@ psmclose(struct cdev *dev, int flag, int */ log(LOG_ERR, "psm%d: failed to disable the device (psmclose).\n", - unit); + sc->unit); } if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) log(LOG_DEBUG, - "psm%d: failed to get status (psmclose).\n", unit); + "psm%d: failed to get status (psmclose).\n", + sc->unit); } if (!set_controller_command_byte(sc->kbdc, @@ -1661,7 +1655,7 @@ psmclose(struct cdev *dev, int flag, int */ log(LOG_ERR, "psm%d: failed to disable the aux port (psmclose).\n", - unit); + sc->unit); } /* remove anything left in the output buffer */ @@ -1676,7 +1670,7 @@ psmclose(struct cdev *dev, int flag, int /* close is almost always successful */ sc->state &= ~PSM_OPEN; kbdc_lock(sc->kbdc, FALSE); - device_unbusy(devclass_get_device(psm_devclass, unit)); + device_unbusy(devclass_get_device(psm_devclass, sc->unit)); return (0); } @@ -1745,7 +1739,7 @@ tame_mouse(struct psm_softc *sc, packetb static int psmread(struct cdev *dev, struct uio *uio, int flag) { - register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; u_char buf[PSM_SMALLBUFSIZE]; int error = 0; int s; @@ -1757,7 +1751,7 @@ psmread(struct cdev *dev, struct uio *ui /* block until mouse activity occured */ s = spltty(); while (sc->queue.count <= 0) { - if (PSM_NBLOCKIO(dev)) { + if (dev != sc->bdev) { splx(s); return (EWOULDBLOCK); } @@ -1892,7 +1886,7 @@ unblock_mouse_data(struct psm_softc *sc, static int psmwrite(struct cdev *dev, struct uio *uio, int flag) { - register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; u_char buf[PSM_SMALLBUFSIZE]; int error = 0, i, l; @@ -1925,7 +1919,7 @@ static int psmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { - struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; mousemode_t mode; mousestatus_t status; #if (defined(MOUSE_GETVARS)) @@ -3270,7 +3264,7 @@ psmsoftintr(void *arg) MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN, MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN }; - register struct psm_softc *sc = arg; + struct psm_softc *sc = arg; mousestatus_t ms; packetbuf_t *pb; int x, y, z, c, l, s; @@ -3519,7 +3513,7 @@ next: static int psmpoll(struct cdev *dev, int events, struct thread *td) { - struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); + struct psm_softc *sc = dev->si_drv1; int s; int revents = 0; From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 07:55:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E851065746; Thu, 9 Sep 2010 07:55:14 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17AD08FC0C; Thu, 9 Sep 2010 07:55: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 o897tDiV049061; Thu, 9 Sep 2010 07:55:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o897tDT7049059; Thu, 9 Sep 2010 07:55:13 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009090755.o897tDT7049059@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Sep 2010 07:55: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: r212356 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 07:55:14 -0000 Author: pjd Date: Thu Sep 9 07:55:13 2010 New Revision: 212356 URL: http://svn.freebsd.org/changeset/base/212356 Log: Remove VI_MOUNT flag from vnode on VFS_MOUNT() failure. Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Thu Sep 9 07:52:15 2010 (r212355) +++ head/sys/kern/vfs_mount.c Thu Sep 9 07:55:13 2010 (r212356) @@ -856,6 +856,9 @@ vfs_domount_first( if (error != 0) { vfs_unbusy(mp); vfs_mount_destroy(mp); + VI_LOCK(vp); + vp->v_iflag &= ~VI_MOUNT; + VI_UNLOCK(vp); vrele(vp); return (error); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 09:58:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0E2C10656F2; Thu, 9 Sep 2010 09:58:05 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE7F18FC08; Thu, 9 Sep 2010 09:58: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 o899w5DG060836; Thu, 9 Sep 2010 09:58:05 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o899w522060831; Thu, 9 Sep 2010 09:58:05 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009090958.o899w522060831@svn.freebsd.org> From: Rui Paulo Date: Thu, 9 Sep 2010 09:58: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: r212357 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/sys kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 09:58:05 -0000 Author: rpaulo Date: Thu Sep 9 09:58:05 2010 New Revision: 212357 URL: http://svn.freebsd.org/changeset/base/212357 Log: Fix two bugs in DTrace: * when the process exits, remove the associated USDT probes * when the process forks, duplicate the USDT probes. Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/kern/kern_fork.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Sep 9 07:55:13 2010 (r212356) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Sep 9 09:58:05 2010 (r212357) @@ -9218,7 +9218,6 @@ dtrace_difo_init(dtrace_difo_t *dp, dtra dtrace_difo_hold(dp); } -#if defined(sun) static dtrace_difo_t * dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate) { @@ -9262,7 +9261,6 @@ dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_difo_init(new, vstate); return (new); } -#endif static void dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate) @@ -14615,12 +14613,16 @@ dtrace_helpers_create(proc_t *p) } #if defined(sun) -static void -dtrace_helpers_destroy(void) +static +#endif +void +dtrace_helpers_destroy(proc_t *p) { dtrace_helpers_t *help; dtrace_vstate_t *vstate; +#if defined(sun) proc_t *p = curproc; +#endif int i; mutex_enter(&dtrace_lock); @@ -14707,7 +14709,10 @@ dtrace_helpers_destroy(void) mutex_exit(&dtrace_lock); } -static void +#if defined(sun) +static +#endif +void dtrace_helpers_duplicate(proc_t *from, proc_t *to) { dtrace_helpers_t *help, *newhelp; @@ -14788,7 +14793,6 @@ dtrace_helpers_duplicate(proc_t *from, p if (hasprovs) dtrace_helper_provider_register(to, newhelp, NULL); } -#endif #if defined(sun) /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 9 07:55:13 2010 (r212356) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 9 09:58:05 2010 (r212357) @@ -456,6 +456,16 @@ fasttrap_fork(proc_t *p, proc_t *cp) #if defined(sun) ASSERT(p->p_dtrace_count > 0); #else + if (p->p_dtrace_helpers) { + /* + * dtrace_helpers_duplicate() allocates memory. + */ + PROC_UNLOCK(p); + PROC_UNLOCK(cp); + dtrace_helpers_duplicate(p, cp); + PROC_LOCK(cp); + PROC_LOCK(p); + } /* * This check is purposely here instead of in kern_fork.c because, * for legal resons, we cannot include the dtrace_cddl.h header @@ -539,6 +549,10 @@ fasttrap_exec_exit(proc_t *p) * static probes are handled by the meta-provider remove entry point. */ fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0); +#if !defined(sun) + if (p->p_dtrace_helpers) + dtrace_helpers_destroy(p); +#endif PROC_LOCK(p); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Thu Sep 9 07:55:13 2010 (r212356) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Thu Sep 9 09:58:05 2010 (r212357) @@ -2289,6 +2289,11 @@ extern int dtrace_blksuword32(uintptr_t, extern void dtrace_getfsr(uint64_t *); #endif +#if !defined(sun) +extern void dtrace_helpers_duplicate(proc_t *, proc_t *); +extern void dtrace_helpers_destroy(proc_t *); +#endif + #define DTRACE_CPUFLAG_ISSET(flag) \ (cpu_core[curcpu].cpuc_dtrace_flags & (flag)) Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Thu Sep 9 07:55:13 2010 (r212356) +++ head/sys/kern/kern_fork.c Thu Sep 9 09:58:05 2010 (r212357) @@ -671,15 +671,6 @@ again: p2->p_pfsflags = p1->p_pfsflags; } -#ifdef KDTRACE_HOOKS - /* - * Tell the DTrace fasttrap provider about the new process - * if it has registered an interest. - */ - if (dtrace_fasttrap_fork) - dtrace_fasttrap_fork(p1, p2); -#endif - /* * This begins the section where we must prevent the parent * from being swapped. @@ -744,6 +735,21 @@ again: PROC_SLOCK(p2); p2->p_state = PRS_NORMAL; PROC_SUNLOCK(p2); +#ifdef KDTRACE_HOOKS + /* + * Tell the DTrace fasttrap provider about the new process + * if it has registered an interest. We have to do this only after + * p_state is PRS_NORMAL since the fasttrap module will use pfind() + * later on. + */ + if (dtrace_fasttrap_fork) { + PROC_LOCK(p1); + PROC_LOCK(p2); + dtrace_fasttrap_fork(p1, p2); + PROC_UNLOCK(p2); + PROC_UNLOCK(p1); + } +#endif /* * If RFSTOPPED not requested, make child runnable and add to From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 11:10:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5EF710656DE; Thu, 9 Sep 2010 11:10:15 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B48C38FC12; Thu, 9 Sep 2010 11:10: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 o89BAFJ1071495; Thu, 9 Sep 2010 11:10:15 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89BAFFF071493; Thu, 9 Sep 2010 11:10:15 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009091110.o89BAFFF071493@svn.freebsd.org> From: Rui Paulo Date: Thu, 9 Sep 2010 11:10: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: r212358 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 11:10:15 -0000 Author: rpaulo Date: Thu Sep 9 11:10:15 2010 New Revision: 212358 URL: http://svn.freebsd.org/changeset/base/212358 Log: Don't clobber an existing target object file when doing the DTrace linking process. This is needed because we change the source object files and the second this dtrace -G is run, no probes will be found. This hack allows us to build postgres with DTrace probes enabled. I'll try to find a way to fix this without needing this hack. Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Sep 9 09:58:05 2010 (r212357) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Sep 9 11:10:15 2010 (r212358) @@ -1616,6 +1616,18 @@ dtrace_program_link(dtrace_hdl_t *dtp, d int eprobes = 0, ret = 0; #if !defined(sun) + if (access(file, R_OK) == 0) { + fprintf(stderr, "dtrace: target object (%s) already exists. " + "Please remove the target\ndtrace: object and rebuild all " + "the source objects if you wish to run the DTrace\n" + "dtrace: linking process again\n", file); + /* + * Several build infrastructures run DTrace twice (e.g. + * postgres) and we don't want the build to fail. Return + * 0 here since this isn't really a fatal error. + */ + return (0); + } /* XXX Should get a temp file name here. */ snprintf(tfile, sizeof(tfile), "%s.tmp", file); #endif From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 13:17:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2103B10656DA; Thu, 9 Sep 2010 13:17:31 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F3DB8FC12; Thu, 9 Sep 2010 13:17: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 o89DHUmS086563; Thu, 9 Sep 2010 13:17:30 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89DHUQn086559; Thu, 9 Sep 2010 13:17:30 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009091317.o89DHUQn086559@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 9 Sep 2010 13:17: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: r212359 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 13:17:31 -0000 Author: nwhitehorn Date: Thu Sep 9 13:17:30 2010 New Revision: 212359 URL: http://svn.freebsd.org/changeset/base/212359 Log: Fix a problem where device detection would work unreliably on Serverworks K2 SATA controllers. The chip's status register must be read first, and as a long, for other registers to be correctly updated after a command, and this includes the command sequence in device detection as well as the previously handled case after interrupts. While here, clean up some previous hacks related to this controller. Reported by: many Reviewed by: mav MFC after: 3 weeks Modified: head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-lowlevel.c head/sys/dev/ata/chipsets/ata-serverworks.c Modified: head/sys/dev/ata/ata-all.h ============================================================================== --- head/sys/dev/ata/ata-all.h Thu Sep 9 11:10:15 2010 (r212358) +++ head/sys/dev/ata/ata-all.h Thu Sep 9 13:17:30 2010 (r212359) @@ -566,6 +566,7 @@ struct ata_channel { #define ATA_SATA 0x80 #define ATA_DMA_BEFORE_CMD 0x100 #define ATA_KNOWN_PRESENCE 0x200 +#define ATA_STATUS_IS_LONG 0x400 int pm_level; /* power management level */ int devices; /* what is present */ Modified: head/sys/dev/ata/ata-lowlevel.c ============================================================================== --- head/sys/dev/ata/ata-lowlevel.c Thu Sep 9 11:10:15 2010 (r212358) +++ head/sys/dev/ata/ata-lowlevel.c Thu Sep 9 13:17:30 2010 (r212359) @@ -516,10 +516,13 @@ ata_generic_reset(device_t dev) if ((mask & 0x01) && (stat0 & ATA_S_BUSY)) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_MASTER)); DELAY(10); + if (ch->flags & ATA_STATUS_IS_LONG) + stat0 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; + else + stat0 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - stat0 = ATA_IDX_INB(ch, ATA_STATUS); if (bootverbose) device_printf(dev, "stat0=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", @@ -546,10 +549,13 @@ ata_generic_reset(device_t dev) !((mask & 0x01) && (stat0 & ATA_S_BUSY))) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_SLAVE)); DELAY(10); + if (ch->flags & ATA_STATUS_IS_LONG) + stat1 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; + else + stat1 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - stat1 = ATA_IDX_INB(ch, ATA_STATUS); if (bootverbose) device_printf(dev, "stat1=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Thu Sep 9 11:10:15 2010 (r212358) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Thu Sep 9 13:17:30 2010 (r212359) @@ -58,9 +58,8 @@ static int ata_serverworks_ch_detach(dev static void ata_serverworks_tf_read(struct ata_request *request); static void ata_serverworks_tf_write(struct ata_request *request); static int ata_serverworks_setmode(device_t dev, int target, int mode); -#ifdef __powerpc__ +static void ata_serverworks_sata_reset(device_t dev); static int ata_serverworks_status(device_t dev); -#endif /* misc defines */ #define SWKS_33 0 @@ -101,7 +100,6 @@ ata_serverworks_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -#ifdef __powerpc__ static int ata_serverworks_status(device_t dev) { @@ -123,7 +121,6 @@ ata_serverworks_status(device_t dev) return ata_pci_status(dev); } -#endif static int ata_serverworks_chipinit(device_t dev) @@ -145,6 +142,7 @@ ata_serverworks_chipinit(device_t dev) ctlr->ch_detach = ata_serverworks_ch_detach; ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; + ctlr->reset = ata_serverworks_sata_reset; return 0; } else if (ctlr->chip->cfg1 == SWKS_33) { @@ -210,30 +208,20 @@ ata_serverworks_ch_attach(device_t dev) ch->r_io[ATA_SERROR].offset = ch_offset + 0x44; ch->r_io[ATA_SCONTROL].offset = ch_offset + 0x48; - ch->flags |= ATA_NO_SLAVE; - ch->flags |= ATA_SATA; + ch->flags |= ATA_NO_SLAVE | ATA_SATA | ATA_KNOWN_PRESENCE; ata_pci_hw(dev); ch->hw.tf_read = ata_serverworks_tf_read; ch->hw.tf_write = ata_serverworks_tf_write; -#ifdef __powerpc__ - ch->hw.status = ata_serverworks_status; -#endif if (ctlr->chip->chipid == ATA_K2) { /* - * The revision 1 K2 SATA controller has interesting bugs. Patch them. - * These magic numbers regulate interrupt delivery in the first few - * cases and are pure magic in the last case. - * - * Values obtained from the Darwin driver. + * Set SICR registers to turn off waiting for a status message + * before sending FIS. Values obtained from the Darwin driver. */ - ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, 0x04); - ATA_IDX_OUTL(ch, ATA_SERROR, 0xffffffff); - ATA_IDX_OUTL(ch, ATA_SCONTROL, 0x00000300); - ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0); ATA_OUTL(ctlr->r_res2, ch_offset + 0x80, ATA_INL(ctlr->r_res2, ch_offset + 0x80) & ~0x00040000); + ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0); /* * Some controllers have a bug where they will send the command @@ -244,6 +232,14 @@ ata_serverworks_ch_attach(device_t dev) */ ch->flags |= ATA_DMA_BEFORE_CMD; + + /* + * The status register must be read as a long to fill the other + * registers. + */ + + ch->hw.status = ata_serverworks_status; + ch->flags |= ATA_STATUS_IS_LONG; } /* chip does not reliably do 64K DMA transfers */ @@ -404,4 +400,15 @@ ata_serverworks_setmode(device_t dev, in return (mode); } +static void +ata_serverworks_sata_reset(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_sata_phy_reset(dev, -1, 1)) + ata_generic_reset(dev); + else + ch->devices = 0; +} + ATA_DECLARE_DRIVER(ata_serverworks); From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 13:32:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE75F1065673; Thu, 9 Sep 2010 13:32:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADA6B8FC19; Thu, 9 Sep 2010 13:32: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 o89DWwJ0087771; Thu, 9 Sep 2010 13:32:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89DWw9H087769; Thu, 9 Sep 2010 13:32:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009091332.o89DWw9H087769@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 9 Sep 2010 13:32: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: r212360 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 13:32:58 -0000 Author: nwhitehorn Date: Thu Sep 9 13:32:58 2010 New Revision: 212360 URL: http://svn.freebsd.org/changeset/base/212360 Log: On architectures with non-tree-based page tables like PowerPC, every page in a range must be checked when calling pmap_remove(). Calling pmap_remove() from vm_pageout_map_deactivate_pages() with the entire range of the map could result in attempting to demap an extraordinary number of pages (> 10^15), so iterate through each map entry and unmap each of them individually. MFC after: 6 weeks Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Thu Sep 9 13:17:30 2010 (r212359) +++ head/sys/vm/vm_pageout.c Thu Sep 9 13:32:58 2010 (r212360) @@ -701,8 +701,11 @@ vm_pageout_map_deactivate_pages(map, des * table pages. */ if (desired == 0 && nothingwired) { - pmap_remove(vm_map_pmap(map), vm_map_min(map), - vm_map_max(map)); + tmpe = map->header.next; + while (tmpe != &map->header) { + pmap_remove(vm_map_pmap(map), tmpe->start, tmpe->end); + tmpe = tmpe->next; + } } vm_map_unlock(map); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 15:45:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51C8E10656F5; Thu, 9 Sep 2010 15:45:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39CCD8FC24; Thu, 9 Sep 2010 15:45: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 o89FjB0g002227; Thu, 9 Sep 2010 15:45:11 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89FjBOq002225; Thu, 9 Sep 2010 15:45:11 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009091545.o89FjBOq002225@svn.freebsd.org> From: Rick Macklem Date: Thu, 9 Sep 2010 15:45: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: r212362 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 15:45:12 -0000 Author: rmacklem Date: Thu Sep 9 15:45:11 2010 New Revision: 212362 URL: http://svn.freebsd.org/changeset/base/212362 Log: Fix the experimental NFS client so that it doesn't panic when NFSv2,3 byte range locking is attempted. A fix that allows the nlm_advlock() to work with both clients is in progress, but may take a while. As such, I am doing this commit so that the kernel doesn't panic in the meantime. Submitted by: jh MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Thu Sep 9 13:38:36 2010 (r212361) +++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Sep 9 15:45:11 2010 (r212362) @@ -2939,8 +2939,10 @@ nfs_advlock(struct vop_advlock_args *ap) } else { if (ncl_advlock_p) error = ncl_advlock_p(ap); - else + else { + VOP_UNLOCK(vp, 0); error = ENOLCK; + } } } return (error); From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 16:06:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F94D10656D1; Thu, 9 Sep 2010 16:06:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F9918FC23; Thu, 9 Sep 2010 16:06: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 o89G6uOe003953; Thu, 9 Sep 2010 16:06:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89G6uw9003951; Thu, 9 Sep 2010 16:06:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009091606.o89G6uw9003951@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 9 Sep 2010 16:06: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: r212363 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 16:06:56 -0000 Author: nwhitehorn Date: Thu Sep 9 16:06:55 2010 New Revision: 212363 URL: http://svn.freebsd.org/changeset/base/212363 Log: Reorder statistics tracking and table lock acquisitions already in place to avoid race conditions updating the PVO statistics. Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Thu Sep 9 15:45:11 2010 (r212362) +++ head/sys/powerpc/aim/mmu_oea64.c Thu Sep 9 16:06:55 2010 (r212363) @@ -2424,7 +2424,6 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z * the bootstrap pool. */ - moea64_pvo_enter_calls++; first = 0; bootstrap = (flags & PVO_BOOTSTRAP); @@ -2444,6 +2443,8 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z */ LOCK_TABLE(); + moea64_pvo_enter_calls++; + LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) { if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && @@ -2608,14 +2609,15 @@ moea64_pvo_remove(struct pvo_entry *pvo) * if we aren't going to reuse it. */ LIST_REMOVE(pvo, pvo_olink); + + moea64_pvo_entries--; + moea64_pvo_remove_calls++; + UNLOCK_TABLE(); if (!(pvo->pvo_vaddr & PVO_BOOTSTRAP)) uma_zfree((pvo->pvo_vaddr & PVO_MANAGED) ? moea64_mpvo_zone : moea64_upvo_zone, pvo); - - moea64_pvo_entries--; - moea64_pvo_remove_calls++; } static struct pvo_entry * From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 16:20:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89AE01065697; Thu, 9 Sep 2010 16:20:04 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by mx1.freebsd.org (Postfix) with ESMTP id 597EA8FC1D; Thu, 9 Sep 2010 16:20:03 +0000 (UTC) Received: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 42D3228F70D; Thu, 9 Sep 2010 11:01:40 -0500 (CDT) X-Virus-Scanned: by amavis-2.6.4 at mh1.mail.rice.edu, auth channel Received: from mh1.mail.rice.edu ([127.0.0.1]) by mh1.mail.rice.edu (mh1.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id OdvSxPDBouxG; Thu, 9 Sep 2010 11:01:40 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id AFD7128F6BA; Thu, 9 Sep 2010 11:01:39 -0500 (CDT) Message-ID: <4C8904E3.9000907@rice.edu> Date: Thu, 09 Sep 2010 11:01:39 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.24 (X11/20100725) MIME-Version: 1.0 To: Nathan Whitehorn References: <201009091332.o89DWw9H087769@svn.freebsd.org> In-Reply-To: <201009091332.o89DWw9H087769@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212360 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 16:20:04 -0000 Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Thu Sep 9 13:32:58 2010 > New Revision: 212360 > URL: http://svn.freebsd.org/changeset/base/212360 > > Log: > On architectures with non-tree-based page tables like PowerPC, every page > in a range must be checked when calling pmap_remove(). Calling > pmap_remove() from vm_pageout_map_deactivate_pages() with the entire range > of the map could result in attempting to demap an extraordinary number > of pages (> 10^15), so iterate through each map entry and unmap each of > them individually. > > This is a machine-dependent issue, and so I will argue that it is the pmap's and not the machine-independent layer's responsibility to deal with this. Our sparc64 port faces the same problem with the TSB, and it deals with it internally. Moreover, the solution isn't that complicated. Is there any reason why the sparc64 solution can't be applied to powerpc? Regards, Alan From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 16:27:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 258531065694; Thu, 9 Sep 2010 16:27:03 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15A888FC0A; Thu, 9 Sep 2010 16:27: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 o89GR2l2005385; Thu, 9 Sep 2010 16:27:02 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89GR2gJ005383; Thu, 9 Sep 2010 16:27:02 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009091627.o89GR2gJ005383@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 9 Sep 2010 16:27: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: r212364 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 16:27:03 -0000 Author: mdf Date: Thu Sep 9 16:27:02 2010 New Revision: 212364 URL: http://svn.freebsd.org/changeset/base/212364 Log: Fix small errors in the sbuf(9) man page. Modified: head/share/man/man9/sbuf.9 Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Thu Sep 9 16:06:55 2010 (r212363) +++ head/share/man/man9/sbuf.9 Thu Sep 9 16:27:02 2010 (r212364) @@ -98,7 +98,7 @@ The .Nm family of functions allows one to safely allocate, construct and -release bounded null-terminated strings in kernel space. +release bounded NUL-terminated strings in kernel space. Instead of arrays of characters, these functions operate on structures called .Fa sbufs , @@ -289,7 +289,7 @@ overflowed. .Pp The .Fn sbuf_finish -function null-terminates the +function NUL-terminates the .Fa sbuf and marks it as finished, which means that it may no longer be modified using @@ -298,7 +298,10 @@ modified using .Fn sbuf_cpy , .Fn sbuf_printf or -.Fn sbuf_putc . +.Fn sbuf_putc , +until +.Fn sbuf_clear +is used to reset the sbuf. .Pp The .Fn sbuf_data @@ -309,7 +312,9 @@ functions return the actual string and i only works on a finished .Fa sbuf . .Fn sbuf_done -returns non-zero if the sbuf is finished. +returns non-zero if the +.Fa sbuf +is finished. .Sh NOTES If an operation caused an .Fa sbuf From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 16:51:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F31110656B3; Thu, 9 Sep 2010 16:51:52 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F4118FC25; Thu, 9 Sep 2010 16:51: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 o89GpqWH007052; Thu, 9 Sep 2010 16:51:52 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89Gpqeo007050; Thu, 9 Sep 2010 16:51:52 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009091651.o89Gpqeo007050@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 9 Sep 2010 16:51: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: r212365 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 16:51:52 -0000 Author: mdf Date: Thu Sep 9 16:51:52 2010 New Revision: 212365 URL: http://svn.freebsd.org/changeset/base/212365 Log: Refactor sbuf code so that most uses of sbuf_extend() are in a new sbuf_put_byte(). This makes it easier to add drain functionality when a buffer would overflow as there are fewer code points. Reviewed by: phk Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Thu Sep 9 16:27:02 2010 (r212364) +++ head/sys/kern/subr_sbuf.c Thu Sep 9 16:51:52 2010 (r212365) @@ -272,27 +272,59 @@ sbuf_setpos(struct sbuf *s, int pos) } /* + * Append a byte to an sbuf. This is the core function for appending + * to an sbuf and is the main place that deals with extending the + * buffer and marking overflow. + */ +static void +sbuf_put_byte(int c, struct sbuf *s) +{ + + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + if (SBUF_HASOVERFLOWED(s)) + return; + if (SBUF_FREESPACE(s) <= 0) { + if (sbuf_extend(s, 1) < 0) { + SBUF_SETFLAG(s, SBUF_OVERFLOWED); + return; + } + } + s->s_buf[s->s_len++] = c; +} + +/* + * Append a non-NUL character to an sbuf. This prototype signature is + * suitable for use with kvprintf(9). + */ +static void +sbuf_putc_func(int c, void *arg) +{ + + if (c != '\0') + sbuf_put_byte(c, arg); +} + +/* * Append a byte string to an sbuf. */ int sbuf_bcat(struct sbuf *s, const void *buf, size_t len) { const char *str = buf; + const char *end = str + len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); if (SBUF_HASOVERFLOWED(s)) return (-1); - for (; len; len--) { - if (!SBUF_HASROOM(s) && sbuf_extend(s, len) < 0) - break; - s->s_buf[s->s_len++] = *str++; - } - if (len > 0) { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); - } + for (; str < end; str++) { + sbuf_put_byte(*str, s); + if (SBUF_HASOVERFLOWED(s)) + return (-1); + } return (0); } @@ -352,13 +384,9 @@ sbuf_cat(struct sbuf *s, const char *str return (-1); while (*str != '\0') { - if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0) - break; - s->s_buf[s->s_len++] = *str++; - } - if (*str != '\0') { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); + sbuf_put_byte(*str, s); + if (SBUF_HASOVERFLOWED(s)) + return (-1); } return (0); } @@ -417,6 +445,23 @@ sbuf_cpy(struct sbuf *s, const char *str /* * Format the given argument list and append the resulting string to an sbuf. */ +#ifdef _KERNEL +int +sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) +{ + + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + KASSERT(fmt != NULL, + ("%s called with a NULL format string", __func__)); + + (void)kvprintf(fmt, sbuf_putc_func, s, 10, ap); + if (SBUF_HASOVERFLOWED(s)) + return (-1); + return (0); +} +#else /* !_KERNEL */ int sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) { @@ -432,6 +477,12 @@ sbuf_vprintf(struct sbuf *s, const char if (SBUF_HASOVERFLOWED(s)) return (-1); + /* + * For the moment, there is no way to get vsnprintf(3) to hand + * back a character at a time, to push everything into + * sbuf_putc_func() as was done for the kernel. + */ + do { va_copy(ap_copy, ap); len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1, @@ -462,6 +513,7 @@ sbuf_vprintf(struct sbuf *s, const char return (-1); return (0); } +#endif /* _KERNEL */ /* * Format the given arguments and append the resulting string to an sbuf. @@ -485,17 +537,9 @@ int sbuf_putc(struct sbuf *s, int c) { - assert_sbuf_integrity(s); - assert_sbuf_state(s, 0); - + sbuf_putc_func(c, s); if (SBUF_HASOVERFLOWED(s)) return (-1); - if (!SBUF_HASROOM(s) && sbuf_extend(s, 1) < 0) { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); - } - if (c != '\0') - s->s_buf[s->s_len++] = c; return (0); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 17:19:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80B8E10656D3; Thu, 9 Sep 2010 17:19:11 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from argol.doit.wisc.edu (argol.doit.wisc.edu [144.92.197.212]) by mx1.freebsd.org (Postfix) with ESMTP id 542C08FC17; Thu, 9 Sep 2010 17:19:11 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0L8H00A16MNPDT00@smtpauth3.wiscmail.wisc.edu>; Thu, 09 Sep 2010 11:19:01 -0500 (CDT) Received: from comporellon.tachypleus.net ([unknown] [76.210.68.10]) by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0L8H00457MNNRP90@smtpauth3.wiscmail.wisc.edu>; Thu, 09 Sep 2010 11:18:59 -0500 (CDT) Date: Thu, 09 Sep 2010 11:18:58 -0500 From: Nathan Whitehorn In-reply-to: <4C8904E3.9000907@rice.edu> To: Alan Cox Message-id: <4C8908F2.6050806@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.68.10 X-Spam-PmxInfo: Server=avs-9, Version=5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2010.9.9.160915, SenderIP=76.210.68.10 X-Enigmail-Version: 1.0.1 References: <201009091332.o89DWw9H087769@svn.freebsd.org> <4C8904E3.9000907@rice.edu> User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.11) Gecko/20100729 Thunderbird/3.0.6 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212360 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 17:19:11 -0000 On 09/09/10 11:01, Alan Cox wrote: > Nathan Whitehorn wrote: >> Author: nwhitehorn >> Date: Thu Sep 9 13:32:58 2010 >> New Revision: 212360 >> URL: http://svn.freebsd.org/changeset/base/212360 >> >> Log: >> On architectures with non-tree-based page tables like PowerPC, >> every page >> in a range must be checked when calling pmap_remove(). Calling >> pmap_remove() from vm_pageout_map_deactivate_pages() with the >> entire range >> of the map could result in attempting to demap an extraordinary number >> of pages (> 10^15), so iterate through each map entry and unmap >> each of >> them individually. >> > > This is a machine-dependent issue, and so I will argue that it is the > pmap's and not the machine-independent layer's responsibility to deal > with this. Our sparc64 port faces the same problem with the TSB, and > it deals with it internally. Moreover, the solution isn't that > complicated. Is there any reason why the sparc64 solution can't be > applied to powerpc? > > Regards, > Alan > It's really a pain. You have to either search the entire hashed page table after transforming the ranges from effective addresses into virtual addresses (and into a discontiguous set of ranges), which involves sorting through several hundred thousand or more entries, or every pmap needs to maintain a list of pages that belong to it at all times, which starts to duplicate the functionality of vm_map, as far as I understand it. The second approach seems to be the one followed by sparc64 (though I'm not very familiar with sparc64's pmap). This particular code seems to be the only place in the kernel that does giant deallocations or protection changes, and I didn't see a reason why this code would be any less efficient on architectures with tree-based tables than the previous one, so it seemed to minimize the number of required hacks just to change it here. If it actually is worse on x86, I'm happy to revert the change and try to hack around this in pmap. -Nathan From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 17:45:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A325110656F1; Thu, 9 Sep 2010 17:45:48 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 915B98FC14; Thu, 9 Sep 2010 17:45: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 o89HjmQt012522; Thu, 9 Sep 2010 17:45:48 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89Hjma0012518; Thu, 9 Sep 2010 17:45:48 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009091745.o89Hjma0012518@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 9 Sep 2010 17:45:48 +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: r212366 - head/sys/mips/rmi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 17:45:48 -0000 Author: jchandra Date: Thu Sep 9 17:45:48 2010 New Revision: 212366 URL: http://svn.freebsd.org/changeset/base/212366 Log: Clean up and update sys/mips/rmi/rmi_mips_exts.h - Provide 64 bit implementations for some macros. On n64 and n32, don't split 64 bit values. - No need for 32 bit ops for control registers. - Fix few bugs (write control reg, write_c0_register64). - Re-write EIRR/EIMR/CPUID operations using read_c0_registerXX, no need of inline assembly. - rename control reg access functions to avoid phnx, update callers. - stlye/whitespace fixes. Modified: head/sys/mips/rmi/rmi_mips_exts.h head/sys/mips/rmi/xlr_machdep.c head/sys/mips/rmi/xlr_pci.c Modified: head/sys/mips/rmi/rmi_mips_exts.h ============================================================================== --- head/sys/mips/rmi/rmi_mips_exts.h Thu Sep 9 16:51:52 2010 (r212365) +++ head/sys/mips/rmi/rmi_mips_exts.h Thu Sep 9 17:45:48 2010 (r212366) @@ -30,234 +30,286 @@ * $FreeBSD$ */ #ifndef __MIPS_EXTS_H__ -#define __MIPS_EXTS_H__ +#define __MIPS_EXTS_H__ -#define CPU_BLOCKID_IFU 0 -#define CPU_BLOCKID_ICU 1 -#define CPU_BLOCKID_IEU 2 -#define CPU_BLOCKID_LSU 3 -#define CPU_BLOCKID_MMU 4 -#define CPU_BLOCKID_PRF 5 - -#define LSU_CERRLOG_REGID 9 - -static __inline__ unsigned int read_32bit_phnx_ctrl_reg(int block, int reg) +#define CPU_BLOCKID_IFU 0 +#define CPU_BLOCKID_ICU 1 +#define CPU_BLOCKID_IEU 2 +#define CPU_BLOCKID_LSU 3 +#define CPU_BLOCKID_MMU 4 +#define CPU_BLOCKID_PRF 5 + +#define LSU_CERRLOG_REGID 9 + +#if defined(__mips_n64) || defined(__mips_n32) +static __inline uint64_t +read_xlr_ctrl_register(int block, int reg) { - unsigned int __res; + uint64_t res; + + __asm__ __volatile__( + ".set push\n\t" + ".set noreorder\n\t" + "move $9, %1\n\t" + ".word 0x71280018\n\t" /* mfcr $8, $9 */ + "move %0, $8\n\t" + ".set pop\n" + : "=r" (res) : "r"((block << 8) | reg) + : "$8", "$9" + ); + return (res); +} - __asm__ __volatile__( - ".set\tpush\n\t" - ".set\tnoreorder\n\t" - "move $9, %1\n" - /* "mfcr\t$8, $9\n\t" */ - ".word 0x71280018\n" - "move %0, $8\n" - ".set\tpop" - : "=r" (__res) : "r"((block<<8)|reg) - : "$8", "$9" - ); - return __res; -} - -static __inline__ void write_32bit_phnx_ctrl_reg(int block, int reg, unsigned int value) -{ - __asm__ __volatile__( - ".set\tpush\n\t" - ".set\tnoreorder\n\t" - "move $8, %0\n" - "move $9, %1\n" - /* "mtcr\t$8, $9\n\t" */ - ".word 0x71280019\n" - ".set\tpop" - : - : "r" (value), "r"((block<<8)|reg) - : "$8", "$9" - ); +static __inline void +write_xlr_ctrl_register(int block, int reg, uint64_t value) +{ + __asm__ __volatile__( + ".set push\n\t" + ".set noreorder\n\t" + "move $8, %0\n" + "move $9, %1\n" + ".word 0x71280019\n" /* mtcr $8, $9 */ + ".set pop\n" + : + : "r" (value), "r" ((block << 8) | reg) + : "$8", "$9" + ); } -static __inline__ unsigned long long read_64bit_phnx_ctrl_reg(int block, int reg) +#else /* !(defined(__mips_n64) || defined(__mips_n32)) */ + +static __inline uint64_t +read_xlr_ctrl_register(int block, int reg) { - unsigned int high, low; - - __asm__ __volatile__( - ".set\tmips64\n\t" - "move $9, %2\n" - /* "mfcr $8, $9\n" */ - ".word 0x71280018\n" - "dsrl32 %0, $8, 0\n\t" - "dsll32 $8, $8, 0\n\t" - "dsrl32 %1, $8, 0\n\t" - ".set mips0" - : "=r" (high), "=r"(low) - : "r"((block<<8)|reg) - : "$8", "$9" - ); - - return ( (((unsigned long long)high)<<32) | low); + uint32_t high, low; + + __asm__ __volatile__( + ".set push\n\t" + ".set noreorder\n\t" + ".set mips64\n\t" + "move $9, %2\n" + ".word 0x71280018\n" /* "mfcr $8, $9\n" */ + "dsra32 %0, $8, 0\n\t" + "sll %1, $8, 0\n\t" + ".set pop" + : "=r" (high), "=r"(low) + : "r" ((block << 8) | reg) + : "$8", "$9"); + + return ( (((uint64_t)high) << 32) | low); } -static __inline__ void write_64bit_phnx_ctrl_reg(int block, int reg,unsigned long long value) +static __inline void +write_xlr_ctrl_register(int block, int reg, uint64_t value) { - __uint32_t low, high; + uint32_t low, high; high = value >> 32; low = value & 0xffffffff; __asm__ __volatile__( - ".set push\n" - ".set noreorder\n" - ".set mips4\n\t" - /* Set up "rs" */ - "move $9, %0\n" - - /* Store 64 bit value in "rt" */ - "dsll32 $10, %1, 0 \n\t" - "dsll32 $8, %2, 0 \n\t" - "dsrl32 $8, $8, 0 \n\t" - "or $10, $8, $8 \n\t" - - ".word 0x71280019\n" /* mtcr $8, $9 */ - - ".set pop\n" - - : /* No outputs */ - : "r"((block<<8)|reg), "r" (high), "r" (low) - : "$8", "$9", "$10" - ); -} - -#define read_c0_register32(reg, sel) \ -({ unsigned int __rv; \ - __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set mips32\n\t" \ - "mfc0\t%0,$%1,%2\n\t" \ - ".set\tpop" \ - : "=r" (__rv) : "i" (reg), "i" (sel) ); \ - __rv;}) - -#define write_c0_register32(reg, sel, value) \ - __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set mips32\n\t" \ - "mtc0\t%0,$%1,%2\n\t" \ - ".set\tpop" \ - : : "r" (value), "i" (reg), "i" (sel) ); - -#define read_c0_register64(reg, sel) \ - ({ unsigned int __high, __low; \ - __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set mips64\n\t" \ - "dmfc0\t $8, $%2, %3\n\t" \ - "dsrl32\t%0, $8, 0\n\t" \ - "dsll32\t$8, $8, 0\n\t" \ - "dsrl32\t%1, $8, 0\n\t" \ - ".set\tpop" \ - : "=r"(__high), "=r"(__low): "i"(reg), "i"(sel): "$8" );\ - (((unsigned long long)__high << 32) | __low);}) - -#define write_c0_register64(reg, sel, value) \ - do{ \ - unsigned int __high = val>>32; \ - unsigned int __low = val & 0xffffffff; \ - __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set mips64\n\t" \ - "dsll32\t$8, %1, 0\n\t" \ - "dsll32\t$9, %0, 0\n\t" \ - "or\t $8, $8, $9\n\t" \ - "dmtc0\t $8, $%2, %3\n\t" \ - ".set\tpop" \ - :: "r"(high), "r"(low), "i"(reg), "i"(sel):"$8", "$9");\ - } while(0) - -#define read_c2_register32(reg, sel) \ -({ unsigned int __rv; \ - __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set mips32\n\t" \ - "mfc2\t%0,$%1,%2\n\t" \ - ".set\tpop" \ - : "=r" (__rv) : "i" (reg), "i" (sel) ); \ - __rv;}) - -#define write_c2_register32(reg, sel, value) \ - __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set mips32\n\t" \ - "mtc2\t%0,$%1,%2\n\t" \ - ".set\tpop" \ - : : "r" (value), "i" (reg), "i" (sel) ); - -#define read_c2_register64(reg, sel) \ - ({ unsigned int __high, __low; \ - __asm__ __volatile__( \ - ".set mips64\n\t" \ - "dmfc2\t $8, $%2, %3\n\t" \ - "dsrl32\t%0, $8, 0\n\t" \ - "dsll32\t$8, $8, 0\n\t" \ - "dsrl32\t%1, $8, 0\n\t" \ - ".set\tmips0" \ - : "=r"(__high), "=r"(__low): "i"(reg), "i"(sel): "$8" );\ - (((unsigned long long)__high << 32) | __low);}) - -#define write_c2_register64(reg, sel, value) \ - do{ \ - unsigned int __high = value>>32; \ - unsigned int __low = value & 0xffffffff; \ - __asm__ __volatile__( \ - ".set mips64\n\t" \ - "dsll32\t$8, %1, 0\n\t" \ - "dsll32\t$9, %0, 0\n\t" \ - "dsrl32\t$8, $8, 0\n\t" \ - "or\t $8, $8, $9\n\t" \ - "dmtc2\t $8, $%2, %3\n\t" \ - ".set\tmips0" \ - :: "r"(__high), "r"(__low), \ - "i"(reg), "i"(sel) \ - :"$8", "$9"); \ - } while(0) - -#define xlr_cpu_id() \ -({int __id; \ - __asm__ __volatile__ ( \ - ".set push\n" \ - ".set noreorder\n" \ - "mfc0 $8, $15, 1\n" \ - "andi %0, $8, 0x1f\n" \ - ".set pop\n" \ - : "=r" (__id) : : "$8"); \ - __id;}) - -#define xlr_core_id() \ -({int __id; \ - __asm__ __volatile__ ( \ - ".set push\n" \ - ".set noreorder\n" \ - "mfc0 $8, $15, 1\n" \ - "andi %0, $8, 0x1f\n" \ - ".set pop\n" \ - : "=r" (__id) : : "$8"); \ - __id/4;}) - -#define xlr_thr_id() \ -({int __id; \ - __asm__ __volatile__ ( \ - ".set push\n" \ - ".set noreorder\n" \ - "mfc0 $8, $15, 1\n" \ - "andi %0, $8, 0x3\n" \ - ".set pop\n" \ - : "=r" (__id) : : "$8"); \ - __id;}) + ".set push\n\t" + ".set noreorder\n\t" + ".set mips64\n\t" + "dsll32 $9, %0, 0\n\t" + "dsll32 $8, %1, 0\n\t" + "dsrl32 $8, $8, 0\n\t" + "or $8, $9, $8\n\t" + "move $9, %2\n\t" + ".word 0x71280019\n\t" /* mtcr $8, $9 */ + ".set pop\n" + : /* No outputs */ + : "r" (high), "r" (low), "r"((block << 8) | reg) + : "$8", "$9"); +} +#endif /* defined(__mips_n64) || defined(__mips_n32) */ +/* + * 32 bit read write for c0 + */ +#define read_c0_register32(reg, sel) \ +({ \ + uint32_t __rv; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips32\n\t" \ + "mfc0 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : "=r" (__rv) : "i" (reg), "i" (sel) ); \ + __rv; \ + }) + +#define write_c0_register32(reg, sel, value) \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips32\n\t" \ + "mtc0 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : : "r" (value), "i" (reg), "i" (sel) ); + +#define read_c2_register32(reg, sel) \ +({ \ + uint32_t __rv; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips32\n\t" \ + "mfc2 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : "=r" (__rv) : "i" (reg), "i" (sel) ); \ + __rv; \ + }) + +#define write_c2_register32(reg, sel, value) \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips32\n\t" \ + "mtc2 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : : "r" (value), "i" (reg), "i" (sel) ); + +#if defined(__mips_n64) || defined(__mips_n32) +/* + * On 64 bit compilation, the operations are simple + */ +#define read_c0_register64(reg, sel) \ +({ \ + uint64_t __rv; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips64\n\t" \ + "dmfc0 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : "=r" (__rv) : "i" (reg), "i" (sel) ); \ + __rv; \ + }) + +#define write_c0_register64(reg, sel, value) \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips64\n\t" \ + "dmtc0 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : : "r" (value), "i" (reg), "i" (sel) ); + +#define read_c2_register64(reg, sel) \ +({ \ + uint64_t __rv; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips64\n\t" \ + "dmfc2 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : "=r" (__rv) : "i" (reg), "i" (sel) ); \ + __rv; \ + }) + +#define write_c2_register64(reg, sel, value) \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set mips64\n\t" \ + "dmtc2 %0, $%1, %2\n\t" \ + ".set pop\n" \ + : : "r" (value), "i" (reg), "i" (sel) ); -/* Additional registers on the XLR */ -#define MIPS_COP_0_OSSCRATCH 22 +#else /* ! (defined(__mips_n64) || defined(__mips_n32)) */ -#define XLR_CACHELINE_SIZE 32 +/* + * 32 bit compilation, 64 bit values has to split + */ +#define read_c0_register64(reg, sel) \ +({ \ + uint32_t __high, __low; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + ".set mips64\n\t" \ + "dmfc0 $8, $%2, %3\n\t" \ + "dsra32 %0, $8, 0\n\t" \ + "sll %1, $8, 0\n\t" \ + ".set pop\n" \ + : "=r"(__high), "=r"(__low): "i"(reg), "i"(sel) \ + : "$8"); \ + ((uint64_t)__high << 32) | __low; \ +}) + +#define write_c0_register64(reg, sel, value) \ +do { \ + uint32_t __high = value >> 32; \ + uint32_t __low = value & 0xffffffff; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + ".set mips64\n\t" \ + "dsll32 $8, %1, 0\n\t" \ + "dsll32 $9, %0, 0\n\t" \ + "dsrl32 $8, $8, 0\n\t" \ + "or $8, $8, $9\n\t" \ + "dmtc0 $8, $%2, %3\n\t" \ + ".set pop" \ + :: "r"(__high), "r"(__low), "i"(reg), "i"(sel) \ + :"$8", "$9"); \ +} while(0) + +#define read_c2_register64(reg, sel) \ +({ \ + uint32_t __high, __low; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + ".set mips64\n\t" \ + "dmfc2 $8, $%2, %3\n\t" \ + "dsra32 %0, $8, 0\n\t" \ + "sll %1, $8, 0\n\t" \ + ".set pop\n" \ + : "=r"(__high), "=r"(__low): "i"(reg), "i"(sel) \ + : "$8"); \ + ((uint64_t)__high << 32) | __low; \ +}) + +#define write_c2_register64(reg, sel, value) \ +do { \ + uint32_t __high = value >> 32; \ + uint32_t __low = value & 0xffffffff; \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + ".set mips64\n\t" \ + "dsll32 $8, %1, 0\n\t" \ + "dsll32 $9, %0, 0\n\t" \ + "dsrl32 $8, $8, 0\n\t" \ + "or $8, $8, $9\n\t" \ + "dmtc2 $8, $%2, %3\n\t" \ + ".set pop" \ + :: "r"(__high), "r"(__low), "i"(reg), "i"(sel) \ + :"$8", "$9"); \ +} while(0) -#define XLR_MAX_CORES 8 +#endif /* defined(__mips_n64) || defined(__mips_n32) */ + +static __inline int +xlr_cpu_id(void) +{ + + return (read_c0_register32(15, 1) & 0x1f); +} + +static __inline int +xlr_core_id(void) +{ + + return (xlr_cpu_id() / 4); +} + +static __inline int +xlr_thr_id(void) +{ + + return (read_c0_register32(15, 1) & 0x3); +} + +/* Additional registers on the XLR */ +#define MIPS_COP_0_OSSCRATCH 22 +#define XLR_CACHELINE_SIZE 32 +#define XLR_MAX_CORES 8 /* functions to write to and read from the extended * cp0 registers. @@ -268,109 +320,32 @@ static __inline__ void write_64bit_phnx_ * cp0 register 9 sel 7 * bits 0...7 are same as status register 8...15 */ - -static inline uint64_t +static __inline uint64_t read_c0_eirr64(void) { - __uint32_t high, low; - - __asm__ __volatile__( - ".set push\n" - ".set noreorder\n" - ".set noat\n" - ".set mips4\n" - - ".word 0x40214806 \n\t" - "nop \n\t" - "dsra32 %0, $1, 0 \n\t" - "sll %1, $1, 0 \n\t" - - ".set pop\n" - - : "=r"(high), "=r"(low) - ); - return (((__uint64_t) high) << 32) | low; + return (read_c0_register64(9, 6)); } -static inline __uint64_t -read_c0_eimr64(void) +static __inline void +write_c0_eirr64(uint64_t val) { - __uint32_t high, low; - - __asm__ __volatile__( - ".set push\n" - ".set noreorder\n" - ".set noat\n" - ".set mips4\n" - - ".word 0x40214807 \n\t" - "nop \n\t" - "dsra32 %0, $1, 0 \n\t" - "sll %1, $1, 0 \n\t" - - ".set pop\n" - : "=r"(high), "=r"(low) - ); - - return (((__uint64_t) high) << 32) | low; + write_c0_register64(9, 6, val); } -static inline void -write_c0_eirr64(__uint64_t value) +static __inline uint64_t +read_c0_eimr64(void) { - __uint32_t low, high; - - high = value >> 32; - low = value & 0xffffffff; - - __asm__ __volatile__( - ".set push\n" - ".set noreorder\n" - ".set noat\n" - ".set mips4\n\t" - - "dsll32 $2, %1, 0 \n\t" - "dsll32 $1, %0, 0 \n\t" - "dsrl32 $2, $2, 0 \n\t" - "or $1, $1, $2 \n\t" - ".word 0x40a14806 \n\t" - "nop \n\t" - ".set pop\n" - - : - : "r"(high), "r"(low) - : "$1", "$2"); + return (read_c0_register64(9, 7)); } -static inline void -write_c0_eimr64(__uint64_t value) +static __inline void +write_c0_eimr64(uint64_t val) { - __uint32_t low, high; - - high = value >> 32; - low = value & 0xffffffff; - - __asm__ __volatile__( - ".set push\n" - ".set noreorder\n" - ".set noat\n" - ".set mips4\n\t" - - "dsll32 $2, %1, 0 \n\t" - "dsll32 $1, %0, 0 \n\t" - "dsrl32 $2, $2, 0 \n\t" - "or $1, $1, $2 \n\t" - ".word 0x40a14807 \n\t" - "nop \n\t" - ".set pop\n" - - : - : "r"(high), "r"(low) - : "$1", "$2"); + write_c0_register64(9, 7, val); } static __inline__ int @@ -378,17 +353,18 @@ xlr_test_and_set(int *lock) { int oldval = 0; - __asm__ __volatile__(".set push\n" - ".set noreorder\n" - "move $9, %2\n" - "li $8, 1\n" + __asm__ __volatile__( + ".set push\n" + ".set noreorder\n" + "move $9, %2\n" + "li $8, 1\n" // "swapw $8, $9\n" - ".word 0x71280014\n" - "move %1, $8\n" - ".set pop\n" - : "+m"(*lock), "=r"(oldval) - : "r"((unsigned long)lock) - : "$8", "$9" + ".word 0x71280014\n" + "move %1, $8\n" + ".set pop\n" + : "+m"(*lock), "=r"(oldval) + : "r"((unsigned long)lock) + : "$8", "$9" ); return (oldval == 0 ? 1 /* success */ : 0 /* failure */ ); @@ -400,11 +376,11 @@ xlr_mfcr(uint32_t reg) uint32_t val; __asm__ __volatile__( - "move $8, %1\n" - ".word 0x71090018\n" - "move %0, $9\n" - : "=r"(val) - : "r"(reg):"$8", "$9"); + "move $8, %1\n" + ".word 0x71090018\n" + "move %0, $9\n" + : "=r"(val) + : "r"(reg):"$8", "$9"); return val; } @@ -413,35 +389,63 @@ static __inline__ void xlr_mtcr(uint32_t reg, uint32_t val) { __asm__ __volatile__( - "move $8, %1\n" - "move $9, %0\n" - ".word 0x71090019\n" - :: "r"(val), "r"(reg) - : "$8", "$9"); + "move $8, %1\n" + "move $9, %0\n" + ".word 0x71090019\n" + :: "r"(val), "r"(reg) + : "$8", "$9"); } +#if defined(__mips_n64) static __inline__ uint32_t xlr_paddr_lw(uint64_t paddr) { - uint32_t high, low, tmp; + + paddr |= 0x9800000000000000ULL; + return (*(uint32_t *)(uintptr_t)paddr); +} - high = 0x98000000 | (paddr >> 32); - low = paddr & 0xffffffff; +#elif defined(__mips_n32) +static __inline__ uint32_t +xlr_paddr_lw(uint64_t paddr) +{ + uint32_t val; - __asm__ __volatile__( - ".set push \n\t" - ".set mips64 \n\t" - "dsll32 %1, %1, 0 \n\t" - "dsll32 %2, %2, 0 \n\t" /* get rid of the */ - "dsrl32 %2, %2, 0 \n\t" /* sign extend */ - "or %1, %1, %2 \n\t" - "lw %0, 0(%1) \n\t" - ".set pop \n" - : "=r"(tmp) - : "r"(high), "r"(low)); + paddr |= 0x9800000000000000ULL; + __asm__ __volatile__( + ".set push \n\t" + ".set mips64 \n\t" + "lw %0, 0(%1) \n\t" + ".set pop \n" + : "=r"(val) + : "r"(paddr)); + + return (val); +} +#else +static __inline__ uint32_t +xlr_paddr_lw(uint64_t paddr) +{ + uint32_t high, low, tmp; + + high = 0x98000000 | (paddr >> 32); + low = paddr & 0xffffffff; + + __asm__ __volatile__( + ".set push \n\t" + ".set mips64 \n\t" + "dsll32 %1, %1, 0 \n\t" + "dsll32 %2, %2, 0 \n\t" /* get rid of the */ + "dsrl32 %2, %2, 0 \n\t" /* sign extend */ + "or %1, %1, %2 \n\t" + "lw %0, 0(%1) \n\t" + ".set pop \n" + : "=r"(tmp) + : "r"(high), "r"(low)); return tmp; } +#endif /* for cpuid to hardware thread id mapping */ extern uint32_t xlr_hw_thread_mask; Modified: head/sys/mips/rmi/xlr_machdep.c ============================================================================== --- head/sys/mips/rmi/xlr_machdep.c Thu Sep 9 16:51:52 2010 (r212365) +++ head/sys/mips/rmi/xlr_machdep.c Thu Sep 9 17:45:48 2010 (r212366) @@ -105,7 +105,7 @@ int xlr_hwtid_to_cpuid[MAXCPU]; static void xlr_setup_mmu_split(void) { - int mmu_setup; + uint64_t mmu_setup; int val = 0; if (xlr_threads_per_core == 4 && xlr_shtlb_enabled == 0) @@ -120,7 +120,7 @@ xlr_setup_mmu_split(void) val = 3; break; } - mmu_setup = read_32bit_phnx_ctrl_reg(4, 0); + mmu_setup = read_xlr_ctrl_register(4, 0); mmu_setup = mmu_setup & ~0x06; mmu_setup |= (val << 1); @@ -128,7 +128,7 @@ xlr_setup_mmu_split(void) if (xlr_shtlb_enabled) mmu_setup |= 0x01; - write_32bit_phnx_ctrl_reg(4, 0, mmu_setup); + write_xlr_ctrl_register(4, 0, mmu_setup); } static void Modified: head/sys/mips/rmi/xlr_pci.c ============================================================================== --- head/sys/mips/rmi/xlr_pci.c Thu Sep 9 16:51:52 2010 (r212365) +++ head/sys/mips/rmi/xlr_pci.c Thu Sep 9 17:45:48 2010 (r212366) @@ -203,11 +203,11 @@ disable_and_clear_cache_error(void) { uint64_t lsu_cfg0; - lsu_cfg0 = read_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CFG0_REGID); + lsu_cfg0 = read_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CFG0_REGID); lsu_cfg0 = lsu_cfg0 & ~0x2e; - write_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CFG0_REGID, lsu_cfg0); + write_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CFG0_REGID, lsu_cfg0); /* Clear cache error log */ - write_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CERRLOG_REGID, 0); + write_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CERRLOG_REGID, 0); } static __inline__ void @@ -216,13 +216,13 @@ clear_and_enable_cache_error(void) uint64_t lsu_cfg0 = 0; /* first clear the cache error logging register */ - write_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CERRLOG_REGID, 0); - write_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CERROVF_REGID, 0); - write_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CERRINT_REGID, 0); + write_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CERRLOG_REGID, 0); + write_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CERROVF_REGID, 0); + write_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CERRINT_REGID, 0); - lsu_cfg0 = read_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CFG0_REGID); + lsu_cfg0 = read_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CFG0_REGID); lsu_cfg0 = lsu_cfg0 | 0x2e; - write_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, LSU_CFG0_REGID, lsu_cfg0); + write_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CFG0_REGID, lsu_cfg0); } static uint32_t @@ -236,7 +236,7 @@ pci_cfg_read_32bit(uint32_t addr) temp = bswap32(*p); /* Read cache err log */ - cerr_cpu_log = read_64bit_phnx_ctrl_reg(CPU_BLOCKID_LSU, + cerr_cpu_log = read_xlr_ctrl_register(CPU_BLOCKID_LSU, LSU_CERRLOG_REGID); if (cerr_cpu_log) { /* Device don't exist. */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 17:49:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2218010656D6; Thu, 9 Sep 2010 17:49:19 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 108F28FC0A; Thu, 9 Sep 2010 17:49: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 o89HnJtN012860; Thu, 9 Sep 2010 17:49:19 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89HnI0q012855; Thu, 9 Sep 2010 17:49:18 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009091749.o89HnI0q012855@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 9 Sep 2010 17:49: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: r212367 - in head: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 17:49:19 -0000 Author: mdf Date: Thu Sep 9 17:49:18 2010 New Revision: 212367 URL: http://svn.freebsd.org/changeset/base/212367 Log: Add drain functionality to sbufs. The drain is a function that is called when the sbuf internal buffer is filled. For kernel sbufs with a drain, the internal buffer will never be expanded. For userland sbufs with a drain, the internal buffer may still be expanded by sbuf_[v]printf(3). Sbufs now have three basic uses: 1) static string manipulation. Overflow is marked. 2) dynamic string manipulation. Overflow triggers string growth. 3) drained string manipulation. Overflow triggers draining. In all cases the manipulation is 'safe' in that overflow is detected and managed. Reviewed by: phk (the previous version) Modified: head/share/man/man9/Makefile head/share/man/man9/sbuf.9 head/sys/kern/subr_sbuf.c head/sys/sys/sbuf.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Sep 9 17:45:48 2010 (r212366) +++ head/share/man/man9/Makefile Thu Sep 9 17:49:18 2010 (r212367) @@ -1031,6 +1031,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_overflowed.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_putc.9 \ + sbuf.9 sbuf_set_drain.9 \ sbuf.9 sbuf_setpos.9 \ sbuf.9 sbuf_trim.9 \ sbuf.9 sbuf_vprintf.9 Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Thu Sep 9 17:45:48 2010 (r212366) +++ head/share/man/man9/sbuf.9 Thu Sep 9 17:49:18 2010 (r212367) @@ -43,6 +43,7 @@ .Nm sbuf_printf , .Nm sbuf_vprintf , .Nm sbuf_putc , +.Nm sbuf_set_drain , .Nm sbuf_trim , .Nm sbuf_overflowed , .Nm sbuf_finish , @@ -54,6 +55,8 @@ .Sh SYNOPSIS .In sys/types.h .In sys/sbuf.h +.Ft typedef\ int ( sbuf_drain_func ) ( void\ *arg, const\ char\ *data, int\ len ) ; +.Pp .Ft struct sbuf * .Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags" .Ft struct sbuf * @@ -80,11 +83,13 @@ .Fn sbuf_vprintf "struct sbuf *s" "const char *fmt" "va_list ap" .Ft int .Fn sbuf_putc "struct sbuf *s" "int c" +.Ft void +.Fn sbuf_set_drain "struct sbuf *s" "sbuf_drain_func *func" "void *arg" .Ft int .Fn sbuf_trim "struct sbuf *s" .Ft int .Fn sbuf_overflowed "struct sbuf *s" -.Ft void +.Ft int .Fn sbuf_finish "struct sbuf *s" .Ft char * .Fn sbuf_data "struct sbuf *s" @@ -224,6 +229,51 @@ to the at the current position. .Pp The +.Fn sbuf_set_drain +function sets a drain function +.Fa func +for the +.Fa sbuf , +and records a pointer +.Fa arg +to be passed to the drain on callback. +The drain function cannot be changed while +.Fa sbuf_len +is non-zero. +.Pp +The registered drain function +.Vt sbuf_drain_func +will be called with the argument +.Fa arg +provided to +.Fn sbuf_set_drain , +a pointer +.Fa data +to a byte string that is the contents of the sbuf, and the length +.Fa len +of the data. +If the drain function exists, it will be called when the sbuf internal +buffer is full, or on behalf of +.Fn sbuf_finish . +The drain function may drain some or all of the data, but must drain +at least 1 byte. +The return value from the drain function, if positive, indicates how +many bytes were drained. +If negative, the return value indicates the negative error code which +will be returned from this or a later call to +.Fn sbuf_finish . +The returned drained length cannot be zero. +To do unbuffered draining, initialize the sbuf with a two-byte buffer. +The drain will be called for every byte added to the sbuf. +The +.Fn sbuf_bcopyin , +.Fn sbuf_copyin , +.Fn sbuf_trim , +and +.Fn sbuf_data +functions cannot be used on an sbuf with a drain. +.Pp +The .Fn sbuf_copyin function copies a NUL-terminated string from the specified userland address into the @@ -289,10 +339,17 @@ overflowed. .Pp The .Fn sbuf_finish -function NUL-terminates the +function will call the attached drain function if one exists until all +the data in the .Fa sbuf -and marks it as finished, which means that it may no longer be -modified using +is flushed. +If there is no attached drain, +.Fn sbuf_finish +NUL-terminates the +.Fa sbuf . +In either case it marks the +.Fa sbuf +as finished, which means that it may no longer be modified using .Fn sbuf_setpos , .Fn sbuf_cat , .Fn sbuf_cpy , @@ -305,12 +362,21 @@ is used to reset the sbuf. .Pp The .Fn sbuf_data -and -.Fn sbuf_len -functions return the actual string and its length, respectively; +function returns the actual string; .Fn sbuf_data only works on a finished .Fa sbuf . +The +.Fn sbuf_len function returns the length of the string. +For an +.Fa sbuf +with an attached drain, +.Fn sbuf_len +returns the length of the un-drained data. +.Fn sbuf_done +returns non-zero if the +.Fa sbuf +is finished. .Fn sbuf_done returns non-zero if the .Fa sbuf @@ -329,6 +395,22 @@ size of its storage buffer using .Fn sbuf_setpos , or it is reinitialized to a sufficiently short string using .Fn sbuf_cpy . +.Pp +Drains in user-space will not always function as indicated. +While the drain function will be called immediately on overflow from +the +.Fa sbuf_putc , +.Fa sbuf_bcat , +.Fa sbuf_cat +functions, +.Fa sbuf_printf +and +.Fa sbuf_vprintf +currently have no way to determine whether there will be an overflow +until after it occurs, and cannot do a partial expansion of the format +string. +Thus when using libsbuf the buffer may be extended to allow completion +of a single printf call, even though a drain is attached. .Sh RETURN VALUES The .Fn sbuf_new @@ -372,6 +454,14 @@ The function returns \-1 if copying string from userland failed, and number of bytes copied otherwise. +The +.Fn sbuf_finish +function returns ENOMEM if the sbuf overflowed before being finished, +or returns the error code from the drain if one is attached. +When used as +.Xr sbuf_finish 3 , +.Fn sbuf_finish +will return \-1 and set errno on error instead. .Sh SEE ALSO .Xr printf 3 , .Xr strcat 3 , @@ -396,6 +486,8 @@ Additional improvements were suggested b .An Justin T. Gibbs Aq gibbs@FreeBSD.org . Auto-extend support added by .An Kelly Yancey Aq kbyanc@FreeBSD.org . +Drain functionality added by +.An Matthew Fleming Aq mdf@FreeBSD.org . .Pp This manual page was written by .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Thu Sep 9 17:45:48 2010 (r212366) +++ head/sys/kern/subr_sbuf.c Thu Sep 9 17:49:18 2010 (r212367) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL #include +#include #include #include #include @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #else /* _KERNEL */ #include +#include #include #include #include @@ -246,6 +248,7 @@ sbuf_clear(struct sbuf *s) SBUF_CLEARFLAG(s, SBUF_FINISHED); SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); + s->s_error = 0; s->s_len = 0; } @@ -272,6 +275,54 @@ sbuf_setpos(struct sbuf *s, int pos) } /* + * Set up a drain function and argument on an sbuf to flush data to + * when the sbuf buffer overflows. + */ +void +sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx) +{ + + assert_sbuf_state(s, 0); + assert_sbuf_integrity(s); + KASSERT(func == s->s_drain_func || s->s_len == 0, + ("Cannot change drain to %p on non-empty sbuf %p", func, s)); + s->s_drain_func = func; + s->s_drain_arg = ctx; +} + +/* + * Call the drain and process the return. + */ +static int +sbuf_drain(struct sbuf *s) +{ + int len; + + KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s)); + len = s->s_drain_func(s->s_drain_arg, s->s_buf, s->s_len); + if (len < 0) { + s->s_error = -len; + SBUF_SETFLAG(s, SBUF_OVERFLOWED); + return (s->s_error); + } + + KASSERT(len > 0, ("Drain must either error or work!")); + s->s_len -= len; + /* + * Fast path for the expected case where all the data was + * drained. + */ + if (s->s_len == 0) + return (0); + /* + * Move the remaining characters to the beginning of the + * string. + */ + memmove(s->s_buf, s->s_buf + len, s->s_len); + return (0); +} + +/* * Append a byte to an sbuf. This is the core function for appending * to an sbuf and is the main place that deals with extending the * buffer and marking overflow. @@ -286,10 +337,16 @@ sbuf_put_byte(int c, struct sbuf *s) if (SBUF_HASOVERFLOWED(s)) return; if (SBUF_FREESPACE(s) <= 0) { - if (sbuf_extend(s, 1) < 0) { + /* + * If there is a drain, use it, otherwise extend the + * buffer. + */ + if (s->s_drain_func != NULL) + (void)sbuf_drain(s); + else if (sbuf_extend(s, 1) < 0) SBUF_SETFLAG(s, SBUF_OVERFLOWED); + if (SBUF_HASOVERFLOWED(s)) return; - } } s->s_buf[s->s_len++] = c; } @@ -338,6 +395,8 @@ sbuf_bcopyin(struct sbuf *s, const void assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain_func == NULL, + ("Nonsensical copyin to sbuf %p with a drain", s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -402,6 +461,8 @@ sbuf_copyin(struct sbuf *s, const void * assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain_func == NULL, + ("Nonsensical copyin to sbuf %p with a drain", s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -466,7 +527,7 @@ int sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) { va_list ap_copy; - int len; + int error, len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -481,15 +542,28 @@ sbuf_vprintf(struct sbuf *s, const char * For the moment, there is no way to get vsnprintf(3) to hand * back a character at a time, to push everything into * sbuf_putc_func() as was done for the kernel. + * + * In userspace, while drains are useful, there's generally + * not a problem attempting to malloc(3) on out of space. So + * expand a userland sbuf if there is not enough room for the + * data produced by sbuf_[v]printf(3). */ + error = 0; do { va_copy(ap_copy, ap); len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1, fmt, ap_copy); va_end(ap_copy); - } while (len > SBUF_FREESPACE(s) && - sbuf_extend(s, len - SBUF_FREESPACE(s)) == 0); + + if (SBUF_FREESPACE(s) >= len) + break; + /* Cannot print with the current available space. */ + if (s->s_drain_func != NULL && s->s_len > 0) + error = sbuf_drain(s); + else + error = sbuf_extend(s, len - SBUF_FREESPACE(s)); + } while (error == 0); /* * s->s_len is the length of the string, without the terminating nul. @@ -552,6 +626,8 @@ sbuf_trim(struct sbuf *s) assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain_func == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -575,16 +651,29 @@ sbuf_overflowed(struct sbuf *s) /* * Finish off an sbuf. */ -void +int sbuf_finish(struct sbuf *s) { + int error = 0; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + if (s->s_drain_func != NULL) { + error = s->s_error; + while (s->s_len > 0 && error == 0) + error = sbuf_drain(s); + } else if (SBUF_HASOVERFLOWED(s)) + error = ENOMEM; s->s_buf[s->s_len] = '\0'; SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); SBUF_SETFLAG(s, SBUF_FINISHED); +#ifdef _KERNEL + return (error); +#else + errno = error; + return (-1); +#endif } /* @@ -596,6 +685,8 @@ sbuf_data(struct sbuf *s) assert_sbuf_integrity(s); assert_sbuf_state(s, SBUF_FINISHED); + KASSERT(s->s_drain_func == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); return (s->s_buf); } @@ -609,6 +700,8 @@ sbuf_len(struct sbuf *s) assert_sbuf_integrity(s); /* don't care if it's finished or not */ + KASSERT(s->s_drain_func == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); if (SBUF_HASOVERFLOWED(s)) return (-1); Modified: head/sys/sys/sbuf.h ============================================================================== --- head/sys/sys/sbuf.h Thu Sep 9 17:45:48 2010 (r212366) +++ head/sys/sys/sbuf.h Thu Sep 9 17:49:18 2010 (r212367) @@ -33,12 +33,17 @@ #include +struct sbuf; +typedef int (sbuf_drain_func)(void *, const char *, int); + /* * Structure definition */ struct sbuf { char *s_buf; /* storage buffer */ - void *s_unused; /* binary compatibility. */ + sbuf_drain_func *s_drain_func; /* drain function */ + void *s_drain_arg; /* user-supplied drain argument */ + int s_error; /* current error code */ int s_size; /* size of storage buffer */ int s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ @@ -69,9 +74,10 @@ int sbuf_printf(struct sbuf *, const c int sbuf_vprintf(struct sbuf *, const char *, __va_list) __printflike(2, 0); int sbuf_putc(struct sbuf *, int); +void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *); int sbuf_trim(struct sbuf *); int sbuf_overflowed(struct sbuf *); -void sbuf_finish(struct sbuf *); +int sbuf_finish(struct sbuf *); char *sbuf_data(struct sbuf *); int sbuf_len(struct sbuf *); int sbuf_done(struct sbuf *); From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 18:19:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56F8F106566B; Thu, 9 Sep 2010 18:19:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4717E8FC08; Thu, 9 Sep 2010 18:19: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 o89IJGla015799; Thu, 9 Sep 2010 18:19:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89IJGLr015797; Thu, 9 Sep 2010 18:19:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009091819.o89IJGLr015797@svn.freebsd.org> From: John Baldwin Date: Thu, 9 Sep 2010 18:19: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: r212368 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 18:19:16 -0000 Author: jhb Date: Thu Sep 9 18:19:15 2010 New Revision: 212368 URL: http://svn.freebsd.org/changeset/base/212368 Log: - Rename the constant for the Master Data Parity Error flag in the PCI status register to map its current name. - Use PCIM_* rather than PCIR_* for constants for fields in various AER registers. I got about half of them right in the previous commit. MFC after: 1 week Modified: head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Thu Sep 9 17:49:18 2010 (r212367) +++ head/sys/dev/pci/pcireg.h Thu Sep 9 18:19:15 2010 (r212368) @@ -67,7 +67,7 @@ #define PCIM_STATUS_CAPPRESENT 0x0010 #define PCIM_STATUS_66CAPABLE 0x0020 #define PCIM_STATUS_BACKTOBACK 0x0080 -#define PCIM_STATUS_PERRREPORT 0x0100 +#define PCIM_STATUS_MDPERR 0x0100 #define PCIM_STATUS_SEL_FAST 0x0000 #define PCIM_STATUS_SEL_MEDIMUM 0x0200 #define PCIM_STATUS_SEL_SLOW 0x0400 @@ -689,18 +689,18 @@ /* Advanced Error Reporting */ #define PCIR_AER_UC_STATUS 0x04 -#define PCIR_AER_UC_TRAINING_ERROR 0x00000001 -#define PCIR_AER_UC_DL_PROTOCOL_ERROR 0x00000010 -#define PCIR_AER_UC_POISONED_TLP 0x00001000 -#define PCIR_AER_UC_FC_PROTOCOL_ERROR 0x00002000 -#define PCIR_AER_UC_COMPLETION_TIMEOUT 0x00004000 -#define PCIR_AER_UC_COMPLETER_ABORT 0x00008000 -#define PCIR_AER_UC_UNEXPECTED_COMPLETION 0x00010000 -#define PCIR_AER_UC_RECEIVER_OVERFLOW 0x00020000 -#define PCIR_AER_UC_MALFORMED_TLP 0x00040000 -#define PCIR_AER_UC_ECRC_ERROR 0x00080000 -#define PCIR_AER_UC_UNSUPPORTED_REQUEST 0x00100000 -#define PCIR_AER_UC_ACS_VIOLATION 0x00200000 +#define PCIM_AER_UC_TRAINING_ERROR 0x00000001 +#define PCIM_AER_UC_DL_PROTOCOL_ERROR 0x00000010 +#define PCIM_AER_UC_POISONED_TLP 0x00001000 +#define PCIM_AER_UC_FC_PROTOCOL_ERROR 0x00002000 +#define PCIM_AER_UC_COMPLETION_TIMEOUT 0x00004000 +#define PCIM_AER_UC_COMPLETER_ABORT 0x00008000 +#define PCIM_AER_UC_UNEXPECTED_COMPLETION 0x00010000 +#define PCIM_AER_UC_RECEIVER_OVERFLOW 0x00020000 +#define PCIM_AER_UC_MALFORMED_TLP 0x00040000 +#define PCIM_AER_UC_ECRC_ERROR 0x00080000 +#define PCIM_AER_UC_UNSUPPORTED_REQUEST 0x00100000 +#define PCIM_AER_UC_ACS_VIOLATION 0x00200000 #define PCIR_AER_UC_MASK 0x08 /* Shares bits with UC_STATUS */ #define PCIR_AER_UC_SEVERITY 0x0c /* Shares bits with UC_STATUS */ #define PCIR_AER_COR_STATUS 0x10 @@ -718,18 +718,18 @@ #define PCIM_AER_ECRC_CHECK_ENABLE 0x00000100 #define PCIR_AER_HEADER_LOG 0x1c #define PCIR_AER_ROOTERR_CMD 0x2c /* Only for root complex ports */ -#define PCIR_AER_ROOTERR_COR_ENABLE 0x00000001 -#define PCIR_AER_ROOTERR_NF_ENABLE 0x00000002 -#define PCIR_AER_ROOTERR_F_ENABLE 0x00000004 +#define PCIM_AER_ROOTERR_COR_ENABLE 0x00000001 +#define PCIM_AER_ROOTERR_NF_ENABLE 0x00000002 +#define PCIM_AER_ROOTERR_F_ENABLE 0x00000004 #define PCIR_AER_ROOTERR_STATUS 0x30 /* Only for root complex ports */ -#define PCIR_AER_ROOTERR_COR_ERR 0x00000001 -#define PCIR_AER_ROOTERR_MULTI_COR_ERR 0x00000002 -#define PCIR_AER_ROOTERR_UC_ERR 0x00000004 -#define PCIR_AER_ROOTERR_MULTI_UC_ERR 0x00000008 -#define PCIR_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 -#define PCIR_AER_ROOTERR_NF_ERR 0x00000020 -#define PCIR_AER_ROOTERR_F_ERR 0x00000040 -#define PCIR_AER_ROOTERR_INT_MESSAGE 0xf8000000 +#define PCIM_AER_ROOTERR_COR_ERR 0x00000001 +#define PCIM_AER_ROOTERR_MULTI_COR_ERR 0x00000002 +#define PCIM_AER_ROOTERR_UC_ERR 0x00000004 +#define PCIM_AER_ROOTERR_MULTI_UC_ERR 0x00000008 +#define PCIM_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 +#define PCIM_AER_ROOTERR_NF_ERR 0x00000020 +#define PCIM_AER_ROOTERR_F_ERR 0x00000040 +#define PCIM_AER_ROOTERR_INT_MESSAGE 0xf8000000 #define PCIR_AER_COR_SOURCE_ID 0x34 /* Only for root complex ports */ #define PCIR_AER_ERR_SOURCE_ID 0x36 /* Only for root complex ports */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 18:29:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AF521065698; Thu, 9 Sep 2010 18:29:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B5A48FC1D; Thu, 9 Sep 2010 18:29: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 o89ITm6N016792; Thu, 9 Sep 2010 18:29:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89ITmOI016790; Thu, 9 Sep 2010 18:29:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009091829.o89ITmOI016790@svn.freebsd.org> From: John Baldwin Date: Thu, 9 Sep 2010 18:29:48 +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: r212369 - head/usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 18:29:49 -0000 Author: jhb Date: Thu Sep 9 18:29:48 2010 New Revision: 212369 URL: http://svn.freebsd.org/changeset/base/212369 Log: - Use 'sta' to hold the PCIR_STATUS register value instead of 'cmd' when walking the capability list. - Use constants for PCI header types instead of magic numbers. MFC after: 1 week Modified: head/usr.sbin/pciconf/cap.c Modified: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Thu Sep 9 18:19:15 2010 (r212368) +++ head/usr.sbin/pciconf/cap.c Thu Sep 9 18:29:48 2010 (r212369) @@ -460,20 +460,20 @@ cap_pciaf(int fd, struct pci_conf *p, ui void list_caps(int fd, struct pci_conf *p) { - uint16_t cmd; + uint16_t sta; uint8_t ptr, cap; /* Are capabilities present for this device? */ - cmd = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); - if (!(cmd & PCIM_STATUS_CAPPRESENT)) + sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); + if (!(sta & PCIM_STATUS_CAPPRESENT)) return; switch (p->pc_hdr & PCIM_HDRTYPE) { - case 0: - case 1: + case PCIM_HDRTYPE_NORMAL: + case PCIM_HDRTYPE_BRIDGE: ptr = PCIR_CAP_PTR; break; - case 2: + case PCIM_HDRTYPE_CARDBUS: ptr = PCIR_CAP_PTR_2; break; default: From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 18:33:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EAE610656E3; Thu, 9 Sep 2010 18:33:47 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F14948FC16; Thu, 9 Sep 2010 18: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 o89IXkRu017234; Thu, 9 Sep 2010 18:33:46 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89IXkkR017222; Thu, 9 Sep 2010 18:33:46 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009091833.o89IXkkR017222@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 9 Sep 2010 18: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: r212370 - in head/sys: dev/cxgb kern sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 18:33:47 -0000 Author: mdf Date: Thu Sep 9 18:33:46 2010 New Revision: 212370 URL: http://svn.freebsd.org/changeset/base/212370 Log: Add a drain function for struct sysctl_req, and use it for a variety of handlers, some of which had to do awkward things to get a large enough FIXEDLEN buffer. Note that some sysctl handlers were explicitly outputting a trailing NUL byte. This behaviour was preserved, though it should not be necessary. Reviewed by: phk Modified: head/sys/dev/cxgb/cxgb_sge.c head/sys/kern/kern_malloc.c head/sys/kern/kern_sysctl.c head/sys/kern/subr_lock.c head/sys/kern/subr_sbuf.c head/sys/kern/subr_sleepqueue.c head/sys/kern/subr_witness.c head/sys/sys/sysctl.h head/sys/vm/uma_core.c head/sys/vm/vm_phys.c head/sys/vm/vm_reserv.c Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/dev/cxgb/cxgb_sge.c Thu Sep 9 18:33:46 2010 (r212370) @@ -3227,7 +3227,6 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS) struct sge_rspq *rspq; struct sge_qset *qs; int i, err, dump_end, idx; - static int multiplier = 1; struct sbuf *sb; struct rsp_desc *rspd; uint32_t data[4]; @@ -3252,8 +3251,8 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS) err = t3_sge_read_rspq(qs->port->adapter, rspq->cntxt_id, data); if (err) return (err); -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " \n index=%u size=%u MSI-X/RspQ=%u intr enable=%u intr armed=%u\n", (data[0] & 0xffff), data[0] >> 16, ((data[2] >> 20) & 0x3f), @@ -3276,13 +3275,11 @@ retry_sbufops: rspd->rss_hdr.rss_hash_val, be32toh(rspd->flags), be32toh(rspd->len_cq), rspd->intr_gen); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } @@ -3293,7 +3290,6 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS) struct sge_txq *txq; struct sge_qset *qs; int i, j, err, dump_end; - static int multiplier = 1; struct sbuf *sb; struct tx_desc *txd; uint32_t *WR, wr_hi, wr_lo, gen; @@ -3321,9 +3317,7 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS) if (err) return (err); - -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " \n credits=%u GTS=%u index=%u size=%u rspq#=%u cmdq#=%u\n", (data[0] & 0x7fff), ((data[0] >> 15) & 1), (data[0] >> 16), @@ -3350,13 +3344,10 @@ retry_sbufops: WR[j], WR[j + 1], WR[j + 2], WR[j + 3]); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } @@ -3367,7 +3358,6 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS) struct sge_txq *txq; struct sge_qset *qs; int i, j, err, dump_end; - static int multiplier = 1; struct sbuf *sb; struct tx_desc *txd; uint32_t *WR, wr_hi, wr_lo, gen; @@ -3391,8 +3381,7 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS) return (EINVAL); } -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " qid=%d start=%d -> end=%d\n", qs->idx, txq->txq_dump_start, (txq->txq_dump_start + txq->txq_dump_count) & 255); @@ -3412,13 +3401,10 @@ retry_sbufops: WR[j], WR[j + 1], WR[j + 2], WR[j + 3]); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/kern/kern_malloc.c Thu Sep 9 18:33:46 2010 (r212370) @@ -828,25 +828,11 @@ sysctl_kern_malloc_stats(SYSCTL_HANDLER_ struct malloc_type_internal *mtip; struct malloc_type_header mth; struct malloc_type *mtp; - int buflen, count, error, i; + int error, i; struct sbuf sbuf; - char *buffer; + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); mtx_lock(&malloc_mtx); -restart: - mtx_assert(&malloc_mtx, MA_OWNED); - count = kmemcount; - mtx_unlock(&malloc_mtx); - buflen = sizeof(mtsh) + count * (sizeof(mth) + - sizeof(struct malloc_type_stats) * MAXCPU) + 1; - buffer = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO); - mtx_lock(&malloc_mtx); - if (count < kmemcount) { - free(buffer, M_TEMP); - goto restart; - } - - sbuf_new(&sbuf, buffer, buflen, SBUF_FIXEDLEN); /* * Insert stream header. @@ -855,11 +841,7 @@ restart: mtsh.mtsh_version = MALLOC_TYPE_STREAM_VERSION; mtsh.mtsh_maxcpus = MAXCPU; mtsh.mtsh_count = kmemcount; - if (sbuf_bcat(&sbuf, &mtsh, sizeof(mtsh)) < 0) { - mtx_unlock(&malloc_mtx); - error = ENOMEM; - goto out; - } + (void)sbuf_bcat(&sbuf, &mtsh, sizeof(mtsh)); /* * Insert alternating sequence of type headers and type statistics. @@ -872,30 +854,19 @@ restart: */ bzero(&mth, sizeof(mth)); strlcpy(mth.mth_name, mtp->ks_shortdesc, MALLOC_MAX_NAME); - if (sbuf_bcat(&sbuf, &mth, sizeof(mth)) < 0) { - mtx_unlock(&malloc_mtx); - error = ENOMEM; - goto out; - } + (void)sbuf_bcat(&sbuf, &mth, sizeof(mth)); /* * Insert type statistics for each CPU. */ for (i = 0; i < MAXCPU; i++) { - if (sbuf_bcat(&sbuf, &mtip->mti_stats[i], - sizeof(mtip->mti_stats[i])) < 0) { - mtx_unlock(&malloc_mtx); - error = ENOMEM; - goto out; - } + (void)sbuf_bcat(&sbuf, &mtip->mti_stats[i], + sizeof(mtip->mti_stats[i])); } } mtx_unlock(&malloc_mtx); - sbuf_finish(&sbuf); - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); -out: + error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); - free(buffer, M_TEMP); return (error); } @@ -1005,26 +976,19 @@ DB_SHOW_COMMAND(multizone_matches, db_sh static int sysctl_kern_mprof(SYSCTL_HANDLER_ARGS) { - int linesize = 64; struct sbuf sbuf; uint64_t count; uint64_t waste; uint64_t mem; - int bufsize; int error; - char *buf; int rsize; int size; int i; - bufsize = linesize * (KMEM_ZSIZE + 1); - bufsize += 128; /* For the stats line */ - bufsize += 128; /* For the banner line */ waste = 0; mem = 0; - buf = malloc(bufsize, M_TEMP, M_WAITOK|M_ZERO); - sbuf_new(&sbuf, buf, bufsize, SBUF_FIXEDLEN); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); sbuf_printf(&sbuf, "\n Size Requests Real Size\n"); for (i = 0; i < KMEM_ZSIZE; i++) { @@ -1042,12 +1006,8 @@ sysctl_kern_mprof(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "\nTotal memory used:\t%30llu\nTotal Memory wasted:\t%30llu\n", (unsigned long long)mem, (unsigned long long)waste); - sbuf_finish(&sbuf); - - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); - + error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); - free(buf, M_TEMP); return (error); } Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/kern/kern_sysctl.c Thu Sep 9 18:33:46 2010 (r212370) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1544,3 +1545,30 @@ userland_sysctl(struct thread *td, int * } return (error); } + +/* + * Drain into a sysctl struct. The user buffer must be wired. + */ +static int +sbuf_sysctl_drain(void *arg, const char *data, int len) +{ + struct sysctl_req *req = arg; + int error; + + error = SYSCTL_OUT(req, data, len); + KASSERT(error >= 0, ("Got unexpected negative value %d", error)); + return (error == 0 ? len : -error); +} + +struct sbuf * +sbuf_new_for_sysctl(struct sbuf *s, char *buf, int length, + struct sysctl_req *req) +{ + + /* Wire the user buffer, so we can write without blocking. */ + sysctl_wire_old_buffer(req, 0); + + s = sbuf_new(s, buf, length, SBUF_FIXEDLEN); + sbuf_set_drain(s, sbuf_sysctl_drain, req); + return (s); +} Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/kern/subr_lock.c Thu Sep 9 18:33:46 2010 (r212370) @@ -191,8 +191,7 @@ struct lock_prof_cpu *lp_cpu[MAXCPU]; volatile int lock_prof_enable = 0; static volatile int lock_prof_resetting; -/* SWAG: sbuf size = avg stat. line size * number of locks */ -#define LPROF_SBUF_SIZE 256 * 400 +#define LPROF_SBUF_SIZE 256 static int lock_prof_rejected; static int lock_prof_skipspin; @@ -384,8 +383,6 @@ lock_prof_type_stats(struct lock_prof_ty continue; lock_prof_sum(l, &lp, i, spin, t); lock_prof_output(&lp, sb); - if (sbuf_overflowed(sb)) - return; } } } @@ -393,13 +390,11 @@ lock_prof_type_stats(struct lock_prof_ty static int dump_lock_prof_stats(SYSCTL_HANDLER_ARGS) { - static int multiplier = 1; struct sbuf *sb; int error, cpu, t; int enabled; -retry_sbufops: - sb = sbuf_new(NULL, NULL, LPROF_SBUF_SIZE * multiplier, SBUF_FIXEDLEN); + sb = sbuf_new_for_sysctl(NULL, NULL, LPROF_SBUF_SIZE, req); sbuf_printf(sb, "\n%8s %9s %11s %11s %11s %6s %6s %2s %6s %s\n", "max", "wait_max", "total", "wait_total", "count", "avg", "wait_avg", "cnt_hold", "cnt_lock", "name"); enabled = lock_prof_enable; @@ -411,16 +406,13 @@ retry_sbufops: continue; lock_prof_type_stats(&lp_cpu[cpu]->lpc_types[0], sb, 0, t); lock_prof_type_stats(&lp_cpu[cpu]->lpc_types[1], sb, 1, t); - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } } lock_prof_enable = enabled; - sbuf_finish(sb); - error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + error = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (error == 0) + error = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (error); } Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/kern/subr_sbuf.c Thu Sep 9 18:33:46 2010 (r212370) @@ -305,8 +305,8 @@ sbuf_drain(struct sbuf *s) SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (s->s_error); } - - KASSERT(len > 0, ("Drain must either error or work!")); + KASSERT(len > 0 && len <= s->s_len, + ("Bad drain amount %d for sbuf %p", len, s)); s->s_len -= len; /* * Fast path for the expected case where all the data was Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/kern/subr_sleepqueue.c Thu Sep 9 18:33:46 2010 (r212370) @@ -1018,7 +1018,7 @@ sleepq_abort(struct thread *td, int intr #ifdef SLEEPQUEUE_PROFILING #define SLEEPQ_PROF_LOCATIONS 1024 -#define SLEEPQ_SBUFSIZE (40 * 512) +#define SLEEPQ_SBUFSIZE 512 struct sleepq_prof { LIST_ENTRY(sleepq_prof) sp_link; const char *sp_wmesg; @@ -1123,15 +1123,13 @@ reset_sleepq_prof_stats(SYSCTL_HANDLER_A static int dump_sleepq_prof_stats(SYSCTL_HANDLER_ARGS) { - static int multiplier = 1; struct sleepq_prof *sp; struct sbuf *sb; int enabled; int error; int i; -retry_sbufops: - sb = sbuf_new(NULL, NULL, SLEEPQ_SBUFSIZE * multiplier, SBUF_FIXEDLEN); + sb = sbuf_new_for_sysctl(NULL, NULL, SLEEPQ_SBUFSIZE, req); sbuf_printf(sb, "\nwmesg\tcount\n"); enabled = prof_enabled; mtx_lock_spin(&sleepq_prof_lock); @@ -1141,19 +1139,13 @@ retry_sbufops: LIST_FOREACH(sp, &sleepq_hash[i], sp_link) { sbuf_printf(sb, "%s\t%ld\n", sp->sp_wmesg, sp->sp_count); - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } } } mtx_lock_spin(&sleepq_prof_lock); prof_enabled = enabled; mtx_unlock_spin(&sleepq_prof_lock); - sbuf_finish(sb); - error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + error = sbuf_finish(sb); sbuf_delete(sb); return (error); } Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/kern/subr_witness.c Thu Sep 9 18:33:46 2010 (r212370) @@ -154,8 +154,7 @@ __FBSDID("$FreeBSD$"); #define MAX_W_NAME 64 #define BADSTACK_SBUF_SIZE (256 * WITNESS_COUNT) -#define CYCLEGRAPH_SBUF_SIZE 8192 -#define FULLGRAPH_SBUF_SIZE 32768 +#define FULLGRAPH_SBUF_SIZE 512 /* * These flags go in the witness relationship matrix and describe the @@ -2545,7 +2544,7 @@ sysctl_debug_witness_fullgraph(SYSCTL_HA return (error); } error = 0; - sb = sbuf_new(NULL, NULL, FULLGRAPH_SBUF_SIZE, SBUF_FIXEDLEN); + sb = sbuf_new_for_sysctl(NULL, NULL, FULLGRAPH_SBUF_SIZE, req); if (sb == NULL) return (ENOMEM); sbuf_printf(sb, "\n"); @@ -2558,19 +2557,9 @@ sysctl_debug_witness_fullgraph(SYSCTL_HA mtx_unlock_spin(&w_mtx); /* - * While using SBUF_FIXEDLEN, check if the sbuf overflowed. - */ - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - panic("%s: sbuf overflowed, bump FULLGRAPH_SBUF_SIZE value\n", - __func__); - } - - /* * Close the sbuf and return to userland. */ - sbuf_finish(sb); - error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + error = sbuf_finish(sb); sbuf_delete(sb); return (error); Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/sys/sysctl.h Thu Sep 9 18:33:46 2010 (r212370) @@ -710,6 +710,9 @@ void sysctl_lock(void); void sysctl_unlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); +struct sbuf; +struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int, + struct sysctl_req *); #else /* !_KERNEL */ #include Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/vm/uma_core.c Thu Sep 9 18:33:46 2010 (r212370) @@ -3175,36 +3175,16 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS uma_keg_t kz; uma_zone_t z; uma_keg_t k; - char *buffer; - int buflen, count, error, i; + int count, error, i; - mtx_lock(&uma_mtx); -restart: - mtx_assert(&uma_mtx, MA_OWNED); - count = 0; - LIST_FOREACH(kz, &uma_kegs, uk_link) { - LIST_FOREACH(z, &kz->uk_zones, uz_link) - count++; - } - mtx_unlock(&uma_mtx); - - buflen = sizeof(ush) + count * (sizeof(uth) + sizeof(ups) * - (mp_maxid + 1)) + 1; - buffer = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + count = 0; mtx_lock(&uma_mtx); - i = 0; LIST_FOREACH(kz, &uma_kegs, uk_link) { LIST_FOREACH(z, &kz->uk_zones, uz_link) - i++; - } - if (i > count) { - free(buffer, M_TEMP); - goto restart; + count++; } - count = i; - - sbuf_new(&sbuf, buffer, buflen, SBUF_FIXEDLEN); /* * Insert stream header. @@ -3213,11 +3193,7 @@ restart: ush.ush_version = UMA_STREAM_VERSION; ush.ush_maxcpus = (mp_maxid + 1); ush.ush_count = count; - if (sbuf_bcat(&sbuf, &ush, sizeof(ush)) < 0) { - mtx_unlock(&uma_mtx); - error = ENOMEM; - goto out; - } + (void)sbuf_bcat(&sbuf, &ush, sizeof(ush)); LIST_FOREACH(kz, &uma_kegs, uk_link) { LIST_FOREACH(z, &kz->uk_zones, uz_link) { @@ -3250,12 +3226,7 @@ restart: uth.uth_frees = z->uz_frees; uth.uth_fails = z->uz_fails; uth.uth_sleeps = z->uz_sleeps; - if (sbuf_bcat(&sbuf, &uth, sizeof(uth)) < 0) { - ZONE_UNLOCK(z); - mtx_unlock(&uma_mtx); - error = ENOMEM; - goto out; - } + (void)sbuf_bcat(&sbuf, &uth, sizeof(uth)); /* * While it is not normally safe to access the cache * bucket pointers while not on the CPU that owns the @@ -3280,21 +3251,14 @@ restart: ups.ups_allocs = cache->uc_allocs; ups.ups_frees = cache->uc_frees; skip: - if (sbuf_bcat(&sbuf, &ups, sizeof(ups)) < 0) { - ZONE_UNLOCK(z); - mtx_unlock(&uma_mtx); - error = ENOMEM; - goto out; - } + (void)sbuf_bcat(&sbuf, &ups, sizeof(ups)); } ZONE_UNLOCK(z); } } mtx_unlock(&uma_mtx); - sbuf_finish(&sbuf); - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); -out: - free(buffer, M_TEMP); + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); return (error); } Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/vm/vm_phys.c Thu Sep 9 18:33:46 2010 (r212370) @@ -123,12 +123,9 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; struct vm_freelist *fl; - char *cbuf; - const int cbufsize = vm_nfreelists*(VM_NFREEORDER + 1)*81; int error, flind, oind, pind; - cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); - sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); for (flind = 0; flind < vm_nfreelists; flind++) { sbuf_printf(&sbuf, "\nFREE LIST %d:\n" "\n ORDER (SIZE) | NUMBER" @@ -149,10 +146,8 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "\n"); } } - sbuf_finish(&sbuf); - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); + error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); - free(cbuf, M_TEMP); return (error); } @@ -164,12 +159,9 @@ sysctl_vm_phys_segs(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; struct vm_phys_seg *seg; - char *cbuf; - const int cbufsize = VM_PHYSSEG_MAX*(VM_NFREEORDER + 1)*81; int error, segind; - cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); - sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); for (segind = 0; segind < vm_phys_nsegs; segind++) { sbuf_printf(&sbuf, "\nSEGMENT %d:\n\n", segind); seg = &vm_phys_segs[segind]; @@ -180,10 +172,8 @@ sysctl_vm_phys_segs(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "domain: %d\n", seg->domain); sbuf_printf(&sbuf, "free list: %p\n", seg->free_queues); } - sbuf_finish(&sbuf); - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); + error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); - free(cbuf, M_TEMP); return (error); } @@ -195,23 +185,18 @@ static int sysctl_vm_phys_lookup_lists(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; - char *cbuf; - const int cbufsize = (vm_nfreelists + 1) * VM_NDOMAIN * 81; int domain, error, flind, ndomains; ndomains = vm_nfreelists - VM_NFREELIST + 1; - cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); - sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); for (domain = 0; domain < ndomains; domain++) { sbuf_printf(&sbuf, "\nDOMAIN %d:\n\n", domain); for (flind = 0; flind < vm_nfreelists; flind++) sbuf_printf(&sbuf, " [%d]:\t%p\n", flind, vm_phys_lookup_lists[domain][flind]); } - sbuf_finish(&sbuf); - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); + error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); - free(cbuf, M_TEMP); return (error); } #endif Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Thu Sep 9 18:29:48 2010 (r212369) +++ head/sys/vm/vm_reserv.c Thu Sep 9 18:33:46 2010 (r212370) @@ -180,12 +180,9 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER { struct sbuf sbuf; vm_reserv_t rv; - char *cbuf; - const int cbufsize = (VM_NRESERVLEVEL + 1) * 81; int counter, error, level, unused_pages; - cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); - sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); sbuf_printf(&sbuf, "\nLEVEL SIZE NUMBER\n\n"); for (level = -1; level <= VM_NRESERVLEVEL - 2; level++) { counter = 0; @@ -199,10 +196,8 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER sbuf_printf(&sbuf, "%5.5d: %6.6dK, %6.6d\n", level, unused_pages * (PAGE_SIZE / 1024), counter); } - sbuf_finish(&sbuf); - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); + error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); - free(cbuf, M_TEMP); return (error); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 18:35:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCEC910656B7; Thu, 9 Sep 2010 18:35:08 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD5BC8FC08; Thu, 9 Sep 2010 18:35: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 o89IZ8qb017421; Thu, 9 Sep 2010 18:35:08 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89IZ8bP017419; Thu, 9 Sep 2010 18:35:08 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009091835.o89IZ8bP017419@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 9 Sep 2010 18:35: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: r212371 - head/sys/dev/led X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 18:35:08 -0000 Author: mdf Date: Thu Sep 9 18:35:08 2010 New Revision: 212371 URL: http://svn.freebsd.org/changeset/base/212371 Log: Fix an incorrect use of sbuf_overflowed() after a call to sbuf_finish(). Modified: head/sys/dev/led/led.c Modified: head/sys/dev/led/led.c ============================================================================== --- head/sys/dev/led/led.c Thu Sep 9 18:33:46 2010 (r212370) +++ head/sys/dev/led/led.c Thu Sep 9 18:35:08 2010 (r212371) @@ -220,15 +220,11 @@ led_write(struct cdev *dev, struct uio * free(s2, M_DEVBUF); return (EINVAL); } - sbuf_finish(sb); + error = sbuf_finish(sb); free(s2, M_DEVBUF); - if (sbuf_overflowed(sb)) { + if (error != 0 || sbuf_len(sb) == 0) { sbuf_delete(sb); - return (ENOMEM); - } - if (sbuf_len(sb) == 0) { - sbuf_delete(sb); - return (0); + return (error); } return (led_state(dev, sb, 0)); From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 18:51:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83E6410656D1; Thu, 9 Sep 2010 18:51:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73F568FC1A; Thu, 9 Sep 2010 18:51: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 o89IpKSQ018968; Thu, 9 Sep 2010 18:51:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89IpKpV018966; Thu, 9 Sep 2010 18:51:20 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009091851.o89IpKpV018966@svn.freebsd.org> From: John Baldwin Date: Thu, 9 Sep 2010 18:51: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: r212372 - head/usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 18:51:21 -0000 Author: jhb Date: Thu Sep 9 18:51:20 2010 New Revision: 212372 URL: http://svn.freebsd.org/changeset/base/212372 Log: Document the format of extended capabilities in the '-c' output. Modified: head/usr.sbin/pciconf/pciconf.8 Modified: head/usr.sbin/pciconf/pciconf.8 ============================================================================== --- head/usr.sbin/pciconf/pciconf.8 Thu Sep 9 18:35:08 2010 (r212371) +++ head/usr.sbin/pciconf/pciconf.8 Thu Sep 9 18:51:20 2010 (r212372) @@ -142,7 +142,7 @@ If the option is supplied, .Nm will list any capabilities supported by each device. -Each capability will be enumerated via a line in the following format: +Each capability is enumerated via a line in the following format: .Bd -literal cap 10[40] = PCI-Express 1 root port .Ed @@ -154,6 +154,18 @@ The second value in the square brackets in config space in hexadecimal. The format of the text after the equals sign is capability-specific. .Pp +Each extended capability is enumerated via a line in a similar format: +.Bd -literal +ecap 0002[100] = VC 1 max VC0 +.Ed +.Pp +The first value after the +.Dq Li ecap +prefix is the extended capability ID in hexadecimal. +The second value in the square brackets is the offset of the extended +capability in config space in hexadecimal. +The format of the text after the equals sign is capability-specific. +.Pp If the .Fl v option is supplied, From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 18:51:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE7F010656C2; Thu, 9 Sep 2010 18:51:50 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A47688FC1B; Thu, 9 Sep 2010 18:51: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 o89IpotQ019037; Thu, 9 Sep 2010 18:51:50 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89IpoFR019035; Thu, 9 Sep 2010 18:51:50 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009091851.o89IpoFR019035@svn.freebsd.org> From: Kai Wang Date: Thu, 9 Sep 2010 18:51: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: r212373 - head/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 18:51:50 -0000 Author: kaiw Date: Thu Sep 9 18:51:50 2010 New Revision: 212373 URL: http://svn.freebsd.org/changeset/base/212373 Log: libelf is overly strict about the type and alignment of Elf_Data objects inside one ELF section, which prevents the creation of a ELF section with mixed data types. For example, gcc LTO use libelf to create a .gnu_lto_XXX section that contains integers and a string table, which doesn't work with our libelf implementation. The changes made in this commit include: * Allow Elf_Data type to be different than section type. * Relax Elf_Data alignment check. * Align each Elf_Data by their own alignment instead of section alignment. MFC after: 1 month Modified: head/lib/libelf/elf_update.c Modified: head/lib/libelf/elf_update.c ============================================================================== --- head/lib/libelf/elf_update.c Thu Sep 9 18:51:20 2010 (r212372) +++ head/lib/libelf/elf_update.c Thu Sep 9 18:51:50 2010 (r212373) @@ -141,7 +141,7 @@ _libelf_compute_section_extents(Elf *e, /* Compute the section alignment. */ STAILQ_FOREACH(d, &s->s_data, d_next) { - if (d->d_type != elftype) { + if (d->d_type > ELF_T_LAST) { LIBELF_SET_ERROR(DATA, 0); return (0); } @@ -149,11 +149,7 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(VERSION, 0); return (0); } - if ((d_align = d->d_align) % sh_align) { - LIBELF_SET_ERROR(LAYOUT, 0); - return (0); - } - if (d_align == 0 || (d_align & (d_align - 1))) { + if ((d_align = d->d_align) == 0 || (d_align & (d_align - 1))) { LIBELF_SET_ERROR(DATA, 0); return (0); } @@ -168,7 +164,7 @@ _libelf_compute_section_extents(Elf *e, if ((uint64_t) d->d_off + d->d_size > scn_size) scn_size = d->d_off + d->d_size; } else { - scn_size = roundup2(scn_size, scn_alignment); + scn_size = roundup2(scn_size, d->d_align); d->d_off = scn_size; scn_size += d->d_size; } @@ -560,8 +556,6 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ elftype = _libelf_xlate_shtype(sh_type); assert(elftype >= ELF_T_FIRST && elftype <= ELF_T_LAST); - msz = _libelf_msize(elftype, ec, e->e_version); - sh_off = s->s_offset; assert(sh_off % _libelf_falign(elftype, ec) == 0); @@ -608,6 +602,8 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ STAILQ_FOREACH(d, &s->s_data, d_next) { + msz = _libelf_msize(d->d_type, ec, e->e_version); + if ((uint64_t) rc < sh_off + d->d_off) (void) memset(nf + rc, LIBELF_PRIVATE(fillchar), sh_off + d->d_off - rc); @@ -615,13 +611,12 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ rc = sh_off + d->d_off; assert(d->d_buf != NULL); - assert(d->d_type == (Elf_Type) elftype); assert(d->d_version == e->e_version); assert(d->d_size % msz == 0); nobjects = d->d_size / msz; - fsz = _libelf_fsize(elftype, ec, e->e_version, nobjects); + fsz = _libelf_fsize(d->d_type, ec, e->e_version, nobjects); dst.d_buf = nf + rc; dst.d_size = fsz; From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 18:59:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A98210656C1; Thu, 9 Sep 2010 18:59:57 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 0CF238FC13; Thu, 9 Sep 2010 18:59:57 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id o89Ixuu4030553; Thu, 9 Sep 2010 11:59:56 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id o89Ixu8E030552; Thu, 9 Sep 2010 11:59:56 -0700 (PDT) (envelope-from sgk) Date: Thu, 9 Sep 2010 11:59:56 -0700 From: Steve Kargl To: Kai Wang Message-ID: <20100909185956.GA30545@troutmask.apl.washington.edu> References: <201009091851.o89IpoFR019035@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201009091851.o89IpoFR019035@svn.freebsd.org> 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: r212373 - head/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 18:59:57 -0000 On Thu, Sep 09, 2010 at 06:51:50PM +0000, Kai Wang wrote: > Author: kaiw > Date: Thu Sep 9 18:51:50 2010 > New Revision: 212373 > URL: http://svn.freebsd.org/changeset/base/212373 > > Log: > libelf is overly strict about the type and alignment of Elf_Data > objects inside one ELF section, which prevents the creation of a ELF > section with mixed data types. For example, gcc LTO use libelf to > create a .gnu_lto_XXX section that contains integers and a string > table, which doesn't work with our libelf implementation. > > The changes made in this commit include: > * Allow Elf_Data type to be different than section type. > * Relax Elf_Data alignment check. > * Align each Elf_Data by their own alignment instead of section alignment. > Thanks you! -- Steve From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 19:27:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C290410656B0; Thu, 9 Sep 2010 19:27:40 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B25D18FC08; Thu, 9 Sep 2010 19:27: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 o89JReMY022428; Thu, 9 Sep 2010 19:27:40 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89JReXm022426; Thu, 9 Sep 2010 19:27:40 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201009091927.o89JReXm022426@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 9 Sep 2010 19:27: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: r212374 - head/usr.bin/printf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 19:27:40 -0000 Author: obrien Date: Thu Sep 9 19:27:40 2010 New Revision: 212374 URL: http://svn.freebsd.org/changeset/base/212374 Log: Note bug in trying to printf(1) things like: '-%s\n' "foo" Modified: head/usr.bin/printf/printf.1 Modified: head/usr.bin/printf/printf.1 ============================================================================== --- head/usr.bin/printf/printf.1 Thu Sep 9 18:51:50 2010 (r212373) +++ head/usr.bin/printf/printf.1 Thu Sep 9 19:27:40 2010 (r212374) @@ -355,3 +355,10 @@ Multibyte characters are not recognized a problem if .Ql % can appear inside a multibyte character). +.Pp +Trying to print a dash ("-") as the first character causes +.Nm +to interpet the dash as a program argument. +.Nm -- +must be used before +.Ar format . From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 19:51:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 887711065670; Thu, 9 Sep 2010 19:51:37 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C453B8FC1E; Thu, 9 Sep 2010 19:51:36 +0000 (UTC) Received: by ewy4 with SMTP id 4so1415298ewy.13 for ; Thu, 09 Sep 2010 12:51:32 -0700 (PDT) Received: by 10.216.6.149 with SMTP id 21mr726757wen.101.1284061891395; Thu, 09 Sep 2010 12:51:31 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.216.5.5 with HTTP; Thu, 9 Sep 2010 12:51:11 -0700 (PDT) In-Reply-To: <201009091927.o89JReXm022426@svn.freebsd.org> References: <201009091927.o89JReXm022426@svn.freebsd.org> From: Juli Mallett Date: Thu, 9 Sep 2010 12:51:11 -0700 X-Google-Sender-Auth: Ko_ljF_xh491n9XboFxvd97BzVY Message-ID: To: "David E. O'Brien" Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212374 - head/usr.bin/printf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 19:51:37 -0000 On Thu, Sep 9, 2010 at 12:27, David E. O'Brien wrote: > Author: obrien > Date: Thu Sep =A09 19:27:40 2010 > New Revision: 212374 > URL: http://svn.freebsd.org/changeset/base/212374 > > Log: > =A0Note bug in trying to printf(1) things like: '-%s\n' "foo" Should we also add something like this note to every manual page for a program that operates on files as command line arguments after options w.r.t. operating on files whose names begin with '-'? It seems like if it's appropriate in individual manpages at all it's appropriate in all of them =97 it's one of the most frequently-asked questions by new Unix users that I've encountered. On the other hand, perhaps intro(1) or similar is more appropriate. Juli. From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 19:53:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66D6D10656FA; Thu, 9 Sep 2010 19:53:04 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 2C17C8FC19; Thu, 9 Sep 2010 19:53:04 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 607F81DD656; Thu, 9 Sep 2010 21:53:02 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 54909172E5; Thu, 9 Sep 2010 21:53:02 +0200 (CEST) Date: Thu, 9 Sep 2010 21:53:02 +0200 From: Jilles Tjoelker To: "David E. O'Brien" Message-ID: <20100909195302.GA48144@stack.nl> References: <201009091927.o89JReXm022426@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201009091927.o89JReXm022426@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212374 - head/usr.bin/printf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 19:53:04 -0000 On Thu, Sep 09, 2010 at 07:27:40PM +0000, David E. O'Brien wrote: > Author: obrien > Date: Thu Sep 9 19:27:40 2010 > New Revision: 212374 > URL: http://svn.freebsd.org/changeset/base/212374 > Log: > Note bug in trying to printf(1) things like: '-%s\n' "foo" > Modified: > head/usr.bin/printf/printf.1 > Modified: head/usr.bin/printf/printf.1 > ============================================================================== > --- head/usr.bin/printf/printf.1 Thu Sep 9 18:51:50 2010 (r212373) > +++ head/usr.bin/printf/printf.1 Thu Sep 9 19:27:40 2010 (r212374) > @@ -355,3 +355,10 @@ Multibyte characters are not recognized > a problem if > .Ql % > can appear inside a multibyte character). > +.Pp > +Trying to print a dash ("-") as the first character causes > +.Nm > +to interpet the dash as a program argument. > +.Nm -- > +must be used before > +.Ar format . I do not consider this a bug. POSIX requires printf to recognize -- and pretty much all current implementations conform to this. Causing an error for unrecognized options allows us to add options later on, without fear of breaking scripts that use format strings starting with a dash without -- protection. Needing -- is not particularly onerous here as format strings are usually constants. A caveat could be added, but it is really echo(1) that is inconsistent by not treating -- specially. The printf utility is consistent with most other utilities in requiring --. FWIW, the omission of hexadecimal character constants does not belong in the BUGS section either. They are deliberately not provided, therefore their omission is not a bug. (One reason is that there is no way to force termination of such a sequence, unlike C where you can do things like "\x1b" "c".) -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 20:07:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3D6710656BB; Thu, 9 Sep 2010 20:07:40 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C375D8FC1B; Thu, 9 Sep 2010 20: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 o89K7ek3026697; Thu, 9 Sep 2010 20:07:40 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89K7eLc026695; Thu, 9 Sep 2010 20:07:40 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201009092007.o89K7eLc026695@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 9 Sep 2010 20: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: r212376 - head/lib/libc/posix1e X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 20:07:40 -0000 Author: trasz Date: Thu Sep 9 20:07:40 2010 New Revision: 212376 URL: http://svn.freebsd.org/changeset/base/212376 Log: Add minor optimization. It's less strict than its kernel counterpart due to upcoming ACL changes required by the new ZFS. Modified: head/lib/libc/posix1e/acl_strip.c Modified: head/lib/libc/posix1e/acl_strip.c ============================================================================== --- head/lib/libc/posix1e/acl_strip.c Thu Sep 9 19:51:46 2010 (r212375) +++ head/lib/libc/posix1e/acl_strip.c Thu Sep 9 20:07:40 2010 (r212376) @@ -176,6 +176,15 @@ acl_is_trivial_np(const acl_t aclp, int case ACL_BRAND_NFS4: /* + * If the ACL has more than canonical six entries, + * it's non trivial by definition. + */ + if (aclp->ats_acl.acl_cnt > 6) { + *trivialp = 1; + return (0); + } + + /* * Calculate trivial ACL - using acl_strip_np - and compare * with the original. */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 20:10:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 247DD10656C4; Thu, 9 Sep 2010 20:10:57 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 766D58FC1B; Thu, 9 Sep 2010 20:10:56 +0000 (UTC) Received: by yxn35 with SMTP id 35so934495yxn.13 for ; Thu, 09 Sep 2010 13:10:55 -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=R3iaQODg/0O55j8j/ChY8/gYFQ8s9eZZeUqVhDEsfjY=; b=si3q8Ador01bnVeUSDBcyxa9hulKw4nxl8d4s+rVbOobms2i59oznbsRbwpcjVZsix N3Igyq/Qjthxa+0OylKsKzcNc2sNoL3glydNwhqujD2XGGI0xHVO+7dcHznDjmuu8hO4 8KJ4EpEYzlIDehuAaImf8kqEtn6UiXAZxT86M= 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=qf440tUNj8/4bCXTsx2Udt5VYbTIsIT/7ocf7/V1xemxtV3em4m7K9j2HdUyn0N4xb DuwFlM01zlo7RgWcR7R/Txih5Phslb0f1rL0+974f0+NobPM05inuADdazuPOR0wnmaD eA8yZIwmU6zn/ZhCcfDCtGoyIkCFqEWifvLCQ= MIME-Version: 1.0 Received: by 10.101.26.21 with SMTP id d21mr576629anj.177.1284063055333; Thu, 09 Sep 2010 13:10:55 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.100.126.20 with HTTP; Thu, 9 Sep 2010 13:10:55 -0700 (PDT) In-Reply-To: <201009091819.o89IJGLr015797@svn.freebsd.org> References: <201009091819.o89IJGLr015797@svn.freebsd.org> Date: Thu, 9 Sep 2010 13:10:55 -0700 X-Google-Sender-Auth: GDvYHbAmtyVza1mfTpUjoAlhxf4 Message-ID: From: mdf@FreeBSD.org To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212368 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 20:10:57 -0000 On Thu, Sep 9, 2010 at 11:19 AM, John Baldwin wrote: > Author: jhb > Date: Thu Sep =A09 18:19:15 2010 > New Revision: 212368 > URL: http://svn.freebsd.org/changeset/base/212368 > > Log: > =A0- Rename the constant for the Master Data Parity Error flag in the > =A0 =A0PCI status register to map its current name. > =A0- Use PCIM_* rather than PCIR_* for constants for fields in various AE= R > =A0 =A0registers. =A0I got about half of them right in the previous commi= t. > > =A0MFC after: =A0 =A01 week > > Modified: > =A0head/sys/dev/pci/pcireg.h This seems to break building CURRENT with this error: /data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'mskc_reset': /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: 'PCIM_STATUS_PERRREPORT' undeclared (first use in this function) /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: (Each undeclared identifier is reported only once /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: for each function it appears in.) /data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'msk_intr_hwerr': /data/sb/bsd.git/sys/dev/msk/if_msk.c:3408: error: 'PCIM_STATUS_PERRREPORT' undeclared (first use in this function) Thanks, matthew > > Modified: head/sys/dev/pci/pcireg.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/pci/pcireg.h =A0 Thu Sep =A09 17:49:18 2010 =A0 =A0 =A0 = =A0(r212367) > +++ head/sys/dev/pci/pcireg.h =A0 Thu Sep =A09 18:19:15 2010 =A0 =A0 =A0 = =A0(r212368) > @@ -67,7 +67,7 @@ > =A0#define =A0 =A0 =A0 =A0PCIM_STATUS_CAPPRESENT =A00x0010 > =A0#define =A0 =A0 =A0 =A0PCIM_STATUS_66CAPABLE =A0 0x0020 > =A0#define =A0 =A0 =A0 =A0PCIM_STATUS_BACKTOBACK =A00x0080 > -#define =A0 =A0 =A0 =A0PCIM_STATUS_PERRREPORT =A00x0100 > +#define =A0 =A0 =A0 =A0PCIM_STATUS_MDPERR =A0 =A0 =A00x0100 > =A0#define =A0 =A0 =A0 =A0PCIM_STATUS_SEL_FAST =A0 =A00x0000 > =A0#define =A0 =A0 =A0 =A0PCIM_STATUS_SEL_MEDIMUM 0x0200 > =A0#define =A0 =A0 =A0 =A0PCIM_STATUS_SEL_SLOW =A0 =A00x0400 > @@ -689,18 +689,18 @@ > > =A0/* Advanced Error Reporting */ > =A0#define =A0 =A0 =A0 =A0PCIR_AER_UC_STATUS =A0 =A0 =A00x04 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_TRAINING_ERROR =A0 =A0 =A00x00000001 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_DL_PROTOCOL_ERROR =A0 0x00000010 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_POISONED_TLP =A0 =A0 =A0 =A00x0000100= 0 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_FC_PROTOCOL_ERROR =A0 0x00002000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_COMPLETION_TIMEOUT =A00x00004000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_COMPLETER_ABORT =A0 =A0 0x00008000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_UNEXPECTED_COMPLETION 0x00010000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_RECEIVER_OVERFLOW =A0 0x00020000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_MALFORMED_TLP =A0 =A0 =A0 0x00040000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_ECRC_ERROR =A0 =A0 =A0 =A0 =A00x00080= 000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_UNSUPPORTED_REQUEST 0x00100000 > -#define =A0 =A0 =A0 =A0PCIR_AER_UC_ACS_VIOLATION =A0 =A0 =A0 0x00200000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_TRAINING_ERROR =A0 =A0 =A00x00000001 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_DL_PROTOCOL_ERROR =A0 0x00000010 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_POISONED_TLP =A0 =A0 =A0 =A00x0000100= 0 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_FC_PROTOCOL_ERROR =A0 0x00002000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_COMPLETION_TIMEOUT =A00x00004000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_COMPLETER_ABORT =A0 =A0 0x00008000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_UNEXPECTED_COMPLETION 0x00010000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_RECEIVER_OVERFLOW =A0 0x00020000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_MALFORMED_TLP =A0 =A0 =A0 0x00040000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_ECRC_ERROR =A0 =A0 =A0 =A0 =A00x00080= 000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_UNSUPPORTED_REQUEST 0x00100000 > +#define =A0 =A0 =A0 =A0PCIM_AER_UC_ACS_VIOLATION =A0 =A0 =A0 0x00200000 > =A0#define =A0 =A0 =A0 =A0PCIR_AER_UC_MASK =A0 =A0 =A0 =A00x08 =A0 =A0/* = Shares bits with UC_STATUS */ > =A0#define =A0 =A0 =A0 =A0PCIR_AER_UC_SEVERITY =A0 =A00x0c =A0 =A0/* Shar= es bits with UC_STATUS */ > =A0#define =A0 =A0 =A0 =A0PCIR_AER_COR_STATUS =A0 =A0 0x10 > @@ -718,18 +718,18 @@ > =A0#define =A0 =A0 =A0 =A0PCIM_AER_ECRC_CHECK_ENABLE =A0 =A0 =A00x0000010= 0 > =A0#define =A0 =A0 =A0 =A0PCIR_AER_HEADER_LOG =A0 =A0 0x1c > =A0#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_CMD =A0 =A00x2c =A0 =A0/* Only= for root complex ports */ > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_COR_ENABLE =A0 =A0 0x00000001 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_NF_ENABLE =A0 =A0 =A00x00000002 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_F_ENABLE =A0 =A0 =A0 0x00000004 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_COR_ENABLE =A0 =A0 0x00000001 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_NF_ENABLE =A0 =A0 =A00x00000002 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_F_ENABLE =A0 =A0 =A0 0x00000004 > =A0#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_STATUS 0x30 =A0 =A0/* Only for= root complex ports */ > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_COR_ERR =A0 =A0 =A0 =A00x0000000= 1 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_MULTI_COR_ERR =A00x00000002 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_UC_ERR =A0 =A0 =A0 =A0 0x0000000= 4 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_MULTI_UC_ERR =A0 0x00000008 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_NF_ERR =A0 =A0 =A0 =A0 0x0000002= 0 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_F_ERR =A0 =A0 =A0 =A0 =A00x00000= 040 > -#define =A0 =A0 =A0 =A0PCIR_AER_ROOTERR_INT_MESSAGE =A0 =A00xf8000000 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_COR_ERR =A0 =A0 =A0 =A00x0000000= 1 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_MULTI_COR_ERR =A00x00000002 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_UC_ERR =A0 =A0 =A0 =A0 0x0000000= 4 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_MULTI_UC_ERR =A0 0x00000008 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_NF_ERR =A0 =A0 =A0 =A0 0x0000002= 0 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_F_ERR =A0 =A0 =A0 =A0 =A00x00000= 040 > +#define =A0 =A0 =A0 =A0PCIM_AER_ROOTERR_INT_MESSAGE =A0 =A00xf8000000 > =A0#define =A0 =A0 =A0 =A0PCIR_AER_COR_SOURCE_ID =A00x34 =A0 =A0/* Only f= or root complex ports */ > =A0#define =A0 =A0 =A0 =A0PCIR_AER_ERR_SOURCE_ID =A00x36 =A0 =A0/* Only f= or root complex ports */ > > From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 20:26:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C0AB10656C1; Thu, 9 Sep 2010 20:26:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 818488FC08; Thu, 9 Sep 2010 20:26: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 o89KQUWI029084; Thu, 9 Sep 2010 20:26:30 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89KQUvG029080; Thu, 9 Sep 2010 20:26:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009092026.o89KQUvG029080@svn.freebsd.org> From: John Baldwin Date: Thu, 9 Sep 2010 20:26: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: r212378 - in head/sys: dev/msk sparc64/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 20:26:31 -0000 Author: jhb Date: Thu Sep 9 20:26:30 2010 New Revision: 212378 URL: http://svn.freebsd.org/changeset/base/212378 Log: Catch up to rename of the constant for the Master Data Parity Error bit in the PCI status register. Pointed out by: mdf Pointy hat to: jhb Modified: head/sys/dev/msk/if_msk.c head/sys/sparc64/pci/schizo.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Thu Sep 9 20:11:41 2010 (r212377) +++ head/sys/dev/msk/if_msk.c Thu Sep 9 20:26:30 2010 (r212378) @@ -1334,7 +1334,7 @@ mskc_reset(struct msk_softc *sc) pci_write_config(sc->msk_dev, PCIR_STATUS, status | PCIM_STATUS_PERR | PCIM_STATUS_SERR | PCIM_STATUS_RMABORT | - PCIM_STATUS_RTABORT | PCIM_STATUS_PERRREPORT, 2); + PCIM_STATUS_RTABORT | PCIM_STATUS_MDPERR, 2); CSR_WRITE_2(sc, B0_CTST, CS_MRST_CLR); switch (sc->msk_bustype) { @@ -3405,7 +3405,7 @@ msk_intr_hwerr(struct msk_softc *sc) CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_ON); pci_write_config(sc->msk_dev, PCIR_STATUS, v16 | PCIM_STATUS_PERR | PCIM_STATUS_SERR | PCIM_STATUS_RMABORT | - PCIM_STATUS_RTABORT | PCIM_STATUS_PERRREPORT, 2); + PCIM_STATUS_RTABORT | PCIM_STATUS_MDPERR, 2); CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_OFF); } Modified: head/sys/sparc64/pci/schizo.c ============================================================================== --- head/sys/sparc64/pci/schizo.c Thu Sep 9 20:11:41 2010 (r212377) +++ head/sys/sparc64/pci/schizo.c Thu Sep 9 20:26:30 2010 (r212378) @@ -849,7 +849,7 @@ schizo_pci_bus(void *arg) fatal = 1; if ((status & (PCIM_STATUS_PERR | PCIM_STATUS_SERR | PCIM_STATUS_RMABORT | PCIM_STATUS_RTABORT | - PCIM_STATUS_PERRREPORT)) != 0 || + PCIM_STATUS_MDPERR)) != 0 || (csr & (SCZ_PCI_CTRL_BUS_UNUS | TOM_PCI_CTRL_DTO_ERR | STX_PCI_CTRL_TTO_ERR | STX_PCI_CTRL_RTRY_ERR | SCZ_PCI_CTRL_SBH_ERR | STX_PCI_CTRL_SERR)) != 0 || From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 20:37:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE11B106566C; Thu, 9 Sep 2010 20:37:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D5308FC0A; Thu, 9 Sep 2010 20:37: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 o89KbJRM030313; Thu, 9 Sep 2010 20:37:19 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89KbJRU030310; Thu, 9 Sep 2010 20:37:19 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201009092037.o89KbJRU030310@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 9 Sep 2010 20:37: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: r212379 - head/lib/libc/posix1e X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 20:37:19 -0000 Author: trasz Date: Thu Sep 9 20:37:19 2010 New Revision: 212379 URL: http://svn.freebsd.org/changeset/base/212379 Log: Arrgh, tested wrong source tree _again_. Fix previous commit. Also, this and previous one are MFC candidate. MFC after: 1 month Modified: head/lib/libc/posix1e/acl_strip.c Modified: head/lib/libc/posix1e/acl_strip.c ============================================================================== --- head/lib/libc/posix1e/acl_strip.c Thu Sep 9 20:26:30 2010 (r212378) +++ head/lib/libc/posix1e/acl_strip.c Thu Sep 9 20:37:19 2010 (r212379) @@ -180,7 +180,7 @@ acl_is_trivial_np(const acl_t aclp, int * it's non trivial by definition. */ if (aclp->ats_acl.acl_cnt > 6) { - *trivialp = 1; + *trivialp = 0; return (0); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 20:51:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B819106564A; Thu, 9 Sep 2010 20:51:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 79FA38FC18; Thu, 9 Sep 2010 20:51: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 o89KpNku031667; Thu, 9 Sep 2010 20:51:23 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89KpNnO031665; Thu, 9 Sep 2010 20:51:23 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201009092051.o89KpNnO031665@svn.freebsd.org> From: Michael Tuexen Date: Thu, 9 Sep 2010 20:51: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: r212380 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 20:51:23 -0000 Author: tuexen Date: Thu Sep 9 20:51:23 2010 New Revision: 212380 URL: http://svn.freebsd.org/changeset/base/212380 Log: * Remove code which has no effect. * Clean up the handling in sctp_lower_sosend(). MFC after: 3 weeks. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Sep 9 20:37:19 2010 (r212379) +++ head/sys/netinet/sctp_output.c Thu Sep 9 20:51:23 2010 (r212380) @@ -12124,7 +12124,6 @@ sctp_sosend(struct socket *so, struct thread *p ) { - struct sctp_inpcb *inp; int error, use_rcvinfo = 0; struct sctp_sndrcvinfo srcv; struct sockaddr *addr_to_use; @@ -12134,7 +12133,6 @@ sctp_sosend(struct socket *so, #endif - inp = (struct sctp_inpcb *)so->so_pcb; if (control) { /* process cmsg snd/rcv info (maybe a assoc-id) */ if (sctp_find_cmsg(SCTP_SNDRCV, (void *)&srcv, control, @@ -12182,7 +12180,7 @@ sctp_lower_sosend(struct socket *so, struct mbuf *top = NULL; int queue_only = 0, queue_only_for_init = 0; int free_cnt_applied = 0; - int un_sent = 0; + int un_sent; int now_filled = 0; unsigned int inqueue_bytes = 0; struct sctp_block_entry be; @@ -12525,9 +12523,10 @@ sctp_lower_sosend(struct socket *so, * change it BEFORE we append the message. */ } - } + } else + asoc = &stcb->asoc; if (srcv == NULL) - srcv = (struct sctp_sndrcvinfo *)&stcb->asoc.def_send; + srcv = (struct sctp_sndrcvinfo *)&asoc->def_send; if (srcv->sinfo_flags & SCTP_ADDR_OVER) { if (addr) net = sctp_findnet(stcb, addr); @@ -12542,14 +12541,10 @@ sctp_lower_sosend(struct socket *so, } else { net = stcb->asoc.primary_destination; } - - if ((SCTP_SO_IS_NBIO(so) - || (flags & MSG_NBIO) - )) { - non_blocking = 1; - } - asoc = &stcb->asoc; atomic_add_int(&stcb->total_sends, 1); + /* Keep the stcb from being freed under our feet */ + atomic_add_int(&asoc->refcnt, 1); + free_cnt_applied = 1; if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NO_FRAGMENT)) { if (sndlen > asoc->smallest_mtu) { @@ -12558,6 +12553,11 @@ sctp_lower_sosend(struct socket *so, goto out_unlocked; } } + if ((SCTP_SO_IS_NBIO(so) + || (flags & MSG_NBIO) + )) { + non_blocking = 1; + } /* would we block? */ if (non_blocking) { if (hold_tcblock == 0) { @@ -12581,17 +12581,6 @@ sctp_lower_sosend(struct socket *so, atomic_add_int(&stcb->asoc.sb_send_resv, sndlen); } local_soresv = sndlen; - /* Keep the stcb from being freed under our feet */ - if (free_cnt_applied) { -#ifdef INVARIANTS - panic("refcnt already incremented"); -#else - printf("refcnt:1 already incremented?\n"); -#endif - } else { - atomic_add_int(&stcb->asoc.refcnt, 1); - free_cnt_applied = 1; - } if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); error = ECONNRESET; @@ -12634,26 +12623,6 @@ sctp_lower_sosend(struct socket *so, if (p) { p->td_ru.ru_msgsnd++; } - if ((net->flight_size > net->cwnd) && - (asoc->sctp_cmt_on_off == 0)) { - /*- - * CMT: Added check for CMT above. net above is the primary - * dest. If CMT is ON, sender should always attempt to send - * with the output routine sctp_fill_outqueue() that loops - * through all destination addresses. Therefore, if CMT is - * ON, queue_only is NOT set to 1 here, so that - * sctp_chunk_output() can be called below. - */ - queue_only = 1; - } else if (asoc->ifp_had_enobuf) { - SCTP_STAT_INCR(sctps_ifnomemqueued); - if (net->flight_size > (net->mtu * 2)) - queue_only = 1; - asoc->ifp_had_enobuf = 0; - } else { - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - } /* Are we aborting? */ if (srcv->sinfo_flags & SCTP_ABORT) { struct mbuf *mm; @@ -12857,7 +12826,6 @@ sctp_lower_sosend(struct socket *so, } inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); } - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; } else { @@ -12886,9 +12854,7 @@ skip_preblock: if (top == NULL) { struct sctp_stream_queue_pending *sp; struct sctp_stream_out *strm; - uint32_t sndout, initial_out; - - initial_out = uio->uio_resid; + uint32_t sndout; SCTP_TCB_SEND_LOCK(stcb); if ((asoc->stream_locked) && @@ -13052,29 +13018,34 @@ skip_preblock: /* Non-blocking io in place out */ goto skip_out_eof; } + /* What about the INIT, send it maybe */ + if (queue_only_for_init) { + if (hold_tcblock == 0) { + SCTP_TCB_LOCK(stcb); + hold_tcblock = 1; + } + if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { + /* a collision took us forward? */ + queue_only = 0; + } else { + sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); + SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); + queue_only = 1; + } + } if ((net->flight_size > net->cwnd) && (asoc->sctp_cmt_on_off == 0)) { + SCTP_STAT_INCR(sctps_send_cwnd_avoid); queue_only = 1; } else if (asoc->ifp_had_enobuf) { SCTP_STAT_INCR(sctps_ifnomemqueued); - if (net->flight_size > (net->mtu * 2)) { + if (net->flight_size > (2 * net->mtu)) { queue_only = 1; - } else { - queue_only = 0; } asoc->ifp_had_enobuf = 0; - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - } else { - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - if (net->flight_size > net->cwnd) { - queue_only = 1; - SCTP_STAT_INCR(sctps_send_cwnd_avoid); - } else { - queue_only = 0; - } } + un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + + (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && @@ -13098,7 +13069,6 @@ skip_preblock: SCTP_STAT_INCR(sctps_naglesent); nagle_applies = 0; } - /* What about the INIT, send it maybe */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { sctp_misc_ints(SCTP_CWNDLOG_PRESEND, queue_only_for_init, queue_only, @@ -13107,22 +13077,8 @@ skip_preblock: stcb->asoc.total_flight, stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count); } - if (queue_only_for_init) { - if (hold_tcblock == 0) { - SCTP_TCB_LOCK(stcb); - hold_tcblock = 1; - } - if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { - /* a collision took us forward? */ - queue_only_for_init = 0; - queue_only = 0; - } else { - sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); - SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); - queue_only_for_init = 0; - queue_only = 1; - } - } + if (queue_only_for_init) + queue_only_for_init = 0; if ((queue_only == 0) && (nagle_applies == 0)) { /*- * need to start chunk output @@ -13215,7 +13171,7 @@ skip_preblock: if (uio->uio_resid == 0) { got_all_of_the_send = 1; } - } else if (top) { + } else { /* We send in a 0, since we do NOT have any locks */ error = sctp_msg_append(stcb, net, top, srcv, 0); top = NULL; @@ -13326,29 +13282,33 @@ skip_out_eof: if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) { some_on_control = 1; } + if (queue_only_for_init) { + if (hold_tcblock == 0) { + SCTP_TCB_LOCK(stcb); + hold_tcblock = 1; + } + if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { + /* a collision took us forward? */ + queue_only = 0; + } else { + sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); + SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_WAIT); + queue_only = 1; + } + } if ((net->flight_size > net->cwnd) && (stcb->asoc.sctp_cmt_on_off == 0)) { + SCTP_STAT_INCR(sctps_send_cwnd_avoid); queue_only = 1; } else if (asoc->ifp_had_enobuf) { SCTP_STAT_INCR(sctps_ifnomemqueued); - if (net->flight_size > (net->mtu * 2)) { + if (net->flight_size > (2 * net->mtu)) { queue_only = 1; - } else { - queue_only = 0; } asoc->ifp_had_enobuf = 0; - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - } else { - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - if (net->flight_size > net->cwnd) { - queue_only = 1; - SCTP_STAT_INCR(sctps_send_cwnd_avoid); - } else { - queue_only = 0; - } } + un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + + (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && @@ -13371,22 +13331,15 @@ skip_out_eof: SCTP_STAT_INCR(sctps_naglesent); nagle_applies = 0; } - if (queue_only_for_init) { - if (hold_tcblock == 0) { - SCTP_TCB_LOCK(stcb); - hold_tcblock = 1; - } - if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { - /* a collision took us forward? */ - queue_only_for_init = 0; - queue_only = 0; - } else { - sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); - SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_WAIT); - queue_only_for_init = 0; - queue_only = 1; - } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { + sctp_misc_ints(SCTP_CWNDLOG_PRESEND, queue_only_for_init, queue_only, + nagle_applies, un_sent); + sctp_misc_ints(SCTP_CWNDLOG_PRESEND, stcb->asoc.total_output_queue_size, + stcb->asoc.total_flight, + stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count); } + if (queue_only_for_init) + queue_only_for_init = 0; if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) { /* we can attempt to send too. */ if (hold_tcblock == 0) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:01:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBECF10656B4; Thu, 9 Sep 2010 21:01:41 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBA6E8FC15; Thu, 9 Sep 2010 21:01: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 o89L1fDD032608; Thu, 9 Sep 2010 21:01:41 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89L1fiB032606; Thu, 9 Sep 2010 21:01:41 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009092101.o89L1fiB032606@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 9 Sep 2010 21:01: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: r212381 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:01:41 -0000 Author: mdf Date: Thu Sep 9 21:01:41 2010 New Revision: 212381 URL: http://svn.freebsd.org/changeset/base/212381 Log: Bump __FreeBSD_version for sbuf ABI change. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Sep 9 20:51:23 2010 (r212380) +++ head/sys/sys/param.h Thu Sep 9 21:01:41 2010 (r212381) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900019 /* Master, propagated to newvers */ +#define __FreeBSD_version 900020 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:15:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 346BA1065697; Thu, 9 Sep 2010 21:15:17 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23D8B8FC1E; Thu, 9 Sep 2010 21:15: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 o89LFH65034204; Thu, 9 Sep 2010 21:15:17 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89LFHpI034202; Thu, 9 Sep 2010 21:15:17 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009092115.o89LFHpI034202@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Sep 2010 21:15: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: r212382 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:15:17 -0000 Author: pjd Date: Thu Sep 9 21:15:16 2010 New Revision: 212382 URL: http://svn.freebsd.org/changeset/base/212382 Log: Remove duplicated code. MFC after: 2 weeks Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:01:41 2010 (r212381) +++ head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:15:16 2010 (r212382) @@ -488,7 +488,16 @@ vdev_init_from_nvlist(const unsigned cha vdev->v_name = strdup(type); } } + } else { + is_new = 0; + } + if (is_new || is_newer) { + /* + * This is either new vdev or we've already seen this vdev, + * but from an older vdev label, so let's refresh its state + * from the newer label. + */ if (is_offline) vdev->v_state = VDEV_STATE_OFFLINE; else if (is_removed) @@ -499,26 +508,6 @@ vdev_init_from_nvlist(const unsigned cha vdev->v_state = VDEV_STATE_DEGRADED; else vdev->v_state = VDEV_STATE_HEALTHY; - } else { - is_new = 0; - - if (is_newer) { - /* - * We've already seen this vdev, but from an older - * vdev label, so let's refresh its state from the - * newer label. - */ - if (is_offline) - vdev->v_state = VDEV_STATE_OFFLINE; - else if (is_removed) - vdev->v_state = VDEV_STATE_REMOVED; - else if (is_faulted) - vdev->v_state = VDEV_STATE_FAULTED; - else if (is_degraded) - vdev->v_state = VDEV_STATE_DEGRADED; - else - vdev->v_state = VDEV_STATE_HEALTHY; - } } rc = nvlist_find(nvlist, ZPOOL_CONFIG_CHILDREN, From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:18:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31AEA1065675; Thu, 9 Sep 2010 21:18:01 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20BEE8FC13; Thu, 9 Sep 2010 21:18: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 o89LI1G2034340; Thu, 9 Sep 2010 21:18:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89LI0an034338; Thu, 9 Sep 2010 21:18:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009092118.o89LI0an034338@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Sep 2010 21:18: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: r212383 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:18:01 -0000 Author: pjd Date: Thu Sep 9 21:18:00 2010 New Revision: 212383 URL: http://svn.freebsd.org/changeset/base/212383 Log: Allow to boot from a pool within which replacing is in progress. Before the change it wasn't possible and the following error was printed: ZFS: can only boot from disk, mirror or raidz vdevs Now if the original vdev (the one we are replacing) is still present we will read from it, but if it is not present we won't read from the new vdev, as it might not have enough valid data yet. MFC after: 2 weeks Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:15:16 2010 (r212382) +++ head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:18:00 2010 (r212383) @@ -376,6 +376,27 @@ vdev_mirror_read(vdev_t *vdev, const blk return (rc); } +static int +vdev_replacing_read(vdev_t *vdev, const blkptr_t *bp, void *buf, + off_t offset, size_t bytes) +{ + vdev_t *kid; + + /* + * Here we should have two kids: + * First one which is the one we are replacing and we can trust + * only this one to have valid data, but it might not be present. + * Second one is that one we are replacing with. It is most likely + * healthy, but we can't trust it has needed data, so we won't use it. + */ + kid = STAILQ_FIRST(&vdev->v_children); + if (kid == NULL) + return (EIO); + if (kid->v_state != VDEV_STATE_HEALTHY) + return (EIO); + return (kid->v_read(kid, bp, buf, offset, bytes)); +} + static vdev_t * vdev_find(uint64_t guid) { @@ -416,7 +437,7 @@ vdev_init_from_nvlist(const unsigned cha vdev_t *vdev, *kid; const unsigned char *kids; int nkids, i, is_new; - uint64_t is_offline, is_faulted, is_degraded, is_removed; + uint64_t is_offline, is_faulted, is_degraded, is_removed, isnt_present; if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64, 0, &guid) @@ -428,14 +449,17 @@ vdev_init_from_nvlist(const unsigned cha return (ENOENT); } + + if (strcmp(type, VDEV_TYPE_MIRROR) && strcmp(type, VDEV_TYPE_DISK) - && strcmp(type, VDEV_TYPE_RAIDZ)) { + && strcmp(type, VDEV_TYPE_RAIDZ) + && strcmp(type, VDEV_TYPE_REPLACING)) { printf("ZFS: can only boot from disk, mirror or raidz vdevs\n"); return (EIO); } - is_offline = is_removed = is_faulted = is_degraded = 0; + is_offline = is_removed = is_faulted = is_degraded = isnt_present = 0; nvlist_find(nvlist, ZPOOL_CONFIG_OFFLINE, DATA_TYPE_UINT64, 0, &is_offline); @@ -445,6 +469,8 @@ vdev_init_from_nvlist(const unsigned cha &is_faulted); nvlist_find(nvlist, ZPOOL_CONFIG_DEGRADED, DATA_TYPE_UINT64, 0, &is_degraded); + nvlist_find(nvlist, ZPOOL_CONFIG_NOT_PRESENT, DATA_TYPE_UINT64, 0, + &isnt_present); vdev = vdev_find(guid); if (!vdev) { @@ -454,6 +480,8 @@ vdev_init_from_nvlist(const unsigned cha vdev = vdev_create(guid, vdev_mirror_read); else if (!strcmp(type, VDEV_TYPE_RAIDZ)) vdev = vdev_create(guid, vdev_raidz_read); + else if (!strcmp(type, VDEV_TYPE_REPLACING)) + vdev = vdev_create(guid, vdev_replacing_read); else vdev = vdev_create(guid, vdev_disk_read); @@ -506,6 +534,8 @@ vdev_init_from_nvlist(const unsigned cha vdev->v_state = VDEV_STATE_FAULTED; else if (is_degraded) vdev->v_state = VDEV_STATE_DEGRADED; + else if (isnt_present) + vdev->v_state = VDEV_STATE_CANT_OPEN; else vdev->v_state = VDEV_STATE_HEALTHY; } From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:19:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6117110656EB; Thu, 9 Sep 2010 21:19:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50DE48FC20; Thu, 9 Sep 2010 21:19: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 o89LJAGD034432; Thu, 9 Sep 2010 21:19:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89LJA4H034431; Thu, 9 Sep 2010 21:19:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009092119.o89LJA4H034431@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Sep 2010 21:19: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: r212384 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:19:10 -0000 Author: pjd Date: Thu Sep 9 21:19:09 2010 New Revision: 212384 URL: http://svn.freebsd.org/changeset/base/212384 Log: Ignore log vdevs. MFC after: 2 weeks Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:18:00 2010 (r212383) +++ head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:19:09 2010 (r212384) @@ -773,6 +773,7 @@ vdev_probe(vdev_phys_read_t *read, void uint64_t val; uint64_t guid; uint64_t pool_txg, pool_guid; + uint64_t is_log; const char *pool_name; const unsigned char *vdevs; int i, rc, is_newer; @@ -849,6 +850,12 @@ vdev_probe(vdev_phys_read_t *read, void return (EIO); } + is_log = 0; + (void) nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, 0, + &is_log); + if (is_log) + return (EIO); + /* * Create the pool if this is the first time we've seen it. */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:20:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 806B710656CA; Thu, 9 Sep 2010 21:20:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F7BA8FC1F; Thu, 9 Sep 2010 21:20: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 o89LKIo7034519; Thu, 9 Sep 2010 21:20:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89LKIRc034517; Thu, 9 Sep 2010 21:20:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009092120.o89LKIRc034517@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Sep 2010 21:20: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: r212385 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:20:18 -0000 Author: pjd Date: Thu Sep 9 21:20:18 2010 New Revision: 212385 URL: http://svn.freebsd.org/changeset/base/212385 Log: On FreeBSD we can log from pool that have multiple top-level vdevs or log vdevs, so don't deny adding new vdevs if bootfs property is set. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c 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 Thu Sep 9 21:19:09 2010 (r212384) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Sep 9 21:20:18 2010 (r212385) @@ -1217,8 +1217,12 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) { spa_t *spa; int error; +#ifdef sun nvlist_t *config, **l2cache, **spares; uint_t nl2cache = 0, nspares = 0; +#else + nvlist_t *config; +#endif error = spa_open(zc->zc_name, &spa, FTAG); if (error != 0) @@ -1226,6 +1230,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) error = get_nvlist(zc->zc_nvlist_conf, zc->zc_nvlist_conf_size, &config); +#ifdef sun (void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache); @@ -1246,6 +1251,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) spa_close(spa, FTAG); return (EDOM); } +#endif if (error == 0) { error = spa_vdev_add(spa, config); From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:26:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ACF710656CE; Thu, 9 Sep 2010 21:26:56 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED7468FC19; Thu, 9 Sep 2010 21:26: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 o89LQt0X034785; Thu, 9 Sep 2010 21:26:55 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89LQt4p034783; Thu, 9 Sep 2010 21:26:55 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201009092126.o89LQt4p034783@svn.freebsd.org> From: Christian Brueffer Date: Thu, 9 Sep 2010 21:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212386 - stable/8/sys/modules X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:26:56 -0000 Author: brueffer Date: Thu Sep 9 21:26:55 2010 New Revision: 212386 URL: http://svn.freebsd.org/changeset/base/212386 Log: MFC: r207979 Build the ixgbe(4) and mwlfw(4) modules by default. Modified: stable/8/sys/modules/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/modules/Makefile ============================================================================== --- stable/8/sys/modules/Makefile Thu Sep 9 21:20:18 2010 (r212385) +++ stable/8/sys/modules/Makefile Thu Sep 9 21:26:55 2010 (r212386) @@ -144,6 +144,7 @@ SUBDIR= ${_3dfx} \ ${_iwn} \ ${_iwnfw} \ ${_ixgb} \ + ${_ixgbe} \ jme \ joy \ kbdmux \ @@ -190,6 +191,7 @@ SUBDIR= ${_3dfx} \ msk \ mvs \ mwl \ + mwlfw \ mxge \ my \ ${_ncp} \ @@ -457,6 +459,7 @@ _iwifw= iwifw _iwn= iwn _iwnfw= iwnfw _ixgb= ixgb +_ixgbe= ixgbe _mly= mly _nfe= nfe _nve= nve @@ -527,6 +530,7 @@ _iwifw= iwifw _iwn= iwn _iwnfw= iwnfw _ixgb= ixgb +_ixgbe= ixgbe _lindev= lindev _linprocfs= linprocfs _linsysfs= linsysfs From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:32:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 709011065695; Thu, 9 Sep 2010 21:32:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6015A8FC13; Thu, 9 Sep 2010 21:32:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o89LWAFL035242; Thu, 9 Sep 2010 21:32:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89LWAjN035240; Thu, 9 Sep 2010 21:32:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009092132.o89LWAjN035240@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Sep 2010 21:32: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: r212387 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:32:10 -0000 Author: pjd Date: Thu Sep 9 21:32:09 2010 New Revision: 212387 URL: http://svn.freebsd.org/changeset/base/212387 Log: Remove empty lines committed by accident. MFC after: 2 weeks Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:26:55 2010 (r212386) +++ head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:32:09 2010 (r212387) @@ -449,8 +449,6 @@ vdev_init_from_nvlist(const unsigned cha return (ENOENT); } - - if (strcmp(type, VDEV_TYPE_MIRROR) && strcmp(type, VDEV_TYPE_DISK) && strcmp(type, VDEV_TYPE_RAIDZ) From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:37:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7200010656F7; Thu, 9 Sep 2010 21:37:05 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6123C8FC15; Thu, 9 Sep 2010 21:37: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 o89Lb5Rj035981; Thu, 9 Sep 2010 21:37:05 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89Lb5Jn035979; Thu, 9 Sep 2010 21:37:05 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201009092137.o89Lb5Jn035979@svn.freebsd.org> From: Christian Brueffer Date: Thu, 9 Sep 2010 21:37: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: r212388 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:37:05 -0000 Author: brueffer Date: Thu Sep 9 21:37:05 2010 New Revision: 212388 URL: http://svn.freebsd.org/changeset/base/212388 Log: Some more grammar, wording and mdoc fixes. Modified: head/share/man/man4/aesni.4 Modified: head/share/man/man4/aesni.4 ============================================================================== --- head/share/man/man4/aesni.4 Thu Sep 9 21:32:09 2010 (r212387) +++ head/share/man/man4/aesni.4 Thu Sep 9 21:37:05 2010 (r212388) @@ -50,20 +50,24 @@ Starting with some models of Core i5/i7, a new set of instructions called AESNI. The set of six instructions accelerates the calculation of the key schedule for key lengths of 128, 192, and 256 of the Advanced -Encryption Standard (AES) symmetric cipher, and provides hardware +Encryption Standard (AES) symmetric cipher, and provides a hardware implementation of the regular and the last encryption and decryption rounds. .Pp The processor capability is reported as AESNI in the Features2 line at boot. -Driver does not attach on the system that lacks the required CPU capability. +The +.Nm +driver does not attach on systems that lack the required CPU capability. .Pp The .Nm driver registers itself to accelerate AES operations for .Xr crypto 4 . -Besides speed, the advantage of using the driver is that the AESNI operation +Besides speed, the advantage of using the +.Nm +driver is that the AESNI operation is data-independent, thus eliminating some attack vectors based on -measuring cache use and timings typically present in the table-driven +measuring cache use and timings typically present in table-driven implementations. .Sh SEE ALSO .Xr crypt 3 , From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:39:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C1EC1065696; Thu, 9 Sep 2010 21:39:06 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B68D8FC16; Thu, 9 Sep 2010 21:39: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 o89Ld65Q036290; Thu, 9 Sep 2010 21:39:06 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89Ld66S036288; Thu, 9 Sep 2010 21:39:06 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201009092139.o89Ld66S036288@svn.freebsd.org> From: Christian Brueffer Date: Thu, 9 Sep 2010 21:39: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: r212389 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:39:06 -0000 Author: brueffer Date: Thu Sep 9 21:39:06 2010 New Revision: 212389 URL: http://svn.freebsd.org/changeset/base/212389 Log: Xref aesni(4). Modified: head/share/man/man4/crypto.4 Modified: head/share/man/man4/crypto.4 ============================================================================== --- head/share/man/man4/crypto.4 Thu Sep 9 21:37:05 2010 (r212388) +++ head/share/man/man4/crypto.4 Thu Sep 9 21:39:06 2010 (r212389) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2009 +.Dd September 7, 2010 .Dt CRYPTO 4 .Os .Sh NAME @@ -106,6 +106,7 @@ asymmetric cryptographic features are po crypto access device .El .Sh SEE ALSO +.Xr aesni 4 , .Xr glxsb 4 , .Xr hifn 4 , .Xr ipsec 4 , From owner-svn-src-all@FreeBSD.ORG Thu Sep 9 21:59:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B7021065698; Thu, 9 Sep 2010 21:59:54 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 302F38FC15; Thu, 9 Sep 2010 21:59: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 o89Lxs3n038449; Thu, 9 Sep 2010 21:59:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o89LxsHf038447; Thu, 9 Sep 2010 21:59:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009092159.o89LxsHf038447@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 9 Sep 2010 21:59: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: r212390 - head/bin/expr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 21:59:54 -0000 Author: jilles Date: Thu Sep 9 21:59:53 2010 New Revision: 212390 URL: http://svn.freebsd.org/changeset/base/212390 Log: expr(1): Add sh(1) versions of examples, remove an incorrect example. The three examples are better done using sh(1) itself these days. The example expr -- "$a" : ".*" is incorrect in the general case, as "$a" may be an operator. MFC after: 2 weeks Modified: head/bin/expr/expr.1 Modified: head/bin/expr/expr.1 ============================================================================== --- head/bin/expr/expr.1 Thu Sep 9 21:39:06 2010 (r212389) +++ head/bin/expr/expr.1 Thu Sep 9 21:59:53 2010 (r212390) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2004 +.Dd September 9, 2010 .Dt EXPR 1 .Os .Sh NAME @@ -217,6 +217,9 @@ command, one might rearrange the express More generally, parenthesize possibly-negative values: .Dl "a=$(expr \e( $a \e) + 1)" .It +With shell arithmetic, no escaping is required: +.Dl "a=$((a + 1))" +.It This example prints the filename portion of a pathname stored in variable .Va a . @@ -229,6 +232,12 @@ The .Li // characters resolve this ambiguity. .Dl "expr \*q//$a\*q \&: '.*/\e(.*\e)'" +.It +With modern +.Xr sh 1 +syntax, +.Dl "\*q${a##*/}\*q" +expands to the same value. .El .Pp The following examples output the number of characters in variable @@ -237,19 +246,21 @@ Again, if .Va a might begin with a hyphen, it is necessary to prevent it from being interpreted as an option to -.Nm . +.Nm , +and +.Va a +might be interpreted as an operator. .Bl -bullet .It -If the -.Nm -command conforms to -.St -p1003.1-2001 , -this is simple: -.Dl "expr -- \*q$a\*q \&: \*q.*\*q" -.It -For portability to older systems, however, a more complicated command +To deal with all of this, a complicated command is required: .Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1" +.It +With modern +.Xr sh 1 +syntax, this can be done much more easily: +.Dl "${#a}" +expands to the required number. .El .Sh SEE ALSO .Xr sh 1 , From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 00:00:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 522241065672; Fri, 10 Sep 2010 00:00:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FA298FC0C; Fri, 10 Sep 2010 00:00: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 o8A007Uk054071; Fri, 10 Sep 2010 00:00:07 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A007PP054069; Fri, 10 Sep 2010 00:00:07 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009100000.o8A007PP054069@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 10 Sep 2010 00:00: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: r212403 - head/sys/contrib/pf/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 00:00:07 -0000 Author: bz Date: Fri Sep 10 00:00:06 2010 New Revision: 212403 URL: http://svn.freebsd.org/changeset/base/212403 Log: When using pf routing options, properly handle IP fragmentation for interfaces with TSO enabled, otherwise one would see an extra ICMP unreach, frag needed pre matching packet on lo0. This syncs pf code to ip_output.c r162084. PR: kern/144311 Submitted by: yongari via mlaier Reviewed by: eri Tested by: kib MFC after: 8 days Modified: head/sys/contrib/pf/net/pf.c Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Thu Sep 9 23:45:59 2010 (r212402) +++ head/sys/contrib/pf/net/pf.c Fri Sep 10 00:00:06 2010 (r212403) @@ -6375,6 +6375,7 @@ pf_route(struct mbuf **m, struct pf_rule m0->m_pkthdr.csum_flags &= ifp->if_hwassist; if (ntohs(ip->ip_len) <= ifp->if_mtu || + (m0->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 || (ifp->if_hwassist & CSUM_FRAGMENT && ((ip->ip_off & htons(IP_DF)) == 0))) { /* @@ -6449,7 +6450,7 @@ pf_route(struct mbuf **m, struct pf_rule * Too large for interface; fragment if possible. * Must be able to put at least 8 bytes per fragment. */ - if (ip->ip_off & htons(IP_DF)) { + if (ip->ip_off & htons(IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) { KMOD_IPSTAT_INC(ips_cantfrag); if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 01:47:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00626106566C; Fri, 10 Sep 2010 01:47:38 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E25438FC18; Fri, 10 Sep 2010 01:47: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 o8A1lbvC061272; Fri, 10 Sep 2010 01:47:37 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A1lb7E061266; Fri, 10 Sep 2010 01:47:37 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009100147.o8A1lb7E061266@svn.freebsd.org> From: David Xu Date: Fri, 10 Sep 2010 01:47: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: r212405 - in head/lib: libc/stdlib libc/sys libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 01:47:38 -0000 Author: davidxu Date: Fri Sep 10 01:47:37 2010 New Revision: 212405 URL: http://svn.freebsd.org/changeset/base/212405 Log: Because POSIX does not allow EINTR to be returned from sigwait(), add a wrapper for it in libc and rework the code in libthr, the system call still can return EINTR, we keep this feature. Discussed on: thread Reviewed by: jilles Added: head/lib/libc/sys/sigwait.c (contents, props changed) Modified: head/lib/libc/stdlib/Makefile.inc head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libthr/thread/thr_sig.c Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Fri Sep 10 00:23:44 2010 (r212404) +++ head/lib/libc/stdlib/Makefile.inc Fri Sep 10 01:47:37 2010 (r212405) @@ -9,7 +9,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate getsubopt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c malloc.c \ merge.c ptsname.c qsort.c qsort_r.c radixsort.c rand.c random.c \ - reallocf.c realpath.c remque.c strfmon.c strtoimax.c \ + reallocf.c realpath.c remque.c sigwait.c strfmon.c strtoimax.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Fri Sep 10 00:23:44 2010 (r212404) +++ head/lib/libc/sys/Makefile.inc Fri Sep 10 01:47:37 2010 (r212405) @@ -21,6 +21,9 @@ SRCS+= stack_protector.c stack_protector SRCS+= fcntl.c ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c PSEUDO+= _fcntl.o .endif +SRCS+= sigwait.c +NOASM+= sigwait.o +PSEUDO+= _sigwait.o # Add machine dependent asm sources: SRCS+=${MDASM} Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Fri Sep 10 00:23:44 2010 (r212404) +++ head/lib/libc/sys/Symbol.map Fri Sep 10 01:47:37 2010 (r212405) @@ -919,6 +919,7 @@ FBSDprivate_1.0 { _sigtimedwait; __sys_sigtimedwait; _sigwait; + __sigwait; __sys_sigwait; _sigwaitinfo; __sys_sigwaitinfo; Added: head/lib/libc/sys/sigwait.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/sigwait.c Fri Sep 10 01:47:37 2010 (r212405) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2010 davidxu@freebsd.org + * + * 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 + +int __sys_sigwait(const sigset_t * restrict, int * restrict); + +__weak_reference(__sigwait, sigwait); + +int +__sigwait(const sigset_t * restrict set, int * restrict sig) +{ + int ret; + + /* POSIX does not allow EINTR to be returned */ + do { + ret = __sys_sigwait(set, sig); + } while (ret == EINTR); + return (ret); +} Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Fri Sep 10 00:23:44 2010 (r212404) +++ head/lib/libthr/thread/thr_sig.c Fri Sep 10 01:47:37 2010 (r212405) @@ -67,7 +67,7 @@ int _sigtimedwait(const sigset_t *set, s const struct timespec * timeout); int __sigwaitinfo(const sigset_t *set, siginfo_t *info); int _sigwaitinfo(const sigset_t *set, siginfo_t *info); -int __sigwait(const sigset_t *set, int *sig); +int ___sigwait(const sigset_t *set, int *sig); int _sigwait(const sigset_t *set, int *sig); int __sigsuspend(const sigset_t *sigmask); int _sigaction(int, const struct sigaction *, struct sigaction *); @@ -634,7 +634,7 @@ __sigsuspend(const sigset_t * set) return (ret); } -__weak_reference(__sigwait, sigwait); +__weak_reference(___sigwait, sigwait); __weak_reference(__sigtimedwait, sigtimedwait); __weak_reference(__sigwaitinfo, sigwaitinfo); @@ -708,15 +708,17 @@ _sigwait(const sigset_t *set, int *sig) * it is not canceled. */ int -__sigwait(const sigset_t *set, int *sig) +___sigwait(const sigset_t *set, int *sig) { struct pthread *curthread = _get_curthread(); sigset_t newset; int ret; - _thr_cancel_enter(curthread); - ret = __sys_sigwait(thr_remove_thr_signals(set, &newset), sig); - _thr_cancel_leave(curthread, (ret != 0)); + do { + _thr_cancel_enter(curthread); + ret = __sys_sigwait(thr_remove_thr_signals(set, &newset), sig); + _thr_cancel_leave(curthread, (ret != 0)); + } while (ret == EINTR); return (ret); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 02:54:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0DA3106564A; Fri, 10 Sep 2010 02:54:02 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 7ED308FC0C; Fri, 10 Sep 2010 02:54:02 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id o8A2s2cN098752; Thu, 9 Sep 2010 19:54:02 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id o8A2s28W098751; Thu, 9 Sep 2010 19:54:02 -0700 (PDT) (envelope-from sgk) Date: Thu, 9 Sep 2010 19:54:02 -0700 From: Steve Kargl To: Kai Wang Message-ID: <20100910025402.GA98740@troutmask.apl.washington.edu> References: <201009091851.o89IpoFR019035@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201009091851.o89IpoFR019035@svn.freebsd.org> 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: r212373 - head/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 02:54:02 -0000 On Thu, Sep 09, 2010 at 06:51:50PM +0000, Kai Wang wrote: > Author: kaiw > Date: Thu Sep 9 18:51:50 2010 > New Revision: 212373 > URL: http://svn.freebsd.org/changeset/base/212373 > > Log: > libelf is overly strict about the type and alignment of Elf_Data > objects inside one ELF section, which prevents the creation of a ELF > section with mixed data types. For example, gcc LTO use libelf to > create a .gnu_lto_XXX section that contains integers and a string > table, which doesn't work with our libelf implementation. > > The changes made in this commit include: > * Allow Elf_Data type to be different than section type. > * Relax Elf_Data alignment check. > * Align each Elf_Data by their own alignment instead of section alignment. > > MFC after: 1 month > > Modified: > head/lib/libelf/elf_update.c > libelf still doesn't work with GCC. All testsuite failures are of the form collect2: lto-wrapper returned 1 exit status compiler exited with status 1 output is: lto1: error: could not open ELF file: Request error: invalid ELF_C_* argument lto-wrapper: /usr/home/sgk/gcc/obj4x/gcc/testsuite/gfortran/../../gfortran returned 1 exit status collect2: lto-wrapper returned 1 exit status -- Steve From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 03:00:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4842C1065673; Fri, 10 Sep 2010 03:00:51 +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 163878FC15; Fri, 10 Sep 2010 03:00:51 +0000 (UTC) Received: from bigwig.baldwin.cx (unknown [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 97BDD46C22; Thu, 9 Sep 2010 16:25:49 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5E35A8A04E; Thu, 9 Sep 2010 16:24:43 -0400 (EDT) From: John Baldwin To: mdf@freebsd.org Date: Thu, 9 Sep 2010 16:24:16 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009091819.o89IJGLr015797@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009091624.17060.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 09 Sep 2010 16:24:43 -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: r212368 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 03:00:51 -0000 On Thursday, September 09, 2010 4:10:55 pm mdf@freebsd.org wrote: > On Thu, Sep 9, 2010 at 11:19 AM, John Baldwin wrote: > > Author: jhb > > Date: Thu Sep 9 18:19:15 2010 > > New Revision: 212368 > > URL: http://svn.freebsd.org/changeset/base/212368 > > > > Log: > > - Rename the constant for the Master Data Parity Error flag in the > > PCI status register to map its current name. > > - Use PCIM_* rather than PCIR_* for constants for fields in various AER > > registers. I got about half of them right in the previous commit. > > > > MFC after: 1 week > > > > Modified: > > head/sys/dev/pci/pcireg.h > > This seems to break building CURRENT with this error: > > /data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'mskc_reset': > /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: > 'PCIM_STATUS_PERRREPORT' undeclared (first use in this function) > /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: (Each undeclared > identifier is reported only once > /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: for each function > it appears in.) > /data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'msk_intr_hwerr': > /data/sb/bsd.git/sys/dev/msk/if_msk.c:3408: error: > 'PCIM_STATUS_PERRREPORT' undeclared (first use in this function) My bad, I will fix. Surprised a driver is even messing with this bit as only the PCI bus driver should really be doing so (if it grows error handling ability). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 03:25:46 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82FCC106564A; Fri, 10 Sep 2010 03:25:46 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2E68FC1D; Fri, 10 Sep 2010 03:25:45 +0000 (UTC) X-Spam-Status: No X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.001, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_20 -0.00) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: o8A3DRVg000389 Received: from kobe.laptop (79.103.63.75.dsl.dyn.forthnet.gr [79.103.63.75]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-9.2) with ESMTP id o8A3DRVg000389 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 10 Sep 2010 06:13:34 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.4/8.14.4) with ESMTP id o8A3DMHn070977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Sep 2010 06:13:22 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.4/8.14.4/Submit) id o8A3DLDw070974; Fri, 10 Sep 2010 06:13:21 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Pawel Jakub Dawidek References: <201009092119.o89LJA4H034431@svn.freebsd.org> Date: Fri, 10 Sep 2010 06:13:21 +0300 In-Reply-To: <201009092119.o89LJA4H034431@svn.freebsd.org> (Pawel Jakub Dawidek's message of "Thu, 9 Sep 2010 21:19:10 +0000 (UTC)") Message-ID: <8762yeqoj2.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212384 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 03:25:46 -0000 On Thu, 9 Sep 2010 21:19:10 +0000 (UTC), Pawel Jakub Dawidek wrote: > Author: pjd > Date: Thu Sep 9 21:19:09 2010 > New Revision: 212384 > URL: http://svn.freebsd.org/changeset/base/212384 > > Log: > Ignore log vdevs. > > MFC after: 2 weeks > --- head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:18:00 2010 (r212383) > +++ head/sys/boot/zfs/zfsimpl.c Thu Sep 9 21:19:09 2010 (r212384) > @@ -849,6 +850,12 @@ vdev_probe(vdev_phys_read_t *read, void > return (EIO); > } > > + is_log = 0; > + (void) nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, 0, > + &is_log); > + if (is_log) > + return (EIO); > + ZPOOL_CONFIG_IS_LOG is not visible in zfsimpl.c and it breaks the build here with: /usr/src/sys/boot/zfs/zfsimpl.c: In function 'vdev_probe': /usr/src/sys/boot/zfs/zfsimpl.c:853: error: 'ZPOOL_CONFIG_IS_LOG' undeclared (first use in this function) /usr/src/sys/boot/zfs/zfsimpl.c:853: error: (Each undeclared identifier is reported only once /usr/src/sys/boot/zfs/zfsimpl.c:853: error: for each function it appears in.) It looks like we have to resync the ZFS_CONFIG_XXX defines from zfs.h to zfsimpl.h to make this buildable again: %%% diff -r 561815530ad6 sys/cddl/boot/zfs/zfsimpl.h --- a/sys/cddl/boot/zfs/zfsimpl.h Fri May 07 22:51:07 2010 +0300 +++ b/sys/cddl/boot/zfs/zfsimpl.h Fri Sep 10 06:13:11 2010 +0300 @@ -546,17 +546,23 @@ #define ZPOOL_CONFIG_NPARITY "nparity" #define ZPOOL_CONFIG_HOSTID "hostid" #define ZPOOL_CONFIG_HOSTNAME "hostname" -#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ - +#define ZPOOL_CONFIG_UNSPARE "unspare" +#define ZPOOL_CONFIG_PHYS_PATH "phys_path" +#define ZPOOL_CONFIG_IS_LOG "is_log" +#define ZPOOL_CONFIG_L2CACHE "l2cache" +#define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */ +#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ +#define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */ /* * The persistent vdev state is stored as separate values rather than a single * 'vdev_state' entry. This is because a device can be in multiple states, such * as offline and degraded. */ -#define ZPOOL_CONFIG_OFFLINE "offline" -#define ZPOOL_CONFIG_FAULTED "faulted" -#define ZPOOL_CONFIG_DEGRADED "degraded" -#define ZPOOL_CONFIG_REMOVED "removed" +#define ZPOOL_CONFIG_OFFLINE "offline" +#define ZPOOL_CONFIG_FAULTED "faulted" +#define ZPOOL_CONFIG_DEGRADED "degraded" +#define ZPOOL_CONFIG_REMOVED "removed" +#define ZPOOL_CONFIG_FRU "fru" #define VDEV_TYPE_ROOT "root" #define VDEV_TYPE_MIRROR "mirror" %%% From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 03:52:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4F70106564A; Fri, 10 Sep 2010 03:52:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C36D28FC1B; Fri, 10 Sep 2010 03:52: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 o8A3q52b073129; Fri, 10 Sep 2010 03:52:05 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A3q5u4073127; Fri, 10 Sep 2010 03:52:05 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009100352.o8A3q5u4073127@svn.freebsd.org> From: Warner Losh Date: Fri, 10 Sep 2010 03:52:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212406 - stable/8/tools/tools/nanobsd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 03:52:05 -0000 Author: imp Date: Fri Sep 10 03:52:05 2010 New Revision: 212406 URL: http://svn.freebsd.org/changeset/base/212406 Log: MFC: r212169: Allow / in the NANO_DEVICE r209225: Allow boot.config to have different values than just -h. r209210: Allow population of /cfg and /data. Begin the move to making all slice creation overrideable too, but there's a few problems doing that for the duplicated partitions (s1 and s2), so just comment that it needs work. r209209: Create a make.conf. not needed for runtime, but some ports want to spam it at compile or install time. r209207: make these convenience functions more convenient by accepting all args, not just the first. makes mechanical conversion of old style more forgiving. r207436: Fix typo in usage message. Add -n to the list of valid arguments. r206276: Fix comment about NANO_ARCH. It can be set now. Also add a warning about how it confuses TARGET and TARGET_ARCH and the need to separate the two out into independent variables. Modified: stable/8/tools/tools/nanobsd/nanobsd.sh Directory Properties: stable/8/tools/tools/nanobsd/ (props changed) Modified: stable/8/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- stable/8/tools/tools/nanobsd/nanobsd.sh Fri Sep 10 01:47:37 2010 (r212405) +++ stable/8/tools/tools/nanobsd/nanobsd.sh Fri Sep 10 03:52:05 2010 (r212406) @@ -124,6 +124,10 @@ NANO_HEADS=16 NANO_BOOT0CFG="-o packet -s 1 -m 3" NANO_BOOTLOADER="boot/boot0sio" +# boot2 flags/options +# default force serial console +NANO_BOOT2CFG="-h" + # Backing type of md(4) device # Can be "file" or "swap" NANO_MD_BACKING="file" @@ -132,7 +136,10 @@ NANO_MD_BACKING="file" PPLEVEL=3 ####################################################################### -# Not a variable at this time +# Architecture to build. Corresponds to TARGET_ARCH in a buildworld. +# Unfortunately, there's no way to set TARGET at this time, and it +# conflates the two, so architectures where TARGET != TARGET_ARCH do +# not work. This defaults to the arch of the current machine. NANO_ARCH=`uname -p` @@ -354,6 +361,30 @@ prune_usr() ( done ) +populate_slice ( ) ( + local dev dir mnt + dev=$1 + dir=$2 + mnt=$3 + test -z $2 && dir=/var/empty + test -d $d || dir=/var/empty + echo "Creating ${dev} with ${dir} (mounting on ${mnt})" + newfs ${NANO_NEWFS} ${dev} + mount ${dev} ${mnt} + cd ${dir} + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt} + df -i ${mnt} + umount ${mnt} +) + +populate_cfg_slice ( ) ( + populate_slice "$1" "$2" "$3" +) + +populate_data_slice ( ) ( + populate_slice "$1" "$2" "$3" +) + create_i386_diskimage ( ) ( pprint 2 "build diskimage" pprint 3 "log: ${NANO_OBJ}/_.di" @@ -453,6 +484,7 @@ create_i386_diskimage ( ) ( bsdlabel ${MD}s1 # Create first image + # XXX: should use populate_slice for easier override newfs ${NANO_NEWFS} /dev/${MD}s1a mount /dev/${MD}s1a ${MNT} df -i ${MNT} @@ -471,19 +503,17 @@ create_i386_diskimage ( ) ( mount /dev/${MD}s2a ${MNT} for f in ${MNT}/etc/fstab ${MNT}/conf/base/etc/fstab do - sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f + sed -i "" "s=${NANO_DRIVE}s1=${NANO_DRIVE}s2=g" $f done umount ${MNT} fi # Create Config slice - newfs ${NANO_NEWFS} /dev/${MD}s3 - # XXX: fill from where ? + populate_cfg_slice /dev/${MD}s3 "${NANO_CFGDIR}" ${MNT} # Create Data slice, if any. if [ $NANO_DATASIZE -ne 0 ] ; then - newfs ${NANO_NEWFS} /dev/${MD}s4 - # XXX: fill from where ? + populate_data_slice /dev/${MD}s4 "${NANO_DATADIR}" ${MNT} fi if [ "${NANO_MD_BACKING}" = "swap" ] ; then @@ -582,7 +612,7 @@ cust_comconsole () ( sed -i "" -e '/^ttyv[0-8]/s/ on/ off/' ${NANO_WORLDDIR}/etc/ttys # Tell loader to use serial console early. - echo " -h" > ${NANO_WORLDDIR}/boot.config + echo "${NANO_BOOT2CFG}" > ${NANO_WORLDDIR}/boot.config ) ####################################################################### @@ -650,19 +680,19 @@ cust_pkg () ( ####################################################################### # Convenience function: -# Register $1 as customize function. +# Register all args as customize function. customize_cmd () { - NANO_CUSTOMIZE="$NANO_CUSTOMIZE $1" + NANO_CUSTOMIZE="$NANO_CUSTOMIZE $*" } ####################################################################### # Convenience function: -# Register $1 as late customize function to run just before +# Register all args as late customize function to run just before # image creation. late_customize_cmd () { - NANO_LATE_CUSTOMIZE="$NANO_LATE_CUSTOMIZE $1" + NANO_LATE_CUSTOMIZE="$NANO_LATE_CUSTOMIZE $*" } ####################################################################### @@ -682,12 +712,12 @@ pprint() { usage () { ( - echo "Usage: $0 [-bikqvw] [-c config_file]" + echo "Usage: $0 [-biknqvw] [-c config_file]" echo " -b suppress builds (both kernel and world)" echo " -i suppress disk image build" echo " -k suppress buildkernel" echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" - echo " -q make output more quite" + echo " -q make output more quiet" echo " -v make output more verbose" echo " -w suppress buildworld" echo " -c specify config file" From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 04:44:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B356F106564A; Fri, 10 Sep 2010 04:44:13 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2E9D8FC18; Fri, 10 Sep 2010 04:44: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 o8A4iDVo078581; Fri, 10 Sep 2010 04:44:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A4iDF4078579; Fri, 10 Sep 2010 04:44:13 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009100444.o8A4iDF4078579@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 10 Sep 2010 04:44: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: r212407 - head/sys/cddl/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 04:44:13 -0000 Author: pjd Date: Fri Sep 10 04:44:13 2010 New Revision: 212407 URL: http://svn.freebsd.org/changeset/base/212407 Log: Forgot to commit this file. Add ZPOOL_CONFIG_IS_LOG. Reported by: keramida MFC after: 2 weeks Modified: head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Fri Sep 10 03:52:05 2010 (r212406) +++ head/sys/cddl/boot/zfs/zfsimpl.h Fri Sep 10 04:44:13 2010 (r212407) @@ -546,6 +546,7 @@ typedef enum { #define ZPOOL_CONFIG_NPARITY "nparity" #define ZPOOL_CONFIG_HOSTID "hostid" #define ZPOOL_CONFIG_HOSTNAME "hostname" +#define ZPOOL_CONFIG_IS_LOG "is_log" #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ /* From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 04:45:13 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF4D106564A; Fri, 10 Sep 2010 04:45:13 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id DAC8B8FC18; Fri, 10 Sep 2010 04:45:12 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id E5CB345C9C; Fri, 10 Sep 2010 06:45:10 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id C290A45CA6; Fri, 10 Sep 2010 06:45:05 +0200 (CEST) Date: Fri, 10 Sep 2010 06:44:52 +0200 From: Pawel Jakub Dawidek To: Giorgos Keramidas Message-ID: <20100910044452.GD2065@garage.freebsd.pl> References: <201009092119.o89LJA4H034431@svn.freebsd.org> <8762yeqoj2.fsf@kobe.laptop> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OaZoDhBhXzo6bW1J" Content-Disposition: inline In-Reply-To: <8762yeqoj2.fsf@kobe.laptop> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212384 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 04:45:13 -0000 --OaZoDhBhXzo6bW1J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 10, 2010 at 06:13:21AM +0300, Giorgos Keramidas wrote: > ZPOOL_CONFIG_IS_LOG is not visible in zfsimpl.c and it breaks the build > here with: >=20 > /usr/src/sys/boot/zfs/zfsimpl.c: In function 'vdev_probe': > /usr/src/sys/boot/zfs/zfsimpl.c:853: error: 'ZPOOL_CONFIG_IS_LOG' undec= lared (first use in this function) > /usr/src/sys/boot/zfs/zfsimpl.c:853: error: (Each undeclared identifier= is reported only once > /usr/src/sys/boot/zfs/zfsimpl.c:853: error: for each function it appear= s in.) Yes, I forgot to include one file in 'svn commit'. Thanks! --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --OaZoDhBhXzo6bW1J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyJt8QACgkQForvXbEpPzSmnwCdF1ubbP4GLCrrVgZFzWKta1zE MYQAoNsFQGxkndV3jE7RlzWmkQ0GmDiZ =BIdY -----END PGP SIGNATURE----- --OaZoDhBhXzo6bW1J-- From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 05:01:51 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5139106564A; Fri, 10 Sep 2010 05:01:51 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 315898FC13; Fri, 10 Sep 2010 05:01:50 +0000 (UTC) X-Spam-Status: No X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: o8A51XcY010234 Received: from kobe.laptop (79.103.63.75.dsl.dyn.forthnet.gr [79.103.63.75]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-9.2) with ESMTP id o8A51XcY010234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 10 Sep 2010 08:01:42 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.4/8.14.4) with ESMTP id o8A51Spc049726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Sep 2010 08:01:28 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.4/8.14.4/Submit) id o8A51SLD049723; Fri, 10 Sep 2010 08:01:28 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Pawel Jakub Dawidek In-Reply-To: <20100910044452.GD2065@garage.freebsd.pl> (Pawel Jakub Dawidek's message of "Fri, 10 Sep 2010 06:44:52 +0200") References: <201009092119.o89LJA4H034431@svn.freebsd.org> <8762yeqoj2.fsf@kobe.laptop> <20100910044452.GD2065@garage.freebsd.pl> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) Date: Fri, 10 Sep 2010 08:01:28 +0300 Message-ID: <87vd6ep4yf.fsf@kobe.laptop> MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212384 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 05:01:51 -0000 On Fri, 10 Sep 2010 06:44:52 +0200, Pawel Jakub Dawidek wrote: > On Fri, Sep 10, 2010 at 06:13:21AM +0300, Giorgos Keramidas wrote: >> ZPOOL_CONFIG_IS_LOG is not visible in zfsimpl.c and it breaks the build >> here with: >> >> /usr/src/sys/boot/zfs/zfsimpl.c: In function 'vdev_probe': >> /usr/src/sys/boot/zfs/zfsimpl.c:853: error: 'ZPOOL_CONFIG_IS_LOG' undeclared (first use in this function) >> /usr/src/sys/boot/zfs/zfsimpl.c:853: error: (Each undeclared identifier is reported only once >> /usr/src/sys/boot/zfs/zfsimpl.c:853: error: for each function it appears in.) > > Yes, I forgot to include one file in 'svn commit'. Thanks! No problem. Problem resolved locally & in svn too :-) From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 06:26:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F153F10656CC; Fri, 10 Sep 2010 06:26:28 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E10A48FC0A; Fri, 10 Sep 2010 06:26: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 o8A6QS3K090923; Fri, 10 Sep 2010 06:26:28 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A6QSxI090921; Fri, 10 Sep 2010 06:26:28 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201009100626.o8A6QSxI090921@svn.freebsd.org> From: "David E. O'Brien" Date: Fri, 10 Sep 2010 06:26: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: r212408 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 06:26:29 -0000 Author: obrien Date: Fri Sep 10 06:26:28 2010 New Revision: 212408 URL: http://svn.freebsd.org/changeset/base/212408 Log: Protect BSDI $Id from accidental manipulation. Modified: head/sys/sys/lock.h Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Fri Sep 10 04:44:13 2010 (r212407) +++ head/sys/sys/lock.h Fri Sep 10 06:26:28 2010 (r212408) @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $ + * from BSDI Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp * $FreeBSD$ */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 07:06:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D6F8106564A; Fri, 10 Sep 2010 07:06:06 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C5278FC14; Fri, 10 Sep 2010 07: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 o8A766ZP097840; Fri, 10 Sep 2010 07:06:06 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A766v6097835; Fri, 10 Sep 2010 07:06:06 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009100706.o8A766v6097835@svn.freebsd.org> From: "Jayachandran C." Date: Fri, 10 Sep 2010 07: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: r212409 - in head/sys/mips/rmi: . dev/nlge dev/xlr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 07:06:06 -0000 Author: jchandra Date: Fri Sep 10 07:06:06 2010 New Revision: 212409 URL: http://svn.freebsd.org/changeset/base/212409 Log: Compilation fix - when INVARIANTS are turned off. Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/mips/rmi/dev/xlr/rge.c head/sys/mips/rmi/msgring.h Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Fri Sep 10 06:26:28 2010 (r212408) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Fri Sep 10 07:06:06 2010 (r212409) @@ -1953,7 +1953,10 @@ send_fmn_msg_tx(struct nlge_softc *sc, s uint32_t n_entries) { uint32_t msgrng_flags; - int i = 0, ret; + int ret; +#ifdef INVARIANTS + int i = 0; +#endif do { msgrng_flags = msgrng_access_enable(); Modified: head/sys/mips/rmi/dev/xlr/rge.c ============================================================================== --- head/sys/mips/rmi/dev/xlr/rge.c Fri Sep 10 06:26:28 2010 (r212408) +++ head/sys/mips/rmi/dev/xlr/rge.c Fri Sep 10 07:06:06 2010 (r212409) @@ -713,8 +713,11 @@ xlr_mac_send_fr(struct driver_data *priv { struct msgrng_msg msg; int stid = priv->rfrbucket; - int i = 0, code, ret; + int code, ret; uint32_t msgrng_flags; +#ifdef INVARIANTS + int i = 0; +#endif mac_make_desc_rfr(&msg, addr); Modified: head/sys/mips/rmi/msgring.h ============================================================================== --- head/sys/mips/rmi/msgring.h Fri Sep 10 06:26:28 2010 (r212408) +++ head/sys/mips/rmi/msgring.h Fri Sep 10 07:06:06 2010 (r212409) @@ -306,7 +306,9 @@ message_send(unsigned int size, unsigned { unsigned int dest = 0; unsigned long long status = 0; +#ifdef INVARIANTS int i = 0; +#endif msgrng_load_tx_msg0(msg->msg0); msgrng_load_tx_msg1(msg->msg1); From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 08:11:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7BA1106564A; Fri, 10 Sep 2010 08:11:48 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96CBE8FC18; Fri, 10 Sep 2010 08:11: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 o8A8Bmj3006000; Fri, 10 Sep 2010 08:11:48 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A8Bm1B005997; Fri, 10 Sep 2010 08:11:48 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201009100811.o8A8Bm1B005997@svn.freebsd.org> From: Bernhard Schmidt Date: Fri, 10 Sep 2010 08:11:48 +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: r212410 - in head/sys/dev: malo mwl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 08:11:48 -0000 Author: bschmidt Date: Fri Sep 10 08:11:48 2010 New Revision: 212410 URL: http://svn.freebsd.org/changeset/base/212410 Log: Fix firmware module dependencies. malo and mwl use the firmware framework to access firmware images. Depending on the firmware modules itself is not required and in this case even wrong because no modules with those names exist. Pointed out by: brucec MFC after: 1 week Modified: head/sys/dev/malo/if_malo_pci.c head/sys/dev/mwl/if_mwl_pci.c Modified: head/sys/dev/malo/if_malo_pci.c ============================================================================== --- head/sys/dev/malo/if_malo_pci.c Fri Sep 10 07:06:06 2010 (r212409) +++ head/sys/dev/malo/if_malo_pci.c Fri Sep 10 08:11:48 2010 (r212410) @@ -371,4 +371,4 @@ static devclass_t malo_devclass; DRIVER_MODULE(malo, pci, malo_pci_driver, malo_devclass, 0, 0); MODULE_VERSION(malo, 1); MODULE_DEPEND(malo, wlan, 1, 1, 1); /* 802.11 media layer */ -MODULE_DEPEND(malo, malofw_fw, 1, 1, 1); +MODULE_DEPEND(malo, firmware, 1, 1, 1); Modified: head/sys/dev/mwl/if_mwl_pci.c ============================================================================== --- head/sys/dev/mwl/if_mwl_pci.c Fri Sep 10 07:06:06 2010 (r212409) +++ head/sys/dev/mwl/if_mwl_pci.c Fri Sep 10 08:11:48 2010 (r212410) @@ -313,4 +313,4 @@ static devclass_t mwl_devclass; DRIVER_MODULE(mwl, pci, mwl_pci_driver, mwl_devclass, 0, 0); MODULE_VERSION(mwl, 1); MODULE_DEPEND(mwl, wlan, 1, 1, 1); /* 802.11 media layer */ -MODULE_DEPEND(mwl, mwlfw_fw, 1, 1, 1); /* firmware */ +MODULE_DEPEND(mwl, firmware, 1, 1, 1); From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 08:27:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA9C41065670; Fri, 10 Sep 2010 08:27:02 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA4378FC18; Fri, 10 Sep 2010 08:27: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 o8A8R2tI007861; Fri, 10 Sep 2010 08:27:02 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8A8R2mG007859; Fri, 10 Sep 2010 08:27:02 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201009100827.o8A8R2mG007859@svn.freebsd.org> From: Bernhard Schmidt Date: Fri, 10 Sep 2010 08:27: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: r212411 - head/etc/mtree X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 08:27:02 -0000 Author: bschmidt Date: Fri Sep 10 08:27:02 2010 New Revision: 212411 URL: http://svn.freebsd.org/changeset/base/212411 Log: Create the var/run/wpa_supplicant directory where the wpa_supplicant RC script wants to save a pidfile for each interface. MFC after: 2 weeks Modified: head/etc/mtree/BSD.var.dist Modified: head/etc/mtree/BSD.var.dist ============================================================================== --- head/etc/mtree/BSD.var.dist Fri Sep 10 08:11:48 2010 (r212410) +++ head/etc/mtree/BSD.var.dist Fri Sep 10 08:27:02 2010 (r212411) @@ -64,6 +64,8 @@ .. ppp gname=network mode=0770 .. + wpa_supplicant + .. .. rwho gname=daemon mode=0775 .. From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 09:59:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 838E61065673; Fri, 10 Sep 2010 09:59:32 +0000 (UTC) (envelope-from kaiwang27@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id AB5F28FC16; Fri, 10 Sep 2010 09:59:31 +0000 (UTC) Received: by ewy4 with SMTP id 4so1763842ewy.13 for ; Fri, 10 Sep 2010 02:59:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:received :x-authentication-warning:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=VGqYOAKYnhEzkeCs/mlrbjIyfdPx0LR8CblqQ3giNJ8=; b=k3qTD6tSx1NK3rViO+WIoNrz2zANAMgmwpRLx6hR73zxwwkZ005P409l0IhDyhlc9B nHbnJkHIPgR/NV3Fwhq2v+Su3e/9C9rPTevIC5bJfQ2CzfhIw4HUGB4/nC38ZE+OuNgp Qpl7yGPQBxuxGLFlIgAyMld81MX3mWbn077vU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=x-authentication-warning:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; b=j1Ju6qzZfkVFy/8fNBrlk7dPImLGwzkZtImnE6QKqvj0Zsb/aaK4I9ocN4MmWBE3dF YGe9TCCo47aYvpfRH6suDyG+7D6BLSfykK26aSMl5+QIlFyhMuqyw9O7IBx6IknokdSU LT3zwaUjeLgtzpLQ9UA7BjZ9dwkh8gUsZSFe8= Received: by 10.213.27.68 with SMTP id h4mr760465ebc.98.1284111461955; Fri, 10 Sep 2010 02:37:41 -0700 (PDT) Received: from localhost (81-233-38-26-no36.tbcn.telia.com [81.233.38.26]) by mx.google.com with ESMTPS id v8sm3591146eeh.14.2010.09.10.02.37.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 10 Sep 2010 02:37:39 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=localhost.my.domain) by localhost with esmtp (Exim 4.71 (FreeBSD)) (envelope-from ) id 1Ou037-0000gz-F9; Fri, 10 Sep 2010 11:37:37 +0200 Received: (from kaiw@localhost) by localhost.my.domain (8.14.3/8.14.3/Submit) id o8A9bbQZ002664; Fri, 10 Sep 2010 11:37:37 +0200 (CEST) (envelope-from kaiwang27@gmail.com) X-Authentication-Warning: localhost.my.domain: kaiw set sender to kaiwang27@gmail.com using -f Date: Fri, 10 Sep 2010 11:37:36 +0200 From: Kai Wang To: Steve Kargl Message-ID: <20100910093736.GA2594@viskning> References: <201009091851.o89IpoFR019035@svn.freebsd.org> <20100910025402.GA98740@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20100910025402.GA98740@troutmask.apl.washington.edu> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212373 - head/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 09:59:32 -0000 On Thu, Sep 09, 2010 at 07:54:02PM -0700, Steve Kargl wrote: > On Thu, Sep 09, 2010 at 06:51:50PM +0000, Kai Wang wrote: > > Author: kaiw > > Date: Thu Sep 9 18:51:50 2010 > > New Revision: 212373 > > URL: http://svn.freebsd.org/changeset/base/212373 > > > > Log: > > libelf is overly strict about the type and alignment of Elf_Data > > objects inside one ELF section, which prevents the creation of a ELF > > section with mixed data types. For example, gcc LTO use libelf to > > create a .gnu_lto_XXX section that contains integers and a string > > table, which doesn't work with our libelf implementation. > > > > The changes made in this commit include: > > * Allow Elf_Data type to be different than section type. > > * Relax Elf_Data alignment check. > > * Align each Elf_Data by their own alignment instead of section alignment. > > > > MFC after: 1 month > > > > Modified: > > head/lib/libelf/elf_update.c > > > > libelf still doesn't work with GCC. All testsuite failures > are of the form > > collect2: lto-wrapper returned 1 exit status > compiler exited with status 1 > output is: > lto1: error: could not open ELF file: Request error: invalid ELF_C_* argument > lto-wrapper: /usr/home/sgk/gcc/obj4x/gcc/testsuite/gfortran/../../gfortran returned 1 exit status > collect2: lto-wrapper returned 1 exit status Hi Steve, It seems that your lto1 was compiled with our libelf header but linked to GNU libelf. (I think "invalid ELF_C_* argument" is GNU libelf error message) Could you please check the value of "ldd /path/to/lto1" ? Thanks, Kai From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 11:01:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 088AC1065693; Fri, 10 Sep 2010 11:01:12 +0000 (UTC) (envelope-from sanpei@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D21E88FC08; Fri, 10 Sep 2010 11:01: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 o8AB1Bl8029935; Fri, 10 Sep 2010 11:01:11 GMT (envelope-from sanpei@svn.freebsd.org) Received: (from sanpei@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AB1BJt029933; Fri, 10 Sep 2010 11:01:11 GMT (envelope-from sanpei@svn.freebsd.org) Message-Id: <201009101101.o8AB1BJt029933@svn.freebsd.org> From: MIHIRA Sanpei Yoshiro Date: Fri, 10 Sep 2010 11:01: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: r212412 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 11:01:12 -0000 Author: sanpei Date: Fri Sep 10 11:01:11 2010 New Revision: 212412 URL: http://svn.freebsd.org/changeset/base/212412 Log: Add Planex UE-200TX-G to list of supported devices. (http://lists.freebsd.org/pipermail/freebsd-current/2008-December/001756.html) Submitted by: nork MFC after: 3 days Modified: head/share/man/man4/axe.4 Modified: head/share/man/man4/axe.4 ============================================================================== --- head/share/man/man4/axe.4 Fri Sep 10 08:27:02 2010 (r212411) +++ head/share/man/man4/axe.4 Fri Sep 10 11:01:11 2010 (r212412) @@ -182,6 +182,8 @@ Buffalo (Melco Inc.) LUA3-U2-ATX Cisco-Linksys USB200Mv2 .It D-Link DUBE100B1 +.It +Planex UE-200TX-G .El .Sh DIAGNOSTICS .Bl -diag From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 11:19:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A7D11065672; Fri, 10 Sep 2010 11:19:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65E798FC17; Fri, 10 Sep 2010 11:19: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 o8ABJ4VH031654; Fri, 10 Sep 2010 11:19:04 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ABJ3lg031619; Fri, 10 Sep 2010 11:19:03 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009101119.o8ABJ3lg031619@svn.freebsd.org> From: Andriy Gapon Date: Fri, 10 Sep 2010 11:19: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: r212413 - in head/sys: amd64/amd64 arm/arm arm/xscale/ixp425 dev/acpica dev/atkbdc dev/firewire dev/iicbus dev/ofw dev/ppbus dev/siba dev/spibus i386/i386 ia64/ia64 isa kern mips/adm512... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 11:19:04 -0000 Author: avg Date: Fri Sep 10 11:19:03 2010 New Revision: 212413 URL: http://svn.freebsd.org/changeset/base/212413 Log: bus_add_child: change type of order parameter to u_int This reflects actual type used to store and compare child device orders. Change is mostly done via a Coccinelle (soon to be devel/coccinelle) semantic patch. Verified by LINT+modules kernel builds. Followup to: r212213 MFC after: 10 days Modified: head/sys/amd64/amd64/legacy.c head/sys/amd64/amd64/nexus.c head/sys/arm/arm/nexus.c head/sys/arm/xscale/ixp425/ixp425.c head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_cpu.c head/sys/dev/atkbdc/atkbdc_isa.c head/sys/dev/firewire/firewire.c head/sys/dev/firewire/fwohci_pci.c head/sys/dev/iicbus/iicbus.c head/sys/dev/ofw/ofw_iicbus.c head/sys/dev/ppbus/ppbconf.c head/sys/dev/siba/siba.c head/sys/dev/spibus/spibus.c head/sys/i386/i386/legacy.c head/sys/i386/i386/nexus.c head/sys/ia64/ia64/nexus.c head/sys/isa/isa_common.c head/sys/kern/bus_if.m head/sys/kern/subr_bus.c head/sys/mips/adm5120/obio.c head/sys/mips/alchemy/obio.c head/sys/mips/atheros/apb.c head/sys/mips/idt/obio.c head/sys/mips/mips/mainbus.c head/sys/mips/mips/nexus.c head/sys/mips/sibyte/sb_zbbus.c head/sys/pc98/pc98/canbus.c head/sys/powerpc/aim/nexus.c head/sys/sparc64/sparc64/nexus.c head/sys/sun4v/sun4v/nexus.c head/sys/sun4v/sun4v/vnex.c head/sys/sys/bus.h Modified: head/sys/amd64/amd64/legacy.c ============================================================================== --- head/sys/amd64/amd64/legacy.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/amd64/amd64/legacy.c Fri Sep 10 11:19:03 2010 (r212413) @@ -60,7 +60,7 @@ struct legacy_device { static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -149,7 +149,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -213,7 +213,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -277,7 +277,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: head/sys/amd64/amd64/nexus.c ============================================================================== --- head/sys/amd64/amd64/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/amd64/amd64/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -83,7 +83,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -293,7 +293,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/arm/arm/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -74,7 +74,7 @@ static struct rman mem_rman; static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int nexus_activate_resource(device_t, device_t, int, int, @@ -166,7 +166,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/arm/xscale/ixp425/ixp425.c Fri Sep 10 11:19:03 2010 (r212413) @@ -369,7 +369,7 @@ ixp425_hinted_child(device_t bus, const } static device_t -ixp425_add_child(device_t dev, int order, const char *name, int unit) +ixp425_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct ixp425_ivar *ivar; Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/acpica/acpi.c Fri Sep 10 11:19:03 2010 (r212413) @@ -105,7 +105,7 @@ static int acpi_attach(device_t dev); static int acpi_suspend(device_t dev); static int acpi_resume(device_t dev); static int acpi_shutdown(device_t dev); -static device_t acpi_add_child(device_t bus, int order, const char *name, +static device_t acpi_add_child(device_t bus, u_int order, const char *name, int unit); static int acpi_print_child(device_t bus, device_t child); static void acpi_probe_nomatch(device_t bus, device_t child); @@ -781,7 +781,7 @@ acpi_shutdown(device_t dev) * Handle a new device being added */ static device_t -acpi_add_child(device_t bus, int order, const char *name, int unit) +acpi_add_child(device_t bus, u_int order, const char *name, int unit) { struct acpi_device *ad; device_t child; Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/acpica/acpi_cpu.c Fri Sep 10 11:19:03 2010 (r212413) @@ -148,7 +148,7 @@ static int acpi_cpu_resume(device_t dev) static int acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id, uint32_t *cpu_id); static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child); -static device_t acpi_cpu_add_child(device_t dev, int order, const char *name, +static device_t acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit); static int acpi_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); @@ -479,7 +479,7 @@ acpi_cpu_get_rlist(device_t dev, device_ } static device_t -acpi_cpu_add_child(device_t dev, int order, const char *name, int unit) +acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit) { struct acpi_cpu_device *ad; device_t child; Modified: head/sys/dev/atkbdc/atkbdc_isa.c ============================================================================== --- head/sys/dev/atkbdc/atkbdc_isa.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/atkbdc/atkbdc_isa.c Fri Sep 10 11:19:03 2010 (r212413) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); static int atkbdc_isa_probe(device_t dev); static int atkbdc_isa_attach(device_t dev); -static device_t atkbdc_isa_add_child(device_t bus, int order, const char *name, +static device_t atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit); static device_method_t atkbdc_isa_methods[] = { @@ -230,7 +230,7 @@ atkbdc_isa_attach(device_t dev) } static device_t -atkbdc_isa_add_child(device_t bus, int order, const char *name, int unit) +atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit) { atkbdc_device_t *ivar; device_t child; Modified: head/sys/dev/firewire/firewire.c ============================================================================== --- head/sys/dev/firewire/firewire.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/firewire/firewire.c Fri Sep 10 11:19:03 2010 (r212413) @@ -102,7 +102,7 @@ static void firewire_xfer_timeout(void * #if 0 static int firewire_shutdown (device_t); #endif -static device_t firewire_add_child (device_t, int, const char *, int); +static device_t firewire_add_child(device_t, u_int, const char *, int); static void fw_try_bmr (void *); static void fw_try_bmr_callback (struct fw_xfer *); static void fw_asystart (struct fw_xfer *); @@ -488,7 +488,7 @@ firewire_attach(device_t dev) * Attach it as child. */ static device_t -firewire_add_child(device_t dev, int order, const char *name, int unit) +firewire_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct firewire_softc *sc; Modified: head/sys/dev/firewire/fwohci_pci.c ============================================================================== --- head/sys/dev/firewire/fwohci_pci.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/firewire/fwohci_pci.c Fri Sep 10 11:19:03 2010 (r212413) @@ -487,7 +487,7 @@ fwohci_pci_shutdown(device_t dev) } static device_t -fwohci_pci_add_child(device_t dev, int order, const char *name, int unit) +fwohci_pci_add_child(device_t dev, u_int order, const char *name, int unit) { struct fwohci_softc *sc; device_t child; Modified: head/sys/dev/iicbus/iicbus.c ============================================================================== --- head/sys/dev/iicbus/iicbus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/iicbus/iicbus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -188,7 +188,7 @@ iicbus_read_ivar(device_t bus, device_t } static device_t -iicbus_add_child(device_t dev, int order, const char *name, int unit) +iicbus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct iicbus_ivar *devi; Modified: head/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- head/sys/dev/ofw/ofw_iicbus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/ofw/ofw_iicbus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -46,8 +46,8 @@ __FBSDID("$FreeBSD$"); /* Methods */ static device_probe_t ofw_iicbus_probe; static device_attach_t ofw_iicbus_attach; -static device_t ofw_iicbus_add_child(device_t dev, int order, const char *name, - int unit); +static device_t ofw_iicbus_add_child(device_t dev, u_int order, + const char *name, int unit); static const struct ofw_bus_devinfo *ofw_iicbus_get_devinfo(device_t bus, device_t dev); @@ -147,7 +147,7 @@ ofw_iicbus_attach(device_t dev) } static device_t -ofw_iicbus_add_child(device_t dev, int order, const char *name, int unit) +ofw_iicbus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct ofw_iicbus_devinfo *devi; Modified: head/sys/dev/ppbus/ppbconf.c ============================================================================== --- head/sys/dev/ppbus/ppbconf.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/ppbus/ppbconf.c Fri Sep 10 11:19:03 2010 (r212413) @@ -90,7 +90,7 @@ ppbus_probe(device_t dev) * Add a ppbus device, allocate/initialize the ivars */ static device_t -ppbus_add_child(device_t dev, int order, const char *name, int unit) +ppbus_add_child(device_t dev, u_int order, const char *name, int unit) { struct ppb_device *ppbdev; device_t child; Modified: head/sys/dev/siba/siba.c ============================================================================== --- head/sys/dev/siba/siba.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/siba/siba.c Fri Sep 10 11:19:03 2010 (r212413) @@ -90,7 +90,7 @@ static struct siba_devid siba_devids[] = static int siba_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t siba_add_child(device_t, int, const char *, int); +static device_t siba_add_child(device_t, u_int, const char *, int); static struct resource * siba_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -505,7 +505,7 @@ siba_destroy_devinfo(struct siba_devinfo /* XXX is this needed? */ static device_t -siba_add_child(device_t dev, int order, const char *name, int unit) +siba_add_child(device_t dev, u_int order, const char *name, int unit) { #if 1 Modified: head/sys/dev/spibus/spibus.c ============================================================================== --- head/sys/dev/spibus/spibus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/dev/spibus/spibus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -127,7 +127,7 @@ spibus_read_ivar(device_t bus, device_t } static device_t -spibus_add_child(device_t dev, int order, const char *name, int unit) +spibus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct spibus_ivar *devi; Modified: head/sys/i386/i386/legacy.c ============================================================================== --- head/sys/i386/i386/legacy.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/i386/i386/legacy.c Fri Sep 10 11:19:03 2010 (r212413) @@ -65,7 +65,7 @@ struct legacy_device { static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -170,7 +170,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -234,7 +234,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -298,7 +298,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: head/sys/i386/i386/nexus.c ============================================================================== --- head/sys/i386/i386/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/i386/i386/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -87,7 +87,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -305,7 +305,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: head/sys/ia64/ia64/nexus.c ============================================================================== --- head/sys/ia64/ia64/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/ia64/ia64/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -82,7 +82,7 @@ static struct rman irq_rman, port_rman, static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -220,7 +220,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: head/sys/isa/isa_common.c ============================================================================== --- head/sys/isa/isa_common.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/isa/isa_common.c Fri Sep 10 11:19:03 2010 (r212413) @@ -597,7 +597,7 @@ isa_probe_children(device_t dev) * Add a new child with default ivars. */ static device_t -isa_add_child(device_t dev, int order, const char *name, int unit) +isa_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct isa_device *idev; Modified: head/sys/kern/bus_if.m ============================================================================== --- head/sys/kern/bus_if.m Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/kern/bus_if.m Fri Sep 10 11:19:03 2010 (r212413) @@ -200,7 +200,7 @@ METHOD void driver_added { */ METHOD device_t add_child { device_t _dev; - int _order; + u_int _order; const char *_name; int _unit; }; Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/kern/subr_bus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -3284,7 +3284,7 @@ resource_list_purge(struct resource_list } device_t -bus_generic_add_child(device_t dev, int order, const char *name, int unit) +bus_generic_add_child(device_t dev, u_int order, const char *name, int unit) { return (device_add_child_ordered(dev, order, name, unit)); Modified: head/sys/mips/adm5120/obio.c ============================================================================== --- head/sys/mips/adm5120/obio.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/mips/adm5120/obio.c Fri Sep 10 11:19:03 2010 (r212413) @@ -101,7 +101,7 @@ int irq_priorities[NIRQS] = { static int obio_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t obio_add_child(device_t, int, const char *, int); +static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * obio_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -480,7 +480,7 @@ obio_hinted_child(device_t bus, const ch } static device_t -obio_add_child(device_t bus, int order, const char *name, int unit) +obio_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct obio_ivar *ivar; Modified: head/sys/mips/alchemy/obio.c ============================================================================== --- head/sys/mips/alchemy/obio.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/mips/alchemy/obio.c Fri Sep 10 11:19:03 2010 (r212413) @@ -101,7 +101,7 @@ int irq_priorities[NIRQS] = { static int obio_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t obio_add_child(device_t, int, const char *, int); +static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * obio_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -472,7 +472,7 @@ obio_hinted_child(device_t bus, const ch } static device_t -obio_add_child(device_t bus, int order, const char *name, int unit) +obio_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct obio_ivar *ivar; Modified: head/sys/mips/atheros/apb.c ============================================================================== --- head/sys/mips/atheros/apb.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/mips/atheros/apb.c Fri Sep 10 11:19:03 2010 (r212413) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); static int apb_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t apb_add_child(device_t, int, const char *, int); +static device_t apb_add_child(device_t, u_int, const char *, int); static struct resource * apb_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -397,7 +397,7 @@ apb_hinted_child(device_t bus, const cha } static device_t -apb_add_child(device_t bus, int order, const char *name, int unit) +apb_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct apb_ivar *ivar; Modified: head/sys/mips/idt/obio.c ============================================================================== --- head/sys/mips/idt/obio.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/mips/idt/obio.c Fri Sep 10 11:19:03 2010 (r212413) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); static int obio_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t obio_add_child(device_t, int, const char *, int); +static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * obio_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -422,7 +422,7 @@ obio_hinted_child(device_t bus, const ch } static device_t -obio_add_child(device_t bus, int order, const char *name, int unit) +obio_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct obio_ivar *ivar; Modified: head/sys/mips/mips/mainbus.c ============================================================================== --- head/sys/mips/mips/mainbus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/mips/mips/mainbus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -67,7 +67,7 @@ static struct rman irq_rman, port_rman, static int mainbus_probe(device_t); static int mainbus_attach(device_t); static int mainbus_print_child(device_t, device_t); -static device_t mainbus_add_child(device_t bus, int order, const char *name, +static device_t mainbus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *mainbus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -178,7 +178,7 @@ mainbus_print_child(device_t bus, device } static device_t -mainbus_add_child(device_t bus, int order, const char *name, int unit) +mainbus_add_child(device_t bus, u_int order, const char *name, int unit) { return device_add_child_ordered(bus, order, name, unit); } Modified: head/sys/mips/mips/nexus.c ============================================================================== --- head/sys/mips/mips/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/mips/mips/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -82,7 +82,7 @@ static struct resource * u_long, u_long, u_int); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static int nexus_attach(device_t); static int nexus_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -282,7 +282,7 @@ nexus_hinted_child(device_t bus, const c } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: head/sys/mips/sibyte/sb_zbbus.c ============================================================================== --- head/sys/mips/sibyte/sb_zbbus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/mips/sibyte/sb_zbbus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -402,7 +402,7 @@ zbbus_setup_intr(device_t dev, device_t } static device_t -zbbus_add_child(device_t bus, int order, const char *name, int unit) +zbbus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct zbbus_devinfo *dinfo; Modified: head/sys/pc98/pc98/canbus.c ============================================================================== --- head/sys/pc98/pc98/canbus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/pc98/pc98/canbus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -82,7 +82,7 @@ static int canbus_detach(device_t); /* Bus interface methods */ static int canbus_print_child(device_t, device_t); -static device_t canbus_add_child(device_t, int, const char *, int); +static device_t canbus_add_child(device_t, u_int, const char *, int); static struct resource * canbus_alloc_resource( device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int canbus_activate_resource( @@ -235,7 +235,7 @@ canbus_print_child(device_t dev, device_ } static device_t -canbus_add_child(device_t bus, int order, const char *name, int unit) +canbus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct canbus_device *cbdev; Modified: head/sys/powerpc/aim/nexus.c ============================================================================== --- head/sys/powerpc/aim/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/powerpc/aim/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -115,7 +115,7 @@ static int nexus_attach(device_t); /* * Bus interface */ -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static void nexus_probe_nomatch(device_t, device_t); static int nexus_read_ivar(device_t, device_t, int, uintptr_t *); static int nexus_write_ivar(device_t, device_t, int, uintptr_t); @@ -262,7 +262,7 @@ nexus_probe_nomatch(device_t dev, device } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct nexus_devinfo *dinfo; Modified: head/sys/sparc64/sparc64/nexus.c ============================================================================== --- head/sys/sparc64/sparc64/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/sparc64/sparc64/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -258,7 +258,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: head/sys/sun4v/sun4v/nexus.c ============================================================================== --- head/sys/sun4v/sun4v/nexus.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/sun4v/sun4v/nexus.c Fri Sep 10 11:19:03 2010 (r212413) @@ -234,7 +234,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: head/sys/sun4v/sun4v/vnex.c ============================================================================== --- head/sys/sun4v/sun4v/vnex.c Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/sun4v/sun4v/vnex.c Fri Sep 10 11:19:03 2010 (r212413) @@ -204,7 +204,7 @@ vnex_attach(device_t dev) } static device_t -vnex_add_child(device_t dev, int order, const char *name, int unit) +vnex_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct vnex_devinfo *vndi; Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Fri Sep 10 11:01:11 2010 (r212412) +++ head/sys/sys/bus.h Fri Sep 10 11:19:03 2010 (r212413) @@ -298,7 +298,7 @@ void root_bus_configure(void); int bus_generic_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); device_t - bus_generic_add_child(device_t dev, int order, const char *name, + bus_generic_add_child(device_t dev, u_int order, const char *name, int unit); struct resource * bus_generic_alloc_resource(device_t bus, device_t child, int type, From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 12:16:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6C66106564A; Fri, 10 Sep 2010 12:16:24 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95FD38FC20; Fri, 10 Sep 2010 12:16: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 o8ACGObr038983; Fri, 10 Sep 2010 12:16:24 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ACGOhI038981; Fri, 10 Sep 2010 12:16:24 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009101216.o8ACGOhI038981@svn.freebsd.org> From: Rui Paulo Date: Fri, 10 Sep 2010 12:16: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: r212414 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 12:16:24 -0000 Author: rpaulo Date: Fri Sep 10 12:16:24 2010 New Revision: 212414 URL: http://svn.freebsd.org/changeset/base/212414 Log: Don't try to map the USDT probes. This is necessary because there is no __SUNW_dof symbol present in FreeBSD binaries. Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Fri Sep 10 11:19:03 2010 (r212413) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Fri Sep 10 12:16:24 2010 (r212414) @@ -641,7 +641,6 @@ dt_pid_create_usdt_probes(dtrace_probede assert(DT_MUTEX_HELD(&dpr->dpr_lock)); #if defined(sun) (void) Pupdate_maps(P); -#endif if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) { ret = -1; (void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_USDT, @@ -652,6 +651,9 @@ dt_pid_create_usdt_probes(dtrace_probede (int)proc_getpid(P), strerror(errno)); #endif } +#else + ret = 0; +#endif /* * Put the module name in its canonical form. From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 12:55:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 903D8106566C; Fri, 10 Sep 2010 12:55:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64EA98FC13; Fri, 10 Sep 2010 12:55: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 o8ACtamL044121; Fri, 10 Sep 2010 12:55:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ACtaUU044119; Fri, 10 Sep 2010 12:55:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009101255.o8ACtaUU044119@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 10 Sep 2010 12:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212415 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 12:55:36 -0000 Author: kib Date: Fri Sep 10 12:55:36 2010 New Revision: 212415 URL: http://svn.freebsd.org/changeset/base/212415 Log: MFC r211941: Recalcule the return value in pollout(). PR: kern/143029 Tested by: John Plevyak Modified: stable/8/sys/kern/sys_generic.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/sys_generic.c ============================================================================== --- stable/8/sys/kern/sys_generic.c Fri Sep 10 12:16:24 2010 (r212414) +++ stable/8/sys/kern/sys_generic.c Fri Sep 10 12:55:36 2010 (r212415) @@ -76,7 +76,8 @@ static MALLOC_DEFINE(M_IOCTLOPS, "ioctlo static MALLOC_DEFINE(M_SELECT, "select", "select() buffer"); MALLOC_DEFINE(M_IOV, "iov", "large iov's"); -static int pollout(struct pollfd *, struct pollfd *, u_int); +static int pollout(struct thread *, struct pollfd *, struct pollfd *, + u_int); static int pollscan(struct thread *, struct pollfd *, u_int); static int pollrescan(struct thread *); static int selscan(struct thread *, fd_mask **, fd_mask **, int); @@ -1207,7 +1208,7 @@ done: if (error == EWOULDBLOCK) error = 0; if (error == 0) { - error = pollout(bits, uap->fds, nfds); + error = pollout(td, bits, uap->fds, nfds); if (error) goto out; } @@ -1262,22 +1263,27 @@ pollrescan(struct thread *td) static int -pollout(fds, ufds, nfd) +pollout(td, fds, ufds, nfd) + struct thread *td; struct pollfd *fds; struct pollfd *ufds; u_int nfd; { int error = 0; u_int i = 0; + u_int n = 0; for (i = 0; i < nfd; i++) { error = copyout(&fds->revents, &ufds->revents, sizeof(ufds->revents)); if (error) return (error); + if (fds->revents != 0) + n++; fds++; ufds++; } + td->td_retval[0] = n; return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 13:24:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B3331065675; Fri, 10 Sep 2010 13:24:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B1FA8FC0C; Fri, 10 Sep 2010 13:24: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 o8ADOlis047279; Fri, 10 Sep 2010 13:24:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ADOld7047277; Fri, 10 Sep 2010 13:24:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009101324.o8ADOld7047277@svn.freebsd.org> From: Alexander Motin Date: Fri, 10 Sep 2010 13:24: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: r212416 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 13:24:47 -0000 Author: mav Date: Fri Sep 10 13:24:47 2010 New Revision: 212416 URL: http://svn.freebsd.org/changeset/base/212416 Log: Do not IPI CPU that is already spinning for load. It doubles effect of spining (comparing to MWAIT) on some heavly switching test loads. Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Fri Sep 10 12:55:36 2010 (r212415) +++ head/sys/kern/sched_ule.c Fri Sep 10 13:24:47 2010 (r212416) @@ -196,7 +196,7 @@ static int preempt_thresh = 0; #endif static int static_boost = PRI_MIN_TIMESHARE; static int sched_idlespins = 10000; -static int sched_idlespinthresh = 4; +static int sched_idlespinthresh = 64; /* * tdq - per processor runqs and statistics. All fields are protected by the @@ -208,6 +208,7 @@ struct tdq { struct mtx tdq_lock; /* run queue lock. */ struct cpu_group *tdq_cg; /* Pointer to cpu topology. */ volatile int tdq_load; /* Aggregate load. */ + volatile int tdq_cpu_idle; /* cpu_idle() is active. */ int tdq_sysload; /* For loadavg, !ITHD load. */ int tdq_transferable; /* Transferable thread count. */ short tdq_switchcnt; /* Switches this tick. */ @@ -966,7 +967,7 @@ tdq_notify(struct tdq *tdq, struct threa * If the MD code has an idle wakeup routine try that before * falling back to IPI. */ - if (cpu_idle_wakeup(cpu)) + if (!tdq->tdq_cpu_idle || cpu_idle_wakeup(cpu)) return; } tdq->tdq_ipipending = 1; @@ -2545,8 +2546,14 @@ sched_idletd(void *dummy) } } switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; - if (tdq->tdq_load == 0) - cpu_idle(switchcnt > 1); + if (tdq->tdq_load == 0) { + tdq->tdq_cpu_idle = 1; + if (tdq->tdq_load == 0) { + cpu_idle(switchcnt > sched_idlespinthresh); + tdq->tdq_switchcnt++; + } + tdq->tdq_cpu_idle = 0; + } if (tdq->tdq_load) { thread_lock(td); mi_switch(SW_VOL | SWT_IDLE, NULL); From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 13:40:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9C4D106566B; Fri, 10 Sep 2010 13:40:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA07E8FC0C; Fri, 10 Sep 2010 13:40: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 o8ADeVhK049207; Fri, 10 Sep 2010 13:40:31 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ADeVeY049205; Fri, 10 Sep 2010 13:40:31 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009101340.o8ADeVeY049205@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 10 Sep 2010 13:40: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: r212417 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 13:40:31 -0000 Author: jilles Date: Fri Sep 10 13:40:31 2010 New Revision: 212417 URL: http://svn.freebsd.org/changeset/base/212417 Log: sh(1): Remove xrefs for expr(1) and getopt(1). expr(1) should usually not be used as various forms of parameter expansion and arithmetic expansion replicate most of its functionality in an easier way. getopt(1) should not be used at all in new code. Instead, getopts(1) or entirely manual parsing should be used. MFC after: 1 week Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Fri Sep 10 13:24:47 2010 (r212416) +++ head/bin/sh/sh.1 Fri Sep 10 13:40:31 2010 (r212417) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd August 22, 2010 +.Dd September 10, 2010 .Dt SH 1 .Os .Sh NAME @@ -2455,8 +2455,6 @@ will return the argument. .Xr echo 1 , .Xr ed 1 , .Xr emacs 1 , -.Xr expr 1 , -.Xr getopt 1 , .Xr pwd 1 , .Xr test 1 , .Xr vi 1 , From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 14:00:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25724106566B; Fri, 10 Sep 2010 14:00:28 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 157F78FC12; Fri, 10 Sep 2010 14:00: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 o8AE0RqB051219; Fri, 10 Sep 2010 14:00:27 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AE0RiP051217; Fri, 10 Sep 2010 14:00:27 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009101400.o8AE0RiP051217@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 10 Sep 2010 14:00: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: r212418 - head/bin/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 14:00:28 -0000 Author: jilles Date: Fri Sep 10 14:00:27 2010 New Revision: 212418 URL: http://svn.freebsd.org/changeset/base/212418 Log: test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||. Modified: head/bin/test/test.1 Modified: head/bin/test/test.1 ============================================================================== --- head/bin/test/test.1 Fri Sep 10 13:40:31 2010 (r212417) +++ head/bin/test/test.1 Fri Sep 10 14:00:27 2010 (r212418) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd July 31, 2006 +.Dd September 10, 2010 .Dt TEST 1 .Os .Sh NAME @@ -310,6 +310,14 @@ are evaluated consistently according to standards document. All other cases are subject to the ambiguity in the command semantics. +.Pp +In particular, only expressions containing +.Fl a , +.Fl o , +.Cm \&( +or +.Cm \&) +can be ambiguous. .Sh EXIT STATUS The .Nm @@ -338,12 +346,11 @@ specification. Both sides are always evaluated in .Fl a and -.Fl o , -unlike in the logical operators of -.Xr sh 1 . +.Fl o . For instance, the writable status of .Pa file will be tested by the following command even though the former expression indicated false, which results in a gratuitous access to the file system: -.Pp .Dl "[ -z abc -a -w file ]" +To avoid this, write +.Dl "[ -z abc ] && [ -w file ]" From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 14:03:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 975C8106566C; Fri, 10 Sep 2010 14:03:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 871DC8FC21; Fri, 10 Sep 2010 14:03: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 o8AE3wHV051456; Fri, 10 Sep 2010 14:03:58 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AE3ws9051454; Fri, 10 Sep 2010 14:03:58 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009101403.o8AE3ws9051454@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 10 Sep 2010 14:03: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: r212419 - head/bin/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 14:03:58 -0000 Author: jilles Date: Fri Sep 10 14:03:58 2010 New Revision: 212419 URL: http://svn.freebsd.org/changeset/base/212419 Log: test(1): Fix markup, ( and ) must be separate arguments so leave spaces. MFC after: 1 week Modified: head/bin/test/test.1 Modified: head/bin/test/test.1 ============================================================================== --- head/bin/test/test.1 Fri Sep 10 14:00:27 2010 (r212418) +++ head/bin/test/test.1 Fri Sep 10 14:03:58 2010 (r212419) @@ -282,7 +282,7 @@ True if either or .Ar expression2 are true. -.It Cm \&( Ns Ar expression Ns Cm \&) +.It Cm \&( Ar expression Cm \&) True if expression is true. .El .Pp From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 15:03:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCD5E1065673; Fri, 10 Sep 2010 15:03:56 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB3D18FC1C; Fri, 10 Sep 2010 15:03: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 o8AF3uRQ055273; Fri, 10 Sep 2010 15:03:56 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AF3up5055268; Fri, 10 Sep 2010 15:03:56 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201009101503.o8AF3up5055268@svn.freebsd.org> From: "Kenneth D. Merry" Date: Fri, 10 Sep 2010 15:03: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: r212420 - in head/sys: amd64/conf conf dev/mps dev/mps/mpi modules modules/mps X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 15:03:57 -0000 Author: ken Date: Fri Sep 10 15:03:56 2010 New Revision: 212420 URL: http://svn.freebsd.org/changeset/base/212420 Log: MFp4 (//depot/projects/mps/...) Bring in a driver for the LSI Logic MPT2 6Gb SAS controllers. This driver supports basic I/O, and works with SAS and SATA drives and expanders. Basic error recovery works (i.e. timeouts and aborts) as well. Integrated RAID isn't supported yet, and there are some known bugs. So this isn't ready for production use, but is certainly ready for testing and additional development. For the moment, new commits to this driver should go into the FreeBSD Perforce repository first (//depot/projects/mps/...) and then get merged into -current once they've been vetted. This has only been added to the amd64 GENERIC, since that is the only architecture I have tested this driver with. Submitted by: scottl Discussed with: imp, gibbs, will Sponsored by: Yahoo, Spectra Logic Corporation Added: head/sys/dev/mps/ head/sys/dev/mps/mpi/ head/sys/dev/mps/mpi/mpi2.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_cnfg.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_hbd.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_history.txt (contents, props changed) head/sys/dev/mps/mpi/mpi2_init.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_ioc.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_ra.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_raid.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_sas.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_targ.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_tool.h (contents, props changed) head/sys/dev/mps/mpi/mpi2_type.h (contents, props changed) head/sys/dev/mps/mps.c (contents, props changed) head/sys/dev/mps/mps_ioctl.h (contents, props changed) head/sys/dev/mps/mps_pci.c (contents, props changed) head/sys/dev/mps/mps_sas.c (contents, props changed) head/sys/dev/mps/mps_table.c (contents, props changed) head/sys/dev/mps/mps_table.h (contents, props changed) head/sys/dev/mps/mps_user.c (contents, props changed) head/sys/dev/mps/mpsvar.h (contents, props changed) head/sys/modules/mps/ head/sys/modules/mps/Makefile (contents, props changed) Modified: head/sys/amd64/conf/GENERIC head/sys/conf/files head/sys/modules/Makefile Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Sep 10 14:03:58 2010 (r212419) +++ head/sys/amd64/conf/GENERIC Fri Sep 10 15:03:56 2010 (r212420) @@ -112,6 +112,7 @@ device hptiop # Highpoint RocketRaid 3 device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module device mpt # LSI-Logic MPT-Fusion +device mps # LSI-Logic MPT-Fusion 2 #device ncr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') device trm # Tekram DC395U/UW/F DC315U adapters Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Sep 10 14:03:58 2010 (r212419) +++ head/sys/conf/files Fri Sep 10 15:03:56 2010 (r212420) @@ -1328,6 +1328,11 @@ dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd dev/mn/if_mn.c optional mn pci +dev/mps/mps.c optional mps +dev/mps/mps_pci.c optional mps pci +dev/mps/mps_sas.c optional mps +dev/mps/mps_table.c optional mps +dev/mps/mps_user.c optional mps dev/mpt/mpt.c optional mpt dev/mpt/mpt_cam.c optional mpt dev/mpt/mpt_debug.c optional mpt Added: head/sys/dev/mps/mpi/mpi2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mps/mpi/mpi2.h Fri Sep 10 15:03:56 2010 (r212420) @@ -0,0 +1,1121 @@ +/* $FreeBSD$ */ +/* + * Copyright (c) 2000-2009 LSI Corporation. + * + * + * Name: mpi2.h + * Title: MPI Message independent structures and definitions + * including System Interface Register Set and + * scatter/gather formats. + * Creation Date: June 21, 2006 + * + * mpi2.h Version: 02.00.14 + * + * Version History + * --------------- + * + * Date Version Description + * -------- -------- ------------------------------------------------------ + * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A. + * 06-04-07 02.00.01 Bumped MPI2_HEADER_VERSION_UNIT. + * 06-26-07 02.00.02 Bumped MPI2_HEADER_VERSION_UNIT. + * 08-31-07 02.00.03 Bumped MPI2_HEADER_VERSION_UNIT. + * Moved ReplyPostHostIndex register to offset 0x6C of the + * MPI2_SYSTEM_INTERFACE_REGS and modified the define for + * MPI2_REPLY_POST_HOST_INDEX_OFFSET. + * Added union of request descriptors. + * Added union of reply descriptors. + * 10-31-07 02.00.04 Bumped MPI2_HEADER_VERSION_UNIT. + * Added define for MPI2_VERSION_02_00. + * Fixed the size of the FunctionDependent5 field in the + * MPI2_DEFAULT_REPLY structure. + * 12-18-07 02.00.05 Bumped MPI2_HEADER_VERSION_UNIT. + * Removed the MPI-defined Fault Codes and extended the + * product specific codes up to 0xEFFF. + * Added a sixth key value for the WriteSequence register + * and changed the flush value to 0x0. + * Added message function codes for Diagnostic Buffer Post + * and Diagnsotic Release. + * New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED + * Moved MPI2_VERSION_UNION from mpi2_ioc.h. + * 02-29-08 02.00.06 Bumped MPI2_HEADER_VERSION_UNIT. + * 03-03-08 02.00.07 Bumped MPI2_HEADER_VERSION_UNIT. + * 05-21-08 02.00.08 Bumped MPI2_HEADER_VERSION_UNIT. + * Added #defines for marking a reply descriptor as unused. + * 06-27-08 02.00.09 Bumped MPI2_HEADER_VERSION_UNIT. + * 10-02-08 02.00.10 Bumped MPI2_HEADER_VERSION_UNIT. + * Moved LUN field defines from mpi2_init.h. + * 01-19-09 02.00.11 Bumped MPI2_HEADER_VERSION_UNIT. + * 05-06-09 02.00.12 Bumped MPI2_HEADER_VERSION_UNIT. + * In all request and reply descriptors, replaced VF_ID + * field with MSIxIndex field. + * Removed DevHandle field from + * MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those + * bytes reserved. + * Added RAID Accelerator functionality. + * 07-30-09 02.00.13 Bumped MPI2_HEADER_VERSION_UNIT. + * 10-28-09 02.00.14 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MSI-x index mask and shift for Reply Post Host + * Index register. + * Added function code for Host Based Discovery Action. + * -------------------------------------------------------------------------- + */ + +#ifndef MPI2_H +#define MPI2_H + + +/***************************************************************************** +* +* MPI Version Definitions +* +*****************************************************************************/ + +#define MPI2_VERSION_MAJOR (0x02) +#define MPI2_VERSION_MINOR (0x00) +#define MPI2_VERSION_MAJOR_MASK (0xFF00) +#define MPI2_VERSION_MAJOR_SHIFT (8) +#define MPI2_VERSION_MINOR_MASK (0x00FF) +#define MPI2_VERSION_MINOR_SHIFT (0) +#define MPI2_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \ + MPI2_VERSION_MINOR) + +#define MPI2_VERSION_02_00 (0x0200) + +/* versioning for this MPI header set */ +#define MPI2_HEADER_VERSION_UNIT (0x0E) +#define MPI2_HEADER_VERSION_DEV (0x00) +#define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) +#define MPI2_HEADER_VERSION_UNIT_SHIFT (8) +#define MPI2_HEADER_VERSION_DEV_MASK (0x00FF) +#define MPI2_HEADER_VERSION_DEV_SHIFT (0) +#define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | MPI2_HEADER_VERSION_DEV) + + +/***************************************************************************** +* +* IOC State Definitions +* +*****************************************************************************/ + +#define MPI2_IOC_STATE_RESET (0x00000000) +#define MPI2_IOC_STATE_READY (0x10000000) +#define MPI2_IOC_STATE_OPERATIONAL (0x20000000) +#define MPI2_IOC_STATE_FAULT (0x40000000) + +#define MPI2_IOC_STATE_MASK (0xF0000000) +#define MPI2_IOC_STATE_SHIFT (28) + +/* Fault state range for prodcut specific codes */ +#define MPI2_FAULT_PRODUCT_SPECIFIC_MIN (0x0000) +#define MPI2_FAULT_PRODUCT_SPECIFIC_MAX (0xEFFF) + + +/***************************************************************************** +* +* System Interface Register Definitions +* +*****************************************************************************/ + +typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS +{ + U32 Doorbell; /* 0x00 */ + U32 WriteSequence; /* 0x04 */ + U32 HostDiagnostic; /* 0x08 */ + U32 Reserved1; /* 0x0C */ + U32 DiagRWData; /* 0x10 */ + U32 DiagRWAddressLow; /* 0x14 */ + U32 DiagRWAddressHigh; /* 0x18 */ + U32 Reserved2[5]; /* 0x1C */ + U32 HostInterruptStatus; /* 0x30 */ + U32 HostInterruptMask; /* 0x34 */ + U32 DCRData; /* 0x38 */ + U32 DCRAddress; /* 0x3C */ + U32 Reserved3[2]; /* 0x40 */ + U32 ReplyFreeHostIndex; /* 0x48 */ + U32 Reserved4[8]; /* 0x4C */ + U32 ReplyPostHostIndex; /* 0x6C */ + U32 Reserved5; /* 0x70 */ + U32 HCBSize; /* 0x74 */ + U32 HCBAddressLow; /* 0x78 */ + U32 HCBAddressHigh; /* 0x7C */ + U32 Reserved6[16]; /* 0x80 */ + U32 RequestDescriptorPostLow; /* 0xC0 */ + U32 RequestDescriptorPostHigh; /* 0xC4 */ + U32 Reserved7[14]; /* 0xC8 */ +} MPI2_SYSTEM_INTERFACE_REGS, MPI2_POINTER PTR_MPI2_SYSTEM_INTERFACE_REGS, + Mpi2SystemInterfaceRegs_t, MPI2_POINTER pMpi2SystemInterfaceRegs_t; + +/* + * Defines for working with the Doorbell register. + */ +#define MPI2_DOORBELL_OFFSET (0x00000000) + +/* IOC --> System values */ +#define MPI2_DOORBELL_USED (0x08000000) +#define MPI2_DOORBELL_WHO_INIT_MASK (0x07000000) +#define MPI2_DOORBELL_WHO_INIT_SHIFT (24) +#define MPI2_DOORBELL_FAULT_CODE_MASK (0x0000FFFF) +#define MPI2_DOORBELL_DATA_MASK (0x0000FFFF) + +/* System --> IOC values */ +#define MPI2_DOORBELL_FUNCTION_MASK (0xFF000000) +#define MPI2_DOORBELL_FUNCTION_SHIFT (24) +#define MPI2_DOORBELL_ADD_DWORDS_MASK (0x00FF0000) +#define MPI2_DOORBELL_ADD_DWORDS_SHIFT (16) + + +/* + * Defines for the WriteSequence register + */ +#define MPI2_WRITE_SEQUENCE_OFFSET (0x00000004) +#define MPI2_WRSEQ_KEY_VALUE_MASK (0x0000000F) +#define MPI2_WRSEQ_FLUSH_KEY_VALUE (0x0) +#define MPI2_WRSEQ_1ST_KEY_VALUE (0xF) +#define MPI2_WRSEQ_2ND_KEY_VALUE (0x4) +#define MPI2_WRSEQ_3RD_KEY_VALUE (0xB) +#define MPI2_WRSEQ_4TH_KEY_VALUE (0x2) +#define MPI2_WRSEQ_5TH_KEY_VALUE (0x7) +#define MPI2_WRSEQ_6TH_KEY_VALUE (0xD) + +/* + * Defines for the HostDiagnostic register + */ +#define MPI2_HOST_DIAGNOSTIC_OFFSET (0x00000008) + +#define MPI2_DIAG_BOOT_DEVICE_SELECT_MASK (0x00001800) +#define MPI2_DIAG_BOOT_DEVICE_SELECT_DEFAULT (0x00000000) +#define MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW (0x00000800) + +#define MPI2_DIAG_CLEAR_FLASH_BAD_SIG (0x00000400) +#define MPI2_DIAG_FORCE_HCB_ON_RESET (0x00000200) +#define MPI2_DIAG_HCB_MODE (0x00000100) +#define MPI2_DIAG_DIAG_WRITE_ENABLE (0x00000080) +#define MPI2_DIAG_FLASH_BAD_SIG (0x00000040) +#define MPI2_DIAG_RESET_HISTORY (0x00000020) +#define MPI2_DIAG_DIAG_RW_ENABLE (0x00000010) +#define MPI2_DIAG_RESET_ADAPTER (0x00000004) +#define MPI2_DIAG_HOLD_IOC_RESET (0x00000002) + +/* + * Offsets for DiagRWData and address + */ +#define MPI2_DIAG_RW_DATA_OFFSET (0x00000010) +#define MPI2_DIAG_RW_ADDRESS_LOW_OFFSET (0x00000014) +#define MPI2_DIAG_RW_ADDRESS_HIGH_OFFSET (0x00000018) + +/* + * Defines for the HostInterruptStatus register + */ +#define MPI2_HOST_INTERRUPT_STATUS_OFFSET (0x00000030) +#define MPI2_HIS_SYS2IOC_DB_STATUS (0x80000000) +#define MPI2_HIS_IOP_DOORBELL_STATUS MPI2_HIS_SYS2IOC_DB_STATUS +#define MPI2_HIS_RESET_IRQ_STATUS (0x40000000) +#define MPI2_HIS_REPLY_DESCRIPTOR_INTERRUPT (0x00000008) +#define MPI2_HIS_IOC2SYS_DB_STATUS (0x00000001) +#define MPI2_HIS_DOORBELL_INTERRUPT MPI2_HIS_IOC2SYS_DB_STATUS + +/* + * Defines for the HostInterruptMask register + */ +#define MPI2_HOST_INTERRUPT_MASK_OFFSET (0x00000034) +#define MPI2_HIM_RESET_IRQ_MASK (0x40000000) +#define MPI2_HIM_REPLY_INT_MASK (0x00000008) +#define MPI2_HIM_RIM MPI2_HIM_REPLY_INT_MASK +#define MPI2_HIM_IOC2SYS_DB_MASK (0x00000001) +#define MPI2_HIM_DIM MPI2_HIM_IOC2SYS_DB_MASK + +/* + * Offsets for DCRData and address + */ +#define MPI2_DCR_DATA_OFFSET (0x00000038) +#define MPI2_DCR_ADDRESS_OFFSET (0x0000003C) + +/* + * Offset for the Reply Free Queue + */ +#define MPI2_REPLY_FREE_HOST_INDEX_OFFSET (0x00000048) + +/* + * Defines for the Reply Descriptor Post Queue + */ +#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +#define MPI2_REPLY_POST_HOST_INDEX_MASK (0x00FFFFFF) +#define MPI2_RPHI_MSIX_INDEX_MASK (0xFF000000) +#define MPI2_RPHI_MSIX_INDEX_SHIFT (24) + +/* + * Defines for the HCBSize and address + */ +#define MPI2_HCB_SIZE_OFFSET (0x00000074) +#define MPI2_HCB_SIZE_SIZE_MASK (0xFFFFF000) +#define MPI2_HCB_SIZE_HCB_ENABLE (0x00000001) + +#define MPI2_HCB_ADDRESS_LOW_OFFSET (0x00000078) +#define MPI2_HCB_ADDRESS_HIGH_OFFSET (0x0000007C) + +/* + * Offsets for the Request Queue + */ +#define MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET (0x000000C0) +#define MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET (0x000000C4) + + +/***************************************************************************** +* +* Message Descriptors +* +*****************************************************************************/ + +/* Request Descriptors */ + +/* Default Request Descriptor */ +typedef struct _MPI2_DEFAULT_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 DescriptorTypeDependent; /* 0x06 */ +} MPI2_DEFAULT_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_DEFAULT_REQUEST_DESCRIPTOR, + Mpi2DefaultRequestDescriptor_t, MPI2_POINTER pMpi2DefaultRequestDescriptor_t; + +/* defines for the RequestFlags field */ +#define MPI2_REQ_DESCRIPT_FLAGS_TYPE_MASK (0x0E) +#define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO (0x00) +#define MPI2_REQ_DESCRIPT_FLAGS_SCSI_TARGET (0x02) +#define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (0x06) +#define MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE (0x08) +#define MPI2_REQ_DESCRIPT_FLAGS_RAID_ACCELERATOR (0x0A) + +#define MPI2_REQ_DESCRIPT_FLAGS_IOC_FIFO_MARKER (0x01) + + +/* High Priority Request Descriptor */ +typedef struct _MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 Reserved1; /* 0x06 */ +} MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR, + Mpi2HighPriorityRequestDescriptor_t, + MPI2_POINTER pMpi2HighPriorityRequestDescriptor_t; + + +/* SCSI IO Request Descriptor */ +typedef struct _MPI2_SCSI_IO_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 DevHandle; /* 0x06 */ +} MPI2_SCSI_IO_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_SCSI_IO_REQUEST_DESCRIPTOR, + Mpi2SCSIIORequestDescriptor_t, MPI2_POINTER pMpi2SCSIIORequestDescriptor_t; + + +/* SCSI Target Request Descriptor */ +typedef struct _MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 IoIndex; /* 0x06 */ +} MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR, + Mpi2SCSITargetRequestDescriptor_t, + MPI2_POINTER pMpi2SCSITargetRequestDescriptor_t; + + +/* RAID Accelerator Request Descriptor */ +typedef struct _MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR +{ + U8 RequestFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 LMID; /* 0x04 */ + U16 Reserved; /* 0x06 */ +} MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR, + Mpi2RAIDAcceleratorRequestDescriptor_t, + MPI2_POINTER pMpi2RAIDAcceleratorRequestDescriptor_t; + + +/* union of Request Descriptors */ +typedef union _MPI2_REQUEST_DESCRIPTOR_UNION +{ + MPI2_DEFAULT_REQUEST_DESCRIPTOR Default; + MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR HighPriority; + MPI2_SCSI_IO_REQUEST_DESCRIPTOR SCSIIO; + MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR SCSITarget; + MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR RAIDAccelerator; + U64 Words; +} MPI2_REQUEST_DESCRIPTOR_UNION, MPI2_POINTER PTR_MPI2_REQUEST_DESCRIPTOR_UNION, + Mpi2RequestDescriptorUnion_t, MPI2_POINTER pMpi2RequestDescriptorUnion_t; + + +/* Reply Descriptors */ + +/* Default Reply Descriptor */ +typedef struct _MPI2_DEFAULT_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 DescriptorTypeDependent1; /* 0x02 */ + U32 DescriptorTypeDependent2; /* 0x04 */ +} MPI2_DEFAULT_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_DEFAULT_REPLY_DESCRIPTOR, + Mpi2DefaultReplyDescriptor_t, MPI2_POINTER pMpi2DefaultReplyDescriptor_t; + +/* defines for the ReplyFlags field */ +#define MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK (0x0F) +#define MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS (0x00) +#define MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY (0x01) +#define MPI2_RPY_DESCRIPT_FLAGS_TARGETASSIST_SUCCESS (0x02) +#define MPI2_RPY_DESCRIPT_FLAGS_TARGET_COMMAND_BUFFER (0x03) +#define MPI2_RPY_DESCRIPT_FLAGS_RAID_ACCELERATOR_SUCCESS (0x05) +#define MPI2_RPY_DESCRIPT_FLAGS_UNUSED (0x0F) + +/* values for marking a reply descriptor as unused */ +#define MPI2_RPY_DESCRIPT_UNUSED_WORD0_MARK (0xFFFFFFFF) +#define MPI2_RPY_DESCRIPT_UNUSED_WORD1_MARK (0xFFFFFFFF) + +/* Address Reply Descriptor */ +typedef struct _MPI2_ADDRESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U32 ReplyFrameAddress; /* 0x04 */ +} MPI2_ADDRESS_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_ADDRESS_REPLY_DESCRIPTOR, + Mpi2AddressReplyDescriptor_t, MPI2_POINTER pMpi2AddressReplyDescriptor_t; + +#define MPI2_ADDRESS_REPLY_SMID_INVALID (0x00) + + +/* SCSI IO Success Reply Descriptor */ +typedef struct _MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U16 TaskTag; /* 0x04 */ + U16 Reserved1; /* 0x06 */ +} MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR, + Mpi2SCSIIOSuccessReplyDescriptor_t, + MPI2_POINTER pMpi2SCSIIOSuccessReplyDescriptor_t; + + +/* TargetAssist Success Reply Descriptor */ +typedef struct _MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U8 SequenceNumber; /* 0x04 */ + U8 Reserved1; /* 0x05 */ + U16 IoIndex; /* 0x06 */ +} MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR, + Mpi2TargetAssistSuccessReplyDescriptor_t, + MPI2_POINTER pMpi2TargetAssistSuccessReplyDescriptor_t; + + +/* Target Command Buffer Reply Descriptor */ +typedef struct _MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U8 VP_ID; /* 0x02 */ + U8 Flags; /* 0x03 */ + U16 InitiatorDevHandle; /* 0x04 */ + U16 IoIndex; /* 0x06 */ +} MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR, + Mpi2TargetCommandBufferReplyDescriptor_t, + MPI2_POINTER pMpi2TargetCommandBufferReplyDescriptor_t; + +/* defines for Flags field */ +#define MPI2_RPY_DESCRIPT_TCB_FLAGS_PHYNUM_MASK (0x3F) + + +/* RAID Accelerator Success Reply Descriptor */ +typedef struct _MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR +{ + U8 ReplyFlags; /* 0x00 */ + U8 MSIxIndex; /* 0x01 */ + U16 SMID; /* 0x02 */ + U32 Reserved; /* 0x04 */ +} MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR, + MPI2_POINTER PTR_MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR, + Mpi2RAIDAcceleratorSuccessReplyDescriptor_t, + MPI2_POINTER pMpi2RAIDAcceleratorSuccessReplyDescriptor_t; + + +/* union of Reply Descriptors */ +typedef union _MPI2_REPLY_DESCRIPTORS_UNION +{ + MPI2_DEFAULT_REPLY_DESCRIPTOR Default; + MPI2_ADDRESS_REPLY_DESCRIPTOR AddressReply; + MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR SCSIIOSuccess; + MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR TargetAssistSuccess; + MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR TargetCommandBuffer; + MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR RAIDAcceleratorSuccess; + U64 Words; +} MPI2_REPLY_DESCRIPTORS_UNION, MPI2_POINTER PTR_MPI2_REPLY_DESCRIPTORS_UNION, + Mpi2ReplyDescriptorsUnion_t, MPI2_POINTER pMpi2ReplyDescriptorsUnion_t; + + + +/***************************************************************************** +* +* Message Functions +* 0x80 -> 0x8F reserved for private message use per product +* +* +*****************************************************************************/ + +#define MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */ +#define MPI2_FUNCTION_SCSI_TASK_MGMT (0x01) /* SCSI Task Management */ +#define MPI2_FUNCTION_IOC_INIT (0x02) /* IOC Init */ +#define MPI2_FUNCTION_IOC_FACTS (0x03) /* IOC Facts */ +#define MPI2_FUNCTION_CONFIG (0x04) /* Configuration */ +#define MPI2_FUNCTION_PORT_FACTS (0x05) /* Port Facts */ +#define MPI2_FUNCTION_PORT_ENABLE (0x06) /* Port Enable */ +#define MPI2_FUNCTION_EVENT_NOTIFICATION (0x07) /* Event Notification */ +#define MPI2_FUNCTION_EVENT_ACK (0x08) /* Event Acknowledge */ +#define MPI2_FUNCTION_FW_DOWNLOAD (0x09) /* FW Download */ +#define MPI2_FUNCTION_TARGET_ASSIST (0x0B) /* Target Assist */ +#define MPI2_FUNCTION_TARGET_STATUS_SEND (0x0C) /* Target Status Send */ +#define MPI2_FUNCTION_TARGET_MODE_ABORT (0x0D) /* Target Mode Abort */ +#define MPI2_FUNCTION_FW_UPLOAD (0x12) /* FW Upload */ +#define MPI2_FUNCTION_RAID_ACTION (0x15) /* RAID Action */ +#define MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH (0x16) /* SCSI IO RAID Passthrough */ +#define MPI2_FUNCTION_TOOLBOX (0x17) /* Toolbox */ +#define MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR (0x18) /* SCSI Enclosure Processor */ +#define MPI2_FUNCTION_SMP_PASSTHROUGH (0x1A) /* SMP Passthrough */ +#define MPI2_FUNCTION_SAS_IO_UNIT_CONTROL (0x1B) /* SAS IO Unit Control */ +#define MPI2_FUNCTION_SATA_PASSTHROUGH (0x1C) /* SATA Passthrough */ +#define MPI2_FUNCTION_DIAG_BUFFER_POST (0x1D) /* Diagnostic Buffer Post */ +#define MPI2_FUNCTION_DIAG_RELEASE (0x1E) /* Diagnostic Release */ +#define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST (0x24) /* Target Command Buffer Post Base */ +#define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) /* Target Command Buffer Post List */ +#define MPI2_FUNCTION_RAID_ACCELERATOR (0x2C) /* RAID Accelerator */ +#define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION (0x2F) /* Host Based Discovery Action */ + + + +/* Doorbell functions */ +#define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40) +#define MPI2_FUNCTION_HANDSHAKE (0x42) + + +/***************************************************************************** +* +* IOC Status Values +* +*****************************************************************************/ + +/* mask for IOCStatus status value */ +#define MPI2_IOCSTATUS_MASK (0x7FFF) + +/**************************************************************************** +* Common IOCStatus values for all replies +****************************************************************************/ + +#define MPI2_IOCSTATUS_SUCCESS (0x0000) +#define MPI2_IOCSTATUS_INVALID_FUNCTION (0x0001) +#define MPI2_IOCSTATUS_BUSY (0x0002) +#define MPI2_IOCSTATUS_INVALID_SGL (0x0003) +#define MPI2_IOCSTATUS_INTERNAL_ERROR (0x0004) +#define MPI2_IOCSTATUS_INVALID_VPID (0x0005) +#define MPI2_IOCSTATUS_INSUFFICIENT_RESOURCES (0x0006) +#define MPI2_IOCSTATUS_INVALID_FIELD (0x0007) +#define MPI2_IOCSTATUS_INVALID_STATE (0x0008) +#define MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED (0x0009) + +/**************************************************************************** +* Config IOCStatus values +****************************************************************************/ + +#define MPI2_IOCSTATUS_CONFIG_INVALID_ACTION (0x0020) +#define MPI2_IOCSTATUS_CONFIG_INVALID_TYPE (0x0021) +#define MPI2_IOCSTATUS_CONFIG_INVALID_PAGE (0x0022) +#define MPI2_IOCSTATUS_CONFIG_INVALID_DATA (0x0023) +#define MPI2_IOCSTATUS_CONFIG_NO_DEFAULTS (0x0024) +#define MPI2_IOCSTATUS_CONFIG_CANT_COMMIT (0x0025) + +/**************************************************************************** +* SCSI IO Reply +****************************************************************************/ + +#define MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR (0x0040) +#define MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE (0x0042) +#define MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE (0x0043) +#define MPI2_IOCSTATUS_SCSI_DATA_OVERRUN (0x0044) +#define MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN (0x0045) +#define MPI2_IOCSTATUS_SCSI_IO_DATA_ERROR (0x0046) +#define MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR (0x0047) +#define MPI2_IOCSTATUS_SCSI_TASK_TERMINATED (0x0048) +#define MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH (0x0049) +#define MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED (0x004A) +#define MPI2_IOCSTATUS_SCSI_IOC_TERMINATED (0x004B) +#define MPI2_IOCSTATUS_SCSI_EXT_TERMINATED (0x004C) + +/**************************************************************************** +* For use by SCSI Initiator and SCSI Target end-to-end data protection +****************************************************************************/ + +#define MPI2_IOCSTATUS_EEDP_GUARD_ERROR (0x004D) +#define MPI2_IOCSTATUS_EEDP_REF_TAG_ERROR (0x004E) +#define MPI2_IOCSTATUS_EEDP_APP_TAG_ERROR (0x004F) + +/**************************************************************************** +* SCSI Target values +****************************************************************************/ + +#define MPI2_IOCSTATUS_TARGET_INVALID_IO_INDEX (0x0062) +#define MPI2_IOCSTATUS_TARGET_ABORTED (0x0063) +#define MPI2_IOCSTATUS_TARGET_NO_CONN_RETRYABLE (0x0064) +#define MPI2_IOCSTATUS_TARGET_NO_CONNECTION (0x0065) +#define MPI2_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A) +#define MPI2_IOCSTATUS_TARGET_DATA_OFFSET_ERROR (0x006D) +#define MPI2_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E) +#define MPI2_IOCSTATUS_TARGET_IU_TOO_SHORT (0x006F) +#define MPI2_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT (0x0070) +#define MPI2_IOCSTATUS_TARGET_NAK_RECEIVED (0x0071) + +/**************************************************************************** +* Serial Attached SCSI values +****************************************************************************/ + +#define MPI2_IOCSTATUS_SAS_SMP_REQUEST_FAILED (0x0090) +#define MPI2_IOCSTATUS_SAS_SMP_DATA_OVERRUN (0x0091) + +/**************************************************************************** +* Diagnostic Buffer Post / Diagnostic Release values +****************************************************************************/ + +#define MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED (0x00A0) + +/**************************************************************************** +* RAID Accelerator values +****************************************************************************/ + +#define MPI2_IOCSTATUS_RAID_ACCEL_ERROR (0x00B0) + +/**************************************************************************** +* IOCStatus flag to indicate that log info is available +****************************************************************************/ + +#define MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE (0x8000) + +/**************************************************************************** +* IOCLogInfo Types +****************************************************************************/ + +#define MPI2_IOCLOGINFO_TYPE_MASK (0xF0000000) +#define MPI2_IOCLOGINFO_TYPE_SHIFT (28) +#define MPI2_IOCLOGINFO_TYPE_NONE (0x0) +#define MPI2_IOCLOGINFO_TYPE_SCSI (0x1) +#define MPI2_IOCLOGINFO_TYPE_FC (0x2) +#define MPI2_IOCLOGINFO_TYPE_SAS (0x3) +#define MPI2_IOCLOGINFO_TYPE_ISCSI (0x4) +#define MPI2_IOCLOGINFO_LOG_DATA_MASK (0x0FFFFFFF) + + +/***************************************************************************** +* +* Standard Message Structures +* +*****************************************************************************/ + +/**************************************************************************** +* Request Message Header for all request messages +****************************************************************************/ + +typedef struct _MPI2_REQUEST_HEADER +{ + U16 FunctionDependent1; /* 0x00 */ + U8 ChainOffset; /* 0x02 */ + U8 Function; /* 0x03 */ + U16 FunctionDependent2; /* 0x04 */ + U8 FunctionDependent3; /* 0x06 */ + U8 MsgFlags; /* 0x07 */ + U8 VP_ID; /* 0x08 */ + U8 VF_ID; /* 0x09 */ + U16 Reserved1; /* 0x0A */ +} MPI2_REQUEST_HEADER, MPI2_POINTER PTR_MPI2_REQUEST_HEADER, + MPI2RequestHeader_t, MPI2_POINTER pMPI2RequestHeader_t; + + +/**************************************************************************** +* Default Reply +****************************************************************************/ + +typedef struct _MPI2_DEFAULT_REPLY +{ + U16 FunctionDependent1; /* 0x00 */ + U8 MsgLength; /* 0x02 */ + U8 Function; /* 0x03 */ + U16 FunctionDependent2; /* 0x04 */ + U8 FunctionDependent3; /* 0x06 */ + U8 MsgFlags; /* 0x07 */ + U8 VP_ID; /* 0x08 */ + U8 VF_ID; /* 0x09 */ + U16 Reserved1; /* 0x0A */ + U16 FunctionDependent5; /* 0x0C */ + U16 IOCStatus; /* 0x0E */ + U32 IOCLogInfo; /* 0x10 */ +} MPI2_DEFAULT_REPLY, MPI2_POINTER PTR_MPI2_DEFAULT_REPLY, + MPI2DefaultReply_t, MPI2_POINTER pMPI2DefaultReply_t; + + +/* common version structure/union used in messages and configuration pages */ + +typedef struct _MPI2_VERSION_STRUCT +{ + U8 Dev; /* 0x00 */ + U8 Unit; /* 0x01 */ + U8 Minor; /* 0x02 */ + U8 Major; /* 0x03 */ +} MPI2_VERSION_STRUCT; + +typedef union _MPI2_VERSION_UNION +{ + MPI2_VERSION_STRUCT Struct; + U32 Word; +} MPI2_VERSION_UNION; + + +/* LUN field defines, common to many structures */ +#define MPI2_LUN_FIRST_LEVEL_ADDRESSING (0x0000FFFF) +#define MPI2_LUN_SECOND_LEVEL_ADDRESSING (0xFFFF0000) +#define MPI2_LUN_THIRD_LEVEL_ADDRESSING (0x0000FFFF) +#define MPI2_LUN_FOURTH_LEVEL_ADDRESSING (0xFFFF0000) +#define MPI2_LUN_LEVEL_1_WORD (0xFF00) +#define MPI2_LUN_LEVEL_1_DWORD (0x0000FF00) + + +/***************************************************************************** +* +* Fusion-MPT MPI Scatter Gather Elements +* +*****************************************************************************/ + +/**************************************************************************** +* MPI Simple Element structures +****************************************************************************/ + +typedef struct _MPI2_SGE_SIMPLE32 +{ + U32 FlagsLength; + U32 Address; +} MPI2_SGE_SIMPLE32, MPI2_POINTER PTR_MPI2_SGE_SIMPLE32, + Mpi2SGESimple32_t, MPI2_POINTER pMpi2SGESimple32_t; + +typedef struct _MPI2_SGE_SIMPLE64 +{ + U32 FlagsLength; + U64 Address; +} MPI2_SGE_SIMPLE64, MPI2_POINTER PTR_MPI2_SGE_SIMPLE64, + Mpi2SGESimple64_t, MPI2_POINTER pMpi2SGESimple64_t; + +typedef struct _MPI2_SGE_SIMPLE_UNION +{ + U32 FlagsLength; + union + { + U32 Address32; + U64 Address64; + } u; +} MPI2_SGE_SIMPLE_UNION, MPI2_POINTER PTR_MPI2_SGE_SIMPLE_UNION, + Mpi2SGESimpleUnion_t, MPI2_POINTER pMpi2SGESimpleUnion_t; + + +/**************************************************************************** +* MPI Chain Element structures +****************************************************************************/ + +typedef struct _MPI2_SGE_CHAIN32 +{ + U16 Length; + U8 NextChainOffset; + U8 Flags; + U32 Address; +} MPI2_SGE_CHAIN32, MPI2_POINTER PTR_MPI2_SGE_CHAIN32, + Mpi2SGEChain32_t, MPI2_POINTER pMpi2SGEChain32_t; + +typedef struct _MPI2_SGE_CHAIN64 +{ + U16 Length; + U8 NextChainOffset; + U8 Flags; + U64 Address; +} MPI2_SGE_CHAIN64, MPI2_POINTER PTR_MPI2_SGE_CHAIN64, + Mpi2SGEChain64_t, MPI2_POINTER pMpi2SGEChain64_t; + +typedef struct _MPI2_SGE_CHAIN_UNION +{ + U16 Length; + U8 NextChainOffset; + U8 Flags; + union + { + U32 Address32; + U64 Address64; + } u; +} MPI2_SGE_CHAIN_UNION, MPI2_POINTER PTR_MPI2_SGE_CHAIN_UNION, + Mpi2SGEChainUnion_t, MPI2_POINTER pMpi2SGEChainUnion_t; + + +/**************************************************************************** +* MPI Transaction Context Element structures +****************************************************************************/ + +typedef struct _MPI2_SGE_TRANSACTION32 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[1]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION32, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION32, + Mpi2SGETransaction32_t, MPI2_POINTER pMpi2SGETransaction32_t; + +typedef struct _MPI2_SGE_TRANSACTION64 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[2]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION64, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION64, + Mpi2SGETransaction64_t, MPI2_POINTER pMpi2SGETransaction64_t; + +typedef struct _MPI2_SGE_TRANSACTION96 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[3]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION96, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION96, + Mpi2SGETransaction96_t, MPI2_POINTER pMpi2SGETransaction96_t; + +typedef struct _MPI2_SGE_TRANSACTION128 +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + U32 TransactionContext[4]; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION128, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION128, + Mpi2SGETransaction_t128, MPI2_POINTER pMpi2SGETransaction_t128; + +typedef struct _MPI2_SGE_TRANSACTION_UNION +{ + U8 Reserved; + U8 ContextSize; + U8 DetailsLength; + U8 Flags; + union + { + U32 TransactionContext32[1]; + U32 TransactionContext64[2]; + U32 TransactionContext96[3]; + U32 TransactionContext128[4]; + } u; + U32 TransactionDetails[1]; +} MPI2_SGE_TRANSACTION_UNION, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION_UNION, + Mpi2SGETransactionUnion_t, MPI2_POINTER pMpi2SGETransactionUnion_t; + + +/**************************************************************************** +* MPI SGE union for IO SGL's +****************************************************************************/ + +typedef struct _MPI2_MPI_SGE_IO_UNION +{ + union + { + MPI2_SGE_SIMPLE_UNION Simple; + MPI2_SGE_CHAIN_UNION Chain; + } u; +} MPI2_MPI_SGE_IO_UNION, MPI2_POINTER PTR_MPI2_MPI_SGE_IO_UNION, + Mpi2MpiSGEIOUnion_t, MPI2_POINTER pMpi2MpiSGEIOUnion_t; + + +/**************************************************************************** +* MPI SGE union for SGL's with Simple and Transaction elements +****************************************************************************/ + +typedef struct _MPI2_SGE_TRANS_SIMPLE_UNION +{ + union + { + MPI2_SGE_SIMPLE_UNION Simple; + MPI2_SGE_TRANSACTION_UNION Transaction; + } u; +} MPI2_SGE_TRANS_SIMPLE_UNION, MPI2_POINTER PTR_MPI2_SGE_TRANS_SIMPLE_UNION, + Mpi2SGETransSimpleUnion_t, MPI2_POINTER pMpi2SGETransSimpleUnion_t; + + +/**************************************************************************** +* All MPI SGE types union +****************************************************************************/ + +typedef struct _MPI2_MPI_SGE_UNION +{ + union + { + MPI2_SGE_SIMPLE_UNION Simple; + MPI2_SGE_CHAIN_UNION Chain; + MPI2_SGE_TRANSACTION_UNION Transaction; + } u; +} MPI2_MPI_SGE_UNION, MPI2_POINTER PTR_MPI2_MPI_SGE_UNION, + Mpi2MpiSgeUnion_t, MPI2_POINTER pMpi2MpiSgeUnion_t; + + +/**************************************************************************** +* MPI SGE field definition and masks +****************************************************************************/ + +/* Flags field bit definitions */ + +#define MPI2_SGE_FLAGS_LAST_ELEMENT (0x80) +#define MPI2_SGE_FLAGS_END_OF_BUFFER (0x40) +#define MPI2_SGE_FLAGS_ELEMENT_TYPE_MASK (0x30) +#define MPI2_SGE_FLAGS_LOCAL_ADDRESS (0x08) +#define MPI2_SGE_FLAGS_DIRECTION (0x04) +#define MPI2_SGE_FLAGS_ADDRESS_SIZE (0x02) +#define MPI2_SGE_FLAGS_END_OF_LIST (0x01) + +#define MPI2_SGE_FLAGS_SHIFT (24) + +#define MPI2_SGE_LENGTH_MASK (0x00FFFFFF) +#define MPI2_SGE_CHAIN_LENGTH_MASK (0x0000FFFF) + +/* Element Type */ + +#define MPI2_SGE_FLAGS_TRANSACTION_ELEMENT (0x00) +#define MPI2_SGE_FLAGS_SIMPLE_ELEMENT (0x10) +#define MPI2_SGE_FLAGS_CHAIN_ELEMENT (0x30) +#define MPI2_SGE_FLAGS_ELEMENT_MASK (0x30) + +/* Address location */ + +#define MPI2_SGE_FLAGS_SYSTEM_ADDRESS (0x00) + +/* Direction */ + +#define MPI2_SGE_FLAGS_IOC_TO_HOST (0x00) +#define MPI2_SGE_FLAGS_HOST_TO_IOC (0x04) + +/* Address Size */ + +#define MPI2_SGE_FLAGS_32_BIT_ADDRESSING (0x00) +#define MPI2_SGE_FLAGS_64_BIT_ADDRESSING (0x02) + +/* Context Size */ + +#define MPI2_SGE_FLAGS_32_BIT_CONTEXT (0x00) +#define MPI2_SGE_FLAGS_64_BIT_CONTEXT (0x02) +#define MPI2_SGE_FLAGS_96_BIT_CONTEXT (0x04) +#define MPI2_SGE_FLAGS_128_BIT_CONTEXT (0x06) + +#define MPI2_SGE_CHAIN_OFFSET_MASK (0x00FF0000) +#define MPI2_SGE_CHAIN_OFFSET_SHIFT (16) + +/**************************************************************************** +* MPI SGE operation Macros +****************************************************************************/ + +/* SIMPLE FlagsLength manipulations... */ +#define MPI2_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_SGE_FLAGS_SHIFT) +#define MPI2_SGE_GET_FLAGS(f) (((f) & ~MPI2_SGE_LENGTH_MASK) >> MPI2_SGE_FLAGS_SHIFT) +#define MPI2_SGE_LENGTH(f) ((f) & MPI2_SGE_LENGTH_MASK) +#define MPI2_SGE_CHAIN_LENGTH(f) ((f) & MPI2_SGE_CHAIN_LENGTH_MASK) + +#define MPI2_SGE_SET_FLAGS_LENGTH(f,l) (MPI2_SGE_SET_FLAGS(f) | MPI2_SGE_LENGTH(l)) + +#define MPI2_pSGE_GET_FLAGS(psg) MPI2_SGE_GET_FLAGS((psg)->FlagsLength) +#define MPI2_pSGE_GET_LENGTH(psg) MPI2_SGE_LENGTH((psg)->FlagsLength) +#define MPI2_pSGE_SET_FLAGS_LENGTH(psg,f,l) (psg)->FlagsLength = MPI2_SGE_SET_FLAGS_LENGTH(f,l) + +/* CAUTION - The following are READ-MODIFY-WRITE! */ +#define MPI2_pSGE_SET_FLAGS(psg,f) (psg)->FlagsLength |= MPI2_SGE_SET_FLAGS(f) +#define MPI2_pSGE_SET_LENGTH(psg,l) (psg)->FlagsLength |= MPI2_SGE_LENGTH(l) + +#define MPI2_GET_CHAIN_OFFSET(x) ((x & MPI2_SGE_CHAIN_OFFSET_MASK) >> MPI2_SGE_CHAIN_OFFSET_SHIFT) + + +/***************************************************************************** +* +* Fusion-MPT IEEE Scatter Gather Elements +* +*****************************************************************************/ + +/**************************************************************************** +* IEEE Simple Element structures +****************************************************************************/ + +typedef struct _MPI2_IEEE_SGE_SIMPLE32 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 15:33:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1B861065675; Fri, 10 Sep 2010 15:33:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E17778FC18; Fri, 10 Sep 2010 15:33: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 o8AFXQSR056987; Fri, 10 Sep 2010 15:33:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AFXQXW056985; Fri, 10 Sep 2010 15:33:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009101533.o8AFXQXW056985@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 10 Sep 2010 15:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212421 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 15:33:27 -0000 Author: nwhitehorn Date: Fri Sep 10 15:33:26 2010 New Revision: 212421 URL: http://svn.freebsd.org/changeset/base/212421 Log: MFC r211861: pmap_mapdev() does not appear to actually need GIANT to be held here, and asserting that is held breaks drm. Modified: stable/8/sys/powerpc/aim/mmu_oea.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/mmu_oea.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea.c Fri Sep 10 15:03:56 2010 (r212420) +++ stable/8/sys/powerpc/aim/mmu_oea.c Fri Sep 10 15:33:26 2010 (r212421) @@ -2382,8 +2382,6 @@ moea_mapdev(mmu_t mmu, vm_offset_t pa, v offset = pa & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); - GIANT_REQUIRED; - /* * If the physical address lies within a valid BAT table entry, * return the 1:1 mapping. This currently doesn't work From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 16:19:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA85C1065670; Fri, 10 Sep 2010 16:19:58 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB88B8FC18; Fri, 10 Sep 2010 16:19: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 o8AGJwkX062465; Fri, 10 Sep 2010 16:19:58 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AGJwCP062463; Fri, 10 Sep 2010 16:19:58 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009101619.o8AGJwCP062463@svn.freebsd.org> From: Rui Paulo Date: Fri, 10 Sep 2010 16: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: r212422 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 16:19:58 -0000 Author: rpaulo Date: Fri Sep 10 16:19:58 2010 New Revision: 212422 URL: http://svn.freebsd.org/changeset/base/212422 Log: Add the DTRACE variable that points to the executable. Sponsored by: The FreeBSD Foundation Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Fri Sep 10 15:33:26 2010 (r212421) +++ head/share/mk/sys.mk Fri Sep 10 16:19:58 2010 (r212422) @@ -69,6 +69,7 @@ CTFFLAGS ?= -L VERSION CTFCONVERT ?= ctfconvert CTFMERGE ?= ctfmerge +DTRACE ?= dtrace .if defined(CFLAGS) && (${CFLAGS:M-g} != "") CTFFLAGS += -g .else From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 16:21:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E21B1065670; Fri, 10 Sep 2010 16:21:09 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EE748FC18; Fri, 10 Sep 2010 16:21: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 o8AGL9Ch062653; Fri, 10 Sep 2010 16:21:09 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AGL9t8062650; Fri, 10 Sep 2010 16:21:09 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009101621.o8AGL9t8062650@svn.freebsd.org> From: Rui Paulo Date: Fri, 10 Sep 2010 16:21:09 +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: r212423 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 16:21:09 -0000 Author: rpaulo Date: Fri Sep 10 16:21:09 2010 New Revision: 212423 URL: http://svn.freebsd.org/changeset/base/212423 Log: Check the existence of a 'beforelinking' target and make the resulting program or library depend on that before doing the final linking. This will be needed by DTrace. Sponsored by: The FreeBSD Foundation Modified: head/share/mk/bsd.lib.mk head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Fri Sep 10 16:19:58 2010 (r212422) +++ head/share/mk/bsd.lib.mk Fri Sep 10 16:21:09 2010 (r212423) @@ -198,7 +198,11 @@ SOBJS+= ${OBJS:.o=.So} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} +.if target(beforelinking) +${SHLIB_NAME}: ${SOBJS} beforelinking +.else ${SHLIB_NAME}: ${SOBJS} +.endif @${ECHO} building shared library ${SHLIB_NAME} @rm -f ${.TARGET} ${SHLIB_LINK} .if defined(SHLIB_LINK) Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Fri Sep 10 16:19:58 2010 (r212422) +++ head/share/mk/bsd.prog.mk Fri Sep 10 16:21:09 2010 (r212423) @@ -60,7 +60,11 @@ LDADD+= -lobjc -lpthread OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -${PROG}: ${OBJS} +.if target(beforelinking) +${PROG}: ${OBJS} beforelinking +.else +${PROG}: ${OBJS} beforelinking +.endif .if defined(PROG_CXX) ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else @@ -86,7 +90,11 @@ SRCS= ${PROG}.c # - it's useful to keep objects around for crunching. OBJS= ${PROG}.o +.if target(beforelinking) +${PROG}: ${OBJS} beforelinking +.else ${PROG}: ${OBJS} +.endif .if defined(PROG_CXX) ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 16:27:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3470D106566B; Fri, 10 Sep 2010 16:27:10 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24C2F8FC12; Fri, 10 Sep 2010 16:27: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 o8AGRAb0063530; Fri, 10 Sep 2010 16:27:10 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AGRA8V063527; Fri, 10 Sep 2010 16:27:10 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009101627.o8AGRA8V063527@svn.freebsd.org> From: Rui Paulo Date: Fri, 10 Sep 2010 16:27: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: r212424 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 16:27:10 -0000 Author: rpaulo Date: Fri Sep 10 16:27:09 2010 New Revision: 212424 URL: http://svn.freebsd.org/changeset/base/212424 Log: Add bsd.dtrace.mk. This allows userland programs and libraries to define USDT probes on a provider.d file and then use this new make infrastructure to build the corresponding header file and object file. This will only take effect when the user defines WITH_DTRACE when building. Sponsored by: The FreeBSD Foundation Added: head/share/mk/bsd.dtrace.mk (contents, props changed) Modified: head/share/mk/Makefile Modified: head/share/mk/Makefile ============================================================================== --- head/share/mk/Makefile Fri Sep 10 16:21:09 2010 (r212423) +++ head/share/mk/Makefile Fri Sep 10 16:27:09 2010 (r212424) @@ -3,7 +3,8 @@ FILES= bsd.README FILES+= bsd.arch.inc.mk -FILES+= bsd.compat.mk bsd.cpu.mk bsd.dep.mk bsd.doc.mk bsd.endian.mk +FILES+= bsd.compat.mk bsd.cpu.mk bsd.dep.mk bsd.doc.mk bsd.dtrace.mk +FILES+= bsd.endian.mk FILES+= bsd.files.mk bsd.incs.mk bsd.info.mk bsd.init.mk FILES+= bsd.kmod.mk FILES+= bsd.lib.mk bsd.libnames.mk bsd.links.mk bsd.man.mk bsd.nls.mk Added: head/share/mk/bsd.dtrace.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/mk/bsd.dtrace.mk Fri Sep 10 16:27:09 2010 (r212424) @@ -0,0 +1,55 @@ +# $FreeBSD$ +# +# Copyright (c) 2010 The FreeBSD Foundation +# All rights reserved. +# +# This software was developed by Rui Paulo under sponsorship from the +# FreeBSD Foundation. +# +# 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. +# +# +# The only variable that you should define on your Makefile is 'DTRACEOBJS'. +# + +.if defined(WITH_DTRACE) + +CFLAGS+=-DWITH_DTRACE +DTRACEHEADERS=${DTRACEOBJS:S/o$/h/} +DTRACESRCS=${DTRACEOBJS:S/o$/d/} +CLEANFILES+=${DTRACEOBJS} ${DTRACEHEADERS} +.if defined(PROG) +_DTRACELINKING:=${OBJS} +OBJS+=${DTRACEOBJS} +.else +_DTRACELINKING:=${SOBJS} +SOBJS+=${DTRACEOBJS} +.endif +DPADD+=${LIBELF} +LDADD+=-lelf + +beforedepend: + ${DTRACE} -C -h -s ${DTRACESRCS} +beforelinking: + ${DTRACE} -G -s ${DTRACESRCS} ${_DTRACELINKING} + +.endif From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 16:42:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40AD9106566C; Fri, 10 Sep 2010 16:42:17 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E16B8FC21; Fri, 10 Sep 2010 16:42: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 o8AGgHgT065828; Fri, 10 Sep 2010 16:42:17 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AGgGjL065818; Fri, 10 Sep 2010 16:42:16 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009101642.o8AGgGjL065818@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 10 Sep 2010 16:42: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: r212425 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linux sys/kern sys/net sys/security/audit sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 16:42:17 -0000 Author: mdf Date: Fri Sep 10 16:42:16 2010 New Revision: 212425 URL: http://svn.freebsd.org/changeset/base/212425 Log: Replace sbuf_overflowed() with sbuf_error(), which returns any error code associated with overflow or with the drain function. While this function is not expected to be used often, it produces more information in the form of an errno that sbuf_overflowed() did. Modified: head/share/man/man9/Makefile head/share/man/man9/sbuf.9 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c head/sys/compat/linux/linux_ioctl.c head/sys/kern/kern_sig.c head/sys/kern/subr_sbuf.c head/sys/net/if.c head/sys/security/audit/audit_bsm_klib.c head/sys/sys/sbuf.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Fri Sep 10 16:27:09 2010 (r212424) +++ head/share/man/man9/Makefile Fri Sep 10 16:42:16 2010 (r212425) @@ -1025,10 +1025,10 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_data.9 \ sbuf.9 sbuf_delete.9 \ sbuf.9 sbuf_done.9 \ + sbuf.9 sbuf_error.9 \ sbuf.9 sbuf_finish.9 \ sbuf.9 sbuf_len.9 \ sbuf.9 sbuf_new.9 \ - sbuf.9 sbuf_overflowed.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_putc.9 \ sbuf.9 sbuf_set_drain.9 \ Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Fri Sep 10 16:27:09 2010 (r212424) +++ head/share/man/man9/sbuf.9 Fri Sep 10 16:42:16 2010 (r212425) @@ -45,7 +45,7 @@ .Nm sbuf_putc , .Nm sbuf_set_drain , .Nm sbuf_trim , -.Nm sbuf_overflowed , +.Nm sbuf_error , .Nm sbuf_finish , .Nm sbuf_data , .Nm sbuf_len , @@ -88,7 +88,7 @@ .Ft int .Fn sbuf_trim "struct sbuf *s" .Ft int -.Fn sbuf_overflowed "struct sbuf *s" +.Fn sbuf_error "struct sbuf *s" .Ft int .Fn sbuf_finish "struct sbuf *s" .Ft char * @@ -332,10 +332,15 @@ function removes trailing whitespace fro .Fa sbuf . .Pp The -.Fn sbuf_overflowed -function returns a non-zero value if the +.Fn sbuf_error +function returns any error value that the +.Fa sbuf +may have accumulated, either from the drain function, or ENOMEM if the .Fa sbuf overflowed. +This function is generally not needed and instead the error code from +.Fn sbuf_finish +is the preferred way to discover whether an sbuf had an error. .Pp The .Fn sbuf_finish @@ -437,9 +442,9 @@ functions all return \-1 if the buffer overflowed, and zero otherwise. .Pp The -.Fn sbuf_overflowed -function -returns a non-zero value if the buffer overflowed, and zero otherwise. +.Fn sbuf_error +function returns a non-zero value if the buffer has an overflow or +drain error, and zero otherwise. .Pp The .Fn sbuf_data Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Fri Sep 10 16:27:09 2010 (r212424) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Fri Sep 10 16:42:16 2010 (r212425) @@ -101,6 +101,7 @@ zfs_ereport_post(const char *subclass, s char buf[1024]; struct sbuf sb; struct timespec ts; + int error; /* * If we are doing a spa_tryimport(), ignore errors. @@ -315,9 +316,9 @@ zfs_ereport_post(const char *subclass, s } mutex_exit(&spa->spa_errlist_lock); - sbuf_finish(&sb); + error = sbuf_finish(&sb); devctl_notify("ZFS", spa->spa_name, subclass, sbuf_data(&sb)); - if (sbuf_overflowed(&sb)) + if (error != 0) printf("ZFS WARNING: sbuf overflowed\n"); sbuf_delete(&sb); #endif @@ -331,6 +332,7 @@ zfs_post_common(spa_t *spa, vdev_t *vd, char class[64]; struct sbuf sb; struct timespec ts; + int error; nanotime(&ts); @@ -346,10 +348,10 @@ zfs_post_common(spa_t *spa, vdev_t *vd, if (vd) sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID, vd->vdev_guid); - sbuf_finish(&sb); + error = sbuf_finish(&sb); ZFS_LOG(1, "%s", sbuf_data(&sb)); devctl_notify("ZFS", spa->spa_name, class, sbuf_data(&sb)); - if (sbuf_overflowed(&sb)) + if (error != 0) printf("ZFS WARNING: sbuf overflowed\n"); sbuf_delete(&sb); #endif Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Fri Sep 10 16:27:09 2010 (r212424) +++ head/sys/compat/linux/linux_ioctl.c Fri Sep 10 16:42:16 2010 (r212425) @@ -2220,7 +2220,7 @@ again: addrs++; } - if (!sbuf_overflowed(sb)) + if (sbuf_error(sb) == 0) valid_len = sbuf_len(sb); } if (addrs == 0) { @@ -2228,7 +2228,7 @@ again: sbuf_bcat(sb, &ifr, sizeof(ifr)); max_len += sizeof(ifr); - if (!sbuf_overflowed(sb)) + if (sbuf_error(sb) == 0) valid_len = sbuf_len(sb); } } Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Fri Sep 10 16:27:09 2010 (r212424) +++ head/sys/kern/kern_sig.c Fri Sep 10 16:42:16 2010 (r212425) @@ -3093,7 +3093,7 @@ expand_name(const char *name, uid_t uid, sbuf_printf(&sb, GZ_SUFFIX); } #endif - if (sbuf_overflowed(&sb)) { + if (sbuf_error(&sb) != 0) { log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " "long\n", (long)pid, name, (u_long)uid); nomem: Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Sep 10 16:27:09 2010 (r212424) +++ head/sys/kern/subr_sbuf.c Fri Sep 10 16:42:16 2010 (r212425) @@ -66,7 +66,6 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "st #define SBUF_ISDYNAMIC(s) ((s)->s_flags & SBUF_DYNAMIC) #define SBUF_ISDYNSTRUCT(s) ((s)->s_flags & SBUF_DYNSTRUCT) #define SBUF_ISFINISHED(s) ((s)->s_flags & SBUF_FINISHED) -#define SBUF_HASOVERFLOWED(s) ((s)->s_flags & SBUF_OVERFLOWED) #define SBUF_HASROOM(s) ((s)->s_len < (s)->s_size - 1) #define SBUF_FREESPACE(s) ((s)->s_size - (s)->s_len - 1) #define SBUF_CANEXTEND(s) ((s)->s_flags & SBUF_AUTOEXTEND) @@ -247,7 +246,6 @@ sbuf_clear(struct sbuf *s) /* don't care if it's finished or not */ SBUF_CLEARFLAG(s, SBUF_FINISHED); - SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); s->s_error = 0; s->s_len = 0; } @@ -299,10 +297,10 @@ sbuf_drain(struct sbuf *s) int len; KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s)); + KASSERT(s->s_error == 0, ("Called %s with error on %p", __func__, s)); len = s->s_drain_func(s->s_drain_arg, s->s_buf, s->s_len); if (len < 0) { s->s_error = -len; - SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (s->s_error); } KASSERT(len > 0 && len <= s->s_len, @@ -334,7 +332,7 @@ sbuf_put_byte(int c, struct sbuf *s) assert_sbuf_integrity(s); assert_sbuf_state(s, 0); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return; if (SBUF_FREESPACE(s) <= 0) { /* @@ -344,8 +342,8 @@ sbuf_put_byte(int c, struct sbuf *s) if (s->s_drain_func != NULL) (void)sbuf_drain(s); else if (sbuf_extend(s, 1) < 0) - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - if (SBUF_HASOVERFLOWED(s)) + s->s_error = ENOMEM; + if (s->s_error != 0) return; } s->s_buf[s->s_len++] = c; @@ -375,11 +373,11 @@ sbuf_bcat(struct sbuf *s, const void *bu assert_sbuf_integrity(s); assert_sbuf_state(s, 0); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); for (; str < end; str++) { sbuf_put_byte(*str, s); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); } return (0); @@ -398,7 +396,7 @@ sbuf_bcopyin(struct sbuf *s, const void KASSERT(s->s_drain_func == NULL, ("Nonsensical copyin to sbuf %p with a drain", s)); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); if (len == 0) return (0); @@ -439,12 +437,12 @@ sbuf_cat(struct sbuf *s, const char *str assert_sbuf_integrity(s); assert_sbuf_state(s, 0); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); while (*str != '\0') { sbuf_put_byte(*str, s); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); } return (0); @@ -464,7 +462,7 @@ sbuf_copyin(struct sbuf *s, const void * KASSERT(s->s_drain_func == NULL, ("Nonsensical copyin to sbuf %p with a drain", s)); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); if (len == 0) @@ -476,7 +474,7 @@ sbuf_copyin(struct sbuf *s, const void * } switch (copyinstr(uaddr, s->s_buf + s->s_len, len + 1, &done)) { case ENAMETOOLONG: - SBUF_SETFLAG(s, SBUF_OVERFLOWED); + s->s_error = ENOMEM; /* fall through */ case 0: s->s_len += done - 1; @@ -518,7 +516,7 @@ sbuf_vprintf(struct sbuf *s, const char ("%s called with a NULL format string", __func__)); (void)kvprintf(fmt, sbuf_putc_func, s, 10, ap); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); return (0); } @@ -535,7 +533,7 @@ sbuf_vprintf(struct sbuf *s, const char KASSERT(fmt != NULL, ("%s called with a NULL format string", __func__)); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); /* @@ -578,12 +576,12 @@ sbuf_vprintf(struct sbuf *s, const char len = SBUF_FREESPACE(s); s->s_len += len; if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s)) - SBUF_SETFLAG(s, SBUF_OVERFLOWED); + s->s_error = ENOMEM; KASSERT(s->s_len < s->s_size, ("wrote past end of sbuf (%d >= %d)", s->s_len, s->s_size)); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); return (0); } @@ -612,7 +610,7 @@ sbuf_putc(struct sbuf *s, int c) { sbuf_putc_func(c, s); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); return (0); } @@ -629,7 +627,7 @@ sbuf_trim(struct sbuf *s) KASSERT(s->s_drain_func == NULL, ("%s makes no sense on sbuf %p with drain", __func__, s)); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); while (s->s_len > 0 && isspace(s->s_buf[s->s_len-1])) @@ -639,13 +637,13 @@ sbuf_trim(struct sbuf *s) } /* - * Check if an sbuf overflowed + * Check if an sbuf has an error. */ int -sbuf_overflowed(struct sbuf *s) +sbuf_error(struct sbuf *s) { - return (SBUF_HASOVERFLOWED(s)); + return (s->s_error); } /* @@ -654,19 +652,18 @@ sbuf_overflowed(struct sbuf *s) int sbuf_finish(struct sbuf *s) { - int error = 0; + int error; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + error = s->s_error; if (s->s_drain_func != NULL) { - error = s->s_error; while (s->s_len > 0 && error == 0) error = sbuf_drain(s); - } else if (SBUF_HASOVERFLOWED(s)) - error = ENOMEM; + } s->s_buf[s->s_len] = '\0'; - SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); + s->s_error = 0; SBUF_SETFLAG(s, SBUF_FINISHED); #ifdef _KERNEL return (error); @@ -703,7 +700,7 @@ sbuf_len(struct sbuf *s) KASSERT(s->s_drain_func == NULL, ("%s makes no sense on sbuf %p with drain", __func__, s)); - if (SBUF_HASOVERFLOWED(s)) + if (s->s_error != 0) return (-1); return (s->s_len); } Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Sep 10 16:27:09 2010 (r212424) +++ head/sys/net/if.c Fri Sep 10 16:42:16 2010 (r212425) @@ -2726,7 +2726,7 @@ again: max_len += sa->sa_len; } - if (!sbuf_overflowed(sb)) + if (sbuf_error(sb) == 0) valid_len = sbuf_len(sb); } IF_ADDR_UNLOCK(ifp); @@ -2735,7 +2735,7 @@ again: sbuf_bcat(sb, &ifr, sizeof(ifr)); max_len += sizeof(ifr); - if (!sbuf_overflowed(sb)) + if (sbuf_error(sb) == 0) valid_len = sbuf_len(sb); } } Modified: head/sys/security/audit/audit_bsm_klib.c ============================================================================== --- head/sys/security/audit/audit_bsm_klib.c Fri Sep 10 16:27:09 2010 (r212424) +++ head/sys/security/audit/audit_bsm_klib.c Fri Sep 10 16:42:16 2010 (r212425) @@ -548,7 +548,7 @@ audit_canon_path(struct thread *td, char * the supplied buffer being overflowed. Check to see if this is the * case. */ - if (sbuf_overflowed(&sbf) != 0) { + if (sbuf_error(&sbf) != 0) { cpath[0] = '\0'; return; } Modified: head/sys/sys/sbuf.h ============================================================================== --- head/sys/sys/sbuf.h Fri Sep 10 16:27:09 2010 (r212424) +++ head/sys/sys/sbuf.h Fri Sep 10 16:42:16 2010 (r212425) @@ -51,7 +51,6 @@ struct sbuf { #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ -#define SBUF_OVERFLOWED 0x00040000 /* sbuf overflowed */ #define SBUF_DYNSTRUCT 0x00080000 /* sbuf must be freed */ int s_flags; /* flags */ }; @@ -76,7 +75,7 @@ int sbuf_vprintf(struct sbuf *, const int sbuf_putc(struct sbuf *, int); void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *); int sbuf_trim(struct sbuf *); -int sbuf_overflowed(struct sbuf *); +int sbuf_error(struct sbuf *); int sbuf_finish(struct sbuf *); char *sbuf_data(struct sbuf *); int sbuf_len(struct sbuf *); From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 17:00:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02D411065675; Fri, 10 Sep 2010 17:00:49 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E76B18FC1C; Fri, 10 Sep 2010 17:00: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 o8AH0mdE068370; Fri, 10 Sep 2010 17:00:48 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AH0mHR068368; Fri, 10 Sep 2010 17:00:48 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009101700.o8AH0mHR068368@svn.freebsd.org> From: Rui Paulo Date: Fri, 10 Sep 2010 17:00:48 +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: r212426 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 17:00:49 -0000 Author: rpaulo Date: Fri Sep 10 17:00:48 2010 New Revision: 212426 URL: http://svn.freebsd.org/changeset/base/212426 Log: Fix typo in previous commit. Modified: head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Fri Sep 10 16:42:16 2010 (r212425) +++ head/share/mk/bsd.prog.mk Fri Sep 10 17:00:48 2010 (r212426) @@ -63,7 +63,7 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .if target(beforelinking) ${PROG}: ${OBJS} beforelinking .else -${PROG}: ${OBJS} beforelinking +${PROG}: ${OBJS} .endif .if defined(PROG_CXX) ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 17:26:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50039106566B; Fri, 10 Sep 2010 17:26:42 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D34A8FC0C; Fri, 10 Sep 2010 17:26: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 o8AHQgJ1070377; Fri, 10 Sep 2010 17:26:42 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AHQg8w070370; Fri, 10 Sep 2010 17:26:42 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009101726.o8AHQg8w070370@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 10 Sep 2010 17:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212427 - in stable/8: share/man/man9 sys/kern sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 17:26:42 -0000 Author: mdf Date: Fri Sep 10 17:26:41 2010 New Revision: 212427 URL: http://svn.freebsd.org/changeset/base/212427 Log: MFC r211194, r211229, r212058, r212063: memguard(9) rewrite r211194: Rework memguard(9) to reserve significantly more KVA to detect use-after-free over a longer time. Also release the backing pages of a guarded allocation at free(9) time to reduce the overhead of using memguard(9). Allow setting and varying the malloc type at run-time. Add knobs to allow: - randomly guarding memory - adding un-backed KVA guard pages to detect underflow and overflow - a lower limit on the size of allocations that are guarded r211229: Fix compile. It seemed better to have memguard.c include opt_vm.h in case future compile-time knobs were added that it wants to use. Also add include guards and forward declarations to vm/memguard.h. r212058: The realloc case for memguard(9) will copy too many bytes when reallocating to a smaller-sized allocation. Fix this issue. r212063: Have memguard(9) crash with an easier-to-debug message on double-free. Modified: stable/8/share/man/man9/memguard.9 stable/8/sys/kern/kern_malloc.c stable/8/sys/vm/memguard.c stable/8/sys/vm/memguard.h stable/8/sys/vm/vm_extern.h stable/8/sys/vm/vm_kern.c Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man9/memguard.9 ============================================================================== --- stable/8/share/man/man9/memguard.9 Fri Sep 10 17:00:48 2010 (r212426) +++ stable/8/share/man/man9/memguard.9 Fri Sep 10 17:26:41 2010 (r212427) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2006 +.Dd August 2, 2010 .Dt MEMGUARD 9 .Os .Sh NAME @@ -41,54 +41,107 @@ multithreaded kernels where race conditi .Pp Currently, .Nm -can only take over +can take over .Fn malloc , .Fn realloc and .Fn free -for a particular malloc type. +for a single malloc type. +.Nm +can also guard all allocations larger than +.Dv PAGE_SIZE , +and can guard a random fraction of all allocations. +There is also a knob to prevent allocations smaller than a specified +size from being guarded, to limit memory waste. .Sh EXAMPLES To use .Nm -for memory type compiled into the kernel, one has to add the -following line to the +for a memory type, either add an entry to .Pa /boot/loader.conf : .Bd -literal -offset indent vm.memguard.desc= .Ed .Pp -Where -.Ar memory_type -is a short description of memory type to monitor. -The short description of memory type is the second argument to -.Xr MALLOC_DEFINE 9 , -so one has to find it in the kernel source. -.Pp -To use -.Nm -for memory type defined in a kernel module, one has to set +Or set the .Va vm.memguard.desc .Xr sysctl 8 -variable before loading the module: +variable at run-time: .Bd -literal -offset indent sysctl vm.memguard.desc= .Ed .Pp +Where +.Ar memory_type +is a short description of the memory type to monitor. +Only allocations from that +.Ar memory_type +made after +.Va vm.memguard.desc +is set will potentially be guarded. +If +.Va vm.memguard.desc +is modified at run-time then only allocations of the new +.Ar memory_type +will potentially be guarded once the +.Xr sysctl 8 +is set. +Existing guarded allocations will still be properly released by +.Xr free 9 . +.Pp +The short description of a +.Xr malloc 9 +type is the second argument to +.Xr MALLOC_DEFINE 9 , +so one has to find it in the kernel source. +.Pp The .Va vm.memguard.divisor -boot-time tunable is used to scale how much of -.Va kmem_map -one wants to allocate for -.Nm . -The default is 10, so -.Va kmem_size Ns /10 -bytes will be used. -The -.Va kmem_size -value can be obtained via the -.Va vm.kmem_size -.Xr sysctl 8 -variable. +boot-time tunable is used to scale how much of the system's physical +memory +.Nm +is allowed to consume. +The default is 10, so up to +.Va cnt.v_page_count Ns /10 +pages can be used. +.Nm +will reserve +.Va vm_kmem_max +/ +.Va vm.memguard.divisor +bytes of virtual address space, limited by twice the physical memory +size. +The physical limit is reported as +.Va vm.memguard.phys_limit +and the virtual space reserved for +.Nm +is reported as +.Va vm.memguard.mapsize . +.Pp +.Nm +will not do page promotions for any allocation smaller than +.Va vm.memguard.minsize +bytes. +The default is 0, meaning all allocations can potentially be guarded. +.Nm +can guard sufficiently large allocations randomly, with average +frequency of every one in 100000 / +.Va vm.memguard.frequency +allocations. +The default is 0, meaning no allocations are randomly guarded. +.Pp +.Nm +can optionally add unmapped guard pages around each allocation to +detect overflow and underflow, if +.Va vm.memguard.options +has the 1 bit set. +This option is enabled by default. +.Nm +will optionally guard all allocations of +.Dv PAGE_SIZE +or larger if +.Va vm.memguard.options +has the 2 bit set. +This option is off by default. .Sh SEE ALSO .Xr sysctl 8 , .Xr vmstat 8 , @@ -102,10 +155,13 @@ first appeared in .Sh AUTHORS .An -nosplit .Nm -was written by +was originally written by .An Bosko Milekic Aq bmilekic@FreeBSD.org . -This manual page was written by +This manual page was originally written by .An Christian Brueffer Aq brueffer@FreeBSD.org . +Additions have been made by +.An Matthew Fleming Aq mdf@FreeBSD.org +to both the implementation and the documentation. .Sh BUGS Currently, it is not possible to override UMA .Xr zone 9 Modified: stable/8/sys/kern/kern_malloc.c ============================================================================== --- stable/8/sys/kern/kern_malloc.c Fri Sep 10 17:00:48 2010 (r212426) +++ stable/8/sys/kern/kern_malloc.c Fri Sep 10 17:26:41 2010 (r212427) @@ -365,8 +365,12 @@ malloc(unsigned long size, struct malloc ("malloc(M_WAITOK) in interrupt context")); #ifdef DEBUG_MEMGUARD - if (memguard_cmp(mtp)) - return memguard_alloc(size, flags); + if (memguard_cmp(mtp, size)) { + va = memguard_alloc(size, flags); + if (va != NULL) + return (va); + /* This is unfortunate but should not be fatal. */ + } #endif #ifdef DEBUG_REDZONE @@ -427,7 +431,7 @@ free(void *addr, struct malloc_type *mtp return; #ifdef DEBUG_MEMGUARD - if (memguard_cmp(mtp)) { + if (is_memguard_addr(addr)) { memguard_free(addr); return; } @@ -496,10 +500,8 @@ realloc(void *addr, unsigned long size, */ #ifdef DEBUG_MEMGUARD -if (memguard_cmp(mtp)) { - slab = NULL; - alloc = size; -} else { + if (is_memguard_addr(addr)) + return (memguard_realloc(addr, size, mtp, flags)); #endif #ifdef DEBUG_REDZONE @@ -524,10 +526,6 @@ if (memguard_cmp(mtp)) { return (addr); #endif /* !DEBUG_REDZONE */ -#ifdef DEBUG_MEMGUARD -} -#endif - /* Allocate a new, bigger (or smaller) block */ if ((newaddr = malloc(size, mtp, flags)) == NULL) return (NULL); @@ -559,7 +557,7 @@ static void kmeminit(void *dummy) { u_int8_t indx; - u_long mem_size; + u_long mem_size, tmp; int i; mtx_init(&malloc_mtx, "malloc", NULL, MTX_DEF); @@ -619,8 +617,13 @@ kmeminit(void *dummy) */ init_param3(vm_kmem_size / PAGE_SIZE); +#ifdef DEBUG_MEMGUARD + tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); +#else + tmp = vm_kmem_size; +#endif kmem_map = kmem_suballoc(kernel_map, &kmembase, &kmemlimit, - vm_kmem_size, TRUE); + tmp, TRUE); kmem_map->system_map = 1; #ifdef DEBUG_MEMGUARD @@ -629,14 +632,7 @@ kmeminit(void *dummy) * replacement allocator used for detecting tamper-after-free * scenarios as they occur. It is only used for debugging. */ - vm_memguard_divisor = 10; - TUNABLE_INT_FETCH("vm.memguard.divisor", &vm_memguard_divisor); - - /* Pick a conservative value if provided value sucks. */ - if ((vm_memguard_divisor <= 0) || - ((vm_kmem_size / vm_memguard_divisor) == 0)) - vm_memguard_divisor = 10; - memguard_init(kmem_map, vm_kmem_size / vm_memguard_divisor); + memguard_init(kmem_map); #endif uma_startup2(); Modified: stable/8/sys/vm/memguard.c ============================================================================== --- stable/8/sys/vm/memguard.c Fri Sep 10 17:00:48 2010 (r212426) +++ stable/8/sys/vm/memguard.c Fri Sep 10 17:26:41 2010 (r212427) @@ -1,6 +1,7 @@ /* - * Copyright (c) 2005, - * Bosko Milekic . All rights reserved. + * Copyright (c) 2005, Bosko Milekic . + * Copyright (c) 2010 Isilon Systems, Inc. (http://www.isilon.com/) + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,6 +37,8 @@ __FBSDID("$FreeBSD$"); * See the memguard(9) man page for more information on using MemGuard. */ +#include "opt_vm.h" + #include #include #include @@ -47,26 +50,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include #include #include -/* - * The maximum number of pages allowed per allocation. If you're using - * MemGuard to override very large items (> MAX_PAGES_PER_ITEM in size), - * you need to increase MAX_PAGES_PER_ITEM. - */ -#define MAX_PAGES_PER_ITEM 64 - SYSCTL_NODE(_vm, OID_AUTO, memguard, CTLFLAG_RW, NULL, "MemGuard data"); /* * The vm_memguard_divisor variable controls how much of kmem_map should be * reserved for MemGuard. */ -u_int vm_memguard_divisor; -SYSCTL_UINT(_vm_memguard, OID_AUTO, divisor, CTLFLAG_RD, &vm_memguard_divisor, +static u_int vm_memguard_divisor; +SYSCTL_UINT(_vm_memguard, OID_AUTO, divisor, CTLFLAG_RDTUN, + &vm_memguard_divisor, 0, "(kmem_size/memguard_divisor) == memguard submap size"); /* @@ -78,233 +77,372 @@ TUNABLE_STR("vm.memguard.desc", vm_memgu static int memguard_sysctl_desc(SYSCTL_HANDLER_ARGS) { - struct malloc_type_internal *mtip; - struct malloc_type_stats *mtsp; - struct malloc_type *mtp; - char desc[128]; - long bytes; - int error, i; + char desc[sizeof(vm_memguard_desc)]; + int error; strlcpy(desc, vm_memguard_desc, sizeof(desc)); error = sysctl_handle_string(oidp, desc, sizeof(desc), req); if (error != 0 || req->newptr == NULL) return (error); + mtx_lock(&malloc_mtx); /* - * We can change memory type when no memory has been allocated for it - * or when there is no such memory type yet (ie. it will be loaded with - * kernel module). + * If mtp is NULL, it will be initialized in memguard_cmp(). */ - bytes = 0; - mtx_lock(&malloc_mtx); - mtp = malloc_desc2type(desc); - if (mtp != NULL) { - mtip = mtp->ks_handle; - for (i = 0; i < MAXCPU; i++) { - mtsp = &mtip->mti_stats[i]; - bytes += mtsp->mts_memalloced; - bytes -= mtsp->mts_memfreed; - } - } - if (bytes > 0) - error = EBUSY; - else { - /* - * If mtp is NULL, it will be initialized in memguard_cmp(). - */ - vm_memguard_mtype = mtp; - strlcpy(vm_memguard_desc, desc, sizeof(vm_memguard_desc)); - } + vm_memguard_mtype = malloc_desc2type(desc); + strlcpy(vm_memguard_desc, desc, sizeof(vm_memguard_desc)); mtx_unlock(&malloc_mtx); return (error); } -SYSCTL_PROC(_vm_memguard, OID_AUTO, desc, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, +SYSCTL_PROC(_vm_memguard, OID_AUTO, desc, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, memguard_sysctl_desc, "A", "Short description of memory type to monitor"); +static vm_map_t memguard_map = NULL; +static vm_offset_t memguard_cursor; +static vm_size_t memguard_mapsize; +static vm_size_t memguard_physlimit; +static u_long memguard_wasted; +static u_long memguard_wrap; +static u_long memguard_succ; +static u_long memguard_fail_kva; +static u_long memguard_fail_pgs; + +SYSCTL_ULONG(_vm_memguard, OID_AUTO, cursor, CTLFLAG_RD, + &memguard_cursor, 0, "MemGuard cursor"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, mapsize, CTLFLAG_RD, + &memguard_mapsize, 0, "MemGuard private vm_map size"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, phys_limit, CTLFLAG_RD, + &memguard_physlimit, 0, "Limit on MemGuard memory consumption"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, wasted, CTLFLAG_RD, + &memguard_wasted, 0, "Excess memory used through page promotion"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, wrapcnt, CTLFLAG_RD, + &memguard_wrap, 0, "MemGuard cursor wrap count"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, numalloc, CTLFLAG_RD, + &memguard_succ, 0, "Count of successful MemGuard allocations"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, fail_kva, CTLFLAG_RD, + &memguard_fail_kva, 0, "MemGuard failures due to lack of KVA"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, fail_pgs, CTLFLAG_RD, + &memguard_fail_pgs, 0, "MemGuard failures due to lack of pages"); + +#define MG_GUARD 0x001 +#define MG_ALLLARGE 0x002 +static int memguard_options = MG_GUARD; +TUNABLE_INT("vm.memguard.options", &memguard_options); +SYSCTL_INT(_vm_memguard, OID_AUTO, options, CTLFLAG_RW, + &memguard_options, 0, + "MemGuard options:\n" + "\t0x001 - add guard pages around each allocation\n" + "\t0x002 - always use MemGuard for allocations over a page"); + +static u_int memguard_minsize; +static u_long memguard_minsize_reject; +SYSCTL_UINT(_vm_memguard, OID_AUTO, minsize, CTLFLAG_RW, + &memguard_minsize, 0, "Minimum size for page promotion"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, minsize_reject, CTLFLAG_RD, + &memguard_minsize_reject, 0, "# times rejected for size"); + +static u_int memguard_frequency; +static u_long memguard_frequency_hits; +TUNABLE_INT("vm.memguard.frequency", &memguard_frequency); +SYSCTL_UINT(_vm_memguard, OID_AUTO, frequency, CTLFLAG_RW, + &memguard_frequency, 0, "Times in 100000 that MemGuard will randomly run"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, frequency_hits, CTLFLAG_RD, + &memguard_frequency_hits, 0, "# times MemGuard randomly chose"); + + /* - * Global MemGuard data. + * Return a fudged value to be used for vm_kmem_size for allocating + * the kmem_map. The memguard memory will be a submap. */ -static vm_map_t memguard_map; -static unsigned long memguard_mapsize; -static unsigned long memguard_mapused; -struct memguard_entry { - STAILQ_ENTRY(memguard_entry) entries; - void *ptr; -}; -static struct memguard_fifo { - struct memguard_entry *stqh_first; - struct memguard_entry **stqh_last; - int index; -} memguard_fifo_pool[MAX_PAGES_PER_ITEM]; - -/* - * Local prototypes. - */ -static void memguard_guard(void *addr, int numpgs); -static void memguard_unguard(void *addr, int numpgs); -static struct memguard_fifo *vtomgfifo(vm_offset_t va); -static void vsetmgfifo(vm_offset_t va, struct memguard_fifo *mgfifo); -static void vclrmgfifo(vm_offset_t va); - -/* - * Local macros. MemGuard data is global, so replace these with whatever - * your system uses to protect global data (if it is kernel-level - * parallelized). This is for porting among BSDs. - */ -#define MEMGUARD_CRIT_SECTION_DECLARE static struct mtx memguard_mtx -#define MEMGUARD_CRIT_SECTION_INIT \ - mtx_init(&memguard_mtx, "MemGuard mtx", NULL, MTX_DEF) -#define MEMGUARD_CRIT_SECTION_ENTER mtx_lock(&memguard_mtx) -#define MEMGUARD_CRIT_SECTION_EXIT mtx_unlock(&memguard_mtx) -MEMGUARD_CRIT_SECTION_DECLARE; +unsigned long +memguard_fudge(unsigned long km_size, unsigned long km_max) +{ + u_long mem_pgs = cnt.v_page_count; + + vm_memguard_divisor = 10; + TUNABLE_INT_FETCH("vm.memguard.divisor", &vm_memguard_divisor); + + /* Pick a conservative value if provided value sucks. */ + if ((vm_memguard_divisor <= 0) || + ((km_size / vm_memguard_divisor) == 0)) + vm_memguard_divisor = 10; + /* + * Limit consumption of physical pages to + * 1/vm_memguard_divisor of system memory. If the KVA is + * smaller than this then the KVA limit comes into play first. + * This prevents memguard's page promotions from completely + * using up memory, since most malloc(9) calls are sub-page. + */ + memguard_physlimit = (mem_pgs / vm_memguard_divisor) * PAGE_SIZE; + /* + * We want as much KVA as we can take safely. Use at most our + * allotted fraction of kmem_max. Limit this to twice the + * physical memory to avoid using too much memory as pagetable + * pages. + */ + memguard_mapsize = km_max / vm_memguard_divisor; + /* size must be multiple of PAGE_SIZE */ + memguard_mapsize = round_page(memguard_mapsize); + if (memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs) + memguard_mapsize = mem_pgs * 2 * PAGE_SIZE; + if (km_size + memguard_mapsize > km_max) + return (km_max); + return (km_size + memguard_mapsize); +} /* * Initialize the MemGuard mock allocator. All objects from MemGuard come * out of a single VM map (contiguous chunk of address space). */ void -memguard_init(vm_map_t parent_map, unsigned long size) +memguard_init(vm_map_t parent_map) { - char *base, *limit; - int i; - - /* size must be multiple of PAGE_SIZE */ - size /= PAGE_SIZE; - size++; - size *= PAGE_SIZE; + vm_offset_t base, limit; - memguard_map = kmem_suballoc(parent_map, (vm_offset_t *)&base, - (vm_offset_t *)&limit, (vm_size_t)size, FALSE); + memguard_map = kmem_suballoc(parent_map, &base, &limit, + memguard_mapsize, FALSE); memguard_map->system_map = 1; - memguard_mapsize = size; - memguard_mapused = 0; - - MEMGUARD_CRIT_SECTION_INIT; - MEMGUARD_CRIT_SECTION_ENTER; - for (i = 0; i < MAX_PAGES_PER_ITEM; i++) { - STAILQ_INIT(&memguard_fifo_pool[i]); - memguard_fifo_pool[i].index = i; - } - MEMGUARD_CRIT_SECTION_EXIT; + KASSERT(memguard_mapsize == limit - base, + ("Expected %lu, got %lu", (u_long)memguard_mapsize, + (u_long)(limit - base))); + memguard_cursor = base; printf("MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:\n"); - printf("\tMEMGUARD map base: %p\n", base); - printf("\tMEMGUARD map limit: %p\n", limit); - printf("\tMEMGUARD map size: %ld (Bytes)\n", size); + printf("\tMEMGUARD map base: 0x%lx\n", (u_long)base); + printf("\tMEMGUARD map limit: 0x%lx\n", (u_long)limit); + printf("\tMEMGUARD map size: %jd KBytes\n", + (uintmax_t)memguard_mapsize >> 10); } /* - * Allocate a single object of specified size with specified flags (either - * M_WAITOK or M_NOWAIT). + * Run things that can't be done as early as memguard_init(). + */ +static void +memguard_sysinit(void) +{ + struct sysctl_oid_list *parent; + + parent = SYSCTL_STATIC_CHILDREN(_vm_memguard); + + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapstart", CTLFLAG_RD, + &memguard_map->min_offset, "MemGuard KVA base"); + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "maplimit", CTLFLAG_RD, + &memguard_map->max_offset, "MemGuard KVA end"); + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapused", CTLFLAG_RD, + &memguard_map->size, "MemGuard KVA used"); +} +SYSINIT(memguard, SI_SUB_KLD, SI_ORDER_ANY, memguard_sysinit, NULL); + +/* + * v2sizep() converts a virtual address of the first page allocated for + * an item to a pointer to u_long recording the size of the original + * allocation request. + * + * This routine is very similar to those defined by UMA in uma_int.h. + * The difference is that this routine stores the originally allocated + * size in one of the page's fields that is unused when the page is + * wired rather than the object field, which is used. + */ +static u_long * +v2sizep(vm_offset_t va) +{ + vm_paddr_t pa; + struct vm_page *p; + + pa = pmap_kextract(va); + if (pa == 0) + panic("MemGuard detected double-free of %p", (void *)va); + p = PHYS_TO_VM_PAGE(pa); + KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, + ("MEMGUARD: Expected wired page %p in vtomgfifo!", p)); + return ((u_long *)&p->pageq.tqe_next); +} + +/* + * Allocate a single object of specified size with specified flags + * (either M_WAITOK or M_NOWAIT). */ void * -memguard_alloc(unsigned long size, int flags) +memguard_alloc(unsigned long req_size, int flags) { - void *obj; - struct memguard_entry *e = NULL; - int numpgs; - - numpgs = size / PAGE_SIZE; - if ((size % PAGE_SIZE) != 0) - numpgs++; - if (numpgs > MAX_PAGES_PER_ITEM) - panic("MEMGUARD: You must increase MAX_PAGES_PER_ITEM " \ - "in memguard.c (requested: %d pages)", numpgs); - if (numpgs == 0) - return NULL; - - /* - * If we haven't exhausted the memguard_map yet, allocate from - * it and grab a new page, even if we have recycled pages in our - * FIFO. This is because we wish to allow recycled pages to live - * guarded in the FIFO for as long as possible in order to catch - * even very late tamper-after-frees, even though it means that - * we end up wasting more memory, this is only a DEBUGGING allocator - * after all. - */ - MEMGUARD_CRIT_SECTION_ENTER; - if (memguard_mapused >= memguard_mapsize) { - e = STAILQ_FIRST(&memguard_fifo_pool[numpgs - 1]); - if (e != NULL) { - STAILQ_REMOVE(&memguard_fifo_pool[numpgs - 1], e, - memguard_entry, entries); - MEMGUARD_CRIT_SECTION_EXIT; - obj = e->ptr; - free(e, M_TEMP); - memguard_unguard(obj, numpgs); - if (flags & M_ZERO) - bzero(obj, PAGE_SIZE * numpgs); - return obj; + vm_offset_t addr; + u_long size_p, size_v; + int do_guard, rv; + + size_p = round_page(req_size); + if (size_p == 0) + return (NULL); + /* + * To ensure there are holes on both sides of the allocation, + * request 2 extra pages of KVA. We will only actually add a + * vm_map_entry and get pages for the original request. Save + * the value of memguard_options so we have a consistent + * value. + */ + size_v = size_p; + do_guard = (memguard_options & MG_GUARD) != 0; + if (do_guard) + size_v += 2 * PAGE_SIZE; + + vm_map_lock(memguard_map); + /* + * When we pass our memory limit, reject sub-page allocations. + * Page-size and larger allocations will use the same amount + * of physical memory whether we allocate or hand off to + * uma_large_alloc(), so keep those. + */ + if (memguard_map->size >= memguard_physlimit && + req_size < PAGE_SIZE) { + addr = (vm_offset_t)NULL; + memguard_fail_pgs++; + goto out; + } + /* + * Keep a moving cursor so we don't recycle KVA as long as + * possible. It's not perfect, since we don't know in what + * order previous allocations will be free'd, but it's simple + * and fast, and requires O(1) additional storage if guard + * pages are not used. + * + * XXX This scheme will lead to greater fragmentation of the + * map, unless vm_map_findspace() is tweaked. + */ + for (;;) { + rv = vm_map_findspace(memguard_map, memguard_cursor, + size_v, &addr); + if (rv == KERN_SUCCESS) + break; + /* + * The map has no space. This may be due to + * fragmentation, or because the cursor is near the + * end of the map. + */ + if (memguard_cursor == vm_map_min(memguard_map)) { + memguard_fail_kva++; + addr = (vm_offset_t)NULL; + goto out; } - MEMGUARD_CRIT_SECTION_EXIT; - if (flags & M_WAITOK) - panic("MEMGUARD: Failed with M_WAITOK: " \ - "memguard_map too small"); - return NULL; + memguard_wrap++; + memguard_cursor = vm_map_min(memguard_map); } - memguard_mapused += (PAGE_SIZE * numpgs); - MEMGUARD_CRIT_SECTION_EXIT; - - obj = (void *)kmem_malloc(memguard_map, PAGE_SIZE * numpgs, flags); - if (obj != NULL) { - vsetmgfifo((vm_offset_t)obj, &memguard_fifo_pool[numpgs - 1]); - if (flags & M_ZERO) - bzero(obj, PAGE_SIZE * numpgs); - } else { - MEMGUARD_CRIT_SECTION_ENTER; - memguard_mapused -= (PAGE_SIZE * numpgs); - MEMGUARD_CRIT_SECTION_EXIT; + if (do_guard) + addr += PAGE_SIZE; + rv = kmem_back(memguard_map, addr, size_p, flags); + if (rv != KERN_SUCCESS) { + memguard_fail_pgs++; + addr = (vm_offset_t)NULL; + goto out; } - return obj; + memguard_cursor = addr + size_p; + *v2sizep(trunc_page(addr)) = req_size; + memguard_succ++; + if (req_size < PAGE_SIZE) { + memguard_wasted += (PAGE_SIZE - req_size); + if (do_guard) { + /* + * Align the request to 16 bytes, and return + * an address near the end of the page, to + * better detect array overrun. + */ + req_size = roundup2(req_size, 16); + addr += (PAGE_SIZE - req_size); + } + } +out: + vm_map_unlock(memguard_map); + return ((void *)addr); +} + +int +is_memguard_addr(void *addr) +{ + vm_offset_t a = (vm_offset_t)(uintptr_t)addr; + + return (a >= memguard_map->min_offset && a < memguard_map->max_offset); } /* * Free specified single object. */ void -memguard_free(void *addr) +memguard_free(void *ptr) { - struct memguard_entry *e; - struct memguard_fifo *mgfifo; - int idx; - int *temp; - - addr = (void *)trunc_page((unsigned long)addr); - - /* - * Page should not be guarded by now, so force a write. - * The purpose of this is to increase the likelihood of catching a - * double-free, but not necessarily a tamper-after-free (the second - * thread freeing might not write before freeing, so this forces it - * to and, subsequently, trigger a fault). - */ - temp = (int *)((unsigned long)addr + (PAGE_SIZE/2)); /* in page */ - *temp = 0xd34dc0d3; - - mgfifo = vtomgfifo((vm_offset_t)addr); - idx = mgfifo->index; - memguard_guard(addr, idx + 1); - e = malloc(sizeof(struct memguard_entry), M_TEMP, M_NOWAIT); - if (e == NULL) { - MEMGUARD_CRIT_SECTION_ENTER; - memguard_mapused -= (PAGE_SIZE * (idx + 1)); - MEMGUARD_CRIT_SECTION_EXIT; - memguard_unguard(addr, idx + 1); /* just in case */ - vclrmgfifo((vm_offset_t)addr); - kmem_free(memguard_map, (vm_offset_t)addr, - PAGE_SIZE * (idx + 1)); - return; - } - e->ptr = addr; - MEMGUARD_CRIT_SECTION_ENTER; - STAILQ_INSERT_TAIL(mgfifo, e, entries); - MEMGUARD_CRIT_SECTION_EXIT; + vm_offset_t addr; + u_long req_size, size; + char *temp; + int i; + + addr = trunc_page((uintptr_t)ptr); + req_size = *v2sizep(addr); + size = round_page(req_size); + + /* + * Page should not be guarded right now, so force a write. + * The purpose of this is to increase the likelihood of + * catching a double-free, but not necessarily a + * tamper-after-free (the second thread freeing might not + * write before freeing, so this forces it to and, + * subsequently, trigger a fault). + */ + temp = ptr; + for (i = 0; i < size; i += PAGE_SIZE) + temp[i] = 'M'; + + /* + * This requires carnal knowledge of the implementation of + * kmem_free(), but since we've already replaced kmem_malloc() + * above, it's not really any worse. We want to use the + * vm_map lock to serialize updates to memguard_wasted, since + * we had the lock at increment. + */ + vm_map_lock(memguard_map); + if (req_size < PAGE_SIZE) + memguard_wasted -= (PAGE_SIZE - req_size); + (void)vm_map_delete(memguard_map, addr, addr + size); + vm_map_unlock(memguard_map); +} + +/* + * Re-allocate an allocation that was originally guarded. + */ +void * +memguard_realloc(void *addr, unsigned long size, struct malloc_type *mtp, + int flags) +{ + void *newaddr; + u_long old_size; + + /* + * Allocate the new block. Force the allocation to be guarded + * as the original may have been guarded through random + * chance, and that should be preserved. + */ + if ((newaddr = memguard_alloc(size, flags)) == NULL) + return (NULL); + + /* Copy over original contents. */ + old_size = *v2sizep(trunc_page((uintptr_t)addr)); + bcopy(addr, newaddr, min(size, old_size)); + memguard_free(addr); + return (newaddr); } int -memguard_cmp(struct malloc_type *mtp) +memguard_cmp(struct malloc_type *mtp, unsigned long size) { + if (size < memguard_minsize) { + memguard_minsize_reject++; + return (0); + } + if ((memguard_options & MG_ALLLARGE) != 0 && size >= PAGE_SIZE) + return (1); + if (memguard_frequency > 0 && + (random() % 100000) < memguard_frequency) { + memguard_frequency_hits++; + return (1); + } #if 1 /* * The safest way of comparsion is to always compare short description @@ -328,78 +466,3 @@ memguard_cmp(struct malloc_type *mtp) return (0); #endif } - -/* - * Guard a page containing specified object (make it read-only so that - * future writes to it fail). - */ -static void -memguard_guard(void *addr, int numpgs) -{ - void *a = (void *)trunc_page((unsigned long)addr); - if (vm_map_protect(memguard_map, (vm_offset_t)a, - (vm_offset_t)((unsigned long)a + (PAGE_SIZE * numpgs)), - VM_PROT_READ, FALSE) != KERN_SUCCESS) - panic("MEMGUARD: Unable to guard page!"); -} - -/* - * Unguard a page containing specified object (make it read-and-write to - * allow full data access). - */ -static void -memguard_unguard(void *addr, int numpgs) -{ - void *a = (void *)trunc_page((unsigned long)addr); - if (vm_map_protect(memguard_map, (vm_offset_t)a, - (vm_offset_t)((unsigned long)a + (PAGE_SIZE * numpgs)), - VM_PROT_DEFAULT, FALSE) != KERN_SUCCESS) - panic("MEMGUARD: Unable to unguard page!"); -} - -/* - * vtomgfifo() converts a virtual address of the first page allocated for - * an item to a memguard_fifo_pool reference for the corresponding item's - * size. - * - * vsetmgfifo() sets a reference in an underlying page for the specified - * virtual address to an appropriate memguard_fifo_pool. - * - * These routines are very similar to those defined by UMA in uma_int.h. - * The difference is that these routines store the mgfifo in one of the - * page's fields that is unused when the page is wired rather than the - * object field, which is used. - */ -static struct memguard_fifo * -vtomgfifo(vm_offset_t va) -{ - vm_page_t p; - struct memguard_fifo *mgfifo; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vtomgfifo!")); - mgfifo = (struct memguard_fifo *)p->pageq.tqe_next; - return mgfifo; -} - -static void -vsetmgfifo(vm_offset_t va, struct memguard_fifo *mgfifo) -{ - vm_page_t p; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vsetmgfifo!")); - p->pageq.tqe_next = (vm_page_t)mgfifo; -} - -static void vclrmgfifo(vm_offset_t va) -{ - vm_page_t p; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vclrmgfifo!")); - p->pageq.tqe_next = NULL; -} Modified: stable/8/sys/vm/memguard.h ============================================================================== --- stable/8/sys/vm/memguard.h Fri Sep 10 17:00:48 2010 (r212426) +++ stable/8/sys/vm/memguard.h Fri Sep 10 17:26:41 2010 (r212427) @@ -26,9 +26,30 @@ * $FreeBSD$ */ -extern u_int vm_memguard_divisor; +#ifndef _VM_MEMGUARD_H_ +#define _VM_MEMGUARD_H_ -void memguard_init(vm_map_t parent_map, unsigned long size); -void *memguard_alloc(unsigned long size, int flags); -void memguard_free(void *addr); -int memguard_cmp(struct malloc_type *mtp); +#include "opt_vm.h" + +struct malloc_type; +struct vm_map; + +#ifdef DEBUG_MEMGUARD +unsigned long memguard_fudge(unsigned long, unsigned long); +void memguard_init(struct vm_map *); +void *memguard_alloc(unsigned long, int); +void *memguard_realloc(void *, unsigned long, struct malloc_type *, int); +void memguard_free(void *); +int memguard_cmp(struct malloc_type *, unsigned long); +int is_memguard_addr(void *); +#else +#define memguard_fudge(size, xxx) (size) +#define memguard_init(map) do { } while (0) +#define memguard_alloc(size, flags) NULL +#define memguard_realloc(a, s, mtp, f) NULL +#define memguard_free(addr) do { } while (0) +#define memguard_cmp(mtp, size) 0 +#define is_memguard_addr(addr) 0 +#endif + +#endif /* _VM_MEMGUARD_H_ */ Modified: stable/8/sys/vm/vm_extern.h ============================================================================== --- stable/8/sys/vm/vm_extern.h Fri Sep 10 17:00:48 2010 (r212426) +++ stable/8/sys/vm/vm_extern.h Fri Sep 10 17:26:41 2010 (r212427) @@ -52,6 +52,7 @@ void kmem_free(vm_map_t, vm_offset_t, vm void kmem_free_wakeup(vm_map_t, vm_offset_t, vm_size_t); void kmem_init(vm_offset_t, vm_offset_t); vm_offset_t kmem_malloc(vm_map_t map, vm_size_t size, int flags); +int kmem_back(vm_map_t, vm_offset_t, vm_size_t, int); vm_map_t kmem_suballoc(vm_map_t, vm_offset_t *, vm_offset_t *, vm_size_t, boolean_t); void swapout_procs(int); Modified: stable/8/sys/vm/vm_kern.c ============================================================================== --- stable/8/sys/vm/vm_kern.c Fri Sep 10 17:00:48 2010 (r212426) +++ stable/8/sys/vm/vm_kern.c Fri Sep 10 17:26:41 2010 (r212427) @@ -272,11 +272,8 @@ kmem_malloc(map, size, flags) vm_size_t size; int flags; { - vm_offset_t offset, i; - vm_map_entry_t entry; vm_offset_t addr; - vm_page_t m; - int pflags; + int i, rv; size = round_page(size); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 17:44:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CE7F1065674; Fri, 10 Sep 2010 17:44:12 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C4BE8FC24; Fri, 10 Sep 2010 17:44: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 o8AHiCwv071744; Fri, 10 Sep 2010 17:44:12 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AHiCGD071742; Fri, 10 Sep 2010 17:44:12 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009101744.o8AHiCGD071742@svn.freebsd.org> From: Rui Paulo Date: Fri, 10 Sep 2010 17:44: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: r212428 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 17:44:12 -0000 Author: rpaulo Date: Fri Sep 10 17:44:11 2010 New Revision: 212428 URL: http://svn.freebsd.org/changeset/base/212428 Log: Fix bugs introduced in the previous rev: * add a phatom target for the DTRACEOBJS * when invoking DTrace, don't add DTRACEOBJS to the command line. Sponsored by: The FreeBSD Foundation Modified: head/share/mk/bsd.dtrace.mk Modified: head/share/mk/bsd.dtrace.mk ============================================================================== --- head/share/mk/bsd.dtrace.mk Fri Sep 10 17:26:41 2010 (r212427) +++ head/share/mk/bsd.dtrace.mk Fri Sep 10 17:44:11 2010 (r212428) @@ -37,19 +37,23 @@ CFLAGS+=-DWITH_DTRACE DTRACEHEADERS=${DTRACEOBJS:S/o$/h/} DTRACESRCS=${DTRACEOBJS:S/o$/d/} CLEANFILES+=${DTRACEOBJS} ${DTRACEHEADERS} + +DPADD+=${LIBELF} +LDADD+=-lelf + .if defined(PROG) -_DTRACELINKING:=${OBJS} +_DTRACELINKING=${OBJS} OBJS+=${DTRACEOBJS} .else -_DTRACELINKING:=${SOBJS} +_DTRACELINKING=${SOBJS} SOBJS+=${DTRACEOBJS} .endif -DPADD+=${LIBELF} -LDADD+=-lelf + +${DTRACEOBJS}: beforedepend: ${DTRACE} -C -h -s ${DTRACESRCS} beforelinking: - ${DTRACE} -G -s ${DTRACESRCS} ${_DTRACELINKING} + ${DTRACE} -G -s ${DTRACESRCS} ${_DTRACELINKING:S/${DTRACEOBJS}//} .endif From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 18:19:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 202A71065674; Fri, 10 Sep 2010 18:19:39 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E04D8FC08; Fri, 10 Sep 2010 18:19: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 o8AIJcXg074721; Fri, 10 Sep 2010 18:19:38 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AIJcHE074719; Fri, 10 Sep 2010 18:19:38 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201009101819.o8AIJcHE074719@svn.freebsd.org> From: "David E. O'Brien" Date: Fri, 10 Sep 2010 18:19: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: r212429 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 18:19:39 -0000 Author: obrien Date: Fri Sep 10 18:19:38 2010 New Revision: 212429 URL: http://svn.freebsd.org/changeset/base/212429 Log: Add real dependancies on the uuencoded firmwares. Now when one does 'make kernel ; make kernel' the second invocation only does: `kernel.ko' is up to date. rather than reproduce all the .fw files and relink the kernel. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Sep 10 17:44:11 2010 (r212428) +++ head/sys/conf/files Fri Sep 10 18:19:38 2010 (r212429) @@ -1064,7 +1064,7 @@ ipw_bss.fwo optional ipwbssfw | ipwfw no-implicit-rule \ clean "ipw_bss.fwo" ipw_bss.fw optional ipwbssfw | ipwfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/ipw/ipw2100-1.3.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/ipw/ipw2100-1.3.fw.uu" \ no-obj no-implicit-rule \ clean "ipw_bss.fw" @@ -1078,7 +1078,7 @@ ipw_ibss.fwo optional ipwibssfw | ipwf no-implicit-rule \ clean "ipw_ibss.fwo" ipw_ibss.fw optional ipwibssfw | ipwfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/ipw/ipw2100-1.3-i.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/ipw/ipw2100-1.3-i.fw.uu" \ no-obj no-implicit-rule \ clean "ipw_ibss.fw" @@ -1092,7 +1092,7 @@ ipw_monitor.fwo optional ipwmonitorfw no-implicit-rule \ clean "ipw_monitor.fwo" ipw_monitor.fw optional ipwmonitorfw | ipwfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/ipw/ipw2100-1.3-p.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/ipw/ipw2100-1.3-p.fw.uu" \ no-obj no-implicit-rule \ clean "ipw_monitor.fw" @@ -1120,7 +1120,7 @@ iwi_bss.fwo optional iwibssfw | iwifw no-implicit-rule \ clean "iwi_bss.fwo" iwi_bss.fw optional iwibssfw | iwifw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwi/ipw2200-bss.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwi/ipw2200-bss.fw.uu" \ no-obj no-implicit-rule \ clean "iwi_bss.fw" @@ -1134,7 +1134,7 @@ iwi_ibss.fwo optional iwiibssfw | iwif no-implicit-rule \ clean "iwi_ibss.fwo" iwi_ibss.fw optional iwiibssfw | iwifw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwi/ipw2200-ibss.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwi/ipw2200-ibss.fw.uu" \ no-obj no-implicit-rule \ clean "iwi_ibss.fw" @@ -1148,7 +1148,7 @@ iwi_monitor.fwo optional iwimonitorfw no-implicit-rule \ clean "iwi_monitor.fwo" iwi_monitor.fw optional iwimonitorfw | iwifw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwi/ipw2200-sniffer.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwi/ipw2200-sniffer.fw.uu" \ no-obj no-implicit-rule \ clean "iwi_monitor.fw" @@ -1163,7 +1163,7 @@ iwn1000fw.fwo optional iwn1000fw | iwn no-implicit-rule \ clean "iwn1000fw.fwo" iwn1000.fw optional iwn1000fw | iwnfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwn/iwlwifi-1000-128.50.3.1.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-1000-128.50.3.1.fw.uu" \ no-obj no-implicit-rule \ clean "iwn1000.fw" @@ -1177,7 +1177,7 @@ iwn4965fw.fwo optional iwn4965fw | iwn no-implicit-rule \ clean "iwn4965fw.fwo" iwn4965.fw optional iwn4965fw | iwnfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwn/iwlwifi-4965-228.61.2.24.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-4965-228.61.2.24.fw.uu" \ no-obj no-implicit-rule \ clean "iwn4965.fw" @@ -1191,7 +1191,7 @@ iwn5000fw.fwo optional iwn5000fw | iwnf no-implicit-rule \ clean "iwn5000fw.fwo" iwn5000.fw optional iwn5000fw | iwnfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwn/iwlwifi-5000-8.24.2.12.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-5000-8.24.2.12.fw.uu" \ no-obj no-implicit-rule \ clean "iwn5000.fw" @@ -1205,7 +1205,7 @@ iwn5150fw.fwo optional iwn5150fw | iwn no-implicit-rule \ clean "iwn5150fw.fwo" iwn5150.fw optional iwn5150fw | iwnfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwn/iwlwifi-5150-8.24.2.2.fw.uu"\ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-5150-8.24.2.2.fw.uu" \ no-obj no-implicit-rule \ clean "iwn5150.fw" @@ -1219,7 +1219,7 @@ iwn6000fw.fwo optional iwn6000fw | iwn no-implicit-rule \ clean "iwn6000fw.fwo" iwn6000.fw optional iwn6000fw | iwnfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwn/iwlwifi-6000-9.221.4.1.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-6000-9.221.4.1.fw.uu" \ no-obj no-implicit-rule \ clean "iwn6000.fw" @@ -1233,7 +1233,7 @@ iwn6050fw.fwo optional iwn6050fw | iwn no-implicit-rule \ clean "iwn6050fw.fwo" iwn6050.fw optional iwn6050fw | iwnfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/iwn/iwlwifi-6050-9.201.4.1.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-6050-9.201.4.1.fw.uu" \ no-obj no-implicit-rule \ clean "iwn6000.fw" @@ -1356,7 +1356,7 @@ mw88W8363.fwo optional mwlfw \ no-implicit-rule \ clean "mw88W8363.fwo" mw88W8363.fw optional mwlfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/mwl/mw88W8363.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/mwl/mw88W8363.fw.uu" \ no-obj no-implicit-rule \ clean "mw88W8363.fw" @@ -1366,7 +1366,7 @@ mwlboot.fwo optional mwlfw \ no-implicit-rule \ clean "mwlboot.fwo" mwlboot.fw optional mwlfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/mwl/mwlboot.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/mwl/mwlboot.fw.uu" \ no-obj no-implicit-rule \ clean "mwlboot.fw" @@ -1471,7 +1471,7 @@ rt2561fw.fwo optional rt2561fw | ralfw no-implicit-rule \ clean "rt2561fw.fwo" rt2561.fw optional rt2561fw | ralfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/ral/rt2561.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/ral/rt2561.fw.uu" \ no-obj no-implicit-rule \ clean "rt2561.fw" @@ -1485,7 +1485,7 @@ rt2561sfw.fwo optional rt2561sfw | ral no-implicit-rule \ clean "rt2561sfw.fwo" rt2561s.fw optional rt2561sfw | ralfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/ral/rt2561s.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/ral/rt2561s.fw.uu" \ no-obj no-implicit-rule \ clean "rt2561s.fw" @@ -1499,7 +1499,7 @@ rt2661fw.fwo optional rt2661fw | ralfw no-implicit-rule \ clean "rt2661fw.fwo" rt2661.fw optional rt2661fw | ralfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/ral/rt2661.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/ral/rt2661.fw.uu" \ no-obj no-implicit-rule \ clean "rt2661.fw" @@ -1513,7 +1513,7 @@ rt2860fw.fwo optional rt2860fw | ralfw no-implicit-rule \ clean "rt2860fw.fwo" rt2860.fw optional rt2860fw | ralfw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/ral/rt2860.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/ral/rt2860.fw.uu" \ no-obj no-implicit-rule \ clean "rt2860.fw" @@ -1873,7 +1873,7 @@ wpifw.fwo optional wpifw \ no-implicit-rule \ clean "wpifw.fwo" wpi.fw optional wpifw \ - dependency ".PHONY" \ + dependency "$S/contrib/dev/wpi/iwlwifi-3945-2.14.4.fw.uu" \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/wpi/iwlwifi-3945-2.14.4.fw.uu" \ no-obj no-implicit-rule \ clean "wpi.fw" From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 19:20:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 941281065674; Fri, 10 Sep 2010 19:20:52 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 822798FC1D; Fri, 10 Sep 2010 19:20: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 o8AJKqFa079685; Fri, 10 Sep 2010 19:20:52 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AJKqsG079683; Fri, 10 Sep 2010 19:20:52 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009101920.o8AJKqsG079683@svn.freebsd.org> From: Colin Percival Date: Fri, 10 Sep 2010 19:20: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: r212431 - head/usr.sbin/freebsd-update X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 19:20:52 -0000 Author: cperciva Date: Fri Sep 10 19:20:52 2010 New Revision: 212431 URL: http://svn.freebsd.org/changeset/base/212431 Log: Remind the user that he needs to run 'freebsd-update install' to install new bits after downloading them using 'freebsd-update upgrade'. Submitted by: bapt MFC after: 1 month Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Fri Sep 10 18:48:26 2010 (r212430) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Fri Sep 10 19:20:52 2010 (r212431) @@ -2528,6 +2528,10 @@ upgrade_run () { # Leave a note behind to tell the "install" command that the kernel # needs to be installed before the world. touch ${BDHASH}-install/kernelfirst + + # Remind the user that they need to run "freebsd-update install" + # to install the downloaded bits, in case they didn't RTFM. + echo "To install the downloaded upgrades, run \"$0 install\"." } # Make sure that all the file hashes mentioned in $@ have corresponding From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 19:23:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD404106566C; Fri, 10 Sep 2010 19:23:59 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB7EE8FC1C; Fri, 10 Sep 2010 19: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 o8AJNxNb079903; Fri, 10 Sep 2010 19:23:59 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AJNx6w079901; Fri, 10 Sep 2010 19:23:59 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009101923.o8AJNx6w079901@svn.freebsd.org> From: Colin Percival Date: Fri, 10 Sep 2010 19: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: r212432 - head/usr.sbin/freebsd-update X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 19:24:00 -0000 Author: cperciva Date: Fri Sep 10 19:23:59 2010 New Revision: 212432 URL: http://svn.freebsd.org/changeset/base/212432 Log: Add warning about freebsd-update upgrade needing lots of disk space. Submitted by: jpaetzel MFC after: 1 month Modified: head/usr.sbin/freebsd-update/freebsd-update.8 Modified: head/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.8 Fri Sep 10 19:20:52 2010 (r212431) +++ head/usr.sbin/freebsd-update/freebsd-update.8 Fri Sep 10 19:23:59 2010 (r212432) @@ -128,6 +128,11 @@ Fetch files necessary for upgrading to a Before using this command, make sure that you read the announcement and release notes for the new release in case there are any special steps needed for upgrading. +Note that this command may require up to 500 MB of space in +.Ar workdir +depending on which components of the +.Fx +base system are installed. .It Cm install Install the most recently fetched updates or upgrade. .It Cm rollback From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 20:20:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7181D1065670; Fri, 10 Sep 2010 20:20:28 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EFCC8FC12; Fri, 10 Sep 2010 20:20: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 o8AKKSF7084383; Fri, 10 Sep 2010 20:20:28 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AKKSDH084381; Fri, 10 Sep 2010 20:20:28 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009102020.o8AKKSDH084381@svn.freebsd.org> From: Colin Percival Date: Fri, 10 Sep 2010 20:20: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: r212434 - head/usr.sbin/freebsd-update X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 20:20:28 -0000 Author: cperciva Date: Fri Sep 10 20:20:28 2010 New Revision: 212434 URL: http://svn.freebsd.org/changeset/base/212434 Log: "freebsd-update fetch -r NEWRELEASE" is meaningless and probably a typo for "freebsd-update upgrade -r NEWRELEASE". Error out and suggest what the user probably meant. Submitted by: James Seward MFC after: 1 month Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Fri Sep 10 19:34:00 2010 (r212433) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Fri Sep 10 20:20:28 2010 (r212434) @@ -572,7 +572,7 @@ fetch_setup_verboselevel () { # running *-p[0-9]+, strip off the last part; if the # user is running -SECURITY, call it -RELEASE. Chdir # into the working directory. -fetch_check_params () { +fetchupgrade_check_params () { export HTTP_USER_AGENT="freebsd-update (${COMMAND}, `uname -r`)" _SERVERNAME_z=\ @@ -655,9 +655,21 @@ fetch_check_params () { BDHASH=`echo ${BASEDIR} | sha256 -q` } +# Perform sanity checks etc. before fetching updates. +fetch_check_params () { + fetchupgrade_check_params + + if ! [ -z "${TARGETRELEASE}" ]; then + echo -n "`basename $0`: " + echo -n "-r option is meaningless with 'fetch' command. " + echo "(Did you mean 'upgrade' instead?)" + exit 1 + fi +} + # Perform sanity checks etc. before fetching upgrades. upgrade_check_params () { - fetch_check_params + fetchupgrade_check_params # Unless set otherwise, we're upgrading to the same kernel config. NKERNCONF=${KERNCONF} From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 20:42:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC859106564A; Fri, 10 Sep 2010 20:42:41 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AF958FC0C; Fri, 10 Sep 2010 20:42: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 o8AKgfxZ086344; Fri, 10 Sep 2010 20:42:41 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AKgfed086342; Fri, 10 Sep 2010 20:42:41 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009102042.o8AKgfed086342@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 10 Sep 2010 20:42: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: r212435 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 20:42:41 -0000 Author: mdf Date: Fri Sep 10 20:42:41 2010 New Revision: 212435 URL: http://svn.freebsd.org/changeset/base/212435 Log: Mark the sbuf_overflowed(9) manpage as obsolete since it has been renamed. Noticed by: jhb Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Sep 10 20:20:28 2010 (r212434) +++ head/ObsoleteFiles.inc Fri Sep 10 20:42:41 2010 (r212435) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20100910: renamed sbuf_overflowed to sbuf_error +OLD_FILES+=usr/share/man/man9/sbuf_overflowed.9.gz # 20100815: retired last traces of chooseproc(9) OLD_FILES+=usr/share/man/man9/chooseproc.9.gz # 20100806: removal of unused libcompat routines From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 21:45:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF507106564A; Fri, 10 Sep 2010 21:45:42 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE0BF8FC13; Fri, 10 Sep 2010 21:45: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 o8ALjgdK091377; Fri, 10 Sep 2010 21:45:42 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ALjgvq091375; Fri, 10 Sep 2010 21:45:42 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201009102145.o8ALjgvq091375@svn.freebsd.org> From: Jamie Gritton Date: Fri, 10 Sep 2010 21:45: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: r212436 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 21:45:42 -0000 Author: jamie Date: Fri Sep 10 21:45:42 2010 New Revision: 212436 URL: http://svn.freebsd.org/changeset/base/212436 Log: Don't exit kern_jail_set without freeing options when enforce_statfs has an illegal value. MFC after: 3 days Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Fri Sep 10 20:42:41 2010 (r212435) +++ head/sys/kern/kern_jail.c Fri Sep 10 21:45:42 2010 (r212436) @@ -584,12 +584,15 @@ kern_jail_set(struct thread *td, struct gotchildmax = 1; error = vfs_copyopt(opts, "enforce_statfs", &enforce, sizeof(enforce)); - gotenforce = (error == 0); - if (gotenforce) { - if (enforce < 0 || enforce > 2) - return (EINVAL); - } else if (error != ENOENT) + if (error == ENOENT) + gotenforce = 0; + else if (error != 0) goto done_free; + else if (enforce < 0 || enforce > 2) { + error = EINVAL; + goto done_free; + } else + gotenforce = 1; pr_flags = ch_flags = 0; for (fi = 0; fi < sizeof(pr_flag_names) / sizeof(pr_flag_names[0]); From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 21:53:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 835B6106566B; Fri, 10 Sep 2010 21:53:47 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F4068FC08; Fri, 10 Sep 2010 21:53: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 o8ALrlkv092062; Fri, 10 Sep 2010 21:53:47 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ALrl93092055; Fri, 10 Sep 2010 21:53:47 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009102153.o8ALrl93092055@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 10 Sep 2010 21:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212437 - in stable/7: share/man/man9 sys/kern sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 21:53:47 -0000 Author: mdf Date: Fri Sep 10 21:53:47 2010 New Revision: 212437 URL: http://svn.freebsd.org/changeset/base/212437 Log: MFC r211194, r211229, r212058, r212063: memguard(9) rewrite r211194: Rework memguard(9) to reserve significantly more KVA to detect use-after-free over a longer time. Also release the backing pages of a guarded allocation at free(9) time to reduce the overhead of using memguard(9). Allow setting and varying the malloc type at run-time. Add knobs to allow: - randomly guarding memory - adding un-backed KVA guard pages to detect underflow and overflow - a lower limit on the size of allocations that are guarded r211229: Fix compile. It seemed better to have memguard.c include opt_vm.h in case future compile-time knobs were added that it wants to use. Also add include guards and forward declarations to vm/memguard.h. r212058: The realloc case for memguard(9) will copy too many bytes when reallocating to a smaller-sized allocation. Fix this issue. r212063: Have memguard(9) crash with an easier-to-debug message on double-free. Modified: stable/7/share/man/man9/memguard.9 stable/7/sys/kern/kern_malloc.c stable/7/sys/vm/memguard.c stable/7/sys/vm/memguard.h stable/7/sys/vm/vm_extern.h stable/7/sys/vm/vm_kern.c Directory Properties: stable/7/share/man/ (props changed) stable/7/share/man/man1/ (props changed) stable/7/share/man/man3/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man5/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man8/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man9/memguard.9 ============================================================================== --- stable/7/share/man/man9/memguard.9 Fri Sep 10 21:45:42 2010 (r212436) +++ stable/7/share/man/man9/memguard.9 Fri Sep 10 21:53:47 2010 (r212437) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2006 +.Dd August 2, 2010 .Dt MEMGUARD 9 .Os .Sh NAME @@ -41,54 +41,107 @@ multithreaded kernels where race conditi .Pp Currently, .Nm -can only take over +can take over .Fn malloc , .Fn realloc and .Fn free -for a particular malloc type. +for a single malloc type. +.Nm +can also guard all allocations larger than +.Dv PAGE_SIZE , +and can guard a random fraction of all allocations. +There is also a knob to prevent allocations smaller than a specified +size from being guarded, to limit memory waste. .Sh EXAMPLES To use .Nm -for memory type compiled into the kernel, one has to add the -following line to the +for a memory type, either add an entry to .Pa /boot/loader.conf : .Bd -literal -offset indent vm.memguard.desc= .Ed .Pp -Where -.Ar memory_type -is a short description of memory type to monitor. -The short description of memory type is the second argument to -.Xr MALLOC_DEFINE 9 , -so one has to find it in the kernel source. -.Pp -To use -.Nm -for memory type defined in a kernel module, one has to set +Or set the .Va vm.memguard.desc .Xr sysctl 8 -variable before loading the module: +variable at run-time: .Bd -literal -offset indent sysctl vm.memguard.desc= .Ed .Pp +Where +.Ar memory_type +is a short description of the memory type to monitor. +Only allocations from that +.Ar memory_type +made after +.Va vm.memguard.desc +is set will potentially be guarded. +If +.Va vm.memguard.desc +is modified at run-time then only allocations of the new +.Ar memory_type +will potentially be guarded once the +.Xr sysctl 8 +is set. +Existing guarded allocations will still be properly released by +.Xr free 9 . +.Pp +The short description of a +.Xr malloc 9 +type is the second argument to +.Xr MALLOC_DEFINE 9 , +so one has to find it in the kernel source. +.Pp The .Va vm.memguard.divisor -boot-time tunable is used to scale how much of -.Va kmem_map -one wants to allocate for -.Nm . -The default is 10, so -.Va kmem_size Ns /10 -bytes will be used. -The -.Va kmem_size -value can be obtained via the -.Va vm.kmem_size -.Xr sysctl 8 -variable. +boot-time tunable is used to scale how much of the system's physical +memory +.Nm +is allowed to consume. +The default is 10, so up to +.Va cnt.v_page_count Ns /10 +pages can be used. +.Nm +will reserve +.Va vm_kmem_max +/ +.Va vm.memguard.divisor +bytes of virtual address space, limited by twice the physical memory +size. +The physical limit is reported as +.Va vm.memguard.phys_limit +and the virtual space reserved for +.Nm +is reported as +.Va vm.memguard.mapsize . +.Pp +.Nm +will not do page promotions for any allocation smaller than +.Va vm.memguard.minsize +bytes. +The default is 0, meaning all allocations can potentially be guarded. +.Nm +can guard sufficiently large allocations randomly, with average +frequency of every one in 100000 / +.Va vm.memguard.frequency +allocations. +The default is 0, meaning no allocations are randomly guarded. +.Pp +.Nm +can optionally add unmapped guard pages around each allocation to +detect overflow and underflow, if +.Va vm.memguard.options +has the 1 bit set. +This option is enabled by default. +.Nm +will optionally guard all allocations of +.Dv PAGE_SIZE +or larger if +.Va vm.memguard.options +has the 2 bit set. +This option is off by default. .Sh SEE ALSO .Xr sysctl 8 , .Xr vmstat 8 , @@ -102,10 +155,13 @@ first appeared in .Sh AUTHORS .An -nosplit .Nm -was written by +was originally written by .An Bosko Milekic Aq bmilekic@FreeBSD.org . -This manual page was written by +This manual page was originally written by .An Christian Brueffer Aq brueffer@FreeBSD.org . +Additions have been made by +.An Matthew Fleming Aq mdf@FreeBSD.org +to both the implementation and the documentation. .Sh BUGS Currently, it is not possible to override UMA .Xr zone 9 Modified: stable/7/sys/kern/kern_malloc.c ============================================================================== --- stable/7/sys/kern/kern_malloc.c Fri Sep 10 21:45:42 2010 (r212436) +++ stable/7/sys/kern/kern_malloc.c Fri Sep 10 21:53:47 2010 (r212437) @@ -365,8 +365,12 @@ malloc(unsigned long size, struct malloc ("malloc(M_WAITOK) in interrupt context")); #ifdef DEBUG_MEMGUARD - if (memguard_cmp(mtp)) - return memguard_alloc(size, flags); + if (memguard_cmp(mtp, size)) { + va = memguard_alloc(size, flags); + if (va != NULL) + return (va); + /* This is unfortunate but should not be fatal. */ + } #endif #ifdef DEBUG_REDZONE @@ -427,7 +431,7 @@ free(void *addr, struct malloc_type *mtp return; #ifdef DEBUG_MEMGUARD - if (memguard_cmp(mtp)) { + if (is_memguard_addr(addr)) { memguard_free(addr); return; } @@ -495,10 +499,8 @@ realloc(void *addr, unsigned long size, */ #ifdef DEBUG_MEMGUARD -if (memguard_cmp(mtp)) { - slab = NULL; - alloc = size; -} else { + if (is_memguard_addr(addr)) + return (memguard_realloc(addr, size, mtp, flags)); #endif #ifdef DEBUG_REDZONE @@ -523,10 +525,6 @@ if (memguard_cmp(mtp)) { return (addr); #endif /* !DEBUG_REDZONE */ -#ifdef DEBUG_MEMGUARD -} -#endif - /* Allocate a new, bigger (or smaller) block */ if ((newaddr = malloc(size, mtp, flags)) == NULL) return (NULL); @@ -558,7 +556,7 @@ static void kmeminit(void *dummy) { u_int8_t indx; - u_long mem_size; + u_long mem_size, tmp; int i; mtx_init(&malloc_mtx, "malloc", NULL, MTX_DEF); @@ -622,8 +620,13 @@ kmeminit(void *dummy) */ init_param3(vm_kmem_size / PAGE_SIZE); +#ifdef DEBUG_MEMGUARD + tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); +#else + tmp = vm_kmem_size; +#endif kmem_map = kmem_suballoc(kernel_map, &kmembase, &kmemlimit, - vm_kmem_size, TRUE); + tmp, TRUE); kmem_map->system_map = 1; #ifdef DEBUG_MEMGUARD @@ -632,14 +635,7 @@ kmeminit(void *dummy) * replacement allocator used for detecting tamper-after-free * scenarios as they occur. It is only used for debugging. */ - vm_memguard_divisor = 10; - TUNABLE_INT_FETCH("vm.memguard.divisor", &vm_memguard_divisor); - - /* Pick a conservative value if provided value sucks. */ - if ((vm_memguard_divisor <= 0) || - ((vm_kmem_size / vm_memguard_divisor) == 0)) - vm_memguard_divisor = 10; - memguard_init(kmem_map, vm_kmem_size / vm_memguard_divisor); + memguard_init(kmem_map); #endif uma_startup2(); Modified: stable/7/sys/vm/memguard.c ============================================================================== --- stable/7/sys/vm/memguard.c Fri Sep 10 21:45:42 2010 (r212436) +++ stable/7/sys/vm/memguard.c Fri Sep 10 21:53:47 2010 (r212437) @@ -1,6 +1,7 @@ /* - * Copyright (c) 2005, - * Bosko Milekic . All rights reserved. + * Copyright (c) 2005, Bosko Milekic . + * Copyright (c) 2010 Isilon Systems, Inc. (http://www.isilon.com/) + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,6 +37,8 @@ __FBSDID("$FreeBSD$"); * See the memguard(9) man page for more information on using MemGuard. */ +#include "opt_vm.h" + #include #include #include @@ -47,26 +50,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include #include #include -/* - * The maximum number of pages allowed per allocation. If you're using - * MemGuard to override very large items (> MAX_PAGES_PER_ITEM in size), - * you need to increase MAX_PAGES_PER_ITEM. - */ -#define MAX_PAGES_PER_ITEM 64 - SYSCTL_NODE(_vm, OID_AUTO, memguard, CTLFLAG_RW, NULL, "MemGuard data"); /* * The vm_memguard_divisor variable controls how much of kmem_map should be * reserved for MemGuard. */ -u_int vm_memguard_divisor; -SYSCTL_UINT(_vm_memguard, OID_AUTO, divisor, CTLFLAG_RD, &vm_memguard_divisor, +static u_int vm_memguard_divisor; +SYSCTL_UINT(_vm_memguard, OID_AUTO, divisor, CTLFLAG_RDTUN, + &vm_memguard_divisor, 0, "(kmem_size/memguard_divisor) == memguard submap size"); /* @@ -78,233 +77,372 @@ TUNABLE_STR("vm.memguard.desc", vm_memgu static int memguard_sysctl_desc(SYSCTL_HANDLER_ARGS) { - struct malloc_type_internal *mtip; - struct malloc_type_stats *mtsp; - struct malloc_type *mtp; - char desc[128]; - long bytes; - int error, i; + char desc[sizeof(vm_memguard_desc)]; + int error; strlcpy(desc, vm_memguard_desc, sizeof(desc)); error = sysctl_handle_string(oidp, desc, sizeof(desc), req); if (error != 0 || req->newptr == NULL) return (error); + mtx_lock(&malloc_mtx); /* - * We can change memory type when no memory has been allocated for it - * or when there is no such memory type yet (ie. it will be loaded with - * kernel module). + * If mtp is NULL, it will be initialized in memguard_cmp(). */ - bytes = 0; - mtx_lock(&malloc_mtx); - mtp = malloc_desc2type(desc); - if (mtp != NULL) { - mtip = mtp->ks_handle; - for (i = 0; i < MAXCPU; i++) { - mtsp = &mtip->mti_stats[i]; - bytes += mtsp->mts_memalloced; - bytes -= mtsp->mts_memfreed; - } - } - if (bytes > 0) - error = EBUSY; - else { - /* - * If mtp is NULL, it will be initialized in memguard_cmp(). - */ - vm_memguard_mtype = mtp; - strlcpy(vm_memguard_desc, desc, sizeof(vm_memguard_desc)); - } + vm_memguard_mtype = malloc_desc2type(desc); + strlcpy(vm_memguard_desc, desc, sizeof(vm_memguard_desc)); mtx_unlock(&malloc_mtx); return (error); } -SYSCTL_PROC(_vm_memguard, OID_AUTO, desc, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, +SYSCTL_PROC(_vm_memguard, OID_AUTO, desc, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, memguard_sysctl_desc, "A", "Short description of memory type to monitor"); +static vm_map_t memguard_map = NULL; +static vm_offset_t memguard_cursor; +static vm_size_t memguard_mapsize; +static vm_size_t memguard_physlimit; +static u_long memguard_wasted; +static u_long memguard_wrap; +static u_long memguard_succ; +static u_long memguard_fail_kva; +static u_long memguard_fail_pgs; + +SYSCTL_ULONG(_vm_memguard, OID_AUTO, cursor, CTLFLAG_RD, + &memguard_cursor, 0, "MemGuard cursor"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, mapsize, CTLFLAG_RD, + &memguard_mapsize, 0, "MemGuard private vm_map size"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, phys_limit, CTLFLAG_RD, + &memguard_physlimit, 0, "Limit on MemGuard memory consumption"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, wasted, CTLFLAG_RD, + &memguard_wasted, 0, "Excess memory used through page promotion"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, wrapcnt, CTLFLAG_RD, + &memguard_wrap, 0, "MemGuard cursor wrap count"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, numalloc, CTLFLAG_RD, + &memguard_succ, 0, "Count of successful MemGuard allocations"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, fail_kva, CTLFLAG_RD, + &memguard_fail_kva, 0, "MemGuard failures due to lack of KVA"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, fail_pgs, CTLFLAG_RD, + &memguard_fail_pgs, 0, "MemGuard failures due to lack of pages"); + +#define MG_GUARD 0x001 +#define MG_ALLLARGE 0x002 +static int memguard_options = MG_GUARD; +TUNABLE_INT("vm.memguard.options", &memguard_options); +SYSCTL_INT(_vm_memguard, OID_AUTO, options, CTLFLAG_RW, + &memguard_options, 0, + "MemGuard options:\n" + "\t0x001 - add guard pages around each allocation\n" + "\t0x002 - always use MemGuard for allocations over a page"); + +static u_int memguard_minsize; +static u_long memguard_minsize_reject; +SYSCTL_UINT(_vm_memguard, OID_AUTO, minsize, CTLFLAG_RW, + &memguard_minsize, 0, "Minimum size for page promotion"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, minsize_reject, CTLFLAG_RD, + &memguard_minsize_reject, 0, "# times rejected for size"); + +static u_int memguard_frequency; +static u_long memguard_frequency_hits; +TUNABLE_INT("vm.memguard.frequency", &memguard_frequency); +SYSCTL_UINT(_vm_memguard, OID_AUTO, frequency, CTLFLAG_RW, + &memguard_frequency, 0, "Times in 100000 that MemGuard will randomly run"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, frequency_hits, CTLFLAG_RD, + &memguard_frequency_hits, 0, "# times MemGuard randomly chose"); + + /* - * Global MemGuard data. + * Return a fudged value to be used for vm_kmem_size for allocating + * the kmem_map. The memguard memory will be a submap. */ -static vm_map_t memguard_map; -static unsigned long memguard_mapsize; -static unsigned long memguard_mapused; -struct memguard_entry { - STAILQ_ENTRY(memguard_entry) entries; - void *ptr; -}; -static struct memguard_fifo { - struct memguard_entry *stqh_first; - struct memguard_entry **stqh_last; - int index; -} memguard_fifo_pool[MAX_PAGES_PER_ITEM]; - -/* - * Local prototypes. - */ -static void memguard_guard(void *addr, int numpgs); -static void memguard_unguard(void *addr, int numpgs); -static struct memguard_fifo *vtomgfifo(vm_offset_t va); -static void vsetmgfifo(vm_offset_t va, struct memguard_fifo *mgfifo); -static void vclrmgfifo(vm_offset_t va); - -/* - * Local macros. MemGuard data is global, so replace these with whatever - * your system uses to protect global data (if it is kernel-level - * parallelized). This is for porting among BSDs. - */ -#define MEMGUARD_CRIT_SECTION_DECLARE static struct mtx memguard_mtx -#define MEMGUARD_CRIT_SECTION_INIT \ - mtx_init(&memguard_mtx, "MemGuard mtx", NULL, MTX_DEF) -#define MEMGUARD_CRIT_SECTION_ENTER mtx_lock(&memguard_mtx) -#define MEMGUARD_CRIT_SECTION_EXIT mtx_unlock(&memguard_mtx) -MEMGUARD_CRIT_SECTION_DECLARE; +unsigned long +memguard_fudge(unsigned long km_size, unsigned long km_max) +{ + u_long mem_pgs = cnt.v_page_count; + + vm_memguard_divisor = 10; + TUNABLE_INT_FETCH("vm.memguard.divisor", &vm_memguard_divisor); + + /* Pick a conservative value if provided value sucks. */ + if ((vm_memguard_divisor <= 0) || + ((km_size / vm_memguard_divisor) == 0)) + vm_memguard_divisor = 10; + /* + * Limit consumption of physical pages to + * 1/vm_memguard_divisor of system memory. If the KVA is + * smaller than this then the KVA limit comes into play first. + * This prevents memguard's page promotions from completely + * using up memory, since most malloc(9) calls are sub-page. + */ + memguard_physlimit = (mem_pgs / vm_memguard_divisor) * PAGE_SIZE; + /* + * We want as much KVA as we can take safely. Use at most our + * allotted fraction of kmem_max. Limit this to twice the + * physical memory to avoid using too much memory as pagetable + * pages. + */ + memguard_mapsize = km_max / vm_memguard_divisor; + /* size must be multiple of PAGE_SIZE */ + memguard_mapsize = round_page(memguard_mapsize); + if (memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs) + memguard_mapsize = mem_pgs * 2 * PAGE_SIZE; + if (km_size + memguard_mapsize > km_max) + return (km_max); + return (km_size + memguard_mapsize); +} /* * Initialize the MemGuard mock allocator. All objects from MemGuard come * out of a single VM map (contiguous chunk of address space). */ void -memguard_init(vm_map_t parent_map, unsigned long size) +memguard_init(vm_map_t parent_map) { - char *base, *limit; - int i; - - /* size must be multiple of PAGE_SIZE */ - size /= PAGE_SIZE; - size++; - size *= PAGE_SIZE; + vm_offset_t base, limit; - memguard_map = kmem_suballoc(parent_map, (vm_offset_t *)&base, - (vm_offset_t *)&limit, (vm_size_t)size, FALSE); + memguard_map = kmem_suballoc(parent_map, &base, &limit, + memguard_mapsize, FALSE); memguard_map->system_map = 1; - memguard_mapsize = size; - memguard_mapused = 0; - - MEMGUARD_CRIT_SECTION_INIT; - MEMGUARD_CRIT_SECTION_ENTER; - for (i = 0; i < MAX_PAGES_PER_ITEM; i++) { - STAILQ_INIT(&memguard_fifo_pool[i]); - memguard_fifo_pool[i].index = i; - } - MEMGUARD_CRIT_SECTION_EXIT; + KASSERT(memguard_mapsize == limit - base, + ("Expected %lu, got %lu", (u_long)memguard_mapsize, + (u_long)(limit - base))); + memguard_cursor = base; printf("MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:\n"); - printf("\tMEMGUARD map base: %p\n", base); - printf("\tMEMGUARD map limit: %p\n", limit); - printf("\tMEMGUARD map size: %ld (Bytes)\n", size); + printf("\tMEMGUARD map base: 0x%lx\n", (u_long)base); + printf("\tMEMGUARD map limit: 0x%lx\n", (u_long)limit); + printf("\tMEMGUARD map size: %jd KBytes\n", + (uintmax_t)memguard_mapsize >> 10); } /* - * Allocate a single object of specified size with specified flags (either - * M_WAITOK or M_NOWAIT). + * Run things that can't be done as early as memguard_init(). + */ +static void +memguard_sysinit(void) +{ + struct sysctl_oid_list *parent; + + parent = SYSCTL_STATIC_CHILDREN(_vm_memguard); + + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapstart", CTLFLAG_RD, + &memguard_map->min_offset, "MemGuard KVA base"); + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "maplimit", CTLFLAG_RD, + &memguard_map->max_offset, "MemGuard KVA end"); + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapused", CTLFLAG_RD, + &memguard_map->size, "MemGuard KVA used"); +} +SYSINIT(memguard, SI_SUB_KLD, SI_ORDER_ANY, memguard_sysinit, NULL); + +/* + * v2sizep() converts a virtual address of the first page allocated for + * an item to a pointer to u_long recording the size of the original + * allocation request. + * + * This routine is very similar to those defined by UMA in uma_int.h. + * The difference is that this routine stores the originally allocated + * size in one of the page's fields that is unused when the page is + * wired rather than the object field, which is used. + */ +static u_long * +v2sizep(vm_offset_t va) +{ + vm_paddr_t pa; + struct vm_page *p; + + pa = pmap_kextract(va); + if (pa == 0) + panic("MemGuard detected double-free of %p", (void *)va); + p = PHYS_TO_VM_PAGE(pa); + KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, + ("MEMGUARD: Expected wired page %p in vtomgfifo!", p)); + return ((u_long *)&p->pageq.tqe_next); +} + +/* + * Allocate a single object of specified size with specified flags + * (either M_WAITOK or M_NOWAIT). */ void * -memguard_alloc(unsigned long size, int flags) +memguard_alloc(unsigned long req_size, int flags) { - void *obj; - struct memguard_entry *e = NULL; - int numpgs; - - numpgs = size / PAGE_SIZE; - if ((size % PAGE_SIZE) != 0) - numpgs++; - if (numpgs > MAX_PAGES_PER_ITEM) - panic("MEMGUARD: You must increase MAX_PAGES_PER_ITEM " \ - "in memguard.c (requested: %d pages)", numpgs); - if (numpgs == 0) - return NULL; - - /* - * If we haven't exhausted the memguard_map yet, allocate from - * it and grab a new page, even if we have recycled pages in our - * FIFO. This is because we wish to allow recycled pages to live - * guarded in the FIFO for as long as possible in order to catch - * even very late tamper-after-frees, even though it means that - * we end up wasting more memory, this is only a DEBUGGING allocator - * after all. - */ - MEMGUARD_CRIT_SECTION_ENTER; - if (memguard_mapused >= memguard_mapsize) { - e = STAILQ_FIRST(&memguard_fifo_pool[numpgs - 1]); - if (e != NULL) { - STAILQ_REMOVE(&memguard_fifo_pool[numpgs - 1], e, - memguard_entry, entries); - MEMGUARD_CRIT_SECTION_EXIT; - obj = e->ptr; - free(e, M_TEMP); - memguard_unguard(obj, numpgs); - if (flags & M_ZERO) - bzero(obj, PAGE_SIZE * numpgs); - return obj; + vm_offset_t addr; + u_long size_p, size_v; + int do_guard, rv; + + size_p = round_page(req_size); + if (size_p == 0) + return (NULL); + /* + * To ensure there are holes on both sides of the allocation, + * request 2 extra pages of KVA. We will only actually add a + * vm_map_entry and get pages for the original request. Save + * the value of memguard_options so we have a consistent + * value. + */ + size_v = size_p; + do_guard = (memguard_options & MG_GUARD) != 0; + if (do_guard) + size_v += 2 * PAGE_SIZE; + + vm_map_lock(memguard_map); + /* + * When we pass our memory limit, reject sub-page allocations. + * Page-size and larger allocations will use the same amount + * of physical memory whether we allocate or hand off to + * uma_large_alloc(), so keep those. + */ + if (memguard_map->size >= memguard_physlimit && + req_size < PAGE_SIZE) { + addr = (vm_offset_t)NULL; + memguard_fail_pgs++; + goto out; + } + /* + * Keep a moving cursor so we don't recycle KVA as long as + * possible. It's not perfect, since we don't know in what + * order previous allocations will be free'd, but it's simple + * and fast, and requires O(1) additional storage if guard + * pages are not used. + * + * XXX This scheme will lead to greater fragmentation of the + * map, unless vm_map_findspace() is tweaked. + */ + for (;;) { + rv = vm_map_findspace(memguard_map, memguard_cursor, + size_v, &addr); + if (rv == KERN_SUCCESS) + break; + /* + * The map has no space. This may be due to + * fragmentation, or because the cursor is near the + * end of the map. + */ + if (memguard_cursor == vm_map_min(memguard_map)) { + memguard_fail_kva++; + addr = (vm_offset_t)NULL; + goto out; } - MEMGUARD_CRIT_SECTION_EXIT; - if (flags & M_WAITOK) - panic("MEMGUARD: Failed with M_WAITOK: " \ - "memguard_map too small"); - return NULL; + memguard_wrap++; + memguard_cursor = vm_map_min(memguard_map); } - memguard_mapused += (PAGE_SIZE * numpgs); - MEMGUARD_CRIT_SECTION_EXIT; - - obj = (void *)kmem_malloc(memguard_map, PAGE_SIZE * numpgs, flags); - if (obj != NULL) { - vsetmgfifo((vm_offset_t)obj, &memguard_fifo_pool[numpgs - 1]); - if (flags & M_ZERO) - bzero(obj, PAGE_SIZE * numpgs); - } else { - MEMGUARD_CRIT_SECTION_ENTER; - memguard_mapused -= (PAGE_SIZE * numpgs); - MEMGUARD_CRIT_SECTION_EXIT; + if (do_guard) + addr += PAGE_SIZE; + rv = kmem_back(memguard_map, addr, size_p, flags); + if (rv != KERN_SUCCESS) { + memguard_fail_pgs++; + addr = (vm_offset_t)NULL; + goto out; } - return obj; + memguard_cursor = addr + size_p; + *v2sizep(trunc_page(addr)) = req_size; + memguard_succ++; + if (req_size < PAGE_SIZE) { + memguard_wasted += (PAGE_SIZE - req_size); + if (do_guard) { + /* + * Align the request to 16 bytes, and return + * an address near the end of the page, to + * better detect array overrun. + */ + req_size = roundup2(req_size, 16); + addr += (PAGE_SIZE - req_size); + } + } +out: + vm_map_unlock(memguard_map); + return ((void *)addr); +} + +int +is_memguard_addr(void *addr) +{ + vm_offset_t a = (vm_offset_t)(uintptr_t)addr; + + return (a >= memguard_map->min_offset && a < memguard_map->max_offset); } /* * Free specified single object. */ void -memguard_free(void *addr) +memguard_free(void *ptr) { - struct memguard_entry *e; - struct memguard_fifo *mgfifo; - int idx; - int *temp; - - addr = (void *)trunc_page((unsigned long)addr); - - /* - * Page should not be guarded by now, so force a write. - * The purpose of this is to increase the likelihood of catching a - * double-free, but not necessarily a tamper-after-free (the second - * thread freeing might not write before freeing, so this forces it - * to and, subsequently, trigger a fault). - */ - temp = (int *)((unsigned long)addr + (PAGE_SIZE/2)); /* in page */ - *temp = 0xd34dc0d3; - - mgfifo = vtomgfifo((vm_offset_t)addr); - idx = mgfifo->index; - memguard_guard(addr, idx + 1); - e = malloc(sizeof(struct memguard_entry), M_TEMP, M_NOWAIT); - if (e == NULL) { - MEMGUARD_CRIT_SECTION_ENTER; - memguard_mapused -= (PAGE_SIZE * (idx + 1)); - MEMGUARD_CRIT_SECTION_EXIT; - memguard_unguard(addr, idx + 1); /* just in case */ - vclrmgfifo((vm_offset_t)addr); - kmem_free(memguard_map, (vm_offset_t)addr, - PAGE_SIZE * (idx + 1)); - return; - } - e->ptr = addr; - MEMGUARD_CRIT_SECTION_ENTER; - STAILQ_INSERT_TAIL(mgfifo, e, entries); - MEMGUARD_CRIT_SECTION_EXIT; + vm_offset_t addr; + u_long req_size, size; + char *temp; + int i; + + addr = trunc_page((uintptr_t)ptr); + req_size = *v2sizep(addr); + size = round_page(req_size); + + /* + * Page should not be guarded right now, so force a write. + * The purpose of this is to increase the likelihood of + * catching a double-free, but not necessarily a + * tamper-after-free (the second thread freeing might not + * write before freeing, so this forces it to and, + * subsequently, trigger a fault). + */ + temp = ptr; + for (i = 0; i < size; i += PAGE_SIZE) + temp[i] = 'M'; + + /* + * This requires carnal knowledge of the implementation of + * kmem_free(), but since we've already replaced kmem_malloc() + * above, it's not really any worse. We want to use the + * vm_map lock to serialize updates to memguard_wasted, since + * we had the lock at increment. + */ + vm_map_lock(memguard_map); + if (req_size < PAGE_SIZE) + memguard_wasted -= (PAGE_SIZE - req_size); + (void)vm_map_delete(memguard_map, addr, addr + size); + vm_map_unlock(memguard_map); +} + +/* + * Re-allocate an allocation that was originally guarded. + */ +void * +memguard_realloc(void *addr, unsigned long size, struct malloc_type *mtp, + int flags) +{ + void *newaddr; + u_long old_size; + + /* + * Allocate the new block. Force the allocation to be guarded + * as the original may have been guarded through random + * chance, and that should be preserved. + */ + if ((newaddr = memguard_alloc(size, flags)) == NULL) + return (NULL); + + /* Copy over original contents. */ + old_size = *v2sizep(trunc_page((uintptr_t)addr)); + bcopy(addr, newaddr, min(size, old_size)); + memguard_free(addr); + return (newaddr); } int -memguard_cmp(struct malloc_type *mtp) +memguard_cmp(struct malloc_type *mtp, unsigned long size) { + if (size < memguard_minsize) { + memguard_minsize_reject++; + return (0); + } + if ((memguard_options & MG_ALLLARGE) != 0 && size >= PAGE_SIZE) + return (1); + if (memguard_frequency > 0 && + (random() % 100000) < memguard_frequency) { + memguard_frequency_hits++; + return (1); + } #if 1 /* * The safest way of comparsion is to always compare short description @@ -328,78 +466,3 @@ memguard_cmp(struct malloc_type *mtp) return (0); #endif } - -/* - * Guard a page containing specified object (make it read-only so that - * future writes to it fail). - */ -static void -memguard_guard(void *addr, int numpgs) -{ - void *a = (void *)trunc_page((unsigned long)addr); - if (vm_map_protect(memguard_map, (vm_offset_t)a, - (vm_offset_t)((unsigned long)a + (PAGE_SIZE * numpgs)), - VM_PROT_READ, FALSE) != KERN_SUCCESS) - panic("MEMGUARD: Unable to guard page!"); -} - -/* - * Unguard a page containing specified object (make it read-and-write to - * allow full data access). - */ -static void -memguard_unguard(void *addr, int numpgs) -{ - void *a = (void *)trunc_page((unsigned long)addr); - if (vm_map_protect(memguard_map, (vm_offset_t)a, - (vm_offset_t)((unsigned long)a + (PAGE_SIZE * numpgs)), - VM_PROT_DEFAULT, FALSE) != KERN_SUCCESS) - panic("MEMGUARD: Unable to unguard page!"); -} - -/* - * vtomgfifo() converts a virtual address of the first page allocated for - * an item to a memguard_fifo_pool reference for the corresponding item's - * size. - * - * vsetmgfifo() sets a reference in an underlying page for the specified - * virtual address to an appropriate memguard_fifo_pool. - * - * These routines are very similar to those defined by UMA in uma_int.h. - * The difference is that these routines store the mgfifo in one of the - * page's fields that is unused when the page is wired rather than the - * object field, which is used. - */ -static struct memguard_fifo * -vtomgfifo(vm_offset_t va) -{ - vm_page_t p; - struct memguard_fifo *mgfifo; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vtomgfifo!")); - mgfifo = (struct memguard_fifo *)p->pageq.tqe_next; - return mgfifo; -} - -static void -vsetmgfifo(vm_offset_t va, struct memguard_fifo *mgfifo) -{ - vm_page_t p; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vsetmgfifo!")); - p->pageq.tqe_next = (vm_page_t)mgfifo; -} - -static void vclrmgfifo(vm_offset_t va) -{ - vm_page_t p; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vclrmgfifo!")); - p->pageq.tqe_next = NULL; -} Modified: stable/7/sys/vm/memguard.h ============================================================================== --- stable/7/sys/vm/memguard.h Fri Sep 10 21:45:42 2010 (r212436) +++ stable/7/sys/vm/memguard.h Fri Sep 10 21:53:47 2010 (r212437) @@ -26,9 +26,30 @@ * $FreeBSD$ */ -extern u_int vm_memguard_divisor; +#ifndef _VM_MEMGUARD_H_ +#define _VM_MEMGUARD_H_ -void memguard_init(vm_map_t parent_map, unsigned long size); -void *memguard_alloc(unsigned long size, int flags); -void memguard_free(void *addr); -int memguard_cmp(struct malloc_type *mtp); +#include "opt_vm.h" + +struct malloc_type; +struct vm_map; + +#ifdef DEBUG_MEMGUARD +unsigned long memguard_fudge(unsigned long, unsigned long); +void memguard_init(struct vm_map *); +void *memguard_alloc(unsigned long, int); +void *memguard_realloc(void *, unsigned long, struct malloc_type *, int); +void memguard_free(void *); +int memguard_cmp(struct malloc_type *, unsigned long); +int is_memguard_addr(void *); +#else +#define memguard_fudge(size, xxx) (size) +#define memguard_init(map) do { } while (0) +#define memguard_alloc(size, flags) NULL +#define memguard_realloc(a, s, mtp, f) NULL +#define memguard_free(addr) do { } while (0) +#define memguard_cmp(mtp, size) 0 +#define is_memguard_addr(addr) 0 +#endif + +#endif /* _VM_MEMGUARD_H_ */ Modified: stable/7/sys/vm/vm_extern.h ============================================================================== --- stable/7/sys/vm/vm_extern.h Fri Sep 10 21:45:42 2010 (r212436) +++ stable/7/sys/vm/vm_extern.h Fri Sep 10 21:53:47 2010 (r212437) @@ -68,6 +68,7 @@ void kmem_free(vm_map_t, vm_offset_t, vm void kmem_free_wakeup(vm_map_t, vm_offset_t, vm_size_t); void kmem_init(vm_offset_t, vm_offset_t); vm_offset_t kmem_malloc(vm_map_t map, vm_size_t size, int flags); +int kmem_back(vm_map_t, vm_offset_t, vm_size_t, int); vm_map_t kmem_suballoc(vm_map_t, vm_offset_t *, vm_offset_t *, vm_size_t, boolean_t); void swapout_procs(int); Modified: stable/7/sys/vm/vm_kern.c ============================================================================== --- stable/7/sys/vm/vm_kern.c Fri Sep 10 21:45:42 2010 (r212436) +++ stable/7/sys/vm/vm_kern.c Fri Sep 10 21:53:47 2010 (r212437) @@ -272,11 +272,8 @@ kmem_malloc(map, size, flags) vm_size_t size; int flags; { - vm_offset_t offset, i; - vm_map_entry_t entry; vm_offset_t addr; - vm_page_t m; - int pflags; + int i, rv; size = round_page(size); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 23:15:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 885501065673; Fri, 10 Sep 2010 23:15:05 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 780538FC1A; Fri, 10 Sep 2010 23:15: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 o8ANF5ml098530; Fri, 10 Sep 2010 23:15:05 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANF5X4098528; Fri, 10 Sep 2010 23:15:05 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201009102315.o8ANF5X4098528@svn.freebsd.org> From: Glen Barber Date: Fri, 10 Sep 2010 23:15: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: r212438 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:15:05 -0000 Author: gjb (doc committer) Date: Fri Sep 10 23:15:05 2010 New Revision: 212438 URL: http://svn.freebsd.org/changeset/base/212438 Log: Add EINVAL to list of possible return values for cpuset_getaffinity(2). PR: 149978 Submitted by: gcooper Patch by: gcooper Approved by: keramida (mentor) MFC after: 1 week Modified: head/lib/libc/sys/cpuset_getaffinity.2 Modified: head/lib/libc/sys/cpuset_getaffinity.2 ============================================================================== --- head/lib/libc/sys/cpuset_getaffinity.2 Fri Sep 10 21:53:47 2010 (r212437) +++ head/lib/libc/sys/cpuset_getaffinity.2 Fri Sep 10 23:15:05 2010 (r212438) @@ -121,6 +121,12 @@ The or .Fa which argument was not a valid value. +.It Bq Er EINVAL +The +.Fa mask +argument specified when calling +.Fn cpuset_setaffinity +was not a valid value. .It Bq Er EDEADLK The .Fn cpuset_setaffinity From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 23:18:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12629106564A; Fri, 10 Sep 2010 23:18:46 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01B6B8FC15; Fri, 10 Sep 2010 23:18: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 o8ANIj0c098890; Fri, 10 Sep 2010 23:18:45 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANIjUw098888; Fri, 10 Sep 2010 23:18:45 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009102318.o8ANIjUw098888@svn.freebsd.org> From: Rick Macklem Date: Fri, 10 Sep 2010 23:18: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: r212439 - head/sys/fs/nfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:18:46 -0000 Author: rmacklem Date: Fri Sep 10 23:18:45 2010 New Revision: 212439 URL: http://svn.freebsd.org/changeset/base/212439 Log: Fix the NFSVNO_CMPFH() macro in the experimental NFS server so that it works correctly for ZFS file handles. It is possible to have two ZFS file handles that differ only in the bytes in the fid_reserved field of the generic "struct fid" and comparing the bytes in fid_data didn't catch this case. This patch changes the macro to compare all bytes of "struct fid". Tested by: gull at gull.us MFC after: 2 weeks Modified: head/sys/fs/nfs/nfsdport.h Modified: head/sys/fs/nfs/nfsdport.h ============================================================================== --- head/sys/fs/nfs/nfsdport.h Fri Sep 10 23:15:05 2010 (r212438) +++ head/sys/fs/nfs/nfsdport.h Fri Sep 10 23:18:45 2010 (r212439) @@ -70,8 +70,7 @@ struct nfsexstuff { #define NFSVNO_CMPFH(f1, f2) \ ((f1)->fh_fsid.val[0] == (f2)->fh_fsid.val[0] && \ (f1)->fh_fsid.val[1] == (f2)->fh_fsid.val[1] && \ - !bcmp((f1)->fh_fid.fid_data, (f2)->fh_fid.fid_data, \ - (f1)->fh_fid.fid_len)) + bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0) #define NFSLOCKHASH(f) \ (&nfslockhash[(*((u_int32_t *)((f)->fh_fid.fid_data))) % NFSLOCKHASHSIZE]) From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 23:22:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C57EC106567A; Fri, 10 Sep 2010 23:22:02 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B53FD8FC2B; Fri, 10 Sep 2010 23:22: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 o8ANM2Hr099206; Fri, 10 Sep 2010 23:22:02 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANM2wY099204; Fri, 10 Sep 2010 23:22:02 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201009102322.o8ANM2wY099204@svn.freebsd.org> From: Glen Barber Date: Fri, 10 Sep 2010 23:22: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: r212440 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:22:02 -0000 Author: gjb (doc committer) Date: Fri Sep 10 23:22:01 2010 New Revision: 212440 URL: http://svn.freebsd.org/changeset/base/212440 Log: Add RETURN VALUES section to devclass_get_maxunit(9). PR: 149979 Submitted by: gcooper Patch by: gcooper Approved by: keramida (mentor) MFC after: 1 week Modified: head/share/man/man9/devclass_get_maxunit.9 Modified: head/share/man/man9/devclass_get_maxunit.9 ============================================================================== --- head/share/man/man9/devclass_get_maxunit.9 Fri Sep 10 23:18:45 2010 (r212439) +++ head/share/man/man9/devclass_get_maxunit.9 Fri Sep 10 23:22:01 2010 (r212440) @@ -43,6 +43,19 @@ Returns the next unit number to be allocated to device instances in the .Dv devclass . This is one greater than the highest currently allocated unit. +.Sh RETURN VALUES +The +.Fn devclass_get_maxunit +function returns -1 if +.Fa dc +is +.Dv NULL; +otherwise it returns the next unit +number in +.Fa dc's +devclass. +.Sh ERRORS +None. .Sh SEE ALSO .Xr devclass 9 , .Xr device 9 From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 23:24:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16073106566C; Fri, 10 Sep 2010 23:24:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 059878FC19; Fri, 10 Sep 2010 23:24: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 o8ANOtTv099482; Fri, 10 Sep 2010 23:24:55 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANOt2u099480; Fri, 10 Sep 2010 23:24:55 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201009102324.o8ANOt2u099480@svn.freebsd.org> From: Glen Barber Date: Fri, 10 Sep 2010 23:24: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: r212441 - head/lib/libc/db/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:24:56 -0000 Author: gjb (doc committer) Date: Fri Sep 10 23:24:55 2010 New Revision: 212441 URL: http://svn.freebsd.org/changeset/base/212441 Log: Note O_SYNC and O_NOFOLLOW flags in dbopen(3) since r190497. PR: 150030 Submitted by: Janne Snabb snabb at epipe com Patch by: Janne Snabb Approved by: keramida (mentor) MFC after: 1 week Modified: head/lib/libc/db/man/dbopen.3 Modified: head/lib/libc/db/man/dbopen.3 ============================================================================== --- head/lib/libc/db/man/dbopen.3 Fri Sep 10 23:22:01 2010 (r212440) +++ head/lib/libc/db/man/dbopen.3 Fri Sep 10 23:24:55 2010 (r212441) @@ -78,8 +78,8 @@ arguments are as specified to the .Xr open 2 routine, however, only the -.Dv O_CREAT , O_EXCL , O_EXLOCK , O_NONBLOCK , -.Dv O_RDONLY , O_RDWR , O_SHLOCK +.Dv O_CREAT , O_EXCL , O_EXLOCK , O_NOFOLLOW , O_NONBLOCK , +.Dv O_RDONLY , O_RDWR , O_SHLOCK , O_SYNC and .Dv O_TRUNC flags are meaningful. From owner-svn-src-all@FreeBSD.ORG Fri Sep 10 23:49:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9166106566C; Fri, 10 Sep 2010 23:49:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D88D98FC1E; Fri, 10 Sep 2010 23:49: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 o8ANnX51001848; Fri, 10 Sep 2010 23:49:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANnXxp001846; Fri, 10 Sep 2010 23:49:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009102349.o8ANnXxp001846@svn.freebsd.org> From: Rick Macklem Date: Fri, 10 Sep 2010 23:49: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: r212443 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:49:34 -0000 Author: rmacklem Date: Fri Sep 10 23:49:33 2010 New Revision: 212443 URL: http://svn.freebsd.org/changeset/base/212443 Log: This patch applies one of the two fixes suggested by zack.kirsch at isilon.com for a race between nfsrv_freeopen() and nfsrv_getlockfile() in the experimental NFS server that he found during testing. Although nfsrv_freeopen() holds a sleep lock on the lock file structure when called with cansleep != 0, nfsrv_getlockfile() could still search the list, once it acquired the NFSLOCKSTATE() mutex. I believe that acquiring the mutex in nfsrv_freeopen() fixes the race. MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Fri Sep 10 23:38:18 2010 (r212442) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Fri Sep 10 23:49:33 2010 (r212443) @@ -1085,8 +1085,11 @@ nfsrv_freeopen(struct nfsstate *stp, vno * associated with the open. * If there are locks associated with the open, the * nfslockfile structure can be freed via nfsrv_freelockowner(). - * (That is why the call must be here instead of after the loop.) + * Acquire the state mutex to avoid races with calls to + * nfsrv_getlockfile(). */ + if (cansleep != 0) + NFSLOCKSTATE(); if (lfp != NULL && LIST_EMPTY(&lfp->lf_open) && LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) && LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) && @@ -1096,6 +1099,8 @@ nfsrv_freeopen(struct nfsstate *stp, vno ret = 1; } else ret = 0; + if (cansleep != 0) + NFSUNLOCKSTATE(); FREE((caddr_t)stp, M_NFSDSTATE); newnfsstats.srvopens--; nfsrv_openpluslock--; From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 01:08:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86ADE106566B; Sat, 11 Sep 2010 01:08:16 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74DF98FC16; Sat, 11 Sep 2010 01: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 o8B18GdF008423; Sat, 11 Sep 2010 01:08:16 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B18Ghx008418; Sat, 11 Sep 2010 01:08:16 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009110108.o8B18Ghx008418@svn.freebsd.org> From: Rick Macklem Date: Sat, 11 Sep 2010 01:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212446 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 01:08:16 -0000 Author: rmacklem Date: Sat Sep 11 01:08:16 2010 New Revision: 212446 URL: http://svn.freebsd.org/changeset/base/212446 Log: MFC: r211951 The timer routine in the experimental NFS server did not acquire the correct mutex when checking nfsv4root_lock. Although this could be fixed by adding mutex lock/unlock calls, zack.kirsch at isilon.com suggested a better fix that uses a non-blocking acquisition of a reference count on nfsv4root_lock. This fix allows the weird NFSLOCKSTATE(); NFSUNLOCKSTATE(); synchronization to be deleted. This patch applies this fix. Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Fri Sep 10 23:55:46 2010 (r212445) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Sep 11 01:08:16 2010 (r212446) @@ -1835,6 +1835,21 @@ nfsv4_getref(struct nfsv4lock *lp, int * } /* + * Get a reference as above, but return failure instead of sleeping if + * an exclusive lock is held. + */ +APPLESTATIC int +nfsv4_getref_nonblock(struct nfsv4lock *lp) +{ + + if ((lp->nfslock_lock & NFSV4LOCK_LOCK) != 0) + return (0); + + lp->nfslock_usecnt++; + return (1); +} + +/* * Test for a lock. Return 1 if locked, 0 otherwise. */ APPLESTATIC int Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Fri Sep 10 23:55:46 2010 (r212445) +++ stable/8/sys/fs/nfs/nfs_var.h Sat Sep 11 01:08:16 2010 (r212446) @@ -251,6 +251,7 @@ int nfsv4_lock(struct nfsv4lock *, int, void nfsv4_unlock(struct nfsv4lock *, int); void nfsv4_relref(struct nfsv4lock *); void nfsv4_getref(struct nfsv4lock *, int *, void *); +int nfsv4_getref_nonblock(struct nfsv4lock *); int nfsv4_testlock(struct nfsv4lock *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); int nfsrv_checkutf8(u_int8_t *, int); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Fri Sep 10 23:55:46 2010 (r212445) +++ stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Sep 11 01:08:16 2010 (r212446) @@ -533,8 +533,6 @@ nfsrvd_compound(struct nfsrv_descript *n NFSV4ROOTLOCKMUTEXPTR); NFSUNLOCKV4ROOTMUTEX(); if (igotlock) { - NFSLOCKSTATE(); /* to avoid a race with */ - NFSUNLOCKSTATE(); /* nfsrv_servertimer() */ /* * If I got the lock, I can update the stable storage file. * Done when the grace period is over or a client has long Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Fri Sep 10 23:55:46 2010 (r212445) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Sep 11 01:08:16 2010 (r212446) @@ -164,8 +164,6 @@ nfsrv_setclient(struct nfsrv_descript *n NFSV4ROOTLOCKMUTEXPTR); } while (!igotlock); NFSUNLOCKV4ROOTMUTEX(); - NFSLOCKSTATE(); /* to avoid a race with */ - NFSUNLOCKSTATE(); /* nfsrv_servertimer() */ /* * Search for a match in the client list. @@ -416,8 +414,6 @@ nfsrv_getclient(nfsquad_t clientid, int NFSV4ROOTLOCKMUTEXPTR); } while (!igotlock); NFSUNLOCKV4ROOTMUTEX(); - NFSLOCKSTATE(); /* to avoid a race with */ - NFSUNLOCKSTATE(); /* nfsrv_servertimer() */ } else if (opflags != CLOPS_RENEW) { NFSLOCKSTATE(); } @@ -547,8 +543,6 @@ nfsrv_adminrevoke(struct nfsd_clid *revo NFSV4ROOTLOCKMUTEXPTR); } while (!igotlock); NFSUNLOCKV4ROOTMUTEX(); - NFSLOCKSTATE(); /* to avoid a race with */ - NFSUNLOCKSTATE(); /* nfsrv_servertimer() */ /* * Search for a match in the client list. @@ -824,11 +818,8 @@ nfsrv_dumplocks(vnode_t vp, struct nfsd_ /* * Server timer routine. It can scan any linked list, so long - * as it holds the spin lock and there is no exclusive lock on + * as it holds the spin/mutex lock and there is no exclusive lock on * nfsv4rootfs_lock. - * Must be called by a kernel thread and not a timer interrupt, - * so that it only runs when the nfsd threads are sleeping on a - * uniprocessor and uses the State spin lock for an SMP system. * (For OpenBSD, a kthread is ok. For FreeBSD, I think it is ok * to do this from a callout, since the spin locks work. For * Darwin, I'm not sure what will work correctly yet.) @@ -839,7 +830,7 @@ nfsrv_servertimer(void) { struct nfsclient *clp, *nclp; struct nfsstate *stp, *nstp; - int i; + int got_ref, i; /* * Make sure nfsboottime is set. This is used by V3 as well @@ -867,13 +858,14 @@ nfsrv_servertimer(void) } /* - * Return now if an nfsd thread has the exclusive lock on - * nfsv4rootfs_lock. The dirty trick here is that we have - * the spin lock already and the nfsd threads do a: - * NFSLOCKSTATE, NFSUNLOCKSTATE after getting the exclusive - * lock, so they won't race with code after this check. + * Try and get a reference count on the nfsv4rootfs_lock so that + * no nfsd thread can acquire an exclusive lock on it before this + * call is done. If it is already exclusively locked, just return. */ - if (nfsv4rootfs_lock.nfslock_lock & NFSV4LOCK_LOCK) { + NFSLOCKV4ROOTMUTEX(); + got_ref = nfsv4_getref_nonblock(&nfsv4rootfs_lock); + NFSUNLOCKV4ROOTMUTEX(); + if (got_ref == 0) { NFSUNLOCKSTATE(); return; } @@ -945,6 +937,9 @@ nfsrv_servertimer(void) } } NFSUNLOCKSTATE(); + NFSLOCKV4ROOTMUTEX(); + nfsv4_relref(&nfsv4rootfs_lock); + NFSUNLOCKV4ROOTMUTEX(); } /* @@ -4224,8 +4219,6 @@ nfsrv_clientconflict(struct nfsclient *c NFSV4ROOTLOCKMUTEXPTR); } while (!gotlock); NFSUNLOCKV4ROOTMUTEX(); - NFSLOCKSTATE(); /* to avoid a race with */ - NFSUNLOCKSTATE(); /* nfsrv_servertimer() */ *haslockp = 1; NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p); return (1); @@ -4390,8 +4383,6 @@ nfsrv_delegconflict(struct nfsstate *stp NFSV4ROOTLOCKMUTEXPTR); } while (!gotlock); NFSUNLOCKV4ROOTMUTEX(); - NFSLOCKSTATE(); /* to avoid a race with */ - NFSUNLOCKSTATE(); /* nfsrv_servertimer() */ *haslockp = 1; NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p); return (-1); From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 02:00:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1642B106566C; Sat, 11 Sep 2010 02:00:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0567B8FC0A; Sat, 11 Sep 2010 02:00: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 o8B20Rjj016730; Sat, 11 Sep 2010 02:00:27 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B20R66016728; Sat, 11 Sep 2010 02:00:27 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009110200.o8B20R66016728@svn.freebsd.org> From: Rick Macklem Date: Sat, 11 Sep 2010 02:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212452 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 02:00:28 -0000 Author: rmacklem Date: Sat Sep 11 02:00:27 2010 New Revision: 212452 URL: http://svn.freebsd.org/changeset/base/212452 Log: MFC: r211953 Add acquisition of a reference count on nfsv4root_lock in the nfsd_recalldelegation() function, since this function is called by nfsd threads when they are handling NFSv2 or NFSv3 RPCs, where no reference count would have been acquired. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Sep 11 01:51:45 2010 (r212451) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Sep 11 02:00:27 2010 (r212452) @@ -4563,6 +4563,14 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO return; /* + * First, get a reference on the nfsv4rootfs_lock so that an + * exclusive lock cannot be acquired by another thread. + */ + NFSLOCKV4ROOTMUTEX(); + nfsv4_getref(&nfsv4rootfs_lock, NULL, NFSV4ROOTLOCKMUTEXPTR); + NFSUNLOCKV4ROOTMUTEX(); + + /* * Now, call nfsrv_checkremove() in a loop while it returns * NFSERR_DELAY. Return upon any other error or when timed out. */ @@ -4576,11 +4584,14 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO NFS_REMOVETIMEO && ((u_int32_t)mytime.tv_sec - starttime) < 100000) - return; + break; /* Sleep for a short period of time */ (void) nfs_catnap(PZERO, 0, "nfsremove"); } } while (error == NFSERR_DELAY); + NFSLOCKV4ROOTMUTEX(); + nfsv4_relref(&nfsv4rootfs_lock); + NFSUNLOCKV4ROOTMUTEX(); } APPLESTATIC void From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 04:45:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1675E106566C; Sat, 11 Sep 2010 04:45:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 043D88FC14; Sat, 11 Sep 2010 04:45: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 o8B4jpoI042576; Sat, 11 Sep 2010 04:45:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B4jpoW042563; Sat, 11 Sep 2010 04:45:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009110445.o8B4jpoW042563@svn.freebsd.org> From: Alexander Motin Date: Sat, 11 Sep 2010 04:45: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: r212453 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 04:45:52 -0000 Author: mav Date: Sat Sep 11 04:45:51 2010 New Revision: 212453 URL: http://svn.freebsd.org/changeset/base/212453 Log: Update PowerPC event timer code to use new event timers infrastructure. Reviewed by: nwitehorn Tested by: andreast H/W donated by: Gheorghe Ardelean Modified: head/sys/conf/files.powerpc head/sys/powerpc/aim/clock.c head/sys/powerpc/aim/interrupt.c head/sys/powerpc/aim/machdep.c head/sys/powerpc/booke/clock.c head/sys/powerpc/booke/interrupt.c head/sys/powerpc/booke/platform_bare.c head/sys/powerpc/include/intr_machdep.h head/sys/powerpc/include/md_var.h head/sys/powerpc/include/smp.h head/sys/powerpc/powerpc/intr_machdep.c head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/conf/files.powerpc Sat Sep 11 04:45:51 2010 (r212453) @@ -52,6 +52,7 @@ dev/syscons/scvtb.c optional sc dev/tsec/if_tsec.c optional tsec dev/tsec/if_tsec_fdt.c optional tsec fdt dev/uart/uart_cpu_powerpc.c optional uart aim +kern/kern_clocksource.c standard kern/syscalls.c optional ktr libkern/ashldi3.c optional powerpc libkern/ashrdi3.c optional powerpc Modified: head/sys/powerpc/aim/clock.c ============================================================================== --- head/sys/powerpc/aim/clock.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/aim/clock.c Sat Sep 11 04:45:51 2010 (r212453) @@ -65,107 +65,195 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +#include #include #include /* * Initially we assume a processor with a bus frequency of 12.5 MHz. */ -u_long ns_per_tick = 80; +static int initialized = 0; +static u_long ns_per_tick = 80; static u_long ticks_per_sec = 12500000; -static long ticks_per_intr; +static u_long *decr_counts[MAXCPU]; +static int decr_et_start(struct eventtimer *et, + struct bintime *first, struct bintime *period); +static int decr_et_stop(struct eventtimer *et); static timecounter_get_t decr_get_timecount; -static struct timecounter decr_timecounter = { +struct decr_state { + int mode; /* 0 - off, 1 - periodic, 2 - one-shot. */ + int32_t div; /* Periodic divisor. */ +}; +static DPCPU_DEFINE(struct decr_state, decr_state); + +static struct eventtimer decr_et; +static struct timecounter decr_tc = { decr_get_timecount, /* get_timecount */ 0, /* no poll_pps */ ~0u, /* counter_mask */ 0, /* frequency */ - "decrementer" /* name */ + "timebase" /* name */ }; +/* + * Decrementor interrupt handler. + */ void decr_intr(struct trapframe *frame) { - int32_t tick, nticks; + struct decr_state *s = DPCPU_PTR(decr_state); + int nticks = 0; + int32_t val; - /* - * Check whether we are initialized. - */ - if (!ticks_per_intr) + if (!initialized) return; - /* - * Based on the actual time delay since the last decrementer reload, - * we arrange for earlier interrupt next time. - */ - __asm ("mfdec %0" : "=r"(tick)); - for (nticks = 0; tick < 0; nticks++) - tick += ticks_per_intr; - mtdec(tick); + (*decr_counts[curcpu])++; + + if (s->mode == 1) { + /* + * Based on the actual time delay since the last decrementer + * reload, we arrange for earlier interrupt next time. + */ + __asm ("mfdec %0" : "=r"(val)); + while (val < 0) { + val += s->div; + nticks++; + } + mtdec(val); + } else if (s->mode == 2) { + nticks = 1; + decr_et_stop(NULL); + } while (nticks-- > 0) { - if (PCPU_GET(cpuid) == 0) - hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); - else - hardclock_cpu(TRAPF_USERMODE(frame)); - - statclock(TRAPF_USERMODE(frame)); - if (profprocs != 0) - profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + if (decr_et.et_active) + decr_et.et_event_cb(&decr_et, decr_et.et_arg); } } +/* + * BSP early initialization. + */ void decr_init(void) { struct cpuref cpu; - register_t msr; + char buf[32]; /* * Check the BSP's timebase frequency. Sometimes we can't find the BSP, so fall * back to the first CPU in this case. */ - if (platform_smp_get_bsp(&cpu) != 0) platform_smp_first_cpu(&cpu); - ticks_per_sec = platform_timebase_freq(&cpu); - - msr = mfmsr(); - mtmsr(msr & ~PSL_EE); - ns_per_tick = 1000000000 / ticks_per_sec; - ticks_per_intr = ticks_per_sec / hz; - mtdec(ticks_per_intr); set_cputicker(mftb, ticks_per_sec, 0); - - mtmsr(msr); + snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu); + intrcnt_add(buf, &decr_counts[curcpu]); + decr_et_stop(NULL); + initialized = 1; } #ifdef SMP +/* + * AP early initialization. + */ void decr_ap_init(void) { + char buf[32]; + snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu); + intrcnt_add(buf, &decr_counts[curcpu]); + decr_et_stop(NULL); } #endif +/* + * Final initialization. + */ void decr_tc_init(void) { - decr_timecounter.tc_frequency = ticks_per_sec; - tc_init(&decr_timecounter); + + decr_tc.tc_frequency = ticks_per_sec; + tc_init(&decr_tc); + decr_et.et_name = "decrementer"; + decr_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | + ET_FLAGS_PERCPU; + decr_et.et_quality = 1000; + decr_et.et_frequency = ticks_per_sec; + decr_et.et_min_period.sec = 0; + decr_et.et_min_period.frac = + ((0x00000002LLU << 32) / ticks_per_sec) << 32; + decr_et.et_max_period.sec = 0x7fffffffLLU / ticks_per_sec; + decr_et.et_max_period.frac = + ((0x7fffffffLLU << 32) / ticks_per_sec) << 32; + decr_et.et_start = decr_et_start; + decr_et.et_stop = decr_et_stop; + decr_et.et_priv = NULL; + et_register(&decr_et); +} + +/* + * Event timer start method. + */ +static int +decr_et_start(struct eventtimer *et, + struct bintime *first, struct bintime *period) +{ + struct decr_state *s = DPCPU_PTR(decr_state); + uint32_t fdiv; + + if (period != NULL) { + s->mode = 1; + s->div = (decr_et.et_frequency * (period->frac >> 32)) >> 32; + if (period->sec != 0) + s->div += decr_et.et_frequency * period->sec; + } else { + s->mode = 2; + s->div = 0x7fffffff; + } + if (first != NULL) { + fdiv = (decr_et.et_frequency * (first->frac >> 32)) >> 32; + if (first->sec != 0) + fdiv += decr_et.et_frequency * first->sec; + } else + fdiv = s->div; + + mtdec(fdiv); + return (0); +} + +/* + * Event timer stop method. + */ +static int +decr_et_stop(struct eventtimer *et) +{ + struct decr_state *s = DPCPU_PTR(decr_state); + + s->mode = 0; + s->div = 0x7fffffff; + mtdec(s->div); + return (0); } +/* + * Timecounter get method. + */ static unsigned decr_get_timecount(struct timecounter *tc) { @@ -189,17 +277,3 @@ DELAY(int n) tb = mftb(); } -/* - * Nothing to do. - */ -void -cpu_startprofclock(void) -{ - - /* Do nothing */ -} - -void -cpu_stopprofclock(void) -{ -} Modified: head/sys/powerpc/aim/interrupt.c ============================================================================== --- head/sys/powerpc/aim/interrupt.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/aim/interrupt.c Sat Sep 11 04:45:51 2010 (r212453) @@ -72,6 +72,7 @@ void powerpc_interrupt(struct trapframe *framep) { struct thread *td; + struct trapframe *oldframe; register_t ee; td = curthread; @@ -88,8 +89,11 @@ powerpc_interrupt(struct trapframe *fram case EXC_DECR: critical_enter(); atomic_add_int(&td->td_intr_nesting_level, 1); + oldframe = td->td_intr_frame; + td->td_intr_frame = framep; decr_intr(framep); - atomic_subtract_int(&td->td_intr_nesting_level, 1); + td->td_intr_frame = oldframe; + atomic_subtract_int(&td->td_intr_nesting_level, 1); critical_exit(); break; Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/aim/machdep.c Sat Sep 11 04:45:51 2010 (r212453) @@ -609,8 +609,7 @@ cpu_initclocks(void) { decr_tc_init(); - stathz = hz; - profhz = hz; + cpu_initclocks_bsp(); } /* Modified: head/sys/powerpc/booke/clock.c ============================================================================== --- head/sys/powerpc/booke/clock.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/booke/clock.c Sat Sep 11 04:45:51 2010 (r212453) @@ -63,12 +63,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include -#include #include +#include #include #include #include @@ -78,33 +80,46 @@ __FBSDID("$FreeBSD$"); /* * Initially we assume a processor with a bus frequency of 12.5 MHz. */ -u_int tickspending; -u_long ns_per_tick = 80; -static u_long ticks_per_sec = 12500000; -static long ticks_per_intr; +static int initialized = 0; +static u_long ns_per_tick = 80; +static u_long ticks_per_sec = 12500000; +static u_long *decr_counts[MAXCPU]; #define DIFF19041970 2082844800 +static int decr_et_start(struct eventtimer *et, + struct bintime *first, struct bintime *period); +static int decr_et_stop(struct eventtimer *et); static timecounter_get_t decr_get_timecount; +struct decr_state { + int mode; /* 0 - off, 1 - periodic, 2 - one-shot. */ + int32_t div; /* Periodic divisor. */ +}; +static DPCPU_DEFINE(struct decr_state, decr_state); + +static struct eventtimer decr_et; static struct timecounter decr_timecounter = { decr_get_timecount, /* get_timecount */ 0, /* no poll_pps */ ~0u, /* counter_mask */ 0, /* frequency */ - "decrementer" /* name */ + "timebase" /* name */ }; +/* + * Decrementor interrupt handler. + */ void decr_intr(struct trapframe *frame) { + struct decr_state *s = DPCPU_PTR(decr_state); - /* - * Check whether we are initialized. - */ - if (!ticks_per_intr) + if (!initialized) return; + (*decr_counts[curcpu])++; + /* * Interrupt handler must reset DIS to avoid getting another * interrupt once EE is enabled. @@ -113,14 +128,11 @@ decr_intr(struct trapframe *frame) CTR1(KTR_INTR, "%s: DEC interrupt", __func__); - if (PCPU_GET(cpuid) == 0) - hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); - else - hardclock_cpu(TRAPF_USERMODE(frame)); - - statclock(TRAPF_USERMODE(frame)); - if (profprocs != 0) - profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + if (s->mode == 2) + decr_et_stop(NULL); + + if (decr_et.et_active) + decr_et.et_event_cb(&decr_et, decr_et.et_arg); } void @@ -128,57 +140,129 @@ cpu_initclocks(void) { decr_tc_init(); - stathz = hz; - profhz = hz; + cpu_initclocks_bsp(); } +/* + * BSP early initialization. + */ void decr_init(void) { struct cpuref cpu; - unsigned int msr; + char buf[32]; if (platform_smp_get_bsp(&cpu) != 0) platform_smp_first_cpu(&cpu); ticks_per_sec = platform_timebase_freq(&cpu); - - msr = mfmsr(); - mtmsr(msr & ~(PSL_EE)); - ns_per_tick = 1000000000 / ticks_per_sec; - ticks_per_intr = ticks_per_sec / hz; - - mtdec(ticks_per_intr); - - mtspr(SPR_DECAR, ticks_per_intr); - mtspr(SPR_TCR, mfspr(SPR_TCR) | TCR_DIE | TCR_ARE); set_cputicker(mftb, ticks_per_sec, 0); - - mtmsr(msr); + snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu); + intrcnt_add(buf, &decr_counts[curcpu]); + decr_et_stop(NULL); + initialized = 1; } #ifdef SMP +/* + * AP early initialization. + */ void decr_ap_init(void) { + char buf[32]; - /* Set auto-reload value and enable DEC interrupts in TCR */ - mtspr(SPR_DECAR, ticks_per_intr); - mtspr(SPR_TCR, mfspr(SPR_TCR) | TCR_DIE | TCR_ARE); - - CTR2(KTR_INTR, "%s: set TCR=%p", __func__, mfspr(SPR_TCR)); + snprintf(buf, sizeof(buf), "cpu%d:decrementer", curcpu); + intrcnt_add(buf, &decr_counts[curcpu]); + decr_et_stop(NULL); } #endif +/* + * Final initialization. + */ void decr_tc_init(void) { decr_timecounter.tc_frequency = ticks_per_sec; tc_init(&decr_timecounter); + decr_et.et_name = "decrementer"; + decr_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | + ET_FLAGS_PERCPU; + decr_et.et_quality = 1000; + decr_et.et_frequency = ticks_per_sec; + decr_et.et_min_period.sec = 0; + decr_et.et_min_period.frac = + ((0x00000002LLU << 32) / ticks_per_sec) << 32; + decr_et.et_max_period.sec = 0xfffffffeLLU / ticks_per_sec; + decr_et.et_max_period.frac = + ((0xfffffffeLLU << 32) / ticks_per_sec) << 32; + decr_et.et_start = decr_et_start; + decr_et.et_stop = decr_et_stop; + decr_et.et_priv = NULL; + et_register(&decr_et); } +/* + * Event timer start method. + */ +static int +decr_et_start(struct eventtimer *et, + struct bintime *first, struct bintime *period) +{ + struct decr_state *s = DPCPU_PTR(decr_state); + uint32_t fdiv, tcr; + + if (period != NULL) { + s->mode = 1; + s->div = (decr_et.et_frequency * (period->frac >> 32)) >> 32; + if (period->sec != 0) + s->div += decr_et.et_frequency * period->sec; + } else { + s->mode = 2; + s->div = 0xffffffff; + } + if (first != NULL) { + fdiv = (decr_et.et_frequency * (first->frac >> 32)) >> 32; + if (first->sec != 0) + fdiv += decr_et.et_frequency * first->sec; + } else + fdiv = s->div; + + tcr = mfspr(SPR_TCR); + tcr |= TCR_DIE; + if (s->mode == 1) { + mtspr(SPR_DECAR, s->div); + tcr |= TCR_ARE; + } else + tcr &= ~TCR_ARE; + mtdec(fdiv); + mtspr(SPR_TCR, tcr); + return (0); +} + +/* + * Event timer stop method. + */ +static int +decr_et_stop(struct eventtimer *et) +{ + struct decr_state *s = DPCPU_PTR(decr_state); + uint32_t tcr; + + s->mode = 0; + s->div = 0xffffffff; + tcr = mfspr(SPR_TCR); + tcr &= ~(TCR_DIE | TCR_ARE); + mtspr(SPR_TCR, tcr); + return (0); +} + +/* + * Timecounter get method. + */ static unsigned decr_get_timecount(struct timecounter *tc) { @@ -203,18 +287,3 @@ DELAY(int n) } while (now < end || (now > start && end < start)); } -/* - * Nothing to do. - */ -void -cpu_startprofclock(void) -{ - - /* Do nothing */ -} - -void -cpu_stopprofclock(void) -{ - -} Modified: head/sys/powerpc/booke/interrupt.c ============================================================================== --- head/sys/powerpc/booke/interrupt.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/booke/interrupt.c Sat Sep 11 04:45:51 2010 (r212453) @@ -116,11 +116,15 @@ void powerpc_decr_interrupt(struct trapframe *framep) { struct thread *td; + struct trapframe *oldframe; td = PCPU_GET(curthread); critical_enter(); atomic_add_int(&td->td_intr_nesting_level, 1); + oldframe = td->td_intr_frame; + td->td_intr_frame = framep; decr_intr(framep); + td->td_intr_frame = oldframe; atomic_subtract_int(&td->td_intr_nesting_level, 1); critical_exit(); framep->srr1 &= ~PSL_WE; Modified: head/sys/powerpc/booke/platform_bare.c ============================================================================== --- head/sys/powerpc/booke/platform_bare.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/booke/platform_bare.c Sat Sep 11 04:45:51 2010 (r212453) @@ -82,7 +82,7 @@ static platform_method_t bare_methods[] PLATFORMMETHOD(platform_smp_get_bsp, bare_smp_get_bsp), PLATFORMMETHOD(platform_smp_start_cpu, bare_smp_start_cpu), - PLATFORMMETHOD(platform_reset, e500_reset); + PLATFORMMETHOD(platform_reset, e500_reset), { 0, 0 } }; Modified: head/sys/powerpc/include/intr_machdep.h ============================================================================== --- head/sys/powerpc/include/intr_machdep.h Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/include/intr_machdep.h Sat Sep 11 04:45:51 2010 (r212453) @@ -48,6 +48,8 @@ struct trapframe; driver_filter_t powerpc_ipi_handler; +void intrcnt_add(const char *name, u_long **countp); + void powerpc_register_pic(device_t, u_int); int powerpc_ign_lookup(uint32_t pic_id); Modified: head/sys/powerpc/include/md_var.h ============================================================================== --- head/sys/powerpc/include/md_var.h Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/include/md_var.h Sat Sep 11 04:45:51 2010 (r212453) @@ -47,8 +47,6 @@ extern int busdma_swi_pending; extern vm_offset_t kstack0; extern vm_offset_t kstack0_phys; -extern u_long ns_per_tick; - extern int powerpc_pow_enabled; extern int cacheline_size; extern int hw_direct_map; Modified: head/sys/powerpc/include/smp.h ============================================================================== --- head/sys/powerpc/include/smp.h Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/include/smp.h Sat Sep 11 04:45:51 2010 (r212453) @@ -36,6 +36,7 @@ #define IPI_RENDEZVOUS 2 #define IPI_STOP 3 #define IPI_STOP_HARD 3 +#define IPI_HARDCLOCK 4 #ifndef LOCORE Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/powerpc/intr_machdep.c Sat Sep 11 04:45:51 2010 (r212453) @@ -95,6 +95,7 @@ struct powerpc_intr { device_t pic; u_int intline; u_int vector; + u_int cntindex; cpumask_t cpu; enum intr_trigger trig; enum intr_polarity pol; @@ -106,6 +107,7 @@ struct pic { int ipi_irq; }; +static u_int intrcnt_index = 0; static struct mtx intr_table_lock; static struct powerpc_intr *powerpc_intrs[INTR_VECTORS]; static struct pic piclist[MAX_PICS]; @@ -152,6 +154,16 @@ intrcnt_setname(const char *name, int in MAXCOMLEN, name); } +void +intrcnt_add(const char *name, u_long **countp) +{ + int idx; + + idx = atomic_fetchadd_int(&intrcnt_index, 1); + *countp = &intrcnt[idx]; + intrcnt_setname(name, idx); +} + static struct powerpc_intr * intr_lookup(u_int irq) { @@ -200,8 +212,10 @@ intr_lookup(u_int irq) if (iscan == NULL && i->vector != -1) { powerpc_intrs[i->vector] = i; + i->cntindex = atomic_fetchadd_int(&intrcnt_index, 1); + i->cntp = &intrcnt[i->cntindex]; sprintf(intrname, "irq%u:", i->irq); - intrcnt_setname(intrname, i->vector); + intrcnt_setname(intrname, i->cntindex); nvectors++; } mtx_unlock(&intr_table_lock); @@ -384,8 +398,6 @@ powerpc_setup_intr(const char *name, u_i if (error) return (error); - i->cntp = &intrcnt[i->vector]; - enable = 1; } @@ -393,7 +405,7 @@ powerpc_setup_intr(const char *name, u_i intr_priority(flags), flags, cookiep); mtx_lock(&intr_table_lock); - intrcnt_setname(i->event->ie_fullname, i->vector); + intrcnt_setname(i->event->ie_fullname, i->cntindex); mtx_unlock(&intr_table_lock); if (!cold) { Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Sat Sep 11 02:00:27 2010 (r212452) +++ head/sys/powerpc/powerpc/mp_machdep.c Sat Sep 11 04:45:51 2010 (r212453) @@ -59,7 +59,6 @@ extern struct pcpu __pcpu[MAXCPU]; volatile static int ap_awake; volatile static u_int ap_letgo; -volatile static uint32_t ap_decr; volatile static u_quad_t ap_timebase; static u_int ipi_msg_cnt[32]; static struct mtx ap_boot_mtx; @@ -79,9 +78,8 @@ machdep_ap_bootstrap(void) ; /* Initialize DEC and TB, sync with the BSP values */ - decr_ap_init(); mttb(ap_timebase); - __asm __volatile("mtdec %0" :: "r"(ap_decr)); + decr_ap_init(); /* Serialize console output and AP count increment */ mtx_lock_spin(&ap_boot_mtx); @@ -96,6 +94,9 @@ machdep_ap_bootstrap(void) /* Let the DEC and external interrupts go */ mtmsr(mfmsr() | PSL_EE); + /* Start per-CPU event timers. */ + cpu_initclocks_ap(); + /* Announce ourselves awake, and enter the scheduler */ sched_throw(NULL); } @@ -243,7 +244,6 @@ cpu_mp_unleash(void *dummy) ap_awake = 1; /* Provide our current DEC and TB values for APs */ - __asm __volatile("mfdec %0" : "=r"(ap_decr)); ap_timebase = mftb() + 10; __asm __volatile("msync; isync"); @@ -313,6 +313,10 @@ powerpc_ipi_handler(void *arg) atomic_clear_int(&stopped_cpus, self); CTR1(KTR_SMP, "%s: IPI_STOP (restart)", __func__); break; + case IPI_HARDCLOCK: + CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__); + hardclockintr(curthread->td_intr_frame); + break; } } From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 06:01:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 130FF1065672; Sat, 11 Sep 2010 06:01:17 +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 7F0368FC1B; Sat, 11 Sep 2010 06:01:16 +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 o8B61BC3066584 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Sep 2010 09:01:11 +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 o8B61B6s096093; Sat, 11 Sep 2010 09:01:11 +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 o8B61BF8096092; Sat, 11 Sep 2010 09:01:11 +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: Sat, 11 Sep 2010 09:01:11 +0300 From: Kostik Belousov To: Rick Macklem Message-ID: <20100911060111.GT2465@deviant.kiev.zoral.com.ua> References: <201009102318.o8ANIjUw098888@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u+FGODhbLwgAeSOU" Content-Disposition: inline In-Reply-To: <201009102318.o8ANIjUw098888@svn.freebsd.org> 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.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_40, 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: r212439 - head/sys/fs/nfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 06:01:17 -0000 --u+FGODhbLwgAeSOU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 10, 2010 at 11:18:45PM +0000, Rick Macklem wrote: > Author: rmacklem > Date: Fri Sep 10 23:18:45 2010 > New Revision: 212439 > URL: http://svn.freebsd.org/changeset/base/212439 >=20 > Log: > Fix the NFSVNO_CMPFH() macro in the experimental NFS server so > that it works correctly for ZFS file handles. It is possible to > have two ZFS file handles that differ only in the bytes in the > fid_reserved field of the generic "struct fid" and comparing the > bytes in fid_data didn't catch this case. This patch changes the > macro to compare all bytes of "struct fid". > =20 > Tested by: gull at gull.us > MFC after: 2 weeks >=20 > Modified: > head/sys/fs/nfs/nfsdport.h >=20 > Modified: head/sys/fs/nfs/nfsdport.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/fs/nfs/nfsdport.h Fri Sep 10 23:15:05 2010 (r212438) > +++ head/sys/fs/nfs/nfsdport.h Fri Sep 10 23:18:45 2010 (r212439) > @@ -70,8 +70,7 @@ struct nfsexstuff { > #define NFSVNO_CMPFH(f1, f2) \ > ((f1)->fh_fsid.val[0] =3D=3D (f2)->fh_fsid.val[0] && \ > (f1)->fh_fsid.val[1] =3D=3D (f2)->fh_fsid.val[1] && \ > - !bcmp((f1)->fh_fid.fid_data, (f2)->fh_fid.fid_data, \ > - (f1)->fh_fid.fid_len)) > + bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) =3D=3D 0) > =20 > #define NFSLOCKHASH(f) \ > (&nfslockhash[(*((u_int32_t *)((f)->fh_fid.fid_data))) % NFSLOCKHASHSIZ= E]) Then, fid_reserved is no more reserved ? Should we rename it ? Comment for fid_reserved about longword alignment is wrong. --u+FGODhbLwgAeSOU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyLGycACgkQC3+MBN1Mb4i+BQCfTDnOn+fFfFwYt8t66HQ5Wwoh 36cAniK/w2BOdH14x6+Dod7oylOhTmaL =9613 -----END PGP SIGNATURE----- --u+FGODhbLwgAeSOU-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 06:38:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4DF1106566B; Sat, 11 Sep 2010 06:38:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 883508FC15; Sat, 11 Sep 2010 06:38: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 o8B6cYoJ056608; Sat, 11 Sep 2010 06:38:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B6cYxn056606; Sat, 11 Sep 2010 06:38:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009110638.o8B6cYxn056606@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 11 Sep 2010 06:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212454 - stable/8/tools/regression/poll X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 06:38:34 -0000 Author: kib Date: Sat Sep 11 06:38:34 2010 New Revision: 212454 URL: http://svn.freebsd.org/changeset/base/212454 Log: MFC r211940: Test the poll(2) return value. Modified: stable/8/tools/regression/poll/pipepoll.c Directory Properties: stable/8/tools/regression/poll/ (props changed) Modified: stable/8/tools/regression/poll/pipepoll.c ============================================================================== --- stable/8/tools/regression/poll/pipepoll.c Sat Sep 11 04:45:51 2010 (r212453) +++ stable/8/tools/regression/poll/pipepoll.c Sat Sep 11 06:38:34 2010 (r212454) @@ -44,16 +44,34 @@ decode_events(int events) } static void -report(int num, const char *state, int expected, int got) +report_state(const char *state) { - if (expected == got) - printf("ok %-2d ", num); - else - printf("not ok %-2d", num); - printf(" %s state %s: expected %s; got %s\n", + + printf(" %s state %s: ", filetype == FT_PIPE ? "Pipe" : filetype == FT_SOCKETPAIR ? "Sock" : "FIFO", - state, decode_events(expected), decode_events(got)); + state); +} + +static void +report(int num, const char *state, int expected, int got, int res, + int res_expected) +{ + + if (res != res_expected) { + printf("not ok %-2d", num); + report_state(state); + printf("poll result %d expected %d. ", + res, res_expected); + } else { + if (expected == got) + printf("ok %-2d ", num); + else + printf("not ok %-2d", num); + report_state(state); + } + printf("expected %s; got %s\n", decode_events(expected), + decode_events(got)); fflush(stdout); } @@ -62,8 +80,9 @@ static pid_t ppid; static volatile sig_atomic_t state; static void -catch(int sig) +catch(int sig __unused) { + state++; } @@ -71,7 +90,7 @@ static void child(int fd, int num) { struct pollfd pfd; - int fd2; + int fd2, res; char buf[256]; if (filetype == FT_FIFO) { @@ -83,9 +102,9 @@ child(int fd, int num) pfd.events = POLLIN; if (filetype == FT_FIFO) { - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "0", 0, pfd.revents); + report(num++, "0", 0, pfd.revents, res, 0); } kill(ppid, SIGUSR1); @@ -101,30 +120,30 @@ child(int fd, int num) state = 4; goto state4; } - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "1", 0, pfd.revents); + report(num++, "1", 0, pfd.revents, res, 0); kill(ppid, SIGUSR1); usleep(1); while (state != 2) ; - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "2", POLLIN, pfd.revents); + report(num++, "2", POLLIN, pfd.revents, res, 1); if (read(fd, buf, sizeof buf) != 1) err(1, "read"); - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "2a", 0, pfd.revents); + report(num++, "2a", 0, pfd.revents, res, 0); kill(ppid, SIGUSR1); usleep(1); while (state != 3) ; - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "3", POLLHUP, pfd.revents); + report(num++, "3", POLLHUP, pfd.revents, res, 1); kill(ppid, SIGUSR1); /* @@ -137,17 +156,17 @@ child(int fd, int num) while (state != 4) ; state4: - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "4", 0, pfd.revents); + report(num++, "4", 0, pfd.revents, res, 0); kill(ppid, SIGUSR1); usleep(1); while (state != 5) ; - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "5", POLLIN, pfd.revents); + report(num++, "5", POLLIN, pfd.revents, res, 1); kill(ppid, SIGUSR1); usleep(1); @@ -163,14 +182,14 @@ state4: * is an example of a broken program that quits on POLLHUP only -- * see its event-loop.c. */ - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "6", POLLIN | POLLHUP, pfd.revents); + report(num++, "6", POLLIN | POLLHUP, pfd.revents, res, 1); if (read(fd, buf, sizeof buf) != 1) err(1, "read"); - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "6a", POLLHUP, pfd.revents); + report(num++, "6a", POLLHUP, pfd.revents, res, 1); if (filetype == FT_FIFO) { /* * Check that POLLHUP is sticky for a new reader and for @@ -180,17 +199,17 @@ state4: if (fd2 < 0) err(1, "open for read"); pfd.fd = fd2; - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "6b", POLLHUP, pfd.revents); + report(num++, "6b", POLLHUP, pfd.revents, res, 1); pfd.fd = fd; - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "6c", POLLHUP, pfd.revents); + report(num++, "6c", POLLHUP, pfd.revents, res, 1); close(fd2); - if (poll(&pfd, 1, 0) < 0) + if ((res = poll(&pfd, 1, 0)) < 0) err(1, "poll"); - report(num++, "6d", POLLHUP, pfd.revents); + report(num++, "6d", POLLHUP, pfd.revents, res, 1); } close(fd); kill(ppid, SIGUSR1); From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 07:08:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8861106564A; Sat, 11 Sep 2010 07:08:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DCCF8FC14; Sat, 11 Sep 2010 07:08: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 o8B78MRc060494; Sat, 11 Sep 2010 07:08:22 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B78MSK060492; Sat, 11 Sep 2010 07:08:22 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009110708.o8B78MSK060492@svn.freebsd.org> From: Alexander Motin Date: Sat, 11 Sep 2010 07:08: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: r212455 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 07:08:22 -0000 Author: mav Date: Sat Sep 11 07:08:22 2010 New Revision: 212455 URL: http://svn.freebsd.org/changeset/base/212455 Log: Merge some SCHED_ULE features to SCHED_4BSD: - Teach SCHED_4BSD to inform cpu_idle() about high sleep/wakeup rate to choose optimized handler. In case of x86 it is MONITOR/MWAIT. Also it will be needed to bypass forthcoming idle tick skipping logic to not consume resources on events rescheduling when it won't give any benefits. - Teach SCHED_4BSD to wake up idle CPUs without using IPI. In case of x86, when MONITOR/MWAIT is active, it require just single memory write. This doubles performance on some heavily switching test loads. Modified: head/sys/kern/sched_4bsd.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Sat Sep 11 06:38:34 2010 (r212454) +++ head/sys/kern/sched_4bsd.c Sat Sep 11 07:08:22 2010 (r212455) @@ -157,6 +157,12 @@ static struct runq runq_pcpu[MAXCPU]; long runq_length[MAXCPU]; #endif +struct pcpuidlestat { + u_int idlecalls; + u_int oldidlecalls; +}; +static DPCPU_DEFINE(struct pcpuidlestat, idlestat); + static void setup_runqs(void) { @@ -684,6 +690,7 @@ sched_rr_interval(void) void sched_clock(struct thread *td) { + struct pcpuidlestat *stat; struct td_sched *ts; THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -703,6 +710,10 @@ sched_clock(struct thread *td) if (!TD_IS_IDLETHREAD(td) && ticks - PCPU_GET(switchticks) >= sched_quantum) td->td_flags |= TDF_NEEDRESCHED; + + stat = DPCPU_PTR(idlestat); + stat->oldidlecalls = stat->idlecalls; + stat->idlecalls = 0; } /* @@ -1137,7 +1148,15 @@ forward_wakeup(int cpunum) } if (map) { forward_wakeups_delivered++; - ipi_selected(map, IPI_AST); + SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + id = pc->pc_cpumask; + if ((map & id) == 0) + continue; + if (cpu_idle_wakeup(pc->pc_cpuid)) + map &= ~id; + } + if (map) + ipi_selected(map, IPI_AST); return (1); } if (cpunum == NOCPU) @@ -1154,7 +1173,8 @@ kick_other_cpu(int pri, int cpuid) pcpu = pcpu_find(cpuid); if (idle_cpus_mask & pcpu->pc_cpumask) { forward_wakeups_delivered++; - ipi_cpu(cpuid, IPI_AST); + if (!cpu_idle_wakeup(cpuid)) + ipi_cpu(cpuid, IPI_AST); return; } @@ -1537,12 +1557,16 @@ sched_tick(void) void sched_idletd(void *dummy) { + struct pcpuidlestat *stat; + stat = DPCPU_PTR(idlestat); for (;;) { mtx_assert(&Giant, MA_NOTOWNED); - while (sched_runnable() == 0) - cpu_idle(0); + while (sched_runnable() == 0) { + cpu_idle(stat->idlecalls + stat->oldidlecalls > 64); + stat->idlecalls++; + } mtx_lock_spin(&sched_lock); mi_switch(SW_VOL | SWT_IDLE, NULL); From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 07:24:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AABBF106566B; Sat, 11 Sep 2010 07:24:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A7DC8FC08; Sat, 11 Sep 2010 07:24: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 o8B7OAZ8061901; Sat, 11 Sep 2010 07:24:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B7OAFH061899; Sat, 11 Sep 2010 07:24:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009110724.o8B7OAFH061899@svn.freebsd.org> From: Alexander Motin Date: Sat, 11 Sep 2010 07:24: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: r212456 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 07:24:10 -0000 Author: mav Date: Sat Sep 11 07:24:10 2010 New Revision: 212456 URL: http://svn.freebsd.org/changeset/base/212456 Log: Sparc64 uses dummy cpu_idle() method. It's CPUs never sleeping. Tell scheduler that it doesn't need to use IPI to "wake up" CPU. Modified: head/sys/sparc64/sparc64/machdep.c Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Sat Sep 11 07:08:22 2010 (r212455) +++ head/sys/sparc64/sparc64/machdep.c Sat Sep 11 07:24:10 2010 (r212456) @@ -959,7 +959,7 @@ int cpu_idle_wakeup(int cpu) { - return (0); + return (1); } int From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 08:09:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90A0A106564A; Sat, 11 Sep 2010 08:09:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FBCC8FC0C; Sat, 11 Sep 2010 08:09: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 o8B89E9s066964; Sat, 11 Sep 2010 08:09:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B89EJl066961; Sat, 11 Sep 2010 08:09:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009110809.o8B89EJl066961@svn.freebsd.org> From: Andriy Gapon Date: Sat, 11 Sep 2010 08:09: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: r212457 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 08:09:14 -0000 Author: avg Date: Sat Sep 11 08:09:14 2010 New Revision: 212457 URL: http://svn.freebsd.org/changeset/base/212457 Log: make acpi_hp device a child of acpi_wmi to properly reflect dependency between the devices/drivers PR: kern/147858 Suggested by: jhb Tested by: Maciej Suszko MFC after: 1 week Modified: head/sys/dev/acpi_support/acpi_hp.c head/sys/dev/acpi_support/acpi_wmi.c Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Sat Sep 11 07:24:10 2010 (r212456) +++ head/sys/dev/acpi_support/acpi_hp.c Sat Sep 11 08:09:14 2010 (r212457) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -336,7 +335,7 @@ static driver_t acpi_hp_driver = { static devclass_t acpi_hp_devclass; -DRIVER_MODULE(acpi_hp, acpi, acpi_hp_driver, acpi_hp_devclass, +DRIVER_MODULE(acpi_hp, acpi_wmi, acpi_hp_driver, acpi_hp_devclass, 0, 0); MODULE_DEPEND(acpi_hp, acpi_wmi, 1, 1, 1); MODULE_DEPEND(acpi_hp, acpi, 1, 1, 1); @@ -453,16 +452,7 @@ acpi_hp_identify(driver_t *driver, devic if (device_find_child(parent, "acpi_hp", -1) != NULL) return; - /* Make sure acpi_wmi driver is present. */ - if (devclass_find("acpi_wmi") == NULL) - return; - - /* - * Add our device with late order, so that it is hopefully - * probed after acpi_wmi. - * XXX User proper constant instead of UINT_MAX for order. - */ - if (BUS_ADD_CHILD(parent, UINT_MAX, "acpi_hp", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_hp", -1) == NULL) device_printf(parent, "add acpi_hp child failed\n"); } @@ -470,11 +460,7 @@ static int acpi_hp_probe(device_t dev) { - /* Skip auto-enumerated devices from ACPI namespace. */ - if (acpi_get_handle(dev) != NULL) - return (ENXIO); device_set_desc(dev, "HP ACPI-WMI Mapping"); - return (0); } @@ -482,7 +468,6 @@ static int acpi_hp_attach(device_t dev) { struct acpi_hp_softc *sc; - devclass_t wmi_devclass; int arg; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -505,14 +490,7 @@ acpi_hp_attach(device_t dev) sc->verbose = 0; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); - if (!(wmi_devclass = devclass_find("acpi_wmi"))) { - device_printf(dev, "Couldn't find acpi_wmi devclass\n"); - return (EINVAL); - } - if (!(sc->wmi_dev = devclass_get_device(wmi_devclass, 0))) { - device_printf(dev, "Couldn't find acpi_wmi device\n"); - return (EINVAL); - } + sc->wmi_dev = device_get_parent(dev); if (!ACPI_WMI_PROVIDES_GUID_STRING(sc->wmi_dev, ACPI_HP_WMI_BIOS_GUID)) { device_printf(dev, Modified: head/sys/dev/acpi_support/acpi_wmi.c ============================================================================== --- head/sys/dev/acpi_support/acpi_wmi.c Sat Sep 11 07:24:10 2010 (r212456) +++ head/sys/dev/acpi_support/acpi_wmi.c Sat Sep 11 08:09:14 2010 (r212457) @@ -173,6 +173,10 @@ static device_method_t acpi_wmi_methods[ DEVMETHOD(device_attach, acpi_wmi_attach), DEVMETHOD(device_detach, acpi_wmi_detach), + /* bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + /* acpi_wmi interface */ DEVMETHOD(acpi_wmi_provides_guid_string, acpi_wmi_provides_guid_string_method), @@ -269,6 +273,11 @@ acpi_wmi_attach(device_t dev) } ACPI_SERIAL_END(acpi_wmi); + if (ret == 0) { + bus_generic_probe(dev); + ret = bus_generic_attach(dev); + } + return (ret); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 08:15:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7790010656AB; Sat, 11 Sep 2010 08:15:18 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6729A8FC20; Sat, 11 Sep 2010 08:15: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 o8B8FILH067639; Sat, 11 Sep 2010 08:15:18 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B8FI1I067637; Sat, 11 Sep 2010 08:15:18 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009110815.o8B8FI1I067637@svn.freebsd.org> From: David Xu Date: Sat, 11 Sep 2010 08:15: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: r212458 - head/share/man/man3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 08:15:18 -0000 Author: davidxu Date: Sat Sep 11 08:15:18 2010 New Revision: 212458 URL: http://svn.freebsd.org/changeset/base/212458 Log: kill() does queue signal now. Modified: head/share/man/man3/siginfo.3 Modified: head/share/man/man3/siginfo.3 ============================================================================== --- head/share/man/man3/siginfo.3 Sat Sep 11 08:09:14 2010 (r212457) +++ head/share/man/man3/siginfo.3 Sat Sep 11 08:15:18 2010 (r212458) @@ -272,10 +272,6 @@ the ID of the message queue which genera Currently, the kernel never generates the .Dv SIGPOLL signal. -Also, the -.Xr kill 2 -system call does not queue signals, so you will not get code -.Dv SI_USER . .Dv SIGCHLD signal is queued when a process changed its status or exited. .Tn POSIX From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 09:20:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07B80106566B; Sat, 11 Sep 2010 09:20:09 +0000 (UTC) (envelope-from niclas.zeising@gmail.com) Received: from mxf2.bahnhof.se (mxf2.bahnhof.se [213.80.101.26]) by mx1.freebsd.org (Postfix) with ESMTP id B3C5A8FC0A; Sat, 11 Sep 2010 09:20:08 +0000 (UTC) Received: from localhost (mxf2.local [127.0.0.1]) by mxf2-reinject (Postfix) with ESMTP id 1CA6096974F; Sat, 11 Sep 2010 10:53:38 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF2) X-Spam-Score: 4.468 X-Spam-Level: **** X-Spam-Status: No, score=4.468 tagged_above=-99 required=5 tests=[DNS_FROM_RFC_POST=1.708, RATWARE_GECKO_BUILD=1.691, SPF_NEUTRAL=1.069] Received: from mxf2.bahnhof.se ([127.0.0.1]) by localhost (mxf2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kiJucamm+3aF; Sat, 11 Sep 2010 10:53:34 +0200 (CEST) Received: from [10.32.0.4] (h-90-99.A163.priv.bahnhof.se [79.136.90.99]) by mxf2.bahnhof.se (Postfix) with ESMTP id 1993496974E; Sat, 11 Sep 2010 10:53:34 +0200 (CEST) Message-ID: <4C8B438B.1040208@gmail.com> Date: Sat, 11 Sep 2010 10:53:31 +0200 From: Niclas Zeising User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: Andriy Gapon References: <201009110809.o8B89EJl066961@svn.freebsd.org> In-Reply-To: <201009110809.o8B89EJl066961@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212457 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 09:20:09 -0000 On 2010-09-11 10:09, Andriy Gapon wrote: > Author: avg > Date: Sat Sep 11 08:09:14 2010 > New Revision: 212457 > URL: http://svn.freebsd.org/changeset/base/212457 > > Log: > make acpi_hp device a child of acpi_wmi > > to properly reflect dependency between the devices/drivers > > PR: kern/147858 > Suggested by: jhb > Tested by: Maciej Suszko > MFC after: 1 week > > Modified: > head/sys/dev/acpi_support/acpi_hp.c > head/sys/dev/acpi_support/acpi_wmi.c > [SNIP CHANGELOG] Thank you! I got bit by this as well last night, but couldn't figure out how to fix it. Best Regards! //Niclas From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 09:24:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A1E4106566C; Sat, 11 Sep 2010 09:24:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id EDA398FC08; Sat, 11 Sep 2010 09:24:35 +0000 (UTC) Received: from besplex.bde.org (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8B9OWgx001528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Sep 2010 19:24:33 +1000 Date: Sat, 11 Sep 2010 19:24:32 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Motin In-Reply-To: <201009110445.o8B4jpoW042563@svn.freebsd.org> Message-ID: <20100911192016.I1055@besplex.bde.org> References: <201009110445.o8B4jpoW042563@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: r212453 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 09:24:36 -0000 On Sat, 11 Sep 2010, Alexander Motin wrote: > Log: > Update PowerPC event timer code to use new event timers infrastructure. What are the advantages of using the new event timers infrastructure? Here it seems to only take longer and cost more (200 more lines of code). Bruce From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 09:26:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70D5B106566B; Sat, 11 Sep 2010 09:26:36 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 605A78FC08; Sat, 11 Sep 2010 09:26: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 o8B9Qaoi076290; Sat, 11 Sep 2010 09:26:36 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B9QarP076288; Sat, 11 Sep 2010 09:26:36 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009110926.o8B9QarP076288@svn.freebsd.org> From: David Xu Date: Sat, 11 Sep 2010 09:26: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: r212459 - head/share/man/man3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 09:26:36 -0000 Author: davidxu Date: Sat Sep 11 09:26:36 2010 New Revision: 212459 URL: http://svn.freebsd.org/changeset/base/212459 Log: Make a link for pthread_timedjoin_np. Modified: head/share/man/man3/Makefile Modified: head/share/man/man3/Makefile ============================================================================== --- head/share/man/man3/Makefile Sat Sep 11 08:15:18 2010 (r212458) +++ head/share/man/man3/Makefile Sat Sep 11 09:26:36 2010 (r212459) @@ -277,6 +277,7 @@ PTHREAD_MLINKS+=pthread_spin_init.3 pthr PTHREAD_MLINKS+=pthread_switch_add_np.3 pthread_switch_delete_np.3 PTHREAD_MLINKS+=pthread_testcancel.3 pthread_setcancelstate.3 \ pthread_testcancel.3 pthread_setcanceltype.3 +PTHREAD_MLINKS+=pthread_join.3 pthread_timedjoin_np.3 .endif .include From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 09:29:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AB011065672; Sat, 11 Sep 2010 09:29:52 +0000 (UTC) (envelope-from niclas.zeising@gmail.com) Received: from mxf1.bahnhof.se (mxf1.bahnhof.se [213.80.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id 22FCE8FC0C; Sat, 11 Sep 2010 09:29:51 +0000 (UTC) Received: from localhost (mxf1.local [127.0.0.1]) by mxf1-reinject (Postfix) with ESMTP id 88E701E3328; Sat, 11 Sep 2010 10:57:08 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF1) X-Spam-Score: 4.245 X-Spam-Level: **** X-Spam-Status: No, score=4.245 tagged_above=-99 required=5 tests=[DNS_FROM_RFC_POST=1.44, RATWARE_GECKO_BUILD=1.426, SPF_NEUTRAL=1.379] Received: from mxf1.bahnhof.se ([127.0.0.1]) by localhost (mxf1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KItLNvg0mIss; Sat, 11 Sep 2010 10:57:04 +0200 (CEST) Received: from [10.32.0.4] (h-90-99.A163.priv.bahnhof.se [79.136.90.99]) by mxf1.bahnhof.se (Postfix) with ESMTP id 75B651E32EC; Sat, 11 Sep 2010 10:57:04 +0200 (CEST) Message-ID: <4C8B445E.3040700@gmail.com> Date: Sat, 11 Sep 2010 10:57:02 +0200 From: Niclas Zeising User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: Andriy Gapon References: <201009110809.o8B89EJl066961@svn.freebsd.org> In-Reply-To: <201009110809.o8B89EJl066961@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212457 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 09:29:52 -0000 On 2010-09-11 10:09, Andriy Gapon wrote: > Author: avg > Date: Sat Sep 11 08:09:14 2010 > New Revision: 212457 > URL: http://svn.freebsd.org/changeset/base/212457 > > Log: > make acpi_hp device a child of acpi_wmi > > to properly reflect dependency between the devices/drivers > > PR: kern/147858 > Suggested by: jhb > Tested by: Maciej Suszko > MFC after: 1 week > [SNIP CHANGES] On another note, acpi_hp, acpi_wmi and probably other acpi_*-devices should be added to amd64 NOTES as well. I'm gonna give these two a more throughout testing but at least they attach properly and I can query the sysctls and the device without problem on a recent amd64 system. Regards! //Niclas From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 09:40:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4DD91065674; Sat, 11 Sep 2010 09:40:09 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id D5A6B8FC0C; Sat, 11 Sep 2010 09:40:08 +0000 (UTC) Received: by bwz20 with SMTP id 20so3576790bwz.13 for ; Sat, 11 Sep 2010 02:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=foy4OtDZmjfZFBXOSWEN4NQ/EaNoydxuhAiiC3I3dU8=; b=djftXEeE3ayWer3Cmvj+FyAce5qnPYSkBQsAHLfCELjJcZDr5XokBEhuxGI+VFTMjU qSyK0yXcVWP7yCuWp/TZ2A9GdtWLf8GAabl+LmnJKiRlpO1mH5Lj2LiHsi1fuYl6teG9 ynUSZkKRrP21NcvRNUKZzggU4pX7Qklskk17I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Ok8cvl4gqYQ/urKGJY1JKiphA1CbSCQy/NZnknwmjc0X1J24Q4F0glgIckJ4QMmXME rozJGjJRxJiEJUhVtsFkI4ck21eyWFzg59ga7vABDd/K6m2mwDdIFSG/iWuHz3sO9KdZ sRnucBIos933J7mZxRHdxyMXrGjukO1XFKJMw= Received: by 10.204.68.144 with SMTP id v16mr1361847bki.58.1284197970964; Sat, 11 Sep 2010 02:39:30 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id g12sm2732939bkb.2.2010.09.11.02.39.27 (version=SSLv3 cipher=RC4-MD5); Sat, 11 Sep 2010 02:39:28 -0700 (PDT) Sender: Alexander Motin Message-ID: <4C8B4E3E.1010401@FreeBSD.org> Date: Sat, 11 Sep 2010 12:39:10 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Bruce Evans References: <201009110445.o8B4jpoW042563@svn.freebsd.org> <20100911192016.I1055@besplex.bde.org> In-Reply-To: <20100911192016.I1055@besplex.bde.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212453 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 09:40:09 -0000 Bruce Evans wrote: > On Sat, 11 Sep 2010, Alexander Motin wrote: > >> Log: >> Update PowerPC event timer code to use new event timers infrastructure. > > What are the advantages of using the new event timers infrastructure? > Here it seems to only take longer and cost more (200 more lines of code). Same as of other architectures. Now mostly unification. With forthcoming one-shot timers patch it will also reduce interrupts in idle, plus reduce aliasing between hardclock and statclock. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 09:40:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7481D106564A; Sat, 11 Sep 2010 09:40:10 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8EF128FC12; Sat, 11 Sep 2010 09:40:09 +0000 (UTC) Received: by bwz20 with SMTP id 20so3576861bwz.13 for ; Sat, 11 Sep 2010 02:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=foy4OtDZmjfZFBXOSWEN4NQ/EaNoydxuhAiiC3I3dU8=; b=djftXEeE3ayWer3Cmvj+FyAce5qnPYSkBQsAHLfCELjJcZDr5XokBEhuxGI+VFTMjU qSyK0yXcVWP7yCuWp/TZ2A9GdtWLf8GAabl+LmnJKiRlpO1mH5Lj2LiHsi1fuYl6teG9 ynUSZkKRrP21NcvRNUKZzggU4pX7Qklskk17I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Ok8cvl4gqYQ/urKGJY1JKiphA1CbSCQy/NZnknwmjc0X1J24Q4F0glgIckJ4QMmXME rozJGjJRxJiEJUhVtsFkI4ck21eyWFzg59ga7vABDd/K6m2mwDdIFSG/iWuHz3sO9KdZ sRnucBIos933J7mZxRHdxyMXrGjukO1XFKJMw= Received: by 10.204.68.144 with SMTP id v16mr1361847bki.58.1284197970964; Sat, 11 Sep 2010 02:39:30 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id g12sm2732939bkb.2.2010.09.11.02.39.27 (version=SSLv3 cipher=RC4-MD5); Sat, 11 Sep 2010 02:39:28 -0700 (PDT) Sender: Alexander Motin Message-ID: <4C8B4E3E.1010401@FreeBSD.org> Date: Sat, 11 Sep 2010 12:39:10 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Bruce Evans References: <201009110445.o8B4jpoW042563@svn.freebsd.org> <20100911192016.I1055@besplex.bde.org> In-Reply-To: <20100911192016.I1055@besplex.bde.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212453 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 09:40:10 -0000 Bruce Evans wrote: > On Sat, 11 Sep 2010, Alexander Motin wrote: > >> Log: >> Update PowerPC event timer code to use new event timers infrastructure. > > What are the advantages of using the new event timers infrastructure? > Here it seems to only take longer and cost more (200 more lines of code). Same as of other architectures. Now mostly unification. With forthcoming one-shot timers patch it will also reduce interrupts in idle, plus reduce aliasing between hardclock and statclock. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 09:53:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 634601065698; Sat, 11 Sep 2010 09:53:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52EDF8FC0C; Sat, 11 Sep 2010 09:53: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 o8B9rXXV078514; Sat, 11 Sep 2010 09:53:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B9rXaq078512; Sat, 11 Sep 2010 09:53:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009110953.o8B9rXaq078512@svn.freebsd.org> From: Alexander Motin Date: Sat, 11 Sep 2010 09:53: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: r212460 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 09:53:33 -0000 Author: mav Date: Sat Sep 11 09:53:33 2010 New Revision: 212460 URL: http://svn.freebsd.org/changeset/base/212460 Log: Fix the build after r212453. IPI_STATCLOCK declaration is still needed for build, though not really used. Submitted by: andreast Modified: head/sys/powerpc/include/smp.h Modified: head/sys/powerpc/include/smp.h ============================================================================== --- head/sys/powerpc/include/smp.h Sat Sep 11 09:26:36 2010 (r212459) +++ head/sys/powerpc/include/smp.h Sat Sep 11 09:53:33 2010 (r212460) @@ -37,6 +37,7 @@ #define IPI_STOP 3 #define IPI_STOP_HARD 3 #define IPI_HARDCLOCK 4 +#define IPI_STATCLOCK 5 #ifndef LOCORE From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 10:11:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F0BF10656A4; Sat, 11 Sep 2010 10:11:59 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EAE68FC13; Sat, 11 Sep 2010 10:11: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 o8BABxhq080122; Sat, 11 Sep 2010 10:11:59 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BABx13080120; Sat, 11 Sep 2010 10:11:59 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009111011.o8BABx13080120@svn.freebsd.org> From: Rui Paulo Date: Sat, 11 Sep 2010 10:11: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: r212461 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 10:11:59 -0000 Author: rpaulo Date: Sat Sep 11 10:11:59 2010 New Revision: 212461 URL: http://svn.freebsd.org/changeset/base/212461 Log: Add a comment describing where to include bsd.dtrace.mk. Sponsored by: The FreeBSD Foundation Modified: head/share/mk/bsd.dtrace.mk Modified: head/share/mk/bsd.dtrace.mk ============================================================================== --- head/share/mk/bsd.dtrace.mk Sat Sep 11 09:53:33 2010 (r212460) +++ head/share/mk/bsd.dtrace.mk Sat Sep 11 10:11:59 2010 (r212461) @@ -29,6 +29,7 @@ # # # The only variable that you should define on your Makefile is 'DTRACEOBJS'. +# You must include this file before bsd.lib.mk or bsd.prog.mk. # .if defined(WITH_DTRACE) From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 10:16:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 335D8106564A; Sat, 11 Sep 2010 10:16:16 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 222E88FC15; Sat, 11 Sep 2010 10:16: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 o8BAGGph080474; Sat, 11 Sep 2010 10:16:16 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BAGG2u080472; Sat, 11 Sep 2010 10:16:16 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009111016.o8BAGG2u080472@svn.freebsd.org> From: Rui Paulo Date: Sat, 11 Sep 2010 10:16: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: r212462 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 10:16:16 -0000 Author: rpaulo Date: Sat Sep 11 10:16:15 2010 New Revision: 212462 URL: http://svn.freebsd.org/changeset/base/212462 Log: Disable debug by default. Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Sat Sep 11 10:11:59 2010 (r212461) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Sat Sep 11 10:16:15 2010 (r212462) @@ -64,7 +64,7 @@ static int gen; /* DOF helper generati #if defined(sun) extern dof_hdr_t __SUNW_dof; /* DOF defined in the .SUNW_dof section */ #endif -static boolean_t dof_init_debug = B_TRUE; /* From DTRACE_DOF_INIT_DEBUG */ +static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */ static void dprintf(int debug, const char *fmt, ...) From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 10:49:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1392F1065674; Sat, 11 Sep 2010 10:49:57 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00A4A8FC08; Sat, 11 Sep 2010 10:49: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 o8BAnuIw083799; Sat, 11 Sep 2010 10:49:56 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BAnu3s083789; Sat, 11 Sep 2010 10:49:56 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111049.o8BAnu3s083789@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 10:49: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: r212463 - in head: bin/test lib/libc/net lib/libc/stdio lib/libc/stdlib secure/lib/libcrypto/man share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 10:49:57 -0000 Author: brucec Date: Sat Sep 11 10:49:56 2010 New Revision: 212463 URL: http://svn.freebsd.org/changeset/base/212463 Log: Revert changes of 'assure' to 'ensure' made in r211936. Approved by: rrs (mentor) Modified: head/bin/test/test.1 head/lib/libc/net/sctp_send.3 head/lib/libc/net/sctp_sendmsg.3 head/lib/libc/stdio/printf.3 head/lib/libc/stdlib/malloc.3 head/secure/lib/libcrypto/man/BIO_s_bio.3 head/share/man/man4/ata.4 head/share/man/man4/ng_hci.4 Modified: head/bin/test/test.1 ============================================================================== --- head/bin/test/test.1 Sat Sep 11 10:16:15 2010 (r212462) +++ head/bin/test/test.1 Sat Sep 11 10:49:56 2010 (r212463) @@ -302,7 +302,7 @@ manual page. The .Nm grammar is inherently ambiguous. -In order to ensure a degree of consistency, +In order to assure a degree of consistency, the cases described in the .St -p1003.2 , section D11.2/4.62.4, standard Modified: head/lib/libc/net/sctp_send.3 ============================================================================== --- head/lib/libc/net/sctp_send.3 Sat Sep 11 10:16:15 2010 (r212462) +++ head/lib/libc/net/sctp_send.3 Sat Sep 11 10:49:56 2010 (r212463) @@ -191,7 +191,7 @@ If that many milliseconds elapse and the peer has not acknowledged the data, the data will be skipped and no longer transmitted. Note that this policy does -not even ensure that the data will ever be sent. +not even assure that the data will ever be sent. In times of a congestion with large amounts of data being queued, the .Fa sinfo->sinfo_timetolive @@ -218,7 +218,7 @@ policy transforms the .Fa sinfo->sinfo_timetolive into a number of retransmissions to allow. This policy -always ensures that at a minimum one send attempt is +always assures that at a minimum one send attempt is made of the data. After which no more than .Fa sinfo->sinfo_timetolive Modified: head/lib/libc/net/sctp_sendmsg.3 ============================================================================== --- head/lib/libc/net/sctp_sendmsg.3 Sat Sep 11 10:16:15 2010 (r212462) +++ head/lib/libc/net/sctp_sendmsg.3 Sat Sep 11 10:49:56 2010 (r212463) @@ -203,7 +203,7 @@ If that many milliseconds elapse and the peer has not acknowledged the data, the data will be skipped and no longer transmitted. Note that this policy does -not even ensure that the data will ever be sent. +not even assure that the data will ever be sent. In times of a congestion with large amounts of data being queued, the .Fa timetolive @@ -230,7 +230,7 @@ policy transforms the .Fa timetolive into a number of retransmissions to allow. This policy -always ensures that at a minimum one send attempt is +always assures that at a minimum one send attempt is made of the data. After which no more than .Fa timetolive Modified: head/lib/libc/stdio/printf.3 ============================================================================== --- head/lib/libc/stdio/printf.3 Sat Sep 11 10:16:15 2010 (r212462) +++ head/lib/libc/stdio/printf.3 Sat Sep 11 10:49:56 2010 (r212463) @@ -849,7 +849,7 @@ and .Fn vsprintf assume an infinitely long string, callers must be careful not to overflow the actual space; -this is often hard to ensure. +this is often hard to assure. For safety, programmers should use the .Fn snprintf interface instead. Modified: head/lib/libc/stdlib/malloc.3 ============================================================================== --- head/lib/libc/stdlib/malloc.3 Sat Sep 11 10:16:15 2010 (r212462) +++ head/lib/libc/stdlib/malloc.3 Sat Sep 11 10:49:56 2010 (r212463) @@ -266,7 +266,7 @@ options are enabled, the allocator prefe but allocation only fails if memory cannot be acquired via either method. If neither option is enabled, then the .Dq M -option is implicitly enabled in order to ensure that there is a method for +option is implicitly enabled in order to assure that there is a method for acquiring memory. .It N Double/halve the number of arenas. @@ -437,7 +437,7 @@ rounded up to the nearest multiple of th .Pp Allocations are packed tightly together, which can be an issue for multi-threaded applications. -If you need to ensure that allocations do not suffer from cacheline sharing, +If you need to assure that allocations do not suffer from cacheline sharing, round your allocation requests up to the nearest multiple of the cacheline size. .Sh DEBUGGING MALLOC PROBLEMS Modified: head/secure/lib/libcrypto/man/BIO_s_bio.3 ============================================================================== --- head/secure/lib/libcrypto/man/BIO_s_bio.3 Sat Sep 11 10:16:15 2010 (r212462) +++ head/secure/lib/libcrypto/man/BIO_s_bio.3 Sat Sep 11 10:49:56 2010 (r212463) @@ -317,7 +317,7 @@ find out, how many bytes must be written .IX Header "WARNING" As the data is buffered, \fISSL_operation()\fR may return with a \s-1ERROR_SSL_WANT_READ\s0 condition, but there is still data in the write buffer. An application must -not rely on the error value of \fISSL_operation()\fR but must ensure that the +not rely on the error value of \fISSL_operation()\fR but must assure that the write buffer is always flushed first. Otherwise a deadlock may occur as the peer might be waiting for the data before being able to continue. .SH "SEE ALSO" Modified: head/share/man/man4/ata.4 ============================================================================== --- head/share/man/man4/ata.4 Sat Sep 11 10:16:15 2010 (r212462) +++ head/share/man/man4/ata.4 Sat Sep 11 10:49:56 2010 (r212463) @@ -243,7 +243,7 @@ based systems Please remember that in order to use UDMA4/ATA66 and above modes you .Em must use 80 conductor cables. -Please ensure that ribbon cables are no longer than 45cm. +Please assure that ribbon cables are no longer than 45cm. In case of rounded ATA cables, the length depends on the quality of the cables. SATA cables can be up to 1m long according to the specification. Modified: head/share/man/man4/ng_hci.4 ============================================================================== --- head/share/man/man4/ng_hci.4 Sat Sep 11 10:16:15 2010 (r212462) +++ head/share/man/man4/ng_hci.4 Sat Sep 11 10:49:56 2010 (r212463) @@ -108,7 +108,7 @@ piconet. Both asynchronous and isochronous services are supported. Between a master and a slave only a single ACL link can exist. For most ACL packets, -packet retransmission is applied to ensure data integrity. +packet retransmission is applied to assure data integrity. .Sh HOST CONTROLLER INTERFACE (HCI) The HCI provides a command interface to the baseband controller and link manager, and access to hardware status and control registers. From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 12:51:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C78D51065674; Sat, 11 Sep 2010 12:51:01 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6BA58FC1A; Sat, 11 Sep 2010 12:51: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 o8BCp1cf096743; Sat, 11 Sep 2010 12:51:01 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BCp1Wr096741; Sat, 11 Sep 2010 12:51:01 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009111251.o8BCp1Wr096741@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 11 Sep 2010 12:51:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212464 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 12:51:01 -0000 Author: jilles Date: Sat Sep 11 12:51:01 2010 New Revision: 212464 URL: http://svn.freebsd.org/changeset/base/212464 Log: MFC r212214: sh: Get rid of some magic numbers. Modified: stable/8/bin/sh/eval.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/eval.c ============================================================================== --- stable/8/bin/sh/eval.c Sat Sep 11 10:49:56 2010 (r212463) +++ stable/8/bin/sh/eval.c Sat Sep 11 12:51:01 2010 (r212464) @@ -896,7 +896,7 @@ cmddone: goto out; parent: /* parent process gets here (if we forked) */ - if (mode == 0) { /* argument to fork */ + if (mode == FORK_FG) { /* argument to fork */ INTOFF; exitstatus = waitforjob(jp, &realstatus); INTON; @@ -904,7 +904,7 @@ parent: /* parent process gets here (if evalskip = SKIPBREAK; skipcount = loopnest; } - } else if (mode == 2) { + } else if (mode == FORK_NOJOB) { backcmd->fd = pip[0]; close(pip[1]); backcmd->jp = jp; From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 12:58:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1ADF106566B; Sat, 11 Sep 2010 12:58:31 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D14B78FC22; Sat, 11 Sep 2010 12:58: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 o8BCwVrb097098; Sat, 11 Sep 2010 12:58:31 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BCwViM097096; Sat, 11 Sep 2010 12:58:31 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009111258.o8BCwViM097096@svn.freebsd.org> From: Rui Paulo Date: Sat, 11 Sep 2010 12:58: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: r212465 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 12:58:32 -0000 Author: rpaulo Date: Sat Sep 11 12:58:31 2010 New Revision: 212465 URL: http://svn.freebsd.org/changeset/base/212465 Log: Avoid a LOR (sleepable after non-sleepable) in fasttrap_tracepoint_enable(). Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Sep 11 12:51:01 2010 (r212464) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Sep 11 12:58:31 2010 (r212465) @@ -591,7 +591,9 @@ fasttrap_tracepoint_enable(proc_t *p, fa * Before we make any modifications, make sure we've imposed a barrier * on the generation in which this probe was last modified. */ + PROC_UNLOCK(p); fasttrap_mod_barrier(probe->ftp_gen); + PROC_LOCK(p); bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 13:06:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED1AA106566B; Sat, 11 Sep 2010 13:06:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCE898FC16; Sat, 11 Sep 2010 13: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 o8BD66No097554; Sat, 11 Sep 2010 13:06:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BD66xa097549; Sat, 11 Sep 2010 13:06:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009111306.o8BD66xa097549@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 11 Sep 2010 13: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: r212466 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 13:06:07 -0000 Author: kib Date: Sat Sep 11 13:06:06 2010 New Revision: 212466 URL: http://svn.freebsd.org/changeset/base/212466 Log: Protect mnt_syncer with the sync_mtx. This prevents a (rare) vnode leak when mount and update are executed in parallel. Encapsulate syncer vnode deallocation into the helper function vfs_deallocate_syncvnode(), to not externalize sync_mtx from vfs_subr.c. Found and reviewed by: jh (previous version of the patch) Tested by: pho MFC after: 3 weeks Modified: head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sat Sep 11 12:58:31 2010 (r212465) +++ head/sys/kern/vfs_mount.c Sat Sep 11 13:06:06 2010 (r212466) @@ -1031,14 +1031,10 @@ vfs_domount_update( */ mp->mnt_optnew = NULL; - if ((mp->mnt_flag & MNT_RDONLY) == 0) { - if (mp->mnt_syncer == NULL) - vfs_allocate_syncvnode(mp); - } else { - if (mp->mnt_syncer != NULL) - vrele(mp->mnt_syncer); - mp->mnt_syncer = NULL; - } + if ((mp->mnt_flag & MNT_RDONLY) == 0) + vfs_allocate_syncvnode(mp); + else + vfs_deallocate_syncvnode(mp); end: vfs_unbusy(mp); VI_LOCK(vp); @@ -1318,8 +1314,7 @@ dounmount(mp, flags, td) mp->mnt_kern_flag &= ~MNTK_ASYNC; MNT_IUNLOCK(mp); cache_purgevfs(mp); /* remove cache entries for this file sys */ - if (mp->mnt_syncer != NULL) - vrele(mp->mnt_syncer); + vfs_deallocate_syncvnode(mp); /* * For forced unmounts, move process cdir/rdir refs on the fs root * vnode to the covered vnode. For non-forced unmounts we want @@ -1358,7 +1353,7 @@ dounmount(mp, flags, td) } MNT_ILOCK(mp); mp->mnt_kern_flag &= ~MNTK_NOINSMNTQ; - if ((mp->mnt_flag & MNT_RDONLY) == 0 && mp->mnt_syncer == NULL) { + if ((mp->mnt_flag & MNT_RDONLY) == 0) { MNT_IUNLOCK(mp); vfs_allocate_syncvnode(mp); MNT_ILOCK(mp); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Sep 11 12:58:31 2010 (r212465) +++ head/sys/kern/vfs_subr.c Sat Sep 11 13:06:06 2010 (r212466) @@ -3405,9 +3405,31 @@ vfs_allocate_syncvnode(struct mount *mp) /* XXX - vn_syncer_add_to_worklist() also grabs and drops sync_mtx. */ mtx_lock(&sync_mtx); sync_vnode_count++; + if (mp->mnt_syncer == NULL) { + mp->mnt_syncer = vp; + vp = NULL; + } mtx_unlock(&sync_mtx); BO_UNLOCK(bo); - mp->mnt_syncer = vp; + if (vp != NULL) { + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vgone(vp); + vput(vp); + } +} + +void +vfs_deallocate_syncvnode(struct mount *mp) +{ + struct vnode *vp; + + mtx_lock(&sync_mtx); + vp = mp->mnt_syncer; + if (vp != NULL) + mp->mnt_syncer = NULL; + mtx_unlock(&sync_mtx); + if (vp != NULL) + vrele(vp); } /* @@ -3488,15 +3510,16 @@ sync_reclaim(struct vop_reclaim_args *ap bo = &vp->v_bufobj; BO_LOCK(bo); - vp->v_mount->mnt_syncer = NULL; + mtx_lock(&sync_mtx); + if (vp->v_mount->mnt_syncer == vp) + vp->v_mount->mnt_syncer = NULL; if (bo->bo_flag & BO_ONWORKLST) { - mtx_lock(&sync_mtx); LIST_REMOVE(bo, bo_synclist); syncer_worklist_len--; sync_vnode_count--; - mtx_unlock(&sync_mtx); bo->bo_flag &= ~BO_ONWORKLST; } + mtx_unlock(&sync_mtx); BO_UNLOCK(bo); return (0); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sat Sep 11 12:58:31 2010 (r212465) +++ head/sys/sys/mount.h Sat Sep 11 13:06:06 2010 (r212466) @@ -731,6 +731,7 @@ int vfs_busy(struct mount *, int); int vfs_export /* process mount export info */ (struct mount *, struct export_args *); void vfs_allocate_syncvnode(struct mount *); +void vfs_deallocate_syncvnode(struct mount *); int vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions); void vfs_getnewfsid(struct mount *); struct cdev *vfs_getrootfsid(struct mount *); From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 13:23:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5EC9106564A; Sat, 11 Sep 2010 13:23:18 +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 256738FC08; Sat, 11 Sep 2010 13:23:17 +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 o8BDNELB093497 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Sep 2010 16:23:14 +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 o8BDNE9O098866; Sat, 11 Sep 2010 16:23:14 +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 o8BDNERZ098865; Sat, 11 Sep 2010 16:23:14 +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: Sat, 11 Sep 2010 16:23:14 +0300 From: Kostik Belousov To: Rui Paulo Message-ID: <20100911132314.GZ2465@deviant.kiev.zoral.com.ua> References: <201009111258.o8BCwViM097096@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DHd0DHvhbdljNSqO" Content-Disposition: inline In-Reply-To: <201009111258.o8BCwViM097096@svn.freebsd.org> 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_20, 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: r212465 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 13:23:18 -0000 --DHd0DHvhbdljNSqO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 11, 2010 at 12:58:31PM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Sat Sep 11 12:58:31 2010 > New Revision: 212465 > URL: http://svn.freebsd.org/changeset/base/212465 >=20 > Log: > Avoid a LOR (sleepable after non-sleepable) in > fasttrap_tracepoint_enable(). > =20 > Sponsored by: The FreeBSD Foundation >=20 > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c >=20 > Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Se= p 11 12:51:01 2010 (r212464) > +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Se= p 11 12:58:31 2010 (r212465) > @@ -591,7 +591,9 @@ fasttrap_tracepoint_enable(proc_t *p, fa > * Before we make any modifications, make sure we've imposed a barrier > * on the generation in which this probe was last modified. > */ > + PROC_UNLOCK(p); > fasttrap_mod_barrier(probe->ftp_gen); > + PROC_LOCK(p); > =20 > bucket =3D &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; > =20 I suspect that you should hold the process around unlocked region. fasttrap_pid_enable() also does unlock, so it might be better to hold the process immediately after pfind(). --DHd0DHvhbdljNSqO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyLgsIACgkQC3+MBN1Mb4jlVwCg48F2wwouG9NZcvAHlW/RulZC lcYAnj6pianC5qnRWHzP9NxG5Z554qi7 =JC/b -----END PGP SIGNATURE----- --DHd0DHvhbdljNSqO-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 13:36:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4268A106566C; Sat, 11 Sep 2010 13:36:32 +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 196928FC1B; Sat, 11 Sep 2010 13:36:31 +0000 (UTC) Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id 2109F24EDBA; Sat, 11 Sep 2010 08:36:31 -0500 (CDT) Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221]) by lavabit.com with ESMTP id YB5A6H24LLZ1; Sat, 11 Sep 2010 08:36:31 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <20100911132314.GZ2465@deviant.kiev.zoral.com.ua> Date: Sat, 11 Sep 2010 14:36:26 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201009111258.o8BCwViM097096@svn.freebsd.org> <20100911132314.GZ2465@deviant.kiev.zoral.com.ua> To: Kostik Belousov X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212465 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 13:36:32 -0000 On 11 Sep 2010, at 14:23, Kostik Belousov wrote: > On Sat, Sep 11, 2010 at 12:58:31PM +0000, Rui Paulo wrote: >> Author: rpaulo >> Date: Sat Sep 11 12:58:31 2010 >> New Revision: 212465 >> URL: http://svn.freebsd.org/changeset/base/212465 >>=20 >> Log: >> Avoid a LOR (sleepable after non-sleepable) in >> fasttrap_tracepoint_enable(). >>=20 >> Sponsored by: The FreeBSD Foundation >>=20 >> Modified: >> head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c >>=20 >> Modified: = head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c = Sat Sep 11 12:51:01 2010 (r212464) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c = Sat Sep 11 12:58:31 2010 (r212465) >> @@ -591,7 +591,9 @@ fasttrap_tracepoint_enable(proc_t *p, fa >> * Before we make any modifications, make sure we've imposed a = barrier >> * on the generation in which this probe was last modified. >> */ >> + PROC_UNLOCK(p); >> fasttrap_mod_barrier(probe->ftp_gen); >> + PROC_LOCK(p); >>=20 >> bucket =3D = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; >>=20 > I suspect that you should hold the process around unlocked region. The unlocked region in the diff ? You're saying I shouldn't unlock/lock = here? > fasttrap_pid_enable() also does unlock, so it might be better to hold > the process immediately after pfind(). You mean use _PHOLD after pfind()? Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 13:46:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B4BE1065670; Sat, 11 Sep 2010 13:46:27 +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 2EFCB8FC1A; Sat, 11 Sep 2010 13:46:26 +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 o8BDkNVs095057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Sep 2010 16:46:23 +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 o8BDkNED098990; Sat, 11 Sep 2010 16:46:23 +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 o8BDkNY5098989; Sat, 11 Sep 2010 16:46:23 +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: Sat, 11 Sep 2010 16:46:23 +0300 From: Kostik Belousov To: Rui Paulo Message-ID: <20100911134623.GA2465@deviant.kiev.zoral.com.ua> References: <201009111258.o8BCwViM097096@svn.freebsd.org> <20100911132314.GZ2465@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k1G2Bc0EDIhoSmEt" 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.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_40, 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: r212465 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 13:46:27 -0000 --k1G2Bc0EDIhoSmEt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 11, 2010 at 02:36:26PM +0100, Rui Paulo wrote: > On 11 Sep 2010, at 14:23, Kostik Belousov wrote: >=20 > > On Sat, Sep 11, 2010 at 12:58:31PM +0000, Rui Paulo wrote: > >> Author: rpaulo > >> Date: Sat Sep 11 12:58:31 2010 > >> New Revision: 212465 > >> URL: http://svn.freebsd.org/changeset/base/212465 > >>=20 > >> Log: > >> Avoid a LOR (sleepable after non-sleepable) in > >> fasttrap_tracepoint_enable(). > >>=20 > >> Sponsored by: The FreeBSD Foundation > >>=20 > >> Modified: > >> head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c > >>=20 > >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap= .c > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > >> --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat= Sep 11 12:51:01 2010 (r212464) > >> +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat= Sep 11 12:58:31 2010 (r212465) > >> @@ -591,7 +591,9 @@ fasttrap_tracepoint_enable(proc_t *p, fa > >> * Before we make any modifications, make sure we've imposed a barrier > >> * on the generation in which this probe was last modified. > >> */ > >> + PROC_UNLOCK(p); > >> fasttrap_mod_barrier(probe->ftp_gen); > >> + PROC_LOCK(p); > >>=20 > >> bucket =3D &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc= )]; > >>=20 > > I suspect that you should hold the process around unlocked region. >=20 > The unlocked region in the diff ? You're saying I shouldn't unlock/lock h= ere? No, I am saying that you should do _PHOLD before dropping process lock. >=20 > > fasttrap_pid_enable() also does unlock, so it might be better to hold > > the process immediately after pfind(). >=20 > You mean use _PHOLD after pfind()? Yes. --k1G2Bc0EDIhoSmEt Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyLiC4ACgkQC3+MBN1Mb4hWigCg2T9Gl+qOBJ9ruB3wPIbl/snY NOcAoJqYouH+clpGVVrPN0NdIA3Zo9Mp =TAoA -----END PGP SIGNATURE----- --k1G2Bc0EDIhoSmEt-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 13:50:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEE71106564A; Sat, 11 Sep 2010 13:50:59 +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 7F7B58FC24; Sat, 11 Sep 2010 13:50:59 +0000 (UTC) Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id E45B516F482; Sat, 11 Sep 2010 08:50:58 -0500 (CDT) Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221]) by lavabit.com with ESMTP id RGM5US656XB8; Sat, 11 Sep 2010 08:50:58 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <20100911134623.GA2465@deviant.kiev.zoral.com.ua> Date: Sat, 11 Sep 2010 14:50:55 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201009111258.o8BCwViM097096@svn.freebsd.org> <20100911132314.GZ2465@deviant.kiev.zoral.com.ua> <20100911134623.GA2465@deviant.kiev.zoral.com.ua> To: Kostik Belousov X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212465 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 13:50:59 -0000 On 11 Sep 2010, at 14:46, Kostik Belousov wrote: > On Sat, Sep 11, 2010 at 02:36:26PM +0100, Rui Paulo wrote: >> On 11 Sep 2010, at 14:23, Kostik Belousov wrote: >>=20 >>> On Sat, Sep 11, 2010 at 12:58:31PM +0000, Rui Paulo wrote: >>>> Author: rpaulo >>>> Date: Sat Sep 11 12:58:31 2010 >>>> New Revision: 212465 >>>> URL: http://svn.freebsd.org/changeset/base/212465 >>>>=20 >>>> Log: >>>> Avoid a LOR (sleepable after non-sleepable) in >>>> fasttrap_tracepoint_enable(). >>>>=20 >>>> Sponsored by: The FreeBSD Foundation >>>>=20 >>>> Modified: >>>> head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c >>>>=20 >>>> Modified: = head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c = Sat Sep 11 12:51:01 2010 (r212464) >>>> +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c = Sat Sep 11 12:58:31 2010 (r212465) >>>> @@ -591,7 +591,9 @@ fasttrap_tracepoint_enable(proc_t *p, fa >>>> * Before we make any modifications, make sure we've imposed a = barrier >>>> * on the generation in which this probe was last modified. >>>> */ >>>> + PROC_UNLOCK(p); >>>> fasttrap_mod_barrier(probe->ftp_gen); >>>> + PROC_LOCK(p); >>>>=20 >>>> bucket =3D = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)]; >>>>=20 >>> I suspect that you should hold the process around unlocked region. >>=20 >> The unlocked region in the diff ? You're saying I shouldn't = unlock/lock here? > No, I am saying that you should do _PHOLD before dropping process = lock. That makes a lot more sense. Will do it, thanks. >=20 >>=20 >>> fasttrap_pid_enable() also does unlock, so it might be better to = hold >>> the process immediately after pfind(). >>=20 >> You mean use _PHOLD after pfind()? > Yes. >=20 >=20 > = __________________________________________________________________________= __________ > Use the link below to report this message as spam. > https://lavabit.com/apps/teacher?sig=3D1329875&key=3D731402291 > = __________________________________________________________________________= __________ Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:15:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DFD81065674; Sat, 11 Sep 2010 14:15:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D3888FC17; Sat, 11 Sep 2010 14:15: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 o8BEFogQ004090; Sat, 11 Sep 2010 14:15:50 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BEFoJP004087; Sat, 11 Sep 2010 14:15:50 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009111415.o8BEFoJP004087@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 11 Sep 2010 14:15: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: r212467 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:15:50 -0000 Author: jilles Date: Sat Sep 11 14:15:50 2010 New Revision: 212467 URL: http://svn.freebsd.org/changeset/base/212467 Log: sh: Apply variable assignments left-to-right in bltinlookup(). Example: HOME=foo HOME=bar cd Added: head/tools/regression/bin/sh/execution/var-assign1.0 (contents, props changed) Modified: head/bin/sh/var.c Modified: head/bin/sh/var.c ============================================================================== --- head/bin/sh/var.c Sat Sep 11 13:06:06 2010 (r212466) +++ head/bin/sh/var.c Sat Sep 11 14:15:50 2010 (r212467) @@ -431,11 +431,15 @@ bltinlookup(const char *name, int doall) { struct strlist *sp; struct var *v; + char *result; + result = NULL; for (sp = cmdenviron ; sp ; sp = sp->next) { if (varequal(sp->text, name)) - return strchr(sp->text, '=') + 1; + result = strchr(sp->text, '=') + 1; } + if (result != NULL) + return result; for (v = *hashvar(name) ; v ; v = v->next) { if (varequal(v->text, name)) { if ((v->flags & VUNSET) Added: head/tools/regression/bin/sh/execution/var-assign1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/var-assign1.0 Sat Sep 11 14:15:50 2010 (r212467) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +[ "$(HOME=/etc HOME=/ cd && pwd)" = / ] From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:18:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BEEA1065672; Sat, 11 Sep 2010 14:18:31 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60B808FC17; Sat, 11 Sep 2010 14:18: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 o8BEIV9R004300; Sat, 11 Sep 2010 14:18:31 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BEIVtC004299; Sat, 11 Sep 2010 14:18:31 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111418.o8BEIVtC004299@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 14:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212468 - stable/8/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:18:31 -0000 Author: brucec Date: Sat Sep 11 14:18:30 2010 New Revision: 212468 URL: http://svn.freebsd.org/changeset/base/212468 Log: MFC r206909: It's not necessary to reset the chip every time an input overflow event occurs. In addition, the delay when programming the short cable fix should be 100us, not 100ms. PR: kern/64556 Approved by: rrs (mentor) Modified: stable/8/sys/dev/sis/if_sis.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/sis/if_sis.c ============================================================================== --- stable/8/sys/dev/sis/if_sis.c Sat Sep 11 14:15:50 2010 (r212467) +++ stable/8/sys/dev/sis/if_sis.c Sat Sep 11 14:18:30 2010 (r212468) @@ -1483,15 +1483,6 @@ sis_rxeof(struct sis_softc *sc) return (rx_npkts); } -static void -sis_rxeoc(struct sis_softc *sc) -{ - - SIS_LOCK_ASSERT(sc); - sis_rxeof(sc); - sis_initl(sc); -} - /* * A frame was downloaded to the chip. It's safe for us to clean up * the list buffers. @@ -1614,7 +1605,7 @@ sis_poll(struct ifnet *ifp, enum poll_cm status = CSR_READ_4(sc, SIS_ISR); if (status & (SIS_ISR_RX_ERR|SIS_ISR_RX_OFLOW)) - sis_rxeoc(sc); + ifp->if_ierrors++; if (status & (SIS_ISR_RX_IDLE)) SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); @@ -1672,7 +1663,7 @@ sis_intr(void *arg) sis_rxeof(sc); if (status & SIS_ISR_RX_OFLOW) - sis_rxeoc(sc); + ifp->if_ierrors++; if (status & (SIS_ISR_RX_IDLE)) SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); @@ -2017,7 +2008,7 @@ sis_initl(struct sis_softc *sc) CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001); reg = CSR_READ_4(sc, NS_PHY_DSPCFG) & 0xfff; CSR_WRITE_4(sc, NS_PHY_DSPCFG, reg | 0x1000); - DELAY(100000); + DELAY(100); reg = CSR_READ_4(sc, NS_PHY_TDATA) & 0xff; if ((reg & 0x0080) == 0 || (reg > 0xd8 && reg <= 0xff)) { device_printf(sc->sis_dev, From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:21:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5402D106566B; Sat, 11 Sep 2010 14:21:03 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2885C8FC17; Sat, 11 Sep 2010 14:21: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 o8BEL31m004494; Sat, 11 Sep 2010 14:21:03 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BEL3bc004492; Sat, 11 Sep 2010 14:21:03 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111421.o8BEL3bc004492@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 14:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212469 - stable/7/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:21:03 -0000 Author: brucec Date: Sat Sep 11 14:21:02 2010 New Revision: 212469 URL: http://svn.freebsd.org/changeset/base/212469 Log: MFC r206909: It's not necessary to reset the chip every time an input overflow event occurs. In addition, the delay when programming the short cable fix should be 100us, not 100ms. PR: kern/64556 Submitted by: Thomas Hurst Approved by: rrs (mentor) Modified: stable/7/sys/dev/sis/if_sis.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sis/if_sis.c ============================================================================== --- stable/7/sys/dev/sis/if_sis.c Sat Sep 11 14:18:30 2010 (r212468) +++ stable/7/sys/dev/sis/if_sis.c Sat Sep 11 14:21:02 2010 (r212469) @@ -1480,15 +1480,6 @@ sis_rxeof(struct sis_softc *sc) sc->sis_rx_pdsc = cur_rx; } -static void -sis_rxeoc(struct sis_softc *sc) -{ - - SIS_LOCK_ASSERT(sc); - sis_rxeof(sc); - sis_initl(sc); -} - /* * A frame was downloaded to the chip. It's safe for us to clean up * the list buffers. @@ -1610,7 +1601,7 @@ sis_poll(struct ifnet *ifp, enum poll_cm status = CSR_READ_4(sc, SIS_ISR); if (status & (SIS_ISR_RX_ERR|SIS_ISR_RX_OFLOW)) - sis_rxeoc(sc); + ifp->if_ierrors++; if (status & (SIS_ISR_RX_IDLE)) SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); @@ -1667,7 +1658,7 @@ sis_intr(void *arg) sis_rxeof(sc); if (status & SIS_ISR_RX_OFLOW) - sis_rxeoc(sc); + ifp->if_ierrors++; if (status & (SIS_ISR_RX_IDLE)) SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); @@ -2012,7 +2003,7 @@ sis_initl(struct sis_softc *sc) CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001); reg = CSR_READ_4(sc, NS_PHY_DSPCFG) & 0xfff; CSR_WRITE_4(sc, NS_PHY_DSPCFG, reg | 0x1000); - DELAY(100000); + DELAY(100); reg = CSR_READ_4(sc, NS_PHY_TDATA) & 0xff; if ((reg & 0x0080) == 0 || (reg > 0xd8 && reg <= 0xff)) { device_printf(sc->sis_dev, From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:26:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5F1F10656C1; Sat, 11 Sep 2010 14:26:18 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D52778FC17; Sat, 11 Sep 2010 14:26: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 o8BEQIXJ004851; Sat, 11 Sep 2010 14:26:18 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BEQINf004849; Sat, 11 Sep 2010 14:26:18 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111426.o8BEQINf004849@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 14:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212470 - stable/8/contrib/top X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:26:19 -0000 Author: brucec Date: Sat Sep 11 14:26:18 2010 New Revision: 212470 URL: http://svn.freebsd.org/changeset/base/212470 Log: MFC r211419: Since top displays the uptime including seconds, there is no need to add 30 onto it, which may have been used for rounding purposes in other utilities. PR: bin/147934 Submitted by: Janne Snabb Approved by: rrs (mentor) Modified: stable/8/contrib/top/display.c Directory Properties: stable/8/contrib/top/ (props changed) stable/8/contrib/top/install-sh (props changed) Modified: stable/8/contrib/top/display.c ============================================================================== --- stable/8/contrib/top/display.c Sat Sep 11 14:21:02 2010 (r212469) +++ stable/8/contrib/top/display.c Sat Sep 11 14:26:18 2010 (r212470) @@ -1273,7 +1273,6 @@ time_t *tod; if (bt->tv_sec != -1) { uptime = *tod - bt->tv_sec; - uptime += 30; days = uptime / 86400; uptime %= 86400; hrs = uptime / 3600; From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:29:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D3E81065672; Sat, 11 Sep 2010 14:29:31 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C86B8FC20; Sat, 11 Sep 2010 14:29: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 o8BETVuX005098; Sat, 11 Sep 2010 14:29:31 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BETVJb005096; Sat, 11 Sep 2010 14:29:31 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111429.o8BETVJb005096@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 14:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212471 - stable/7/contrib/top X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:29:31 -0000 Author: brucec Date: Sat Sep 11 14:29:31 2010 New Revision: 212471 URL: http://svn.freebsd.org/changeset/base/212471 Log: MFC r211419: Since top displays the uptime including seconds, there is no need to add 30 onto it, which may have been used for rounding purposes in other utilities. PR: bin/147934 Submitted by: Janne Snabb Approved by: rrs (mentor) Modified: stable/7/contrib/top/display.c Directory Properties: stable/7/contrib/top/ (props changed) Modified: stable/7/contrib/top/display.c ============================================================================== --- stable/7/contrib/top/display.c Sat Sep 11 14:26:18 2010 (r212470) +++ stable/7/contrib/top/display.c Sat Sep 11 14:29:31 2010 (r212471) @@ -1273,7 +1273,6 @@ time_t *tod; if (bt->tv_sec != -1) { uptime = *tod - bt->tv_sec; - uptime += 30; days = uptime / 86400; uptime %= 86400; hrs = uptime / 3600; From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:34:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA71310656A3; Sat, 11 Sep 2010 14:34:16 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8D9C8FC13; Sat, 11 Sep 2010 14:34: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 o8BEYG3W005527; Sat, 11 Sep 2010 14:34:16 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BEYGn7005524; Sat, 11 Sep 2010 14:34:16 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111434.o8BEYGn7005524@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 14:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212472 - stable/8/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:34:17 -0000 Author: brucec Date: Sat Sep 11 14:34:16 2010 New Revision: 212472 URL: http://svn.freebsd.org/changeset/base/212472 Log: MFC r211415: Add -m and -M options to control the minimum and maximum frequency. PR: bin/145063 Submitted by: Boris Kochergin Approved by: rrs (mentor) Modified: stable/8/usr.sbin/powerd/powerd.8 stable/8/usr.sbin/powerd/powerd.c Directory Properties: stable/8/usr.sbin/powerd/ (props changed) Modified: stable/8/usr.sbin/powerd/powerd.8 ============================================================================== --- stable/8/usr.sbin/powerd/powerd.8 Sat Sep 11 14:29:31 2010 (r212471) +++ stable/8/usr.sbin/powerd/powerd.8 Sat Sep 11 14:34:16 2010 (r212472) @@ -35,6 +35,8 @@ .Op Fl a Ar mode .Op Fl b Ar mode .Op Fl i Ar percent +.Op Fl m Ar freq +.Op Fl M Ar freq .Op Fl n Ar mode .Op Fl p Ar ival .Op Fl P Ar pidfile @@ -79,6 +81,10 @@ to use while on battery power. Specifies the CPU load percent level when adaptive mode should begin to degrade performance to save power. The default is 50% or lower. +.It Fl m Ar freq +Specifies the minimum frequency to throttle down to. +.It Fl M Ar freq +Specifies the maximum frequency to throttle up to. .It Fl n Ar mode Selects the .Ar mode Modified: stable/8/usr.sbin/powerd/powerd.c ============================================================================== --- stable/8/usr.sbin/powerd/powerd.c Sat Sep 11 14:29:31 2010 (r212471) +++ stable/8/usr.sbin/powerd/powerd.c Sat Sep 11 14:34:16 2010 (r212472) @@ -80,7 +80,8 @@ const char *modes[] = { #define DEVCTL_MAXBUF 1024 static int read_usage_times(int *load); -static int read_freqs(int *numfreqs, int **freqs, int **power); +static int read_freqs(int *numfreqs, int **freqs, int **power, + int minfreq, int maxfreq); static int set_freq(int freq); static void acline_init(void); static void acline_read(void); @@ -170,10 +171,10 @@ read_usage_times(int *load) } static int -read_freqs(int *numfreqs, int **freqs, int **power) +read_freqs(int *numfreqs, int **freqs, int **power, int minfreq, int maxfreq) { char *freqstr, *p, *q; - int i; + int i, j; size_t len = 0; if (sysctl(levels_mib, 4, NULL, &len, NULL, 0)) @@ -197,19 +198,30 @@ read_freqs(int *numfreqs, int **freqs, i free(*freqs); return (-1); } - for (i = 0, p = freqstr; i < *numfreqs; i++) { + for (i = 0, j = 0, p = freqstr; i < *numfreqs; i++) { q = strchr(p, ' '); if (q != NULL) *q = '\0'; - if (sscanf(p, "%d/%d", &(*freqs)[i], &(*power)[i]) != 2) { + if (sscanf(p, "%d/%d", &(*freqs)[j], &(*power)[i]) != 2) { free(freqstr); free(*freqs); free(*power); return (-1); } + if (((*freqs)[j] >= minfreq || minfreq == -1) && + ((*freqs)[j] <= maxfreq || maxfreq == -1)) + j++; p = q + 1; } + *numfreqs = j; + if ((*freqs = realloc(*freqs, *numfreqs * sizeof(int))) == NULL) { + free(freqstr); + free(*freqs); + free(*power); + return (-1); + } + free(freqstr); return (0); } @@ -418,7 +430,7 @@ usage(void) { fprintf(stderr, -"usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-n mode] [-p ival] [-r %%] [-P pidfile]\n"); +"usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-m freq] [-M freq] [-n mode] [-p ival] [-r %%] [-P pidfile]\n"); exit(1); } @@ -431,7 +443,8 @@ main(int argc, char * argv[]) struct pidfh *pfh = NULL; const char *pidfile = NULL; int freq, curfreq, initfreq, *freqs, i, j, *mwatts, numfreqs, load; - int ch, mode, mode_ac, mode_battery, mode_none; + int ch, mode, mode_ac, mode_battery, mode_none, idle; + int minfreq = -1, maxfreq = -1; uint64_t mjoules_used; size_t len; @@ -448,7 +461,7 @@ main(int argc, char * argv[]) if (geteuid() != 0) errx(1, "must be root to run"); - while ((ch = getopt(argc, argv, "a:b:i:n:p:P:r:v")) != -1) + while ((ch = getopt(argc, argv, "a:b:i:m:M:n:p:P:r:v")) != -1) switch (ch) { case 'a': parse_mode(optarg, &mode_ac, ch); @@ -464,6 +477,22 @@ main(int argc, char * argv[]) usage(); } break; + case 'm': + minfreq = atoi(optarg); + if (minfreq < 0) { + warnx("%d is not a valid CPU frequency", + minfreq); + usage(); + } + break; + case 'M': + maxfreq = atoi(optarg); + if (maxfreq < 0) { + warnx("%d is not a valid CPU frequency", + maxfreq); + usage(); + } + break; case 'n': parse_mode(optarg, &mode_none, ch); break; @@ -511,8 +540,10 @@ main(int argc, char * argv[]) /* Check if we can read the load and supported freqs. */ if (read_usage_times(NULL)) err(1, "read_usage_times"); - if (read_freqs(&numfreqs, &freqs, &mwatts)) + if (read_freqs(&numfreqs, &freqs, &mwatts, minfreq, maxfreq)) err(1, "error reading supported CPU frequencies"); + if (numfreqs == 0) + errx(1, "no CPU frequencies in user-specified range"); /* Run in the background unless in verbose mode. */ if (!vflag) { @@ -547,6 +578,50 @@ main(int argc, char * argv[]) freq = initfreq = get_freq(); if (freq < 1) freq = 1; + + /* + * If we are in adaptive mode and the current frequency is outside the + * user-defined range, adjust it to be within the user-defined range. + */ + acline_read(); + if (acline_status > SRC_UNKNOWN) + errx(1, "invalid AC line status %d", acline_status); + if ((acline_status == SRC_AC && + (mode_ac == MODE_ADAPTIVE || mode_ac == MODE_HIADAPTIVE)) || + (acline_status == SRC_BATTERY && + (mode_battery == MODE_ADAPTIVE || mode_battery == MODE_HIADAPTIVE)) || + (acline_status == SRC_UNKNOWN && + (mode_none == MODE_ADAPTIVE || mode_none == MODE_HIADAPTIVE))) { + /* Read the current frequency. */ + len = sizeof(curfreq); + if (sysctl(freq_mib, 4, &curfreq, &len, NULL, 0) != 0) { + if (vflag) + warn("error reading current CPU frequency"); + } + if (curfreq < freqs[numfreqs - 1]) { + if (vflag) { + printf("CPU frequency is below user-defined " + "minimum; changing frequency to %d " + "MHz\n", freqs[numfreqs - 1]); + } + if (set_freq(freqs[numfreqs - 1]) != 0) { + warn("error setting CPU freq %d", + freqs[numfreqs - 1]); + } + } else if (curfreq > freqs[0]) { + if (vflag) { + printf("CPU frequency is above user-defined " + "maximum; changing frequency to %d " + "MHz\n", freqs[0]); + } + if (set_freq(freqs[0]) != 0) { + warn("error setting CPU freq %d", + freqs[0]); + } + } + } + + idle = 0; /* Main loop. */ for (;;) { FD_ZERO(&fdset); From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:39:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72EED106564A; Sat, 11 Sep 2010 14:39:53 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 610E18FC12; Sat, 11 Sep 2010 14:39: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 o8BEdrCY005931; Sat, 11 Sep 2010 14:39:53 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BEdrKd005928; Sat, 11 Sep 2010 14:39:53 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111439.o8BEdrKd005928@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 14:39:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212473 - stable/7/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:39:53 -0000 Author: brucec Date: Sat Sep 11 14:39:53 2010 New Revision: 212473 URL: http://svn.freebsd.org/changeset/base/212473 Log: MFC r211415: Add -m and -M options to control the minimum and maximum frequency. PR: bin/145063 Submitted by: Boris Kochergin Approved by: rrs (mentor) Modified: stable/7/usr.sbin/powerd/powerd.8 stable/7/usr.sbin/powerd/powerd.c Directory Properties: stable/7/usr.sbin/powerd/ (props changed) Modified: stable/7/usr.sbin/powerd/powerd.8 ============================================================================== --- stable/7/usr.sbin/powerd/powerd.8 Sat Sep 11 14:34:16 2010 (r212472) +++ stable/7/usr.sbin/powerd/powerd.8 Sat Sep 11 14:39:53 2010 (r212473) @@ -35,6 +35,8 @@ .Op Fl a Ar mode .Op Fl b Ar mode .Op Fl i Ar percent +.Op Fl m Ar freq +.Op Fl M Ar freq .Op Fl n Ar mode .Op Fl p Ar ival .Op Fl P Ar pidfile @@ -78,6 +80,10 @@ to use while on battery power. Specifies the CPU load percent level when adaptive mode should begin to degrade performance to save power. The default is 50% or lower. +.It Fl m Ar freq +Specifies the minimum frequency to throttle down to. +.It Fl M Ar freq +Specifies the maximum frequency to throttle up to. .It Fl n Ar mode Selects the .Ar mode Modified: stable/7/usr.sbin/powerd/powerd.c ============================================================================== --- stable/7/usr.sbin/powerd/powerd.c Sat Sep 11 14:34:16 2010 (r212472) +++ stable/7/usr.sbin/powerd/powerd.c Sat Sep 11 14:39:53 2010 (r212473) @@ -79,7 +79,8 @@ const char *modes[] = { #define DEVCTL_MAXBUF 1024 static int read_usage_times(int *load); -static int read_freqs(int *numfreqs, int **freqs, int **power); +static int read_freqs(int *numfreqs, int **freqs, int **power, + int minfreq, int maxfreq); static int set_freq(int freq); static void acline_init(void); static void acline_read(void); @@ -168,10 +169,10 @@ read_usage_times(int *load) } static int -read_freqs(int *numfreqs, int **freqs, int **power) +read_freqs(int *numfreqs, int **freqs, int **power, int minfreq, int maxfreq) { char *freqstr, *p, *q; - int i; + int i, j; size_t len = 0; if (sysctl(levels_mib, 4, NULL, &len, NULL, 0)) @@ -195,19 +196,30 @@ read_freqs(int *numfreqs, int **freqs, i free(*freqs); return (-1); } - for (i = 0, p = freqstr; i < *numfreqs; i++) { + for (i = 0, j = 0, p = freqstr; i < *numfreqs; i++) { q = strchr(p, ' '); if (q != NULL) *q = '\0'; - if (sscanf(p, "%d/%d", &(*freqs)[i], &(*power)[i]) != 2) { + if (sscanf(p, "%d/%d", &(*freqs)[j], &(*power)[i]) != 2) { free(freqstr); free(*freqs); free(*power); return (-1); } + if (((*freqs)[j] >= minfreq || minfreq == -1) && + ((*freqs)[j] <= maxfreq || maxfreq == -1)) + j++; p = q + 1; } + *numfreqs = j; + if ((*freqs = realloc(*freqs, *numfreqs * sizeof(int))) == NULL) { + free(freqstr); + free(*freqs); + free(*power); + return (-1); + } + free(freqstr); return (0); } @@ -410,7 +422,7 @@ usage(void) { fprintf(stderr, -"usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-n mode] [-p ival] [-r %%] [-P pidfile]\n"); +"usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-m freq] [-M freq] [-n mode] [-p ival] [-r %%] [-P pidfile]\n"); exit(1); } @@ -424,6 +436,7 @@ main(int argc, char * argv[]) const char *pidfile = NULL; int freq, curfreq, initfreq, *freqs, i, j, *mwatts, numfreqs, load; int ch, mode, mode_ac, mode_battery, mode_none; + int minfreq = -1, maxfreq = -1; uint64_t mjoules_used; size_t len; @@ -440,7 +453,7 @@ main(int argc, char * argv[]) if (geteuid() != 0) errx(1, "must be root to run"); - while ((ch = getopt(argc, argv, "a:b:i:n:p:P:r:v")) != -1) + while ((ch = getopt(argc, argv, "a:b:i:m:M:n:p:P:r:v")) != -1) switch (ch) { case 'a': parse_mode(optarg, &mode_ac, ch); @@ -456,6 +469,22 @@ main(int argc, char * argv[]) usage(); } break; + case 'm': + minfreq = atoi(optarg); + if (minfreq < 0) { + warnx("%d is not a valid CPU frequency", + minfreq); + usage(); + } + break; + case 'M': + maxfreq = atoi(optarg); + if (maxfreq < 0) { + warnx("%d is not a valid CPU frequency", + maxfreq); + usage(); + } + break; case 'n': parse_mode(optarg, &mode_none, ch); break; @@ -503,8 +532,10 @@ main(int argc, char * argv[]) /* Check if we can read the load and supported freqs. */ if (read_usage_times(NULL)) err(1, "read_usage_times"); - if (read_freqs(&numfreqs, &freqs, &mwatts)) + if (read_freqs(&numfreqs, &freqs, &mwatts, minfreq, maxfreq)) err(1, "error reading supported CPU frequencies"); + if (numfreqs == 0) + errx(1, "no CPU frequencies in user-specified range"); /* Run in the background unless in verbose mode. */ if (!vflag) { @@ -539,6 +570,49 @@ main(int argc, char * argv[]) freq = initfreq = get_freq(); if (freq < 1) freq = 1; + + /* + * If we are in adaptive mode and the current frequency is outside the + * user-defined range, adjust it to be within the user-defined range. + */ + acline_read(); + if (acline_status > SRC_UNKNOWN) + errx(1, "invalid AC line status %d", acline_status); + if ((acline_status == SRC_AC && + (mode_ac == MODE_ADAPTIVE || mode_ac == MODE_HIADAPTIVE)) || + (acline_status == SRC_BATTERY && + (mode_battery == MODE_ADAPTIVE || mode_battery == MODE_HIADAPTIVE)) || + (acline_status == SRC_UNKNOWN && + (mode_none == MODE_ADAPTIVE || mode_none == MODE_HIADAPTIVE))) { + /* Read the current frequency. */ + len = sizeof(curfreq); + if (sysctl(freq_mib, 4, &curfreq, &len, NULL, 0) != 0) { + if (vflag) + warn("error reading current CPU frequency"); + } + if (curfreq < freqs[numfreqs - 1]) { + if (vflag) { + printf("CPU frequency is below user-defined " + "minimum; changing frequency to %d " + "MHz\n", freqs[numfreqs - 1]); + } + if (set_freq(freqs[numfreqs - 1]) != 0) { + warn("error setting CPU freq %d", + freqs[numfreqs - 1]); + } + } else if (curfreq > freqs[0]) { + if (vflag) { + printf("CPU frequency is above user-defined " + "maximum; changing frequency to %d " + "MHz\n", freqs[0]); + } + if (set_freq(freqs[0]) != 0) { + warn("error setting CPU freq %d", + freqs[0]); + } + } + } + /* Main loop. */ for (;;) { FD_ZERO(&fdset); From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:46:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDEAC1065670; Sat, 11 Sep 2010 14:46:20 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACBF58FC1A; Sat, 11 Sep 2010 14:46: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 o8BEkJEQ006555; Sat, 11 Sep 2010 14:46:19 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BEkJUR006553; Sat, 11 Sep 2010 14:46:19 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009111446.o8BEkJUR006553@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 14:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212474 - stable/7/sys/boot/forth X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:46:20 -0000 Author: brucec Date: Sat Sep 11 14:46:19 2010 New Revision: 212474 URL: http://svn.freebsd.org/changeset/base/212474 Log: MFC r182194: Add geom_journal PR: conf/126829 Approved by: rrs (mentor) Modified: stable/7/sys/boot/forth/loader.conf Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/forth/loader.conf ============================================================================== --- stable/7/sys/boot/forth/loader.conf Sat Sep 11 14:39:53 2010 (r212473) +++ stable/7/sys/boot/forth/loader.conf Sat Sep 11 14:46:19 2010 (r212474) @@ -149,6 +149,7 @@ geom_concat_load="NO" # Concatenated di geom_eli_load="NO" # Disk encryption driver (see geli(8)) geom_gate_load="NO" # Userland disk driver (see geom_gate(4), # ggatec(8), ggated(8), ggatel(8)) +geom_journal_load="NO" # Journaled filesystem driver (see gjournal(8)) geom_label_load="NO" # File system labels (see glabel(8)) geom_md_load="NO" # Memory disk driver (vnode/swap/malloc) (see # md(4), mdconfig(8)) From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 14:53:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE32A106566C; Sat, 11 Sep 2010 14:53:37 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from april.london.02.net (april.london.02.net [87.194.255.143]) by mx1.freebsd.org (Postfix) with ESMTP id 485428FC08; Sat, 11 Sep 2010 14:53:37 +0000 (UTC) Received: from core.draftnet (94.193.93.212) by april.london.02.net (8.5.124.10) id 4C888693001259A8; Sat, 11 Sep 2010 15:42:16 +0100 From: Bruce Cran To: Bruce Cran Date: Sat, 11 Sep 2010 15:42:15 +0100 User-Agent: KMail/1.13.5 (FreeBSD/9.0-CURRENT; KDE/4.5.1; amd64; ; ) References: <201009111434.o8BEYGn7005524@svn.freebsd.org> In-Reply-To: <201009111434.o8BEYGn7005524@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009111542.15446.bruce@cran.org.uk> Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r212472 - stable/8/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 14:53:37 -0000 On Saturday 11 September 2010 15:34:16 Bruce Cran wrote: > Author: brucec > Date: Sat Sep 11 14:34:16 2010 > New Revision: 212472 > URL: http://svn.freebsd.org/changeset/base/212472 > > Log: > MFC r211415: > > Add -m and -M options to control the minimum and maximum frequency. > > PR: bin/145063 > Submitted by: Boris Kochergin > Approved by: rrs (mentor) > > Modified: > stable/8/usr.sbin/powerd/powerd.8 > stable/8/usr.sbin/powerd/powerd.c > Directory Properties: > stable/8/usr.sbin/powerd/ (props changed) > > [...] > + int ch, mode, mode_ac, mode_battery, mode_none, idle; > [...] > + idle = 0; 'idle' shouldn't have been merged here. I'll fix it in a followup checkin. -- Bruce Cran From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 15:01:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D71D106566B; Sat, 11 Sep 2010 15:01:10 +0000 (UTC) (envelope-from itetcu@FreeBSD.org) Received: from worf.ds9.tecnik93.com (worf.ds9.tecnik93.com [81.196.207.130]) by mx1.freebsd.org (Postfix) with ESMTP id 034218FC08; Sat, 11 Sep 2010 15:01:09 +0000 (UTC) Received: from it.buh.tecnik93.com (it.buh.tecnik93.com [81.196.204.98]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by worf.ds9.tecnik93.com (Postfix) with ESMTPSA id 267F522C52F1; Sat, 11 Sep 2010 17:43:43 +0300 (EEST) Date: Sat, 11 Sep 2010 17:43:41 +0300 From: Ion-Mihai Tetcu To: Bruce Cran Message-ID: <20100911174341.660a78dc@it.buh.tecnik93.com> In-Reply-To: <201009111434.o8BEYGn7005524@svn.freebsd.org> References: <201009111434.o8BEYGn7005524@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd8.1) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/N4J35v=KX2vRJ1O=o80Ym6m"; protocol="application/pgp-signature" Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r212472 - stable/8/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 15:01:10 -0000 --Sig_/N4J35v=KX2vRJ1O=o80Ym6m Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 11 Sep 2010 14:34:16 +0000 (UTC) Bruce Cran wrote: > Author: brucec > Date: Sat Sep 11 14:34:16 2010 > New Revision: 212472 > URL: http://svn.freebsd.org/changeset/base/212472 >=20 > Log: > MFC r211415: > =20 > Add -m and -M options to control the minimum and maximum frequency. > =20 > PR: bin/145063 > Submitted by: Boris Kochergin > Approved by: rrs (mentor) Thank you! --=20 IOnut - Un^d^dregistered ;) FreeBSD "user" "Intellectual Property" is nowhere near as valuable as "Intellect" FreeBSD committer -> itetcu@FreeBSD.org, PGP Key ID 057E9F8B493A297B --Sig_/N4J35v=KX2vRJ1O=o80Ym6m Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkyLlZ4ACgkQJ7GIuiH/oeXHTQCeNodT/PjjW7hjCF6Sd3iGWT6c yhwAoLi60U4LeHyZwBTbQnZCzLbtednc =R0t+ -----END PGP SIGNATURE----- --Sig_/N4J35v=KX2vRJ1O=o80Ym6m-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 15:07:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6E06106567A; Sat, 11 Sep 2010 15:07:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95D7A8FC1A; Sat, 11 Sep 2010 15: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 o8BF7emZ008372; Sat, 11 Sep 2010 15:07:40 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BF7e0k008368; Sat, 11 Sep 2010 15:07:40 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009111507.o8BF7e0k008368@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 11 Sep 2010 15: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: r212475 - in head: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 15:07:40 -0000 Author: jilles Date: Sat Sep 11 15:07:40 2010 New Revision: 212475 URL: http://svn.freebsd.org/changeset/base/212475 Log: sh: Fix exit status if return is used within a loop condition. Added: head/tools/regression/bin/sh/builtins/return6.4 (contents, props changed) head/tools/regression/bin/sh/builtins/return7.4 (contents, props changed) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sat Sep 11 14:46:19 2010 (r212474) +++ head/bin/sh/eval.c Sat Sep 11 15:07:40 2010 (r212475) @@ -305,6 +305,8 @@ skipping: if (evalskip == SKIPCONT && } if (evalskip == SKIPBREAK && --skipcount <= 0) evalskip = 0; + if (evalskip == SKIPFUNC || evalskip == SKIPFILE) + status = exitstatus; break; } if (n->type == NWHILE) { Added: head/tools/regression/bin/sh/builtins/return6.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/return6.4 Sat Sep 11 15:07:40 2010 (r212475) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +while return 4; do exit 3; done Added: head/tools/regression/bin/sh/builtins/return7.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/return7.4 Sat Sep 11 15:07:40 2010 (r212475) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +f() { + while return 4; do exit 3; done +} +f From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 18:50:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 497E1106566B; Sat, 11 Sep 2010 18:50:34 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37E038FC17; Sat, 11 Sep 2010 18:50: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 o8BIoYi0028632; Sat, 11 Sep 2010 18:50:34 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BIoYem028630; Sat, 11 Sep 2010 18:50:34 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201009111850.o8BIoYem028630@svn.freebsd.org> From: Gavin Atkinson Date: Sat, 11 Sep 2010 18:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212476 - stable/8/usr.bin/split X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 18:50:34 -0000 Author: gavin Date: Sat Sep 11 18:50:33 2010 New Revision: 212476 URL: http://svn.freebsd.org/changeset/base/212476 Log: Merge r212162 from head: Correct spelling mistake, int -> into Modified: stable/8/usr.bin/split/split.1 Directory Properties: stable/8/usr.bin/split/ (props changed) Modified: stable/8/usr.bin/split/split.1 ============================================================================== --- stable/8/usr.bin/split/split.1 Sat Sep 11 15:07:40 2010 (r212475) +++ stable/8/usr.bin/split/split.1 Sat Sep 11 18:50:33 2010 (r212476) @@ -32,7 +32,7 @@ .\" @(#)split.1 8.3 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd January 23, 2009 +.Dd September 2, 2010 .Dt SPLIT 1 .Os .Sh NAME @@ -117,7 +117,7 @@ Create split files .Ar line_count lines in length. .It Fl n Ar chunk_count -Split file int +Split file into .Ar chunk_count smaller files. .It Fl p Ar pattern From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 18:55:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD3BD1065672; Sat, 11 Sep 2010 18:55:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B86088FC24; Sat, 11 Sep 2010 18:55: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 o8BIt0Zg029093; Sat, 11 Sep 2010 18:55:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BIt00G029087; Sat, 11 Sep 2010 18:55:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009111855.o8BIt00G029087@svn.freebsd.org> From: Marius Strobl Date: Sat, 11 Sep 2010 18:55: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: r212477 - in head/sys: dev/ofw powerpc/ofw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 18:55:00 -0000 Author: marius Date: Sat Sep 11 18:55:00 2010 New Revision: 212477 URL: http://svn.freebsd.org/changeset/base/212477 Log: Change OF_interpret() to also take an array of cell_t (missed in r209801). Reviewed by: nwhitehorn Modified: head/sys/dev/ofw/ofw_fdt.c head/sys/dev/ofw/ofw_if.m head/sys/dev/ofw/ofw_standard.c head/sys/dev/ofw/openfirm.c head/sys/powerpc/ofw/ofw_real.c Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Sat Sep 11 18:50:33 2010 (r212476) +++ head/sys/dev/ofw/ofw_fdt.c Sat Sep 11 18:55:00 2010 (r212477) @@ -66,7 +66,7 @@ static ssize_t ofw_fdt_canon(ofw_t, cons static phandle_t ofw_fdt_finddevice(ofw_t, const char *); static ssize_t ofw_fdt_instance_to_path(ofw_t, ihandle_t, char *, size_t); static ssize_t ofw_fdt_package_to_path(ofw_t, phandle_t, char *, size_t); -static int ofw_fdt_interpret(ofw_t, const char *, int, unsigned long *); +static int ofw_fdt_interpret(ofw_t, const char *, int, cell_t *); static ofw_method_t ofw_fdt_methods[] = { OFWMETHOD(ofw_init, ofw_fdt_init), @@ -435,7 +435,7 @@ ofw_fdt_fixup(ofw_t ofw) } static int -ofw_fdt_interpret(ofw_t ofw, const char *cmd, int nret, unsigned long *retvals) +ofw_fdt_interpret(ofw_t ofw, const char *cmd, int nret, cell_t *retvals) { int rv; Modified: head/sys/dev/ofw/ofw_if.m ============================================================================== --- head/sys/dev/ofw/ofw_if.m Sat Sep 11 18:50:33 2010 (r212476) +++ head/sys/dev/ofw/ofw_if.m Sat Sep 11 18:55:00 2010 (r212477) @@ -244,7 +244,7 @@ METHOD int interpret { ofw_t _ofw; const char *_cmd; int _nreturns; - unsigned long *_returns; + cell_t *_returns; }; # Device I/O Functions (optional) Modified: head/sys/dev/ofw/ofw_standard.c ============================================================================== --- head/sys/dev/ofw/ofw_standard.c Sat Sep 11 18:50:33 2010 (r212476) +++ head/sys/dev/ofw/ofw_standard.c Sat Sep 11 18:55:00 2010 (r212477) @@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$"); static int ofw_std_init(ofw_t ofw, void *openfirm); static int ofw_std_test(ofw_t ofw, const char *name); static int ofw_std_interpret(ofw_t ofw, const char *cmd, int nreturns, - unsigned long *returns); + cell_t *returns); static phandle_t ofw_std_peer(ofw_t ofw, phandle_t node); static phandle_t ofw_std_child(ofw_t ofw, phandle_t node); static phandle_t ofw_std_parent(ofw_t ofw, phandle_t node); @@ -94,8 +94,7 @@ static ssize_t ofw_std_instance_to_path( static ssize_t ofw_std_package_to_path(ofw_t ofw, phandle_t package, char *buf, size_t len); static int ofw_std_call_method(ofw_t ofw, ihandle_t instance, - const char *method, int nargs, int nreturns, - cell_t *args_and_returns); + const char *method, int nargs, int nreturns, cell_t *args_and_returns); static ihandle_t ofw_std_open(ofw_t ofw, const char *device); static void ofw_std_close(ofw_t ofw, ihandle_t instance); static ssize_t ofw_std_read(ofw_t ofw, ihandle_t instance, void *addr, @@ -185,8 +184,7 @@ ofw_std_test(ofw_t ofw, const char *name } static int -ofw_std_interpret(ofw_t ofw, const char *cmd, int nreturns, - unsigned long *returns) +ofw_std_interpret(ofw_t ofw, const char *cmd, int nreturns, cell_t *returns) { struct { cell_t name; @@ -529,7 +527,7 @@ ofw_std_call_method(ofw_t ofw, ihandle_t 2, 1, }; - cell_t *cp, *ap; + cell_t *ap, *cp; int n; if (nargs > 6) Modified: head/sys/dev/ofw/openfirm.c ============================================================================== --- head/sys/dev/ofw/openfirm.c Sat Sep 11 18:50:33 2010 (r212476) +++ head/sys/dev/ofw/openfirm.c Sat Sep 11 18:55:00 2010 (r212477) @@ -165,7 +165,7 @@ int OF_interpret(const char *cmd, int nreturns, ...) { va_list ap; - unsigned long slots[16]; + cell_t slots[16]; int i = 0; int status; Modified: head/sys/powerpc/ofw/ofw_real.c ============================================================================== --- head/sys/powerpc/ofw/ofw_real.c Sat Sep 11 18:50:33 2010 (r212476) +++ head/sys/powerpc/ofw/ofw_real.c Sat Sep 11 18:55:00 2010 (r212477) @@ -101,7 +101,7 @@ static ssize_t ofw_real_package_to_path( static int ofw_real_call_method(ofw_t, ihandle_t instance, const char *method, int nargs, int nreturns, cell_t *args_and_returns); static int ofw_real_interpret(ofw_t ofw, const char *cmd, int nreturns, - unsigned long *returns); + cell_t *returns); static ihandle_t ofw_real_open(ofw_t, const char *device); static void ofw_real_close(ofw_t, ihandle_t instance); static ssize_t ofw_real_read(ofw_t, ihandle_t instance, void *addr, size_t len); @@ -756,7 +756,7 @@ ofw_real_call_method(ofw_t ofw, ihandle_ cell_t instance; cell_t args_n_results[12]; } args; - cell_t *cp, *ap; + cell_t *ap, *cp; int n; args.name = (cell_t)(uintptr_t)"call-method"; @@ -791,8 +791,7 @@ ofw_real_call_method(ofw_t ofw, ihandle_ } static int -ofw_real_interpret(ofw_t ofw, const char *cmd, int nreturns, - unsigned long *returns) +ofw_real_interpret(ofw_t ofw, const char *cmd, int nreturns, cell_t *returns) { vm_offset_t argsptr; struct { From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 19:02:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 912F81065670; Sat, 11 Sep 2010 19:02:51 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 095E48FC08; Sat, 11 Sep 2010 19:02:50 +0000 (UTC) Received: by vws7 with SMTP id 7so4080151vws.13 for ; Sat, 11 Sep 2010 12:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=ib1ZmBZH+1UDXgBotJjy3nlQGAg0GGadAyIV5Ef86yw=; b=KbRHecRxS6/jPunKkeNN5vmGhdxi09i453nmHPlP/x7Zi/E3r3GpXSuoM0OzdwTFG6 r4F6R6skC0qZmlxgzzEXp9yu1ULA4M95HMjBzm1PQkxN08aXa3o5tICiBREfNJz0UDIQ KRWFW5Dz2iEUhSTMD+d2adnbXU9JuZ+EKhtRs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=RGa6og1fpiEFPoAykxUDsUAAQ+dBfOHJ3y8eq3P2bkALnPOea4EyEaEJjzFcTFb4w+ 5S1ok8Mb0vFHD7e8uRp0lxF8fedOXl/XU1uuA4gHGX8zi7xEA2mFij2qH4drSWRjnzpz ll+SOxTe/ZvMrGRk2h/sSNy4J9Uel5+rpUrjI= Received: by 10.220.72.84 with SMTP id l20mr66998vcj.90.1284231769284; Sat, 11 Sep 2010 12:02:49 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id w1sm2586203vbl.8.2010.09.11.12.02.47 (version=SSLv3 cipher=RC4-MD5); Sat, 11 Sep 2010 12:02:48 -0700 (PDT) Date: Sat, 11 Sep 2010 15:02:42 -0400 From: Alexander Kabaev To: Matthew D Fleming Message-ID: <20100911150242.714ef287@kan.dnsalias.net> In-Reply-To: <201009091749.o89HnI0q012855@svn.freebsd.org> References: <201009091749.o89HnI0q012855@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/EjeclXe.uA8kbHX6JlUymQf"; protocol="application/pgp-signature" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212367 - in head: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 19:02:51 -0000 --Sig_/EjeclXe.uA8kbHX6JlUymQf Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 9 Sep 2010 17:49:18 +0000 (UTC) Matthew D Fleming wrote: > Author: mdf > Date: Thu Sep 9 17:49:18 2010 > New Revision: 212367 > URL: http://svn.freebsd.org/changeset/base/212367 >=20 > Log: > Add drain functionality to sbufs. The drain is a function that is > called when the sbuf internal buffer is filled. For kernel sbufs > with a drain, the internal buffer will never be expanded. For > userland sbufs with a drain, the internal buffer may still be > expanded by sbuf_[v]printf(3). > =20 > Sbufs now have three basic uses: > 1) static string manipulation. Overflow is marked. > 2) dynamic string manipulation. Overflow triggers string growth. > 3) drained string manipulation. Overflow triggers draining. > =20 > In all cases the manipulation is 'safe' in that overflow is > detected and managed. > =20 > Reviewed by: phk (the previous version) >=20 This one is responsible for hangs on my amd64 test box. --=20 Alexander Kabaev --Sig_/EjeclXe.uA8kbHX6JlUymQf Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFMi9JWQ6z1jMm+XZYRAnGOAJ4vQZYmtrli+X1GTjsmZXnlLwkUxQCcCvWD qmCBc7/YslVCmFU8BA8ElSw= =XkMQ -----END PGP SIGNATURE----- --Sig_/EjeclXe.uA8kbHX6JlUymQf-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 19:07:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13866106566B; Sat, 11 Sep 2010 19:07:29 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7FBD58FC15; Sat, 11 Sep 2010 19:07:28 +0000 (UTC) Received: by vws7 with SMTP id 7so4082442vws.13 for ; Sat, 11 Sep 2010 12:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=NeWhg7TRhcOYjI0eJOJ/2n8zkGBakNAOYY8UAScijOM=; b=kzHpYbozfc0sLOdB5re4Oh+wEfvJ3V87a+zfCbVsmqeJ26D7h5+/Sw3t1AtXzOKEvK ys1WElNX3/xC6EfsbJ7VcAOwBOWis08HZwZPVTuI0tNzjtMXzeJf+d8xpoJre59wclHe 0QUKAtfen5aOQVg2+M4jRtRD42PFhV99MP32w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=DCCNuVnKe/7k+ND4DZtMOIQUMToHieMRmTl8ufmulZxm4v9FGwA3wWuGY/T5n/ecbc vdkiztNu6bVMBzuAx0aV72NVijsSxEqbfyuuy6BLP2PLjJb5B+7ZssnwKRLTmogK1O+b eXcjZiDKHw7RWUAl/JywoGXcB6voOiIcb2mCU= Received: by 10.220.168.12 with SMTP id s12mr1591190vcy.100.1284232047584; Sat, 11 Sep 2010 12:07:27 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id p26sm1787748vcr.3.2010.09.11.12.07.26 (version=SSLv3 cipher=RC4-MD5); Sat, 11 Sep 2010 12:07:26 -0700 (PDT) Date: Sat, 11 Sep 2010 15:07:21 -0400 From: Alexander Kabaev To: Matthew D Fleming Message-ID: <20100911150721.0dbd2873@kan.dnsalias.net> In-Reply-To: <201009091651.o89Gpqeo007050@svn.freebsd.org> References: <201009091651.o89Gpqeo007050@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/f_DKXNrdmEDN2jV043iWzoa"; protocol="application/pgp-signature" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212365 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 19:07:29 -0000 --Sig_/f_DKXNrdmEDN2jV043iWzoa Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 9 Sep 2010 16:51:52 +0000 (UTC) Matthew D Fleming wrote: > Author: mdf > Date: Thu Sep 9 16:51:52 2010 > New Revision: 212365 > URL: http://svn.freebsd.org/changeset/base/212365 >=20 > Log: > Refactor sbuf code so that most uses of sbuf_extend() are in a new > sbuf_put_byte(). This makes it easier to add drain functionality > when a buffer would overflow as there are fewer code points. > =20 Please disregard my previous report. This is the revision that causes the hang, according to git bisect. --=20 Alexander Kabaev --Sig_/f_DKXNrdmEDN2jV043iWzoa Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFMi9NtQ6z1jMm+XZYRAg2eAKCKqJc7WnKtuqnZ/hO5U2dcgdaD+gCg6wKL fj+vxsh03cingWVYkYncxEs= =0qZc -----END PGP SIGNATURE----- --Sig_/f_DKXNrdmEDN2jV043iWzoa-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 19:42:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C03D1065675; Sat, 11 Sep 2010 19:42:51 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFACA8FC14; Sat, 11 Sep 2010 19:42: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 o8BJgo15032976; Sat, 11 Sep 2010 19:42:50 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BJgocS032974; Sat, 11 Sep 2010 19:42:50 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201009111942.o8BJgocS032974@svn.freebsd.org> From: Alexander Kabaev Date: Sat, 11 Sep 2010 19:42: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: r212478 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 19:42:51 -0000 Author: kan Date: Sat Sep 11 19:42:50 2010 New Revision: 212478 URL: http://svn.freebsd.org/changeset/base/212478 Log: Add missing pointer increment to sbuf_cat. Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Sat Sep 11 18:55:00 2010 (r212477) +++ head/sys/kern/subr_sbuf.c Sat Sep 11 19:42:50 2010 (r212478) @@ -441,7 +441,7 @@ sbuf_cat(struct sbuf *s, const char *str return (-1); while (*str != '\0') { - sbuf_put_byte(*str, s); + sbuf_put_byte(*str++, s); if (s->s_error != 0) return (-1); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 20:18:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F72D1065672; Sat, 11 Sep 2010 20:18:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F0178FC13; Sat, 11 Sep 2010 20:18: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 o8BKIFFb035549; Sat, 11 Sep 2010 20:18:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BKIFuv035547; Sat, 11 Sep 2010 20:18:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009112018.o8BKIFuv035547@svn.freebsd.org> From: Alexander Motin Date: Sat, 11 Sep 2010 20:18: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: r212479 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 20:18:15 -0000 Author: mav Date: Sat Sep 11 20:18:15 2010 New Revision: 212479 URL: http://svn.freebsd.org/changeset/base/212479 Log: Do not print "frequency 0 Hz", when frequency is unknown. Modified: head/sys/kern/kern_et.c Modified: head/sys/kern/kern_et.c ============================================================================== --- head/sys/kern/kern_et.c Sat Sep 11 19:42:50 2010 (r212478) +++ head/sys/kern/kern_et.c Sat Sep 11 20:18:15 2010 (r212479) @@ -52,9 +52,15 @@ et_register(struct eventtimer *et) struct eventtimer *tmp, *next; if (et->et_quality >= 0 || bootverbose) { - printf("Event timer \"%s\" frequency %ju Hz quality %d\n", - et->et_name, (uintmax_t)et->et_frequency, - et->et_quality); + if (et->et_frequency == 0) { + printf("Event timer \"%s\" quality %d\n", + et->et_name, et->et_quality); + } else { + printf("Event timer \"%s\" " + "frequency %ju Hz quality %d\n", + et->et_name, (uintmax_t)et->et_frequency, + et->et_quality); + } } et->et_sysctl = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_kern_eventtimer_et), OID_AUTO, et->et_name, From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 21:49:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F518106566C; Sat, 11 Sep 2010 21:49:28 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EA798FC0C; Sat, 11 Sep 2010 21:49: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 o8BLnShV045359; Sat, 11 Sep 2010 21:49:28 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BLnSY7045357; Sat, 11 Sep 2010 21:49:28 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009112149.o8BLnSY7045357@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 11 Sep 2010 21:49: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: r212480 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 21:49:28 -0000 Author: weongyo Date: Sat Sep 11 21:49:28 2010 New Revision: 212480 URL: http://svn.freebsd.org/changeset/base/212480 Log: Mentions cases when bwi(4) driver should be used that it only wrote about chipset type instead of card names because it's not easy to sort names what cards use these chipsets. Pointed by: imp Modified: head/share/man/man4/bwn.4 Modified: head/share/man/man4/bwn.4 ============================================================================== --- head/share/man/man4/bwn.4 Sat Sep 11 20:18:15 2010 (r212479) +++ head/share/man/man4/bwn.4 Sat Sep 11 21:49:28 2010 (r212480) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 6, 2010 +.Dd September 11, 2010 .Dt BWN 4 .Os .Sh NAME @@ -92,6 +92,13 @@ driver supports Broadcom BCM43xx based w .It "TRENDnet TEW-401PCplus BCM4306 CardBus b/g" .It "US Robotics 5411 BCM4318 CardBus b/g" .El +.Pp +However if the device chipset is one of BCM4301, BCM4303 and BCM4306 rev 2, +uses +.Xr bwi 4 +instead of +.Xr bwn 4 +because the vendor dropped the firmware support. .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): .Pp From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 21:52:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDEC5106564A; Sat, 11 Sep 2010 21:52:40 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC8D88FC1E; Sat, 11 Sep 2010 21:52: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 o8BLqew2045693; Sat, 11 Sep 2010 21:52:40 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BLqeYS045691; Sat, 11 Sep 2010 21:52:40 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201009112152.o8BLqeYS045691@svn.freebsd.org> From: Bruce Cran Date: Sat, 11 Sep 2010 21:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212481 - stable/8/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 21:52:40 -0000 Author: brucec Date: Sat Sep 11 21:52:40 2010 New Revision: 212481 URL: http://svn.freebsd.org/changeset/base/212481 Log: Remove unused variable 'idle' which mistakenly got merged in r212472. Approved by: rrs (mentor) Modified: stable/8/usr.sbin/powerd/powerd.c Modified: stable/8/usr.sbin/powerd/powerd.c ============================================================================== --- stable/8/usr.sbin/powerd/powerd.c Sat Sep 11 21:49:28 2010 (r212480) +++ stable/8/usr.sbin/powerd/powerd.c Sat Sep 11 21:52:40 2010 (r212481) @@ -443,7 +443,7 @@ main(int argc, char * argv[]) struct pidfh *pfh = NULL; const char *pidfile = NULL; int freq, curfreq, initfreq, *freqs, i, j, *mwatts, numfreqs, load; - int ch, mode, mode_ac, mode_battery, mode_none, idle; + int ch, mode, mode_ac, mode_battery, mode_none; int minfreq = -1, maxfreq = -1; uint64_t mjoules_used; size_t len; @@ -621,7 +621,6 @@ main(int argc, char * argv[]) } } - idle = 0; /* Main loop. */ for (;;) { FD_ZERO(&fdset); From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 22:02:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 738331065670; Sat, 11 Sep 2010 22:02:36 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 605E18FC08; Sat, 11 Sep 2010 22:02: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 o8BM2aOE046743; Sat, 11 Sep 2010 22:02:36 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BM2aJL046730; Sat, 11 Sep 2010 22:02:36 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201009112202.o8BM2aJL046730@svn.freebsd.org> From: Will Andrews Date: Sat, 11 Sep 2010 22:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212482 - in stable/8/sys: modules modules/if_carp net netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 22:02:36 -0000 Author: will Date: Sat Sep 11 22:02:36 2010 New Revision: 212482 URL: http://svn.freebsd.org/changeset/base/212482 Log: MFC r211157, r211193, r212265, r212266: make it possible to load carp(4) as a kld using function pointer hooks and {pf_,ip,ip6}proto_{un,}register(). Reviewed by: bz Approved by: ken (mentor) Added: stable/8/sys/modules/if_carp/ - copied from r211157, head/sys/modules/if_carp/ Modified: stable/8/sys/modules/Makefile stable/8/sys/net/if.c stable/8/sys/net/if_bridge.c stable/8/sys/net/if_ethersubr.c stable/8/sys/netinet/if_ether.c stable/8/sys/netinet/in.c stable/8/sys/netinet/in_proto.c stable/8/sys/netinet/ip_carp.c stable/8/sys/netinet/ip_carp.h stable/8/sys/netinet/ip_input.c stable/8/sys/netinet6/in6_proto.c stable/8/sys/netinet6/nd6_nbr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/modules/Makefile ============================================================================== --- stable/8/sys/modules/Makefile Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/modules/Makefile Sat Sep 11 22:02:36 2010 (r212482) @@ -111,6 +111,7 @@ SUBDIR= ${_3dfx} \ ${_ida} \ ${_ie} \ if_bridge \ + if_carp \ if_disc \ if_edsc \ if_ef \ Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/net/if.c Sat Sep 11 22:02:36 2010 (r212482) @@ -33,7 +33,6 @@ #include "opt_compat.h" #include "opt_inet6.h" #include "opt_inet.h" -#include "opt_carp.h" #include "opt_ddb.h" #include @@ -81,6 +80,7 @@ /*XXX*/ #include #include +#include #ifdef INET6 #include #include @@ -89,11 +89,6 @@ #ifdef INET #include #endif -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP -#include -#endif -#endif #include @@ -128,6 +123,22 @@ SX_SYSINIT(ifdescr_sx, &ifdescr_sx, "ifn void (*bstp_linkstate_p)(struct ifnet *ifp, int state); void (*ng_ether_link_state_p)(struct ifnet *ifp, int state); void (*lagg_linkstate_p)(struct ifnet *ifp, int state); +/* These are external hooks for CARP. */ +void (*carp_linkstate_p)(struct ifnet *ifp); +#if defined(INET) || defined(INET6) +struct ifnet *(*carp_forus_p)(struct ifnet *ifp, u_char *dhost); +int (*carp_output_p)(struct ifnet *ifp, struct mbuf *m, + struct sockaddr *sa, struct rtentry *rt); +#endif +#ifdef INET +int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, struct in_addr *, + u_int8_t **); +#endif +#ifdef INET6 +struct ifaddr *(*carp_iamatch6_p)(struct ifnet *ifp, struct in6_addr *taddr6); +caddr_t (*carp_macmatch6_p)(struct ifnet *ifp, struct mbuf *m, + const struct in6_addr *taddr); +#endif struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL; @@ -1851,12 +1862,8 @@ if_unroute(struct ifnet *ifp, int flag, pfctlinput(PRC_IFDOWN, ifa->ifa_addr); ifp->if_qflush(ifp); -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp) - carp_carpdev_state(ifp->if_carp); -#endif -#endif + (*carp_linkstate_p)(ifp); rt_ifmsg(ifp); } @@ -1877,12 +1884,8 @@ if_route(struct ifnet *ifp, int flag, in TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFUP, ifa->ifa_addr); -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp) - carp_carpdev_state(ifp->if_carp); -#endif -#endif + (*carp_linkstate_p)(ifp); rt_ifmsg(ifp); #ifdef INET6 in6_if_up(ifp); @@ -1925,12 +1928,8 @@ do_link_state_change(void *arg, int pend if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) && IFP2AC(ifp)->ac_netgraph != NULL) (*ng_ether_link_state_p)(ifp, link_state); -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp) - carp_carpdev_state(ifp->if_carp); -#endif -#endif + (*carp_linkstate_p)(ifp); if (ifp->if_bridge) { KASSERT(bstp_linkstate_p != NULL,("if_bridge bstp not loaded!")); (*bstp_linkstate_p)(ifp, link_state); Modified: stable/8/sys/net/if_bridge.c ============================================================================== --- stable/8/sys/net/if_bridge.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/net/if_bridge.c Sat Sep 11 22:02:36 2010 (r212482) @@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_carp.h" #include #include @@ -121,10 +120,8 @@ __FBSDID("$FreeBSD$"); #include #endif #if defined(INET) || defined(INET6) -#ifdef DEV_CARP #include #endif -#endif #include #include /* for struct arpcom */ #include @@ -2252,13 +2249,13 @@ bridge_input(struct ifnet *ifp, struct m return (m); } -#if (defined(INET) || defined(INET6)) && defined(DEV_CARP) +#if (defined(INET) || defined(INET6)) # define OR_CARP_CHECK_WE_ARE_DST(iface) \ || ((iface)->if_carp \ - && carp_forus((iface)->if_carp, eh->ether_dhost)) + && (*carp_forus_p)((iface), eh->ether_dhost)) # define OR_CARP_CHECK_WE_ARE_SRC(iface) \ || ((iface)->if_carp \ - && carp_forus((iface)->if_carp, eh->ether_shost)) + && (*carp_forus_p)((iface), eh->ether_shost)) #else # define OR_CARP_CHECK_WE_ARE_DST(iface) # define OR_CARP_CHECK_WE_ARE_SRC(iface) Modified: stable/8/sys/net/if_ethersubr.c ============================================================================== --- stable/8/sys/net/if_ethersubr.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/net/if_ethersubr.c Sat Sep 11 22:02:36 2010 (r212482) @@ -35,7 +35,6 @@ #include "opt_inet6.h" #include "opt_ipx.h" #include "opt_netgraph.h" -#include "opt_carp.h" #include "opt_mbuf_profiling.h" #include @@ -70,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -78,12 +78,6 @@ #include #endif -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP -#include -#endif -#endif - #ifdef IPX #include #include @@ -402,12 +396,10 @@ ether_output(struct ifnet *ifp, struct m } #if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp && - (error = carp_output(ifp, m, dst, NULL))) + (error = (*carp_output_p)(ifp, m, dst, NULL))) goto bad; #endif -#endif /* Handle ng_ether(4) processing, if any */ if (IFP2AC(ifp)->ac_netgraph != NULL) { @@ -727,7 +719,6 @@ ether_input(struct ifnet *ifp, struct mb } #if defined(INET) || defined(INET6) -#ifdef DEV_CARP /* * Clear M_PROMISC on frame so that carp(4) will see it when the * mbuf flows up to Layer 3. @@ -738,11 +729,10 @@ ether_input(struct ifnet *ifp, struct mb * TODO: Maintain a hash table of ethernet addresses other than * ether_dhost which may be active on this ifp. */ - if (ifp->if_carp && carp_forus(ifp->if_carp, eh->ether_dhost)) { + if (ifp->if_carp && (*carp_forus_p)(ifp, eh->ether_dhost)) { m->m_flags &= ~M_PROMISC; } else #endif -#endif { /* * If the frame received was not for our MAC address, set the Modified: stable/8/sys/netinet/if_ether.c ============================================================================== --- stable/8/sys/netinet/if_ether.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet/if_ether.c Sat Sep 11 22:02:36 2010 (r212482) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" -#include "opt_carp.h" #include #include @@ -65,14 +64,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if defined(INET) || defined(INET6) +#include +#endif #include #include -#ifdef DEV_CARP -#include -#endif - #include #define SIN(s) ((struct sockaddr_in *)s) @@ -494,9 +492,7 @@ in_arpinput(struct mbuf *m) int op, flags; int req_len; int bridged = 0, is_bridge = 0; -#ifdef DEV_CARP int carp_match = 0; -#endif struct sockaddr_in sin; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_family = AF_INET; @@ -539,16 +535,14 @@ in_arpinput(struct mbuf *m) IN_IFADDR_RUNLOCK(); goto match; } -#ifdef DEV_CARP if (ifp->if_carp != NULL && - carp_iamatch(ifp->if_carp, ia, &isaddr, &enaddr) && + (*carp_iamatch_p)(ifp, ia, &isaddr, &enaddr) && itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { carp_match = 1; ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); goto match; } -#endif } LIST_FOREACH(ia, INADDR_HASH(isaddr.s_addr), ia_hash) if (((bridged && ia->ia_ifp->if_bridge != NULL) || @@ -648,11 +642,7 @@ match: IF_AFDATA_UNLOCK(ifp); if (la != NULL) { /* the following is not an error when doing bridging */ - if (!bridged && la->lle_tbl->llt_ifp != ifp -#ifdef DEV_CARP - && (ifp->if_type != IFT_CARP || !carp_match) -#endif - ) { + if (!bridged && la->lle_tbl->llt_ifp != ifp && !carp_match) { if (log_arp_wrong_iface) log(LOG_ERR, "arp: %s is on %s " "but got reply from %*D on %s\n", Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet/in.c Sat Sep 11 22:02:36 2010 (r212482) @@ -33,7 +33,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_carp.h" #include "opt_mpath.h" #include @@ -891,13 +890,11 @@ in_ifinit(struct ifnet *ifp, struct in_i ia->ia_net = i & ia->ia_netmask; ia->ia_subnet = i & ia->ia_subnetmask; in_socktrim(&ia->ia_sockmask); -#ifdef DEV_CARP /* * XXX: carp(4) does not have interface route */ if (ifp->if_type == IFT_CARP) return (0); -#endif /* * Add route for the network. */ @@ -1153,12 +1150,12 @@ in_scrubprefix(struct in_ifaddr *target) * the route itself to it. Make sure that routing daemons * get a heads-up. * - * XXX: a special case for carp(4) interface + * XXX: a special case for carp(4) interface - this should + * be more generally specified as an interface that + * doesn't support such action. */ if ((ia->ia_flags & IFA_ROUTE) == 0 -#ifdef DEV_CARP && (ia->ia_ifp->if_type != IFT_CARP) -#endif ) { IN_IFADDR_RUNLOCK(); rtinit(&(target->ia_ifa), (int)RTM_DELETE, Modified: stable/8/sys/netinet/in_proto.c ============================================================================== --- stable/8/sys/netinet/in_proto.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet/in_proto.c Sat Sep 11 22:02:36 2010 (r212482) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ipsec.h" #include "opt_inet6.h" #include "opt_pf.h" -#include "opt_carp.h" #include "opt_sctp.h" #include "opt_mpath.h" @@ -94,10 +93,6 @@ static struct pr_usrreqs nousrreqs; #include #endif -#ifdef DEV_CARP -#include -#endif - extern struct domain inetdomain; /* Spacer for loadable protocols. */ @@ -330,18 +325,6 @@ struct protosw inetsw[] = { .pr_usrreqs = &rip_usrreqs }, #endif /* DEV_PFSYNC */ -#ifdef DEV_CARP -{ - .pr_type = SOCK_RAW, - .pr_domain = &inetdomain, - .pr_protocol = IPPROTO_CARP, - .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_input = carp_input, - .pr_output = (pr_output_t*)rip_output, - .pr_ctloutput = rip_ctloutput, - .pr_usrreqs = &rip_usrreqs -}, -#endif /* DEV_CARP */ /* Spacer n-times for loadable protocols. */ IPPROTOSPACER, IPPROTOSPACER, @@ -413,6 +396,3 @@ SYSCTL_NODE(_net_inet, IPPROTO_RAW, raw, #ifdef DEV_PFSYNC SYSCTL_NODE(_net_inet, IPPROTO_PFSYNC, pfsync, CTLFLAG_RW, 0, "PFSYNC"); #endif -#ifdef DEV_CARP -SYSCTL_NODE(_net_inet, IPPROTO_CARP, carp, CTLFLAG_RW, 0, "CARP"); -#endif Modified: stable/8/sys/netinet/ip_carp.c ============================================================================== --- stable/8/sys/netinet/ip_carp.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet/ip_carp.c Sat Sep 11 22:02:36 2010 (r212482) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_carp.h" #include "opt_bpf.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -44,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #ifdef INET6 #include #include +#include #include #include #include @@ -136,6 +137,7 @@ struct carp_softc { int carp_suppress_preempt = 0; int carp_opts[CARPCTL_MAXID] = { 0, 1, 0, 1, 0, 0 }; /* XXX for now */ +SYSCTL_NODE(_net_inet, IPPROTO_CARP, carp, CTLFLAG_RW, 0, "CARP"); SYSCTL_INT(_net_inet_carp, CARPCTL_ALLOW, allow, CTLFLAG_RW, &carp_opts[CARPCTL_ALLOW], 0, "Accept incoming CARP packets"); SYSCTL_INT(_net_inet_carp, CARPCTL_PREEMPT, preempt, CTLFLAG_RW, @@ -160,6 +162,10 @@ struct carp_if { struct mtx vhif_mtx; }; +#define CARP_INET 0 +#define CARP_INET6 1 +static int proto_reg[] = {-1, -1}; + /* Get carp_if from softc. Valid after carp_set_addr{,6}. */ #define SC2CIF(sc) ((struct carp_if *)(sc)->sc_carpdev->if_carp) @@ -1146,14 +1152,15 @@ carp_addrcount(struct carp_if *cif, stru } int -carp_iamatch(void *v, struct in_ifaddr *ia, +carp_iamatch(struct ifnet *ifp, struct in_ifaddr *ia, struct in_addr *isaddr, u_int8_t **enaddr) { - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *vh; int index, count = 0; struct ifaddr *ifa; + cif = ifp->if_carp; CARP_LOCK(cif); if (carp_opts[CARPCTL_ARPBALANCE]) { @@ -1222,12 +1229,13 @@ carp_iamatch(void *v, struct in_ifaddr * #ifdef INET6 struct ifaddr * -carp_iamatch6(void *v, struct in6_addr *taddr) +carp_iamatch6(struct ifnet *ifp, struct in6_addr *taddr) { - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *vh; struct ifaddr *ifa; + cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { IF_ADDR_LOCK(SC2IFP(vh)); @@ -1250,14 +1258,15 @@ carp_iamatch6(void *v, struct in6_addr * return (NULL); } -void * -carp_macmatch6(void *v, struct mbuf *m, const struct in6_addr *taddr) +caddr_t +carp_macmatch6(struct ifnet *ifp, struct mbuf *m, const struct in6_addr *taddr) { struct m_tag *mtag; - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *sc; struct ifaddr *ifa; + cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { IF_ADDR_LOCK(SC2IFP(sc)); @@ -1293,15 +1302,16 @@ carp_macmatch6(void *v, struct mbuf *m, #endif struct ifnet * -carp_forus(void *v, void *dhost) +carp_forus(struct ifnet *ifp, u_char *dhost) { - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *vh; u_int8_t *ena = dhost; if (ena[0] || ena[1] || ena[2] != 0x5e || ena[3] || ena[4] != 1) return (NULL); + cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) if ((SC2IFP(vh)->if_flags & IFF_UP) && @@ -2209,10 +2219,11 @@ carp_set_state(struct carp_softc *sc, in } void -carp_carpdev_state(void *v) +carp_carpdev_state(struct ifnet *ifp) { - struct carp_if *cif = v; + struct carp_if *cif; + cif = ifp->if_carp; CARP_LOCK(cif); carp_carpdev_state_locked(cif); CARP_UNLOCK(cif); @@ -2263,24 +2274,136 @@ carp_sc_state_locked(struct carp_softc * return; } +#ifdef INET +extern struct domain inetdomain; +static struct protosw in_carp_protosw = { + .pr_type = SOCK_RAW, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_CARP, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_input = carp_input, + .pr_output = (pr_output_t *)rip_output, + .pr_ctloutput = rip_ctloutput, + .pr_usrreqs = &rip_usrreqs +}; +#endif + +#ifdef INET6 +extern struct domain inet6domain; +static struct ip6protosw in6_carp_protosw = { + .pr_type = SOCK_RAW, + .pr_domain = &inet6domain, + .pr_protocol = IPPROTO_CARP, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_input = carp6_input, + .pr_output = rip6_output, + .pr_ctloutput = rip6_ctloutput, + .pr_usrreqs = &rip6_usrreqs +}; +#endif + +static void +carp_mod_cleanup(void) +{ + + if (if_detach_event_tag == NULL) + return; + EVENTHANDLER_DEREGISTER(ifnet_departure_event, if_detach_event_tag); + if_clone_detach(&carp_cloner); +#ifdef INET + if (proto_reg[CARP_INET] == 0) { + (void)ipproto_unregister(IPPROTO_CARP); + pf_proto_unregister(PF_INET, IPPROTO_CARP, SOCK_RAW); + proto_reg[CARP_INET] = -1; + } + carp_iamatch_p = NULL; +#endif +#ifdef INET6 + if (proto_reg[CARP_INET6] == 0) { + (void)ip6proto_unregister(IPPROTO_CARP); + pf_proto_unregister(PF_INET6, IPPROTO_CARP, SOCK_RAW); + proto_reg[CARP_INET6] = -1; + } + carp_iamatch6_p = NULL; + carp_macmatch6_p = NULL; +#endif + carp_linkstate_p = NULL; + carp_forus_p = NULL; + carp_output_p = NULL; + mtx_destroy(&carp_mtx); +} + +static int +carp_mod_load(void) +{ + int err; + + if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, + carp_ifdetach, NULL, EVENTHANDLER_PRI_ANY); + if (if_detach_event_tag == NULL) + return (ENOMEM); + mtx_init(&carp_mtx, "carp_mtx", NULL, MTX_DEF); + LIST_INIT(&carpif_list); + if_clone_attach(&carp_cloner); + carp_linkstate_p = carp_carpdev_state; + carp_forus_p = carp_forus; + carp_output_p = carp_output; +#ifdef INET6 + carp_iamatch6_p = carp_iamatch6; + carp_macmatch6_p = carp_macmatch6; + proto_reg[CARP_INET6] = pf_proto_register(PF_INET6, + (struct protosw *)&in6_carp_protosw); + if (proto_reg[CARP_INET6] != 0) { + printf("carp: error %d attaching to PF_INET6\n", + proto_reg[CARP_INET6]); + carp_mod_cleanup(); + return (EINVAL); + } + err = ip6proto_register(IPPROTO_CARP); + if (err) { + printf("carp: error %d registering with INET6\n", err); + carp_mod_cleanup(); + return (EINVAL); + } +#endif +#ifdef INET + carp_iamatch_p = carp_iamatch; + proto_reg[CARP_INET] = pf_proto_register(PF_INET, &in_carp_protosw); + if (proto_reg[CARP_INET] != 0) { + printf("carp: error %d attaching to PF_INET\n", + proto_reg[CARP_INET]); + carp_mod_cleanup(); + return (EINVAL); + } + err = ipproto_register(IPPROTO_CARP); + if (err) { + printf("carp: error %d registering with INET\n", err); + carp_mod_cleanup(); + return (EINVAL); + } +#endif + return 0; +} + static int carp_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: - if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, - carp_ifdetach, NULL, EVENTHANDLER_PRI_ANY); - if (if_detach_event_tag == NULL) - return (ENOMEM); - mtx_init(&carp_mtx, "carp_mtx", NULL, MTX_DEF); - LIST_INIT(&carpif_list); - if_clone_attach(&carp_cloner); - break; - + return carp_mod_load(); + /* NOTREACHED */ case MOD_UNLOAD: - EVENTHANDLER_DEREGISTER(ifnet_departure_event, if_detach_event_tag); - if_clone_detach(&carp_cloner); - mtx_destroy(&carp_mtx); + /* + * XXX: For now, disallow module unloading by default due to + * a race condition where a thread may dereference one of the + * function pointer hooks after the module has been + * unloaded, during processing of a packet, causing a panic. + */ +#ifdef CARPMOD_CAN_UNLOAD + carp_mod_cleanup(); +#else + return (EBUSY); +#endif break; default: @@ -2296,4 +2419,4 @@ static moduledata_t carp_mod = { 0 }; -DECLARE_MODULE(carp, carp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(carp, carp_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); Modified: stable/8/sys/netinet/ip_carp.h ============================================================================== --- stable/8/sys/netinet/ip_carp.h Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet/ip_carp.h Sat Sep 11 22:02:36 2010 (r212482) @@ -157,15 +157,35 @@ struct carpreq { } #ifdef _KERNEL -void carp_carpdev_state(void *); +void carp_carpdev_state(struct ifnet *); void carp_input (struct mbuf *, int); int carp6_input (struct mbuf **, int *, int); int carp_output (struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); -int carp_iamatch (void *, struct in_ifaddr *, struct in_addr *, +int carp_iamatch (struct ifnet *, struct in_ifaddr *, struct in_addr *, u_int8_t **); -struct ifaddr *carp_iamatch6(void *, struct in6_addr *); -void *carp_macmatch6(void *, struct mbuf *, const struct in6_addr *); -struct ifnet *carp_forus (void *, void *); +struct ifaddr *carp_iamatch6(struct ifnet *, struct in6_addr *); +caddr_t carp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *); +struct ifnet *carp_forus (struct ifnet *, u_char *); + +/* These are external networking stack hooks for CARP */ +/* net/if.c */ +extern void (*carp_linkstate_p)(struct ifnet *); +/* net/if_bridge.c net/if_ethersubr.c */ +extern struct ifnet *(*carp_forus_p)(struct ifnet *, u_char *); +/* net/if_ethersubr.c */ +extern int (*carp_output_p)(struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *); +#ifdef INET +/* netinet/if_ether.c */ +extern int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, + struct in_addr *, u_int8_t **); +#endif +#ifdef INET6 +/* netinet6/nd6_nbr.c */ +extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); +extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, + const struct in6_addr *); +#endif #endif #endif /* _IP_CARP_H */ Modified: stable/8/sys/netinet/ip_input.c ============================================================================== --- stable/8/sys/netinet/ip_input.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet/ip_input.c Sat Sep 11 22:02:36 2010 (r212482) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ipstealth.h" #include "opt_ipsec.h" #include "opt_route.h" -#include "opt_carp.h" #include #include @@ -74,9 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef DEV_CARP #include -#endif #ifdef IPSEC #include #endif /* IPSEC */ @@ -606,10 +603,7 @@ passin: */ checkif = V_ip_checkinterface && (V_ipforwarding == 0) && ifp != NULL && ((ifp->if_flags & IFF_LOOPBACK) == 0) && -#ifdef DEV_CARP - !ifp->if_carp && -#endif - (dchg == 0); + ifp->if_carp == NULL && (dchg == 0); /* * Check for exact addresses in the hash bucket. Modified: stable/8/sys/netinet6/in6_proto.c ============================================================================== --- stable/8/sys/netinet6/in6_proto.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet6/in6_proto.c Sat Sep 11 22:02:36 2010 (r212482) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_ipsec.h" #include "opt_ipstealth.h" -#include "opt_carp.h" #include "opt_sctp.h" #include "opt_mpath.h" @@ -111,10 +110,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef DEV_CARP -#include -#endif - #ifdef SCTP #include #include @@ -331,18 +326,6 @@ struct ip6protosw inet6sw[] = { .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs }, -#ifdef DEV_CARP -{ - .pr_type = SOCK_RAW, - .pr_domain = &inet6domain, - .pr_protocol = IPPROTO_CARP, - .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_input = carp6_input, - .pr_output = rip6_output, - .pr_ctloutput = rip6_ctloutput, - .pr_usrreqs = &rip6_usrreqs -}, -#endif /* DEV_CARP */ /* Spacer n-times for loadable protocols. */ IP6PROTOSPACER, IP6PROTOSPACER, Modified: stable/8/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/8/sys/netinet6/nd6_nbr.c Sat Sep 11 21:52:40 2010 (r212481) +++ stable/8/sys/netinet6/nd6_nbr.c Sat Sep 11 22:02:36 2010 (r212482) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_carp.h" #include "opt_mpath.h" #include @@ -73,10 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - -#ifdef DEV_CARP #include -#endif #define SDL(s) ((struct sockaddr_dl *)s) @@ -222,14 +218,10 @@ nd6_ns_input(struct mbuf *m, int off, in * (3) "tentative" address on which DAD is being performed. */ /* (1) and (3) check. */ -#ifdef DEV_CARP if (ifp->if_carp) - ifa = carp_iamatch6(ifp->if_carp, &taddr6); + ifa = (*carp_iamatch6_p)(ifp, &taddr6); if (ifa == NULL) ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); -#else - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); -#endif /* (2) check. */ if (ifa == NULL) { @@ -1029,14 +1021,10 @@ nd6_na_output(struct ifnet *ifp, const s * my address) use lladdr configured for the interface. */ if (sdl0 == NULL) { -#ifdef DEV_CARP if (ifp->if_carp) - mac = carp_macmatch6(ifp->if_carp, m, taddr6); + mac = (*carp_macmatch6_p)(ifp, m, taddr6); if (mac == NULL) mac = nd6_ifptomac(ifp); -#else - mac = nd6_ifptomac(ifp); -#endif } else if (sdl0->sa_family == AF_LINK) { struct sockaddr_dl *sdl; sdl = (struct sockaddr_dl *)sdl0; From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 22:09:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C13011065679; Sat, 11 Sep 2010 22:09:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B044D8FC08; Sat, 11 Sep 2010 22:09: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 o8BM9GJf047438; Sat, 11 Sep 2010 22:09:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8BM9G3Y047436; Sat, 11 Sep 2010 22:09:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009112209.o8BM9G3Y047436@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 11 Sep 2010 22:09: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: r212483 - head/sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 22:09:16 -0000 Author: nwhitehorn Date: Sat Sep 11 22:09:16 2010 New Revision: 212483 URL: http://svn.freebsd.org/changeset/base/212483 Log: ATAPI DMA does not seem to work completely reliably on Shasta controllers, especially in conjunction with ATA_CAM, so disable it for now. Modified: head/sys/powerpc/powermac/ata_kauai.c Modified: head/sys/powerpc/powermac/ata_kauai.c ============================================================================== --- head/sys/powerpc/powermac/ata_kauai.c Sat Sep 11 22:02:36 2010 (r212482) +++ head/sys/powerpc/powermac/ata_kauai.c Sat Sep 11 22:09:16 2010 (r212483) @@ -217,8 +217,10 @@ ata_kauai_probe(device_t dev) ch = &sc->sc_ch.sc_ch; compatstring = ofw_bus_get_compat(dev); - if (compatstring != NULL && strcmp(compatstring,"shasta-ata") == 0) + if (compatstring != NULL && strcmp(compatstring,"shasta-ata") == 0) { + ch->flags |= ATA_NO_ATAPI_DMA; sc->shasta = 1; + } /* Pre-K2 controllers apparently need this hack */ if (!sc->shasta &&