From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 00:06:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA40C106566C; Sun, 26 Feb 2012 00:06:50 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 661198FC08; Sun, 26 Feb 2012 00:06:49 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 467D3B43; Sun, 26 Feb 2012 01:06:48 +0100 (CET) Date: Sun, 26 Feb 2012 01:05:29 +0100 From: Pawel Jakub Dawidek To: Adrian Chadd Message-ID: <20120226000529.GK1344@garage.freebsd.pl> References: <201202250801.q1P81Tdx006994@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SLauP2uySp+9cKYP" Content-Disposition: inline In-Reply-To: <201202250801.q1P81Tdx006994@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232147 - head/sys/dev/wi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 00:06:50 -0000 --SLauP2uySp+9cKYP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 25, 2012 at 08:01:29AM +0000, Adrian Chadd wrote: > Author: adrian > Date: Sat Feb 25 08:01:29 2012 > New Revision: 232147 > URL: http://svn.freebsd.org/changeset/base/232147 >=20 > Log: > If an interrupt is received with no vap attached, just fail LINK events. > =20 > This fixes a NULL pointer dereference which occurs if the vap list is > empty but someone brings up the wi0 interface. >=20 > Modified: > head/sys/dev/wi/if_wi.c >=20 > Modified: head/sys/dev/wi/if_wi.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/dev/wi/if_wi.c Sat Feb 25 07:58:59 2012 (r232146) > +++ head/sys/dev/wi/if_wi.c Sat Feb 25 08:01:29 2012 (r232147) > @@ -1511,6 +1511,10 @@ wi_info_intr(struct wi_softc *sc) > case WI_INFO_LINK_STAT: > wi_read_bap(sc, fid, sizeof(ltbuf), &stat, sizeof(stat)); > DPRINTF(("wi_info_intr: LINK_STAT 0x%x\n", le16toh(stat))); > + > + if (vap =3D=3D NULL) > + goto finish; > + > switch (le16toh(stat)) { > case WI_INFO_LINK_STAT_CONNECTED: > if (vap->iv_state =3D=3D IEEE80211_S_RUN && > @@ -1566,6 +1570,7 @@ wi_info_intr(struct wi_softc *sc) > le16toh(ltbuf[1]), le16toh(ltbuf[0]))); > break; > } > +finish: > CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_INFO); > } Can't you just 'break' instead of using goto? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --SLauP2uySp+9cKYP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk9Jd0kACgkQForvXbEpPzRwwACgsmQR8LYDIP9xEkvb0MVeYIjQ ruIAn2WksOvKx0y5I6GDeLPfp/LSWLOm =7Co+ -----END PGP SIGNATURE----- --SLauP2uySp+9cKYP-- From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 00:52:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C0F11065677; Sun, 26 Feb 2012 00:52:11 +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 6582B8FC1A; Sun, 26 Feb 2012 00:52:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1Q0qBnh040780; Sun, 26 Feb 2012 00:52:11 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1Q0qBmW040778; Sun, 26 Feb 2012 00:52:11 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201202260052.q1Q0qBmW040778@svn.freebsd.org> From: Christian Brueffer Date: Sun, 26 Feb 2012 00:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232167 - stable/9/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, 26 Feb 2012 00:52:11 -0000 Author: brueffer Date: Sun Feb 26 00:52:10 2012 New Revision: 232167 URL: http://svn.freebsd.org/changeset/base/232167 Log: MFC: r232056 Rename DESCRIPTION section to HARDWARE, so this manpage can be used for automatic hardware notes generation. Modified: stable/9/share/man/man4/isci.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/isci.4 ============================================================================== --- stable/9/share/man/man4/isci.4 Sat Feb 25 21:06:39 2012 (r232166) +++ stable/9/share/man/man4/isci.4 Sun Feb 26 00:52:10 2012 (r232167) @@ -52,7 +52,7 @@ Or, to load the driver as a module at bo .Bd -literal -offset indent isci_load="YES" .Ed -.Sh DESCRIPTION +.Sh HARDWARE The .Nm driver provides support for Intel C600 From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 00:54:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB43A1065672; Sun, 26 Feb 2012 00:54:14 +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 6A7238FC14; Sun, 26 Feb 2012 00:54:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1Q0sESE040888; Sun, 26 Feb 2012 00:54:14 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1Q0sEcT040885; Sun, 26 Feb 2012 00:54:14 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201202260054.q1Q0sEcT040885@svn.freebsd.org> From: Christian Brueffer Date: Sun, 26 Feb 2012 00:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232168 - in stable/9/release/doc: en_US.ISO8859-1/hardware 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, 26 Feb 2012 00:54:14 -0000 Author: brueffer Date: Sun Feb 26 00:54:13 2012 New Revision: 232168 URL: http://svn.freebsd.org/changeset/base/232168 Log: MFC: r232060 Add isci(4) to the hardware notes. Modified: stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml stable/9/release/doc/share/misc/dev.archlist.txt Directory Properties: stable/9/release/ (props changed) stable/9/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/9/release/picobsd/tinyware/passwd/ (props changed) Modified: stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Feb 26 00:52:10 2012 (r232167) +++ stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Feb 26 00:54:13 2012 (r232168) @@ -790,6 +790,8 @@ &hwlist.ips; + &hwlist.isci; + &hwlist.isp; &hwlist.mfi; Modified: stable/9/release/doc/share/misc/dev.archlist.txt ============================================================================== --- stable/9/release/doc/share/misc/dev.archlist.txt Sun Feb 26 00:52:10 2012 (r232167) +++ stable/9/release/doc/share/misc/dev.archlist.txt Sun Feb 26 00:54:13 2012 (r232168) @@ -80,6 +80,7 @@ ida i386 ie i386 iir i386,ia64,amd64 ips i386,amd64 +isci i386,amd64 ixgb i386,amd64 kue i386,pc98,ia64,amd64,powerpc lge i386,pc98,amd64 From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 00:59:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02914106564A; Sun, 26 Feb 2012 00:59:01 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 7C73D8FC08; Sun, 26 Feb 2012 00:59:00 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAHSDSU+DaFvO/2dsb2JhbABBhSeud4FzAQEEASNWBRYUBAICDRkCWQaIFAULpWCRA4Evi28DIQICBQIKAQYEBwIGBxULBgMChEQBAjpQB4I6gRYEiE+MbpMM X-IronPort-AV: E=Sophos;i="4.73,483,1325480400"; d="scan'208";a="157913757" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 25 Feb 2012 19:58:59 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 44583B3FFC; Sat, 25 Feb 2012 19:58:59 -0500 (EST) Date: Sat, 25 Feb 2012 19:58:59 -0500 (EST) From: Rick Macklem To: Maxim Konovalov Message-ID: <788625604.124085.1330217939168.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <201202251206.q1PC6eaF016823@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Linux)/6.0.10_GA_2692) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232156 - 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, 26 Feb 2012 00:59:01 -0000 Maxim Konovalov wrote: > Author: maxim > Date: Sat Feb 25 12:06:40 2012 > New Revision: 232156 > URL: http://svn.freebsd.org/changeset/base/232156 > > Log: > o Reduce chances for integer overflow. > o More verbose sysctl description added. > > MFC after: 2 weeks > Sponsored by: Nginx, Inc. > > Modified: > head/sys/kern/vfs_cache.c > > Modified: head/sys/kern/vfs_cache.c > ============================================================================== > --- head/sys/kern/vfs_cache.c Sat Feb 25 11:07:32 2012 (r232155) > +++ head/sys/kern/vfs_cache.c Sat Feb 25 12:06:40 2012 (r232156) > @@ -369,7 +369,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND > maxlength = count; > } > n_nchash = nchash + 1; > - pct = (used * 100 * 100) / n_nchash; > + pct = (used * 100) / (n_nchash / 100); You might want to consider a sanity check to make sure n_nchash is >= 100, to avoid a "divide by zero". There was an NFS PR# a while back, where "desiredvnodes" was set very small and resulted in a "divide by zero" in the NFS code. Just a suggestion, rick > error = SYSCTL_OUT(req, &n_nchash, sizeof(n_nchash)); > if (error) > return (error); > @@ -386,7 +386,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND > } > SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE_INT|CTLFLAG_RD| > CTLFLAG_MPSAFE, 0, 0, sysctl_debug_hashstat_nchash, "I", > - "nchash chain lengths"); > + "nchash statistics (number of total/used buckets, maximum chain > length, usage percentage)"); > #endif > > /* From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 01:46:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99B4D106566B; Sun, 26 Feb 2012 01:46:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 257048FC0A; Sun, 26 Feb 2012 01:46:33 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1Q1kULG001155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 26 Feb 2012 12:46:31 +1100 Date: Sun, 26 Feb 2012 12:46:30 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Rick Macklem In-Reply-To: <788625604.124085.1330217939168.JavaMail.root@erie.cs.uoguelph.ca> Message-ID: <20120226122354.D2293@besplex.bde.org> References: <788625604.124085.1330217939168.JavaMail.root@erie.cs.uoguelph.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Maxim Konovalov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232156 - 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, 26 Feb 2012 01:46:34 -0000 On Sat, 25 Feb 2012, Rick Macklem wrote: >> Log: >> o Reduce chances for integer overflow. >> o More verbose sysctl description added. >> >> MFC after: 2 weeks >> Sponsored by: Nginx, Inc. >> >> Modified: >> head/sys/kern/vfs_cache.c >> >> Modified: head/sys/kern/vfs_cache.c >> ============================================================================== >> --- head/sys/kern/vfs_cache.c Sat Feb 25 11:07:32 2012 (r232155) >> +++ head/sys/kern/vfs_cache.c Sat Feb 25 12:06:40 2012 (r232156) >> @@ -369,7 +369,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND >> maxlength = count; >> } >> n_nchash = nchash + 1; >> - pct = (used * 100 * 100) / n_nchash; >> + pct = (used * 100) / (n_nchash / 100); > > You might want to consider a sanity check to make > sure n_nchash is >= 100, to avoid a "divide by zero". > > There was an NFS PR# a while back, where "desiredvnodes" was > set very small and resulted in a "divide by zero" in the NFS code. Interesting. I considered mentioning this possibility in my reply, but decided that desiredvnodes is always initially at least a few hundred, since even an unbootable machine with 4MB memory has 1024 4K-pages. You can tune desiredvnodes down to a bad value, but another old bug is that tuning desiredvnodes doesn't affect the namecache, so you can't make the above divide by provided n_nchash was initially not bad. In nfs, the problem is larger and still exists in oldnfs: % nfsclient/nfs_vfsops.c- nmp->nm_wsize = NFS_WSIZE; % nfsclient/nfs_vfsops.c- nmp->nm_rsize = NFS_RSIZE; % nfsclient/nfs_vfsops.c- } % nfsclient/nfs_vfsops.c: nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); Now the divisor is 1000, so problems occur with the initial value occurs on machines with 10 times as much memory as ones which have a problem in the namecache code, and a good initial value can be tuned down to ensure division by zero. % nfsclient/nfs_vfsops.c- nmp->nm_readdirsize = NFS_READDIRSIZE; % nfsclient/nfs_vfsops.c- nmp->nm_numgrps = NFS_MAXGRPS; % nfsclient/nfs_vfsops.c- nmp->nm_readahead = NFS_DEFRAHEAD; % -- % fs/nfsclient/nfs_clvfsops.c- nmp->nm_timeo = NFS_TIMEO; % fs/nfsclient/nfs_clvfsops.c- nmp->nm_retry = NFS_RETRANS; % fs/nfsclient/nfs_clvfsops.c- nmp->nm_readahead = NFS_DEFRAHEAD; % fs/nfsclient/nfs_clvfsops.c: if (desiredvnodes >= 11000) % fs/nfsclient/nfs_clvfsops.c: nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); % fs/nfsclient/nfs_clvfsops.c- else % fs/nfsclient/nfs_clvfsops.c- nmp->nm_wcommitsize = hibufspace / 10; % fs/nfsclient/nfs_clvfsops.c- Has been fixed, but if you only want to avoid division by 0, then a simpler fix is to split up the powers of 10, e.g.: nmp->nm_wcommitsize = hibufspace * 100 / (desiredvnodes / 10); No one would set desiredvnodes to < 10, but now there is possible overflow for the multiplication, and this is even easier to arrange then division by zero since it is easy to set highbufspace to a non-physical value (2**63-1 on 64-bit machines). So this is too fragile. Except the sysctls are privileged and we should rely on their users to not misuse them. Bruce From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 06:04:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20493106564A; Sun, 26 Feb 2012 06:04:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA02E8FC12; Sun, 26 Feb 2012 06:04:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1Q64ijX051068; Sun, 26 Feb 2012 06:04:44 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1Q64i9e051065; Sun, 26 Feb 2012 06:04:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202260604.q1Q64i9e051065@svn.freebsd.org> From: Adrian Chadd Date: Sun, 26 Feb 2012 06:04: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: r232170 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 06:04:45 -0000 Author: adrian Date: Sun Feb 26 06:04:44 2012 New Revision: 232170 URL: http://svn.freebsd.org/changeset/base/232170 Log: Add in some debugging code to check whether the current rate table has been bait-and-switched from the rate control code. This will avoid the panic that I saw and will avoid sending invalid rates (eg 11a/11g OFDM rates when in 11b, on 11b-only NICs (AR5211)) where the rate table is not "big". It also will point out situations where this occurs for the 11n NICs which will have sufficiently large rate tables that "invalid rix" doesn't occur. I'll try to follow this up with a commit that adds a current operating mode check. The "rix" is only relevant to the current operating mode and rate table. PR: kern/165475 Modified: head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Sun Feb 26 02:24:40 2012 (r232169) +++ head/sys/dev/ath/ath_rate/sample/sample.c Sun Feb 26 06:04:44 2012 (r232170) @@ -495,6 +495,14 @@ ath_rate_findrate(struct ath_softc *sc, ath_rate_update_static_rix(sc, &an->an_node); + if (sn->currates != sc->sc_currates) { + device_printf(sc->sc_dev, "%s: currates != sc_currates!\n", + __func__); + rix = 0; + *try0 = ATH_TXMAXTRY; + goto done; + } + if (sn->static_rix != -1) { rix = sn->static_rix; *try0 = ATH_TXMAXTRY; @@ -621,6 +629,20 @@ ath_rate_findrate(struct ath_softc *sc, } *try0 = mrr ? sn->sched[rix].t0 : ATH_TXMAXTRY; done: + + /* + * This bug totally sucks and should be fixed. + * + * For now though, let's not panic, so we can start to figure + * out how to better reproduce it. + */ + if (rix < 0 || rix >= rt->rateCount) { + printf("%s: ERROR: rix %d out of bounds (rateCount=%d)\n", + __func__, + rix, + rt->rateCount); + rix = 0; /* XXX just default for now */ + } KASSERT(rix >= 0 && rix < rt->rateCount, ("rix is %d", rix)); *rix0 = rix; @@ -1073,6 +1095,8 @@ ath_rate_ctl_reset(struct ath_softc *sc, sn->static_rix = -1; ath_rate_update_static_rix(sc, ni); + sn->currates = sc->sc_currates; + /* * Construct a bitmask of usable rates. This has all * negotiated rates minus those marked by the hal as Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Sun Feb 26 02:24:40 2012 (r232169) +++ head/sys/dev/ath/ath_rate/sample/sample.h Sun Feb 26 06:04:44 2012 (r232170) @@ -86,6 +86,8 @@ struct sample_node { uint32_t ratemask; /* bit mask of valid rate indices */ const struct txschedule *sched; /* tx schedule table */ + const HAL_RATE_TABLE *currates; + struct rate_stats stats[NUM_PACKET_SIZE_BINS][SAMPLE_MAXRATES]; int last_sample_rix[NUM_PACKET_SIZE_BINS]; From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 07:24:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFFC2106566B; Sun, 26 Feb 2012 07:24:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 22EAF8FC08; Sun, 26 Feb 2012 07:24:07 +0000 (UTC) Received: by werl4 with SMTP id l4so12266wer.13 for ; Sat, 25 Feb 2012 23:24:07 -0800 (PST) Received-SPF: pass (google.com: domain of adrian.chadd@gmail.com designates 10.180.101.37 as permitted sender) client-ip=10.180.101.37; Authentication-Results: mr.google.com; spf=pass (google.com: domain of adrian.chadd@gmail.com designates 10.180.101.37 as permitted sender) smtp.mail=adrian.chadd@gmail.com; dkim=pass header.i=adrian.chadd@gmail.com Received: from mr.google.com ([10.180.101.37]) by 10.180.101.37 with SMTP id fd5mr10161315wib.1.1330241047081 (num_hops = 1); Sat, 25 Feb 2012 23:24:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=wReNGcVmYqXnPszvGcoYjMXCVNjBFUUtxeoploHcEQU=; b=g63/JUbEl2Jx/98j9PeEI/ajIJHkbGNBjf9NqyyajOIR5UwmN0al2CjmZlAQq9ZcAx XDRK0fVZphdM6o+DiP5QpXiX8VdAakoJYQMdjR31qfDIG25tu+b9EVcvwUNLQx72pXaQ PwSszs406L1t+VVJeNL+BKWYVkDIBdU2b/6js= MIME-Version: 1.0 Received: by 10.180.101.37 with SMTP id fd5mr8018099wib.1.1330241046975; Sat, 25 Feb 2012 23:24:06 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.154.199 with HTTP; Sat, 25 Feb 2012 23:24:06 -0800 (PST) In-Reply-To: <201202250801.q1P81Tdx006994@svn.freebsd.org> References: <201202250801.q1P81Tdx006994@svn.freebsd.org> Date: Sat, 25 Feb 2012 23:24:06 -0800 X-Google-Sender-Auth: MYtO1xKjYXZluUSmhAItI71TlHM Message-ID: From: Adrian Chadd To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r232147 - head/sys/dev/wi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 07:24:09 -0000 Good point.. Adiran On 25 February 2012 00:01, Adrian Chadd wrote: > Author: adrian > Date: Sat Feb 25 08:01:29 2012 > New Revision: 232147 > URL: http://svn.freebsd.org/changeset/base/232147 > > Log: > =A0If an interrupt is received with no vap attached, just fail LINK event= s. > > =A0This fixes a NULL pointer dereference which occurs if the vap list is > =A0empty but someone brings up the wi0 interface. > > Modified: > =A0head/sys/dev/wi/if_wi.c > > Modified: head/sys/dev/wi/if_wi.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/dev/wi/if_wi.c =A0 =A0 Sat Feb 25 07:58:59 2012 =A0 =A0 =A0 = =A0(r232146) > +++ head/sys/dev/wi/if_wi.c =A0 =A0 Sat Feb 25 08:01:29 2012 =A0 =A0 =A0 = =A0(r232147) > @@ -1511,6 +1511,10 @@ wi_info_intr(struct wi_softc *sc) > =A0 =A0 =A0 =A0case WI_INFO_LINK_STAT: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0wi_read_bap(sc, fid, sizeof(ltbuf), &stat,= sizeof(stat)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DPRINTF(("wi_info_intr: LINK_STAT 0x%x\n",= le16toh(stat))); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (vap =3D=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto finish; > + > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0switch (le16toh(stat)) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0case WI_INFO_LINK_STAT_CONNECTED: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (vap->iv_state =3D=3D I= EEE80211_S_RUN && > @@ -1566,6 +1570,7 @@ wi_info_intr(struct wi_softc *sc) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0le16toh(ltbuf[1]), le16toh(ltbuf[0= ]))); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0} > +finish: > =A0 =A0 =A0 =A0CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_INFO); > =A0} > From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 10:20:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0EA61065672; Sun, 26 Feb 2012 10:20:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF54D8FC14; Sun, 26 Feb 2012 10:20:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QAKDY0058911; Sun, 26 Feb 2012 10:20:13 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QAKDpn058909; Sun, 26 Feb 2012 10:20:13 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201202261020.q1QAKDpn058909@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 26 Feb 2012 10:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232171 - stable/9/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: Sun, 26 Feb 2012 10:20:14 -0000 Author: ae Date: Sun Feb 26 10:20:13 2012 New Revision: 232171 URL: http://svn.freebsd.org/changeset/base/232171 Log: MFC r231991: Don't use `m' after m_megapullup. PR: kern/165373 Modified: stable/9/sys/netinet/ipfw/ip_fw_nat.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_nat.c Sun Feb 26 06:04:44 2012 (r232170) +++ stable/9/sys/netinet/ipfw/ip_fw_nat.c Sun Feb 26 10:20:13 2012 (r232171) @@ -315,7 +315,7 @@ ipfw_nat(struct ip_fw_args *args, struct } if (retval == PKT_ALIAS_RESPOND) - m->m_flags |= M_SKIP_FIREWALL; + mcl->m_flags |= M_SKIP_FIREWALL; mcl->m_pkthdr.len = mcl->m_len = ntohs(ip->ip_len); /* From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 10:20:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5855D1065672; Sun, 26 Feb 2012 10:20:56 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1222E8FC13; Sun, 26 Feb 2012 10:20:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QAKtfH058966; Sun, 26 Feb 2012 10:20:55 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QAKtwX058964; Sun, 26 Feb 2012 10:20:55 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201202261020.q1QAKtwX058964@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 26 Feb 2012 10:20: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: r232172 - stable/8/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: Sun, 26 Feb 2012 10:20:56 -0000 Author: ae Date: Sun Feb 26 10:20:55 2012 New Revision: 232172 URL: http://svn.freebsd.org/changeset/base/232172 Log: MFC r231991: Don't use `m' after m_megapullup. PR: kern/165373 Approved by: re (kib) Modified: stable/8/sys/netinet/ipfw/ip_fw_nat.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_nat.c Sun Feb 26 10:20:13 2012 (r232171) +++ stable/8/sys/netinet/ipfw/ip_fw_nat.c Sun Feb 26 10:20:55 2012 (r232172) @@ -315,7 +315,7 @@ ipfw_nat(struct ip_fw_args *args, struct } if (retval == PKT_ALIAS_RESPOND) - m->m_flags |= M_SKIP_FIREWALL; + mcl->m_flags |= M_SKIP_FIREWALL; mcl->m_pkthdr.len = mcl->m_len = ntohs(ip->ip_len); /* From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 11:51:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC284106566B; Sun, 26 Feb 2012 11:51:23 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C41AC8FC14; Sun, 26 Feb 2012 11:51:22 +0000 (UTC) Received: by lagz14 with SMTP id z14so6213344lag.13 for ; Sun, 26 Feb 2012 03:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; 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; bh=3fvW3hrk4f07A3jeTvDUOQXhcWrbwC8kZthvt1351z8=; b=j9mVWNbz+vkIXA8XAZcINWnh//V/HaLVmrZu3SwhWhO1PMez1nKub9E0a4dzNBIsm1 R0VOuMGNQMoQX6r4A0x1TCQdJ7O7qemOUSu0kF8KZrz31uNQYUTF3PTaL4kmByX0d3wB Hf78bMG/krid59Q1HVUlmu7yA6aFsXY+ElwnM= MIME-Version: 1.0 Received: by 10.152.125.20 with SMTP id mm20mr6422981lab.6.1330257081568; Sun, 26 Feb 2012 03:51:21 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.152.18.4 with HTTP; Sun, 26 Feb 2012 03:51:21 -0800 (PST) In-Reply-To: <201202221505.q1MF5JNt057163@svn.freebsd.org> References: <201202221505.q1MF5JNt057163@svn.freebsd.org> Date: Sun, 26 Feb 2012 14:51:21 +0300 X-Google-Sender-Auth: rbsT2hhYKe0JmfWwvudCn-tatnk Message-ID: From: Sergey Kandaurov To: Josh Paetzel 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: r231999 - 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: Sun, 26 Feb 2012 11:51:25 -0000 On 22 February 2012 19:05, Josh Paetzel wrote: > Author: jpaetzel > Date: Wed Feb 22 15:05:19 2012 > New Revision: 231999 > URL: http://svn.freebsd.org/changeset/base/231999 > > Log: > =A0Fix various typos and normalize spelling. [...] > @@ -602,7 +602,7 @@ options =A0 =A0 FLOWTABLE > =A0options =A0 =A0 =A0 =A0SCTP > =A0# There are bunches of options: > =A0# this one turns on all sorts of > -# nastly printing that you can > +# nastily printing that you can > =A0# do. It's all controlled by a > =A0# bit mask (settable by socket opt and > =A0# by sysctl). Including will not cause adj. nasty? --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 12:54:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D6BB106564A; Sun, 26 Feb 2012 12:54:30 +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 0BCBD8FC0A; Sun, 26 Feb 2012 12:54:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QCsT9E065979; Sun, 26 Feb 2012 12:54:29 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QCsT3t065977; Sun, 26 Feb 2012 12:54:29 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201202261254.q1QCsT3t065977@svn.freebsd.org> From: Christian Brueffer Date: Sun, 26 Feb 2012 12:54: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: r232174 - 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: Sun, 26 Feb 2012 12:54:30 -0000 Author: brueffer Date: Sun Feb 26 12:54:29 2012 New Revision: 232174 URL: http://svn.freebsd.org/changeset/base/232174 Log: MFC: r232056 Rename DESCRIPTION section to HARDWARE, so this manpage can be used for automatic hardware notes generation. Approved by: re (kib) Modified: stable/8/share/man/man4/isci.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/isci.4 ============================================================================== --- stable/8/share/man/man4/isci.4 Sun Feb 26 10:52:57 2012 (r232173) +++ stable/8/share/man/man4/isci.4 Sun Feb 26 12:54:29 2012 (r232174) @@ -52,7 +52,7 @@ Or, to load the driver as a module at bo .Bd -literal -offset indent isci_load="YES" .Ed -.Sh DESCRIPTION +.Sh HARDWARE The .Nm driver provides support for Intel C600 From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 12:56:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 005AB1065672; Sun, 26 Feb 2012 12:56:12 +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 E1AF78FC0C; Sun, 26 Feb 2012 12:56:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QCuClB066082; Sun, 26 Feb 2012 12:56:12 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QCuCdF066079; Sun, 26 Feb 2012 12:56:12 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201202261256.q1QCuCdF066079@svn.freebsd.org> From: Christian Brueffer Date: Sun, 26 Feb 2012 12:56: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: r232175 - in stable/8/release: doc/en_US.ISO8859-1/hardware doc/share/misc picobsd/floppy.tree/sbin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 12:56:13 -0000 Author: brueffer Date: Sun Feb 26 12:56:12 2012 New Revision: 232175 URL: http://svn.freebsd.org/changeset/base/232175 Log: MFC: r232060 Add isci(4) to the hardware notes. Approved by: re (kib) Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml stable/8/release/doc/share/misc/dev.archlist.txt Directory Properties: stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/picobsd/tinyware/passwd/ (props changed) stable/8/release/powerpc/ (props changed) Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Feb 26 12:54:29 2012 (r232174) +++ stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Sun Feb 26 12:56:12 2012 (r232175) @@ -737,6 +737,8 @@ &hwlist.ips; + &hwlist.isci; + &hwlist.isp; &hwlist.mfi; Modified: stable/8/release/doc/share/misc/dev.archlist.txt ============================================================================== --- stable/8/release/doc/share/misc/dev.archlist.txt Sun Feb 26 12:54:29 2012 (r232174) +++ stable/8/release/doc/share/misc/dev.archlist.txt Sun Feb 26 12:56:12 2012 (r232175) @@ -80,6 +80,7 @@ ida i386 ie i386 iir i386,ia64,amd64 ips i386,amd64 +isci i386,amd64 ixgb i386,amd64 kue i386,pc98,ia64,amd64,powerpc lge i386,pc98,amd64 From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 13:27:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1913106566C; Sun, 26 Feb 2012 13:27:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0E4C8FC0C; Sun, 26 Feb 2012 13:27:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QDRM61067031; Sun, 26 Feb 2012 13:27:22 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QDRMaG067029; Sun, 26 Feb 2012 13:27:22 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201202261327.q1QDRMaG067029@svn.freebsd.org> From: Justin Hibbits Date: Sun, 26 Feb 2012 13:27: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: r232176 - head/sys/modules/scc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 13:27:22 -0000 Author: jhibbits Date: Sun Feb 26 13:27:22 2012 New Revision: 232176 URL: http://svn.freebsd.org/changeset/base/232176 Log: Fix the scc(4) module build. Without the file it's missing a required symbol. Approved by: nwhitehorn (mentor) MFC after: 3 days Modified: head/sys/modules/scc/Makefile Modified: head/sys/modules/scc/Makefile ============================================================================== --- head/sys/modules/scc/Makefile Sun Feb 26 12:56:12 2012 (r232175) +++ head/sys/modules/scc/Makefile Sun Feb 26 13:27:22 2012 (r232176) @@ -6,7 +6,7 @@ scc_bfe= scc_bfe_ebus.c scc_bfe_sbus.c .endif .if ${MACHINE_CPUARCH} == "powerpc" -scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c +scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c scc_dev_quicc.c .endif KMOD= scc From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 13:45:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 929481065670; Sun, 26 Feb 2012 13:45:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 804878FC16; Sun, 26 Feb 2012 13:45:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QDjP86067632; Sun, 26 Feb 2012 13:45:25 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QDjPqc067626; Sun, 26 Feb 2012 13:45:25 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201202261345.q1QDjPqc067626@svn.freebsd.org> From: Justin Hibbits Date: Sun, 26 Feb 2012 13:45: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: r232177 - in head: etc/devd sys/conf sys/powerpc/conf 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: Sun, 26 Feb 2012 13:45:25 -0000 Author: jhibbits Date: Sun Feb 26 13:45:25 2012 New Revision: 232177 URL: http://svn.freebsd.org/changeset/base/232177 Log: Add backlight control to ATI-graphics PowerBooks and iBooks. Approved by: nwhitehorn (mentor) MFC after: 1 week Added: head/sys/powerpc/powermac/atibl.c (contents, props changed) Modified: head/etc/devd/apple.conf head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 Modified: head/etc/devd/apple.conf ============================================================================== --- head/etc/devd/apple.conf Sun Feb 26 13:27:22 2012 (r232176) +++ head/etc/devd/apple.conf Sun Feb 26 13:45:25 2012 (r232177) @@ -19,6 +19,26 @@ notify 0 { }; +# The next blocks enable brightness hotkeys that can be found on Apple laptops +notify 0 { + match "system" "PMU"; + match "subsystem" "keys"; + match "type" "brightness"; + match "notify" "down"; + action "sysctl dev.backlight.0.level=\ + $(expr `sysctl -n dev.backlight.0.level` - 10)"; +}; + +notify 0 { + match "system" "PMU"; + match "subsystem" "keys"; + match "type" "brightness"; + match "notify" "up"; + action "sysctl dev.backlight.0.level=\ + $(expr `sysctl -n dev.backlight.0.level` + 10)"; +}; + + # The next blocks enable volume hotkeys that can be found on Apple laptops notify 0 { match "system" "PMU"; Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sun Feb 26 13:27:22 2012 (r232176) +++ head/sys/conf/files.powerpc Sun Feb 26 13:45:25 2012 (r232177) @@ -145,6 +145,7 @@ powerpc/ofw/rtas.c optional aim powerpc/powermac/ata_kauai.c optional powermac ata | powermac atamacio powerpc/powermac/ata_macio.c optional powermac ata | powermac atamacio powerpc/powermac/ata_dbdma.c optional powermac ata | powermac atamacio +powerpc/powermac/atibl.c optional powermac atibl powerpc/powermac/cuda.c optional powermac cuda powerpc/powermac/cpcht.c optional powermac pci powerpc/powermac/dbdma.c optional powermac pci Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sun Feb 26 13:27:22 2012 (r232176) +++ head/sys/powerpc/conf/GENERIC Sun Feb 26 13:45:25 2012 (r232177) @@ -194,6 +194,7 @@ device max6690 # PowerMac7,2 temperatu device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit device windtunnel # Apple G4 MDD fan controller +device atibl # ATI-based backlight driver for PowerBooks/iBooks # ADB support device adb Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Sun Feb 26 13:27:22 2012 (r232176) +++ head/sys/powerpc/conf/GENERIC64 Sun Feb 26 13:45:25 2012 (r232177) @@ -188,6 +188,7 @@ device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit +device atibl # ATI-based backlight driver for PowerBooks/iBooks # ADB support device adb Added: head/sys/powerpc/powermac/atibl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powermac/atibl.c Sun Feb 26 13:45:25 2012 (r232177) @@ -0,0 +1,196 @@ +/*- + * Copyright (c) 2012 Justin Hibbits + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +/* From the xf86-video-ati driver's radeon_reg.h */ +#define RADEON_LVDS_GEN_CNTL 0x02d0 +#define RADEON_LVDS_ON (1 << 0) +#define RADEON_LVDS_DISPLAY_DIS (1 << 1) +#define RADEON_LVDS_PANEL_TYPE (1 << 2) +#define RADEON_LVDS_PANEL_FORMAT (1 << 3) +#define RADEON_LVDS_RST_FM (1 << 6) +#define RADEON_LVDS_EN (1 << 7) +#define RADEON_LVDS_BL_MOD_LEVEL_SHIFT 8 +#define RADEON_LVDS_BL_MOD_LEVEL_MASK (0xff << 8) +#define RADEON_LVDS_BL_MOD_EN (1 << 16) +#define RADEON_LVDS_DIGON (1 << 18) +#define RADEON_LVDS_BLON (1 << 19) + +struct atibl_softc { + device_t dev; + struct resource *sc_memr; +}; + +static void atibl_identify(driver_t *driver, device_t parent); +static int atibl_probe(device_t dev); +static int atibl_attach(device_t dev); +static int atibl_setlevel(struct atibl_softc *sc, int newlevel); +static int atibl_getlevel(struct atibl_softc *sc); +static int atibl_sysctl(SYSCTL_HANDLER_ARGS); + +static device_method_t atibl_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, atibl_identify), + DEVMETHOD(device_probe, atibl_probe), + DEVMETHOD(device_attach, atibl_attach), + {0, 0}, +}; + +static driver_t atibl_driver = { + "backlight", + atibl_methods, + sizeof(struct atibl_softc) +}; + +static devclass_t atibl_devclass; + +DRIVER_MODULE(atibl, vgapci, atibl_driver, atibl_devclass, 0, 0); + +static void +atibl_identify(driver_t *driver, device_t parent) +{ + if (device_find_child(parent, "backlight", -1) == NULL) + device_add_child(parent, "backlight", -1); +} + +static int +atibl_probe(device_t dev) +{ + char control[8]; + phandle_t handle; + + handle = OF_finddevice("mac-io/backlight"); + + if (handle <= 0) + return (ENXIO); + + if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0) + return (ENXIO); + + if (strcmp(control, "ati") != 0) + return (ENXIO); + + device_set_desc(dev, "PowerBook backlight"); + + return (0); +} + +static int +atibl_attach(device_t dev) +{ + struct atibl_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + int rid; + + sc = device_get_softc(dev); + + rid = 0x18; /* BAR[2], for the MMIO register */ + sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->sc_memr == NULL) { + device_printf(dev, "Could not alloc mem resource!\n"); + return (ENXIO); + } + + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "level", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + atibl_sysctl, "I", "Backlight level (0-100)"); + + return (0); +} + +static int +atibl_setlevel(struct atibl_softc *sc, int newlevel) +{ + uint32_t lvds_gen_cntl; + + if (newlevel > 100) + newlevel = 100; + + if (newlevel < 0) + newlevel = 0; + + newlevel = (newlevel * 5) / 2 + 5; + lvds_gen_cntl = bus_read_4(sc->sc_memr, RADEON_LVDS_GEN_CNTL); + lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; + lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_LEVEL_MASK; + lvds_gen_cntl |= (newlevel << RADEON_LVDS_BL_MOD_LEVEL_SHIFT) & + RADEON_LVDS_BL_MOD_LEVEL_MASK; + bus_write_4(sc->sc_memr, RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); + + return (0); +} + +static int +atibl_getlevel(struct atibl_softc *sc) +{ + uint32_t lvds_gen_cntl; + int level; + + lvds_gen_cntl = bus_read_4(sc->sc_memr, RADEON_LVDS_GEN_CNTL); + + level = ((lvds_gen_cntl & RADEON_LVDS_BL_MOD_LEVEL_MASK) >> + RADEON_LVDS_BL_MOD_LEVEL_SHIFT); + level = ((level - 5) * 2) / 5; + + return (level); +} + +static int +atibl_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct atibl_softc *sc; + int newlevel, error; + + sc = arg1; + + newlevel = atibl_getlevel(sc); + + error = sysctl_handle_int(oidp, &newlevel, 0, req); + + if (error || !req->newptr) + return (error); + + return (atibl_setlevel(sc, newlevel)); +} From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 13:51:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DDCB106566C; Sun, 26 Feb 2012 13:51:05 +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 543728FC0C; Sun, 26 Feb 2012 13:51:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QDp5Lh067830; Sun, 26 Feb 2012 13:51:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QDp571067828; Sun, 26 Feb 2012 13:51:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202261351.q1QDp571067828@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 26 Feb 2012 13:51: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: r232178 - 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, 26 Feb 2012 13:51:05 -0000 Author: kib Date: Sun Feb 26 13:51:05 2012 New Revision: 232178 URL: http://svn.freebsd.org/changeset/base/232178 Log: Remove apparently redundand checks for socket so_proto being non-NULL from sosetopt() and sogetopt(). No exposed sockets may have so_proto invalid. Discussed with: bz, rwatson Reviewed by: glebius MFC after: 2 weeks Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun Feb 26 13:45:25 2012 (r232177) +++ head/sys/kern/uipc_socket.c Sun Feb 26 13:51:05 2012 (r232178) @@ -2447,7 +2447,7 @@ sosetopt(struct socket *so, struct socko CURVNET_SET(so->so_vnet); error = 0; if (sopt->sopt_level != SOL_SOCKET) { - if (so->so_proto && so->so_proto->pr_ctloutput) { + if (so->so_proto->pr_ctloutput != NULL) { error = (*so->so_proto->pr_ctloutput)(so, sopt); CURVNET_RESTORE(); return (error); @@ -2508,8 +2508,7 @@ sosetopt(struct socket *so, struct socko error = EINVAL; goto bad; } - if (so->so_proto != NULL && - ((so->so_proto->pr_domain->dom_family == PF_INET) || + if (((so->so_proto->pr_domain->dom_family == PF_INET) || (so->so_proto->pr_domain->dom_family == PF_INET6) || (so->so_proto->pr_domain->dom_family == PF_ROUTE))) { so->so_fibnum = optval; @@ -2641,11 +2640,8 @@ sosetopt(struct socket *so, struct socko error = ENOPROTOOPT; break; } - if (error == 0 && so->so_proto != NULL && - so->so_proto->pr_ctloutput != NULL) { - (void) ((*so->so_proto->pr_ctloutput) - (so, sopt)); - } + if (error == 0 && so->so_proto->pr_ctloutput != NULL) + (void)(*so->so_proto->pr_ctloutput)(so, sopt); } bad: CURVNET_RESTORE(); @@ -2695,7 +2691,7 @@ sogetopt(struct socket *so, struct socko CURVNET_SET(so->so_vnet); error = 0; if (sopt->sopt_level != SOL_SOCKET) { - if (so->so_proto && so->so_proto->pr_ctloutput) + if (so->so_proto->pr_ctloutput != NULL) error = (*so->so_proto->pr_ctloutput)(so, sopt); else error = ENOPROTOOPT; From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 13:55:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4C96106566B; Sun, 26 Feb 2012 13:55:43 +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 D44788FC12; Sun, 26 Feb 2012 13:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QDthwV068044; Sun, 26 Feb 2012 13:55:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QDth33068041; Sun, 26 Feb 2012 13:55:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202261355.q1QDth33068041@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 26 Feb 2012 13:55: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: r232179 - 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: Sun, 26 Feb 2012 13:55:44 -0000 Author: kib Date: Sun Feb 26 13:55:43 2012 New Revision: 232179 URL: http://svn.freebsd.org/changeset/base/232179 Log: Add SO_PROTOCOL/SO_PROTOTYPE socket SOL_SOCKET-level option to get the socket protocol number. This is useful since the socket type can be implemented by different protocols in the same protocol family, e.g. SOCK_STREAM may be provided by both TCP and SCTP. Submitted by: Jukka A. Ukkonen PR: kern/162352 Discussed with: bz Reviewed by: glebius MFC after: 2 weeks Modified: head/sys/kern/uipc_socket.c head/sys/sys/socket.h Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun Feb 26 13:51:05 2012 (r232178) +++ head/sys/kern/uipc_socket.c Sun Feb 26 13:55:43 2012 (r232179) @@ -2733,6 +2733,10 @@ integer: optval = so->so_type; goto integer; + case SO_PROTOCOL: + optval = so->so_proto->pr_protocol; + goto integer; + case SO_ERROR: SOCK_LOCK(so); optval = so->so_error; Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Sun Feb 26 13:51:05 2012 (r232178) +++ head/sys/sys/socket.h Sun Feb 26 13:55:43 2012 (r232179) @@ -138,6 +138,8 @@ typedef __uid_t uid_t; #define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */ #define SO_SETFIB 0x1014 /* use this FIB to route */ #define SO_USER_COOKIE 0x1015 /* user cookie (dummynet etc.) */ +#define SO_PROTOCOL 0x1016 /* get socket protocol (Linux name) */ +#define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */ #endif /* From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 13:57:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EE411065673; Sun, 26 Feb 2012 13:57:25 +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 F249B8FC20; Sun, 26 Feb 2012 13:57:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QDvOeK068137; Sun, 26 Feb 2012 13:57:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QDvOcs068135; Sun, 26 Feb 2012 13:57:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202261357.q1QDvOcs068135@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 26 Feb 2012 13: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: r232180 - 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: Sun, 26 Feb 2012 13:57:25 -0000 Author: kib Date: Sun Feb 26 13:57:24 2012 New Revision: 232180 URL: http://svn.freebsd.org/changeset/base/232180 Log: Document SO_PROTOCOL socket option. Discussed with: bz Reviewed by: glebius MFC after: 2 weeks Modified: head/lib/libc/sys/getsockopt.2 Modified: head/lib/libc/sys/getsockopt.2 ============================================================================== --- head/lib/libc/sys/getsockopt.2 Sun Feb 26 13:55:43 2012 (r232179) +++ head/lib/libc/sys/getsockopt.2 Sun Feb 26 13:57:24 2012 (r232180) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd November 21, 2011 +.Dd February 26, 2012 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -172,6 +172,8 @@ for the socket .It Dv SO_BINTIME Ta "enables reception of a timestamp with datagrams" .It Dv SO_ACCEPTCONN Ta "get listening status of the socket (get only)" .It Dv SO_TYPE Ta "get the type of the socket (get only)" +.It Dv SO_PROTOCOL Ta "get the protocol number for the socket (get only)" +.It Dv SO_PROTOTYPE Ta "SunOS alias for the Linux SO_PROTOCOL (get only)" .It Dv SO_ERROR Ta "get and clear error on the socket (get only)" .It Dv SO_SETFIB Ta "set the associated FIB (routing table) for the socket (set only)" .El @@ -449,7 +451,10 @@ and for .Ed .Pp .Dv SO_ACCEPTCONN , -.Dv SO_TYPE +.Dv SO_TYPE , +.Dv SO_PROTOCOL +(and its alias +.Dv SO_PROTOTYPE ) and .Dv SO_ERROR are options used only with @@ -463,6 +468,12 @@ system call was invoked on the socket. returns the type of the socket, such as .Dv SOCK_STREAM ; it is useful for servers that inherit sockets on startup. +.Dv SO_PROTOCOL +returns the protocol number for the socket, for +.Dv AF_INET +and +.Dv AF_INET6 +address families. .Dv SO_ERROR returns any pending error on the socket and clears the error status. From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 14:25:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 5F1F91065670; Sun, 26 Feb 2012 14:25:05 +0000 (UTC) Date: Sun, 26 Feb 2012 14:25:05 +0000 From: Alexander Best To: Bruce Evans Message-ID: <20120226142505.GA63828@freebsd.org> References: <201202232134.q1NLYEq5024067@svn.freebsd.org> <20120224093807.GA88853@freebsd.org> <4F476FEA.1090004@FreeBSD.org> <20120224112224.GA13109@freebsd.org> <20120225061506.C2626@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120225061506.C2626@besplex.bde.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r232074 - head/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 14:25:05 -0000 On Sat Feb 25 12, Bruce Evans wrote: > On Fri, 24 Feb 2012, Alexander Best wrote: > > >On Fri Feb 24 12, Dimitry Andric wrote: > >>On 2012-02-24 10:38, Alexander Best wrote: > >>>which will turn all -Wformat-invalid-specifier and -Wformat-extra-args > >>>errors > >>>into warnings (because clang tot doesn't support -fformat-extensions)? > >> > >>It would be better to push our format extensions upstream, I think. > >>Though the option should probably be renamed to something else, e.g. > >>-ffreebsd-extensions, or such. > > It is only for format extensions. The idea is that a C compiler that > supports warning about unsupported printf formats must warn about > uses of format extensions (no matter whose they are) unless instructed > not to do so. It seems excessive to have separate flags > -fbsd-format-extensions -ffreebsd-format-extensions > -fotherbsd-format-extensions -fgnu-format-extensions > -flinux-format-extensions ..., so I used a single flag. If > -fbsd-format-extensions existed, then it would have only %b as an > extension. > > Anyway, clang already supports -fformat-extensions. The following > compiles with this, but fails messily without it: > > % #include > % > % void > % foo(void) > % { > % printf("0x%b\n", 1, "\1foo"); > % } > > gcc (FreeBSD-gcc) complains about %#b, but clang doesn't. I don't know > if %#b is valid, but it should be. > > >i'm still confused regarding the actual politics regarding this change. > >everytime this comes up i get a different answer. the last one was that > >since > >the special printf format is only used for kernel code, the > >-fformat-extensions > >code within clang base shouldn't be pushed upstream. > > Is it only the FreeBSD version of clang that has it? Does FreeBSD has any > other significant local changes? The flag should be push upstream, but > there are likely to always be OS-specific details. For example, if %#b > is indeed invalid and someone fixes the kernel to support it, you don't > want to have to wait for the upstream sources to be synchronized before > using %#b. yes. only the clang version that ships with the freebsd src has support for -fformat-extensions, however i couldn't find any referrence to it in the clang(1) manual page. so it seems the support was only hacked into the clang source and the manual page wasn't updated. getting these changes pushed upstream would be nice. it's very likely that the clang folks will rename -fformat-extensions to something else, but it shouldn't be a big problem handling the different flag names in some *.mk file. i don't know, if the freebsd of clang has any other major differences compared to the vendor version. maybe the freebsd-clang wiki page has some details about this matter (or will direct you to people who know the answer). cheers. alex > > Bruce From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 14:25:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6FF71065674; Sun, 26 Feb 2012 14:25:48 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCB738FC14; Sun, 26 Feb 2012 14:25:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QEPm32069105; Sun, 26 Feb 2012 14:25:48 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QEPm9g069102; Sun, 26 Feb 2012 14:25:48 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202261425.q1QEPm9g069102@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 26 Feb 2012 14:25: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: r232181 - 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: Sun, 26 Feb 2012 14:25:49 -0000 Author: trociny Date: Sun Feb 26 14:25:48 2012 New Revision: 232181 URL: http://svn.freebsd.org/changeset/base/232181 Log: Add sysctl to retrieve or set umask of another process. Submitted by: Dmitry Banschikov Discussed with: kib, rwatson Reviewed by: kib MFC after: 2 weeks Modified: head/sys/kern/kern_proc.c head/sys/sys/sysctl.h Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Feb 26 13:57:24 2012 (r232180) +++ head/sys/kern/kern_proc.c Sun Feb 26 14:25:48 2012 (r232181) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2471,6 +2472,49 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL return (error); } +/* + * This sysctl allows a process to retrieve or/and set umask of + * another process. + */ +static int +sysctl_kern_proc_umask(SYSCTL_HANDLER_ARGS) +{ + int *name = (int *)arg1; + u_int namelen = arg2; + struct proc *p; + int error; + u_short fd_cmask; + + if (namelen != 1) + return (EINVAL); + + if (req->newptr != NULL && req->newlen != sizeof(fd_cmask)) + return (EINVAL); + + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) + return (error); + + FILEDESC_SLOCK(p->p_fd); + fd_cmask = p->p_fd->fd_cmask; + FILEDESC_SUNLOCK(p->p_fd); + error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask)); + if (error != 0) + goto errout; + + if (req->newptr != NULL) { + error = SYSCTL_IN(req, &fd_cmask, sizeof(fd_cmask)); + if (error == 0) { + FILEDESC_XLOCK(p->p_fd); + p->p_fd->fd_cmask = fd_cmask & ALLPERMS; + FILEDESC_XUNLOCK(p->p_fd); + } + } +errout: + PRELE(p); + return (error); +} + SYSCTL_NODE(_kern, KERN_PROC, proc, CTLFLAG_RD, 0, "Process table"); SYSCTL_PROC(_kern_proc, KERN_PROC_ALL, all, CTLFLAG_RD|CTLTYPE_STRUCT| @@ -2572,3 +2616,7 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC static SYSCTL_NODE(_kern_proc, KERN_PROC_PS_STRINGS, ps_strings, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc_ps_strings, "Process ps_strings location"); + +static SYSCTL_NODE(_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RW | + CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_umask, + "Process umask"); Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Sun Feb 26 13:57:24 2012 (r232180) +++ head/sys/sys/sysctl.h Sun Feb 26 14:25:48 2012 (r232181) @@ -563,6 +563,7 @@ SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a #define KERN_PROC_AUXV 36 /* get ELF auxiliary vector */ #define KERN_PROC_RLIMIT 37 /* process resource limits */ #define KERN_PROC_PS_STRINGS 38 /* get ps_strings location */ +#define KERN_PROC_UMASK 39 /* process umask */ /* * KERN_IPC identifiers From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 14:27:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97084106564A; Sun, 26 Feb 2012 14:27:35 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D2818FC0A; Sun, 26 Feb 2012 14:27:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QERZaJ069201; Sun, 26 Feb 2012 14:27:35 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QERZqE069199; Sun, 26 Feb 2012 14:27:35 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202261427.q1QERZqE069199@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 26 Feb 2012 14:27: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: r232182 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 14:27:35 -0000 Author: trociny Date: Sun Feb 26 14:27:34 2012 New Revision: 232182 URL: http://svn.freebsd.org/changeset/base/232182 Log: When displaying security credential information show also process umask. Submitted by: Dmitry Banschikov Discussed with: rwatson MFC after: 2 weeks Modified: head/usr.bin/procstat/procstat_cred.c Modified: head/usr.bin/procstat/procstat_cred.c ============================================================================== --- head/usr.bin/procstat/procstat_cred.c Sun Feb 26 14:25:48 2012 (r232181) +++ head/usr.bin/procstat/procstat_cred.c Sun Feb 26 14:27:34 2012 (r232182) @@ -38,6 +38,8 @@ #include "procstat.h" +static const char *get_umask(struct kinfo_proc *kipp); + void procstat_cred(struct kinfo_proc *kipp) { @@ -48,9 +50,9 @@ procstat_cred(struct kinfo_proc *kipp) gid_t *groups = NULL; if (!hflag) - printf("%5s %-16s %5s %5s %5s %5s %5s %5s %5s %-15s\n", "PID", - "COMM", "EUID", "RUID", "SVUID", "EGID", "RGID", "SVGID", - "FLAGS", "GROUPS"); + printf("%5s %-16s %5s %5s %5s %5s %5s %5s %5s %5s %-15s\n", + "PID", "COMM", "EUID", "RUID", "SVUID", "EGID", "RGID", + "SVGID", "UMASK", "FLAGS", "GROUPS"); printf("%5d ", kipp->ki_pid); printf("%-16s ", kipp->ki_comm); @@ -60,6 +62,7 @@ procstat_cred(struct kinfo_proc *kipp) printf("%5d ", kipp->ki_groups[0]); printf("%5d ", kipp->ki_rgid); printf("%5d ", kipp->ki_svgid); + printf("%5s ", get_umask(kipp)); printf("%s", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ? "C" : "-"); printf(" "); @@ -98,3 +101,26 @@ procstat_cred(struct kinfo_proc *kipp) printf("\n"); } + +static const char * +get_umask(struct kinfo_proc *kipp) +{ + int error; + int mib[4]; + size_t len; + u_short fd_cmask; + static char umask[4]; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_UMASK; + mib[3] = kipp->ki_pid; + len = sizeof(fd_cmask); + error = sysctl(mib, 4, &fd_cmask, &len, NULL, 0); + if (error == 0) { + snprintf(umask, 4, "%03o", fd_cmask); + return (umask); + } else { + return ("-"); + } +} From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 15:14:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2DC4106564A; Sun, 26 Feb 2012 15:14:29 +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 A21478FC08; Sun, 26 Feb 2012 15:14:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QFETUC070812; Sun, 26 Feb 2012 15:14:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QFET0v070810; Sun, 26 Feb 2012 15:14:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202261514.q1QFET0v070810@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 26 Feb 2012 15:14: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: r232183 - 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, 26 Feb 2012 15:14:29 -0000 Author: jilles Date: Sun Feb 26 15:14:29 2012 New Revision: 232183 URL: http://svn.freebsd.org/changeset/base/232183 Log: Fix fchmod() and fchown() on fifos. The new fifo implementation in r232055 broke fchmod() and fchown() on fifos. Postfix needs this. Submitted by: gianni Reported by: dougb Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Sun Feb 26 14:27:34 2012 (r232182) +++ head/sys/kern/sys_pipe.c Sun Feb 26 15:14:29 2012 (r232183) @@ -152,6 +152,8 @@ static fo_poll_t pipe_poll; static fo_kqfilter_t pipe_kqfilter; static fo_stat_t pipe_stat; static fo_close_t pipe_close; +static fo_chmod_t pipe_chmod; +static fo_chown_t pipe_chown; struct fileops pipeops = { .fo_read = pipe_read, @@ -162,8 +164,8 @@ struct fileops pipeops = { .fo_kqfilter = pipe_kqfilter, .fo_stat = pipe_stat, .fo_close = pipe_close, - .fo_chmod = invfo_chmod, - .fo_chown = invfo_chown, + .fo_chmod = pipe_chmod, + .fo_chown = pipe_chown, .fo_flags = DFLAG_PASSABLE }; @@ -1548,6 +1550,43 @@ pipe_close(fp, td) return (0); } +static int +pipe_chmod(fp, mode, active_cred, td) + struct file *fp; + mode_t mode; + struct ucred *active_cred; + struct thread *td; +{ + struct pipe *cpipe; + int error; + + cpipe = fp->f_data; + if (cpipe->pipe_state & PIPE_NAMED) + error = vn_chmod(fp, mode, active_cred, td); + else + error = invfo_chmod(fp, mode, active_cred, td); + return (error); +} + +static int +pipe_chown(fp, uid, gid, active_cred, td) + struct file *fp; + uid_t uid; + gid_t gid; + struct ucred *active_cred; + struct thread *td; +{ + struct pipe *cpipe; + int error; + + cpipe = fp->f_data; + if (cpipe->pipe_state & PIPE_NAMED) + error = vn_chown(fp, uid, gid, active_cred, td); + else + error = invfo_chown(fp, uid, gid, active_cred, td); + return (error); +} + static void pipe_free_kmem(cpipe) struct pipe *cpipe; From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 15:32:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9706D106564A; Sun, 26 Feb 2012 15:32:02 +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 7BFCC8FC08; Sun, 26 Feb 2012 15:32:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QFW2Hg071426; Sun, 26 Feb 2012 15:32:02 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QFW285071424; Sun, 26 Feb 2012 15:32:02 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202261532.q1QFW285071424@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 26 Feb 2012 15:32: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: r232184 - head/tools/regression/fifo/fifo_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, 26 Feb 2012 15:32:02 -0000 Author: jilles Date: Sun Feb 26 15:32:02 2012 New Revision: 232184 URL: http://svn.freebsd.org/changeset/base/232184 Log: Check fchmod()/fchown() in fifo_misc test. Modified: head/tools/regression/fifo/fifo_misc/fifo_misc.c Modified: head/tools/regression/fifo/fifo_misc/fifo_misc.c ============================================================================== --- head/tools/regression/fifo/fifo_misc/fifo_misc.c Sun Feb 26 15:14:29 2012 (r232183) +++ head/tools/regression/fifo/fifo_misc/fifo_misc.c Sun Feb 26 15:32:02 2012 (r232184) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2005 Robert N. M. Watson + * Copyright (c) 2012 Jilles Tjoelker * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -223,6 +224,97 @@ test_ioctl(void) cleanfifo("testfifo", reader_fd, writer_fd); } +/* + * fchmod(2)/fchown(2) on FIFO should work. + */ +static void +test_chmodchown(void) +{ + struct stat sb; + int reader_fd, writer_fd; + uid_t u; + gid_t g; + + makefifo("testfifo", __func__); + + if (openfifo("testfifo", __func__, &reader_fd, &writer_fd) < 0) { + warn("%s: openfifo", __func__); + cleanfifo("testfifo", -1, -1); + exit(-1); + } + + if (fchmod(reader_fd, 0666) != 0) { + warn("%s: fchmod", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if (stat("testfifo", &sb) != 0) { + warn("%s: stat", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if ((sb.st_mode & 0777) != 0666) { + warnx("%s: stat chmod result", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if (fstat(writer_fd, &sb) != 0) { + warn("%s: fstat", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if ((sb.st_mode & 0777) != 0666) { + warnx("%s: fstat chmod result", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if (fchown(reader_fd, -1, -1) != 0) { + warn("%s: fchown 1", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + u = geteuid(); + if (u == 0) + u = 1; + g = getegid(); + if (fchown(reader_fd, u, g) != 0) { + warn("%s: fchown 2", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + if (stat("testfifo", &sb) != 0) { + warn("%s: stat", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if (sb.st_uid != u || sb.st_gid != g) { + warnx("%s: stat chown result", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if (fstat(writer_fd, &sb) != 0) { + warn("%s: fstat", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + if (sb.st_uid != u || sb.st_gid != g) { + warnx("%s: fstat chown result", __func__); + cleanfifo("testfifo", reader_fd, writer_fd); + exit(-1); + } + + cleanfifo("testfifo", -1, -1); +} + int main(int argc, char *argv[]) { @@ -238,6 +330,7 @@ main(int argc, char *argv[]) test_lseek(); test_truncate(); test_ioctl(); + test_chmodchown(); return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 16:05:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2EF2106566B; Sun, 26 Feb 2012 16:05:20 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23738FC1C; Sun, 26 Feb 2012 16:05:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QG5KE8072592; Sun, 26 Feb 2012 16:05:20 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QG5KfZ072590; Sun, 26 Feb 2012 16:05:20 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202261605.q1QG5KfZ072590@svn.freebsd.org> From: Kevin Lo Date: Sun, 26 Feb 2012 16:05: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: r232185 - head/sys/dev/dpt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 16:05:20 -0000 Author: kevlo Date: Sun Feb 26 16:05:20 2012 New Revision: 232185 URL: http://svn.freebsd.org/changeset/base/232185 Log: Remove duplicate assignment of CTS_SPI_VALID_SYNC_RATE bit Modified: head/sys/dev/dpt/dpt_scsi.c Modified: head/sys/dev/dpt/dpt_scsi.c ============================================================================== --- head/sys/dev/dpt/dpt_scsi.c Sun Feb 26 15:32:02 2012 (r232184) +++ head/sys/dev/dpt/dpt_scsi.c Sun Feb 26 16:05:20 2012 (r232185) @@ -1034,7 +1034,6 @@ dpt_action(struct cam_sim *sim, union cc spi->valid = CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET - | CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_BUS_WIDTH | CTS_SPI_VALID_DISC; scsi->valid = CTS_SCSI_VALID_TQ; From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 16:30:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39A97106566B; Sun, 26 Feb 2012 16:30:40 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 269C58FC14; Sun, 26 Feb 2012 16:30:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QGUebZ073542; Sun, 26 Feb 2012 16:30:40 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QGUdIZ073536; Sun, 26 Feb 2012 16:30:39 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201202261630.q1QGUdIZ073536@svn.freebsd.org> From: Martin Matuska Date: Sun, 26 Feb 2012 16:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232186 - in head: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/kern sys/sys usr.sbin/jail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 16:30:40 -0000 Author: mm Date: Sun Feb 26 16:30:39 2012 New Revision: 232186 URL: http://svn.freebsd.org/changeset/base/232186 Log: Analogous to r232059, add a parameter for the ZFS file system: allow.mount.zfs: allow mounting the zfs filesystem inside a jail This way the permssions for mounting all current VFCF_JAIL filesystems inside a jail are controlled wia allow.mount.* jail parameters. Update sysctl descriptions. Update jail(8) and zfs(8) manpages. TODO: document the connection of allow.mount.* and VFCF_JAIL for kernel developers MFC after: 10 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/kern/kern_jail.c head/sys/sys/jail.h head/usr.sbin/jail/jail.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 26 16:05:20 2012 (r232185) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 26 16:30:39 2012 (r232186) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 26, 2011 +.Dd February 26, 2012 .Dt ZFS 8 .Os .Sh NAME @@ -413,9 +413,15 @@ subcommand. You cannot attach a dataset same dataset to another jails. To allow management of the dataset from within a jail, the .Sy jailed -property has to be set. The +property has to be set and the jail needs access to the +.Pa /dev/zfs +device. The .Sy quota -property cannot be changed from within a jail. +property cannot be changed from within a jail. See +.Xr jail 8 +for information on how to allow mounting +.Tn ZFS +datasets from within a jail. .Pp .No A Tn ZFS dataset can be detached from a jail using the @@ -2715,13 +2721,12 @@ to the jail identified by JID From now on this file system tree can be managed from within a jail if the .Sy jailed property has been set. To use this functionality, the jail needs the -.Va enforce_statfs -parameter set to -.Sy 0 -and the .Va allow.mount -parameter set to -.Sy 1 . +and +.Va allow.mount.zfs +parameters set to 1 and the +.Va enforce_statfs +parameter set to a value lower than 2. .Pp See .Xr jail 8 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Feb 26 16:05:20 2012 (r232185) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Feb 26 16:30:39 2012 (r232186) @@ -60,6 +60,7 @@ #include #include #include +#include #include "zfs_comutil.h" struct mtx zfs_debug_mtx; @@ -1533,6 +1534,9 @@ zfs_mount(vfs_t *vfsp) int error = 0; int canwrite; + if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS)) + return (EPERM); + if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) return (EINVAL); Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sun Feb 26 16:05:20 2012 (r232185) +++ head/sys/kern/kern_jail.c Sun Feb 26 16:30:39 2012 (r232186) @@ -203,6 +203,7 @@ static char *pr_allow_names[] = { "allow.socket_af", "allow.mount.devfs", "allow.mount.nullfs", + "allow.mount.zfs", }; const size_t pr_allow_names_size = sizeof(pr_allow_names); @@ -216,6 +217,7 @@ static char *pr_allow_nonames[] = { "allow.nosocket_af", "allow.mount.nodevfs", "allow.mount.nonullfs", + "allow.mount.nozfs", }; const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames); @@ -4199,11 +4201,15 @@ SYSCTL_PROC(_security_jail, OID_AUTO, mo SYSCTL_PROC(_security_jail, OID_AUTO, mount_devfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_DEVFS, sysctl_jail_default_allow, "I", - "Processes in jail can mount/unmount the devfs file system"); + "Processes in jail can mount the devfs file system"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_nullfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_NULLFS, sysctl_jail_default_allow, "I", - "Processes in jail can mount/unmount the nullfs file system"); + "Processes in jail can mount the nullfs file system"); +SYSCTL_PROC(_security_jail, OID_AUTO, mount_zfs_allowed, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + NULL, PR_ALLOW_MOUNT_ZFS, sysctl_jail_default_allow, "I", + "Processes in jail can mount the zfs file system"); static int sysctl_jail_default_level(SYSCTL_HANDLER_ARGS) @@ -4347,9 +4353,11 @@ SYSCTL_JAIL_PARAM_SUBNODE(allow, mount, SYSCTL_JAIL_PARAM(_allow_mount, , CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may mount/unmount jail-friendly file systems in general"); SYSCTL_JAIL_PARAM(_allow_mount, devfs, CTLTYPE_INT | CTLFLAG_RW, - "B", "Jail may mount/unmount the devfs file system"); + "B", "Jail may mount the devfs file system"); SYSCTL_JAIL_PARAM(_allow_mount, nullfs, CTLTYPE_INT | CTLFLAG_RW, - "B", "Jail may mount/unmount the nullfs file system"); + "B", "Jail may mount the nullfs file system"); +SYSCTL_JAIL_PARAM(_allow_mount, zfs, CTLTYPE_INT | CTLFLAG_RW, + "B", "Jail may mount the zfs file system"); void prison_racct_foreach(void (*callback)(struct racct *racct, Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Sun Feb 26 16:05:20 2012 (r232185) +++ head/sys/sys/jail.h Sun Feb 26 16:30:39 2012 (r232186) @@ -225,7 +225,8 @@ struct prison_racct { #define PR_ALLOW_SOCKET_AF 0x0040 #define PR_ALLOW_MOUNT_DEVFS 0x0080 #define PR_ALLOW_MOUNT_NULLFS 0x0100 -#define PR_ALLOW_ALL 0x01ff +#define PR_ALLOW_MOUNT_ZFS 0x0200 +#define PR_ALLOW_ALL 0x03ff /* * OSD methods Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Sun Feb 26 16:05:20 2012 (r232185) +++ head/usr.sbin/jail/jail.8 Sun Feb 26 16:30:39 2012 (r232186) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2012 +.Dd February 26, 2012 .Dt JAIL 8 .Os .Sh NAME @@ -427,6 +427,17 @@ This permission is effective only togeth and if .Va enforce_statfs is set to a value lower than 2. +.It Va allow.mount.zfs +privileged users inside the jail will be able to mount and unmount the +ZFS file system. +This permission is effective only together with +.Va allow.mount +and if +.Va enforce_statfs +is set to a value lower than 2. See +.Xr zfs 8 +for information on how to configure the ZFS filesystem to operate from +within a jail. .It Va allow.quotas The prison root may administer quotas on the jail's filesystem(s). This includes filesystems that the jail may share with other jails or From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 17:39:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE200106566C; Sun, 26 Feb 2012 17:39:47 +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 5EE7F8FC13; Sun, 26 Feb 2012 17:39:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QHdlgB076015; Sun, 26 Feb 2012 17:39:47 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QHdluw076013; Sun, 26 Feb 2012 17:39:47 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202261739.q1QHdluw076013@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 26 Feb 2012 17:39: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: r232187 - head/usr.bin/xargs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 17:39:47 -0000 Author: jilles Date: Sun Feb 26 17:39:46 2012 New Revision: 232187 URL: http://svn.freebsd.org/changeset/base/232187 Log: xargs: Fix comma splice in error message. Reported by: bde Modified: head/usr.bin/xargs/xargs.c Modified: head/usr.bin/xargs/xargs.c ============================================================================== --- head/usr.bin/xargs/xargs.c Sun Feb 26 16:30:39 2012 (r232186) +++ head/usr.bin/xargs/xargs.c Sun Feb 26 17:39:46 2012 (r232187) @@ -609,10 +609,10 @@ waitchildren(const char *name, int waita * exit 1-125. */ if (WIFSIGNALED(status)) - errx(1, "%s: terminated with signal %d, aborting", + errx(1, "%s: terminated with signal %d; aborting", name, WTERMSIG(status)); if (WEXITSTATUS(status) == 255) - errx(1, "%s: exited with status 255, aborting", name); + errx(1, "%s: exited with status 255; aborting", name); if (WEXITSTATUS(status)) rval = 1; } From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 19:10:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B42D1065670; Sun, 26 Feb 2012 19:10:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8682C8FC0C; Sun, 26 Feb 2012 19:10:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QJAE5x079072; Sun, 26 Feb 2012 19:10:14 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QJAEsj079070; Sun, 26 Feb 2012 19:10:14 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201202261910.q1QJAEsj079070@svn.freebsd.org> From: Alan Cox Date: Sun, 26 Feb 2012 19:10: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: r232192 - 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, 26 Feb 2012 19:10:14 -0000 Author: alc Date: Sun Feb 26 19:10:14 2012 New Revision: 232192 URL: http://svn.freebsd.org/changeset/base/232192 Log: Fix typo. MFC after: 1 week Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Feb 26 19:05:17 2012 (r232191) +++ head/sys/kern/vfs_bio.c Sun Feb 26 19:10:14 2012 (r232192) @@ -3062,7 +3062,7 @@ allocbuf(struct buf *bp, int size) /* * We must allocate system pages since blocking - * here could intefere with paging I/O, no + * here could interfere with paging I/O, no * matter which process we are. * * We can only test VPO_BUSY here. Blocking on From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 20:56:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E43E6106564A; Sun, 26 Feb 2012 20:56:49 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF3F58FC08; Sun, 26 Feb 2012 20:56:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QKunKk082816; Sun, 26 Feb 2012 20:56:49 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QKunNg082814; Sun, 26 Feb 2012 20:56:49 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <201202262056.q1QKunNg082814@svn.freebsd.org> From: Poul-Henning Kamp Date: Sun, 26 Feb 2012 20:56: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: r232197 - 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, 26 Feb 2012 20:56:50 -0000 Author: phk Date: Sun Feb 26 20:56:49 2012 New Revision: 232197 URL: http://svn.freebsd.org/changeset/base/232197 Log: Also call the low-level driver if ->c_iflag & (IXON|IXOFF|IXANY) changes. Uftdi(4) examines (c_iflag & (IXON|IXOFF)) to control hw XON-XOFF support. This is obviously no good, if changes to those bits are not communicated down the stack. Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Feb 26 20:30:21 2012 (r232196) +++ head/sys/kern/tty.c Sun Feb 26 20:56:49 2012 (r232197) @@ -1481,6 +1481,8 @@ tty_generic_ioctl(struct tty *tp, u_long */ if ((t->c_cflag & CIGNORE) == 0 && (tp->t_termios.c_cflag != t->c_cflag || + ((tp->t_termios.c_iflag ^ t->c_iflag) & + (IXON|IXOFF|IXANY)) || tp->t_termios.c_ispeed != t->c_ispeed || tp->t_termios.c_ospeed != t->c_ospeed)) { error = ttydevsw_param(tp, t); From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 21:02:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EB8D1065670; Sun, 26 Feb 2012 21:02:32 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 080F88FC0A; Sun, 26 Feb 2012 21:02:31 +0000 (UTC) Received: by qao25 with SMTP id 25so1146208qao.13 for ; Sun, 26 Feb 2012 13:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=7kg67PPUZ1D0T2GkCJKRMqBsHeIByyjCoQpjKuuBX1g=; b=OwcGCpTvewKyUDAnwUzIl1vWaJl+1GF36/u+NvCjieSn10Sb161GeQv3bqJsHMui9X o/GYAzSQg8fmWBP6QanSDWpx+1IC2R7c4EOIacEfM2Yprsu4ysMbmAcyQ96lkQARimKE /M4EoQa9j3VZ0Zkk7p7nPU7tdpAhdcsU/pGE0= MIME-Version: 1.0 Received: by 10.224.174.72 with SMTP id s8mr7031919qaz.67.1330288684611; Sun, 26 Feb 2012 12:38:04 -0800 (PST) Received: by 10.229.82.7 with HTTP; Sun, 26 Feb 2012 12:38:04 -0800 (PST) In-Reply-To: <201202261514.q1QFET0v070810@svn.freebsd.org> References: <201202261514.q1QFET0v070810@svn.freebsd.org> Date: Sun, 26 Feb 2012 21:38:04 +0100 Message-ID: From: Giovanni Trematerra To: Jilles Tjoelker 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: r232183 - 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, 26 Feb 2012 21:02:32 -0000 On Sun, Feb 26, 2012 at 4:14 PM, Jilles Tjoelker wrote= : > Author: jilles > Date: Sun Feb 26 15:14:29 2012 > New Revision: 232183 > URL: http://svn.freebsd.org/changeset/base/232183 > > Log: > =A0Fix fchmod() and fchown() on fifos. > > =A0The new fifo implementation in r232055 broke fchmod() and fchown() on = fifos. > =A0Postfix needs this. > > =A0Submitted by: gianni > =A0Reported by: =A0dougb > > Modified: > =A0head/sys/kern/sys_pipe.c > Thank you. And just for the record: Pointy hat to: gianni From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 21:12:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE75C106566B; Sun, 26 Feb 2012 21:12:51 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 46BDB8FC08; Sun, 26 Feb 2012 21:12:51 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id CF8522A28CC5; Sun, 26 Feb 2012 22:12:48 +0100 (CET) Date: Sun, 26 Feb 2012 22:12:48 +0100 From: Ed Schouten To: Jilles Tjoelker Message-ID: <20120226211248.GO32748@hoeg.nl> References: <201202261514.q1QFET0v070810@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="muT+E17Lr9urPYYJ" Content-Disposition: inline In-Reply-To: <201202261514.q1QFET0v070810@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232183 - 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, 26 Feb 2012 21:12:51 -0000 --muT+E17Lr9urPYYJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jilles, * Jilles Tjoelker , 20120226 16:14: > +static int > +pipe_chmod(fp, mode, active_cred, td) > + struct file *fp; > + mode_t mode; > + struct ucred *active_cred; > + struct thread *td; > +{ > + struct pipe *cpipe; > + int error; > + > + cpipe =3D fp->f_data; > + if (cpipe->pipe_state & PIPE_NAMED) > + error =3D vn_chmod(fp, mode, active_cred, td); > + else > + error =3D invfo_chmod(fp, mode, active_cred, td); > + return (error); > +} Maybe this would be a useless optimisation, but wouldn't it be better to just use two separate struct fileops here? --=20 Ed Schouten WWW: http://80386.nl/ --muT+E17Lr9urPYYJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iQIcBAEBAgAGBQJPSqBQAAoJEG5e2P40kaK7d6wP/A5/zifopAwbfdOAYtZxltsR 71A7spratlXH4d+hTpw8T2UERHZ/f12FieBTodAVgzr3lJ75P+5l+gR3gM3MWhIG Zgz712HcCdkFyo6JnFx2PY4HeyRGvErBrvJ3vCbAXN1quwSynShvwOvFhP+45yAK FjsV2KQmQ+1sNQdH2oftP1QpcX/dAjU2olRDyP+8QGNmSK7w2IAKJkzuV7FieMc2 rtj36QyElaNGJJCOGpJvfgyaNI5ly0U1s3P2G32zXLLzor0/TuWc5VAMEHZquTcu TGKMvTx/0XzanAv4Xyot9qaslaWtBNSOvzzpCUu7mbMCXawE14HPp7kBQ3LnQbxH VUTtGtD+Voo1skc4xtW1ad42dHgH4k8+f3mw0pzYtibiNxn3SwDmW8mi2j0EHaiE MeJuinX4u7G6IsA5dTvEHuzQV/Nc60RfgmJRMpPNdjtu6z0wGyi8wN8MGgDsHSq7 O/GaDkMsN2J96Fu/ejYFQGKlJIy8kPZ3FPaE5IgUp2L5+VCFPhO/B//xHW7p+flF H7PILa7RQtw2HC6zX8vquS8KpBJJeigmqpIH0yb4RnNeB3Exh1Q5uXVhshJBm9OD ytK7jycShznMSE2ySMwCfwteXRuzVXt1wpbim7CYA2NNGii09h34IPp3+fKSwNbN YLobmbuadEF3XMRVvZq8 =FLIB -----END PGP SIGNATURE----- --muT+E17Lr9urPYYJ-- From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 21:24:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70AEA106566B; Sun, 26 Feb 2012 21:24:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 420F68FC08; Sun, 26 Feb 2012 21:24:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QLO3Vk083687; Sun, 26 Feb 2012 21:24:03 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QLO3O8083685; Sun, 26 Feb 2012 21:24:03 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201202262124.q1QLO3O8083685@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 26 Feb 2012 21:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232198 - stable/9/sys/dev/sound/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 21:24:03 -0000 Author: hselasky Date: Sun Feb 26 21:24:02 2012 New Revision: 232198 URL: http://svn.freebsd.org/changeset/base/232198 Log: MFC r232039: Avoid creating PCM devices for MIDI only adapters. Modified: stable/9/sys/dev/sound/usb/uaudio.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/9/sys/dev/sound/usb/uaudio.c Sun Feb 26 20:56:49 2012 (r232197) +++ stable/9/sys/dev/sound/usb/uaudio.c Sun Feb 26 21:24:02 2012 (r232198) @@ -626,21 +626,21 @@ uaudio_attach(device_t dev) sc->sc_mixer_count); if (sc->sc_play_chan.valid) { - device_printf(dev, "Play: %d Hz, %d ch, %s format\n", + device_printf(dev, "Play: %d Hz, %d ch, %s format.\n", sc->sc_play_chan.sample_rate, sc->sc_play_chan.p_asf1d->bNrChannels, sc->sc_play_chan.p_fmt->description); } else { - device_printf(dev, "No playback!\n"); + device_printf(dev, "No playback.\n"); } if (sc->sc_rec_chan.valid) { - device_printf(dev, "Record: %d Hz, %d ch, %s format\n", + device_printf(dev, "Record: %d Hz, %d ch, %s format.\n", sc->sc_rec_chan.sample_rate, sc->sc_rec_chan.p_asf1d->bNrChannels, sc->sc_rec_chan.p_fmt->description); } else { - device_printf(dev, "No recording!\n"); + device_printf(dev, "No recording.\n"); } if (sc->sc_midi_chan.valid) { @@ -648,9 +648,9 @@ uaudio_attach(device_t dev) if (umidi_probe(dev)) { goto detach; } - device_printf(dev, "MIDI sequencer\n"); + device_printf(dev, "MIDI sequencer.\n"); } else { - device_printf(dev, "No midi sequencer\n"); + device_printf(dev, "No midi sequencer.\n"); } DPRINTF("doing child attach\n"); @@ -659,13 +659,21 @@ uaudio_attach(device_t dev) sc->sc_sndcard_func.func = SCF_PCM; - child = device_add_child(dev, "pcm", -1); + /* + * Only attach a PCM device if we have a playback, recording + * or mixer device present: + */ + if (sc->sc_play_chan.valid || + sc->sc_rec_chan.valid || + sc->sc_mix_info) { + child = device_add_child(dev, "pcm", -1); - if (child == NULL) { - DPRINTF("out of memory\n"); - goto detach; + if (child == NULL) { + DPRINTF("out of memory\n"); + goto detach; + } + device_set_ivars(child, &sc->sc_sndcard_func); } - device_set_ivars(child, &sc->sc_sndcard_func); if (bus_generic_attach(dev)) { DPRINTF("child attach failed\n"); From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 21:24:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0C221065849; Sun, 26 Feb 2012 21:24:27 +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 ACC498FC17; Sun, 26 Feb 2012 21:24:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QLORPl083738; Sun, 26 Feb 2012 21:24:27 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QLORF6083736; Sun, 26 Feb 2012 21:24:27 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201202262124.q1QLORF6083736@svn.freebsd.org> From: Alexander Kabaev Date: Sun, 26 Feb 2012 21:24: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: r232199 - head/sys/x86/cpufreq X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 21:24:27 -0000 Author: kan Date: Sun Feb 26 21:24:27 2012 New Revision: 232199 URL: http://svn.freebsd.org/changeset/base/232199 Log: Fix apparent logic reversal in setting the 'auto_mode' flag. MFC after: 2 weeks Modified: head/sys/x86/cpufreq/p4tcc.c Modified: head/sys/x86/cpufreq/p4tcc.c ============================================================================== --- head/sys/x86/cpufreq/p4tcc.c Sun Feb 26 21:24:02 2012 (r232198) +++ head/sys/x86/cpufreq/p4tcc.c Sun Feb 26 21:24:27 2012 (r232199) @@ -276,9 +276,9 @@ p4tcc_set(device_t dev, const struct cf_ * what the current mode. */ if (msr & TCC_ENABLE_ONDEMAND) - sc->auto_mode = TRUE; - else sc->auto_mode = FALSE; + else + sc->auto_mode = TRUE; return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 22:09:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FEED106566B; Sun, 26 Feb 2012 22:09:22 +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 30F318FC08; Sun, 26 Feb 2012 22:09:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QM9MqB085092; Sun, 26 Feb 2012 22:09:22 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QM9LdP085089; Sun, 26 Feb 2012 22:09:21 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201202262209.q1QM9LdP085089@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 26 Feb 2012 22:09: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: r232200 - in head/usr.sbin/bsdinstall: distextract distfetch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 22:09:22 -0000 Author: nwhitehorn Date: Sun Feb 26 22:09:21 2012 New Revision: 232200 URL: http://svn.freebsd.org/changeset/base/232200 Log: Fix segfault if distfetch and distextract binaries are run standalone without the DISTRIBUTIONS environment variable set. PR: bin/165492 Submitted by: Fernando Apesteguia MFC after: 4 days Modified: head/usr.sbin/bsdinstall/distextract/distextract.c head/usr.sbin/bsdinstall/distfetch/distfetch.c Modified: head/usr.sbin/bsdinstall/distextract/distextract.c ============================================================================== --- head/usr.sbin/bsdinstall/distextract/distextract.c Sun Feb 26 21:24:27 2012 (r232199) +++ head/usr.sbin/bsdinstall/distextract/distextract.c Sun Feb 26 22:09:21 2012 (r232200) @@ -38,9 +38,16 @@ static int extract_files(int nfiles, con int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; const char **dists; int i, retval, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; Modified: head/usr.sbin/bsdinstall/distfetch/distfetch.c ============================================================================== --- head/usr.sbin/bsdinstall/distfetch/distfetch.c Sun Feb 26 21:24:27 2012 (r232199) +++ head/usr.sbin/bsdinstall/distfetch/distfetch.c Sun Feb 26 22:09:21 2012 (r232200) @@ -37,9 +37,16 @@ static int fetch_files(int nfiles, char int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; char **urls; int i, nfetched, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 22:28:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD12D106564A; Sun, 26 Feb 2012 22:28:44 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 230A38FC08; Sun, 26 Feb 2012 22:28:43 +0000 (UTC) Received: by qao25 with SMTP id 25so1171098qao.13 for ; Sun, 26 Feb 2012 14:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=W9/HjDIOPku7/ONd5W9FGotIXGM51et9/h277uL/0QU=; b=I9KwvxxJoDi5+sX/DBxtQf/lODrF6eK26UpQqJwd9C4gqvTHxu8RlBQTQ8WVZtg1/T V4Z+w472X0+upS+fGnIyRKs4foUR3VP1cIY+DnbHIVwCsRDg+yCj+ldz1ZSc7bzMnT7l bNno0QcKLwH1T9t3W0kzmkKthdHUb0FXqoSDc= MIME-Version: 1.0 Received: by 10.224.195.135 with SMTP id ec7mr7504046qab.54.1330295322591; Sun, 26 Feb 2012 14:28:42 -0800 (PST) Received: by 10.229.82.7 with HTTP; Sun, 26 Feb 2012 14:28:42 -0800 (PST) In-Reply-To: <20120226211248.GO32748@hoeg.nl> References: <201202261514.q1QFET0v070810@svn.freebsd.org> <20120226211248.GO32748@hoeg.nl> Date: Sun, 26 Feb 2012 23:28:42 +0100 Message-ID: From: Giovanni Trematerra To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Jilles Tjoelker , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232183 - 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, 26 Feb 2012 22:28:44 -0000 On Sun, Feb 26, 2012 at 10:12 PM, Ed Schouten wrote: > Hi Jilles, > > * Jilles Tjoelker , 20120226 16:14: >> +static int >> +pipe_chmod(fp, mode, active_cred, td) >> + =A0 =A0 struct file *fp; >> + =A0 =A0 mode_t mode; >> + =A0 =A0 struct ucred *active_cred; >> + =A0 =A0 struct thread *td; >> +{ >> + =A0 =A0 struct pipe *cpipe; >> + =A0 =A0 int error; >> + >> + =A0 =A0 cpipe =3D fp->f_data; >> + =A0 =A0 if (cpipe->pipe_state & PIPE_NAMED) >> + =A0 =A0 =A0 =A0 =A0 =A0 error =3D vn_chmod(fp, mode, active_cred, td); >> + =A0 =A0 else >> + =A0 =A0 =A0 =A0 =A0 =A0 error =3D invfo_chmod(fp, mode, active_cred, t= d); >> + =A0 =A0 return (error); >> +} > > Maybe this would be a useless optimisation, but wouldn't it be better to > just use two separate struct fileops here? > I don't think the problem here is related to performance. it might be a problem of readability. I prefer to use one fileops for pipes and fifos just to remark that fifos are actual pipes. If others think that would be better to have two separated fileops, for readability, I'm not against it. -- Gianni From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 23:06:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9D32106566C; Sun, 26 Feb 2012 23:06:30 +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 C4C528FC0C; Sun, 26 Feb 2012 23:06:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QN6Upc086992; Sun, 26 Feb 2012 23:06:30 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QN6UiM086990; Sun, 26 Feb 2012 23:06:30 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202262306.q1QN6UiM086990@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 26 Feb 2012 23:06: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: r232201 - head/usr.bin/xargs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 23:06:30 -0000 Author: jilles Date: Sun Feb 26 23:06:30 2012 New Revision: 232201 URL: http://svn.freebsd.org/changeset/base/232201 Log: xargs: Remove an unclear comment that only tried to repeat what the code did Reported by: bde Modified: head/usr.bin/xargs/xargs.c Modified: head/usr.bin/xargs/xargs.c ============================================================================== --- head/usr.bin/xargs/xargs.c Sun Feb 26 22:09:21 2012 (r232200) +++ head/usr.bin/xargs/xargs.c Sun Feb 26 23:06:30 2012 (r232201) @@ -604,10 +604,6 @@ waitchildren(const char *name, int waita errno = childerr; err(errno == ENOENT ? 127 : 126, "%s", name); } - /* - * If utility signaled or exited with a value of 255, - * exit 1-125. - */ if (WIFSIGNALED(status)) errx(1, "%s: terminated with signal %d; aborting", name, WTERMSIG(status)); From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 23:25:43 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F9AB106564A; Sun, 26 Feb 2012 23:25:43 +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 8FB638FC18; Sun, 26 Feb 2012 23:25:42 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 4EA0B1DD416; Mon, 27 Feb 2012 00:25:41 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 1FBDD28470; Mon, 27 Feb 2012 00:25:41 +0100 (CET) Date: Mon, 27 Feb 2012 00:25:40 +0100 From: Jilles Tjoelker To: Bruce Evans Message-ID: <20120226232540.GA34962@stack.nl> References: <201202241235.q1OCZH2U059017@svn.freebsd.org> <20120225024051.C1150@besplex.bde.org> <20120224210141.GA3223@stack.nl> <20120225084319.P3207@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120225084319.P3207@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r232108 - head/usr.bin/xargs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 26 Feb 2012 23:25:43 -0000 On Sat, Feb 25, 2012 at 09:10:04AM +1100, Bruce Evans wrote: > On Fri, 24 Feb 2012, Jilles Tjoelker wrote: > > > On Sat, Feb 25, 2012 at 04:27:35AM +1100, Bruce Evans wrote: > > ... > >> Utilities are quite broken near here too: > >> - under -current: > >> - utilities still don't support signals >= 32, but give better error > >> messages. > > > > kill(1) (both /bin/kill and the 9.x/10.x sh builtin) has passed > > arbitrary signal numbers to kill(2) for quite a while. > > Apparently I got confused by testing several versions. In -current, > the bugs are just that: > - bash-4.2 builtin kill doesn't understand signals >= 32, despite > supposedly being configured for FreeBSD > - bash-4.2 prints confusing termination messages which made me think > that /bin/kill didn't work: > - for signal 127, it prints "Stopped ..." > - for signal 126, it prints "Unknown signal: 126". I didn't notice > this was printed by bash(1) and not by kill(1). > A bug in builtin kill turned up: with kill(1), both bash and sh print > the termination message immediately, with builtin kill neither prints > it until a newline is entered. That's not a bug, but a normal race condition. With external kill, the kill process usually takes long enough to shut down and be waited for that the kill victim will have terminated too. With builtin kill, the shell proceeds very quickly and often the kill victim will not have terminated yet. > >> Neither WIFSTOPPED() nor WIFEXITED() are tested, so the result of the > >> misclassification is turning signal 127 into a normal exit with status > >> 0. A normal WIFSTOPPED() should not get here, else job control would > >> just break xargs, so the bug can probably be worked around by turning > >> WIFSTOPPED() into WIFSIGNALED() here, or just blindly using WTERMSIG() > >> != 0 to classify signals. > > I don't think xargs should work around that bug, particularly not by > > introducing unspecified behaviour (the value of WTERMSIG(x) when > > !WIFSIGNALED(x)). > OK. So it needs to be disallowed in the kernel. Hmm. The kernel allows 0 <= sig <= 128 (_SIG_MAXSIG). It also allows signals 33..64 which do not have a documented meaning. I wonder what will break if I change _SIG_MAXSIG to 126. This will disallow all operations on signals 127 and 128 and change the sigacts structure. Alternatively, the check in sys_kill() and friends could be tightened. -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 00:11:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ABDB106566B; Mon, 27 Feb 2012 00:11:51 +0000 (UTC) (envelope-from pawel.worach@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id B25458FC0A; Mon, 27 Feb 2012 00:11:49 +0000 (UTC) Received: by lagz14 with SMTP id z14so6743553lag.13 for ; Sun, 26 Feb 2012 16:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=A+ofTZI8oAXq3PsVhpjghCbuTgQIYWbL8an2YdEUdt4=; b=hdBkswxMeY3uho88ASGr7Ofu0r3ONqNNpGDwvCRpZmcqn/P0RrqUMfMn0klNqasy0w alqbxFkzJT+jGsSPO+byJS0kasn6Et0qoDZrSYSCofa0erb0fK7oD24CX1xQIsaeXxZ4 tOpJJ5S6D7beNprxxr56Pc4XY9hNURbSmHbMI= Received: by 10.152.130.102 with SMTP id od6mr7845743lab.14.1330299970897; Sun, 26 Feb 2012 15:46:10 -0800 (PST) Received: from [172.16.0.199] (host-78-64-61-69.homerun.telia.com. [78.64.61.69]) by mx.google.com with ESMTPS id mj2sm11925996lab.2.2012.02.26.15.46.08 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 26 Feb 2012 15:46:09 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=iso-8859-1 From: Pawel Worach In-Reply-To: <4F476FEA.1090004@FreeBSD.org> Date: Mon, 27 Feb 2012 00:46:06 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201202232134.q1NLYEq5024067@svn.freebsd.org> <20120224093807.GA88853@freebsd.org> <4F476FEA.1090004@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1257) Cc: svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232074 - head/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 00:11:51 -0000 On Feb 24, 2012, at 12:09, Dimitry Andric wrote: > On 2012-02-24 10:38, Alexander Best wrote: >> is the clang version in base able to do complete universe builds for = i386 and >> amd64 without the need for NO_WERROR=3D and WERROR=3D now? >=20 > "universe" means all arches, and all kernel configs, so no. The = status > for head with clang is as follows: >=20 > - buildworld with default options, e.g. no WITH_XXX or WITHOUT_XXX > settings, will complete without any (fatal) warnings. > - buildkernel of the default GENERIC config still has one warning = left, > in sys/dev/mps/mps_sas.c. It should be simple to fix, but I'm > checking it with Ken first. > - The LINT kernel configs probably have many warnings left. I haven't > tested those extensively. >=20 > As soon as world & kernel compile without warnings, I'd like to have a > tinderbox that continually builds with clang. So head won't be > regressing any more. :) >=20 >=20 >> ps: are there any plans to add support for compiling kernel+userland = with clang >> tot? maybe this can be accomplished by doing something like >>=20 >> echo "WITH_CLANG_TOT=3Dyes" >> /etc/src.conf >=20 > I'm not working on this at the moment. Pawel Worach (CC'd) has a > buildbot setup that builds FreeBSD daily with clang ToT. Apparently > just a few patches are needed. You will find all the patches and hacks to build FreeBSD with llvm/clang = trunk here: http://llvm-amd64.freebsd.your.org/patches/ clang-*.diff contains the FreeBSD local changes, -fformat-extensions and = worldtmp prefix stuff. freebsd-*.diff contains the patches for FreeBSD to fix/disable -Werror = warnings found by clang trunk and needed hacks to the build infrastructure to use an out-of-tree = compiler. Just set CC and CXX to the *full path* of your custom version of clang. >> which will turn all -Wformat-invalid-specifier and = -Wformat-extra-args errors >> into warnings (because clang tot doesn't support = -fformat-extensions)? >=20 > It would be better to push our format extensions upstream, I think. > Though the option should probably be renamed to something else, e.g. > -ffreebsd-extensions, or such. --=20 Pawel From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 01:48:48 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E229E106564A; Mon, 27 Feb 2012 01:48:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au [211.29.132.196]) by mx1.freebsd.org (Postfix) with ESMTP id 6152E8FC0A; Mon, 27 Feb 2012 01:48:47 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1R1mhds008571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Feb 2012 12:48:45 +1100 Date: Mon, 27 Feb 2012 12:48:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jilles Tjoelker In-Reply-To: <20120226232540.GA34962@stack.nl> Message-ID: <20120227123912.I2260@besplex.bde.org> References: <201202241235.q1OCZH2U059017@svn.freebsd.org> <20120225024051.C1150@besplex.bde.org> <20120224210141.GA3223@stack.nl> <20120225084319.P3207@besplex.bde.org> <20120226232540.GA34962@stack.nl> 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, Bruce Evans Subject: Re: svn commit: r232108 - head/usr.bin/xargs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 01:48:49 -0000 On Mon, 27 Feb 2012, Jilles Tjoelker wrote: > On Sat, Feb 25, 2012 at 09:10:04AM +1100, Bruce Evans wrote: >> On Fri, 24 Feb 2012, Jilles Tjoelker wrote: >>> I don't think xargs should work around that bug, particularly not by >>> introducing unspecified behaviour (the value of WTERMSIG(x) when >>> !WIFSIGNALED(x)). > >> OK. So it needs to be disallowed in the kernel. > > Hmm. The kernel allows 0 <= sig <= 128 (_SIG_MAXSIG). It also allows > signals 33..64 which do not have a documented meaning. > > I wonder what will break if I change _SIG_MAXSIG to 126. This will > disallow all operations on signals 127 and 128 and change the sigacts > structure. Alternatively, the check in sys_kill() and friends could be > tightened. I forgot about the extra one. 128 gives slightly more brokenness than 127 -- shells are confused by it, and turn it into $? = 0. Was the old PR about #127 or #128 or both? I think nothing should be using these signals, so nothing should break if you change _SIG_MAXSIG to 126 and change the sigacts struct to use a harder-coded 128. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 05:49:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0C1D106566C; Mon, 27 Feb 2012 05:49:00 +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 B378B8FC12; Mon, 27 Feb 2012 05:49:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1R5n0Pm000115; Mon, 27 Feb 2012 05:49:00 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1R5n0gG000113; Mon, 27 Feb 2012 05:49:00 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201202270549.q1R5n0gG000113@svn.freebsd.org> From: Xin LI Date: Mon, 27 Feb 2012 05:49: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: r232202 - head/usr.sbin/cron/crontab X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 05:49:01 -0000 Author: delphij Date: Mon Feb 27 05:49:00 2012 New Revision: 232202 URL: http://svn.freebsd.org/changeset/base/232202 Log: Drop setuid status while doing file operations to prevent potential information leak. This changeset is intended to be a minimal one to make backports easier. Reviewed by: kevlo, remko MFC after: 1 week Modified: head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Sun Feb 26 23:06:30 2012 (r232201) +++ head/usr.sbin/cron/crontab/crontab.c Mon Feb 27 05:49:00 2012 (r232202) @@ -194,6 +194,17 @@ parse_args(argc, argv) } if (Option == opt_replace) { + /* relinquish the setuid status of the binary during + * the open, lest nonroot users read files they should + * not be able to read. we can't use access() here + * since there's a race condition. thanks go out to + * Arnt Gulbrandsen for spotting + * the race. + */ + + if (swap_uids() < OK) + err(ERROR_EXIT, "swapping uids"); + /* we have to open the file here because we're going to * chdir(2) into /var/cron before we get around to * reading the file. @@ -204,21 +215,11 @@ parse_args(argc, argv) !strcmp(resolved_path, SYSCRONTAB)) { err(ERROR_EXIT, SYSCRONTAB " must be edited manually"); } else { - /* relinquish the setuid status of the binary during - * the open, lest nonroot users read files they should - * not be able to read. we can't use access() here - * since there's a race condition. thanks go out to - * Arnt Gulbrandsen for spotting - * the race. - */ - - if (swap_uids() < OK) - err(ERROR_EXIT, "swapping uids"); if (!(NewCrontab = fopen(Filename, "r"))) err(ERROR_EXIT, "%s", Filename); - if (swap_uids_back() < OK) - err(ERROR_EXIT, "swapping uids back"); } + if (swap_uids_back() < OK) + err(ERROR_EXIT, "swapping uids back"); } Debug(DMISC, ("user=%s, file=%s, option=%s\n", @@ -363,11 +364,15 @@ edit_cmd() { goto fatal; } again: + if (swap_uids() < OK) + err(ERROR_EXIT, "swapping uids"); if (stat(Filename, &statbuf) < 0) { warn("stat"); fatal: unlink(Filename); exit(ERROR_EXIT); } + if (swap_uids_back() < OK) + err(ERROR_EXIT, "swapping uids back"); if (statbuf.st_dev != fsbuf.st_dev || statbuf.st_ino != fsbuf.st_ino) errx(ERROR_EXIT, "temp file must be edited in place"); if (MD5File(Filename, orig_md5) == NULL) { @@ -433,6 +438,8 @@ edit_cmd() { editor, WTERMSIG(waiter), WCOREDUMP(waiter) ?"" :"no "); goto fatal; } + if (swap_uids() < OK) + err(ERROR_EXIT, "swapping uids"); if (stat(Filename, &statbuf) < 0) { warn("stat"); goto fatal; @@ -443,6 +450,8 @@ edit_cmd() { warn("MD5"); goto fatal; } + if (swap_uids_back() < OK) + err(ERROR_EXIT, "swapping uids back"); if (strcmp(orig_md5, new_md5) == 0 && !syntax_error) { warnx("no changes made to crontab"); goto remove; From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 08:29:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B424106566B; Mon, 27 Feb 2012 08:29:29 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 4F73F8FC0C; Mon, 27 Feb 2012 08:29:29 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 9BFB5F5B; Mon, 27 Feb 2012 09:29:27 +0100 (CET) Date: Mon, 27 Feb 2012 09:28:11 +0100 From: Pawel Jakub Dawidek To: Mikolaj Golub Message-ID: <20120227082811.GC1363@garage.freebsd.pl> References: <201202261425.q1QEPm9g069102@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kVXhAStRUZ/+rrGn" Content-Disposition: inline In-Reply-To: <201202261425.q1QEPm9g069102@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232181 - 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: Mon, 27 Feb 2012 08:29:29 -0000 --kVXhAStRUZ/+rrGn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: > Author: trociny > Date: Sun Feb 26 14:25:48 2012 > New Revision: 232181 > URL: http://svn.freebsd.org/changeset/base/232181 >=20 > Log: > Add sysctl to retrieve or set umask of another process. "set umask of another process"? This seems... weird. What's the purpose of this change? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --kVXhAStRUZ/+rrGn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk9LPpsACgkQForvXbEpPzRd+gCg+B7iHkbc/4Yoe1qMWnaoHpf8 020AoLK5msskGDctIRSZzXeovGu+ZnQ1 =lYBl -----END PGP SIGNATURE----- --kVXhAStRUZ/+rrGn-- From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 08:50:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF6DD1065670; Mon, 27 Feb 2012 08:50:05 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id C97EB8FC15; Mon, 27 Feb 2012 08:50:04 +0000 (UTC) Received: by eekd17 with SMTP id d17so1291602eek.13 for ; Mon, 27 Feb 2012 00:50:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=4Rv6zdW7iQPKmeOxGWIR/K3KpCm/9Hkx4+/eM/QPXpE=; b=w7aH4kzMpApmCcCD7Lo0asOKdyhv2Femc1iPejdsNrc6cqu7MbadCEQlKC8AmcVAwP iyIrkOC0qrw9fTDPFYjScEO2nJfWqwlwxnrvXwAcBsxhsW93Fa+gNYBBVm91PA5x8skJ 3W2rBTo8BIepMFtgiZTIEi9p3gCSrlKVm/1xo= Received: by 10.213.19.207 with SMTP id c15mr1412899ebb.67.1330332603731; Mon, 27 Feb 2012 00:50:03 -0800 (PST) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id o49sm55647665eeb.7.2012.02.27.00.50.01 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 00:50:02 -0800 (PST) From: Mikolaj Golub To: Pawel Jakub Dawidek Organization: TOA Ukraine References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> Sender: Mikolaj Golub Date: Mon, 27 Feb 2012 10:49:59 +0200 In-Reply-To: <20120227082811.GC1363@garage.freebsd.pl> (Pawel Jakub Dawidek's message of "Mon, 27 Feb 2012 09:28:11 +0100") Message-ID: <864nucd5jc.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r232181 - 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: Mon, 27 Feb 2012 08:50:06 -0000 On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote: PJD> On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: >> Author: trociny >> Date: Sun Feb 26 14:25:48 2012 >> New Revision: 232181 >> URL: http://svn.freebsd.org/changeset/base/232181 >> >> Log: >> Add sysctl to retrieve or set umask of another process. PJD> "set umask of another process"? This seems... weird. What's the purpose PJD> of this change? When we were discussing this with Kostik and Robert, and I asked if it could be useful to have the sysctl rw, Kostik described a real situation when he had had to change umask of another process: umask had not been set properly on an aplication start but it could not be restarted until the end of the day. Kostik was able to fix it using gdb but having an easier way looked useful. -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 08:55:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ED561065672; Mon, 27 Feb 2012 08:55:33 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2C758FC0A; Mon, 27 Feb 2012 08:55:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1R8tW2B007155; Mon, 27 Feb 2012 08:55:32 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1R8tWVD007153; Mon, 27 Feb 2012 08:55:32 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202270855.q1R8tWVD007153@svn.freebsd.org> From: Kevin Lo Date: Mon, 27 Feb 2012 08:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232203 - head/sys/dev/sf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 08:55:33 -0000 Author: kevlo Date: Mon Feb 27 08:55:32 2012 New Revision: 232203 URL: http://svn.freebsd.org/changeset/base/232203 Log: Remove duplicate assignment of SF_IMR_RXDQ2_DMADONE bit Modified: head/sys/dev/sf/if_sfreg.h Modified: head/sys/dev/sf/if_sfreg.h ============================================================================== --- head/sys/dev/sf/if_sfreg.h Mon Feb 27 05:49:00 2012 (r232202) +++ head/sys/dev/sf/if_sfreg.h Mon Feb 27 08:55:32 2012 (r232203) @@ -352,7 +352,7 @@ #define SF_INTRS \ (SF_IMR_RXDQ2_NOBUFS|SF_IMR_RXDQ1_DMADONE|SF_IMR_RXDQ2_DMADONE| \ - SF_IMR_TX_DMADONE|SF_IMR_RXDQ1_NOBUFS|SF_IMR_RXDQ2_DMADONE| \ + SF_IMR_TX_DMADONE|SF_IMR_RXDQ1_NOBUFS| \ SF_IMR_NORMALINTR|SF_IMR_ABNORMALINTR|SF_IMR_TXCQ_NOBUFS| \ SF_IMR_RXCQ1_NOBUFS|SF_IMR_RXCQ2_NOBUFS|SF_IMR_STATSOFLOW| \ SF_IMR_TX_LOFIFO|SF_IMR_DMAERR|SF_IMR_RXGFP_NORESP| \ From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 08:57:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7853E106566B; Mon, 27 Feb 2012 08:57:03 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 684A08FC1B; Mon, 27 Feb 2012 08:57:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1R8v3JH007241; Mon, 27 Feb 2012 08:57:03 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1R8v3jQ007239; Mon, 27 Feb 2012 08:57:03 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202270857.q1R8v3jQ007239@svn.freebsd.org> From: Kevin Lo Date: Mon, 27 Feb 2012 08:57: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: r232204 - head/sys/dev/pcn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 08:57:03 -0000 Author: kevlo Date: Mon Feb 27 08:57:02 2012 New Revision: 232204 URL: http://svn.freebsd.org/changeset/base/232204 Log: Fix logic error Modified: head/sys/dev/pcn/if_pcn.c Modified: head/sys/dev/pcn/if_pcn.c ============================================================================== --- head/sys/dev/pcn/if_pcn.c Mon Feb 27 08:55:32 2012 (r232203) +++ head/sys/dev/pcn/if_pcn.c Mon Feb 27 08:57:02 2012 (r232204) @@ -966,7 +966,7 @@ pcn_tick(xsc) mii_tick(mii); /* link just died */ - if (sc->pcn_link & !(mii->mii_media_status & IFM_ACTIVE)) + if (sc->pcn_link && !(mii->mii_media_status & IFM_ACTIVE)) sc->pcn_link = 0; /* link just came up, restart */ From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 09:00:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF6FF1065672; Mon, 27 Feb 2012 09:00:54 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 8781D8FC17; Mon, 27 Feb 2012 09:00:54 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 26A57F75; Mon, 27 Feb 2012 10:00:53 +0100 (CET) Date: Mon, 27 Feb 2012 09:59:37 +0100 From: Pawel Jakub Dawidek To: Mikolaj Golub Message-ID: <20120227085937.GD1363@garage.freebsd.pl> References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EY/WZ/HvNxOox07X" Content-Disposition: inline In-Reply-To: <864nucd5jc.fsf@in138.ua3> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r232181 - 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: Mon, 27 Feb 2012 09:00:55 -0000 --EY/WZ/HvNxOox07X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 27, 2012 at 10:49:59AM +0200, Mikolaj Golub wrote: >=20 > On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote: >=20 > PJD> On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: > >> Author: trociny > >> Date: Sun Feb 26 14:25:48 2012 > >> New Revision: 232181 > >> URL: http://svn.freebsd.org/changeset/base/232181 > >>=20 > >> Log: > >> Add sysctl to retrieve or set umask of another process. >=20 > PJD> "set umask of another process"? This seems... weird. What's the pur= pose > PJD> of this change? >=20 > When we were discussing this with Kostik and Robert, and I asked if it co= uld > be useful to have the sysctl rw, Kostik described a real situation when h= e had > had to change umask of another process: umask had not been set properly o= n an > aplication start but it could not be restarted until the end of the day. > Kostik was able to fix it using gdb but having an easier way looked usefu= l. As a debugging feature it might be useful, but I wonder if we don't open Pandora's box, as I can see the same arguments for being able to change process current working directory, its real/effective/saved uid/gid, its groups, etc. Application can get really confused by this. From what I see we require the process to have permission to debug the target process, which is fine, but wherever it is documented I'd like there be a warning this is for debug purposes and can confuse application. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --EY/WZ/HvNxOox07X Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk9LRfgACgkQForvXbEpPzRxAgCgj+2KdqWT9VW3M+W5eE02ldpU zkQAnjAykxiGlnkZjDXHZqRoT7JEL7Z6 =jAZN -----END PGP SIGNATURE----- --EY/WZ/HvNxOox07X-- From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 09:30:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3843E106566B; Mon, 27 Feb 2012 09:30:00 +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 9DCCE8FC0C; Mon, 27 Feb 2012 09:29:58 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q1R9TpnX056319; Mon, 27 Feb 2012 11:29:51 +0200 (EET) (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.5/8.14.5) with ESMTP id q1R9Tp0Q032962; Mon, 27 Feb 2012 11:29:51 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q1R9Tpv0032961; Mon, 27 Feb 2012 11:29:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 27 Feb 2012 11:29:51 +0200 From: Konstantin Belousov To: Mikolaj Golub Message-ID: <20120227092951.GB55074@deviant.kiev.zoral.com.ua> References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Y7P0gPYVJgs55uY0" Content-Disposition: inline In-Reply-To: <864nucd5jc.fsf@in138.ua3> 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=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham 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, Pawel Jakub Dawidek Subject: Re: svn commit: r232181 - 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: Mon, 27 Feb 2012 09:30:00 -0000 --Y7P0gPYVJgs55uY0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 27, 2012 at 10:49:59AM +0200, Mikolaj Golub wrote: >=20 > On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote: >=20 > PJD> On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: > >> Author: trociny > >> Date: Sun Feb 26 14:25:48 2012 > >> New Revision: 232181 > >> URL: http://svn.freebsd.org/changeset/base/232181 > >>=20 > >> Log: > >> Add sysctl to retrieve or set umask of another process. >=20 > PJD> "set umask of another process"? This seems... weird. What's the pur= pose > PJD> of this change? >=20 > When we were discussing this with Kostik and Robert, and I asked if it co= uld > be useful to have the sysctl rw, Kostik described a real situation when h= e had > had to change umask of another process: umask had not been set properly o= n an > aplication start but it could not be restarted until the end of the day. > Kostik was able to fix it using gdb but having an easier way looked usefu= l. kgdb, not gdb. It is indeed possible to write a ptrace-based utility that inject a code payload that would change umask. Since this is very risky but indeed possib= le, having the straighforward kernel facility is justified. Patch puts the same restrictions on the caller as ptrace(). --Y7P0gPYVJgs55uY0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9LTQ8ACgkQC3+MBN1Mb4hLYwCgh2jXh1tdvHOXqfJCry0ZkJPM kE4AoMz88aIr1aT7ZpoevFODTzVhiw63 =KTy8 -----END PGP SIGNATURE----- --Y7P0gPYVJgs55uY0-- From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 10:31:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F0361065675; Mon, 27 Feb 2012 10:31:55 +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 04A978FC1A; Mon, 27 Feb 2012 10:31:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RAVsGD013197; Mon, 27 Feb 2012 10:31:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RAVsjO013195; Mon, 27 Feb 2012 10:31:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201202271031.q1RAVsjO013195@svn.freebsd.org> From: Alexander Motin Date: Mon, 27 Feb 2012 10:31: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: r232207 - 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, 27 Feb 2012 10:31:55 -0000 Author: mav Date: Mon Feb 27 10:31:54 2012 New Revision: 232207 URL: http://svn.freebsd.org/changeset/base/232207 Log: Rework CPU load balancing in SCHED_ULE: - In sched_pickcpu() be more careful taking previous CPU on SMT systems. Do it only if all other logical CPUs of that physical one are idle to avoid extra resource sharing. - In sched_pickcpu() change general logic of CPU selection. First look for idle CPU, sharing last level cache with previously used one, skipping SMT CPU groups. If none found, search all CPUs for the least loaded one, where the thread with its priority can run now. If none found, search just for the least loaded CPU. - Make cpu_search() compare lowest/highest CPU load when comparing CPU groups with equal load. That allows to differentiate 1+1 and 2+0 loads. - Make cpu_search() to prefer specified (previous) CPU or group if load is equal. This improves cache affinity for more complicated topologies. - Randomize CPU selection if above factors are equal. Previous code tend to prefer CPUs with lower IDs, causing unneeded collisions. - Rework periodic balancer in sched_balance_group(). With cpu_search() more intelligent now, make balansing process flat, removing recursion over the topology tree. That fixes double swap problem and makes load distribution more even and predictable. All together this gives 10-15% performance improvement in many tests on CPUs with SMT, such as Core i7, for number of threads is less then number of logical CPUs. In some tests it also gives positive effect to systems without SMT. Reviewed by: jeff Tested by: flo, hackers@ MFC after: 1 month Sponsored by: iXsystems, Inc. Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Mon Feb 27 09:10:24 2012 (r232206) +++ head/sys/kern/sched_ule.c Mon Feb 27 10:31:54 2012 (r232207) @@ -258,7 +258,6 @@ struct cpu_group *cpu_top; /* CPU topol static int rebalance = 1; static int balance_interval = 128; /* Default set in sched_initticks(). */ static int affinity; -static int steal_htt = 1; static int steal_idle = 1; static int steal_thresh = 2; @@ -268,6 +267,7 @@ static int steal_thresh = 2; static struct tdq tdq_cpu[MAXCPU]; static struct tdq *balance_tdq; static int balance_ticks; +static DPCPU_DEFINE(uint32_t, randomval); #define TDQ_SELF() (&tdq_cpu[PCPU_GET(cpuid)]) #define TDQ_CPU(x) (&tdq_cpu[(x)]) @@ -553,9 +553,11 @@ tdq_setlowpri(struct tdq *tdq, struct th #ifdef SMP struct cpu_search { cpuset_t cs_mask; - u_int cs_load; - u_int cs_cpu; - int cs_limit; /* Min priority for low min load for high. */ + u_int cs_prefer; + int cs_pri; /* Min priority for low. */ + int cs_limit; /* Max load for low, min load for high. */ + int cs_cpu; + int cs_load; }; #define CPU_SEARCH_LOWEST 0x1 @@ -566,44 +568,14 @@ struct cpu_search { for ((cpu) = 0; (cpu) <= mp_maxid; (cpu)++) \ if (CPU_ISSET(cpu, &mask)) -static __inline int cpu_search(struct cpu_group *cg, struct cpu_search *low, +static __inline int cpu_search(const struct cpu_group *cg, struct cpu_search *low, struct cpu_search *high, const int match); -int cpu_search_lowest(struct cpu_group *cg, struct cpu_search *low); -int cpu_search_highest(struct cpu_group *cg, struct cpu_search *high); -int cpu_search_both(struct cpu_group *cg, struct cpu_search *low, +int cpu_search_lowest(const struct cpu_group *cg, struct cpu_search *low); +int cpu_search_highest(const struct cpu_group *cg, struct cpu_search *high); +int cpu_search_both(const struct cpu_group *cg, struct cpu_search *low, struct cpu_search *high); /* - * This routine compares according to the match argument and should be - * reduced in actual instantiations via constant propagation and dead code - * elimination. - */ -static __inline int -cpu_compare(int cpu, struct cpu_search *low, struct cpu_search *high, - const int match) -{ - struct tdq *tdq; - - tdq = TDQ_CPU(cpu); - if (match & CPU_SEARCH_LOWEST) - if (CPU_ISSET(cpu, &low->cs_mask) && - tdq->tdq_load < low->cs_load && - tdq->tdq_lowpri > low->cs_limit) { - low->cs_cpu = cpu; - low->cs_load = tdq->tdq_load; - } - if (match & CPU_SEARCH_HIGHEST) - if (CPU_ISSET(cpu, &high->cs_mask) && - tdq->tdq_load >= high->cs_limit && - tdq->tdq_load > high->cs_load && - tdq->tdq_transferable) { - high->cs_cpu = cpu; - high->cs_load = tdq->tdq_load; - } - return (tdq->tdq_load); -} - -/* * Search the tree of cpu_groups for the lowest or highest loaded cpu * according to the match argument. This routine actually compares the * load on all paths through the tree and finds the least loaded cpu on @@ -615,33 +587,42 @@ cpu_compare(int cpu, struct cpu_search * * also recursive to the depth of the tree. */ static __inline int -cpu_search(struct cpu_group *cg, struct cpu_search *low, +cpu_search(const struct cpu_group *cg, struct cpu_search *low, struct cpu_search *high, const int match) { - int total; + struct cpu_search lgroup; + struct cpu_search hgroup; + cpuset_t cpumask; + struct cpu_group *child; + struct tdq *tdq; + int cpu, i, hload, lload, load, total, rnd; total = 0; - if (cg->cg_children) { - struct cpu_search lgroup; - struct cpu_search hgroup; - struct cpu_group *child; - u_int lload; - int hload; - int load; - int i; - - lload = -1; + cpumask = cg->cg_mask; + if (match & CPU_SEARCH_LOWEST) { + lload = INT_MAX; + low->cs_load = INT_MAX; + lgroup = *low; + } + if (match & CPU_SEARCH_HIGHEST) { hload = -1; - for (i = 0; i < cg->cg_children; i++) { + high->cs_load = -1; + hgroup = *high; + } + + /* Iterate through the child CPU groups and then remaining CPUs. */ + for (i = 0, cpu = 0; i <= cg->cg_children; ) { + if (i >= cg->cg_children) { + while (cpu <= mp_maxid && !CPU_ISSET(cpu, &cpumask)) + cpu++; + if (cpu > mp_maxid) + break; + child = NULL; + } else child = &cg->cg_child[i]; - if (match & CPU_SEARCH_LOWEST) { - lgroup = *low; - lgroup.cs_load = -1; - } - if (match & CPU_SEARCH_HIGHEST) { - hgroup = *high; - lgroup.cs_load = 0; - } + + if (child) { /* Handle child CPU group. */ + CPU_NAND(&cpumask, &child->cg_mask); switch (match) { case CPU_SEARCH_LOWEST: load = cpu_search_lowest(child, &lgroup); @@ -653,23 +634,52 @@ cpu_search(struct cpu_group *cg, struct load = cpu_search_both(child, &lgroup, &hgroup); break; } - total += load; - if (match & CPU_SEARCH_LOWEST) - if (load < lload || low->cs_cpu == -1) { - *low = lgroup; - lload = load; + } else { /* Handle child CPU. */ + tdq = TDQ_CPU(cpu); + load = tdq->tdq_load * 256; + rnd = DPCPU_SET(randomval, + DPCPU_GET(randomval) * 69069 + 5) >> 26; + if (match & CPU_SEARCH_LOWEST) { + if (cpu == low->cs_prefer) + load -= 64; + /* If that CPU is allowed and get data. */ + if (CPU_ISSET(cpu, &lgroup.cs_mask) && + tdq->tdq_lowpri > lgroup.cs_pri && + tdq->tdq_load <= lgroup.cs_limit) { + lgroup.cs_cpu = cpu; + lgroup.cs_load = load - rnd; } - if (match & CPU_SEARCH_HIGHEST) - if (load > hload || high->cs_cpu == -1) { - hload = load; - *high = hgroup; + } + if (match & CPU_SEARCH_HIGHEST) + if (CPU_ISSET(cpu, &hgroup.cs_mask) && + tdq->tdq_load >= hgroup.cs_limit && + tdq->tdq_transferable) { + hgroup.cs_cpu = cpu; + hgroup.cs_load = load - rnd; } } - } else { - int cpu; + total += load; - CPUSET_FOREACH(cpu, cg->cg_mask) - total += cpu_compare(cpu, low, high, match); + /* We have info about child item. Compare it. */ + if (match & CPU_SEARCH_LOWEST) { + if ((load < lload) || + (load == lload && lgroup.cs_load < low->cs_load)) { + lload = load; + low->cs_cpu = lgroup.cs_cpu; + low->cs_load = lgroup.cs_load; + } + } + if (match & CPU_SEARCH_HIGHEST) + if ((load > hload) || + (load == hload && hgroup.cs_load > high->cs_load)) { + hload = load; + high->cs_cpu = hgroup.cs_cpu; + high->cs_load = hgroup.cs_load; + } + if (child) + i++; + else + cpu++; } return (total); } @@ -679,19 +689,19 @@ cpu_search(struct cpu_group *cg, struct * optimization. */ int -cpu_search_lowest(struct cpu_group *cg, struct cpu_search *low) +cpu_search_lowest(const struct cpu_group *cg, struct cpu_search *low) { return cpu_search(cg, low, NULL, CPU_SEARCH_LOWEST); } int -cpu_search_highest(struct cpu_group *cg, struct cpu_search *high) +cpu_search_highest(const struct cpu_group *cg, struct cpu_search *high) { return cpu_search(cg, NULL, high, CPU_SEARCH_HIGHEST); } int -cpu_search_both(struct cpu_group *cg, struct cpu_search *low, +cpu_search_both(const struct cpu_group *cg, struct cpu_search *low, struct cpu_search *high) { return cpu_search(cg, low, high, CPU_SEARCH_BOTH); @@ -703,14 +713,16 @@ cpu_search_both(struct cpu_group *cg, st * acceptable. */ static inline int -sched_lowest(struct cpu_group *cg, cpuset_t mask, int pri) +sched_lowest(const struct cpu_group *cg, cpuset_t mask, int pri, int maxload, + int prefer) { struct cpu_search low; low.cs_cpu = -1; - low.cs_load = -1; + low.cs_prefer = prefer; low.cs_mask = mask; - low.cs_limit = pri; + low.cs_pri = pri; + low.cs_limit = maxload; cpu_search_lowest(cg, &low); return low.cs_cpu; } @@ -719,12 +731,11 @@ sched_lowest(struct cpu_group *cg, cpuse * Find the cpu with the highest load via the highest loaded path. */ static inline int -sched_highest(struct cpu_group *cg, cpuset_t mask, int minload) +sched_highest(const struct cpu_group *cg, cpuset_t mask, int minload) { struct cpu_search high; high.cs_cpu = -1; - high.cs_load = 0; high.cs_mask = mask; high.cs_limit = minload; cpu_search_highest(cg, &high); @@ -735,17 +746,17 @@ sched_highest(struct cpu_group *cg, cpus * Simultaneously find the highest and lowest loaded cpu reachable via * cg. */ -static inline void -sched_both(struct cpu_group *cg, cpuset_t mask, int *lowcpu, int *highcpu) +static inline void +sched_both(const struct cpu_group *cg, cpuset_t mask, int *lowcpu, int *highcpu) { struct cpu_search high; struct cpu_search low; low.cs_cpu = -1; - low.cs_limit = -1; - low.cs_load = -1; + low.cs_prefer = -1; + low.cs_pri = -1; + low.cs_limit = INT_MAX; low.cs_mask = mask; - high.cs_load = 0; high.cs_cpu = -1; high.cs_limit = -1; high.cs_mask = mask; @@ -758,30 +769,45 @@ sched_both(struct cpu_group *cg, cpuset_ static void sched_balance_group(struct cpu_group *cg) { - cpuset_t mask; - int high; - int low; - int i; + cpuset_t hmask, lmask; + int high, low, anylow; - CPU_FILL(&mask); + CPU_FILL(&hmask); for (;;) { - sched_both(cg, mask, &low, &high); - if (low == high || low == -1 || high == -1) + high = sched_highest(cg, hmask, 1); + /* Stop if there is no more CPU with transferrable threads. */ + if (high == -1) break; - if (sched_balance_pair(TDQ_CPU(high), TDQ_CPU(low))) + CPU_CLR(high, &hmask); + CPU_COPY(&hmask, &lmask); + /* Stop if there is no more CPU left for low. */ + if (CPU_EMPTY(&lmask)) break; - /* - * If we failed to move any threads determine which cpu - * to kick out of the set and try again. - */ - if (TDQ_CPU(high)->tdq_transferable == 0) - CPU_CLR(high, &mask); - else - CPU_CLR(low, &mask); + anylow = 1; +nextlow: + low = sched_lowest(cg, lmask, -1, + TDQ_CPU(high)->tdq_load - 1, high); + /* Stop if we looked well and found no less loaded CPU. */ + if (anylow && low == -1) + break; + /* Go to next high if we found no less loaded CPU. */ + if (low == -1) + continue; + /* Transfer thread from high to low. */ + if (sched_balance_pair(TDQ_CPU(high), TDQ_CPU(low))) { + /* CPU that got thread can no longer be a donor. */ + CPU_CLR(low, &hmask); + } else { + /* + * If failed, then there is no threads on high + * that can run on this low. Drop low from low + * mask and look for different one. + */ + CPU_CLR(low, &lmask); + anylow = 0; + goto nextlow; + } } - - for (i = 0; i < cg->cg_children; i++) - sched_balance_group(&cg->cg_child[i]); } static void @@ -834,32 +860,17 @@ tdq_unlock_pair(struct tdq *one, struct static int sched_balance_pair(struct tdq *high, struct tdq *low) { - int transferable; - int high_load; - int low_load; int moved; - int move; int cpu; - int diff; - int i; tdq_lock_pair(high, low); - transferable = high->tdq_transferable; - high_load = high->tdq_load; - low_load = low->tdq_load; moved = 0; /* * Determine what the imbalance is and then adjust that to how many * threads we actually have to give up (transferable). */ - if (transferable != 0) { - diff = high_load - low_load; - move = diff / 2; - if (diff & 0x1) - move++; - move = min(move, transferable); - for (i = 0; i < move; i++) - moved += tdq_move(high, low); + if (high->tdq_transferable != 0 && high->tdq_load > low->tdq_load && + (moved = tdq_move(high, low)) > 0) { /* * In case the target isn't the current cpu IPI it to force a * reschedule with the new workload. @@ -1003,8 +1014,7 @@ runq_steal_from(struct runq *rq, int cpu { struct rqbits *rqb; struct rqhead *rqh; - struct thread *td; - int first; + struct thread *td, *first; int bit; int pri; int i; @@ -1012,7 +1022,7 @@ runq_steal_from(struct runq *rq, int cpu rqb = &rq->rq_status; bit = start & (RQB_BPW -1); pri = 0; - first = 0; + first = NULL; again: for (i = RQB_WORD(start); i < RQB_LEN; bit = 0, i++) { if (rqb->rqb_bits[i] == 0) @@ -1031,7 +1041,7 @@ again: if (first && THREAD_CAN_MIGRATE(td) && THREAD_CAN_SCHED(td, cpu)) return (td); - first = 1; + first = td; } } if (start != 0) { @@ -1039,6 +1049,9 @@ again: goto again; } + if (first && THREAD_CAN_MIGRATE(first) && + THREAD_CAN_SCHED(first, cpu)) + return (first); return (NULL); } @@ -1140,13 +1153,11 @@ SCHED_STAT_DEFINE(pickcpu_migration, "Se static int sched_pickcpu(struct thread *td, int flags) { - struct cpu_group *cg; + struct cpu_group *cg, *ccg; struct td_sched *ts; struct tdq *tdq; cpuset_t mask; - int self; - int pri; - int cpu; + int cpu, pri, self; self = PCPU_GET(cpuid); ts = td->td_sched; @@ -1161,45 +1172,70 @@ sched_pickcpu(struct thread *td, int fla * Prefer to run interrupt threads on the processors that generate * the interrupt. */ + pri = td->td_priority; if (td->td_priority <= PRI_MAX_ITHD && THREAD_CAN_SCHED(td, self) && curthread->td_intr_nesting_level && ts->ts_cpu != self) { SCHED_STAT_INC(pickcpu_intrbind); ts->ts_cpu = self; + if (TDQ_CPU(self)->tdq_lowpri > pri) { + SCHED_STAT_INC(pickcpu_affinity); + return (ts->ts_cpu); + } } /* * If the thread can run on the last cpu and the affinity has not * expired or it is idle run it there. */ - pri = td->td_priority; tdq = TDQ_CPU(ts->ts_cpu); - if (THREAD_CAN_SCHED(td, ts->ts_cpu)) { - if (tdq->tdq_lowpri > PRI_MIN_IDLE) { + cg = tdq->tdq_cg; + if (THREAD_CAN_SCHED(td, ts->ts_cpu) && + tdq->tdq_lowpri >= PRI_MIN_IDLE && + SCHED_AFFINITY(ts, CG_SHARE_L2)) { + if (cg->cg_flags & CG_FLAG_THREAD) { + CPUSET_FOREACH(cpu, cg->cg_mask) { + if (TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE) + break; + } + } else + cpu = INT_MAX; + if (cpu > mp_maxid) { SCHED_STAT_INC(pickcpu_idle_affinity); return (ts->ts_cpu); } - if (SCHED_AFFINITY(ts, CG_SHARE_L2) && tdq->tdq_lowpri > pri) { - SCHED_STAT_INC(pickcpu_affinity); - return (ts->ts_cpu); - } } /* - * Search for the highest level in the tree that still has affinity. + * Search for the last level cache CPU group in the tree. + * Skip caches with expired affinity time and SMT groups. + * Affinity to higher level caches will be handled less aggressively. */ - cg = NULL; - for (cg = tdq->tdq_cg; cg != NULL; cg = cg->cg_parent) - if (SCHED_AFFINITY(ts, cg->cg_level)) - break; + for (ccg = NULL; cg != NULL; cg = cg->cg_parent) { + if (cg->cg_flags & CG_FLAG_THREAD) + continue; + if (!SCHED_AFFINITY(ts, cg->cg_level)) + continue; + ccg = cg; + } + if (ccg != NULL) + cg = ccg; cpu = -1; + /* Search the group for the less loaded idle CPU we can run now. */ mask = td->td_cpuset->cs_mask; - if (cg) - cpu = sched_lowest(cg, mask, pri); + if (cg != NULL && cg != cpu_top && + CPU_CMP(&cg->cg_mask, &cpu_top->cg_mask) != 0) + cpu = sched_lowest(cg, mask, max(pri, PRI_MAX_TIMESHARE), + INT_MAX, ts->ts_cpu); + /* Search globally for the less loaded CPU we can run now. */ + if (cpu == -1) + cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu); + /* Search globally for the less loaded CPU. */ if (cpu == -1) - cpu = sched_lowest(cpu_top, mask, -1); + cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu); /* * Compare the lowest loaded cpu to current cpu. */ if (THREAD_CAN_SCHED(td, self) && TDQ_CPU(self)->tdq_lowpri > pri && - TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE) { + TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE && + TDQ_CPU(self)->tdq_load <= TDQ_CPU(cpu)->tdq_load + 1) { SCHED_STAT_INC(pickcpu_local); cpu = self; } else @@ -2750,8 +2786,6 @@ SYSCTL_INT(_kern_sched, OID_AUTO, balanc SYSCTL_INT(_kern_sched, OID_AUTO, balance_interval, CTLFLAG_RW, &balance_interval, 0, "Average frequency in stathz ticks to run the long-term balancer"); -SYSCTL_INT(_kern_sched, OID_AUTO, steal_htt, CTLFLAG_RW, &steal_htt, 0, - "Steals work from another hyper-threaded core on idle"); SYSCTL_INT(_kern_sched, OID_AUTO, steal_idle, CTLFLAG_RW, &steal_idle, 0, "Attempts to steal work from other cores before idling"); SYSCTL_INT(_kern_sched, OID_AUTO, steal_thresh, CTLFLAG_RW, &steal_thresh, 0, From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 13:38:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 974BA1065672; Mon, 27 Feb 2012 13:38:52 +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 84D308FC0C; Mon, 27 Feb 2012 13:38:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RDcqTt020038; Mon, 27 Feb 2012 13:38:52 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RDcqEQ020033; Mon, 27 Feb 2012 13:38:52 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201202271338.q1RDcqEQ020033@svn.freebsd.org> From: David Xu Date: Mon, 27 Feb 2012 13:38: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: r232209 - in head: lib/libthr/thread 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, 27 Feb 2012 13:38:52 -0000 Author: davidxu Date: Mon Feb 27 13:38:52 2012 New Revision: 232209 URL: http://svn.freebsd.org/changeset/base/232209 Log: Follow changes made in revision 232144, pass absolute timeout to kernel, this eliminates a clock_gettime() syscall. Modified: head/lib/libthr/thread/thr_rwlock.c head/lib/libthr/thread/thr_umtx.c head/lib/libthr/thread/thr_umtx.h head/sys/kern/kern_umtx.c Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Mon Feb 27 13:04:09 2012 (r232208) +++ head/lib/libthr/thread/thr_rwlock.c Mon Feb 27 13:38:52 2012 (r232209) @@ -123,7 +123,6 @@ rwlock_rdlock_common(pthread_rwlock_t *r { struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; - struct timespec ts, ts2, *tsp; int flags; int ret; @@ -162,18 +161,8 @@ rwlock_rdlock_common(pthread_rwlock_t *r return (EINVAL); for (;;) { - if (abstime) { - clock_gettime(CLOCK_REALTIME, &ts); - TIMESPEC_SUB(&ts2, abstime, &ts); - if (ts2.tv_sec < 0 || - (ts2.tv_sec == 0 && ts2.tv_nsec <= 0)) - return (ETIMEDOUT); - tsp = &ts2; - } else - tsp = NULL; - /* goto kernel and lock it */ - ret = __thr_rwlock_rdlock(&prwlock->lock, flags, tsp); + ret = __thr_rwlock_rdlock(&prwlock->lock, flags, abstime); if (ret != EINTR) break; @@ -255,7 +244,6 @@ rwlock_wrlock_common (pthread_rwlock_t * { struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; - struct timespec ts, ts2, *tsp; int ret; CHECK_AND_INIT_RWLOCK @@ -275,18 +263,8 @@ rwlock_wrlock_common (pthread_rwlock_t * return (EINVAL); for (;;) { - if (abstime != NULL) { - clock_gettime(CLOCK_REALTIME, &ts); - TIMESPEC_SUB(&ts2, abstime, &ts); - if (ts2.tv_sec < 0 || - (ts2.tv_sec == 0 && ts2.tv_nsec <= 0)) - return (ETIMEDOUT); - tsp = &ts2; - } else - tsp = NULL; - /* goto kernel and lock it */ - ret = __thr_rwlock_wrlock(&prwlock->lock, tsp); + ret = __thr_rwlock_wrlock(&prwlock->lock, abstime); if (ret == 0) { prwlock->owner = curthread; break; Modified: head/lib/libthr/thread/thr_umtx.c ============================================================================== --- head/lib/libthr/thread/thr_umtx.c Mon Feb 27 13:04:09 2012 (r232208) +++ head/lib/libthr/thread/thr_umtx.c Mon Feb 27 13:38:52 2012 (r232209) @@ -265,15 +265,42 @@ _thr_ucond_broadcast(struct ucond *cv) } int -__thr_rwlock_rdlock(struct urwlock *rwlock, int flags, struct timespec *tsp) +__thr_rwlock_rdlock(struct urwlock *rwlock, int flags, + const struct timespec *tsp) { - return _umtx_op_err(rwlock, UMTX_OP_RW_RDLOCK, flags, NULL, tsp); + struct _umtx_time timeout, *tm_p; + size_t tm_size; + + if (tsp == NULL) { + tm_p = NULL; + tm_size = 0; + } else { + timeout._timeout = *tsp; + timeout._flags = UMTX_ABSTIME; + timeout._clockid = CLOCK_REALTIME; + tm_p = &timeout; + tm_size = sizeof(timeout); + } + return _umtx_op_err(rwlock, UMTX_OP_RW_RDLOCK, flags, (void *)tm_size, tm_p); } int -__thr_rwlock_wrlock(struct urwlock *rwlock, struct timespec *tsp) +__thr_rwlock_wrlock(struct urwlock *rwlock, const struct timespec *tsp) { - return _umtx_op_err(rwlock, UMTX_OP_RW_WRLOCK, 0, NULL, tsp); + struct _umtx_time timeout, *tm_p; + size_t tm_size; + + if (tsp == NULL) { + tm_p = NULL; + tm_size = 0; + } else { + timeout._timeout = *tsp; + timeout._flags = UMTX_ABSTIME; + timeout._clockid = CLOCK_REALTIME; + tm_p = &timeout; + tm_size = sizeof(timeout); + } + return _umtx_op_err(rwlock, UMTX_OP_RW_WRLOCK, 0, (void *)tm_size, tm_p); } int Modified: head/lib/libthr/thread/thr_umtx.h ============================================================================== --- head/lib/libthr/thread/thr_umtx.h Mon Feb 27 13:04:09 2012 (r232208) +++ head/lib/libthr/thread/thr_umtx.h Mon Feb 27 13:38:52 2012 (r232209) @@ -60,8 +60,10 @@ void _thr_ucond_init(struct ucond *cv) _ int _thr_ucond_signal(struct ucond *cv) __hidden; int _thr_ucond_broadcast(struct ucond *cv) __hidden; -int __thr_rwlock_rdlock(struct urwlock *rwlock, int flags, struct timespec *tsp) __hidden; -int __thr_rwlock_wrlock(struct urwlock *rwlock, struct timespec *tsp) __hidden; +int __thr_rwlock_rdlock(struct urwlock *rwlock, int flags, + const struct timespec *tsp) __hidden; +int __thr_rwlock_wrlock(struct urwlock *rwlock, + const struct timespec *tsp) __hidden; int __thr_rwlock_unlock(struct urwlock *rwlock) __hidden; /* Internal used only */ Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Mon Feb 27 13:04:09 2012 (r232208) +++ head/sys/kern/kern_umtx.c Mon Feb 27 13:38:52 2012 (r232209) @@ -2289,7 +2289,6 @@ do_cv_wait(struct thread *td, struct uco struct timespec *timeout, u_long wflags) { struct umtx_q *uq; - struct timeval tv; struct timespec cts, ets, tts; uint32_t flags; uint32_t clockid; @@ -2345,9 +2344,8 @@ do_cv_wait(struct thread *td, struct uco kern_clock_gettime(td, clockid, &cts); timespecsub(&tts, &cts); } - TIMESPEC_TO_TIMEVAL(&tv, &tts); for (;;) { - error = umtxq_sleep(uq, "ucond", tvtohz(&tv)); + error = umtxq_sleep(uq, "ucond", tstohz(&tts)); if (error != ETIMEDOUT) break; kern_clock_gettime(td, clockid, &cts); @@ -2357,7 +2355,6 @@ do_cv_wait(struct thread *td, struct uco } tts = ets; timespecsub(&tts, &cts); - TIMESPEC_TO_TIMEVAL(&tv, &tts); } } } @@ -2555,27 +2552,30 @@ sleep: } static int -do_rw_rdlock2(struct thread *td, void *obj, long val, struct timespec *timeout) +do_rw_rdlock2(struct thread *td, void *obj, long val, struct _umtx_time *timeout) { - struct timespec ts, ts2, ts3; - struct timeval tv; + struct timespec cts, ets, tts; int error; - getnanouptime(&ts); - timespecadd(&ts, timeout); - TIMESPEC_TO_TIMEVAL(&tv, timeout); + kern_clock_gettime(td, timeout->_clockid, &cts); + if ((timeout->_flags & UMTX_ABSTIME) == 0) { + ets = cts; + timespecadd(&ets, &timeout->_timeout); + tts = timeout->_timeout; + } else { + ets = timeout->_timeout; + tts = timeout->_timeout; + timespecsub(&tts, &cts); + } for (;;) { - error = do_rw_rdlock(td, obj, val, tvtohz(&tv)); + error = do_rw_rdlock(td, obj, val, tstohz(&tts)); if (error != ETIMEDOUT) break; - getnanouptime(&ts2); - if (timespeccmp(&ts2, &ts, >=)) { - error = ETIMEDOUT; + kern_clock_gettime(td, timeout->_clockid, &cts); + if (timespeccmp(&cts, &ets, >=)) break; - } - ts3 = ts; - timespecsub(&ts3, &ts2); - TIMESPEC_TO_TIMEVAL(&tv, &ts3); + tts = ets; + timespecsub(&tts, &cts); } if (error == ERESTART) error = EINTR; @@ -2692,27 +2692,30 @@ sleep: } static int -do_rw_wrlock2(struct thread *td, void *obj, struct timespec *timeout) +do_rw_wrlock2(struct thread *td, void *obj, struct _umtx_time *timeout) { - struct timespec ts, ts2, ts3; - struct timeval tv; + struct timespec cts, ets, tts; int error; - getnanouptime(&ts); - timespecadd(&ts, timeout); - TIMESPEC_TO_TIMEVAL(&tv, timeout); + kern_clock_gettime(td, timeout->_clockid, &cts); + if ((timeout->_flags & UMTX_ABSTIME) == 0) { + ets = cts; + timespecadd(&ets, &timeout->_timeout); + tts = timeout->_timeout; + } else { + ets = timeout->_timeout; + tts = timeout->_timeout; + timespecsub(&tts, &cts); + } for (;;) { - error = do_rw_wrlock(td, obj, tvtohz(&tv)); + error = do_rw_wrlock(td, obj, tstohz(&tts)); if (error != ETIMEDOUT) break; - getnanouptime(&ts2); - if (timespeccmp(&ts2, &ts, >=)) { - error = ETIMEDOUT; + kern_clock_gettime(td, timeout->_clockid, &cts); + if (timespeccmp(&cts, &ets, >=)) break; - } - ts3 = ts; - timespecsub(&ts3, &ts2); - TIMESPEC_TO_TIMEVAL(&tv, &ts3); + tts = ets; + timespecsub(&tts, &cts); } if (error == ERESTART) error = EINTR; @@ -3159,14 +3162,15 @@ __umtx_op_cv_broadcast(struct thread *td static int __umtx_op_rw_rdlock(struct thread *td, struct _umtx_op_args *uap) { - struct timespec timeout; + struct _umtx_time timeout; int error; /* Allow a null timespec (wait forever). */ if (uap->uaddr2 == NULL) { error = do_rw_rdlock(td, uap->obj, uap->val, 0); } else { - error = umtx_copyin_timeout(uap->uaddr2, &timeout); + error = umtx_copyin_umtx_time(uap->uaddr2, + (size_t)uap->uaddr1, &timeout); if (error != 0) return (error); error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout); @@ -3177,14 +3181,15 @@ __umtx_op_rw_rdlock(struct thread *td, s static int __umtx_op_rw_wrlock(struct thread *td, struct _umtx_op_args *uap) { - struct timespec timeout; + struct _umtx_time timeout; int error; /* Allow a null timespec (wait forever). */ if (uap->uaddr2 == NULL) { error = do_rw_wrlock(td, uap->obj, 0); } else { - error = umtx_copyin_timeout(uap->uaddr2, &timeout); + error = umtx_copyin_umtx_time(uap->uaddr2, + (size_t)uap->uaddr1, &timeout); if (error != 0) return (error); @@ -3430,14 +3435,15 @@ __umtx_op_cv_wait_compat32(struct thread static int __umtx_op_rw_rdlock_compat32(struct thread *td, struct _umtx_op_args *uap) { - struct timespec timeout; + struct _umtx_time timeout; int error; /* Allow a null timespec (wait forever). */ if (uap->uaddr2 == NULL) { error = do_rw_rdlock(td, uap->obj, uap->val, 0); } else { - error = umtx_copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_umtx_time32(uap->uaddr2, + (size_t)uap->uaddr1, &timeout); if (error != 0) return (error); error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout); @@ -3448,17 +3454,17 @@ __umtx_op_rw_rdlock_compat32(struct thre static int __umtx_op_rw_wrlock_compat32(struct thread *td, struct _umtx_op_args *uap) { - struct timespec timeout; + struct _umtx_time timeout; int error; /* Allow a null timespec (wait forever). */ if (uap->uaddr2 == NULL) { error = do_rw_wrlock(td, uap->obj, 0); } else { - error = umtx_copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_umtx_time32(uap->uaddr2, + (size_t)uap->uaddr1, &timeout); if (error != 0) return (error); - error = do_rw_wrlock2(td, uap->obj, &timeout); } return (error); From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 14:30:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DBB81065672; Mon, 27 Feb 2012 14:30:05 +0000 (UTC) (envelope-from ivoras@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 C4DBB8FC12; Mon, 27 Feb 2012 14:30:04 +0000 (UTC) Received: by yenq7 with SMTP id q7so302229yen.13 for ; Mon, 27 Feb 2012 06:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=/xrmBaI5+usmSpbn6+v3PDG5rJgJiyqFDPyJPsLowQc=; b=LZ7+UCROdKWOsfPSgV2eh9V3ljmM9N99Pp47JY59xVI5Y/kF4MA7CJxNXb8L7DFwnz 6NKsFEi5IV+gM6mGhT6LIGFHutwKFc+QSMKRDRUPXAO9rbHybMvw/Hc5KoeZdUHknwEV uyVZIcYg7Pu8ehYn5hOmZzd4ONRmmbJDF3b2Y= Received: by 10.236.201.195 with SMTP id b43mr15773199yho.75.1330353004141; Mon, 27 Feb 2012 06:30:04 -0800 (PST) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.100.93.1 with HTTP; Mon, 27 Feb 2012 06:29:24 -0800 (PST) In-Reply-To: <201202271338.q1RDcqEQ020033@svn.freebsd.org> References: <201202271338.q1RDcqEQ020033@svn.freebsd.org> From: Ivan Voras Date: Mon, 27 Feb 2012 15:29:24 +0100 X-Google-Sender-Auth: zxnp-jXKB8QnHFisoWGsfzZbmtA Message-ID: To: David Xu Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232209 - in head: lib/libthr/thread 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, 27 Feb 2012 14:30:05 -0000 On 27 February 2012 14:38, David Xu wrote: > Author: davidxu > Date: Mon Feb 27 13:38:52 2012 > New Revision: 232209 > URL: http://svn.freebsd.org/changeset/base/232209 > > Log: > =C2=A0Follow changes made in revision 232144, pass absolute timeout to ke= rnel, > =C2=A0this eliminates a clock_gettime() syscall. Any chance of a MFC? I use rwlocks a lot; removing a syscall from all operations looks like a nice improvement. From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 16:08:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EA2E1065675; Mon, 27 Feb 2012 16:08:18 +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 5E2A98FC0C; Mon, 27 Feb 2012 16:08:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RG8IKL025687; Mon, 27 Feb 2012 16:08:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RG8Iaj025685; Mon, 27 Feb 2012 16:08:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271608.q1RG8Iaj025685@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 16:08: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: r232218 - 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, 27 Feb 2012 16:08:18 -0000 Author: jhb Date: Mon Feb 27 16:08:18 2012 New Revision: 232218 URL: http://svn.freebsd.org/changeset/base/232218 Log: Clear the a device's description string anytime it's driver changes. Descriptions are specific to drivers and we don't change drivers on attached devices. This fixes a few places where we were not clearing the description when detaching a driver (e.g. with device_attach() failed). While here, fix a few other nits: - Remove spurious call to remove a device's driver from devclass_driver_deleted(). device_detach() removes it already. - Fix a typo. Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Mon Feb 27 15:59:17 2012 (r232217) +++ head/sys/kern/subr_bus.c Mon Feb 27 16:08:18 2012 (r232218) @@ -1129,7 +1129,6 @@ devclass_driver_deleted(devclass_t buscl dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2097,7 +2096,7 @@ device_probe_child(device_t dev, device_ /* XXX What happens if we rebid and got no best? */ if (best) { /* - * If this device was atached, and we were asked to + * If this device was attached, and we were asked to * rescan, and it is a different driver, then we have * to detach the old driver and reattach this new one. * Note, we don't have to check for DF_REBID here @@ -2604,6 +2603,7 @@ device_set_driver(device_t dev, driver_t free(dev->softc, M_BUS_SC); dev->softc = NULL; } + device_set_desc(dev, NULL); kobj_delete((kobj_t) dev, NULL); dev->driver = driver; if (driver) { @@ -2789,7 +2789,6 @@ device_detach(device_t dev) dev->state = DS_NOTPRESENT; (void)device_set_driver(dev, NULL); - device_set_desc(dev, NULL); device_sysctl_fini(dev); return (0); From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 16:10:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D415D1065672; Mon, 27 Feb 2012 16:10:26 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3B548FC16; Mon, 27 Feb 2012 16:10:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RGAQ9q025807; Mon, 27 Feb 2012 16:10:26 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RGAQOI025805; Mon, 27 Feb 2012 16:10:26 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202271610.q1RGAQOI025805@svn.freebsd.org> From: Kevin Lo Date: Mon, 27 Feb 2012 16:10:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232219 - head/sys/dev/mlx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 16:10:26 -0000 Author: kevlo Date: Mon Feb 27 16:10:26 2012 New Revision: 232219 URL: http://svn.freebsd.org/changeset/base/232219 Log: Remove unused variable count. This variable is initialized but not used. Modified: head/sys/dev/mlx/mlx.c Modified: head/sys/dev/mlx/mlx.c ============================================================================== --- head/sys/dev/mlx/mlx.c Mon Feb 27 16:08:18 2012 (r232218) +++ head/sys/dev/mlx/mlx.c Mon Feb 27 16:10:26 2012 (r232219) @@ -2254,7 +2254,7 @@ static void mlx_complete(struct mlx_softc *sc) { struct mlx_command *mc, *nc; - int s, count; + int s; debug_called(2); @@ -2263,7 +2263,6 @@ mlx_complete(struct mlx_softc *sc) return; s = splbio(); - count = 0; /* scan the list of busy/done commands */ mc = TAILQ_FIRST(&sc->mlx_work); From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 16:28:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 610061065672; Mon, 27 Feb 2012 16:28:03 +0000 (UTC) Date: Mon, 27 Feb 2012 16:28:03 +0000 From: Alexey Dokuchaev To: John Baldwin Message-ID: <20120227162803.GA85675@FreeBSD.org> References: <201202271608.q1RG8Iaj025685@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201202271608.q1RG8Iaj025685@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232218 - 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, 27 Feb 2012 16:28:03 -0000 On Mon, Feb 27, 2012 at 04:08:18PM +0000, John Baldwin wrote: > Author: jhb > Date: Mon Feb 27 16:08:18 2012 > New Revision: 232218 > URL: http://svn.freebsd.org/changeset/base/232218 > > Log: > Clear the a device's description string anytime it's driver changes. > Descriptions are specific to drivers and we don't change drivers on attached > devices. This fixes a few places where we were not clearing the description > when detaching a driver (e.g. with device_attach() failed). While here, fix > a few other nits: > - Remove spurious call to remove a device's driver from > devclass_driver_deleted(). device_detach() removes it already. > - Fix a typo. Thanks John, Please MFC it at least as far as RELENG_8. ./danfe From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:04:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16750106564A; Mon, 27 Feb 2012 17:04:19 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 062598FC17; Mon, 27 Feb 2012 17:04:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RH4IC6027942; Mon, 27 Feb 2012 17:04:18 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RH4IBM027940; Mon, 27 Feb 2012 17:04:18 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201202271704.q1RH4IBM027940@svn.freebsd.org> From: Sean Bruno Date: Mon, 27 Feb 2012 17:04: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: r232225 - head/sys/dev/isci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 17:04:19 -0000 Author: sbruno Date: Mon Feb 27 17:04:18 2012 New Revision: 232225 URL: http://svn.freebsd.org/changeset/base/232225 Log: Update PCI-IDs with devices found on Intel SDP Return BUS_PROBE_DEFAULT so that non-default drivers may be loaded Reviewed by: jharris@ Obtained from: Yahoo! Inc. and Intel MFC after: 3 days Modified: head/sys/dev/isci/isci.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Mon Feb 27 16:18:49 2012 (r232224) +++ head/sys/dev/isci/isci.c Mon Feb 27 17:04:18 2012 (r232225) @@ -98,7 +98,11 @@ static struct _pcsid { 0x1d688086, "Intel(R) C600 Series Chipset SAS Controller" }, { 0x1d698086, "Intel(R) C600 Series Chipset SAS Controller" }, { 0x1d6a8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, - { 0x1d6b8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, + { 0x1d6b8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, + { 0x1d6c8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6d8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6e8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6f8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, { 0x00000000, NULL } }; @@ -114,7 +118,7 @@ isci_probe (device_t device) if (ep->desc) { device_set_desc(device, ep->desc); - return (0); + return (BUS_PROBE_DEFAULT); } else return (ENXIO); From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:28:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29BC4106564A; Mon, 27 Feb 2012 17:28:23 +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 199BE8FC19; Mon, 27 Feb 2012 17:28:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHSMWo028882; Mon, 27 Feb 2012 17:28:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHSMA2028880; Mon, 27 Feb 2012 17:28:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271728.q1RHSMA2028880@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 17:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232226 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 17:28:23 -0000 Author: jhb Date: Mon Feb 27 17:28:22 2012 New Revision: 232226 URL: http://svn.freebsd.org/changeset/base/232226 Log: Update incorrect comment. Modified: head/sys/amd64/amd64/cpu_switch.S Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Mon Feb 27 17:04:18 2012 (r232225) +++ head/sys/amd64/amd64/cpu_switch.S Mon Feb 27 17:28:22 2012 (r232226) @@ -76,7 +76,7 @@ ENTRY(cpu_throw) movq PCPU(CURPMAP),%rdx LK btrl %eax,PM_ACTIVE(%rdx) /* clear old */ 1: - movq TD_PCB(%rsi),%r8 /* newtd->td_proc */ + movq TD_PCB(%rsi),%r8 /* newtd->td_pcb */ movq PCB_CR3(%r8),%rdx movq %rdx,%cr3 /* new address space */ jmp swact From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:28:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A3F21065679; Mon, 27 Feb 2012 17:28:48 +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 4A3B38FC17; Mon, 27 Feb 2012 17:28:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHSmVY028932; Mon, 27 Feb 2012 17:28:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHSmpN028930; Mon, 27 Feb 2012 17:28:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271728.q1RHSmpN028930@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 17:28: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: r232227 - head/sys/amd64/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: Mon, 27 Feb 2012 17:28:48 -0000 Author: jhb Date: Mon Feb 27 17:28:47 2012 New Revision: 232227 URL: http://svn.freebsd.org/changeset/base/232227 Log: Correct function prototype for read_rflags(). Modified: head/sys/amd64/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Mon Feb 27 17:28:22 2012 (r232226) +++ head/sys/amd64/include/cpufunc.h Mon Feb 27 17:28:47 2012 (r232227) @@ -727,7 +727,7 @@ uint64_t rdr5(void); uint64_t rdr6(void); uint64_t rdr7(void); uint64_t rdtsc(void); -u_int read_rflags(void); +u_long read_rflags(void); u_int rfs(void); u_int rgs(void); void wbinvd(void); From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:29:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C6091065673; Mon, 27 Feb 2012 17:29:37 +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 7BD858FC12; Mon, 27 Feb 2012 17:29:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHTb4I029000; Mon, 27 Feb 2012 17:29:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHTbsr028997; Mon, 27 Feb 2012 17:29:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271729.q1RHTbsr028997@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 17:29: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: r232228 - 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: Mon, 27 Feb 2012 17:29:37 -0000 Author: jhb Date: Mon Feb 27 17:29:37 2012 New Revision: 232228 URL: http://svn.freebsd.org/changeset/base/232228 Log: Resort the IDT_DTRACE_RET constant after it was changed to be less than IDT_SYSCALL. Modified: head/sys/amd64/include/segments.h head/sys/i386/include/segments.h Modified: head/sys/amd64/include/segments.h ============================================================================== --- head/sys/amd64/include/segments.h Mon Feb 27 17:28:47 2012 (r232227) +++ head/sys/amd64/include/segments.h Mon Feb 27 17:29:37 2012 (r232228) @@ -213,8 +213,8 @@ struct region_descriptor { #define IDT_MC 18 /* #MC: Machine Check */ #define IDT_XF 19 /* #XF: SIMD Floating-Point Exception */ #define IDT_IO_INTS NRSVIDT /* Base of IDT entries for I/O interrupts. */ -#define IDT_SYSCALL 0x80 /* System Call Interrupt Vector */ #define IDT_DTRACE_RET 0x20 /* DTrace pid provider Interrupt Vector */ +#define IDT_SYSCALL 0x80 /* System Call Interrupt Vector */ /* * Entries in the Global Descriptor Table (GDT) Modified: head/sys/i386/include/segments.h ============================================================================== --- head/sys/i386/include/segments.h Mon Feb 27 17:28:47 2012 (r232227) +++ head/sys/i386/include/segments.h Mon Feb 27 17:29:37 2012 (r232228) @@ -206,8 +206,8 @@ struct region_descriptor { #define IDT_MC 18 /* #MC: Machine Check */ #define IDT_XF 19 /* #XF: SIMD Floating-Point Exception */ #define IDT_IO_INTS NRSVIDT /* Base of IDT entries for I/O interrupts. */ -#define IDT_SYSCALL 0x80 /* System Call Interrupt Vector */ #define IDT_DTRACE_RET 0x20 /* DTrace pid provider Interrupt Vector */ +#define IDT_SYSCALL 0x80 /* System Call Interrupt Vector */ /* * Entries in the Global Descriptor Table (GDT) From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:29:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC16F106577F; Mon, 27 Feb 2012 17:29:43 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 354FF8FC15; Mon, 27 Feb 2012 17:29:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHTgOT029040; Mon, 27 Feb 2012 17:29:42 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHTgBj029038; Mon, 27 Feb 2012 17:29:42 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201202271729.q1RHTgBj029038@svn.freebsd.org> From: Sean Bruno Date: Mon, 27 Feb 2012 17:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232229 - stable/9/sys/dev/isci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 17:29:44 -0000 Author: sbruno Date: Mon Feb 27 17:29:42 2012 New Revision: 232229 URL: http://svn.freebsd.org/changeset/base/232229 Log: MFC r231860 During work to port isci(4) to stable/7 I noted that the maxio portion of struct ccb_pathinq from sys/cam/cam_ccb.h wasn't added to stable/7 at all and didn't appear in stable/8 until svn R195534. Since __FreeBSD_version did not get bumped until svn R195634, assume that maxio is valid at 800102 or higher. Obtained from: Yahoo! Inc. Modified: stable/9/sys/dev/isci/isci_controller.c Modified: stable/9/sys/dev/isci/isci_controller.c ============================================================================== --- stable/9/sys/dev/isci/isci_controller.c Mon Feb 27 17:29:37 2012 (r232228) +++ stable/9/sys/dev/isci/isci_controller.c Mon Feb 27 17:29:42 2012 (r232229) @@ -549,7 +549,7 @@ void isci_action(struct cam_sim *sim, un cpi->hba_eng_cnt = 0; cpi->max_target = SCI_MAX_REMOTE_DEVICES - 1; cpi->max_lun = ISCI_MAX_LUN; -#if __FreeBSD_version >= 704100 +#if __FreeBSD_version >= 800102 cpi->maxio = isci_io_request_get_max_io_size(); #endif cpi->unit_number = cam_sim_unit(sim); From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:30:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACB89106564A; Mon, 27 Feb 2012 17:30: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 831948FC17; Mon, 27 Feb 2012 17:30:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHULOV029127; Mon, 27 Feb 2012 17:30:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHULHQ029125; Mon, 27 Feb 2012 17:30:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271730.q1RHULHQ029125@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 17:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232230 - head/sys/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: Mon, 27 Feb 2012 17:30:21 -0000 Author: jhb Date: Mon Feb 27 17:30:21 2012 New Revision: 232230 URL: http://svn.freebsd.org/changeset/base/232230 Log: Remove completely duplicate '#ifdef XEN' section. Modified: head/sys/i386/include/apicvar.h Modified: head/sys/i386/include/apicvar.h ============================================================================== --- head/sys/i386/include/apicvar.h Mon Feb 27 17:29:42 2012 (r232229) +++ head/sys/i386/include/apicvar.h Mon Feb 27 17:30:21 2012 (r232230) @@ -103,35 +103,6 @@ */ /* Interrupts for local APIC LVT entries other than the timer. */ -#ifdef XEN -/* These are the Xen i386 APIC definitions */ -#define APIC_LOCAL_INTS 240 -#define APIC_ERROR_INT APIC_LOCAL_INTS -#define APIC_THERMAL_INT (APIC_LOCAL_INTS + 1) -#define APIC_CMC_INT (APIC_LOCAL_INTS + 2) -#define APIC_IPI_INTS (APIC_LOCAL_INTS + 3) - -#define IPI_RENDEZVOUS (APIC_IPI_INTS) /* Inter-CPU rendezvous. */ -#define IPI_INVLTLB (APIC_IPI_INTS + 1) /* TLB Shootdown IPIs */ -#define IPI_INVLPG (APIC_IPI_INTS + 2) -#define IPI_INVLRNG (APIC_IPI_INTS + 3) -#define IPI_INVLCACHE (APIC_IPI_INTS + 4) -#define IPI_LAZYPMAP (APIC_IPI_INTS + 5) /* Lazy pmap release. */ -/* Vector to handle bitmap based IPIs */ -#define IPI_BITMAP_VECTOR (APIC_IPI_INTS + 6) - -/* IPIs handled by IPI_BITMAPED_VECTOR (XXX ups is there a better place?) */ -#define IPI_AST 0 /* Generate software trap. */ -#define IPI_PREEMPT 1 -#define IPI_HARDCLOCK 2 -#define IPI_BITMAP_LAST IPI_HARDCLOCK -#define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST) - -#define IPI_STOP (APIC_IPI_INTS + 7) /* Stop CPU until restarted. */ -#define IPI_STOP_HARD (APIC_IPI_INTS + 8) /* Stop CPU with a NMI. */ - -#else /* XEN */ -/* These are the normal i386 APIC definitions */ #define APIC_LOCAL_INTS 240 #define APIC_ERROR_INT APIC_LOCAL_INTS #define APIC_THERMAL_INT (APIC_LOCAL_INTS + 1) @@ -156,7 +127,6 @@ #define IPI_STOP (APIC_IPI_INTS + 7) /* Stop CPU until restarted. */ #define IPI_STOP_HARD (APIC_IPI_INTS + 8) /* Stop CPU with a NMI. */ -#endif /* XEN */ /* * The spurious interrupt can share the priority class with the IPIs since From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:31:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 956D41065672; Mon, 27 Feb 2012 17:31:38 +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 855D08FC14; Mon, 27 Feb 2012 17:31:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHVcaO029221; Mon, 27 Feb 2012 17:31:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHVcMJ029219; Mon, 27 Feb 2012 17:31:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271731.q1RHVcMJ029219@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 17:31: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: r232231 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 17:31:38 -0000 Author: jhb Date: Mon Feb 27 17:31:38 2012 New Revision: 232231 URL: http://svn.freebsd.org/changeset/base/232231 Log: MFamd64: Don't whine about interrupts being disabled for an NMI. Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Feb 27 17:30:21 2012 (r232230) +++ head/sys/i386/i386/trap.c Mon Feb 27 17:31:38 2012 (r232231) @@ -304,8 +304,9 @@ trap(struct trapframe *frame) uprintf( "pid %ld (%s): trap %d with interrupts disabled\n", (long)curproc->p_pid, curthread->td_name, type); - else if (type != T_BPTFLT && type != T_TRCTRAP && - frame->tf_eip != (int)cpu_switch_load_gs) { + else if (type != T_NMI && type != T_BPTFLT && + type != T_TRCTRAP && + frame->tf_eip != (int)cpu_switch_load_gs) { /* * XXX not quite right, since this may be for a * multiple fault in user mode. @@ -315,9 +316,9 @@ trap(struct trapframe *frame) /* * Page faults need interrupts disabled until later, * and we shouldn't enable interrupts while holding - * a spin lock or if servicing an NMI. + * a spin lock. */ - if (type != T_NMI && type != T_PAGEFLT && + if (type != T_PAGEFLT && td->td_md.md_spinlock_count == 0) enable_intr(); } From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:33:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEF851065678; Mon, 27 Feb 2012 17:33: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 AED4F8FC19; Mon, 27 Feb 2012 17:33:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHXGa9029339; Mon, 27 Feb 2012 17:33:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHXGuA029337; Mon, 27 Feb 2012 17:33:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271733.q1RHXGuA029337@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 17:33: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: r232232 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 17:33:16 -0000 Author: jhb Date: Mon Feb 27 17:33:16 2012 New Revision: 232232 URL: http://svn.freebsd.org/changeset/base/232232 Log: - Panic up front if a kernel does not include 'device atpic' and an APIC is not found. - Don't panic if lapic_enable_cmc() is called and the APIC is not enabled. This can happen due to booting a kernel with APIC disabled on a CPU that supports CMCI. - Wrap a long line. Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Feb 27 17:31:38 2012 (r232231) +++ head/sys/x86/x86/local_apic.c Mon Feb 27 17:33:16 2012 (r232232) @@ -34,6 +34,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_atpic.h" #include "opt_hwpmc_hooks.h" #include "opt_kdtrace.h" @@ -308,7 +309,8 @@ lapic_create(u_int apic_id, int boot_cpu lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] = IRQ_TIMER; #ifdef KDTRACE_HOOKS - lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] = IRQ_DTRACE_RET; + lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] = + IRQ_DTRACE_RET; #endif @@ -890,6 +892,10 @@ lapic_enable_cmc(void) { u_int apic_id; +#ifdef DEV_ATPIC + if (lapic == NULL) + return; +#endif apic_id = PCPU_GET(apic_id); KASSERT(lapics[apic_id].la_present, ("%s: missing APIC %u", __func__, apic_id)); @@ -1286,6 +1292,9 @@ apic_init(void *dummy __unused) if (best_enum == NULL) { if (bootverbose) printf("APIC: Could not find any APICs.\n"); +#ifndef DEV_ATPIC + panic("running without device atpic requires a local APIC"); +#endif return; } From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:39:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87820106564A; Mon, 27 Feb 2012 17:39:34 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D8AC8FC15; Mon, 27 Feb 2012 17:39:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHdYCY029561; Mon, 27 Feb 2012 17:39:34 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHdYVr029559; Mon, 27 Feb 2012 17:39:34 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202271739.q1RHdYVr029559@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 27 Feb 2012 17:39: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: r232233 - head/usr.bin/fstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 17:39:34 -0000 Author: pluknet Date: Mon Feb 27 17:39:34 2012 New Revision: 232233 URL: http://svn.freebsd.org/changeset/base/232233 Log: Backout r230934 which didn't work with unix sockets and several filesystem layers mounted at the specified path. Pointy hat to: pluknet Modified: head/usr.bin/fstat/fstat.c Modified: head/usr.bin/fstat/fstat.c ============================================================================== --- head/usr.bin/fstat/fstat.c Mon Feb 27 17:33:16 2012 (r232232) +++ head/usr.bin/fstat/fstat.c Mon Feb 27 17:39:34 2012 (r232233) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -225,53 +224,28 @@ static void print_file_info(struct procstat *procstat, struct filestat *fst, const char *uname, const char *cmd, int pid) { - struct sockstat sock; struct vnstat vn; DEVS *d; const char *filename; int error, fsmatch = 0; char errbuf[_POSIX2_LINE_MAX]; - error = 0; filename = NULL; if (checkfile != 0) { - switch (fst->fs_type) { - case PS_FST_TYPE_VNODE: - case PS_FST_TYPE_FIFO: - error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); - break; - case PS_FST_TYPE_SOCKET: - error = procstat_get_socket_info(procstat, fst, &sock, errbuf); - break; - default: + if (fst->fs_type != PS_FST_TYPE_VNODE && + fst->fs_type != PS_FST_TYPE_FIFO) return; - } + error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); if (error != 0) return; for (d = devs; d != NULL; d = d->next) - switch (fst->fs_type) { - case PS_FST_TYPE_VNODE: - case PS_FST_TYPE_FIFO: - if (d->fsid == vn.vn_fsid) { - fsmatch = 1; - if ((unsigned)d->ino == vn.vn_fileid) { - filename = d->name; - break; - } - } - break; - case PS_FST_TYPE_SOCKET: - if (sock.dom_family == AF_UNIX) { - fsmatch = 1; - if (strcmp(((struct sockaddr_un *) - (&sock.sa_local))->sun_path, - d->name) == 0) { - filename = d->name; - break; - } + if (d->fsid == vn.vn_fsid) { + fsmatch = 1; + if ((unsigned)d->ino == vn.vn_fileid) { + filename = d->name; + break; } - break; } if (fsmatch == 0 || (filename == NULL && fsflg == 0)) return; From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 17:41:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F93F106564A; Mon, 27 Feb 2012 17:41:24 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8E258FC0A; Mon, 27 Feb 2012 17:41:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RHfNtf029653; Mon, 27 Feb 2012 17:41:23 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RHfNDL029651; Mon, 27 Feb 2012 17:41:23 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202271741.q1RHfNDL029651@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 27 Feb 2012 17:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232234 - stable/9/usr.bin/fstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 17:41:24 -0000 Author: pluknet Date: Mon Feb 27 17:41:23 2012 New Revision: 232234 URL: http://svn.freebsd.org/changeset/base/232234 Log: Backout r230934 (MFCed as r231859) which didn't work with unix sockets and several filesystem layers mounted at the specified path. Pointy hat to: pluknet Reported by: flo via broken tinderbox Modified: stable/9/usr.bin/fstat/fstat.c Directory Properties: stable/9/usr.bin/fstat/ (props changed) Modified: stable/9/usr.bin/fstat/fstat.c ============================================================================== --- stable/9/usr.bin/fstat/fstat.c Mon Feb 27 17:39:34 2012 (r232233) +++ stable/9/usr.bin/fstat/fstat.c Mon Feb 27 17:41:23 2012 (r232234) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -225,53 +224,28 @@ static void print_file_info(struct procstat *procstat, struct filestat *fst, const char *uname, const char *cmd, int pid) { - struct sockstat sock; struct vnstat vn; DEVS *d; const char *filename; int error, fsmatch = 0; char errbuf[_POSIX2_LINE_MAX]; - error = 0; filename = NULL; if (checkfile != 0) { - switch (fst->fs_type) { - case PS_FST_TYPE_VNODE: - case PS_FST_TYPE_FIFO: - error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); - break; - case PS_FST_TYPE_SOCKET: - error = procstat_get_socket_info(procstat, fst, &sock, errbuf); - break; - default: + if (fst->fs_type != PS_FST_TYPE_VNODE && + fst->fs_type != PS_FST_TYPE_FIFO) return; - } + error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); if (error != 0) return; for (d = devs; d != NULL; d = d->next) - switch (fst->fs_type) { - case PS_FST_TYPE_VNODE: - case PS_FST_TYPE_FIFO: - if (d->fsid == vn.vn_fsid) { - fsmatch = 1; - if ((unsigned)d->ino == vn.vn_fileid) { - filename = d->name; - break; - } - } - break; - case PS_FST_TYPE_SOCKET: - if (sock.dom_family == AF_UNIX) { - fsmatch = 1; - if (strcmp(((struct sockaddr_un *) - (&sock.sa_local))->sun_path, - d->name) == 0) { - filename = d->name; - break; - } + if (d->fsid == vn.vn_fsid) { + fsmatch = 1; + if ((unsigned)d->ino == vn.vn_fileid) { + filename = d->name; + break; } - break; } if (fsmatch == 0 || (filename == NULL && fsflg == 0)) return; From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 18:10:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46F9D106566B; Mon, 27 Feb 2012 18:10:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1CC638FC1E; Mon, 27 Feb 2012 18:10:22 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id CA20446B3F; Mon, 27 Feb 2012 13:10:21 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 35D9AB967; Mon, 27 Feb 2012 13:10:21 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Mon, 27 Feb 2012 10:43:07 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202221505.q1MF5JNt057163@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201202271043.07379.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Feb 2012 13:10:21 -0500 (EST) Cc: Josh Paetzel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r231999 - 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: Mon, 27 Feb 2012 18:10:22 -0000 On Sunday, February 26, 2012 6:51:21 am Sergey Kandaurov wrote: > On 22 February 2012 19:05, Josh Paetzel wrote: > > Author: jpaetzel > > Date: Wed Feb 22 15:05:19 2012 > > New Revision: 231999 > > URL: http://svn.freebsd.org/changeset/base/231999 > > > > Log: > > Fix various typos and normalize spelling. > [...] > > @@ -602,7 +602,7 @@ options FLOWTABLE > > options SCTP > > # There are bunches of options: > > # this one turns on all sorts of > > -# nastly printing that you can > > +# nastily printing that you can > > # do. It's all controlled by a > > # bit mask (settable by socket opt and > > # by sysctl). Including will not cause > > adj. nasty? Yeah, 'nastily printing' doesn't read well here and doesn't seem to be the intent. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 18:10:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B80CA106577E; Mon, 27 Feb 2012 18:10: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 515EE8FC0A; Mon, 27 Feb 2012 18:10:28 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 097B346B4C; Mon, 27 Feb 2012 13:10:28 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 670DFB99E; Mon, 27 Feb 2012 13:10:27 -0500 (EST) From: John Baldwin To: Alexey Dokuchaev Date: Mon, 27 Feb 2012 12:12:43 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202271608.q1RG8Iaj025685@svn.freebsd.org> <20120227162803.GA85675@FreeBSD.org> In-Reply-To: <20120227162803.GA85675@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <201202271212.43914.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Feb 2012 13:10:27 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232218 - 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, 27 Feb 2012 18:10:28 -0000 On Monday, February 27, 2012 11:28:03 am Alexey Dokuchaev wrote: > On Mon, Feb 27, 2012 at 04:08:18PM +0000, John Baldwin wrote: > > Author: jhb > > Date: Mon Feb 27 16:08:18 2012 > > New Revision: 232218 > > URL: http://svn.freebsd.org/changeset/base/232218 > > > > Log: > > Clear the a device's description string anytime it's driver changes. > > Descriptions are specific to drivers and we don't change drivers on attached > > devices. This fixes a few places where we were not clearing the description > > when detaching a driver (e.g. with device_attach() failed). While here, fix > > a few other nits: > > - Remove spurious call to remove a device's driver from > > devclass_driver_deleted(). device_detach() removes it already. > > - Fix a typo. > > Thanks John, > > Please MFC it at least as far as RELENG_8. Oh, whoops, I forgot to add 'MFC after'. I will MFC it. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 18:17:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D93801065670; Mon, 27 Feb 2012 18:17:03 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C83E18FC08; Mon, 27 Feb 2012 18:17:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RIH3ro030855; Mon, 27 Feb 2012 18:17:03 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RIH396030852; Mon, 27 Feb 2012 18:17:03 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201202271817.q1RIH396030852@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Feb 2012 18:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232235 - stable/9/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 18:17:04 -0000 Author: jkim Date: Mon Feb 27 18:17:03 2012 New Revision: 232235 URL: http://svn.freebsd.org/changeset/base/232235 Log: MFC: r231841, r231842 Properly check VESA video mode number. Modified: stable/9/sys/dev/fb/vesa.c stable/9/sys/dev/fb/vesa.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/fb/vesa.c ============================================================================== --- stable/9/sys/dev/fb/vesa.c Mon Feb 27 17:41:23 2012 (r232234) +++ stable/9/sys/dev/fb/vesa.c Mon Feb 27 18:17:03 2012 (r232235) @@ -1311,7 +1311,9 @@ vesa_set_mode(video_adapter_t *adp, int if (!(info.vi_flags & V_INFO_GRAPHICS)) info.vi_flags &= ~V_INFO_LINEAR; - if (vesa_bios_set_mode(mode | ((info.vi_flags & V_INFO_LINEAR) ? 0x4000 : 0))) + if ((info.vi_flags & V_INFO_LINEAR) != 0) + mode |= 0x4000; + if (vesa_bios_set_mode(mode)) return (1); /* Palette format is reset by the above VBE function call. */ @@ -1329,7 +1331,7 @@ vesa_set_mode(video_adapter_t *adp, int #if VESA_DEBUG > 0 printf("VESA: mode set!\n"); #endif - vesa_adp->va_mode = mode; + vesa_adp->va_mode = mode & 0x1ff; /* Mode number is 9-bit. */ vesa_adp->va_flags &= ~V_ADP_COLOR; vesa_adp->va_flags |= (info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0; Modified: stable/9/sys/dev/fb/vesa.h ============================================================================== --- stable/9/sys/dev/fb/vesa.h Mon Feb 27 17:41:23 2012 (r232234) +++ stable/9/sys/dev/fb/vesa.h Mon Feb 27 18:17:03 2012 (r232235) @@ -126,7 +126,7 @@ struct vesa_mode #ifdef _KERNEL -#define VESA_MODE(x) ((x) >= M_VESA_BASE) +#define VESA_MODE(x) ((x) >= M_VESA_BASE && (x) <= M_VESA_MODE_MAX) int vesa_load_ioctl(void); int vesa_unload_ioctl(void); From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 18:28:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6EEC1065673; Mon, 27 Feb 2012 18:28:18 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C58998FC0C; Mon, 27 Feb 2012 18:28:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RISI8h031359; Mon, 27 Feb 2012 18:28:18 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RISIWB031357; Mon, 27 Feb 2012 18:28:18 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201202271828.q1RISIWB031357@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 27 Feb 2012 18:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232236 - stable/9/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 18:28:19 -0000 Author: jkim Date: Mon Feb 27 18:28:18 2012 New Revision: 232236 URL: http://svn.freebsd.org/changeset/base/232236 Log: MFC: r231843, r232061, r232063, r232065, r232069 - Set the initial mode for the adapter after executing VESA BIOS POST. - Probe supported states for save/restore function. - Defer to VGA methods if no state is supported. Modified: stable/9/sys/dev/fb/vesa.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/fb/vesa.c ============================================================================== --- stable/9/sys/dev/fb/vesa.c Mon Feb 27 18:17:03 2012 (r232235) +++ stable/9/sys/dev/fb/vesa.c Mon Feb 27 18:28:18 2012 (r232236) @@ -1,6 +1,6 @@ /*- * Copyright (c) 1998 Kazutaka YOKOTA and Michael Smith - * Copyright (c) 2009-2010 Jung-uk Kim + * Copyright (c) 2009-2012 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,6 +80,7 @@ typedef struct adp_state adp_state_t; static struct mtx vesa_lock; +static int vesa_state; static void *vesa_state_buf = NULL; static uint32_t vesa_state_buf_offs = 0; static ssize_t vesa_state_buf_size = 0; @@ -205,13 +206,7 @@ static int vesa_bios_load_palette2(int s #define STATE_SIZE 0 #define STATE_SAVE 1 #define STATE_LOAD 2 -#define STATE_HW (1<<0) -#define STATE_DATA (1<<1) -#define STATE_DAC (1<<2) -#define STATE_REG (1<<3) -#define STATE_MOST (STATE_HW | STATE_DATA | STATE_REG) -#define STATE_ALL (STATE_HW | STATE_DATA | STATE_DAC | STATE_REG) -static ssize_t vesa_bios_state_buf_size(void); +static ssize_t vesa_bios_state_buf_size(int); static int vesa_bios_save_restore(int code, void *p); #ifdef MODE_TABLE_BROKEN static int vesa_bios_get_line_length(void); @@ -509,14 +504,14 @@ vesa_bios_load_palette2(int start, int c } static ssize_t -vesa_bios_state_buf_size(void) +vesa_bios_state_buf_size(int state) { x86regs_t regs; x86bios_init_regs(®s); regs.R_AX = 0x4f04; /* regs.R_DL = STATE_SIZE; */ - regs.R_CX = STATE_MOST; + regs.R_CX = state; x86bios_intr(®s, 0x10); @@ -537,7 +532,7 @@ vesa_bios_save_restore(int code, void *p x86bios_init_regs(®s); regs.R_AX = 0x4f04; regs.R_DL = code; - regs.R_CX = STATE_MOST; + regs.R_CX = vesa_state; regs.R_ES = X86BIOS_PHYSTOSEG(vesa_state_buf_offs); regs.R_BX = X86BIOS_PHYSTOOFF(vesa_state_buf_offs); @@ -1041,7 +1036,12 @@ vesa_bios_init(void) x86bios_free(vmbuf, sizeof(*buf)); - vesa_state_buf_size = vesa_bios_state_buf_size(); + /* Probe supported save/restore states. */ + for (i = 0; i < 4; i++) + if (vesa_bios_state_buf_size(1 << i) > 0) + vesa_state |= 1 << i; + if (vesa_state != 0) + vesa_state_buf_size = vesa_bios_state_buf_size(vesa_state); vesa_palette = x86bios_alloc(&vesa_palette_offs, VESA_PALETTE_SIZE + vesa_state_buf_size, M_WAITOK); if (vesa_state_buf_size > 0) { @@ -1451,15 +1451,13 @@ static int vesa_save_state(video_adapter_t *adp, void *p, size_t size) { - if (adp != vesa_adp) + if (adp != vesa_adp || vesa_state_buf_size == 0) return ((*prevvidsw->save_state)(adp, p, size)); - if (vesa_state_buf_size == 0) - return (1); if (size == 0) return (offsetof(adp_state_t, regs) + vesa_state_buf_size); if (size < (offsetof(adp_state_t, regs) + vesa_state_buf_size)) - return (1); + return (EINVAL); ((adp_state_t *)p)->sig = V_STATE_SIG; bzero(((adp_state_t *)p)->regs, vesa_state_buf_size); @@ -1469,18 +1467,20 @@ vesa_save_state(video_adapter_t *adp, vo static int vesa_load_state(video_adapter_t *adp, void *p) { + int mode; - if ((adp != vesa_adp) || (((adp_state_t *)p)->sig != V_STATE_SIG)) + if (adp != vesa_adp) return ((*prevvidsw->load_state)(adp, p)); - if (vesa_state_buf_size == 0) - return (1); - /* Try BIOS POST to restore a sane state. */ (void)vesa_bios_post(); - (void)int10_set_mode(adp->va_initial_bios_mode); - (void)vesa_set_mode(adp, adp->va_mode); + mode = adp->va_mode; + (void)vesa_set_mode(adp, adp->va_initial_mode); + if (mode != adp->va_initial_mode) + (void)vesa_set_mode(adp, mode); + if (((adp_state_t *)p)->sig != V_STATE_SIG) + return ((*prevvidsw->load_state)(adp, p)); return (vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs)); } From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 18:28:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAD9F1065673; Mon, 27 Feb 2012 18:28: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 AAB098FC0A; Mon, 27 Feb 2012 18:28:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RISVaf031400; Mon, 27 Feb 2012 18:28:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RISVmf031398; Mon, 27 Feb 2012 18:28:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202271828.q1RISVmf031398@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Feb 2012 18:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232237 - 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: Mon, 27 Feb 2012 18:28:31 -0000 Author: jhb Date: Mon Feb 27 18:28:31 2012 New Revision: 232237 URL: http://svn.freebsd.org/changeset/base/232237 Log: Typo. Modified: head/sys/sys/rman.h Modified: head/sys/sys/rman.h ============================================================================== --- head/sys/sys/rman.h Mon Feb 27 18:28:18 2012 (r232236) +++ head/sys/sys/rman.h Mon Feb 27 18:28:31 2012 (r232237) @@ -50,7 +50,7 @@ #define RF_ALIGNMENT_SHIFT 10 /* alignment size bit starts bit 10 */ #define RF_ALIGNMENT_MASK (0x003F << RF_ALIGNMENT_SHIFT) - /* resource address alignemnt size bit mask */ + /* resource address alignment size bit mask */ #define RF_ALIGNMENT_LOG2(x) ((x) << RF_ALIGNMENT_SHIFT) #define RF_ALIGNMENT(x) (((x) & RF_ALIGNMENT_MASK) >> RF_ALIGNMENT_SHIFT) From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 19:05:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96AF41065670; Mon, 27 Feb 2012 19:05:02 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 838638FC24; Mon, 27 Feb 2012 19:05:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RJ52tt032781; Mon, 27 Feb 2012 19:05:02 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RJ52Se032771; Mon, 27 Feb 2012 19:05:02 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201202271905.q1RJ52Se032771@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 27 Feb 2012 19:05: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: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 27 Feb 2012 19:05:02 -0000 Author: luigi Date: Mon Feb 27 19:05:01 2012 New Revision: 232238 URL: http://svn.freebsd.org/changeset/base/232238 Log: A bunch of netmap fixes: USERSPACE: 1. add support for devices with different number of rx and tx queues; 2. add better support for zero-copy operation, adding an extra field to the netmap ring to indicate how many buffers we have already processed but not yet released (with help from Eddie Kohler); 3. The two changes above unfortunately require an API change, so while at it add a version field and some spares to the ioctl() argument to help detect mismatches. 4. update the manual page for the two changes above; 5. update sample applications in tools/tools/netmap KERNEL: 1. simplify the internal structures moving the global wait queues to the 'struct netmap_adapter'; 2. simplify the functions that map kring<->nic ring indexes 3. normalize device-specific code, helps mainteinance; 4. start exploring the impact of micro-optimizations (prefetch etc.) in the ixgbe driver. Use 'legacy' descriptors on the tx ring and prefetch slots gives about 20% speedup at 900 MHz. Another 7-10% would come from removing the explict calls to bus_dmamap* in the core (they are effectively NOPs in this case, but it takes expensive load of the per-buffer dma maps to figure out that they are all NULL. Rx performance not investigated. I am postponing the MFC so i can import a few more improvements before merging. Modified: head/share/man/man4/netmap.4 head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/re/if_re.c head/sys/net/netmap.h head/sys/net/netmap_user.h head/tools/tools/netmap/bridge.c head/tools/tools/netmap/pcap.c head/tools/tools/netmap/pkt-gen.c Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Mon Feb 27 18:28:31 2012 (r232237) +++ head/share/man/man4/netmap.4 Mon Feb 27 19:05:01 2012 (r232238) @@ -28,7 +28,7 @@ .\" $FreeBSD$ .\" $Id: netmap.4 9662 2011-11-16 13:18:06Z luigi $: stable/8/share/man/man4/bpf.4 181694 2008-08-13 17:45:06Z ed $ .\" -.Dd November 16, 2011 +.Dd February 27, 2012 .Dt NETMAP 4 .Os .Sh NAME @@ -123,8 +123,9 @@ one ring pair (numbered N) for packets f struct netmap_ring { const ssize_t buf_ofs; const uint32_t num_slots; /* number of slots in the ring. */ - uint32_t avail; /* number of usable slots */ - uint32_t cur; /* 'current' index for the user side */ + uint32_t avail; /* number of usable slots */ + uint32_t cur; /* 'current' index for the user side */ + uint32_t reserved; /* not refilled before current */ const uint16_t nr_buf_size; uint16_t flags; @@ -173,10 +174,14 @@ defined as follows: .Bd -literal struct nmreq { char nr_name[IFNAMSIZ]; + uint32_t nr_version; /* API version */ +#define NETMAP_API 2 /* current version */ uint32_t nr_offset; /* nifp offset in the shared region */ uint32_t nr_memsize; /* size of the shared region */ - uint32_t nr_numdescs; /* descriptors per queue */ - uint16_t nr_numqueues; + uint32_t nr_tx_slots; /* slots in tx rings */ + uint32_t nr_rx_slots; /* slots in rx rings */ + uint16_t nr_tx_rings; /* number of tx rings */ + uint16_t nr_rx_rings; /* number of tx rings */ uint16_t nr_ringid; /* ring(s) we care about */ #define NETMAP_HW_RING 0x4000 /* low bits indicate one hw ring */ #define NETMAP_SW_RING 0x2000 /* we process the sw ring */ @@ -199,8 +204,10 @@ and are: returns information about the interface named in nr_name. On return, nr_memsize indicates the size of the shared netmap memory region (this is device-independent), -nr_numslots indicates how many buffers are in a ring, -nr_numrings indicates the number of rings supported by the hardware. +nr_tx_slots and nr_rx_slots indicates how many buffers are in a +transmit and receive ring, +nr_tx_rings and nr_rx_rings indicates the number of transmit +and receive rings supported by the hardware. .Pp If the device does not support netmap, the ioctl returns EINVAL. .It Dv NIOCREGIF @@ -266,6 +273,7 @@ struct netmap_request nmr; fd = open("/dev/netmap", O_RDWR); bzero(&nmr, sizeof(nmr)); strcpy(nmr.nm_name, "ix0"); +nmr.nm_version = NETMAP_API; ioctl(fd, NIOCREG, &nmr); p = mmap(0, nmr.memsize, fd); nifp = NETMAP_IF(p, nmr.offset); Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Feb 27 18:28:31 2012 (r232237) +++ head/sys/dev/e1000/if_em.c Mon Feb 27 19:05:01 2012 (r232238) @@ -3296,7 +3296,7 @@ em_setup_transmit_ring(struct tx_ring *t } #ifdef DEV_NETMAP if (slot) { - int si = netmap_tidx_n2k(na, txr->me, i); + int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); uint64_t paddr; void *addr; @@ -3759,7 +3759,7 @@ em_txeof(struct tx_ring *txr) selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); EM_TX_UNLOCK(txr); EM_CORE_LOCK(adapter); - selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + selwakeuppri(&na->tx_si, PI_NET); EM_CORE_UNLOCK(adapter); EM_TX_LOCK(txr); return (FALSE); @@ -4051,7 +4051,7 @@ em_setup_receive_ring(struct rx_ring *rx rxbuf = &rxr->rx_buffers[j]; #ifdef DEV_NETMAP if (slot) { - int si = netmap_ridx_n2k(na, rxr->me, j); + int si = netmap_idx_n2k(&na->rx_rings[rxr->me], j); uint64_t paddr; void *addr; @@ -4370,10 +4370,11 @@ em_rxeof(struct rx_ring *rxr, int count, if (ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(ifp); + na->rx_rings[rxr->me].nr_kflags |= NKR_PENDINTR; selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); EM_RX_UNLOCK(rxr); EM_CORE_LOCK(adapter); - selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + selwakeuppri(&na->rx_si, PI_NET); EM_CORE_UNLOCK(adapter); return (0); } Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Feb 27 18:28:31 2012 (r232237) +++ head/sys/dev/e1000/if_igb.c Mon Feb 27 19:05:01 2012 (r232238) @@ -3315,7 +3315,7 @@ igb_setup_transmit_ring(struct tx_ring * } #ifdef DEV_NETMAP if (slot) { - int si = netmap_tidx_n2k(na, txr->me, i); + int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); /* no need to set the address */ netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); } @@ -3693,7 +3693,7 @@ igb_txeof(struct tx_ring *txr) selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); IGB_TX_UNLOCK(txr); IGB_CORE_LOCK(adapter); - selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + selwakeuppri(&na->tx_si, PI_NET); IGB_CORE_UNLOCK(adapter); IGB_TX_LOCK(txr); return FALSE; @@ -4057,7 +4057,7 @@ igb_setup_receive_ring(struct rx_ring *r #ifdef DEV_NETMAP if (slot) { /* slot sj is mapped to the i-th NIC-ring entry */ - int sj = netmap_ridx_n2k(na, rxr->me, j); + int sj = netmap_idx_n2k(&na->rx_rings[rxr->me], j); uint64_t paddr; void *addr; @@ -4554,10 +4554,11 @@ igb_rxeof(struct igb_queue *que, int cou if (ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(ifp); + na->rx_rings[rxr->me].nr_kflags |= NKR_PENDINTR; selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); IGB_RX_UNLOCK(rxr); IGB_CORE_LOCK(adapter); - selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + selwakeuppri(&na->rx_si, PI_NET); IGB_CORE_UNLOCK(adapter); return (0); } Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Mon Feb 27 18:28:31 2012 (r232237) +++ head/sys/dev/e1000/if_lem.c Mon Feb 27 19:05:01 2012 (r232238) @@ -2669,7 +2669,7 @@ lem_setup_transmit_structures(struct ada #ifdef DEV_NETMAP if (slot) { /* the i-th NIC entry goes to slot si */ - int si = netmap_tidx_n2k(na, 0, i); + int si = netmap_idx_n2k(&na->tx_rings[0], i); uint64_t paddr; void *addr; @@ -3243,7 +3243,7 @@ lem_setup_receive_structures(struct adap #ifdef DEV_NETMAP if (slot) { /* the i-th NIC entry goes to slot si */ - int si = netmap_ridx_n2k(na, 0, i); + int si = netmap_idx_n2k(&na->rx_rings[0], i); uint64_t paddr; void *addr; @@ -3475,7 +3475,9 @@ lem_rxeof(struct adapter *adapter, int c #ifdef DEV_NETMAP if (ifp->if_capenable & IFCAP_NETMAP) { - selwakeuppri(&NA(ifp)->rx_rings[0].si, PI_NET); + struct netmap_adapter *na = NA(ifp); + na->rx_rings[0].nr_kflags |= NKR_PENDINTR; + selwakeuppri(&na->rx_rings[0].si, PI_NET); EM_RX_UNLOCK(adapter); return (0); } Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Feb 27 18:28:31 2012 (r232237) +++ head/sys/dev/ixgbe/ixgbe.c Mon Feb 27 19:05:01 2012 (r232238) @@ -2970,10 +2970,10 @@ ixgbe_setup_transmit_ring(struct tx_ring * kring->nkr_hwofs positions "ahead" wrt the * corresponding slot in the NIC ring. In some drivers * (not here) nkr_hwofs can be negative. Function - * netmap_tidx_n2k() handles wraparounds properly. + * netmap_idx_n2k() handles wraparounds properly. */ if (slot) { - int si = netmap_tidx_n2k(na, txr->me, i); + int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); } #endif /* DEV_NETMAP */ @@ -3491,7 +3491,7 @@ ixgbe_txeof(struct tx_ring *txr) selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); IXGBE_TX_UNLOCK(txr); IXGBE_CORE_LOCK(adapter); - selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + selwakeuppri(&na->tx_si, PI_NET); IXGBE_CORE_UNLOCK(adapter); IXGBE_TX_LOCK(txr); } @@ -3922,7 +3922,7 @@ ixgbe_setup_receive_ring(struct rx_ring * an mbuf, so end the block with a continue; */ if (slot) { - int sj = netmap_ridx_n2k(na, rxr->me, j); + int sj = netmap_idx_n2k(&na->rx_rings[rxr->me], j); uint64_t paddr; void *addr; @@ -4376,7 +4376,7 @@ ixgbe_rxeof(struct ix_queue *que, int co selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); IXGBE_RX_UNLOCK(rxr); IXGBE_CORE_LOCK(adapter); - selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + selwakeuppri(&na->rx_si, PI_NET); IXGBE_CORE_UNLOCK(adapter); return (FALSE); } Modified: head/sys/dev/netmap/if_em_netmap.h ============================================================================== --- head/sys/dev/netmap/if_em_netmap.h Mon Feb 27 18:28:31 2012 (r232237) +++ head/sys/dev/netmap/if_em_netmap.h Mon Feb 27 19:05:01 2012 (r232238) @@ -25,45 +25,23 @@ /* * $FreeBSD$ - * $Id: if_em_netmap.h 9802 2011-12-02 18:42:37Z luigi $ + * $Id: if_em_netmap.h 10627 2012-02-23 19:37:15Z luigi $ * - * netmap support for if_em.c + * netmap support for em. * - * For structure and details on the individual functions please see - * ixgbe_netmap.h + * For more details on netmap support please see ixgbe_netmap.h */ + #include #include #include #include /* vtophys ? */ #include + static void em_netmap_block_tasks(struct adapter *); static void em_netmap_unblock_tasks(struct adapter *); -static int em_netmap_reg(struct ifnet *, int onoff); -static int em_netmap_txsync(struct ifnet *, u_int, int); -static int em_netmap_rxsync(struct ifnet *, u_int, int); -static void em_netmap_lock_wrapper(struct ifnet *, int, u_int); - - -static void -em_netmap_attach(struct adapter *adapter) -{ - struct netmap_adapter na; - - bzero(&na, sizeof(na)); - - na.ifp = adapter->ifp; - na.separate_locks = 1; - na.num_tx_desc = adapter->num_tx_desc; - na.num_rx_desc = adapter->num_rx_desc; - na.nm_txsync = em_netmap_txsync; - na.nm_rxsync = em_netmap_rxsync; - na.nm_lock = em_netmap_lock_wrapper; - na.nm_register = em_netmap_reg; - netmap_attach(&na, adapter->num_queues); -} static void @@ -137,7 +115,7 @@ em_netmap_unblock_tasks(struct adapter * /* - * register-unregister routine + * Register/unregister routine */ static int em_netmap_reg(struct ifnet *ifp, int onoff) @@ -180,17 +158,17 @@ fail: /* - * Reconcile hardware and user view of the transmit ring. + * Reconcile kernel and user view of the transmit ring. */ static int em_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock) { struct adapter *adapter = ifp->if_softc; struct tx_ring *txr = &adapter->tx_rings[ring_nr]; - struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; + u_int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; @@ -204,16 +182,17 @@ em_netmap_txsync(struct ifnet *ifp, u_in bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_POSTREAD); - /* check for new packets to send. - * j indexes the netmap ring, l indexes the nic ring, and - * j = kring->nr_hwcur, l = E1000_TDT (not tracked), - * j == (l + kring->nkr_hwofs) % ring_size + /* + * Process new packets to send. j is the current index in the + * netmap ring, l is the corresponding index in the NIC ring. */ j = kring->nr_hwcur; - if (j != k) { /* we have packets to send */ - l = netmap_tidx_k2n(na, ring_nr, j); + if (j != k) { /* we have new packets to send */ + l = netmap_idx_k2n(kring, j); for (n = 0; j != k; n++) { + /* slot is the current slot in the netmap ring */ struct netmap_slot *slot = &ring->slot[j]; + /* curr is the current slot in the nic ring */ struct e1000_tx_desc *curr = &txr->tx_base[l]; struct em_buffer *txbuf = &txr->tx_buffers[l]; int flags = ((slot->flags & NS_REPORT) || @@ -221,7 +200,7 @@ em_netmap_txsync(struct ifnet *ifp, u_in E1000_TXD_CMD_RS : 0; uint64_t paddr; void *addr = PNMB(slot, &paddr); - int len = slot->len; + u_int len = slot->len; if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { if (do_lock) @@ -230,25 +209,21 @@ em_netmap_txsync(struct ifnet *ifp, u_in } slot->flags &= ~NS_REPORT; - curr->upper.data = 0; - curr->lower.data = - htole32(adapter->txd_cmd | len | - (E1000_TXD_CMD_EOP | flags) ); if (slot->flags & NS_BUF_CHANGED) { curr->buffer_addr = htole64(paddr); /* buffer has changed, reload map */ netmap_reload_map(txr->txtag, txbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } - + curr->upper.data = 0; + curr->lower.data = htole32(adapter->txd_cmd | len | + (E1000_TXD_CMD_EOP | flags) ); bus_dmamap_sync(txr->txtag, txbuf->map, BUS_DMASYNC_PREWRITE); j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; } - kring->nr_hwcur = k; - - /* decrease avail by number of sent packets */ + kring->nr_hwcur = k; /* the saved ring->cur */ kring->nr_hwavail -= n; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, @@ -275,7 +250,7 @@ em_netmap_txsync(struct ifnet *ifp, u_in kring->nr_hwavail += delta; } } - /* update avail to what the hardware knows */ + /* update avail to what the kernel knows */ ring->avail = kring->nr_hwavail; if (do_lock) @@ -292,10 +267,12 @@ em_netmap_rxsync(struct ifnet *ifp, u_in { struct adapter *adapter = ifp->if_softc; struct rx_ring *rxr = &adapter->rx_rings[ring_nr]; - struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, l, n, lim = kring->nkr_num_slots - 1; + u_int j, l, n, lim = kring->nkr_num_slots - 1; + int force_update = do_lock || kring->nr_kflags & NKR_PENDINTR; + u_int k = ring->cur, resvd = ring->reserved; k = ring->cur; if (k > lim) @@ -308,37 +285,45 @@ em_netmap_rxsync(struct ifnet *ifp, u_in bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* import newly received packets into the netmap ring. - * j is an index in the netmap ring, l in the NIC ring, and - * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size - * l = rxr->next_to_check; - * and - * j == (l + kring->nkr_hwofs) % ring_size + /* + * Import newly received packets into the netmap ring. + * j is an index in the netmap ring, l in the NIC ring. */ l = rxr->next_to_check; - j = netmap_ridx_n2k(na, ring_nr, l); - for (n = 0; ; n++) { - struct e1000_rx_desc *curr = &rxr->rx_base[l]; - - if ((curr->status & E1000_RXD_STAT_DD) == 0) - break; - ring->slot[j].len = le16toh(curr->length); - bus_dmamap_sync(rxr->rxtag, rxr->rx_buffers[l].map, - BUS_DMASYNC_POSTREAD); - j = (j == lim) ? 0 : j + 1; - /* make sure next_to_refresh follows next_to_check */ - rxr->next_to_refresh = l; // XXX - l = (l == lim) ? 0 : l + 1; - } - if (n) { - rxr->next_to_check = l; - kring->nr_hwavail += n; + j = netmap_idx_n2k(kring, l); + if (netmap_no_pendintr || force_update) { + for (n = 0; ; n++) { + struct e1000_rx_desc *curr = &rxr->rx_base[l]; + uint32_t staterr = le32toh(curr->status); + + if ((staterr & E1000_RXD_STAT_DD) == 0) + break; + ring->slot[j].len = le16toh(curr->length); + bus_dmamap_sync(rxr->rxtag, rxr->rx_buffers[l].map, + BUS_DMASYNC_POSTREAD); + j = (j == lim) ? 0 : j + 1; + /* make sure next_to_refresh follows next_to_check */ + rxr->next_to_refresh = l; // XXX + l = (l == lim) ? 0 : l + 1; + } + if (n) { /* update the state variables */ + rxr->next_to_check = l; + kring->nr_hwavail += n; + } + kring->nr_kflags &= ~NKR_PENDINTR; } - /* skip past packets that userspace has already processed */ + /* skip past packets that userspace has released */ j = kring->nr_hwcur; /* netmap ring index */ - if (j != k) { /* userspace has read some packets. */ - l = netmap_ridx_k2n(na, ring_nr, j); /* NIC ring index */ + if (resvd > 0) { + if (resvd + ring->avail >= lim + 1) { + D("XXX invalid reserve/avail %d %d", resvd, ring->avail); + ring->reserved = resvd = 0; // XXX panic... + } + k = (k >= resvd) ? k - resvd : k + lim + 1 - resvd; + } + if (j != k) { /* userspace has released some packets. */ + l = netmap_idx_k2n(kring, j); /* NIC ring index */ for (n = 0; j != k; n++) { struct netmap_slot *slot = &ring->slot[j]; struct e1000_rx_desc *curr = &rxr->rx_base[l]; @@ -352,17 +337,15 @@ em_netmap_rxsync(struct ifnet *ifp, u_in return netmap_ring_reinit(kring); } - curr->status = 0; if (slot->flags & NS_BUF_CHANGED) { curr->buffer_addr = htole64(paddr); /* buffer has changed, reload map */ netmap_reload_map(rxr->rxtag, rxbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } - + curr->status = 0; bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); - j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; } @@ -378,9 +361,29 @@ em_netmap_rxsync(struct ifnet *ifp, u_in E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), l); } /* tell userspace that there are new packets */ - ring->avail = kring->nr_hwavail ; + ring->avail = kring->nr_hwavail - resvd; if (do_lock) EM_RX_UNLOCK(rxr); return 0; } + + +static void +em_netmap_attach(struct adapter *adapter) +{ + struct netmap_adapter na; + + bzero(&na, sizeof(na)); + + na.ifp = adapter->ifp; + na.separate_locks = 1; + na.num_tx_desc = adapter->num_tx_desc; + na.num_rx_desc = adapter->num_rx_desc; + na.nm_txsync = em_netmap_txsync; + na.nm_rxsync = em_netmap_rxsync; + na.nm_lock = em_netmap_lock_wrapper; + na.nm_register = em_netmap_reg; + netmap_attach(&na, adapter->num_queues); +} + /* end of file */ Modified: head/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- head/sys/dev/netmap/if_igb_netmap.h Mon Feb 27 18:28:31 2012 (r232237) +++ head/sys/dev/netmap/if_igb_netmap.h Mon Feb 27 19:05:01 2012 (r232238) @@ -25,41 +25,19 @@ /* * $FreeBSD$ - * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $ + * $Id: if_igb_netmap.h 10627 2012-02-23 19:37:15Z luigi $ * - * netmap modifications for igb contributed by Ahmed Kooli + * Netmap support for igb, partly contributed by Ahmed Kooli + * For details on netmap support please see ixgbe_netmap.h */ + #include #include #include #include /* vtophys ? */ #include -static int igb_netmap_reg(struct ifnet *, int onoff); -static int igb_netmap_txsync(struct ifnet *, u_int, int); -static int igb_netmap_rxsync(struct ifnet *, u_int, int); -static void igb_netmap_lock_wrapper(struct ifnet *, int, u_int); - - -static void -igb_netmap_attach(struct adapter *adapter) -{ - struct netmap_adapter na; - - bzero(&na, sizeof(na)); - - na.ifp = adapter->ifp; - na.separate_locks = 1; - na.num_tx_desc = adapter->num_tx_desc; - na.num_rx_desc = adapter->num_rx_desc; - na.nm_txsync = igb_netmap_txsync; - na.nm_rxsync = igb_netmap_rxsync; - na.nm_lock = igb_netmap_lock_wrapper; - na.nm_register = igb_netmap_reg; - netmap_attach(&na, adapter->num_queues); -} - /* * wrapper to export locks to the generic code @@ -134,17 +112,17 @@ fail: /* - * Reconcile hardware and user view of the transmit ring. + * Reconcile kernel and user view of the transmit ring. */ static int igb_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock) { struct adapter *adapter = ifp->if_softc; struct tx_ring *txr = &adapter->tx_rings[ring_nr]; - struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; + u_int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; @@ -164,14 +142,16 @@ igb_netmap_txsync(struct ifnet *ifp, u_i * j == (l + kring->nkr_hwofs) % ring_size */ j = kring->nr_hwcur; - if (j != k) { /* we have packets to send */ + if (j != k) { /* we have new packets to send */ /* 82575 needs the queue index added */ u32 olinfo_status = (adapter->hw.mac.type == e1000_82575) ? (txr->me << 4) : 0; - l = netmap_tidx_k2n(na, ring_nr, j); + l = netmap_idx_k2n(kring, j); for (n = 0; j != k; n++) { + /* slot is the current slot in the netmap ring */ struct netmap_slot *slot = &ring->slot[j]; + /* curr is the current slot in the nic ring */ union e1000_adv_tx_desc *curr = (union e1000_adv_tx_desc *)&txr->tx_base[l]; struct igb_tx_buffer *txbuf = &txr->tx_buffers[l]; @@ -180,7 +160,7 @@ igb_netmap_txsync(struct ifnet *ifp, u_i E1000_ADVTXD_DCMD_RS : 0; uint64_t paddr; void *addr = PNMB(slot, &paddr); - int len = slot->len; + u_int len = slot->len; if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { if (do_lock) @@ -189,8 +169,13 @@ igb_netmap_txsync(struct ifnet *ifp, u_i } slot->flags &= ~NS_REPORT; - // XXX set the address unconditionally + if (slot->flags & NS_BUF_CHANGED) { + /* buffer has changed, reload map */ + netmap_reload_map(txr->txtag, txbuf->map, addr); + slot->flags &= ~NS_BUF_CHANGED; + } curr->read.buffer_addr = htole64(paddr); + // XXX check olinfo and cmd_type_len curr->read.olinfo_status = htole32(olinfo_status | (len<< E1000_ADVTXD_PAYLEN_SHIFT)); @@ -199,20 +184,13 @@ igb_netmap_txsync(struct ifnet *ifp, u_i E1000_ADVTXD_DCMD_IFCS | E1000_ADVTXD_DCMD_DEXT | E1000_ADVTXD_DCMD_EOP | flags); - if (slot->flags & NS_BUF_CHANGED) { - /* buffer has changed, reload map */ - netmap_reload_map(txr->txtag, txbuf->map, addr); - slot->flags &= ~NS_BUF_CHANGED; - } bus_dmamap_sync(txr->txtag, txbuf->map, BUS_DMASYNC_PREWRITE); j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; } - kring->nr_hwcur = k; - - /* decrease avail by number of sent packets */ + kring->nr_hwcur = k; /* the saved ring->cur */ kring->nr_hwavail -= n; /* Set the watchdog XXX ? */ @@ -243,7 +221,7 @@ igb_netmap_txsync(struct ifnet *ifp, u_i kring->nr_hwavail += delta; } } - /* update avail to what the hardware knows */ + /* update avail to what the kernel knows */ ring->avail = kring->nr_hwavail; if (do_lock) @@ -260,10 +238,12 @@ igb_netmap_rxsync(struct ifnet *ifp, u_i { struct adapter *adapter = ifp->if_softc; struct rx_ring *rxr = &adapter->rx_rings[ring_nr]; - struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, l, n, lim = kring->nkr_num_slots - 1; + u_int j, l, n, lim = kring->nkr_num_slots - 1; + int force_update = do_lock || kring->nr_kflags & NKR_PENDINTR; + u_int k = ring->cur, resvd = ring->reserved; k = ring->cur; if (k > lim) @@ -276,36 +256,43 @@ igb_netmap_rxsync(struct ifnet *ifp, u_i bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* import newly received packets into the netmap ring. - * j is an index in the netmap ring, l in the NIC ring, and - * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size - * l = rxr->next_to_check; - * and - * j == (l + kring->nkr_hwofs) % ring_size + /* + * import newly received packets into the netmap ring. + * j is an index in the netmap ring, l in the NIC ring. */ l = rxr->next_to_check; - j = netmap_ridx_n2k(na, ring_nr, l); - for (n = 0; ; n++) { - union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; - uint32_t staterr = le32toh(curr->wb.upper.status_error); - - if ((staterr & E1000_RXD_STAT_DD) == 0) - break; - ring->slot[j].len = le16toh(curr->wb.upper.length); - bus_dmamap_sync(rxr->ptag, - rxr->rx_buffers[l].pmap, BUS_DMASYNC_POSTREAD); - j = (j == lim) ? 0 : j + 1; - l = (l == lim) ? 0 : l + 1; - } - if (n) { - rxr->next_to_check = l; - kring->nr_hwavail += n; + j = netmap_idx_n2k(kring, l); + if (netmap_no_pendintr || force_update) { + for (n = 0; ; n++) { + union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; + uint32_t staterr = le32toh(curr->wb.upper.status_error); + + if ((staterr & E1000_RXD_STAT_DD) == 0) + break; + ring->slot[j].len = le16toh(curr->wb.upper.length); + bus_dmamap_sync(rxr->ptag, + rxr->rx_buffers[l].pmap, BUS_DMASYNC_POSTREAD); + j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; + } + if (n) { /* update the state variables */ + rxr->next_to_check = l; + kring->nr_hwavail += n; + } + kring->nr_kflags &= ~NKR_PENDINTR; } - /* skip past packets that userspace has already processed */ - j = kring->nr_hwcur; - if (j != k) { /* userspace has read some packets. */ - l = netmap_ridx_k2n(na, ring_nr, j); + /* skip past packets that userspace has released */ + j = kring->nr_hwcur; /* netmap ring index */ + if (resvd > 0) { + if (resvd + ring->avail >= lim + 1) { + D("XXX invalid reserve/avail %d %d", resvd, ring->avail); + ring->reserved = resvd = 0; // XXX panic... + } + k = (k >= resvd) ? k - resvd : k + lim + 1 - resvd; + } + if (j != k) { /* userspace has released some packets. */ + l = netmap_idx_k2n(kring, j); for (n = 0; j != k; n++) { struct netmap_slot *slot = ring->slot + j; union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; @@ -319,16 +306,14 @@ igb_netmap_rxsync(struct ifnet *ifp, u_i return netmap_ring_reinit(kring); } - curr->wb.upper.status_error = 0; - curr->read.pkt_addr = htole64(paddr); if (slot->flags & NS_BUF_CHANGED) { netmap_reload_map(rxr->ptag, rxbuf->pmap, addr); slot->flags &= ~NS_BUF_CHANGED; } - + curr->read.pkt_addr = htole64(paddr); + curr->wb.upper.status_error = 0; bus_dmamap_sync(rxr->ptag, rxbuf->pmap, BUS_DMASYNC_PREREAD); - j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; } @@ -344,9 +329,28 @@ igb_netmap_rxsync(struct ifnet *ifp, u_i E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), l); } /* tell userspace that there are new packets */ - ring->avail = kring->nr_hwavail ; + ring->avail = kring->nr_hwavail - resvd; if (do_lock) IGB_RX_UNLOCK(rxr); return 0; } + + +static void +igb_netmap_attach(struct adapter *adapter) +{ + struct netmap_adapter na; + + bzero(&na, sizeof(na)); + + na.ifp = adapter->ifp; + na.separate_locks = 1; + na.num_tx_desc = adapter->num_tx_desc; + na.num_rx_desc = adapter->num_rx_desc; + na.nm_txsync = igb_netmap_txsync; + na.nm_rxsync = igb_netmap_rxsync; + na.nm_lock = igb_netmap_lock_wrapper; + na.nm_register = igb_netmap_reg; + netmap_attach(&na, adapter->num_queues); +} /* end of file */ Modified: head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- head/sys/dev/netmap/if_lem_netmap.h Mon Feb 27 18:28:31 2012 (r232237) +++ head/sys/dev/netmap/if_lem_netmap.h Mon Feb 27 19:05:01 2012 (r232238) @@ -23,14 +23,14 @@ * SUCH DAMAGE. */ + /* * $FreeBSD$ - * $Id: if_lem_netmap.h 9802 2011-12-02 18:42:37Z luigi $ + * $Id: if_lem_netmap.h 10627 2012-02-23 19:37:15Z luigi $ * - * netmap support for if_lem.c + * netmap support for "lem" * - * For structure and details on the individual functions please see - * ixgbe_netmap.h + * For details on netmap support please see ixgbe_netmap.h */ #include @@ -39,30 +39,6 @@ #include /* vtophys ? */ #include -static int lem_netmap_reg(struct ifnet *, int onoff); -static int lem_netmap_txsync(struct ifnet *, u_int, int); -static int lem_netmap_rxsync(struct ifnet *, u_int, int); -static void lem_netmap_lock_wrapper(struct ifnet *, int, u_int); - - -static void -lem_netmap_attach(struct adapter *adapter) -{ - struct netmap_adapter na; - - bzero(&na, sizeof(na)); - - na.ifp = adapter->ifp; - na.separate_locks = 1; - na.num_tx_desc = adapter->num_tx_desc; - na.num_rx_desc = adapter->num_rx_desc; - na.nm_txsync = lem_netmap_txsync; - na.nm_rxsync = lem_netmap_rxsync; - na.nm_lock = lem_netmap_lock_wrapper; - na.nm_register = lem_netmap_reg; - netmap_attach(&na, 1); -} - static void lem_netmap_lock_wrapper(struct ifnet *ifp, int what, u_int ringid) @@ -94,7 +70,7 @@ lem_netmap_lock_wrapper(struct ifnet *if /* - * register-unregister routine + * Register/unregister */ static int lem_netmap_reg(struct ifnet *ifp, int onoff) @@ -104,7 +80,7 @@ lem_netmap_reg(struct ifnet *ifp, int on int error = 0; if (na == NULL) - return EINVAL; /* no netmap support here */ + return EINVAL; lem_disable_intr(adapter); @@ -144,20 +120,21 @@ fail: /* - * Reconcile hardware and user view of the transmit ring. + * Reconcile kernel and user view of the transmit ring. */ static int lem_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock) { struct adapter *adapter = ifp->if_softc; - struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; + u_int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; + /* take a copy of ring->cur now, and never read it again */ k = ring->cur; if (k > lim) return netmap_ring_reinit(kring); @@ -166,17 +143,17 @@ lem_netmap_txsync(struct ifnet *ifp, u_i EM_TX_LOCK(adapter); bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_POSTREAD); - - /* check for new packets to send. - * j indexes the netmap ring, l indexes the nic ring, and - * j = kring->nr_hwcur, l = E1000_TDT (not tracked), - * j == (l + kring->nkr_hwofs) % ring_size + /* + * Process new packets to send. j is the current index in the + * netmap ring, l is the corresponding index in the NIC ring. */ j = kring->nr_hwcur; - if (j != k) { /* we have packets to send */ - l = netmap_tidx_k2n(na, ring_nr, j); + if (j != k) { /* we have new packets to send */ + l = netmap_idx_k2n(kring, j); for (n = 0; j != k; n++) { + /* slot is the current slot in the netmap ring */ struct netmap_slot *slot = &ring->slot[j]; + /* curr is the current slot in the nic ring */ struct e1000_tx_desc *curr = &adapter->tx_desc_base[l]; struct em_buffer *txbuf = &adapter->tx_buffer_area[l]; int flags = ((slot->flags & NS_REPORT) || @@ -184,7 +161,7 @@ lem_netmap_txsync(struct ifnet *ifp, u_i E1000_TXD_CMD_RS : 0; uint64_t paddr; void *addr = PNMB(slot, &paddr); - int len = slot->len; + u_int len = slot->len; if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { if (do_lock) @@ -193,25 +170,23 @@ lem_netmap_txsync(struct ifnet *ifp, u_i } slot->flags &= ~NS_REPORT; - curr->upper.data = 0; - curr->lower.data = - htole32( adapter->txd_cmd | len | - (E1000_TXD_CMD_EOP | flags) ); if (slot->flags & NS_BUF_CHANGED) { - curr->buffer_addr = htole64(paddr); /* buffer has changed, reload map */ netmap_reload_map(adapter->txtag, txbuf->map, addr); + curr->buffer_addr = htole64(paddr); slot->flags &= ~NS_BUF_CHANGED; } + curr->upper.data = 0; + curr->lower.data = + htole32( adapter->txd_cmd | len | + (E1000_TXD_CMD_EOP | flags) ); bus_dmamap_sync(adapter->txtag, txbuf->map, BUS_DMASYNC_PREWRITE); j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; } - kring->nr_hwcur = k; - - /* decrease avail by number of sent packets */ + kring->nr_hwcur = k; /* the saved ring->cur */ kring->nr_hwavail -= n; bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, @@ -231,14 +206,14 @@ lem_netmap_txsync(struct ifnet *ifp, u_i } delta = l - adapter->next_tx_to_clean; if (delta) { - /* some completed, increment hwavail. */ + /* some tx completed, increment hwavail. */ if (delta < 0) delta += kring->nkr_num_slots; adapter->next_tx_to_clean = l; kring->nr_hwavail += delta; } } - /* update avail to what the hardware knows */ + /* update avail to what the kernel knows */ ring->avail = kring->nr_hwavail; if (do_lock) @@ -254,12 +229,13 @@ static int lem_netmap_rxsync(struct ifnet *ifp, u_int ring_nr, int do_lock) { struct adapter *adapter = ifp->if_softc; - struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, l, n, lim = kring->nkr_num_slots - 1; + int j, l, n, lim = kring->nkr_num_slots - 1; + int force_update = do_lock || kring->nr_kflags & NKR_PENDINTR; + u_int k = ring->cur, resvd = ring->reserved; - k = ring->cur; if (k > lim) return netmap_ring_reinit(kring); @@ -270,42 +246,50 @@ lem_netmap_rxsync(struct ifnet *ifp, u_i bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* import newly received packets into the netmap ring - * j is an index in the netmap ring, l in the NIC ring, and - * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size - * l = rxr->next_to_check; - * and - * j == (l + kring->nkr_hwofs) % ring_size + /* + * Import newly received packets into the netmap ring. + * j is an index in the netmap ring, l in the NIC ring. */ l = adapter->next_rx_desc_to_check; - j = netmap_ridx_n2k(na, ring_nr, l); - for (n = 0; ; n++) { - struct e1000_rx_desc *curr = &adapter->rx_desc_base[l]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 20:52:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3B3F106566B; Mon, 27 Feb 2012 20:52:20 +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 AF4238FC15; Mon, 27 Feb 2012 20:52:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RKqKjD036549; Mon, 27 Feb 2012 20:52:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RKqKnl036547; Mon, 27 Feb 2012 20:52:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202272052.q1RKqKnl036547@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 27 Feb 2012 20:52: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: r232239 - head/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: Mon, 27 Feb 2012 20:52:20 -0000 Author: kib Date: Mon Feb 27 20:52:20 2012 New Revision: 232239 URL: http://svn.freebsd.org/changeset/base/232239 Log: Fix a race in top non-interactive mode. Use plain sleep(3) call instead of arming timer and then pausing. If SIGALRM is delivered before pause(3) is entered, top hangs. Submitted by: Andrey Zonov MFC after: 1 week Modified: head/contrib/top/top.c Modified: head/contrib/top/top.c ============================================================================== --- head/contrib/top/top.c Mon Feb 27 19:05:01 2012 (r232238) +++ head/contrib/top/top.c Mon Feb 27 20:52:20 2012 (r232239) @@ -70,7 +70,6 @@ int pcpu_stats = No; /* signal handling routines */ sigret_t leave(); -sigret_t onalrm(); sigret_t tstop(); #ifdef SIGWINCH sigret_t winch(); @@ -723,12 +722,7 @@ restart: no_command = Yes; if (!interactive) { - /* set up alarm */ - (void) signal(SIGALRM, onalrm); - (void) alarm((unsigned)delay); - - /* wait for the rest of it .... */ - pause(); + sleep(delay); } else while (no_command) { @@ -1174,11 +1168,3 @@ int status; exit(status); /*NOTREACHED*/ } - -sigret_t onalrm() /* SIGALRM handler */ - -{ - /* this is only used in batch mode to break out of the pause() */ - /* return; */ -} - From owner-svn-src-all@FreeBSD.ORG Mon Feb 27 21:10:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96A0F106564A; Mon, 27 Feb 2012 21:10:11 +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 813948FC08; Mon, 27 Feb 2012 21:10:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1RLABqS037143; Mon, 27 Feb 2012 21:10:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1RLABjb037139; Mon, 27 Feb 2012 21:10:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202272110.q1RLABjb037139@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 27 Feb 2012 21:10: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: r232240 - 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: Mon, 27 Feb 2012 21:10:11 -0000 Author: kib Date: Mon Feb 27 21:10:10 2012 New Revision: 232240 URL: http://svn.freebsd.org/changeset/base/232240 Log: Currently, the debugger attached to the process executing vfork() does not get syscall exit notification until the child performed exec of exit. Swap the order of doing ptracestop() and waiting for P_PPWAIT clearing, by postponing the wait into syscallret after ptracestop() notification is done. Reported, tested and reviewed by: Dmitry Mikulin MFC after: 2 weeks Modified: head/sys/kern/kern_fork.c head/sys/kern/subr_syscall.c head/sys/sys/proc.h Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Mon Feb 27 20:52:20 2012 (r232239) +++ head/sys/kern/kern_fork.c Mon Feb 27 21:10:10 2012 (r232240) @@ -708,6 +708,10 @@ do_fork(struct thread *td, int flags, st _PHOLD(p2); p2_held = 1; } + if (flags & RFPPWAIT) { + td->td_pflags |= TDP_RFPPWAIT; + td->td_rfppwait_p = p2; + } PROC_UNLOCK(p2); if ((flags & RFSTOPPED) == 0) { /* @@ -740,14 +744,6 @@ do_fork(struct thread *td, int flags, st cv_wait(&p2->p_dbgwait, &p2->p_mtx); if (p2_held) _PRELE(p2); - - /* - * Preserve synchronization semantics of vfork. If waiting for - * child to exec or exit, set P_PPWAIT on child, and sleep on our - * proc (in case of exit). - */ - while (p2->p_flag & P_PPWAIT) - cv_wait(&p2->p_pwait, &p2->p_mtx); PROC_UNLOCK(p2); } Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Mon Feb 27 20:52:20 2012 (r232239) +++ head/sys/kern/subr_syscall.c Mon Feb 27 21:10:10 2012 (r232240) @@ -165,7 +165,7 @@ syscallenter(struct thread *td, struct s static inline void syscallret(struct thread *td, int error, struct syscall_args *sa __unused) { - struct proc *p; + struct proc *p, *p2; int traced; p = td->td_proc; @@ -223,4 +223,23 @@ syscallret(struct thread *td, int error, td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); PROC_UNLOCK(p); } + + if (td->td_pflags & TDP_RFPPWAIT) { + /* + * Preserve synchronization semantics of vfork. If + * waiting for child to exec or exit, fork set + * P_PPWAIT on child, and there we sleep on our proc + * (in case of exit). + * + * Do it after the ptracestop() above is finished, to + * not block our debugger until child execs or exits + * to finish vfork wait. + */ + td->td_pflags &= ~TDP_RFPPWAIT; + p2 = td->td_rfppwait_p; + PROC_LOCK(p2); + while (p2->p_flag & P_PPWAIT) + cv_wait(&p2->p_pwait, &p2->p_mtx); + PROC_UNLOCK(p2); + } } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Feb 27 20:52:20 2012 (r232239) +++ head/sys/sys/proc.h Mon Feb 27 21:10:10 2012 (r232240) @@ -311,6 +311,7 @@ struct thread { struct vnet *td_vnet; /* (k) Effective vnet. */ const char *td_vnet_lpush; /* (k) Debugging vnet push / pop. */ struct trapframe *td_intr_frame;/* (k) Frame of the current irq */ + struct proc *td_rfppwait_p; /* (k) The vforked child */ }; struct mtx *thread_lock_block(struct thread *); @@ -415,6 +416,7 @@ do { \ #define TDP_CALLCHAIN 0x00400000 /* Capture thread's callchain */ #define TDP_IGNSUSP 0x00800000 /* Permission to ignore the MNTK_SUSPEND* */ #define TDP_AUDITREC 0x01000000 /* Audit record pending on thread */ +#define TDP_RFPPWAIT 0x02000000 /* Handle RFPPWAIT on syscall exit */ /* * Reasons that the current thread can not be run yet. From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 00:29:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5052D1065675; Tue, 28 Feb 2012 00:29:55 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id C20D28FC19; Tue, 28 Feb 2012 00:29:54 +0000 (UTC) Received: by vcge1 with SMTP id e1so2698585vcg.13 for ; Mon, 27 Feb 2012 16:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=7EYLYo+0YeyDeP/fGfhjErYr56FUtvR19kjsG0wId0w=; b=ARWGQgPBh/G3Da/kCWGNdl/ktViX6DqCOiZMJX4eQanZTzwiXa7ePuep7X1/AAuJoC 3qERRZc2UBfLA/KrV9fD8hdzYVuy1mMFt54/aInmuuONID+WFxVCWVOxlm/8z286Ri4y A7ZOdO4jgX+nDbsbe2rMaCdiLSwc6JZElxiqw= MIME-Version: 1.0 Received: by 10.52.100.97 with SMTP id ex1mr4528418vdb.127.1330387545257; Mon, 27 Feb 2012 16:05:45 -0800 (PST) Received: by 10.52.29.236 with HTTP; Mon, 27 Feb 2012 16:05:45 -0800 (PST) In-Reply-To: <201202271905.q1RJ52Se032771@svn.freebsd.org> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> Date: Mon, 27 Feb 2012 19:05:45 -0500 Message-ID: From: Ben Kaduk To: Luigi Rizzo 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: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 00:29:55 -0000 On Mon, Feb 27, 2012 at 2:05 PM, Luigi Rizzo wrote: > Author: luigi > Date: Mon Feb 27 19:05:01 2012 > New Revision: 232238 > URL: http://svn.freebsd.org/changeset/base/232238 > > Log: > =A0A bunch of netmap fixes: > > =A0USERSPACE: > =A01. add support for devices with different number of rx and tx queues; > > =A02. add better support for zero-copy operation, adding an extra field > =A0 =A0 to the netmap ring to indicate how many buffers we have already p= rocessed > =A0 =A0 but not yet released (with help from Eddie Kohler); > > =A03. The two changes above unfortunately require an API change, so while > =A0 =A0 at it add a version field and some spares to the ioctl() argument > =A0 =A0 to help detect mismatches. Is it worth bumping __FreeBSD_version? -Ben Kaduk From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 02:59:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26994106564A; Tue, 28 Feb 2012 02:59:05 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0DAC88FC0C; Tue, 28 Feb 2012 02:59:05 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1S2x2ZC085097; Tue, 28 Feb 2012 02:59:03 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4F4C42F5.2070006@gmail.com> Date: Tue, 28 Feb 2012 10:59:01 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Ivan Voras References: <201202271338.q1RDcqEQ020033@svn.freebsd.org> In-Reply-To: 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, David Xu Subject: Re: svn commit: r232209 - in head: lib/libthr/thread sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: "SVN commit messages 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, 28 Feb 2012 02:59:05 -0000 On 2012/2/27 22:29, Ivan Voras wrote: > On 27 February 2012 14:38, David Xu wrote: >> Author: davidxu >> Date: Mon Feb 27 13:38:52 2012 >> New Revision: 232209 >> URL: http://svn.freebsd.org/changeset/base/232209 >> >> Log: >> Follow changes made in revision 232144, pass absolute timeout to kernel, >> this eliminates a clock_gettime() syscall. > Any chance of a MFC? > > I use rwlocks a lot; removing a syscall from all operations looks like > a nice improvement. > Yes, I will do a MFC when it is ready. ;-) From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 03:11:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7634F106564A; Tue, 28 Feb 2012 03:11:03 +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 61FFF8FC0C; Tue, 28 Feb 2012 03:11:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1S3B3M4049211; Tue, 28 Feb 2012 03:11:03 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1S3B3RT049208; Tue, 28 Feb 2012 03:11:03 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201202280311.q1S3B3RT049208@svn.freebsd.org> From: Glen Barber Date: Tue, 28 Feb 2012 03:11: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: r232243 - 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: Tue, 28 Feb 2012 03:11:03 -0000 Author: gjb (doc committer) Date: Tue Feb 28 03:11:02 2012 New Revision: 232243 URL: http://svn.freebsd.org/changeset/base/232243 Log: Fix a few rendering nits in rc.conf(5) with regards to mentioning jail_parallel_enable. Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Mon Feb 27 22:37:35 2012 (r232242) +++ head/share/man/man5/rc.conf.5 Tue Feb 28 03:11:02 2012 (r232243) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd February 27, 2012 .Dt RC.CONF 5 .Os .Sh NAME @@ -3754,11 +3754,11 @@ indicates that the highest frequency (le If set to .Dq Li NO , any configured jails will not be started. -.It jail_parallel_start +.It Va jail_parallel_start .Pq Vt bool If set to -.Dq Li YES -all configured jails will be started in the background (= in parallel). +.Dq Li YES , +all configured jails will be started in the background (in parallel). .It Va jail_list .Pq Vt str A space separated list of names for jails. From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 04:05:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2B25106564A; Tue, 28 Feb 2012 04:05:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DA968FC0A; Tue, 28 Feb 2012 04:05:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1S45atj050905; Tue, 28 Feb 2012 04:05:36 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1S45ah5050902; Tue, 28 Feb 2012 04:05:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202280405.q1S45ah5050902@svn.freebsd.org> From: Adrian Chadd Date: Tue, 28 Feb 2012 04:05: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: r232244 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 04:05:36 -0000 Author: adrian Date: Tue Feb 28 04:05:35 2012 New Revision: 232244 URL: http://svn.freebsd.org/changeset/base/232244 Log: Track the number of bad beacons received. PR: kern/165517 Modified: head/sys/net80211/ieee80211_ioctl.h head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_ioctl.h ============================================================================== --- head/sys/net80211/ieee80211_ioctl.h Tue Feb 28 03:11:02 2012 (r232243) +++ head/sys/net80211/ieee80211_ioctl.h Tue Feb 28 04:05:35 2012 (r232244) @@ -241,8 +241,9 @@ struct ieee80211_stats { uint32_t is_mesh_notproxy; /* dropped 'cuz not proxying */ uint32_t is_rx_badalign; /* dropped 'cuz misaligned */ uint32_t is_hwmp_proxy; /* PREP for proxy route */ + uint32_t is_beacon_bad; /* Number of bad beacons */ - uint32_t is_spare[11]; + uint32_t is_spare[10]; }; /* Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Tue Feb 28 03:11:02 2012 (r232243) +++ head/sys/net80211/ieee80211_sta.c Tue Feb 28 04:05:35 2012 (r232244) @@ -1305,8 +1305,10 @@ sta_recv_mgmt(struct ieee80211_node *ni, return; } /* XXX probe response in sta mode when !scanning? */ - if (ieee80211_parse_beacon(ni, m0, &scan) != 0) + if (ieee80211_parse_beacon(ni, m0, &scan) != 0) { + vap->iv_stats.is_beacon_bad++; return; + } /* * Count frame now that we know it's to be processed. */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 04:06:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7ABA5106564A; Tue, 28 Feb 2012 04:06:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 653EF8FC1C; Tue, 28 Feb 2012 04:06:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1S46hK0050976; Tue, 28 Feb 2012 04:06:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1S46hUD050974; Tue, 28 Feb 2012 04:06:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202280406.q1S46hUD050974@svn.freebsd.org> From: Adrian Chadd Date: Tue, 28 Feb 2012 04:06: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: r232245 - head/tools/tools/net80211/wlanstats X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 04:06:43 -0000 Author: adrian Date: Tue Feb 28 04:06:42 2012 New Revision: 232245 URL: http://svn.freebsd.org/changeset/base/232245 Log: Add is_beacon_bad. PR: kern/165517 Modified: head/tools/tools/net80211/wlanstats/wlanstats.c Modified: head/tools/tools/net80211/wlanstats/wlanstats.c ============================================================================== --- head/tools/tools/net80211/wlanstats/wlanstats.c Tue Feb 28 04:05:35 2012 (r232244) +++ head/tools/tools/net80211/wlanstats/wlanstats.c Tue Feb 28 04:06:42 2012 (r232245) @@ -370,6 +370,8 @@ static const struct fmt wlanstats[] = { { 5, "noise", "noise", "current noise floor (dBm)" }, #define S_SIGNAL AFTER(S_NOISE) { 5, "signal", "sig", "current signal (dBm)" }, +#define S_BEACON_BAD AFTER(S_SIGNAL) + { 9, "beacon_bad", "beaconbad", "bad beacons received" }, }; struct wlanstatfoo_p { @@ -814,6 +816,7 @@ wlan_get_curstat(struct statfoo *sf, int case S_RX_MCAST: NSTAT(rx_mcast); case S_TX_UCAST: NSTAT(tx_ucast); case S_TX_MCAST: NSTAT(tx_mcast); + case S_BEACON_BAD: STAT(beacon_bad); } return wlan_getinfo(wf, s, b, bs); #undef NSTAT @@ -972,6 +975,7 @@ wlan_get_totstat(struct statfoo *sf, int case S_RX_MCAST: NSTAT(rx_mcast); case S_TX_UCAST: NSTAT(tx_ucast); case S_TX_MCAST: NSTAT(tx_mcast); + case S_BEACON_BAD: STAT(beacon_bad); } return wlan_getinfo(wf, s, b, bs); #undef NSTAT From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 05:23:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F3BF1065674; Tue, 28 Feb 2012 05:23: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 19D2E8FC0C; Tue, 28 Feb 2012 05:23:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1S5NT3o053427; Tue, 28 Feb 2012 05:23:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1S5NTak053424; Tue, 28 Feb 2012 05:23:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202280523.q1S5NTak053424@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 28 Feb 2012 05:23: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: r232246 - in head/sys/dev: mii re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 05:23:30 -0000 Author: yongari Date: Tue Feb 28 05:23:29 2012 New Revision: 232246 URL: http://svn.freebsd.org/changeset/base/232246 Log: Prefer RL_GMEDIASTAT register to RGEPHY_MII_SSR register to extract a link status of PHY when parent driver is re(4). RGEPHY_MII_SSR register does not seem to report correct PHY status on some integrated PHYs used with re(4). Unfortunately, RealTek PHYs have no additional information to differentiate integrated PHYs from external ones so relying on PHY model number is not enough to know that. However, it seems RGEPHY_MII_SSR register exists for external RealTek PHYs so checking parent driver would be good indication to know which PHY was used. In other words, for non-re(4) controllers, the PHY is external one and its revision number is greater than or equal to 2. This change fixes intermittent link UP/DOWN messages reported on RTL8169 controller. Also, mii_attach(9) is tried after setting interface name since rgephy(4) have to know parent driver name. PR: kern/165509 Modified: head/sys/dev/mii/rgephy.c head/sys/dev/re/if_re.c Modified: head/sys/dev/mii/rgephy.c ============================================================================== --- head/sys/dev/mii/rgephy.c Tue Feb 28 04:06:42 2012 (r232245) +++ head/sys/dev/mii/rgephy.c Tue Feb 28 05:23:29 2012 (r232246) @@ -110,10 +110,15 @@ static int rgephy_attach(device_t dev) { struct mii_softc *sc; + struct mii_attach_args *ma; + u_int flags; sc = device_get_softc(dev); - - mii_phy_dev_attach(dev, 0, &rgephy_funcs, 0); + ma = device_get_ivars(dev); + flags = 0; + if (strcmp(ma->mii_data->mii_ifp->if_dname, "re") == 0) + flags |= MIIF_PHYPRIV0; + mii_phy_dev_attach(dev, flags, &rgephy_funcs, 0); /* RTL8169S do not report auto-sense; add manually. */ sc->mii_capabilities = (PHY_READ(sc, MII_BMSR) | BMSR_ANEG) & @@ -243,7 +248,8 @@ setit: * Check to see if we have link. If we do, we don't * need to restart the autonegotiation process. */ - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && + sc->mii_mpd_rev >= 2) { /* RTL8211B(L) */ reg = PHY_READ(sc, RGEPHY_MII_SSR); if (reg & RGEPHY_SSR_LINK) { @@ -298,7 +304,7 @@ rgephy_status(struct mii_softc *sc) mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) { ssr = PHY_READ(sc, RGEPHY_MII_SSR); if (ssr & RGEPHY_SSR_LINK) mii->mii_media_status |= IFM_ACTIVE; @@ -328,7 +334,7 @@ rgephy_status(struct mii_softc *sc) } } - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) { ssr = PHY_READ(sc, RGEPHY_MII_SSR); switch (ssr & RGEPHY_SSR_SPD_MASK) { case RGEPHY_SSR_S1000: @@ -484,7 +490,7 @@ rgephy_reset(struct mii_softc *sc) { uint16_t ssr; - if (sc->mii_mpd_rev == 3) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev == 3) { /* RTL8211C(L) */ ssr = PHY_READ(sc, RGEPHY_MII_SSR); if ((ssr & RGEPHY_SSR_ALDPS) != 0) { Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Tue Feb 28 04:06:42 2012 (r232245) +++ head/sys/dev/re/if_re.c Tue Feb 28 05:23:29 2012 (r232246) @@ -1577,19 +1577,6 @@ re_attach(device_t dev) re_gmii_writereg(dev, 1, 0x0e, 0); } -#define RE_PHYAD_INTERNAL 0 - - /* Do MII setup. */ - phy = RE_PHYAD_INTERNAL; - if (sc->rl_type == RL_8169) - phy = 1; - error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd, - re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); - if (error != 0) { - device_printf(dev, "attaching PHYs failed\n"); - goto fail; - } - ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -1614,6 +1601,19 @@ re_attach(device_t dev) TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc); +#define RE_PHYAD_INTERNAL 0 + + /* Do MII setup. */ + phy = RE_PHYAD_INTERNAL; + if (sc->rl_type == RL_8169) + phy = 1; + error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd, + re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + goto fail; + } + /* * Call MI attach routine. */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 05:48:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5AD21065670 for ; Tue, 28 Feb 2012 05:48:16 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3168B8FC0C for ; Tue, 28 Feb 2012 05:48:15 +0000 (UTC) Received: by bkcjc3 with SMTP id jc3so2299790bkc.13 for ; Mon, 27 Feb 2012 21:48:15 -0800 (PST) Received-SPF: pass (google.com: domain of andrey@zonov.org designates 10.204.153.215 as permitted sender) client-ip=10.204.153.215; Authentication-Results: mr.google.com; spf=pass (google.com: domain of andrey@zonov.org designates 10.204.153.215 as permitted sender) smtp.mail=andrey@zonov.org Received: from mr.google.com ([10.204.153.215]) by 10.204.153.215 with SMTP id l23mr3552423bkw.11.1330408095043 (num_hops = 1); Mon, 27 Feb 2012 21:48:15 -0800 (PST) Received: by 10.204.153.215 with SMTP id l23mr2805074bkw.11.1330408094834; Mon, 27 Feb 2012 21:48:14 -0800 (PST) Received: from [10.254.254.77] (ppp109-252-213-87.pppoe.spdop.ru. [109.252.213.87]) by mx.google.com with ESMTPS id t17sm28888718bke.6.2012.02.27.21.48.13 (version=SSLv3 cipher=OTHER); Mon, 27 Feb 2012 21:48:14 -0800 (PST) Message-ID: <4F4C6A9D.9060508@zonov.org> Date: Tue, 28 Feb 2012 09:48:13 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Konstantin Belousov References: <201202272052.q1RKqKnl036547@svn.freebsd.org> In-Reply-To: <201202272052.q1RKqKnl036547@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQk+dXBdm9XdQBRocI1sJ75syOm9oklS4P2xHVYcyNv8JVlUvwxc4U7syOV9QiqhF6blL3nW Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232239 - head/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: Tue, 28 Feb 2012 05:48:17 -0000 On 28.02.2012 0:52, Konstantin Belousov wrote: > Author: kib > Date: Mon Feb 27 20:52:20 2012 > New Revision: 232239 > URL: http://svn.freebsd.org/changeset/base/232239 > > Log: > Fix a race in top non-interactive mode. Use plain sleep(3) call instead > of arming timer and then pausing. If SIGALRM is delivered before pause(3) > is entered, top hangs. > > Submitted by: Andrey Zonov > MFC after: 1 week > > Modified: > head/contrib/top/top.c > Thanks a lot! -- Andrey Zonov From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 06:30:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F725106566B; Tue, 28 Feb 2012 06:30:05 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id DF73B8FC13; Tue, 28 Feb 2012 06:30:04 +0000 (UTC) Received: from julian-mac.elischer.org (c-67-180-24-15.hsd1.ca.comcast.net [67.180.24.15]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id q1S6U1YJ098762 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 27 Feb 2012 22:30:03 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4F4C746D.3040005@freebsd.org> Date: Mon, 27 Feb 2012 22:30:05 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> In-Reply-To: <20120227082811.GC1363@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Mikolaj Golub , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232181 - 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: Tue, 28 Feb 2012 06:30:05 -0000 On 2/27/12 12:28 AM, Pawel Jakub Dawidek wrote: > On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: >> Author: trociny >> Date: Sun Feb 26 14:25:48 2012 >> New Revision: 232181 >> URL: http://svn.freebsd.org/changeset/base/232181 >> >> Log: >> Add sysctl to retrieve or set umask of another process. > "set umask of another process"? This seems... weird. What's the purpose > of this change? I also wondered on seeing this.. who was it discussed with, and what usage makes this a requirement? Julian From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 06:34:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E93D106564A; Tue, 28 Feb 2012 06:34:24 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 18E398FC12; Tue, 28 Feb 2012 06:34:23 +0000 (UTC) Received: from julian-mac.elischer.org (c-67-180-24-15.hsd1.ca.comcast.net [67.180.24.15]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id q1S6YLPa098788 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 27 Feb 2012 22:34:23 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4F4C7571.7010407@freebsd.org> Date: Mon, 27 Feb 2012 22:34:25 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19 MIME-Version: 1.0 To: Konstantin Belousov References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> In-Reply-To: <20120227092951.GB55074@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Mikolaj Golub , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r232181 - 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: Tue, 28 Feb 2012 06:34:24 -0000 On 2/27/12 1:29 AM, Konstantin Belousov wrote: > On Mon, Feb 27, 2012 at 10:49:59AM +0200, Mikolaj Golub wrote: >> On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote: >> >> PJD> On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: >> >> Author: trociny >> >> Date: Sun Feb 26 14:25:48 2012 >> >> New Revision: 232181 >> >> URL: http://svn.freebsd.org/changeset/base/232181 >> >> >> >> Log: >> >> Add sysctl to retrieve or set umask of another process. >> >> PJD> "set umask of another process"? This seems... weird. What's the purpose >> PJD> of this change? >> >> When we were discussing this with Kostik and Robert, and I asked if it could >> be useful to have the sysctl rw, Kostik described a real situation when he had >> had to change umask of another process: umask had not been set properly on an >> aplication start but it could not be restarted until the end of the day. >> Kostik was able to fix it using gdb but having an easier way looked useful. > kgdb, not gdb. > > It is indeed possible to write a ptrace-based utility that inject a code > payload that would change umask. Since this is very risky but indeed possible, > having the straighforward kernel facility is justified. Why not have a sysctl to change a process' uid, cwd, memory limits, etc. etc. I don't think this belongs in the kernel by default. It's not exactl a call for backout but It's teh next thing short of that. a call for "do you REALLY think we need this particular specific case catered for?" Julian > Patch puts the same restrictions on the caller as ptrace(). From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 07:13:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1024106566B; Tue, 28 Feb 2012 07:13:12 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 578268FC08; Tue, 28 Feb 2012 07:13:11 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id EB4A67300A; Tue, 28 Feb 2012 08:31:22 +0100 (CET) Date: Tue, 28 Feb 2012 08:31:22 +0100 From: Luigi Rizzo To: Ben Kaduk Message-ID: <20120228073122.GC57270@onelab2.iet.unipi.it> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 07:13:12 -0000 On Mon, Feb 27, 2012 at 07:05:45PM -0500, Ben Kaduk wrote: ... > > ?1. add support for devices with different number of rx and tx queues; > > > > ?2. add better support for zero-copy operation, adding an extra field > > ? ? to the netmap ring to indicate how many buffers we have already processed > > ? ? but not yet released (with help from Eddie Kohler); > > > > ?3. The two changes above unfortunately require an API change, so while > > ? ? at it add a version field and some spares to the ioctl() argument > > ? ? to help detect mismatches. > > Is it worth bumping __FreeBSD_version? I don't think it is necessary. There is basically no code that uses the netmap API except for the examples in tools/tools/netmap, and i now have a NETMAP_API macro that defines the version without the need for using __FreeBSD_version cheers luigi From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 07:29:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 959DA1065674; Tue, 28 Feb 2012 07:29:32 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6C85B8FC1E; Tue, 28 Feb 2012 07:29:30 +0000 (UTC) Received: by eaan10 with SMTP id n10so2489268eaa.13 for ; Mon, 27 Feb 2012 23:29:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=b2FsuzvHI91fpXhjFufDCwual+IkgsUDJUlv+GGb7oI=; b=i6lfPwkjpjRcZbRRGPECWOd9N/RvalPp60QFQEYSHBZS8aTC0xfwU/PykoUtScbB/A LWLDocF/sJpqDZ4d4MkfiAo1Pht5WrhShS6BTlsdJELZ631yeJNveR6LlTWX1xZxbUc0 v13wH/DJrRIQDLUzLEolTEijiEqnmpU2bfuXw= Received: by 10.213.6.209 with SMTP id a17mr3995519eba.137.1330414170127; Mon, 27 Feb 2012 23:29:30 -0800 (PST) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id v51sm67407936eef.2.2012.02.27.23.29.28 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 23:29:29 -0800 (PST) From: Mikolaj Golub To: Julian Elischer Organization: TOA Ukraine References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org> Sender: Mikolaj Golub Date: Tue, 28 Feb 2012 09:29:26 +0200 In-Reply-To: <4F4C7571.7010407@freebsd.org> (Julian Elischer's message of "Mon, 27 Feb 2012 22:34:25 -0800") Message-ID: <86zkc3bell.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Robert Watson , Konstantin Belousov Subject: Re: svn commit: r232181 - 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: Tue, 28 Feb 2012 07:29:32 -0000 On Mon, 27 Feb 2012 22:34:25 -0800 Julian Elischer wrote: JE> On 2/27/12 1:29 AM, Konstantin Belousov wrote: >> On Mon, Feb 27, 2012 at 10:49:59AM +0200, Mikolaj Golub wrote: >>> On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote: >>> >>> PJD> On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: >>> >> Author: trociny >>> >> Date: Sun Feb 26 14:25:48 2012 >>> >> New Revision: 232181 >>> >> URL: http://svn.freebsd.org/changeset/base/232181 >>> >> >>> >> Log: >>> >> Add sysctl to retrieve or set umask of another process. >>> >>> PJD> "set umask of another process"? This seems... weird. What's the purpose >>> PJD> of this change? >>> >>> When we were discussing this with Kostik and Robert, and I asked if it could >>> be useful to have the sysctl rw, Kostik described a real situation when he had >>> had to change umask of another process: umask had not been set properly on an >>> aplication start but it could not be restarted until the end of the day. >>> Kostik was able to fix it using gdb but having an easier way looked useful. >> kgdb, not gdb. >> >> It is indeed possible to write a ptrace-based utility that inject a code >> payload that would change umask. Since this is very risky but indeed possible, >> having the straighforward kernel facility is justified. JE> Why not have a sysctl to change a process' uid, cwd, memory limits, JE> etc. etc. We already can change limits. Ability to change cwd and may be uid I think could be useful too. This not necessary should be a sysctl though. JE> I don't think this belongs in the kernel by default. It's not exactl a JE> call for backout but It's teh next thing short of that. a call for "do JE> you REALLY think we need this particular specific case catered for?" The main goal of the patch was to provide ability to get another process umask. It looks like usefulness of this is not questioned here. When ways to do this were discussed with Kostik and Robert options to extend kinfo_proc or add another sysctl were considered. Adding a new sysctl won because it does not break ABI, may be controlled by p_candebug() and actually kinfo_proc did not look like a right place for umask. So when it was decided to make a new sysctl the question arose if it should be RW or RO. Making it RW was just a matter of couple lines, and as there were cases when this could be useful why not? I should mention that Robert was not very happy with having this RW but did not object strongly. Sorry, it was my mistake I did not discuss this in public before committing. Will do the next time. Although I still think it is a useful thing. I don't think it is bad to have debugging tools that provide ability to control another process without tricks with kgdb or code injection. -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 07:35:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64CA3106564A; Tue, 28 Feb 2012 07:35:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3718E8FC1E; Tue, 28 Feb 2012 07:35:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1S7Z8G7057943; Tue, 28 Feb 2012 07:35:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1S7Z8VT057940; Tue, 28 Feb 2012 07:35:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201202280735.q1S7Z8VT057940@svn.freebsd.org> From: Martin Matuska Date: Tue, 28 Feb 2012 07:35: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: r232247 - in head: share/man/man5 usr.sbin/jail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 07:35:08 -0000 Author: mm Date: Tue Feb 28 07:35:07 2012 New Revision: 232247 URL: http://svn.freebsd.org/changeset/base/232247 Log: mdoc(7) stype - start new sentences on new line MFC after: 1 week Modified: head/share/man/man5/devfs.5 head/usr.sbin/jail/jail.8 Modified: head/share/man/man5/devfs.5 ============================================================================== --- head/share/man/man5/devfs.5 Tue Feb 28 05:23:29 2012 (r232246) +++ head/share/man/man5/devfs.5 Tue Feb 28 07:35:07 2012 (r232247) @@ -103,12 +103,13 @@ The following devfs file system-specific .It Cm ruleset Ns No = Ns Ar ruleset Set ruleset number .Ar ruleset -as the current ruleset for the mount-point and apply all its rules. If the -ruleset number +as the current ruleset for the mount-point and apply all its rules. +If the ruleset number .Ar ruleset does not exist, an empty ruleset with the number .Ar ruleset -is created. See +is created. +See .Xr devfs 8 for more information on working with devfs rulesets. .El Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Tue Feb 28 05:23:29 2012 (r232246) +++ head/usr.sbin/jail/jail.8 Tue Feb 28 07:35:07 2012 (r232247) @@ -303,16 +303,17 @@ If the system securelevel is changed, an least as secure. .It Va devfs_ruleset The number of the devfs ruleset that is enforced for mounting devfs in -this jail. A value of zero (default) means no ruleset is enforced. Descendant -jails inherit the parent jail's devfs ruleset enforcement. Mounting devfs -inside a jail is possible only if the +this jail. +A value of zero (default) means no ruleset is enforced. +Descendant jails inherit the parent jail's devfs ruleset enforcement. +Mounting devfs inside a jail is possible only if the .Va allow.mount and .Va allow.mount.devfs permissions are effective and .Va enforce_statfs -is set to a value lower than 2. Devfs rules and rulesets cannot be viewed or -modified from inside a jail. +is set to a value lower than 2. +Devfs rules and rulesets cannot be viewed or modified from inside a jail. .It Va children.max The number of child jails allowed to be created by this jail (or by other jails under this jail). @@ -415,8 +416,8 @@ This permission is effective only togeth .Va allow.mount and if .Va enforce_statfs -is set to a value lower than 2. Please consider restricting the devfs ruleset -with the +is set to a value lower than 2. +Please consider restricting the devfs ruleset with the .Va devfs_ruleset option. .It Va allow.mount.nullfs @@ -434,7 +435,8 @@ This permission is effective only togeth .Va allow.mount and if .Va enforce_statfs -is set to a value lower than 2. See +is set to a value lower than 2. +See .Xr zfs 8 for information on how to configure the ZFS filesystem to operate from within a jail. From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 11:06:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 827E01065673; Tue, 28 Feb 2012 11:06:52 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BC818FC1B; Tue, 28 Feb 2012 11:06:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SB6q80067937; Tue, 28 Feb 2012 11:06:52 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SB6qR2067935; Tue, 28 Feb 2012 11:06:52 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202281106.q1SB6qR2067935@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 28 Feb 2012 11:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232249 - 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: Tue, 28 Feb 2012 11:06:52 -0000 Author: pluknet Date: Tue Feb 28 11:06:52 2012 New Revision: 232249 URL: http://svn.freebsd.org/changeset/base/232249 Log: Add lib32 part after libarchive 3.0.3 update. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Feb 28 08:36:38 2012 (r232248) +++ head/ObsoleteFiles.inc Tue Feb 28 11:06:52 2012 (r232249) @@ -56,6 +56,9 @@ OLD_FILES+=man/man3/archive_read_data_in man/man3/archive_write_set_compression_none.3.gz \ man/man3/archive_write_set_compression_program.3.gz OLD_LIBS+=usr/lib/libarchive.so.5 +.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" +OLD_LIBS+=usr/lib32/libarchive.so.5 +.endif # 20120113: removal of wtmpcvt(1) OLD_FILES+=usr/bin/wtmpcvt OLD_FILES+=usr/share/man/man1/wtmpcvt.1.gz From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 13:19:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1A2A106564A; Tue, 28 Feb 2012 13:19: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 DE8558FC0A; Tue, 28 Feb 2012 13:19:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SDJYLC072346; Tue, 28 Feb 2012 13:19:34 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SDJYiH072336; Tue, 28 Feb 2012 13:19:34 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201202281319.q1SDJYiH072336@svn.freebsd.org> From: Gavin Atkinson Date: Tue, 28 Feb 2012 13:19: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: r232250 - in head: sbin/ifconfig sbin/ipfw share/man/man4 sys/conf sys/dev/ath sys/dev/siba sys/ia64/ia64 sys/mips/rt305x X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 13:19:35 -0000 Author: gavin Date: Tue Feb 28 13:19:34 2012 New Revision: 232250 URL: http://svn.freebsd.org/changeset/base/232250 Log: Correct capitalization of "Hz" in user-visible text (manpages, printf(), etc). MFC after: 3 days Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ipfw/ipfw.8 head/share/man/man4/ath.4 head/share/man/man4/net80211.4 head/sys/conf/NOTES head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/siba/siba_core.c head/sys/ia64/ia64/machdep.c head/sys/mips/rt305x/rt305x_sysctl.c Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Tue Feb 28 11:06:52 2012 (r232249) +++ head/sbin/ifconfig/ifconfig.8 Tue Feb 28 13:19:34 2012 (r232250) @@ -1036,7 +1036,7 @@ Enable Dynamic Frequency Selection (DFS) DFS embodies several facilities including detection of overlapping radar signals, dynamic transmit power control, and channel selection according to a least-congested criteria. -DFS support is mandatory for some 5Ghz frequencies in certain +DFS support is mandatory for some 5GHz frequencies in certain locales (e.g. ETSI). By default DFS is enabled according to the regulatory definitions specified in /etc/regdomain.xml and the current country code, regdomain, @@ -1091,7 +1091,7 @@ By default DTIM is 1 (i.e., DTIM occurs .It Cm quiet Enable the use of quiet IE. Hostap will use this to silent other stations to reduce interference for radar detection when -operating on 5Ghz frequency and doth support is enabled. +operating on 5GHz frequency and doth support is enabled. Use .Fl quiet to disable this functionality. Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Tue Feb 28 11:06:52 2012 (r232249) +++ head/sbin/ipfw/ipfw.8 Tue Feb 28 13:19:34 2012 (r232250) @@ -2235,7 +2235,7 @@ specifies the scheduling algorithm to us is just a FIFO scheduler (which means that all packets are stored in the same queue as they arrive to the scheduler). FIFO has O(1) per-packet time complexity, with very low -constants (estimate 60-80ns on a 2Ghz desktop machine) +constants (estimate 60-80ns on a 2GHz desktop machine) but gives no service guarantees. .It Cm wf2qp implements the WF2Q+ algorithm, which is a Weighted Fair Queueing Modified: head/share/man/man4/ath.4 ============================================================================== --- head/share/man/man4/ath.4 Tue Feb 28 11:06:52 2012 (r232249) +++ head/share/man/man4/ath.4 Tue Feb 28 13:19:34 2012 (r232250) @@ -95,8 +95,8 @@ with transmit speeds appropriate to each AR5416-class devices are capable of 802.11n operation but are supported only in legacy modes (802.11a, 11b, 11g). Most chips also support an Atheros Turbo Mode (TM) that operates in -the 5Ghz frequency range with 2x the transmit speeds. -Some chips also support Turbo mode in the 2.4Ghz range with 802.11g +the 5GHz frequency range with 2x the transmit speeds. +Some chips also support Turbo mode in the 2.4GHz range with 802.11g though this support is not presently available due to regulatory requirements. (Note that Turbo modes are, however, only interoperable with other Atheros-based devices.) Modified: head/share/man/man4/net80211.4 ============================================================================== --- head/share/man/man4/net80211.4 Tue Feb 28 11:06:52 2012 (r232249) +++ head/share/man/man4/net80211.4 Tue Feb 28 13:19:34 2012 (r232250) @@ -280,7 +280,7 @@ Return whether or not Dynamic Frequency DFS embodies several facilities including detection of overlapping radar signals, dynamic transmit power control, and channel selection according to a least-congested criteria. -DFS support is mandatory for some 5Ghz frequencies in certain +DFS support is mandatory for some 5GHz frequencies in certain locales (e.g. ETSI). By default DFS is enabled according to the regulatory definitions and the current country code, regdomain, and channel. Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Tue Feb 28 11:06:52 2012 (r232249) +++ head/sys/conf/NOTES Tue Feb 28 13:19:34 2012 (r232250) @@ -2417,11 +2417,11 @@ device cmx # or # options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC # Specifies the default video capture mode. -# This is required for Dual Crystal (28&35Mhz) boards where PAL is used +# This is required for Dual Crystal (28&35MHz) boards where PAL is used # to prevent hangs during initialization, e.g. VideoLogic Captivator PCI. # # options BKTR_USE_PLL -# This is required for PAL or SECAM boards with a 28Mhz crystal and no 35Mhz +# This is required for PAL or SECAM boards with a 28MHz crystal and no 35MHz # crystal, e.g. some new Bt878 cards. # # options BKTR_GPIO_ACCESS Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Tue Feb 28 11:06:52 2012 (r232249) +++ head/sys/dev/ath/if_ath_sysctl.c Tue Feb 28 13:19:34 2012 (r232250) @@ -912,7 +912,7 @@ ath_sysctl_hal_attach(struct ath_softc * sc->sc_ah->ah_config.ah_ar5416_biasadj = 0; SYSCTL_ADD_INT(ctx, child, OID_AUTO, "ar5416_biasadj", CTLFLAG_RW, &sc->sc_ah->ah_config.ah_ar5416_biasadj, 0, - "Enable 2ghz AR5416 direction sensitivity bias adjust"); + "Enable 2GHz AR5416 direction sensitivity bias adjust"); sc->sc_ah->ah_config.ah_dma_beacon_response_time = 2; SYSCTL_ADD_INT(ctx, child, OID_AUTO, "dma_brt", CTLFLAG_RW, Modified: head/sys/dev/siba/siba_core.c ============================================================================== --- head/sys/dev/siba/siba_core.c Tue Feb 28 11:06:52 2012 (r232249) +++ head/sys/dev/siba/siba_core.c Tue Feb 28 13:19:34 2012 (r232250) @@ -1207,7 +1207,7 @@ siba_cc_pmu0_pll0_init(struct siba_cc *s if (((pmu & SIBA_CC_PMUCTL_XF) >> 2) == e->xf) return; - DPRINTF(siba, SIBA_DEBUG_PLL, "change PLL value to %u.%03u mhz\n", + DPRINTF(siba, SIBA_DEBUG_PLL, "change PLL value to %u.%03u MHz\n", (xtalfreq / 1000), (xtalfreq % 1000)); KASSERT(siba->siba_chipid == 0x4328 || siba->siba_chipid == 0x5354, Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Tue Feb 28 11:06:52 2012 (r232249) +++ head/sys/ia64/ia64/machdep.c Tue Feb 28 13:19:34 2012 (r232250) @@ -245,7 +245,7 @@ identifycpu(void) printf("CPU: %s (", model_name); if (cpu_freq) - printf("%u Mhz ", cpu_freq); + printf("%u MHz ", cpu_freq); printf("%s)\n", family_name); printf(" Origin = \"%s\" Revision = %d\n", vendor, revision); printf(" Features = 0x%b\n", (u_int32_t) features, Modified: head/sys/mips/rt305x/rt305x_sysctl.c ============================================================================== --- head/sys/mips/rt305x/rt305x_sysctl.c Tue Feb 28 11:06:52 2012 (r232249) +++ head/sys/mips/rt305x/rt305x_sysctl.c Tue Feb 28 13:19:34 2012 (r232250) @@ -84,7 +84,7 @@ rt305x_sysctl_dump_config(device_t dev) if ( val & SYSCTL_SYSCFG_BIG_ENDIAN) printf("\tBig Endian\n"); if ( val & SYSCTL_SYSCFG_CPU_CLK_SEL_384MHZ) - printf("\tClock is 384Mhz\n"); + printf("\tClock is 384MHz\n"); printf("\tBoot from %u\n", ((val & SYSCTL_SYSCFG_BOOT_FROM_MASK) >> SYSCTL_SYSCFG_BOOT_FROM_SHIFT)); @@ -109,7 +109,7 @@ rt305x_sysctl_dump_config(device_t dev) printf("\tI2S clock is enabled\n"); printf("\tI2S clock is %s\n", (val & SYSCTL_CLKCFG1_I2S_CLK_SEL_EXT)? - "external":"internal 15.625Mhz"); + "external":"internal 15.625MHz"); printf("\tI2S clock divider %u\n", ((val & SYSCTL_CLKCFG1_I2S_CLK_DIV_MASK) >> SYSCTL_CLKCFG1_I2S_CLK_DIV_SHIFT)); @@ -118,7 +118,7 @@ rt305x_sysctl_dump_config(device_t dev) printf("\tPCM clock is %s\n", (val & SYSCTL_CLKCFG1_PCM_CLK_SEL_EXT)? - "external":"internal 15.625Mhz"); + "external":"internal 15.625MHz"); printf("\tPCM clock divider %u\n", ((val & SYSCTL_CLKCFG1_PCM_CLK_DIV_MASK) >> SYSCTL_CLKCFG1_PCM_CLK_DIV_SHIFT)); From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 14:35:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 317621065670; Tue, 28 Feb 2012 14:35:37 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07A658FC13; Tue, 28 Feb 2012 14:35:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SEZaXI074919; Tue, 28 Feb 2012 14:35:36 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SEZaEI074917; Tue, 28 Feb 2012 14:35:36 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202281435.q1SEZaEI074917@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 28 Feb 2012 14:35: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: r232253 - 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: Tue, 28 Feb 2012 14:35:37 -0000 Author: pluknet Date: Tue Feb 28 14:35:36 2012 New Revision: 232253 URL: http://svn.freebsd.org/changeset/base/232253 Log: Correct pathname for manpages after libarchive 3.0.3 update. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Feb 28 14:22:54 2012 (r232252) +++ head/ObsoleteFiles.inc Tue Feb 28 14:35:36 2012 (r232253) @@ -39,22 +39,22 @@ # done # 20120225: libarchive 3.0.3 -OLD_FILES+=man/man3/archive_read_data_into_buffer.3.gz \ - man/man3/archive_read_support_compression_all.3.gz \ - man/man3/archive_read_support_compression_bzip2.3.gz \ - man/man3/archive_read_support_compression_compress.3.gz \ - man/man3/archive_read_support_compression_gzip.3.gz \ - man/man3/archive_read_support_compression_lzma.3.gz \ - man/man3/archive_read_support_compression_none.3.gz \ - man/man3/archive_read_support_compression_program.3.gz \ - man/man3/archive_read_support_compression_program_signature.3.gz \ - man/man3/archive_read_support_compression_xz.3.gz \ - man/man3/archive_write_set_callbacks.3.gz \ - man/man3/archive_write_set_compression_bzip2.3.gz \ - man/man3/archive_write_set_compression_compress.3.gz \ - man/man3/archive_write_set_compression_gzip.3.gz \ - man/man3/archive_write_set_compression_none.3.gz \ - man/man3/archive_write_set_compression_program.3.gz +OLD_FILES+=usr/share/man/man3/archive_read_data_into_buffer.3.gz \ + usr/share/man/man3/archive_read_support_compression_all.3.gz \ + usr/share/man/man3/archive_read_support_compression_bzip2.3.gz \ + usr/share/man/man3/archive_read_support_compression_compress.3.gz \ + usr/share/man/man3/archive_read_support_compression_gzip.3.gz \ + usr/share/man/man3/archive_read_support_compression_lzma.3.gz \ + usr/share/man/man3/archive_read_support_compression_none.3.gz \ + usr/share/man/man3/archive_read_support_compression_program.3.gz \ + usr/share/man/man3/archive_read_support_compression_program_signature.3.gz \ + usr/share/man/man3/archive_read_support_compression_xz.3.gz \ + usr/share/man/man3/archive_write_set_callbacks.3.gz \ + usr/share/man/man3/archive_write_set_compression_bzip2.3.gz \ + usr/share/man/man3/archive_write_set_compression_compress.3.gz \ + usr/share/man/man3/archive_write_set_compression_gzip.3.gz \ + usr/share/man/man3/archive_write_set_compression_none.3.gz \ + usr/share/man/man3/archive_write_set_compression_program.3.gz OLD_LIBS+=usr/lib/libarchive.so.5 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" OLD_LIBS+=usr/lib32/libarchive.so.5 From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 15:07:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D54A6106566B; Tue, 28 Feb 2012 15:07:05 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C42DB8FC0A; Tue, 28 Feb 2012 15:07:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SF75vE075915; Tue, 28 Feb 2012 15:07:05 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SF758I075911; Tue, 28 Feb 2012 15:07:05 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202281507.q1SF758I075911@svn.freebsd.org> From: Kevin Lo Date: Tue, 28 Feb 2012 15:07: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: r232254 - in head: share/man/man5 share/man/man9 sys/netatalk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 15:07:05 -0000 Author: kevlo Date: Tue Feb 28 15:07:05 2012 New Revision: 232254 URL: http://svn.freebsd.org/changeset/base/232254 Log: Fix typos Modified: head/share/man/man5/passwd.5 head/share/man/man9/byteorder.9 head/sys/netatalk/aarp.c Modified: head/share/man/man5/passwd.5 ============================================================================== --- head/share/man/man5/passwd.5 Tue Feb 28 14:35:36 2012 (r232253) +++ head/share/man/man5/passwd.5 Tue Feb 28 15:07:05 2012 (r232254) @@ -232,7 +232,7 @@ user's home phone number .Pp The full .Ar name -may contain a ampersand +may contain an ampersand .Pq Ql & which will be replaced by the capitalized login Modified: head/share/man/man9/byteorder.9 ============================================================================== --- head/share/man/man9/byteorder.9 Tue Feb 28 14:35:36 2012 (r232253) +++ head/share/man/man9/byteorder.9 Tue Feb 28 15:07:05 2012 (r232254) @@ -123,7 +123,7 @@ The .Fn htobe32 , and .Fn htobe64 -functions return a integer in the system's native +functions return an integer in the system's native byte order converted to big endian byte order. The return value will be the same as the argument on big endian systems. .Pp Modified: head/sys/netatalk/aarp.c ============================================================================== --- head/sys/netatalk/aarp.c Tue Feb 28 14:35:36 2012 (r232253) +++ head/sys/netatalk/aarp.c Tue Feb 28 15:07:05 2012 (r232254) @@ -467,7 +467,7 @@ at_aarpinput(struct ifnet *ifp, struct m if (aat != NULL) { if (op == AARPOP_PROBE) { /* - * Someone's probing for spa, dealocate the one we've + * Someone's probing for spa, deallocate the one we've * got, so that if the prober keeps the address, * we'll be able to arp for him. */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 15:09:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA55E106567C; Tue, 28 Feb 2012 15:09:56 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA13E8FC08; Tue, 28 Feb 2012 15:09:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SF9ujK076036; Tue, 28 Feb 2012 15:09:56 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SF9ubH076034; Tue, 28 Feb 2012 15:09:56 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202281509.q1SF9ubH076034@svn.freebsd.org> From: Kevin Lo Date: Tue, 28 Feb 2012 15:09: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: r232255 - head/sys/dev/amr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 15:09:56 -0000 Author: kevlo Date: Tue Feb 28 15:09:56 2012 New Revision: 232255 URL: http://svn.freebsd.org/changeset/base/232255 Log: Fix checks for error return from amr_sglist_map() and amr_ccb_map() Modified: head/sys/dev/amr/amr_pci.c Modified: head/sys/dev/amr/amr_pci.c ============================================================================== --- head/sys/dev/amr/amr_pci.c Tue Feb 28 15:07:05 2012 (r232254) +++ head/sys/dev/amr/amr_pci.c Tue Feb 28 15:09:56 2012 (r232255) @@ -339,11 +339,11 @@ amr_pci_attach(device_t dev) /* * Build the scatter/gather buffers. */ - if (amr_sglist_map(sc)) + if ((error = amr_sglist_map(sc)) != 0) goto out; debug(2, "s/g list mapped"); - if (amr_ccb_map(sc)) + if ((error = amr_ccb_map(sc)) != 0) goto out; debug(2, "ccb mapped"); From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 15:12:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60C86106564A; Tue, 28 Feb 2012 15:12:26 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 505608FC0A; Tue, 28 Feb 2012 15:12:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SFCQNS076160; Tue, 28 Feb 2012 15:12:26 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SFCQGq076158; Tue, 28 Feb 2012 15:12:26 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202281512.q1SFCQGq076158@svn.freebsd.org> From: Kevin Lo Date: Tue, 28 Feb 2012 15:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232256 - 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, 28 Feb 2012 15:12:26 -0000 Author: kevlo Date: Tue Feb 28 15:12:26 2012 New Revision: 232256 URL: http://svn.freebsd.org/changeset/base/232256 Log: Add missing MODULE_DEPEND() so that acpi.ko and aibs.ko can be loaded dynamically. Modified: head/sys/dev/acpi_support/atk0110.c Modified: head/sys/dev/acpi_support/atk0110.c ============================================================================== --- head/sys/dev/acpi_support/atk0110.c Tue Feb 28 15:09:56 2012 (r232255) +++ head/sys/dev/acpi_support/atk0110.c Tue Feb 28 15:12:26 2012 (r232256) @@ -97,7 +97,7 @@ static driver_t aibs_driver = { static devclass_t aibs_devclass; DRIVER_MODULE(aibs, acpi, aibs_driver, aibs_devclass, NULL, NULL); - +MODULE_DEPEND(aibs, acpi, 1, 1, 1); static char* aibs_hids[] = { "ATK0110", From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 15:18:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13D0F1065674; Tue, 28 Feb 2012 15:18:27 +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 DC7498FC17; Tue, 28 Feb 2012 15:18:26 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 9304246B2D; Tue, 28 Feb 2012 10:18:26 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8C407B967; Tue, 28 Feb 2012 10:18:25 -0500 (EST) From: John Baldwin To: Julian Elischer Date: Tue, 28 Feb 2012 08:41:53 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org> In-Reply-To: <4F4C7571.7010407@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201202280841.53552.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 28 Feb 2012 10:18:25 -0500 (EST) Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Mikolaj Golub , svn-src-head@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r232181 - 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: Tue, 28 Feb 2012 15:18:27 -0000 On Tuesday, February 28, 2012 1:34:25 am Julian Elischer wrote: > On 2/27/12 1:29 AM, Konstantin Belousov wrote: > > On Mon, Feb 27, 2012 at 10:49:59AM +0200, Mikolaj Golub wrote: > >> On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote: > >> > >> PJD> On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: > >> >> Author: trociny > >> >> Date: Sun Feb 26 14:25:48 2012 > >> >> New Revision: 232181 > >> >> URL: http://svn.freebsd.org/changeset/base/232181 > >> >> > >> >> Log: > >> >> Add sysctl to retrieve or set umask of another process. > >> > >> PJD> "set umask of another process"? This seems... weird. What's the purpose > >> PJD> of this change? > >> > >> When we were discussing this with Kostik and Robert, and I asked if it could > >> be useful to have the sysctl rw, Kostik described a real situation when he had > >> had to change umask of another process: umask had not been set properly on an > >> aplication start but it could not be restarted until the end of the day. > >> Kostik was able to fix it using gdb but having an easier way looked useful. > > kgdb, not gdb. > > > > It is indeed possible to write a ptrace-based utility that inject a code > > payload that would change umask. Since this is very risky but indeed possible, > > having the straighforward kernel facility is justified. > Why not have a sysctl to change a process' uid, cwd, memory limits, > etc. etc. uid and cwd would be rediculous to change. However, we recently added sysctls to allow a sysadmin to read and write the limits of other processes (and that is a very useful feature indeed since it is not unusual for a long-running process to require more resources than it was initially allocated, as is the ability to easily query the limits that a given process is subject to). > I don't think this belongs in the kernel by default. It's not exactl a > call for backout but It's teh next thing short of that. a call for "do > you REALLY think we need this particular specific case catered for?" That said, the umask bit does strike me as a bit more odd than the limits case. I would have more need of a tool to let me adjust the listen queue length of a socket than to adjust umask (I've had to do that multiple times via kgdb). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 15:45:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94568106566C; Tue, 28 Feb 2012 15:45:42 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 831958FC0C; Tue, 28 Feb 2012 15:45:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SFjg7Z077213; Tue, 28 Feb 2012 15:45:42 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SFjgZm077208; Tue, 28 Feb 2012 15:45:42 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202281545.q1SFjgZm077208@svn.freebsd.org> From: Kevin Lo Date: Tue, 28 Feb 2012 15: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: r232257 - in head: share/man/man4 sys/dev/usb sys/dev/usb/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, 28 Feb 2012 15:45:42 -0000 Author: kevlo Date: Tue Feb 28 15:45:42 2012 New Revision: 232257 URL: http://svn.freebsd.org/changeset/base/232257 Log: Add support for the MCS7832 Obtained from: OpenBSD Modified: head/share/man/man4/mos.4 head/sys/dev/usb/net/if_mos.c head/sys/dev/usb/net/if_mosreg.h head/sys/dev/usb/usbdevs Modified: head/share/man/man4/mos.4 ============================================================================== --- head/share/man/man4/mos.4 Tue Feb 28 15:12:26 2012 (r232256) +++ head/share/man/man4/mos.4 Tue Feb 28 15:45:42 2012 (r232257) @@ -20,7 +20,7 @@ .Os .Sh NAME .Nm mos -.Nd Moschip MCS7730/MCS7840 USB Ethernet driver +.Nd Moschip MCS7730/MCS7830/MCS7832 USB Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -44,9 +44,9 @@ if_mos_load="YES" The .Nm driver provides support for USB Ethernet adapters based on the -Moschip MCS7730/MCS7830 chipset. +Moschip MCS7730/MCS7830/MCS7832 chipset. .Pp -The adapters that contain the Moschip MCS7730/MCS7830 chipset +The adapters that contain the Moschip MCS7730/MCS7830/MCS7832 chipset will operate at 100Base-TX and full-duplex. .Pp The Moschip contains a 10/100 Modified: head/sys/dev/usb/net/if_mos.c ============================================================================== --- head/sys/dev/usb/net/if_mos.c Tue Feb 28 15:12:26 2012 (r232256) +++ head/sys/dev/usb/net/if_mos.c Tue Feb 28 15:45:42 2012 (r232257) @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); /* - * Moschip MCS7730/MCS7830 USB to Ethernet controller + * Moschip MCS7730/MCS7830/MCS7832 USB to Ethernet controller * The datasheet is available at the following URL: * http://www.moschip.com/data/products/MCS7830/Data%20Sheet_7830.pdf */ @@ -149,6 +149,7 @@ SYSCTL_INT(_hw_usb_mos, OID_AUTO, debug, static const STRUCT_USB_HOST_ID mos_devs[] = { {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7730, MCS7730)}, {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7830, MCS7830)}, + {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7832, MCS7832)}, {USB_VPI(USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_LN030, MCS7830)}, }; @@ -715,6 +716,8 @@ mos_attach(device_t dev) MOS_DPRINTFN("model: MCS7730"); } else if (sc->mos_flags & MCS7830) { MOS_DPRINTFN("model: MCS7830"); + } else if (sc->mos_flags & MCS7832) { + MOS_DPRINTFN("model: MCS7832"); } error = uether_ifattach(ue); if (error) { Modified: head/sys/dev/usb/net/if_mosreg.h ============================================================================== --- head/sys/dev/usb/net/if_mosreg.h Tue Feb 28 15:12:26 2012 (r232256) +++ head/sys/dev/usb/net/if_mosreg.h Tue Feb 28 15:45:42 2012 (r232257) @@ -152,6 +152,7 @@ #define MCS7730 0x0001 #define MCS7830 0x0002 +#define MCS7832 0x0004 #define MOS_INC(x, y) (x) = (x + 1) % y Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Feb 28 15:12:26 2012 (r232256) +++ head/sys/dev/usb/usbdevs Tue Feb 28 15:45:42 2012 (r232257) @@ -2306,6 +2306,7 @@ product MOSCHIP MCS7703 0x7703 MCS7703 product MOSCHIP MCS7730 0x7730 MCS7730 Ethernet product MOSCHIP MCS7820 0x7820 MCS7820 Serial Port Adapter product MOSCHIP MCS7830 0x7830 MCS7830 Ethernet +product MOSCHIP MCS7832 0x7832 MCS7832 Ethernet product MOSCHIP MCS7840 0x7840 MCS7840 Serial Port Adapter /* Motorola products */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 15:47:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6CFA1065673; Tue, 28 Feb 2012 15:47:39 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D35F8FC08; Tue, 28 Feb 2012 15:47:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SFld9p077310; Tue, 28 Feb 2012 15:47:39 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SFld3E077308; Tue, 28 Feb 2012 15:47:39 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201202281547.q1SFld3E077308@svn.freebsd.org> From: Kevin Lo Date: Tue, 28 Feb 2012 15:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232258 - 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: Tue, 28 Feb 2012 15:47:39 -0000 Author: kevlo Date: Tue Feb 28 15:47:39 2012 New Revision: 232258 URL: http://svn.freebsd.org/changeset/base/232258 Log: Mention mos(4) Modified: head/share/man/man4/usb.4 Modified: head/share/man/man4/usb.4 ============================================================================== --- head/share/man/man4/usb.4 Tue Feb 28 15:45:42 2012 (r232257) +++ head/share/man/man4/usb.4 Tue Feb 28 15:47:39 2012 (r232258) @@ -150,6 +150,7 @@ specifications can be found at: .Xr cue 4 , .Xr ehci 4 , .Xr kue 4 , +.Xr mos 4 , .Xr ohci 4 , .Xr pci 4 , .Xr rue 4 , From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 15:52:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 796BA106566B; Tue, 28 Feb 2012 15:52:02 +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 4DDC98FC13; Tue, 28 Feb 2012 15:52:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SFq2ji077489; Tue, 28 Feb 2012 15:52:02 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SFq2AI077486; Tue, 28 Feb 2012 15:52:02 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202281552.q1SFq2AI077486@svn.freebsd.org> From: Rick Macklem Date: Tue, 28 Feb 2012 15:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232259 - in stable/9/sys: fs/nfsserver i386/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: Tue, 28 Feb 2012 15:52:02 -0000 Author: rmacklem Date: Tue Feb 28 15:52:01 2012 New Revision: 232259 URL: http://svn.freebsd.org/changeset/base/232259 Log: MFC: r232050 hrs@ reported a panic to freebsd-stable@ under the subject line "panic in 8.3-PRERELEASE" on Feb. 22, 2012. This panic was caused by use of a mix of tsleep() and msleep() calls on the same event in the new NFS server DRC code. It did "mtx_unlock(); tsleep();" in two places, which kib@ noted introduced a slight risk that the wakeup() would occur before the tsleep(), resulting in a 10sec delay before waking up. This patch fixes the problem by replacing "mtx_unlock(); tsleep();" with mtx_sleep(..PDROP..). It also changes a nfsmsleep() call to mtx_sleep() so that the code uses mtx_sleep() consistently within the file. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdcache.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdcache.c Tue Feb 28 15:47:39 2012 (r232258) +++ stable/9/sys/fs/nfsserver/nfs_nfsdcache.c Tue Feb 28 15:52:01 2012 (r232259) @@ -336,9 +336,8 @@ loop: nfsaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) { if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - NFSUNLOCKCACHE(); - (void) tsleep((caddr_t)rp, PZERO - 1, - "nfsrc", 10 * hz); + (void)mtx_sleep(rp, NFSCACHEMUTEXPTR, + (PZERO - 1) | PDROP, "nfsrc", 10 * hz); goto loop; } if (rp->rc_flag == 0) @@ -622,8 +621,8 @@ tryagain: rp = hitrp; if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - NFSUNLOCKCACHE(); - (void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 10 * hz); + (void)mtx_sleep(rp, NFSCACHEMUTEXPTR, + (PZERO - 1) | PDROP, "nfsrc", 10 * hz); goto tryagain; } if (rp->rc_flag == 0) @@ -694,7 +693,7 @@ nfsrc_lock(struct nfsrvcache *rp) NFSCACHELOCKREQUIRED(); while ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void) nfsmsleep((caddr_t)rp, NFSCACHEMUTEXPTR, PZERO - 1, + (void)mtx_sleep(rp, NFSCACHEMUTEXPTR, PZERO - 1, "nfsrc", 0); } rp->rc_flag |= RC_LOCKED; From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 17:29:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9343106566B; Tue, 28 Feb 2012 17:29:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8CA68FC17; Tue, 28 Feb 2012 17:29:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SHTVhi080514; Tue, 28 Feb 2012 17:29:31 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SHTVsj080512; Tue, 28 Feb 2012 17:29:31 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202281729.q1SHTVsj080512@svn.freebsd.org> From: Ed Maste Date: Tue, 28 Feb 2012 17:29: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: r232260 - head/sys/dev/aac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 17:29:31 -0000 Author: emaste Date: Tue Feb 28 17:29:31 2012 New Revision: 232260 URL: http://svn.freebsd.org/changeset/base/232260 Log: Avoid transfers crossing a 4GB boundary, which can lead to data corruption. Thanks to scottl@ for the suggestion. This change will likely be revised after consideration of a general method to address this type of issue for other drivers. Sponsored by: Sandvine Incorporated MFC after: 3 days Modified: head/sys/dev/aac/aac_pci.c Modified: head/sys/dev/aac/aac_pci.c ============================================================================== --- head/sys/dev/aac/aac_pci.c Tue Feb 28 15:52:01 2012 (r232259) +++ head/sys/dev/aac/aac_pci.c Tue Feb 28 17:29:31 2012 (r232260) @@ -403,7 +403,8 @@ aac_pci_attach(device_t dev) * Note that some of these controllers are 64-bit capable. */ if (bus_dma_tag_create(NULL, /* parent */ - PAGE_SIZE, 0, /* algnmnt, boundary */ + PAGE_SIZE, /* alignment */ + ((bus_size_t)((uint64_t)1 << 32)), /* boundary*/ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 18:15:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14FAD106564A; Tue, 28 Feb 2012 18:15:29 +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 EE0958FC15; Tue, 28 Feb 2012 18:15:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SIFSMP082035; Tue, 28 Feb 2012 18:15:28 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SIFSbB082030; Tue, 28 Feb 2012 18:15:28 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202281815.q1SIFSbB082030@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 28 Feb 2012 18:15: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: r232261 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 18:15:29 -0000 Author: tijl Date: Tue Feb 28 18:15:28 2012 New Revision: 232261 URL: http://svn.freebsd.org/changeset/base/232261 Log: Copy amd64 _types.h to x86 and merge with i386 _types.h. Replace existing amd64/i386/pc98 _types.h with stubs. Added: head/sys/x86/include/_types.h - copied, changed from r232259, head/sys/amd64/include/_types.h Modified: head/sys/amd64/include/_types.h head/sys/i386/include/_types.h head/sys/pc98/include/_types.h Modified: head/sys/amd64/include/_types.h ============================================================================== --- head/sys/amd64/include/_types.h Tue Feb 28 17:29:31 2012 (r232260) +++ head/sys/amd64/include/_types.h Tue Feb 28 18:15:28 2012 (r232261) @@ -1,116 +1,6 @@ /*- - * Copyright (c) 2002 Mike Barcroft - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * From: @(#)types.h 8.3 (Berkeley) 1/5/94 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE__TYPES_H_ -#define _MACHINE__TYPES_H_ - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -#define __NO_STRICT_ALIGNMENT - -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; - -/* - * Standard type definitions. - */ -typedef __int32_t __clock_t; /* clock()... */ -typedef __int64_t __critical_t; -typedef double __double_t; -typedef float __float_t; -typedef __int64_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int64_t __intptr_t; -typedef __int32_t __int_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ -typedef __int64_t __register_t; -typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ -typedef __int64_t __time_t; /* time()... */ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint64_t __uintptr_t; -typedef __uint32_t __uint_fast8_t; -typedef __uint32_t __uint_fast16_t; -typedef __uint32_t __uint_fast32_t; -typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; -typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; -typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; -typedef __uint64_t __vm_size_t; - -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#elif defined(lint) -typedef char * __va_list; /* pretend */ -#endif -#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - -#endif /* !_MACHINE__TYPES_H_ */ +#include Modified: head/sys/i386/include/_types.h ============================================================================== --- head/sys/i386/include/_types.h Tue Feb 28 17:29:31 2012 (r232260) +++ head/sys/i386/include/_types.h Tue Feb 28 18:15:28 2012 (r232261) @@ -1,128 +1,6 @@ /*- - * Copyright (c) 2002 Mike Barcroft - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * From: @(#)types.h 8.3 (Berkeley) 1/5/94 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE__TYPES_H_ -#define _MACHINE__TYPES_H_ - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -#define __NO_STRICT_ALIGNMENT - -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef long long __int64_t; -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef unsigned long long __uint64_t; - -/* - * Standard type definitions. - */ -typedef unsigned long __clock_t; /* clock()... */ -typedef __int32_t __critical_t; -typedef long double __double_t; -typedef long double __float_t; -typedef __int32_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int32_t __intptr_t; -typedef __int32_t __int_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ -typedef __int32_t __register_t; -typedef __int32_t __segsz_t; /* segment size (in pages) */ -typedef __uint32_t __size_t; /* sizeof() */ -typedef __int32_t __ssize_t; /* byte count or error */ -typedef __int32_t __time_t; /* time()... */ -typedef __uint32_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint32_t __uintptr_t; -typedef __uint32_t __uint_fast8_t; -typedef __uint32_t __uint_fast16_t; -typedef __uint32_t __uint_fast32_t; -typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; -typedef __uint32_t __u_register_t; -typedef __uint32_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; -#ifdef PAE -typedef __uint64_t __vm_paddr_t; -#else -typedef __uint32_t __vm_paddr_t; -#endif -typedef __uint64_t __vm_pindex_t; -typedef __uint32_t __vm_size_t; - -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ -#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - -#endif /* !_MACHINE__TYPES_H_ */ +#include Modified: head/sys/pc98/include/_types.h ============================================================================== --- head/sys/pc98/include/_types.h Tue Feb 28 17:29:31 2012 (r232260) +++ head/sys/pc98/include/_types.h Tue Feb 28 18:15:28 2012 (r232261) @@ -3,4 +3,4 @@ */ /* $FreeBSD$ */ -#include +#include Copied and modified: head/sys/x86/include/_types.h (from r232259, head/sys/amd64/include/_types.h) ============================================================================== --- head/sys/amd64/include/_types.h Tue Feb 28 15:52:01 2012 (r232259, copy source) +++ head/sys/x86/include/_types.h Tue Feb 28 18:15:28 2012 (r232261) @@ -54,19 +54,41 @@ typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; +#ifdef _LP64 typedef long __int64_t; typedef unsigned long __uint64_t; +#else +#ifndef lint +__extension__ +#endif +/* LONGLONG */ +typedef long long __int64_t; +#ifndef lint +__extension__ +#endif +/* LONGLONG */ +typedef unsigned long long __uint64_t; +#endif /* * Standard type definitions. */ +#ifdef _LP64 typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; typedef double __double_t; typedef float __float_t; typedef __int64_t __intfptr_t; -typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; +#else +typedef unsigned long __clock_t; +typedef __int32_t __critical_t; +typedef long double __double_t; +typedef long double __float_t; +typedef __int32_t __intfptr_t; +typedef __int32_t __intptr_t; +#endif +typedef __int64_t __intmax_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; @@ -75,6 +97,7 @@ typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; +#ifdef _LP64 typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ @@ -82,8 +105,18 @@ typedef __uint64_t __size_t; /* sizeof( typedef __int64_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintmax_t; typedef __uint64_t __uintptr_t; +#else +typedef __int32_t __ptrdiff_t; +typedef __int32_t __register_t; +typedef __int32_t __segsz_t; +typedef __uint32_t __size_t; +typedef __int32_t __ssize_t; +typedef __int32_t __time_t; +typedef __uint32_t __uintfptr_t; +typedef __uint32_t __uintptr_t; +#endif +typedef __uint64_t __uintmax_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; @@ -92,12 +125,23 @@ typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; +#ifdef _LP64 typedef __uint64_t __u_register_t; typedef __uint64_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; typedef __uint64_t __vm_size_t; +#else +typedef __uint32_t __u_register_t; +typedef __uint32_t __vm_offset_t; +#ifdef PAE +typedef __uint64_t __vm_paddr_t; +#else +typedef __uint32_t __vm_paddr_t; +#endif +typedef __uint32_t __vm_size_t; +#endif +typedef __int64_t __vm_ooffset_t; +typedef __uint64_t __vm_pindex_t; /* * Unusual type definitions. From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 18:24:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F4081065672; Tue, 28 Feb 2012 18:24:29 +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 7CFC58FC19; Tue, 28 Feb 2012 18:24:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SIOTfP082349; Tue, 28 Feb 2012 18:24:29 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SIOTdp082344; Tue, 28 Feb 2012 18:24:29 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202281824.q1SIOTdp082344@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 28 Feb 2012 18:24: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: r232262 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 18:24:29 -0000 Author: tijl Date: Tue Feb 28 18:24:28 2012 New Revision: 232262 URL: http://svn.freebsd.org/changeset/base/232262 Log: Copy amd64 _limits.h to x86 and merge with i386 _limits.h. Replace amd64/i386/pc98 _limits.h with stubs. Added: head/sys/x86/include/_limits.h - copied, changed from r232259, head/sys/amd64/include/_limits.h Modified: head/sys/amd64/include/_limits.h head/sys/i386/include/_limits.h head/sys/pc98/include/_limits.h Modified: head/sys/amd64/include/_limits.h ============================================================================== --- head/sys/amd64/include/_limits.h Tue Feb 28 18:15:28 2012 (r232261) +++ head/sys/amd64/include/_limits.h Tue Feb 28 18:24:28 2012 (r232262) @@ -1,87 +1,6 @@ /*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE__LIMITS_H_ -#define _MACHINE__LIMITS_H_ - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - */ - -#define __CHAR_BIT 8 /* number of bits in a char */ - -#define __SCHAR_MAX 0x7f /* max value for a signed char */ -#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ - -#define __UCHAR_MAX 0xff /* max value for an unsigned char */ - -#define __USHRT_MAX 0xffff /* max value for an unsigned short */ -#define __SHRT_MAX 0x7fff /* max value for a short */ -#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ - -#define __UINT_MAX 0xffffffff /* max value for an unsigned int */ -#define __INT_MAX 0x7fffffff /* max value for an int */ -#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ - -#define __ULONG_MAX 0xffffffffffffffff /* max for an unsigned long */ -#define __LONG_MAX 0x7fffffffffffffff /* max for a long */ -#define __LONG_MIN (-0x7fffffffffffffff - 1) /* min for a long */ - - /* max value for an unsigned long long */ -#define __ULLONG_MAX 0xffffffffffffffffULL -#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ -#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ - -#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ - -#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ - -#define __OFF_MAX __LONG_MAX /* max value for an off_t */ -#define __OFF_MIN __LONG_MIN /* min value for an off_t */ - -/* Quads and longs are the same on the amd64. Ensure they stay in sync. */ -#define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ -#define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ -#define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ - -#define __LONG_BIT 64 -#define __WORD_BIT 32 - -/* Minimum signal stack size. */ -#define __MINSIGSTKSZ (512 * 4) - -#endif /* !_MACHINE__LIMITS_H_ */ +#include Modified: head/sys/i386/include/_limits.h ============================================================================== --- head/sys/i386/include/_limits.h Tue Feb 28 18:15:28 2012 (r232261) +++ head/sys/i386/include/_limits.h Tue Feb 28 18:24:28 2012 (r232262) @@ -1,87 +1,6 @@ /*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE__LIMITS_H_ -#define _MACHINE__LIMITS_H_ - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - */ - -#define __CHAR_BIT 8 /* number of bits in a char */ - -#define __SCHAR_MAX 0x7f /* max value for a signed char */ -#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ - -#define __UCHAR_MAX 0xff /* max value for an unsigned char */ - -#define __USHRT_MAX 0xffff /* max value for an unsigned short */ -#define __SHRT_MAX 0x7fff /* max value for a short */ -#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ - -#define __UINT_MAX 0xffffffff /* max value for an unsigned int */ -#define __INT_MAX 0x7fffffff /* max value for an int */ -#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ - -#define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ -#define __LONG_MAX 0x7fffffffL /* max value for a long */ -#define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */ - - /* max value for an unsigned long long */ -#define __ULLONG_MAX 0xffffffffffffffffULL -#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ -#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ - -#define __SSIZE_MAX __INT_MAX /* max value for a ssize_t */ - -#define __SIZE_T_MAX __UINT_MAX /* max value for a size_t */ - -#define __OFF_MAX __LLONG_MAX /* max value for an off_t */ -#define __OFF_MIN __LLONG_MIN /* min value for an off_t */ - -/* Quads and long longs are the same size. Ensure they stay in sync. */ -#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ -#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ -#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ - -#define __LONG_BIT 32 -#define __WORD_BIT 32 - -/* Minimum signal stack size. */ -#define __MINSIGSTKSZ (512 * 4) - -#endif /* !_MACHINE__LIMITS_H_ */ +#include Modified: head/sys/pc98/include/_limits.h ============================================================================== --- head/sys/pc98/include/_limits.h Tue Feb 28 18:15:28 2012 (r232261) +++ head/sys/pc98/include/_limits.h Tue Feb 28 18:24:28 2012 (r232262) @@ -3,4 +3,4 @@ */ /* $FreeBSD$ */ -#include +#include Copied and modified: head/sys/x86/include/_limits.h (from r232259, head/sys/amd64/include/_limits.h) ============================================================================== --- head/sys/amd64/include/_limits.h Tue Feb 28 15:52:01 2012 (r232259, copy source) +++ head/sys/x86/include/_limits.h Tue Feb 28 18:24:28 2012 (r232262) @@ -57,28 +57,42 @@ #define __INT_MAX 0x7fffffff /* max value for an int */ #define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ +#ifdef _LP64 #define __ULONG_MAX 0xffffffffffffffff /* max for an unsigned long */ #define __LONG_MAX 0x7fffffffffffffff /* max for a long */ #define __LONG_MIN (-0x7fffffffffffffff - 1) /* min for a long */ +#else +#define __ULONG_MAX 0xffffffffUL +#define __LONG_MAX 0x7fffffffL +#define __LONG_MIN (-0x7fffffffL - 1) +#endif /* max value for an unsigned long long */ #define __ULLONG_MAX 0xffffffffffffffffULL #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ +#ifdef _LP64 #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ - #define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ - #define __OFF_MAX __LONG_MAX /* max value for an off_t */ #define __OFF_MIN __LONG_MIN /* min value for an off_t */ - /* Quads and longs are the same on the amd64. Ensure they stay in sync. */ #define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ #define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ #define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ - #define __LONG_BIT 64 +#else +#define __SSIZE_MAX __INT_MAX +#define __SIZE_T_MAX __UINT_MAX +#define __OFF_MAX __LLONG_MAX +#define __OFF_MIN __LLONG_MIN +#define __UQUAD_MAX __ULLONG_MAX +#define __QUAD_MAX __LLONG_MAX +#define __QUAD_MIN __LLONG_MIN +#define __LONG_BIT 32 +#endif + #define __WORD_BIT 32 /* Minimum signal stack size. */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 18:30:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E853106566B; Tue, 28 Feb 2012 18:30:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A4AD8FC19; Tue, 28 Feb 2012 18:30:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SIUJNR082587; Tue, 28 Feb 2012 18:30:19 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SIUIIM082560; Tue, 28 Feb 2012 18:30:18 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202281830.q1SIUIIM082560@svn.freebsd.org> From: Dimitry Andric Date: Tue, 28 Feb 2012 18:30: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: r232263 - in head: lib/libsm lib/libthread_db lib/libz libexec/mail.local libexec/smrsh sbin/fsdb share/mk sys/boot/i386/boot0 sys/boot/i386/boot2 sys/boot/i386/btx/btx sys/boot/i386/bt... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 18:30:19 -0000 Author: dim Date: Tue Feb 28 18:30:18 2012 New Revision: 232263 URL: http://svn.freebsd.org/changeset/base/232263 Log: Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to get rid of testing explicitly for clang (using ${CC:T:Mclang}) in individual Makefiles. Instead, use the following extra macros, for use with clang: - NO_WERROR.clang (disables -Werror) - NO_WCAST_ALIGN.clang (disables -Wcast-align) - NO_WFORMAT.clang (disables -Wformat and friends) - CLANG_NO_IAS (disables integrated assembler) - CLANG_OPT_SMALL (adds flags for extra small size optimizations) As a side effect, this enables setting CC/CXX/CPP in src.conf instead of make.conf! For clang, use the following: CC=clang CXX=clang++ CPP=clang-cpp MFC after: 2 weeks Modified: head/lib/libsm/Makefile head/lib/libthread_db/Makefile head/lib/libz/Makefile head/libexec/mail.local/Makefile head/libexec/smrsh/Makefile head/sbin/fsdb/Makefile head/share/mk/bsd.sys.mk head/sys/boot/i386/boot0/Makefile head/sys/boot/i386/boot2/Makefile head/sys/boot/i386/btx/btx/Makefile head/sys/boot/i386/btx/btxldr/Makefile head/sys/boot/i386/gptboot/Makefile head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/libi386/Makefile head/sys/boot/i386/pxeldr/Makefile head/sys/boot/i386/zfsboot/Makefile head/sys/boot/pc98/btx/btx/Makefile head/sys/boot/pc98/btx/btxldr/Makefile head/sys/conf/Makefile.amd64 head/sys/conf/Makefile.i386 head/sys/conf/kern.pre.mk head/sys/modules/bios/smapi/Makefile head/sys/modules/linux/Makefile head/usr.bin/netstat/Makefile head/usr.bin/vacation/Makefile head/usr.sbin/sendmail/Makefile Modified: head/lib/libsm/Makefile ============================================================================== --- head/lib/libsm/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/lib/libsm/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -18,12 +18,10 @@ CFLAGS+=${SENDMAIL_CFLAGS} WARNS?= 2 -.if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really # care about the warnings, just make them non-fatal for now. -NO_WERROR= -.endif +NO_WERROR.clang= LIB= sm Modified: head/lib/libthread_db/Makefile ============================================================================== --- head/lib/libthread_db/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/lib/libthread_db/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -16,10 +16,8 @@ SYM_MAPS+=${.CURDIR}/Symbol.map SYMBOL_MAPS=${SYM_MAPS} VERSION_DEF=${.CURDIR}/../libc/Versions.def -.if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives an incorrect warning about alignment in # arch/i386/libpthread_md.c, so turn that off for now. -NO_WCAST_ALIGN= -.endif +NO_WCAST_ALIGN.clang= .include Modified: head/lib/libz/Makefile ============================================================================== --- head/lib/libz/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/lib/libz/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -47,10 +47,6 @@ ACFLAGS+= -Wa,--noexecstack #SRCS+= gvmat64.S #CFLAGS+= -DASMV -DNO_UNDERLINE #ACFLAGS+= -Wa,--noexecstack -#.if ${CC:T:Mclang} == "clang" -## XXX: clang integrated-as doesn't grok .intel_syntax directives yet -#ACFLAGS+= ${.IMPSRC:T:Mgvmat64.S:C/^.+$/-no-integrated-as/} -#.endif #.endif VERSION_DEF= ${.CURDIR}/Versions.def @@ -71,3 +67,7 @@ test: example minigzip echo hello world | ./minigzip | ./minigzip -d ) .include + +## XXX: clang integrated-as doesn't grok .intel_syntax directives yet +#ACFLAGS.gvmat64.S= ${CLANG_NO_IAS} +#ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}} Modified: head/libexec/mail.local/Makefile ============================================================================== --- head/libexec/mail.local/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/libexec/mail.local/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -12,12 +12,10 @@ CFLAGS+=-I${SENDMAIL_DIR}/include -I. WARNS?= 2 WFORMAT=0 -.if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really # care about the warnings, just make them non-fatal for now. -NO_WERROR= -.endif +NO_WERROR.clang= LIBSMDIR= ${.OBJDIR}/../../lib/libsm LIBSM= ${LIBSMDIR}/libsm.a Modified: head/libexec/smrsh/Makefile ============================================================================== --- head/libexec/smrsh/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/libexec/smrsh/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -17,12 +17,10 @@ LDADD= ${LIBSM} WARNS?= 2 -.if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really # care about the warnings, just make them non-fatal for now. -NO_WERROR= -.endif +NO_WERROR.clang= SRCS+= sm_os.h CLEANFILES+=sm_os.h Modified: head/sbin/fsdb/Makefile ============================================================================== --- head/sbin/fsdb/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sbin/fsdb/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -9,10 +9,8 @@ SRCS= fsdb.c fsdbutil.c \ pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c CFLAGS+= -I${.CURDIR}/../fsck_ffs WARNS?= 2 -.if ${CC:T:Mclang} == "clang" # Work around a problem with format string warnings and ntohs macros. -NO_WFORMAT= -.endif +NO_WFORMAT.clang= LDADD= -ledit -ltermcap DPADD= ${LIBEDIT} ${LIBTERMCAP} .PATH: ${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Tue Feb 28 18:24:28 2012 (r232262) +++ head/share/mk/bsd.sys.mk Tue Feb 28 18:30:18 2012 (r232263) @@ -28,7 +28,7 @@ CFLAGS += -std=${CSTD} . if defined(WARNS) . if ${WARNS} >= 1 CWARNFLAGS += -Wsystem-headers -. if !defined(NO_WERROR) +. if !defined(NO_WERROR) && (${CC:T:Mclang} != "clang" || !defined(NO_WERROR.clang)) CWARNFLAGS += -Werror . endif . endif @@ -42,7 +42,7 @@ CWARNFLAGS += -W -Wno-unused-parameter - . if ${WARNS} >= 4 CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\ -Wshadow -Wunused-parameter -. if !defined(NO_WCAST_ALIGN) +. if !defined(NO_WCAST_ALIGN) && (${CC:T:Mclang} != "clang" || !defined(NO_WCAST_ALIGN.clang)) CWARNFLAGS += -Wcast-align . endif . endif @@ -84,12 +84,12 @@ WFORMAT = 1 . if ${WFORMAT} > 0 #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS += -Wformat=2 -Wno-format-extra-args -. if !defined(NO_WERROR) +. if !defined(NO_WERROR) && (${CC:T:Mclang} != "clang" || !defined(NO_WERROR.clang)) CWARNFLAGS += -Werror . endif . endif . endif -. if defined(NO_WFORMAT) +. if defined(NO_WFORMAT) || (${CC:T:Mclang} == "clang" && defined(NO_WFORMAT.clang)) CWARNFLAGS += -Wno-format . endif .endif @@ -98,6 +98,12 @@ CWARNFLAGS += -Wno-format CWARNFLAGS += -Wno-unknown-pragmas .endif +.if ${CC:T:Mclang} == "clang" +CLANG_NO_IAS = -no-integrated-as +CLANG_OPT_SMALL = -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \ + -mllvm -enable-load-pre=false +.endif + .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \ ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" # Don't use -Wstack-protector as it breaks world with -Werror. Modified: head/sys/boot/i386/boot0/Makefile ============================================================================== --- head/sys/boot/i386/boot0/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/boot0/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -19,12 +19,6 @@ SRCS= ${PROG}.S OPTS ?= -DVOLUME_SERIAL -DPXE CFLAGS += ${OPTS} -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+= ${.IMPSRC:T:Mboot0.S:C/^.+$/-no-integrated-as/} -CFLAGS+= ${.IMPSRC:T:Mboot0ext.S:C/^.+$/-no-integrated-as/} -.endif - # Flags used in the boot0.S code: # 0x0f all valid partitions enabled. # 0x80 'packet', use BIOS EDD (LBA) extensions instead of CHS @@ -83,3 +77,8 @@ CFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \ LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-S,--oformat,binary .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.boot0.S= ${CLANG_NO_IAS} +CFLAGS.boot0ext.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/boot2/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -40,14 +40,8 @@ CFLAGS= -Os \ -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline --param max-inline-insns-single=100 - -.if ${CC:T:Mclang} == "clang" -CFLAGS+= -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \ - -mllvm -enable-load-pre=false -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+= ${.IMPSRC:T:Mboot1.S:C/^.+$/-no-integrated-as/} -.endif + -Winline --param max-inline-insns-single=100 \ + ${CLANG_OPT_SMALL} LDFLAGS=-static -N --gc-sections @@ -89,9 +83,7 @@ boot2.out: ${BTXCRT} boot2.o sio.o ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} boot2.o: boot2.s -.if ${CC:T:Mclang} == "clang" ${CC} ${ACFLAGS} -c boot2.s -.endif SRCS= boot2.c boot2.h @@ -115,3 +107,7 @@ machine: .endif .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.boot1.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/i386/btx/btx/Makefile ============================================================================== --- head/sys/boot/i386/btx/btx/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/btx/btx/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -13,11 +13,6 @@ BOOT_BTX_FLAGS=0x0 CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+=${.IMPSRC:T:Mbtx.S:C/^.+$/-no-integrated-as/} -.endif - .if defined(BTX_SERIAL) BOOT_COMCONSOLE_PORT?= 0x3f8 BOOT_COMCONSOLE_SPEED?= 9600 @@ -32,3 +27,7 @@ ORG= 0x9000 LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.btx.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/i386/btx/btxldr/Makefile ============================================================================== --- head/sys/boot/i386/btx/btxldr/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/btx/btxldr/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -11,11 +11,10 @@ CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRES CFLAGS+=-DBTXLDR_VERBOSE .endif -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+=${.IMPSRC:T:Mbtxldr.S:C/^.+$/-no-integrated-as/} -.endif - LDFLAGS=-e start -Ttext ${LOADER_ADDRESS} -Wl,-N,-S,--oformat,binary .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.btxldr.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/i386/gptboot/Makefile ============================================================================== --- head/sys/boot/i386/gptboot/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/gptboot/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -36,11 +36,6 @@ CFLAGS= -DBOOTPROG=\"gptboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline --param max-inline-insns-single=100 -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+= ${.IMPSRC:T:Mgptldr.S:C/^.+$/-no-integrated-as/} -.endif - LDFLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. @@ -79,3 +74,7 @@ machine: .endif .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.gptldr.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/gptzfsboot/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -34,11 +34,6 @@ CFLAGS= -DBOOTPROG=\"gptzfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline --param max-inline-insns-single=100 -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+= ${.IMPSRC:T:Mgptldr.S:C/^.+$/-no-integrated-as/} -.endif - LDFLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. @@ -77,3 +72,7 @@ machine: .endif .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.gptldr.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/i386/libi386/Makefile ============================================================================== --- head/sys/boot/i386/libi386/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/libi386/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -54,11 +54,6 @@ CFLAGS+= -I${.CURDIR}/../../common -I${. # the location of libstand CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+= ${.IMPSRC:T:Mamd64_tramp.S:C/^.+$/-no-integrated-as/} -.endif - .if ${MACHINE_CPUARCH} == "amd64" CLEANFILES+= machine machine: @@ -67,6 +62,10 @@ machine: .include +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} + .if ${MACHINE_CPUARCH} == "amd64" beforedepend ${OBJS}: machine .endif Modified: head/sys/boot/i386/pxeldr/Makefile ============================================================================== --- head/sys/boot/i386/pxeldr/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/pxeldr/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -23,11 +23,6 @@ CFLAGS+=-DPROBE_KEYBOARD CFLAGS+=-DALWAYS_SERIAL .endif -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+=${.IMPSRC:T:Mpxeldr.S:C/^.+$/-no-integrated-as/} -.endif - LOADERBIN= ${.OBJDIR}/../loader/loader.bin CLEANFILES+= ${BOOT}.tmp @@ -46,3 +41,7 @@ ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXK -b ${BTXKERN} ${LOADERBIN} .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.pxeldr.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/i386/zfsboot/Makefile ============================================================================== --- head/sys/boot/i386/zfsboot/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/i386/zfsboot/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -31,11 +31,6 @@ CFLAGS= -DBOOTPROG=\"zfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline --param max-inline-insns-single=100 -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+= ${.IMPSRC:T:Mzfsldr.S:C/^.+$/-no-integrated-as/} -.endif - LDFLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. @@ -90,3 +85,7 @@ machine: .endif .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.zfsldr.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/pc98/btx/btx/Makefile ============================================================================== --- head/sys/boot/pc98/btx/btx/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/pc98/btx/btx/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -13,11 +13,6 @@ BOOT_BTX_FLAGS=0x0 CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+=${.IMPSRC:T:Mbtx.S:C/^.+$/-no-integrated-as/} -.endif - .if defined(BTX_SERIAL) BOOT_COMCONSOLE_PORT?= 0x238 BOOT_COMCONSOLE_SPEED?= 9600 @@ -32,3 +27,7 @@ ORG= 0x9000 LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.btx.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/boot/pc98/btx/btxldr/Makefile ============================================================================== --- head/sys/boot/pc98/btx/btxldr/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/boot/pc98/btx/btxldr/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -11,11 +11,10 @@ CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRES CFLAGS+=-DBTXLDR_VERBOSE .endif -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+=${.IMPSRC:T:Mbtxldr.S:C/^.+$/-no-integrated-as/} -.endif - LDFLAGS=-e start -Ttext ${LOADER_ADDRESS} -Wl,-N,-S,--oformat,binary .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.btxldr.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/conf/Makefile.amd64 ============================================================================== --- head/sys/conf/Makefile.amd64 Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/conf/Makefile.amd64 Tue Feb 28 18:30:18 2012 (r232263) @@ -40,13 +40,12 @@ CFLAGS+= -fno-omit-frame-pointer MKMODULESENV+= MACHINE=amd64 -.if ${CC:T:Mclang} == "clang" # XXX: clang integrated-as doesn't grok .codeNN directives yet -ASM_CFLAGS+= ${.IMPSRC:T:Macpi_wakecode.S:C/^.+$/-no-integrated-as/} -ASM_CFLAGS+= ${.IMPSRC:T:Mia32_sigtramp.S:C/^.+$/-no-integrated-as/} -ASM_CFLAGS+= ${.IMPSRC:T:Mlinux32_locore.s:C/^.+$/-no-integrated-as/} -ASM_CFLAGS+= ${.IMPSRC:T:Mmpboot.S:C/^.+$/-no-integrated-as/} -.endif +ASM_CFLAGS.acpi_wakecode.S= ${CLANG_NO_IAS} +ASM_CFLAGS.ia32_sigtramp.S= ${CLANG_NO_IAS} +ASM_CFLAGS.linux32_locore.s= ${CLANG_NO_IAS} +ASM_CFLAGS.mpboot.S= ${CLANG_NO_IAS} +ASM_CFLAGS+= ${ASM_CFLAGS.${.IMPSRC:T}} %BEFORE_DEPEND Modified: head/sys/conf/Makefile.i386 ============================================================================== --- head/sys/conf/Makefile.i386 Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/conf/Makefile.i386 Tue Feb 28 18:30:18 2012 (r232263) @@ -34,11 +34,10 @@ MACHINE=i386 MKMODULESENV+= MACHINE=${MACHINE} -.if ${CC:T:Mclang} == "clang" # XXX: clang integrated-as doesn't grok .codeNN directives yet -ASM_CFLAGS+= ${.IMPSRC:T:Macpi_wakecode.S:C/^.+$/-no-integrated-as/} -ASM_CFLAGS+= ${.IMPSRC:T:Mmpboot.s:C/^.+$/-no-integrated-as/} -.endif +ASM_CFLAGS.acpi_wakecode.S= ${CLANG_NO_IAS} +ASM_CFLAGS.mpboot.s= ${CLANG_NO_IAS} +ASM_CFLAGS+= ${ASM_CFLAGS.${.IMPSRC:T}} %BEFORE_DEPEND Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/conf/kern.pre.mk Tue Feb 28 18:30:18 2012 (r232263) @@ -101,6 +101,10 @@ WERROR?= -Werror # XXX LOCORE means "don't declare C stuff" not "for locore.s". ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} +.if ${CC:T:Mclang} == "clang" +CLANG_NO_IAS= -no-integrated-as +.endif + .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1 CFLAGS+= -DGPROF -falign-functions=16 .if ${PROFLEVEL} >= 2 Modified: head/sys/modules/bios/smapi/Makefile ============================================================================== --- head/sys/modules/bios/smapi/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/modules/bios/smapi/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -7,9 +7,9 @@ KMOD= smapi SRCS= smapi.c smapi_bios.S \ bus_if.h device_if.h WERROR= -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok 16-bit assembly yet -CFLAGS+= ${.IMPSRC:T:Msmapi_bios.S:C/^.+$/-no-integrated-as/} -.endif .include + +# XXX: clang integrated-as doesn't grok 16-bit assembly yet +CFLAGS.smapi_bios.S= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/sys/modules/linux/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -5,11 +5,6 @@ SFX= 32 CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 .endif -.if ${CC:T:Mclang} == "clang" -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS+= ${.IMPSRC:T:Mlinux32_locore.s:C/^.+$/-no-integrated-as/} -.endif - .PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_CPUARCH}/linux${SFX} KMOD= linux @@ -69,3 +64,7 @@ CFLAGS+= -DKTR .endif .include + +# XXX: clang integrated-as doesn't grok .codeNN directives yet +CFLAGS.linux32_locore.s= ${CLANG_NO_IAS} +CFLAGS+= ${CFLAGS.${.IMPSRC:T}} Modified: head/usr.bin/netstat/Makefile ============================================================================== --- head/usr.bin/netstat/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/usr.bin/netstat/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -8,11 +8,9 @@ SRCS= if.c inet.c main.c mbuf.c mroute.c unix.c atalk.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c WARNS?= 3 -.if ${CC:T:Mclang} == "clang" # XXX: Work around a clang false positive with format string warnings # and ntohs macros (see LLVM PR 11313). -NO_WFORMAT= -.endif +NO_WFORMAT.clang= CFLAGS+=-fno-strict-aliasing CFLAGS+=-DIPSEC Modified: head/usr.bin/vacation/Makefile ============================================================================== --- head/usr.bin/vacation/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/usr.bin/vacation/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -11,12 +11,10 @@ CFLAGS+=-D_FFR_LISTDB -D_FFR_DEBUG WARNS?= 2 -.if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really # care about the warnings, just make them non-fatal for now. -NO_WERROR= -.endif +NO_WERROR.clang= LIBSMDIR= ${.OBJDIR}/../../lib/libsm LIBSM= ${LIBSMDIR}/libsm.a Modified: head/usr.sbin/sendmail/Makefile ============================================================================== --- head/usr.sbin/sendmail/Makefile Tue Feb 28 18:24:28 2012 (r232262) +++ head/usr.sbin/sendmail/Makefile Tue Feb 28 18:30:18 2012 (r232263) @@ -45,12 +45,10 @@ CFLAGS+= -DNETINET6 WARNS?= 1 -.if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really # care about the warnings, just make them non-fatal for now. -NO_WERROR= -.endif +NO_WERROR.clang= DPADD= ${LIBUTIL} ${LIBWRAP} LDADD= -lutil -lwrap From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 18:38:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D8D41065670; Tue, 28 Feb 2012 18:38:34 +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 47AD68FC0A; Tue, 28 Feb 2012 18:38:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SIcYH1082933; Tue, 28 Feb 2012 18:38:34 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SIcYhE082928; Tue, 28 Feb 2012 18:38:34 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202281838.q1SIcYhE082928@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 28 Feb 2012 18:38: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: r232264 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 18:38:34 -0000 Author: tijl Date: Tue Feb 28 18:38:33 2012 New Revision: 232264 URL: http://svn.freebsd.org/changeset/base/232264 Log: Copy amd64 _stdint.h to x86 and merge with i386 _stdint.h. Replace amd64/i386/pc98 _stdint.h with stubs. Added: head/sys/x86/include/_stdint.h - copied, changed from r232259, head/sys/amd64/include/_stdint.h Modified: head/sys/amd64/include/_stdint.h head/sys/i386/include/_stdint.h head/sys/pc98/include/_stdint.h Modified: head/sys/amd64/include/_stdint.h ============================================================================== --- head/sys/amd64/include/_stdint.h Tue Feb 28 18:30:18 2012 (r232263) +++ head/sys/amd64/include/_stdint.h Tue Feb 28 18:38:33 2012 (r232264) @@ -1,171 +1,6 @@ /*- - * Copyright (c) 2001, 2002 Mike Barcroft - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE__STDINT_H_ -#define _MACHINE__STDINT_H_ - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) (c) -#define INT16_C(c) (c) -#define INT32_C(c) (c) -#define INT64_C(c) (c ## L) - -#define UINT8_C(c) (c) -#define UINT16_C(c) (c) -#define UINT32_C(c) (c ## U) -#define UINT64_C(c) (c ## UL) - -#define INTMAX_C(c) INT64_C(c) -#define UINTMAX_C(c) UINT64_C(c) - -#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -/* - * ISO/IEC 9899:1999 - * 7.18.2.1 Limits of exact-width integer types - */ -/* Minimum values of exact-width signed integer types. */ -#define INT8_MIN (-0x7f-1) -#define INT16_MIN (-0x7fff-1) -#define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffL-1) - -/* Maximum values of exact-width signed integer types. */ -#define INT8_MAX 0x7f -#define INT16_MAX 0x7fff -#define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffffL - -/* Maximum values of exact-width unsigned integer types. */ -#define UINT8_MAX 0xff -#define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#define UINT64_MAX 0xffffffffffffffffUL - -/* - * ISO/IEC 9899:1999 - * 7.18.2.2 Limits of minimum-width integer types - */ -/* Minimum values of minimum-width signed integer types. */ -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -/* Maximum values of minimum-width signed integer types. */ -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -/* Maximum values of minimum-width unsigned integer types. */ -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.3 Limits of fastest minimum-width integer types - */ -/* Minimum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MIN INT32_MIN -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST64_MIN INT64_MIN - -/* Maximum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MAX INT32_MAX -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MAX INT64_MAX - -/* Maximum values of fastest minimum-width unsigned integer types. */ -#define UINT_FAST8_MAX UINT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.4 Limits of integer types capable of holding object pointers - */ -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.5 Limits of greatest-width integer types - */ -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.3 Limits of other integer types - */ -/* Limits of ptrdiff_t. */ -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX - -/* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN LONG_MIN -#define SIG_ATOMIC_MAX LONG_MAX - -/* Limit of size_t. */ -#define SIZE_MAX UINT64_MAX - -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* Limits of wchar_t. */ -#define WCHAR_MIN INT32_MIN -#define WCHAR_MAX INT32_MAX -#endif - -/* Limits of wint_t. */ -#define WINT_MIN INT32_MIN -#define WINT_MAX INT32_MAX - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - -#endif /* !_MACHINE__STDINT_H_ */ +#include Modified: head/sys/i386/include/_stdint.h ============================================================================== --- head/sys/i386/include/_stdint.h Tue Feb 28 18:30:18 2012 (r232263) +++ head/sys/i386/include/_stdint.h Tue Feb 28 18:38:33 2012 (r232264) @@ -1,171 +1,6 @@ /*- - * Copyright (c) 2001, 2002 Mike Barcroft - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE__STDINT_H_ -#define _MACHINE__STDINT_H_ - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) (c) -#define INT16_C(c) (c) -#define INT32_C(c) (c) -#define INT64_C(c) (c ## LL) - -#define UINT8_C(c) (c) -#define UINT16_C(c) (c) -#define UINT32_C(c) (c ## U) -#define UINT64_C(c) (c ## ULL) - -#define INTMAX_C(c) INT64_C(c) -#define UINTMAX_C(c) UINT64_C(c) - -#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -/* - * ISO/IEC 9899:1999 - * 7.18.2.1 Limits of exact-width integer types - */ -/* Minimum values of exact-width signed integer types. */ -#define INT8_MIN (-0x7f-1) -#define INT16_MIN (-0x7fff-1) -#define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffLL-1) - -/* Maximum values of exact-width signed integer types. */ -#define INT8_MAX 0x7f -#define INT16_MAX 0x7fff -#define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffffLL - -/* Maximum values of exact-width unsigned integer types. */ -#define UINT8_MAX 0xff -#define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#define UINT64_MAX 0xffffffffffffffffULL - -/* - * ISO/IEC 9899:1999 - * 7.18.2.2 Limits of minimum-width integer types - */ -/* Minimum values of minimum-width signed integer types. */ -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -/* Maximum values of minimum-width signed integer types. */ -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -/* Maximum values of minimum-width unsigned integer types. */ -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.3 Limits of fastest minimum-width integer types - */ -/* Minimum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MIN INT32_MIN -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST64_MIN INT64_MIN - -/* Maximum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MAX INT32_MAX -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MAX INT64_MAX - -/* Maximum values of fastest minimum-width unsigned integer types. */ -#define UINT_FAST8_MAX UINT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.4 Limits of integer types capable of holding object pointers - */ -#define INTPTR_MIN INT32_MIN -#define INTPTR_MAX INT32_MAX -#define UINTPTR_MAX UINT32_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.5 Limits of greatest-width integer types - */ -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.3 Limits of other integer types - */ -/* Limits of ptrdiff_t. */ -#define PTRDIFF_MIN INT32_MIN -#define PTRDIFF_MAX INT32_MAX - -/* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX - -/* Limit of size_t. */ -#define SIZE_MAX UINT32_MAX - -#ifndef WCHAR_MIN /* Also possibly defined in */ -/* Limits of wchar_t. */ -#define WCHAR_MIN INT32_MIN -#define WCHAR_MAX INT32_MAX -#endif - -/* Limits of wint_t. */ -#define WINT_MIN INT32_MIN -#define WINT_MAX INT32_MAX - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - -#endif /* !_MACHINE__STDINT_H_ */ +#include Modified: head/sys/pc98/include/_stdint.h ============================================================================== --- head/sys/pc98/include/_stdint.h Tue Feb 28 18:30:18 2012 (r232263) +++ head/sys/pc98/include/_stdint.h Tue Feb 28 18:38:33 2012 (r232264) @@ -3,4 +3,4 @@ */ /* $FreeBSD$ */ -#include +#include Copied and modified: head/sys/x86/include/_stdint.h (from r232259, head/sys/amd64/include/_stdint.h) ============================================================================== --- head/sys/amd64/include/_stdint.h Tue Feb 28 15:52:01 2012 (r232259, copy source) +++ head/sys/x86/include/_stdint.h Tue Feb 28 18:38:33 2012 (r232264) @@ -45,12 +45,18 @@ #define INT8_C(c) (c) #define INT16_C(c) (c) #define INT32_C(c) (c) -#define INT64_C(c) (c ## L) #define UINT8_C(c) (c) #define UINT16_C(c) (c) #define UINT32_C(c) (c ## U) + +#ifdef _LP64 +#define INT64_C(c) (c ## L) #define UINT64_C(c) (c ## UL) +#else +#define INT64_C(c) (c ## LL) +#define UINT64_C(c) (c ## ULL) +#endif #define INTMAX_C(c) INT64_C(c) #define UINTMAX_C(c) UINT64_C(c) @@ -67,19 +73,19 @@ #define INT8_MIN (-0x7f-1) #define INT16_MIN (-0x7fff-1) #define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffL-1) +#define INT64_MIN (-INT64_C(0x7fffffffffffffff)-1) /* Maximum values of exact-width signed integer types. */ #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffffL +#define INT64_MAX INT64_C(0x7fffffffffffffff) /* Maximum values of exact-width unsigned integer types. */ #define UINT8_MAX 0xff #define UINT16_MAX 0xffff #define UINT32_MAX 0xffffffffU -#define UINT64_MAX 0xffffffffffffffffUL +#define UINT64_MAX UINT64_C(0xffffffffffffffff) /* * ISO/IEC 9899:1999 @@ -129,9 +135,15 @@ * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ +#ifdef _LP64 #define INTPTR_MIN INT64_MIN #define INTPTR_MAX INT64_MAX #define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif /* * ISO/IEC 9899:1999 @@ -145,6 +157,7 @@ * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ +#ifdef _LP64 /* Limits of ptrdiff_t. */ #define PTRDIFF_MIN INT64_MIN #define PTRDIFF_MAX INT64_MAX @@ -155,6 +168,13 @@ /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX +#else +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX +#define SIZE_MAX UINT32_MAX +#endif #ifndef WCHAR_MIN /* Also possibly defined in */ /* Limits of wchar_t. */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 19:16:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 130AB106567A; Tue, 28 Feb 2012 19:16: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 D9E4E8FC12; Tue, 28 Feb 2012 19:16:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SJG23x084109; Tue, 28 Feb 2012 19:16:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SJG2JE084107; Tue, 28 Feb 2012 19:16:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202281916.q1SJG2JE084107@svn.freebsd.org> From: John Baldwin Date: Tue, 28 Feb 2012 19:16: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: r232265 - 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: Tue, 28 Feb 2012 19:16:03 -0000 Author: jhb Date: Tue Feb 28 19:16:02 2012 New Revision: 232265 URL: http://svn.freebsd.org/changeset/base/232265 Log: Properly clear a device's devclass if DEVICE_ATTACH() fails if the device does not have a fixed devclass. Reviewed by: imp MFC after: 2 weeks Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Tue Feb 28 18:38:33 2012 (r232264) +++ head/sys/kern/subr_bus.c Tue Feb 28 19:16:02 2012 (r232265) @@ -2732,9 +2732,8 @@ device_attach(device_t dev) if ((error = DEVICE_ATTACH(dev)) != 0) { printf("device_attach: %s%d attach returned %d\n", dev->driver->name, dev->unit, error); - /* Unset the class; set in device_probe_child */ - if (dev->devclass == NULL) - (void)device_set_devclass(dev, NULL); + if (!(dev->flags & DF_FIXEDCLASS)) + devclass_delete_device(dev->devclass, dev); (void)device_set_driver(dev, NULL); device_sysctl_fini(dev); dev->state = DS_NOTPRESENT; From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 19:39:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D13F106564A; Tue, 28 Feb 2012 19:39:55 +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 424298FC1D; Tue, 28 Feb 2012 19:39:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SJdtJM084863; Tue, 28 Feb 2012 19:39:55 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SJdtYr084858; Tue, 28 Feb 2012 19:39:55 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202281939.q1SJdtYr084858@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 28 Feb 2012 19: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: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 19:39:55 -0000 Author: tijl Date: Tue Feb 28 19:39:54 2012 New Revision: 232266 URL: http://svn.freebsd.org/changeset/base/232266 Log: Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace amd64/i386/pc98 endian.h with stubs. In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been resolved by reimplementing the macro in terms of __bswap32(x). As a side effect __bswap64_var(x) is now implemented using two bswap instructions on i386 and should be much faster. __bswap32_const(x) has been reimplemented in terms of __bswap16(x) for consistency. Added: head/sys/x86/include/endian.h - copied, changed from r232259, head/sys/amd64/include/endian.h Modified: head/sys/amd64/include/endian.h head/sys/i386/include/endian.h head/sys/pc98/include/endian.h Modified: head/sys/amd64/include/endian.h ============================================================================== --- head/sys/amd64/include/endian.h Tue Feb 28 19:16:02 2012 (r232265) +++ head/sys/amd64/include/endian.h Tue Feb 28 19:39:54 2012 (r232266) @@ -1,145 +1,6 @@ /*- - * Copyright (c) 1987, 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)endian.h 7.8 (Berkeley) 4/3/91 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 1 -#define _QUAD_LOWWORD 0 - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define _BYTE_ORDER _LITTLE_ENDIAN - -/* - * Deprecated variants that don't have enough underscores to be useful in more - * strict namespaces. - */ -#if __BSD_VISIBLE -#define LITTLE_ENDIAN _LITTLE_ENDIAN -#define BIG_ENDIAN _BIG_ENDIAN -#define PDP_ENDIAN _PDP_ENDIAN -#define BYTE_ORDER _BYTE_ORDER -#endif - -#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) - -#define __bswap64_const(_x) \ - (((_x) >> 56) | \ - (((_x) >> 40) & (0xffUL << 8)) | \ - (((_x) >> 24) & (0xffUL << 16)) | \ - (((_x) >> 8) & (0xffUL << 24)) | \ - (((_x) << 8) & (0xffUL << 32)) | \ - (((_x) << 24) & (0xffUL << 40)) | \ - (((_x) << 40) & (0xffUL << 48)) | \ - ((_x) << 56)) - -#define __bswap32_const(_x) \ - (((_x) >> 24) | \ - (((_x) & (0xff << 16)) >> 8) | \ - (((_x) & (0xff << 8)) << 8) | \ - ((_x) << 24)) - -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) - -static __inline __uint64_t -__bswap64_var(__uint64_t _x) -{ - - __asm ("bswap %0" : "+r" (_x)); - return (_x); -} - -static __inline __uint32_t -__bswap32_var(__uint32_t _x) -{ - - __asm ("bswap %0" : "+r" (_x)); - return (_x); -} - -static __inline __uint16_t -__bswap16_var(__uint16_t _x) -{ - - return (__bswap16_const(_x)); -} - -#define __bswap64(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) - -#define __bswap32(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) - -#define __bswap16(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) - -#define __htonl(x) __bswap32(x) -#define __htons(x) __bswap16(x) -#define __ntohl(x) __bswap32(x) -#define __ntohs(x) __bswap16(x) - -#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */ - -/* - * No optimizations are available for this compiler. Fall back to - * non-optimized functions by defining the constant usually used to prevent - * redefinition. - */ -#define _BYTEORDER_FUNC_DEFINED - -#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_MACHINE_ENDIAN_H_ */ +#include Modified: head/sys/i386/include/endian.h ============================================================================== --- head/sys/i386/include/endian.h Tue Feb 28 19:16:02 2012 (r232265) +++ head/sys/i386/include/endian.h Tue Feb 28 19:39:54 2012 (r232266) @@ -1,145 +1,6 @@ /*- - * Copyright (c) 1987, 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)endian.h 7.8 (Berkeley) 4/3/91 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 1 -#define _QUAD_LOWWORD 0 - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define _BYTE_ORDER _LITTLE_ENDIAN - -/* - * Deprecated variants that don't have enough underscores to be useful in more - * strict namespaces. - */ -#if __BSD_VISIBLE -#define LITTLE_ENDIAN _LITTLE_ENDIAN -#define BIG_ENDIAN _BIG_ENDIAN -#define PDP_ENDIAN _PDP_ENDIAN -#define BYTE_ORDER _BYTE_ORDER -#endif - -#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) - -#define __bswap64_const(_x) \ - (((_x) >> 56) | \ - (((_x) >> 40) & (0xffULL << 8)) | \ - (((_x) >> 24) & (0xffULL << 16)) | \ - (((_x) >> 8) & (0xffULL << 24)) | \ - (((_x) << 8) & (0xffULL << 32)) | \ - (((_x) << 24) & (0xffULL << 40)) | \ - (((_x) << 40) & (0xffULL << 48)) | \ - ((_x) << 56)) - -#define __bswap32_const(_x) \ - (((_x) >> 24) | \ - (((_x) & (0xff << 16)) >> 8) | \ - (((_x) & (0xff << 8)) << 8) | \ - ((_x) << 24)) - -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) - -static __inline __uint64_t -__bswap64_var(__uint64_t __x) -{ - - return __bswap64_const(__x); -} - - -static __inline __uint32_t -__bswap32_var(__uint32_t _x) -{ - - __asm ("bswap %0" : "+r" (_x)); - return (_x); -} - -static __inline __uint16_t -__bswap16_var(__uint16_t _x) -{ - - return (__bswap16_const(_x)); -} - -#define __bswap64(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) - -#define __bswap32(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) - -#define __bswap16(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) - -#define __htonl(x) __bswap32(x) -#define __htons(x) __bswap16(x) -#define __ntohl(x) __bswap32(x) -#define __ntohs(x) __bswap16(x) - -#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */ - -/* - * No optimizations are available for this compiler. Fall back to - * non-optimized functions by defining the constant usually used to prevent - * redefinition. - */ -#define _BYTEORDER_FUNC_DEFINED - -#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_MACHINE_ENDIAN_H_ */ +#include Modified: head/sys/pc98/include/endian.h ============================================================================== --- head/sys/pc98/include/endian.h Tue Feb 28 19:16:02 2012 (r232265) +++ head/sys/pc98/include/endian.h Tue Feb 28 19:39:54 2012 (r232266) @@ -3,4 +3,4 @@ */ /* $FreeBSD$ */ -#include +#include Copied and modified: head/sys/x86/include/endian.h (from r232259, head/sys/amd64/include/endian.h) ============================================================================== --- head/sys/amd64/include/endian.h Tue Feb 28 15:52:01 2012 (r232259, copy source) +++ head/sys/x86/include/endian.h Tue Feb 28 19:39:54 2012 (r232266) @@ -69,30 +69,31 @@ extern "C" { #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) -#define __bswap64_const(_x) \ - (((_x) >> 56) | \ - (((_x) >> 40) & (0xffUL << 8)) | \ - (((_x) >> 24) & (0xffUL << 16)) | \ - (((_x) >> 8) & (0xffUL << 24)) | \ - (((_x) << 8) & (0xffUL << 32)) | \ - (((_x) << 24) & (0xffUL << 40)) | \ - (((_x) << 40) & (0xffUL << 48)) | \ - ((_x) << 56)) - -#define __bswap32_const(_x) \ - (((_x) >> 24) | \ - (((_x) & (0xff << 16)) >> 8) | \ - (((_x) & (0xff << 8)) << 8) | \ - ((_x) << 24)) +#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) +#define __bswap16(_x) \ + (__builtin_constant_p(_x) ? \ + __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) -static __inline __uint64_t -__bswap64_var(__uint64_t _x) +#define __bswap32_const(_x) \ + (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) + +#define __bswap32(_x) \ + (__builtin_constant_p(_x) ? \ + __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) + +#define __bswap64_const(_x) \ + (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32)) + +#define __bswap64(_x) \ + (__builtin_constant_p(_x) ? \ + __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) + +static __inline __uint16_t +__bswap16_var(__uint16_t _x) { - __asm ("bswap %0" : "+r" (_x)); - return (_x); + return (__bswap16_const(_x)); } static __inline __uint32_t @@ -103,25 +104,17 @@ __bswap32_var(__uint32_t _x) return (_x); } -static __inline __uint16_t -__bswap16_var(__uint16_t _x) +static __inline __uint64_t +__bswap64_var(__uint64_t _x) { - - return (__bswap16_const(_x)); +#ifdef _LP64 + __asm ("bswap %0" : "+r" (_x)); + return (_x); +#else + return (__bswap64_const(_x)); +#endif } -#define __bswap64(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) - -#define __bswap32(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) - -#define __bswap16(_x) \ - (__builtin_constant_p(_x) ? \ - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) - #define __htonl(x) __bswap32(x) #define __htons(x) __bswap16(x) #define __ntohl(x) __bswap32(x) From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 19:42:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D079106566C; Tue, 28 Feb 2012 19:42:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CB698FC12; Tue, 28 Feb 2012 19:42:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SJge2E084976; Tue, 28 Feb 2012 19:42:40 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SJgeed084974; Tue, 28 Feb 2012 19:42:40 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202281942.q1SJgeed084974@svn.freebsd.org> From: Ed Maste Date: Tue, 28 Feb 2012 19:42: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: r232267 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 19:42:40 -0000 Author: emaste Date: Tue Feb 28 19:42:40 2012 New Revision: 232267 URL: http://svn.freebsd.org/changeset/base/232267 Log: Workaround for PCIe 4GB boundary issue Enforce a boundary of no more than 4GB - transfers crossing a 4GB boundary can lead to data corruption due to PCIe limitations. This change is a less-intrusive workaround that can be quickly merged back to older branches; a cleaner implementation will arrive in HEAD later but may require KPI changes. This change is based on a suggestion by jhb@. Reviewed by: scottl, jhb Sponsored by: Sandvine Incorporated MFC after: 3 days Modified: head/sys/x86/x86/busdma_machdep.c Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Tue Feb 28 19:39:54 2012 (r232266) +++ head/sys/x86/x86/busdma_machdep.c Tue Feb 28 19:42:40 2012 (r232267) @@ -227,6 +227,14 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; + /* Always enforce at least a 4GB (2GB for PAE) boundary. */ +#if defined(__amd64__) + if (boundary == 0 || boundary > ((bus_addr_t)1 << 32)) + boundary = (bus_size_t)1 << 32; +#elif defined(PAE) + if (boundary == 0 || boundary > ((bus_addr_t)1 << 31)) + boundary = (bus_size_t)1 << 31; +#endif /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 19:45:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id AEAAC106566C; Tue, 28 Feb 2012 19:45:20 +0000 (UTC) Date: Tue, 28 Feb 2012 19:45:20 +0000 From: Alexander Best To: Jilles Tjoelker Message-ID: <20120228194520.GA56030@freebsd.org> References: <201202261514.q1QFET0v070810@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201202261514.q1QFET0v070810@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232183 - 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: Tue, 28 Feb 2012 19:45:20 -0000 On Sun Feb 26 12, Jilles Tjoelker wrote: > Author: jilles > Date: Sun Feb 26 15:14:29 2012 > New Revision: 232183 > URL: http://svn.freebsd.org/changeset/base/232183 > > Log: > Fix fchmod() and fchown() on fifos. > > The new fifo implementation in r232055 broke fchmod() and fchown() on fifos. > Postfix needs this. clang seems to have a problem with this commit: usr/subversion-src/sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of K&R function parameter is not compatible with the parameter type 'mode_t' (aka 'unsigned short') declared in a previous prototype [-Werror] mode_t mode; ^ /usr/subversion-src/sys/kern/sys_pipe.c:155:19: note: previous declaration is here static fo_chmod_t pipe_chmod; ^ 1 error generated. *** Error code 1 cheers. alex > > Submitted by: gianni > Reported by: dougb > > Modified: > head/sys/kern/sys_pipe.c > > Modified: head/sys/kern/sys_pipe.c > ============================================================================== > --- head/sys/kern/sys_pipe.c Sun Feb 26 14:27:34 2012 (r232182) > +++ head/sys/kern/sys_pipe.c Sun Feb 26 15:14:29 2012 (r232183) > @@ -152,6 +152,8 @@ static fo_poll_t pipe_poll; > static fo_kqfilter_t pipe_kqfilter; > static fo_stat_t pipe_stat; > static fo_close_t pipe_close; > +static fo_chmod_t pipe_chmod; > +static fo_chown_t pipe_chown; > > struct fileops pipeops = { > .fo_read = pipe_read, > @@ -162,8 +164,8 @@ struct fileops pipeops = { > .fo_kqfilter = pipe_kqfilter, > .fo_stat = pipe_stat, > .fo_close = pipe_close, > - .fo_chmod = invfo_chmod, > - .fo_chown = invfo_chown, > + .fo_chmod = pipe_chmod, > + .fo_chown = pipe_chown, > .fo_flags = DFLAG_PASSABLE > }; > > @@ -1548,6 +1550,43 @@ pipe_close(fp, td) > return (0); > } > > +static int > +pipe_chmod(fp, mode, active_cred, td) > + struct file *fp; > + mode_t mode; > + struct ucred *active_cred; > + struct thread *td; > +{ > + struct pipe *cpipe; > + int error; > + > + cpipe = fp->f_data; > + if (cpipe->pipe_state & PIPE_NAMED) > + error = vn_chmod(fp, mode, active_cred, td); > + else > + error = invfo_chmod(fp, mode, active_cred, td); > + return (error); > +} > + > +static int > +pipe_chown(fp, uid, gid, active_cred, td) > + struct file *fp; > + uid_t uid; > + gid_t gid; > + struct ucred *active_cred; > + struct thread *td; > +{ > + struct pipe *cpipe; > + int error; > + > + cpipe = fp->f_data; > + if (cpipe->pipe_state & PIPE_NAMED) > + error = vn_chown(fp, uid, gid, active_cred, td); > + else > + error = invfo_chown(fp, uid, gid, active_cred, td); > + return (error); > +} > + > static void > pipe_free_kmem(cpipe) > struct pipe *cpipe; From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 19:50:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CB90106564A; Tue, 28 Feb 2012 19:50:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C4D58FC0C; Tue, 28 Feb 2012 19:50:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SJoFuR085291; Tue, 28 Feb 2012 19:50:15 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SJoFur085289; Tue, 28 Feb 2012 19:50:15 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202281950.q1SJoFur085289@svn.freebsd.org> From: Ed Maste Date: Tue, 28 Feb 2012 19:50: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: r232268 - head/sys/dev/aac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 19:50:15 -0000 Author: emaste Date: Tue Feb 28 19:50:14 2012 New Revision: 232268 URL: http://svn.freebsd.org/changeset/base/232268 Log: Revert r232260. The problem is now fixed by a general workaround in r232267. Modified: head/sys/dev/aac/aac_pci.c Modified: head/sys/dev/aac/aac_pci.c ============================================================================== --- head/sys/dev/aac/aac_pci.c Tue Feb 28 19:42:40 2012 (r232267) +++ head/sys/dev/aac/aac_pci.c Tue Feb 28 19:50:14 2012 (r232268) @@ -403,8 +403,7 @@ aac_pci_attach(device_t dev) * Note that some of these controllers are 64-bit capable. */ if (bus_dma_tag_create(NULL, /* parent */ - PAGE_SIZE, /* alignment */ - ((bus_size_t)((uint64_t)1 << 32)), /* boundary*/ + PAGE_SIZE, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 20:56:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ADD7106564A; Tue, 28 Feb 2012 20:56:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id DE5CF8FC08; Tue, 28 Feb 2012 20:56:00 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:40c7:bfc6:1449:f9dd] (unknown [IPv6:2001:7b8:3a7:0:40c7:bfc6:1449:f9dd]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 875A05C37; Tue, 28 Feb 2012 21:55:58 +0100 (CET) Message-ID: <4F4D3F5D.70905@FreeBSD.org> Date: Tue, 28 Feb 2012 21:55:57 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120216 Thunderbird/11.0 MIME-Version: 1.0 To: Tijl Coosemans References: <201202281939.q1SJdtYr084858@svn.freebsd.org> In-Reply-To: <201202281939.q1SJdtYr084858@svn.freebsd.org> X-Enigmail-Version: 1.4a1pre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 20:56:01 -0000 On 2012-02-28 20:39, Tijl Coosemans wrote: > Author: tijl > Date: Tue Feb 28 19:39:54 2012 > New Revision: 232266 > URL: http://svn.freebsd.org/changeset/base/232266 > > Log: > Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace > amd64/i386/pc98 endian.h with stubs. > > In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been > resolved by reimplementing the macro in terms of __bswap32(x). As a side > effect __bswap64_var(x) is now implemented using two bswap instructions on > i386 and should be much faster. __bswap32_const(x) has been reimplemented > in terms of __bswap16(x) for consistency. ... > +#define __bswap32_const(_x) \ > + (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) > + > +#define __bswap32(_x) \ > + (__builtin_constant_p(_x) ? \ > + __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) > + > +#define __bswap64_const(_x) \ > + (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32)) Hmm, shouldn't __bswap32_const() be implemented in terms of __bswap16_const(), and similarly for __bswap64_const(), which should be implemented in terms of __bswap32_const()? The whole reason for the difficult dance with __builtin_constant_p is to allow for compile-time resolving of bswap'd constants. Invoking the regular __bswap() macros doesn't gain you anything here. From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 20:56:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11F751065673; Tue, 28 Feb 2012 20:56:20 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id B94A38FC17; Tue, 28 Feb 2012 20:56:19 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1S2Tlb-000ETm-V8; Wed, 29 Feb 2012 00:35:23 +0400 Date: Wed, 29 Feb 2012 00:35:23 +0400 From: Slawa Olhovchenkov To: Luigi Rizzo Message-ID: <20120228203523.GB97848@zxy.spb.ru> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> <20120228073122.GC57270@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120228073122.GC57270@onelab2.iet.unipi.it> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Ben Kaduk Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 20:56:20 -0000 On Tue, Feb 28, 2012 at 08:31:22AM +0100, Luigi Rizzo wrote: > On Mon, Feb 27, 2012 at 07:05:45PM -0500, Ben Kaduk wrote: > ... > > > ?1. add support for devices with different number of rx and tx queues; > > > > > > ?2. add better support for zero-copy operation, adding an extra field > > > ? ? to the netmap ring to indicate how many buffers we have already processed > > > ? ? but not yet released (with help from Eddie Kohler); > > > > > > ?3. The two changes above unfortunately require an API change, so while > > > ? ? at it add a version field and some spares to the ioctl() argument > > > ? ? to help detect mismatches. > > > > Is it worth bumping __FreeBSD_version? > > I don't think it is necessary. > There is basically no code that uses the netmap API except for > the examples in tools/tools/netmap, and i now have a NETMAP_API macro no code in *FreeBSD base system*, yes? because I am write tools uses the netmap API now. > that defines the version without the need for using __FreeBSD_version From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 21:32:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 350E5106564A; Tue, 28 Feb 2012 21:32:36 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay012.isp.belgacom.be (mailrelay012.isp.belgacom.be [195.238.6.179]) by mx1.freebsd.org (Postfix) with ESMTP id 2559F8FC16; Tue, 28 Feb 2012 21:32:34 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EAOhETU9bsWst/2dsb2JhbABDhSeuLIEIgXcBAQUjMxYKAxALDgYEKgICOR4GiB8Hpm2SGI0TDQ8CAj4UBgMChQgKPweCOoEWBKgw Received: from 45.107-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.107.45]) by relay.skynet.be with ESMTP; 28 Feb 2012 22:22:29 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q1SLMS6M006493; Tue, 28 Feb 2012 22:22:28 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Dimitry Andric Date: Tue, 28 Feb 2012 22:22:20 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <4F4D3F5D.70905@FreeBSD.org> In-Reply-To: <4F4D3F5D.70905@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1486186.v0UtTdUSRE"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201202282222.26343.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 21:32:36 -0000 --nextPart1486186.v0UtTdUSRE Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tuesday 28 February 2012 21:55:57 Dimitry Andric wrote: > On 2012-02-28 20:39, Tijl Coosemans wrote: >> Author: tijl >> Date: Tue Feb 28 19:39:54 2012 >> New Revision: 232266 >> URL: http://svn.freebsd.org/changeset/base/232266 >>=20 >> Log: >> Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace >> amd64/i386/pc98 endian.h with stubs. >> =20 >> In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been >> resolved by reimplementing the macro in terms of __bswap32(x). As a si= de >> effect __bswap64_var(x) is now implemented using two bswap instruction= s on >> i386 and should be much faster. __bswap32_const(x) has been reimplemen= ted >> in terms of __bswap16(x) for consistency. > ... >> +#define __bswap32_const(_x) \ >> + (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) >> + >> +#define __bswap32(_x) \ >> + (__builtin_constant_p(_x) ? \ >> + __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) >> + >> +#define __bswap64_const(_x) \ >> + (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32)) >=20 > Hmm, shouldn't __bswap32_const() be implemented in terms of > __bswap16_const(), and similarly for __bswap64_const(), which should be > implemented in terms of __bswap32_const()? >=20 > The whole reason for the difficult dance with __builtin_constant_p is to > allow for compile-time resolving of bswap'd constants. Invoking the > regular __bswap() macros doesn't gain you anything here. __bswap64_const is also used in __bswap64_var, so its argument isn't always a compile time constant and then __bswap32 becomes __bswap32_var. If it is a constant __bswap32 becomes __bswap32_const (even at -O0). --nextPart1486186.v0UtTdUSRE Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk9NRZIACgkQfoCS2CCgtitN6AD8DQEnzXs8/yF/R0V/q8r/QqKT 4LPpT2qnabaPO9u4XPkA/2THbeoN9I7c1DAty5t4EBlZw31uf8dThiNUkl1d5HIq =XmI7 -----END PGP SIGNATURE----- --nextPart1486186.v0UtTdUSRE-- From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 21:40:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9250D106566B; Tue, 28 Feb 2012 21:40:43 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 4B37E8FC14; Tue, 28 Feb 2012 21:40:42 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 298627300A; Tue, 28 Feb 2012 22:58:56 +0100 (CET) Date: Tue, 28 Feb 2012 22:58:56 +0100 From: Luigi Rizzo To: Slawa Olhovchenkov Message-ID: <20120228215856.GA99692@onelab2.iet.unipi.it> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> <20120228073122.GC57270@onelab2.iet.unipi.it> <20120228203523.GB97848@zxy.spb.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120228203523.GB97848@zxy.spb.ru> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Ben Kaduk Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 21:40:43 -0000 On Wed, Feb 29, 2012 at 12:35:23AM +0400, Slawa Olhovchenkov wrote: ... > > > > ?3. The two changes above unfortunately require an API change, so while > > > > ? ? at it add a version field and some spares to the ioctl() argument > > > > ? ? to help detect mismatches. > > > > > > Is it worth bumping __FreeBSD_version? > > > > I don't think it is necessary. > > There is basically no code that uses the netmap API except for > > the examples in tools/tools/netmap, and i now have a NETMAP_API macro > > no code in *FreeBSD base system*, yes? > because I am write tools uses the netmap API now. i am glad to hear that, and the NETMAP_API will serve you well because you can use the same also on the Linux version of netmap cheers luigi From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 21:41:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CA45106566B; Tue, 28 Feb 2012 21:41:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C36A8FC08; Tue, 28 Feb 2012 21:41:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SLfmrg093468; Tue, 28 Feb 2012 21:41:48 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SLfmRx093466; Tue, 28 Feb 2012 21:41:48 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202282141.q1SLfmRx093466@svn.freebsd.org> From: Adrian Chadd Date: Tue, 28 Feb 2012 21:41: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: r232269 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 21:41:48 -0000 Author: adrian Date: Tue Feb 28 21:41:47 2012 New Revision: 232269 URL: http://svn.freebsd.org/changeset/base/232269 Log: Print out the bogus beacon interval. Modified: head/sys/net80211/ieee80211_input.c Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Tue Feb 28 19:50:14 2012 (r232268) +++ head/sys/net80211/ieee80211_input.c Tue Feb 28 21:41:47 2012 (r232269) @@ -652,7 +652,8 @@ ieee80211_parse_beacon(struct ieee80211_ scan->bintval <= IEEE80211_BINTVAL_MAX)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID | IEEE80211_MSG_INPUT, - wh, NULL, "bogus beacon interval", scan->bintval); + wh, NULL, "bogus beacon interval (%d TU)", + (int) scan->bintval); vap->iv_stats.is_rx_badbintval++; scan->status |= IEEE80211_BPARSE_BINTVAL_INVALID; } From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 21:43:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D681D106567B; Tue, 28 Feb 2012 21:43:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C61BE8FC0A; Tue, 28 Feb 2012 21:43:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SLhTe1093551; Tue, 28 Feb 2012 21:43:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SLhTFg093549; Tue, 28 Feb 2012 21:43:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202282143.q1SLhTFg093549@svn.freebsd.org> From: Adrian Chadd Date: Tue, 28 Feb 2012 21:43: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: r232270 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 21:43:29 -0000 Author: adrian Date: Tue Feb 28 21:43:29 2012 New Revision: 232270 URL: http://svn.freebsd.org/changeset/base/232270 Log: Only increment is_beacon_bad if we're not scanning. Otherwise things such as off-channel probe responses and beacons are also silently discarded and logged against this error counter. Modified: head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Tue Feb 28 21:41:47 2012 (r232269) +++ head/sys/net80211/ieee80211_sta.c Tue Feb 28 21:43:29 2012 (r232270) @@ -1306,7 +1306,8 @@ sta_recv_mgmt(struct ieee80211_node *ni, } /* XXX probe response in sta mode when !scanning? */ if (ieee80211_parse_beacon(ni, m0, &scan) != 0) { - vap->iv_stats.is_beacon_bad++; + if (! (ic->ic_flags & IEEE80211_F_SCAN)) + vap->iv_stats.is_beacon_bad++; return; } /* From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 21:45:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18DAD106566C; Tue, 28 Feb 2012 21:45:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 089E58FC13; Tue, 28 Feb 2012 21:45:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SLjLMP093660; Tue, 28 Feb 2012 21:45:21 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SLjLpO093657; Tue, 28 Feb 2012 21:45:21 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202282145.q1SLjLpO093657@svn.freebsd.org> From: Dimitry Andric Date: Tue, 28 Feb 2012 21:45: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: r232271 - 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: Tue, 28 Feb 2012 21:45:22 -0000 Author: dim Date: Tue Feb 28 21:45:21 2012 New Revision: 232271 URL: http://svn.freebsd.org/changeset/base/232271 Log: Change definition of pipe_chmod() from K&R to C99, to avoid the following clang warning: sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of K&R function parameter is not compatible with the parameter type 'mode_t' (aka 'unsigned short') declared in a previous prototype [-Werror] mode_t mode; ^ sys/kern/sys_pipe.c:155:19: note: previous declaration is here static fo_chmod_t pipe_chmod; ^ Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Feb 28 21:43:29 2012 (r232270) +++ head/sys/kern/sys_pipe.c Tue Feb 28 21:45:21 2012 (r232271) @@ -1551,11 +1551,7 @@ pipe_close(fp, td) } static int -pipe_chmod(fp, mode, active_cred, td) - struct file *fp; - mode_t mode; - struct ucred *active_cred; - struct thread *td; +pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td) { struct pipe *cpipe; int error; From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 21:53:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AB9D106566B; Tue, 28 Feb 2012 21:53:40 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3AAA8FC0A; Tue, 28 Feb 2012 21:53:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SLrdqI093938; Tue, 28 Feb 2012 21:53:39 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SLrdfQ093936; Tue, 28 Feb 2012 21:53:39 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <201202282153.q1SLrdfQ093936@svn.freebsd.org> From: Oleg Bulyzhin Date: Tue, 28 Feb 2012 21:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232272 - 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: Tue, 28 Feb 2012 21:53:40 -0000 Author: oleg Date: Tue Feb 28 21:53:39 2012 New Revision: 232272 URL: http://svn.freebsd.org/changeset/base/232272 Log: lookup_dyn_rule_locked(): style(9) cleanup MFC after: 1 month Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 21:45:21 2012 (r232271) +++ head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 21:53:39 2012 (r232272) @@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r IPFW_DYN_UNLOCK(); } -/** - * lookup a dynamic rule, locked version +/* + * Lookup a dynamic rule, locked version. */ static ipfw_dyn_rule * lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction, struct tcphdr *tcp) { /* - * stateful ipfw extensions. - * Lookup into dynamic session queue + * Stateful ipfw extensions. + * Lookup into dynamic session queue. */ #define MATCH_REVERSE 0 #define MATCH_FORWARD 1 #define MATCH_NONE 2 #define MATCH_UNKNOWN 3 int i, dir = MATCH_NONE; - ipfw_dyn_rule *prev, *q=NULL; + ipfw_dyn_rule *prev, *q = NULL; IPFW_DYN_LOCK_ASSERT(); if (V_ipfw_dyn_v == NULL) - goto done; /* not found */ - i = hash_packet( pkt ); - for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) { + goto done; /* not found */ + i = hash_packet(pkt); + for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) { if (q->dyn_type == O_LIMIT_PARENT && q->count) goto next; - if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */ + if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */ UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); continue; } - if (pkt->proto == q->id.proto && - q->dyn_type != O_LIMIT_PARENT) { - if (IS_IP6_FLOW_ID(pkt)) { - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.src_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.dst_ip6)) && + if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT) + goto next; + + if (IS_IP6_FLOW_ID(pkt)) { + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) && + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) && pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port ) { + pkt->dst_port == q->id.dst_port) { dir = MATCH_FORWARD; break; - } - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.dst_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.src_ip6)) && - pkt->src_port == q->id.dst_port && - pkt->dst_port == q->id.src_port ) { - dir = MATCH_REVERSE; - break; - } - } else { - if (pkt->src_ip == q->id.src_ip && - pkt->dst_ip == q->id.dst_ip && - pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port ) { - dir = MATCH_FORWARD; - break; - } - if (pkt->src_ip == q->id.dst_ip && - pkt->dst_ip == q->id.src_ip && - pkt->src_port == q->id.dst_port && - pkt->dst_port == q->id.src_port ) { - dir = MATCH_REVERSE; - break; - } + } + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) && + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) && + pkt->src_port == q->id.dst_port && + pkt->dst_port == q->id.src_port) { + dir = MATCH_REVERSE; + break; + } + } else { + if (pkt->src_ip == q->id.src_ip && + pkt->dst_ip == q->id.dst_ip && + pkt->src_port == q->id.src_port && + pkt->dst_port == q->id.dst_port) { + dir = MATCH_FORWARD; + break; + } + if (pkt->src_ip == q->id.dst_ip && + pkt->dst_ip == q->id.src_ip && + pkt->src_port == q->id.dst_port && + pkt->dst_port == q->id.src_port) { + dir = MATCH_REVERSE; + break; } } next: @@ -463,43 +459,45 @@ next: q = q->next; } if (q == NULL) - goto done; /* q = NULL, not found */ + goto done; /* q = NULL, not found */ - if ( prev != NULL) { /* found and not in front */ + if (prev != NULL) { /* found and not in front */ prev->next = q->next; q->next = V_ipfw_dyn_v[i]; V_ipfw_dyn_v[i] = q; } if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */ - u_char flags = pkt->_flags & (TH_FIN|TH_SYN|TH_RST); + uint32_t ack; + u_char flags = pkt->_flags & (TH_FIN | TH_SYN | TH_RST); #define BOTH_SYN (TH_SYN | (TH_SYN << 8)) #define BOTH_FIN (TH_FIN | (TH_FIN << 8)) - q->state |= (dir == MATCH_FORWARD ) ? flags : (flags << 8); + q->state |= (dir == MATCH_FORWARD) ? flags : (flags << 8); switch (q->state) { - case TH_SYN: /* opening */ + case TH_SYN: /* opening */ q->expire = time_uptime + V_dyn_syn_lifetime; break; case BOTH_SYN: /* move to established */ - case BOTH_SYN | TH_FIN : /* one side tries to close */ - case BOTH_SYN | (TH_FIN << 8) : - if (tcp) { + case BOTH_SYN | TH_FIN: /* one side tries to close */ + case BOTH_SYN | (TH_FIN << 8): #define _SEQ_GE(a,b) ((int)(a) - (int)(b) >= 0) - u_int32_t ack = ntohl(tcp->th_ack); - if (dir == MATCH_FORWARD) { + if (tcp == NULL) { + q->expire = time_uptime + V_dyn_ack_lifetime; + break; + } + + ack = ntohl(tcp->th_ack); + if (dir == MATCH_FORWARD) { if (q->ack_fwd == 0 || _SEQ_GE(ack, q->ack_fwd)) - q->ack_fwd = ack; - else { /* ignore out-of-sequence */ - break; - } - } else { + q->ack_fwd = ack; + else /* ignore out-of-sequence */ + break; + } else { if (q->ack_rev == 0 || _SEQ_GE(ack, q->ack_rev)) - q->ack_rev = ack; - else { /* ignore out-of-sequence */ - break; - } - } + q->ack_rev = ack; + else /* ignore out-of-sequence */ + break; } q->expire = time_uptime + V_dyn_ack_lifetime; break; @@ -531,9 +529,9 @@ next: q->expire = time_uptime + V_dyn_short_lifetime; } done: - if (match_direction) + if (match_direction != NULL) *match_direction = dir; - return q; + return (q); } ipfw_dyn_rule * From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:00:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDDF2106564A; Tue, 28 Feb 2012 22:00:41 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2DDF8FC13; Tue, 28 Feb 2012 22:00:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SM0f25094205; Tue, 28 Feb 2012 22:00:41 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SM0f5R094203; Tue, 28 Feb 2012 22:00:41 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <201202282200.q1SM0f5R094203@svn.freebsd.org> From: Oleg Bulyzhin Date: Tue, 28 Feb 2012 22:00: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: r232273 - 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: Tue, 28 Feb 2012 22:00:42 -0000 Author: oleg Date: Tue Feb 28 22:00:41 2012 New Revision: 232273 URL: http://svn.freebsd.org/changeset/base/232273 Log: - Refresh dynamic tcp rule only if both sides answered keepalive packets. - Remove some useless assignments. MFC after: 1 month Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 21:53:39 2012 (r232272) +++ head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 22:00:41 2012 (r232273) @@ -472,8 +472,12 @@ next: #define BOTH_SYN (TH_SYN | (TH_SYN << 8)) #define BOTH_FIN (TH_FIN | (TH_FIN << 8)) +#define TCP_FLAGS (TH_FLAGS | (TH_FLAGS << 8)) +#define ACK_FWD 0x10000 /* fwd ack seen */ +#define ACK_REV 0x20000 /* rev ack seen */ + q->state |= (dir == MATCH_FORWARD) ? flags : (flags << 8); - switch (q->state) { + switch (q->state & TCP_FLAGS) { case TH_SYN: /* opening */ q->expire = time_uptime + V_dyn_syn_lifetime; break; @@ -482,24 +486,28 @@ next: case BOTH_SYN | TH_FIN: /* one side tries to close */ case BOTH_SYN | (TH_FIN << 8): #define _SEQ_GE(a,b) ((int)(a) - (int)(b) >= 0) - if (tcp == NULL) { - q->expire = time_uptime + V_dyn_ack_lifetime; + if (tcp == NULL) break; - } ack = ntohl(tcp->th_ack); if (dir == MATCH_FORWARD) { - if (q->ack_fwd == 0 || _SEQ_GE(ack, q->ack_fwd)) + if (q->ack_fwd == 0 || + _SEQ_GE(ack, q->ack_fwd)) { q->ack_fwd = ack; - else /* ignore out-of-sequence */ - break; + q->state |= ACK_FWD; + } } else { - if (q->ack_rev == 0 || _SEQ_GE(ack, q->ack_rev)) + if (q->ack_rev == 0 || + _SEQ_GE(ack, q->ack_rev)) { q->ack_rev = ack; - else /* ignore out-of-sequence */ - break; + q->state |= ACK_REV; + } + } + if ((q->state & (ACK_FWD | ACK_REV)) == + (ACK_FWD | ACK_REV)) { + q->expire = time_uptime + V_dyn_ack_lifetime; + q->state &= ~(ACK_FWD | ACK_REV); } - q->expire = time_uptime + V_dyn_ack_lifetime; break; case BOTH_SYN | BOTH_FIN: /* both sides closed */ @@ -1074,10 +1082,12 @@ ipfw_tick(void * vnetx) if (TIME_LEQ(q->expire, time_uptime)) continue; /* too late, rule expired */ - m = ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1, - q->ack_fwd, TH_SYN); - mnext = ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1, - q->ack_rev, 0); + m = (q->state & ACK_REV) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1, + q->ack_fwd, TH_SYN); + mnext = (q->state & ACK_FWD) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1, + q->ack_rev, 0); switch (q->id.addr_type) { case 4: @@ -1103,18 +1113,16 @@ ipfw_tick(void * vnetx) break; #endif } - - m = mnext = NULL; } } IPFW_DYN_UNLOCK(); - for (m = mnext = m0; m != NULL; m = mnext) { + for (m = m0; m != NULL; m = mnext) { mnext = m->m_nextpkt; m->m_nextpkt = NULL; ip_output(m, NULL, NULL, 0, NULL, NULL); } #ifdef INET6 - for (m = mnext = m6; m != NULL; m = mnext) { + for (m = m6; m != NULL; m = mnext) { mnext = m->m_nextpkt; m->m_nextpkt = NULL; ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:04:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04421106566B; Tue, 28 Feb 2012 22:04:40 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 5D70C8FC1D; Tue, 28 Feb 2012 22:04:39 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 758227300B; Tue, 28 Feb 2012 23:22:52 +0100 (CET) Date: Tue, 28 Feb 2012 23:22:52 +0100 From: Luigi Rizzo To: Oleg Bulyzhin Message-ID: <20120228222252.GA801@onelab2.iet.unipi.it> References: <201202282153.q1SLrdfQ093936@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201202282153.q1SLrdfQ093936@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: r232272 - 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: Tue, 28 Feb 2012 22:04:40 -0000 On Tue, Feb 28, 2012 at 09:53:39PM +0000, Oleg Bulyzhin wrote: > Author: oleg > Date: Tue Feb 28 21:53:39 2012 > New Revision: 232272 > URL: http://svn.freebsd.org/changeset/base/232272 > > Log: > lookup_dyn_rule_locked(): style(9) cleanup > > MFC after: 1 month is there a reason for delaying the MFC, such as this is preparatory work for further changes ? Otherwise i'd suggest that whitespace changes like this are quickly pushed to the stable branch so that the code versions do not diverge. cheers luigi > Modified: > head/sys/netinet/ipfw/ip_fw_dynamic.c > > Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c > ============================================================================== > --- head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 21:45:21 2012 (r232271) > +++ head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 21:53:39 2012 (r232272) > @@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r > IPFW_DYN_UNLOCK(); > } > > -/** > - * lookup a dynamic rule, locked version > +/* > + * Lookup a dynamic rule, locked version. > */ > static ipfw_dyn_rule * > lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction, > struct tcphdr *tcp) > { > /* > - * stateful ipfw extensions. > - * Lookup into dynamic session queue > + * Stateful ipfw extensions. > + * Lookup into dynamic session queue. > */ > #define MATCH_REVERSE 0 > #define MATCH_FORWARD 1 > #define MATCH_NONE 2 > #define MATCH_UNKNOWN 3 > int i, dir = MATCH_NONE; > - ipfw_dyn_rule *prev, *q=NULL; > + ipfw_dyn_rule *prev, *q = NULL; > > IPFW_DYN_LOCK_ASSERT(); > > if (V_ipfw_dyn_v == NULL) > - goto done; /* not found */ > - i = hash_packet( pkt ); > - for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) { > + goto done; /* not found */ > + i = hash_packet(pkt); > + for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) { > if (q->dyn_type == O_LIMIT_PARENT && q->count) > goto next; > - if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */ > + if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */ > UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); > continue; > } > - if (pkt->proto == q->id.proto && > - q->dyn_type != O_LIMIT_PARENT) { > - if (IS_IP6_FLOW_ID(pkt)) { > - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), > - &(q->id.src_ip6)) && > - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), > - &(q->id.dst_ip6)) && > + if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT) > + goto next; > + > + if (IS_IP6_FLOW_ID(pkt)) { > + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) && > + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) && > pkt->src_port == q->id.src_port && > - pkt->dst_port == q->id.dst_port ) { > + pkt->dst_port == q->id.dst_port) { > dir = MATCH_FORWARD; > break; > - } > - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), > - &(q->id.dst_ip6)) && > - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), > - &(q->id.src_ip6)) && > - pkt->src_port == q->id.dst_port && > - pkt->dst_port == q->id.src_port ) { > - dir = MATCH_REVERSE; > - break; > - } > - } else { > - if (pkt->src_ip == q->id.src_ip && > - pkt->dst_ip == q->id.dst_ip && > - pkt->src_port == q->id.src_port && > - pkt->dst_port == q->id.dst_port ) { > - dir = MATCH_FORWARD; > - break; > - } > - if (pkt->src_ip == q->id.dst_ip && > - pkt->dst_ip == q->id.src_ip && > - pkt->src_port == q->id.dst_port && > - pkt->dst_port == q->id.src_port ) { > - dir = MATCH_REVERSE; > - break; > - } > + } > + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) && > + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) && > + pkt->src_port == q->id.dst_port && > + pkt->dst_port == q->id.src_port) { > + dir = MATCH_REVERSE; > + break; > + } > + } else { > + if (pkt->src_ip == q->id.src_ip && > + pkt->dst_ip == q->id.dst_ip && > + pkt->src_port == q->id.src_port && > + pkt->dst_port == q->id.dst_port) { > + dir = MATCH_FORWARD; > + break; > + } > + if (pkt->src_ip == q->id.dst_ip && > + pkt->dst_ip == q->id.src_ip && > + pkt->src_port == q->id.dst_port && > + pkt->dst_port == q->id.src_port) { > + dir = MATCH_REVERSE; > + break; > } > } > next: > @@ -463,43 +459,45 @@ next: > q = q->next; > } > if (q == NULL) > - goto done; /* q = NULL, not found */ > + goto done; /* q = NULL, not found */ > > - if ( prev != NULL) { /* found and not in front */ > + if (prev != NULL) { /* found and not in front */ > prev->next = q->next; > q->next = V_ipfw_dyn_v[i]; > V_ipfw_dyn_v[i] = q; > } > if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */ > - u_char flags = pkt->_flags & (TH_FIN|TH_SYN|TH_RST); > + uint32_t ack; > + u_char flags = pkt->_flags & (TH_FIN | TH_SYN | TH_RST); > > #define BOTH_SYN (TH_SYN | (TH_SYN << 8)) > #define BOTH_FIN (TH_FIN | (TH_FIN << 8)) > - q->state |= (dir == MATCH_FORWARD ) ? flags : (flags << 8); > + q->state |= (dir == MATCH_FORWARD) ? flags : (flags << 8); > switch (q->state) { > - case TH_SYN: /* opening */ > + case TH_SYN: /* opening */ > q->expire = time_uptime + V_dyn_syn_lifetime; > break; > > case BOTH_SYN: /* move to established */ > - case BOTH_SYN | TH_FIN : /* one side tries to close */ > - case BOTH_SYN | (TH_FIN << 8) : > - if (tcp) { > + case BOTH_SYN | TH_FIN: /* one side tries to close */ > + case BOTH_SYN | (TH_FIN << 8): > #define _SEQ_GE(a,b) ((int)(a) - (int)(b) >= 0) > - u_int32_t ack = ntohl(tcp->th_ack); > - if (dir == MATCH_FORWARD) { > + if (tcp == NULL) { > + q->expire = time_uptime + V_dyn_ack_lifetime; > + break; > + } > + > + ack = ntohl(tcp->th_ack); > + if (dir == MATCH_FORWARD) { > if (q->ack_fwd == 0 || _SEQ_GE(ack, q->ack_fwd)) > - q->ack_fwd = ack; > - else { /* ignore out-of-sequence */ > - break; > - } > - } else { > + q->ack_fwd = ack; > + else /* ignore out-of-sequence */ > + break; > + } else { > if (q->ack_rev == 0 || _SEQ_GE(ack, q->ack_rev)) > - q->ack_rev = ack; > - else { /* ignore out-of-sequence */ > - break; > - } > - } > + q->ack_rev = ack; > + else /* ignore out-of-sequence */ > + break; > } > q->expire = time_uptime + V_dyn_ack_lifetime; > break; > @@ -531,9 +529,9 @@ next: > q->expire = time_uptime + V_dyn_short_lifetime; > } > done: > - if (match_direction) > + if (match_direction != NULL) > *match_direction = dir; > - return q; > + return (q); > } > > ipfw_dyn_rule * From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:11:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 225B1106566B; Tue, 28 Feb 2012 22:11:13 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id AFEF58FC14; Tue, 28 Feb 2012 22:11:12 +0000 (UTC) Received: by qcsg15 with SMTP id g15so1826933qcs.13 for ; Tue, 28 Feb 2012 14:11:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=wP/NNCAWuMjx9qhUmBvUXhBSZ+9hu9w6fVegR4W4K1k=; b=C5gEOVtUWQPUbg0TCzFrjxa6q6frfPOjqFq0BAroeeCXRgfOJrw5xXCA1ypAnNGKiM PkKO+yZBRw1G5+iPEVIIrt3KfBHiNUR+QKcLKqfTO9IAu/N6uP378aab6XF70otKjaQE mMQU1vL/tsUzb2G/xWy5EER9C3jJm1M3BgjEc= MIME-Version: 1.0 Received: by 10.229.102.101 with SMTP id f37mr6966639qco.37.1330467072127; Tue, 28 Feb 2012 14:11:12 -0800 (PST) Received: by 10.229.86.200 with HTTP; Tue, 28 Feb 2012 14:11:12 -0800 (PST) In-Reply-To: <201202282145.q1SLjLpO093657@svn.freebsd.org> References: <201202282145.q1SLjLpO093657@svn.freebsd.org> Date: Tue, 28 Feb 2012 23:11:12 +0100 Message-ID: From: Giovanni Trematerra To: Dimitry Andric 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: r232271 - 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: Tue, 28 Feb 2012 22:11:13 -0000 On Tue, Feb 28, 2012 at 10:45 PM, Dimitry Andric wrote: > Author: dim > Date: Tue Feb 28 21:45:21 2012 > New Revision: 232271 > URL: http://svn.freebsd.org/changeset/base/232271 > > Log: > =A0Change definition of pipe_chmod() from K&R to C99, to avoid the > =A0following clang warning: > > =A0sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of K&R functio= n parameter is not compatible with the parameter type 'mode_t' > =A0 =A0 =A0 =A0(aka 'unsigned short') declared in a previous prototype [-= Werror] > =A0 =A0 =A0 =A0 =A0mode_t mode; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^ > =A0sys/kern/sys_pipe.c:155:19: note: previous declaration is here > =A0static fo_chmod_t =A0 =A0 =A0 pipe_chmod; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0^ > > Modified: > =A0head/sys/kern/sys_pipe.c > > Modified: head/sys/kern/sys_pipe.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/sys_pipe.c =A0 =A0Tue Feb 28 21:43:29 2012 =A0 =A0 =A0 = =A0(r232270) > +++ head/sys/kern/sys_pipe.c =A0 =A0Tue Feb 28 21:45:21 2012 =A0 =A0 =A0 = =A0(r232271) > @@ -1551,11 +1551,7 @@ pipe_close(fp, td) > =A0} > > =A0static int > -pipe_chmod(fp, mode, active_cred, td) > - =A0 =A0 =A0 struct file *fp; > - =A0 =A0 =A0 mode_t mode; > - =A0 =A0 =A0 struct ucred *active_cred; > - =A0 =A0 =A0 struct thread *td; > +pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, stru= ct thread *td) > =A0{ > =A0 =A0 =A0 =A0struct pipe *cpipe; > =A0 =A0 =A0 =A0int error; Thank you. It introduces a style(9) violation, though. I think it should be in this way pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td) Anyway that's not a problem I can take care of this and other style violati= ons during next weeks. -- Gianni From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:15:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47BAF106564A; Tue, 28 Feb 2012 22:15:47 +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 3714E8FC16; Tue, 28 Feb 2012 22:15:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SMFlIA094682; Tue, 28 Feb 2012 22:15:47 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SMFlDB094680; Tue, 28 Feb 2012 22:15:47 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201202282215.q1SMFlDB094680@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 28 Feb 2012 22:15: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: r232274 - head/usr.bin/fetch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 28 Feb 2012 22:15:47 -0000 Author: obrien Date: Tue Feb 28 22:15:46 2012 New Revision: 232274 URL: http://svn.freebsd.org/changeset/base/232274 Log: Document the 'URL' argument. Modified: head/usr.bin/fetch/fetch.1 Modified: head/usr.bin/fetch/fetch.1 ============================================================================== --- head/usr.bin/fetch/fetch.1 Tue Feb 28 22:00:41 2012 (r232273) +++ head/usr.bin/fetch/fetch.1 Tue Feb 28 22:15:46 2012 (r232274) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2000-2011 Dag-Erling Smørgrav +.\" Copyright (c) 2000-2012 Dag-Erling Smørgrav .\" All rights reserved. .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used .\" by permission. @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2011 +.Dd February 28, 2012 .Dt FETCH 1 .Os .Sh NAME @@ -214,6 +214,11 @@ When the flag is specified, wait this many seconds between successive retries. .El .Pp +.Ar URL +.Bd -literal + :(//((:)?@)?(:)?)?/()? +.Ed +.Pp If .Nm receives a From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:17:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 815BE1065670; Tue, 28 Feb 2012 22:17:53 +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 6EEE28FC1C; Tue, 28 Feb 2012 22:17:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SMHrwA094785; Tue, 28 Feb 2012 22:17:53 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SMHrIk094780; Tue, 28 Feb 2012 22:17:53 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202282217.q1SMHrIk094780@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 28 Feb 2012 22:17: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: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 22:17:53 -0000 Author: tijl Date: Tue Feb 28 22:17:52 2012 New Revision: 232275 URL: http://svn.freebsd.org/changeset/base/232275 Log: Copy amd64 setjmp.h to x86 and replace amd64/i386/pc98 setjmp.h with stubs. Added: head/sys/x86/include/setjmp.h - copied unchanged from r232268, head/sys/amd64/include/setjmp.h Modified: head/sys/amd64/include/setjmp.h head/sys/i386/include/setjmp.h head/sys/pc98/include/setjmp.h Modified: head/sys/amd64/include/setjmp.h ============================================================================== --- head/sys/amd64/include/setjmp.h Tue Feb 28 22:15:46 2012 (r232274) +++ head/sys/amd64/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275) @@ -1,50 +1,6 @@ /*- - * Copyright (c) 1998 John Birrell . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE_SETJMP_H_ -#define _MACHINE_SETJMP_H_ - -#include - -#define _JBLEN 12 /* Size of the jmp_buf on AMD64. */ - -/* - * jmp_buf and sigjmp_buf are encapsulated in different structs to force - * compile-time diagnostics for mismatches. The structs are the same - * internally to avoid some run-time errors for mismatches. - */ -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE -typedef struct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1]; -#endif - -typedef struct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1]; - -#endif /* !_MACHINE_SETJMP_H_ */ +#include Modified: head/sys/i386/include/setjmp.h ============================================================================== --- head/sys/i386/include/setjmp.h Tue Feb 28 22:15:46 2012 (r232274) +++ head/sys/i386/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275) @@ -1,50 +1,6 @@ /*- - * Copyright (c) 1998 John Birrell . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE_SETJMP_H_ -#define _MACHINE_SETJMP_H_ - -#include - -#define _JBLEN 11 /* Size of the jmp_buf on x86. */ - -/* - * jmp_buf and sigjmp_buf are encapsulated in different structs to force - * compile-time diagnostics for mismatches. The structs are the same - * internally to avoid some run-time errors for mismatches. - */ -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE -typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; -#endif - -typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1]; - -#endif /* !_MACHINE_SETJMP_H_ */ +#include Modified: head/sys/pc98/include/setjmp.h ============================================================================== --- head/sys/pc98/include/setjmp.h Tue Feb 28 22:15:46 2012 (r232274) +++ head/sys/pc98/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275) @@ -3,4 +3,4 @@ */ /* $FreeBSD$ */ -#include +#include Copied: head/sys/x86/include/setjmp.h (from r232268, head/sys/amd64/include/setjmp.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275, copy of r232268, head/sys/amd64/include/setjmp.h) @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 1998 John Birrell . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_SETJMP_H_ +#define _MACHINE_SETJMP_H_ + +#include + +#define _JBLEN 12 /* Size of the jmp_buf on AMD64. */ + +/* + * jmp_buf and sigjmp_buf are encapsulated in different structs to force + * compile-time diagnostics for mismatches. The structs are the same + * internally to avoid some run-time errors for mismatches. + */ +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE +typedef struct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1]; +#endif + +typedef struct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1]; + +#endif /* !_MACHINE_SETJMP_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:30:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AA3F106564A; Tue, 28 Feb 2012 22:30:59 +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 37DB58FC13; Tue, 28 Feb 2012 22:30:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SMUxpl095215; Tue, 28 Feb 2012 22:30:59 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SMUwAb095210; Tue, 28 Feb 2012 22:30:58 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201202282230.q1SMUwAb095210@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 28 Feb 2012 22:30: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: r232276 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 22:30:59 -0000 Author: tijl Date: Tue Feb 28 22:30:58 2012 New Revision: 232276 URL: http://svn.freebsd.org/changeset/base/232276 Log: Copy amd64 stdarg.h to x86 and replace amd64/i386/pc98 stdarg.h with stubs. Added: head/sys/x86/include/stdarg.h - copied unchanged from r232268, head/sys/amd64/include/stdarg.h Modified: head/sys/amd64/include/stdarg.h head/sys/i386/include/stdarg.h head/sys/pc98/include/stdarg.h Modified: head/sys/amd64/include/stdarg.h ============================================================================== --- head/sys/amd64/include/stdarg.h Tue Feb 28 22:17:52 2012 (r232275) +++ head/sys/amd64/include/stdarg.h Tue Feb 28 22:30:58 2012 (r232276) @@ -1,75 +1,6 @@ /*- - * Copyright (c) 2002 David E. O'Brien. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE 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$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE_STDARG_H_ -#define _MACHINE_STDARG_H_ - -#include -#include - -#ifndef _VA_LIST_DECLARED -#define _VA_LIST_DECLARED -typedef __va_list va_list; -#endif - -#ifdef __GNUCLIKE_BUILTIN_STDARG - -#define va_start(ap, last) \ - __builtin_va_start((ap), (last)) - -#define va_arg(ap, type) \ - __builtin_va_arg((ap), type) - -#define __va_copy(dest, src) \ - __builtin_va_copy((dest), (src)) - -#if __ISO_C_VISIBLE >= 1999 -#define va_copy(dest, src) \ - __va_copy(dest, src) -#endif - -#define va_end(ap) \ - __builtin_va_end(ap) - -#elif defined(lint) -/* Provide a fake implementation for lint's benefit */ -#define __va_size(type) \ - (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) -#define va_start(ap, last) \ - ((ap) = (va_list)&(last) + __va_size(last)) -#define va_arg(ap, type) \ - (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) -#define va_end(ap) - -#else -#error this file needs to be ported to your compiler -#endif - -#endif /* !_MACHINE_STDARG_H_ */ +#include Modified: head/sys/i386/include/stdarg.h ============================================================================== --- head/sys/i386/include/stdarg.h Tue Feb 28 22:17:52 2012 (r232275) +++ head/sys/i386/include/stdarg.h Tue Feb 28 22:30:58 2012 (r232276) @@ -1,90 +1,6 @@ /*- - * Copyright (c) 2002 David E. O'Brien. All rights reserved. - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD$ + * This file is in the public domain. */ +/* $FreeBSD$ */ -#ifndef _MACHINE_STDARG_H_ -#define _MACHINE_STDARG_H_ - -#include -#include - -#ifndef _VA_LIST_DECLARED -#define _VA_LIST_DECLARED -typedef __va_list va_list; -#endif - -#ifdef __GNUCLIKE_BUILTIN_STDARG - -#define va_start(ap, last) \ - __builtin_va_start((ap), (last)) - -#define va_arg(ap, type) \ - __builtin_va_arg((ap), type) - -#if __ISO_C_VISIBLE >= 1999 -#define va_copy(dest, src) \ - __builtin_va_copy((dest), (src)) -#endif - -#define va_end(ap) \ - __builtin_va_end(ap) - -#else /* !__GNUCLIKE_BUILTIN_STDARG */ - -#define __va_size(type) \ - (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) - -#ifdef __GNUCLIKE_BUILTIN_NEXT_ARG -#define va_start(ap, last) \ - ((ap) = (va_list)__builtin_next_arg(last)) -#else /* !__GNUCLIKE_BUILTIN_NEXT_ARG */ -#define va_start(ap, last) \ - ((ap) = (va_list)&(last) + __va_size(last)) -#endif /* __GNUCLIKE_BUILTIN_NEXT_ARG */ - -#define va_arg(ap, type) \ - (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) - -#if __ISO_C_VISIBLE >= 1999 -#define va_copy(dest, src) \ - ((dest) = (src)) -#endif - -#define va_end(ap) - -#endif /* __GNUCLIKE_BUILTIN_STDARG */ - -#endif /* !_MACHINE_STDARG_H_ */ +#include Modified: head/sys/pc98/include/stdarg.h ============================================================================== --- head/sys/pc98/include/stdarg.h Tue Feb 28 22:17:52 2012 (r232275) +++ head/sys/pc98/include/stdarg.h Tue Feb 28 22:30:58 2012 (r232276) @@ -3,4 +3,4 @@ */ /* $FreeBSD$ */ -#include +#include Copied: head/sys/x86/include/stdarg.h (from r232268, head/sys/amd64/include/stdarg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/include/stdarg.h Tue Feb 28 22:30:58 2012 (r232276, copy of r232268, head/sys/amd64/include/stdarg.h) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2002 David E. O'Brien. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_STDARG_H_ +#define _MACHINE_STDARG_H_ + +#include +#include + +#ifndef _VA_LIST_DECLARED +#define _VA_LIST_DECLARED +typedef __va_list va_list; +#endif + +#ifdef __GNUCLIKE_BUILTIN_STDARG + +#define va_start(ap, last) \ + __builtin_va_start((ap), (last)) + +#define va_arg(ap, type) \ + __builtin_va_arg((ap), type) + +#define __va_copy(dest, src) \ + __builtin_va_copy((dest), (src)) + +#if __ISO_C_VISIBLE >= 1999 +#define va_copy(dest, src) \ + __va_copy(dest, src) +#endif + +#define va_end(ap) \ + __builtin_va_end(ap) + +#elif defined(lint) +/* Provide a fake implementation for lint's benefit */ +#define __va_size(type) \ + (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) +#define va_start(ap, last) \ + ((ap) = (va_list)&(last) + __va_size(last)) +#define va_arg(ap, type) \ + (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) +#define va_end(ap) + +#else +#error this file needs to be ported to your compiler +#endif + +#endif /* !_MACHINE_STDARG_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:50:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DCD7106564A; Tue, 28 Feb 2012 22:50:06 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 2F07E8FC18; Tue, 28 Feb 2012 22:50:05 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 3A3777300B; Wed, 29 Feb 2012 00:08:19 +0100 (CET) Date: Wed, 29 Feb 2012 00:08:19 +0100 From: Luigi Rizzo To: Oleg Bulyzhin Message-ID: <20120228230819.GA1134@onelab2.iet.unipi.it> References: <201202282153.q1SLrdfQ093936@svn.freebsd.org> <20120228222252.GA801@onelab2.iet.unipi.it> <20120228223937.GA17838@lath.rinet.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120228223937.GA17838@lath.rinet.ru> 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: r232272 - 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: Tue, 28 Feb 2012 22:50:06 -0000 On Wed, Feb 29, 2012 at 02:39:37AM +0400, Oleg Bulyzhin wrote: > On Tue, Feb 28, 2012 at 11:22:52PM +0100, Luigi Rizzo wrote: > > On Tue, Feb 28, 2012 at 09:53:39PM +0000, Oleg Bulyzhin wrote: > > > Author: oleg > > > Date: Tue Feb 28 21:53:39 2012 > > > New Revision: 232272 > > > URL: http://svn.freebsd.org/changeset/base/232272 > > > > > > Log: > > > lookup_dyn_rule_locked(): style(9) cleanup > > > > > > MFC after: 1 month > > > > is there a reason for delaying the MFC, such as this is > > preparatory work for further changes ? > > Otherwise i'd suggest that whitespace changes like this > > are quickly pushed to the stable branch so that the code > > versions do not diverge. > > > > cheers > > luigi > > Actual commit is r232273, this one used for reduce diff > of meaningful commit. ok, thanks luigi From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 22:57:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E65DE106566C; Tue, 28 Feb 2012 22:57:17 +0000 (UTC) (envelope-from oleg@lath.rinet.ru) Received: from lath.rinet.ru (lath.rinet.ru [195.54.192.90]) by mx1.freebsd.org (Postfix) with ESMTP id A2A668FC1F; Tue, 28 Feb 2012 22:57:17 +0000 (UTC) Received: by lath.rinet.ru (Postfix, from userid 222) id 661E65256; Wed, 29 Feb 2012 02:39:37 +0400 (MSK) Date: Wed, 29 Feb 2012 02:39:37 +0400 From: Oleg Bulyzhin To: Luigi Rizzo Message-ID: <20120228223937.GA17838@lath.rinet.ru> References: <201202282153.q1SLrdfQ093936@svn.freebsd.org> <20120228222252.GA801@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120228222252.GA801@onelab2.iet.unipi.it> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232272 - 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: Tue, 28 Feb 2012 22:57:18 -0000 On Tue, Feb 28, 2012 at 11:22:52PM +0100, Luigi Rizzo wrote: > On Tue, Feb 28, 2012 at 09:53:39PM +0000, Oleg Bulyzhin wrote: > > Author: oleg > > Date: Tue Feb 28 21:53:39 2012 > > New Revision: 232272 > > URL: http://svn.freebsd.org/changeset/base/232272 > > > > Log: > > lookup_dyn_rule_locked(): style(9) cleanup > > > > MFC after: 1 month > > is there a reason for delaying the MFC, such as this is > preparatory work for further changes ? > Otherwise i'd suggest that whitespace changes like this > are quickly pushed to the stable branch so that the code > versions do not diverge. > > cheers > luigi Actual commit is r232273, this one used for reduce diff of meaningful commit. -- Oleg. ================================================================ === Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- oleg@rinet.ru === ================================================================ From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 23:26:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10D94106566B; Tue, 28 Feb 2012 23:26:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 666688FC08; Tue, 28 Feb 2012 23:26:47 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1SNQhmZ006573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 10:26:45 +1100 Date: Wed, 29 Feb 2012 10:26:43 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201202281815.q1SIFSbB082030@svn.freebsd.org> Message-ID: <20120229071721.G989@besplex.bde.org> References: <201202281815.q1SIFSbB082030@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: r232261 - in head/sys: amd64/include i386/include pc98/include x86/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, 28 Feb 2012 23:26:51 -0000 On Tue, 28 Feb 2012, Tijl Coosemans wrote: > Log: > Copy amd64 _types.h to x86 and merge with i386 _types.h. Replace existing > amd64/i386/pc98 _types.h with stubs. I don't like this much. It gives 2 layers of convolutions for readers (humans and compilers) to slowly untangle. There is another layer of include files for compatibility (but both layers are still used by default), and lots of ifdefs. The whole point of 1 file per arch was to avoid such ifdefs. This might be OK if arches were actually identical for the APIs in these files, but for types there are lots of differences between 32-bit and 64-bit machines. The differences can be reduced by spelling 32/64-bit types as [unsigned] long and by always using the basic type instead of a derived type. Old code (e.g., FreeBSD-3) did this, but now almost everything is declared using the derived fixed-width types int32_t/int64_t etc., so there is always a spelling difference for 32/64-bit types. The only exceptions are floating point types, and the broken __clock_t type. clock_t is unsigned long on i386, but is int32_t on amd64. This is backwards at best. I think this brokenness came from NetBSD. _BSD_CLOCK_T_ was correct (unsigned long) for all arches in 4.4BSD, and i386 just didn't break this. But now __clock_t is broken for all arches except i386: it is __uint32_t on arm and powerpc, which is just a different spelling for the 32-bit case and is at least ABI-compatible for the 64-bit case, but for all other arches including all 64-bit ones, it broken to __int32_t. Perhaps the difference is explained by "long" being bad for ABI compatibility. Old code like 4.4BSD-Lite1 used long excessively (since technically, int might be only 16 bits). Even pid_t was long in 4.4BSD-Lite1. NetBSD changed many of these longs to ints or int32_t's for ABI compatibility and/or because 64 bit longs are just too wide, and FreeBSD eventually picked up these changes (mostly via 4.4BSD-Lite2 for general typedefs and directly from NetBSD for 64-bit arches). So pid_t is now int32_t and clock_t is mostly broken. clock_t really needs all 64 bits if they are readily available, but has been reduced to 31, especially when 64 are readily available. OTOH, if you just want ABI and API compatibility for clock_t, then it should have been changed to uint32_t for all arches and not defined in any MD types file. There is now a minor API compatibility for printing clock_t's -- %lu format must be used on i386, %u on others, and %d on most. Except for the gratuitous loss of unsignedness, this is just a special case of printing a typedefed types. clock_t may also be a floating point type, so the only good way to print it is to convert it to [long] double and then worry about the correct floating point format (how much precision should it have?...). > Copied and modified: head/sys/x86/include/_types.h (from r232259, head/sys/amd64/include/_types.h) > ============================================================================== > --- head/sys/amd64/include/_types.h Tue Feb 28 15:52:01 2012 (r232259, copy source) > +++ head/sys/x86/include/_types.h Tue Feb 28 18:15:28 2012 (r232261) > @@ -54,19 +54,41 @@ typedef short __int16_t; > typedef unsigned short __uint16_t; > typedef int __int32_t; > typedef unsigned int __uint32_t; > +#ifdef _LP64 > typedef long __int64_t; > typedef unsigned long __uint64_t; This is about the only ifdef that is really needed. > +#else > +#ifndef lint > +__extension__ An old bug -- work around broken lints. Although messy, this is not messy enough to be correct -- __extension__ is a hard-coded gccism. Elsewhere, in much less important code than this, there are messy ifdefs to avoid hard-coded gccisms. > +#endif > +/* LONGLONG */ long long has only been standard for 13 years now, so broken lints still need this messy markup. > +typedef long long __int64_t; > +#ifndef lint > +__extension__ > +#endif > +/* LONGLONG */ > +typedef unsigned long long __uint64_t; > +#endif I ifdefed all this correctly 15+ years ago so that it compiled (but didn't run if *int64_t was used) for a non-gcc K&R compiler. The long long abomination was not used, and __attribute__(()) was used to declare *int64_t, but only under a gcc ifdef. This wasn't broken until 8 Jan 2011 by, erm, us. We also added the __extensions__. The justification was that long long is now standard. But there are still the old messes for lint, and new breakage for non-gcc to support C90. > > /* > * Standard type definitions. > */ > +#ifdef _LP64 > typedef __int32_t __clock_t; /* clock()... */ > typedef __int64_t __critical_t; > typedef double __double_t; > typedef float __float_t; > typedef __int64_t __intfptr_t; > -typedef __int64_t __intmax_t; > typedef __int64_t __intptr_t; > +#else > +typedef unsigned long __clock_t; > +typedef __int32_t __critical_t; > +typedef long double __double_t; > +typedef long double __float_t; > +typedef __int32_t __intfptr_t; > +typedef __int32_t __intptr_t; > +#endif [unsigned] long would work without ifdefs for everything except to preserve the broken __clock_t, and the FP types. Except for i386's with correctly-sized longs (64 bits). We may have discussed these too. > @@ -75,6 +97,7 @@ typedef __int8_t __int_least8_t; > typedef __int16_t __int_least16_t; > typedef __int32_t __int_least32_t; > typedef __int64_t __int_least64_t; > +#ifdef _LP64 > typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ > typedef __int64_t __register_t; > typedef __int64_t __segsz_t; /* segment size (in pages) */ > @@ -82,8 +105,18 @@ typedef __uint64_t __size_t; /* sizeof( > typedef __int64_t __ssize_t; /* byte count or error */ > typedef __int64_t __time_t; /* time()... */ > typedef __uint64_t __uintfptr_t; > -typedef __uint64_t __uintmax_t; > typedef __uint64_t __uintptr_t; > +#else > +typedef __int32_t __ptrdiff_t; > +typedef __int32_t __register_t; > +typedef __int32_t __segsz_t; > +typedef __uint32_t __size_t; > +typedef __int32_t __ssize_t; > +typedef __int32_t __time_t; > +typedef __uint32_t __uintfptr_t; > +typedef __uint32_t __uintptr_t; > +#endif [unsigned] long would work without ifdefs for all of these, since all these expanded naturally to the register width. Perhaps a better way, which also works for i386's with correctly-sized longs, is to define almost everything in terms of registers -- as __[u]register_t. > +typedef __uint64_t __uintmax_t; > typedef __uint32_t __uint_fast8_t; > typedef __uint32_t __uint_fast16_t; > typedef __uint32_t __uint_fast32_t; > @@ -92,12 +125,23 @@ typedef __uint8_t __uint_least8_t; > typedef __uint16_t __uint_least16_t; > typedef __uint32_t __uint_least32_t; > typedef __uint64_t __uint_least64_t; > +#ifdef _LP64 > typedef __uint64_t __u_register_t; > typedef __uint64_t __vm_offset_t; > -typedef __int64_t __vm_ooffset_t; > typedef __uint64_t __vm_paddr_t; > -typedef __uint64_t __vm_pindex_t; > typedef __uint64_t __vm_size_t; > +#else > +typedef __uint32_t __u_register_t; > +typedef __uint32_t __vm_offset_t; > +#ifdef PAE > +typedef __uint64_t __vm_paddr_t; > +#else > +typedef __uint32_t __vm_paddr_t; > +#endif > +typedef __uint32_t __vm_size_t; > +#endif > +typedef __int64_t __vm_ooffset_t; > +typedef __uint64_t __vm_pindex_t; Similarly. The patch, and possibly the ifdefs, are hard to read here. There's a nested ifdef for PAE. PAE doesn't apply for amd64. The above assumes that the cases where it doesn't apply are classified by !_LP64. x86/include didn't have many files in it before this and similar commits in the same batch, and the first file that I looked at in it has various new and old convolutions and bugs: x86/include/_align.h: % /* % * Round p (pointer or byte index) up to a correctly-aligned value % * for all data types (int, long, ...). The result is unsigned int % * and must be cast to any desired pointer type. % */ This comment was blindly copied from i386. It doesn't match the code below. % #define _ALIGNBYTES (sizeof(register_t) - 1) % #define _ALIGN(p) (((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) This code is broken, since it uses register_t and uintptr_t which are not necessarily defined here. Old code was careful to use only basic types, so that no undocumented prerequisites are required and so that this not broken when the undocumented prerequisites are not accidentally supplied. The type of the result is actually uintptr_t. On i386, uintptr_t is just a different spelling of unsigned int. On amd64, it is different. This file shouldn't exist. {amd64,i386,pc98}/include/_align.h just include x86/include/_align.h. They shouldn't exist either. i386/include/param.h: % #include This include is misplaced (outside of the idempotency ifdef for this file). The definitions used to be here for technical reasons in their correct implementation. There used to be an ifdef here so that this file could be included to define only the alignment macros so as to not get namespace pollution in unusual cases. This was "cleaned up" for the unusual cases to pessimize the usual cases. The cleanups have rotted, so they now have not just 1, but 2 layers of nested includes of _align.h to untangle to see what this file is doing. 2 layers give about the same level of obfuscation as the correct implementation, plus more inefficiencies than only 1 layer. % % #ifndef _I386_INCLUDE_PARAM_H_ % #define _I386_INCLUDE_PARAM_H_ % % /* % * Machine dependent constants for Intel 386. % */ % % /* % * Round p (pointer or byte index) up to a correctly-aligned value % * for all data types (int, long, ...). The result is unsigned int % * and must be cast to any desired pointer type. % */ The comment is still correct for the definitions here. % #ifndef _ALIGNBYTES % #define _ALIGNBYTES (sizeof(int) - 1) % #endif % #ifndef _ALIGN % #define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) % #endif But these definitions are unreachable, since is included unconditionally, and it defines the alignment macros unconditionally. % % Mistakes near here also added this style bug (extra blank line). % #define __HAVE_ACPI amd64/include/param.h: % * $FreeBSD: src/sys/amd64/include/param.h,v 1.37 2011/07/19 13:00:30 attilio Exp $ % */ % % Extra blank lines are scattered randomly and happen to be in different places. % #ifndef _AMD64_INCLUDE_PARAM_H_ % #define _AMD64_INCLUDE_PARAM_H_ % % #include Unlike for i386, this is placed almost correctly. It is inside the idempotency ifdef... % % /* % * Machine dependent constants for AMD64. % */ ... but not inside the comment that should describe everything in this file. % % Another random extra blank line. Or not so random. Unlike for i386, the old definitions are not kept here. They used to be placed up where the include is now on i386 (outside of the idempotency ifdef). They used to use u_long to avoid prerequisites and have a correct comment for them. For i386 there are now 2 correct comments about them (but with confusing spelling in one), while for amd64 there is only 1 incorrect comment. % ... % #define ALIGNBYTES _ALIGNBYTES % #define ALIGN(p) _ALIGN(p) These (and ALIGNED_POINTER()) are the primary APIs for these macros (the APIs with underscores are just to keep them out of the namespace in POSIX headers). The above definitions of the primary APIs are completely MI once the underscored versions are defined, so they shouldn't be defined here or in any other MD header. Just about all of the amd64 and i386 param.h are the same, although not as MI as ALIGNBYTES etc. I don't really want the definitions moved to x86 though. They are bad enough where they are. Other bugs in them include: - amd64_btop() and amd64_ptob() are named gratuitously differently than i386_btop() and i386_ptob(). Names like md_btop() and md_btop() or just btop() and btop() would be better. Not having these APIs might be better still. There is considerable confusion between these APIs and others that give the same results, and since the results are the same and there is no type checking, it is unlikely that the logically correct API is always used: - the corresponding "MI" APIs are ctob() and btoc(). These are ancient. 'c' in them means 'clicks' (groups of pages). Groups of more than one page have never been used in FreeBSD. The implementation of these macros is sort of backwards, with the assumption that the group size is always 1 page hard-coded in their definitions via PAGE_MASK and PAGE_SHIFT. - atop() and ptoa() may also be "MI", but have MD implementations. They are confusingly similar to ctob() and btoc(). 'p' (page) in them always means the same as 'c' (clicks) in practice. 'a' (address) in them always means the same as 'b' (address in bytes, or size in bytes) in practice. The logical differences are subtle. There isn't even a MI API like atop() for for sizes instead of addresses. - {amd64,i386}_btop() and {amd64,i386}_ptob() logically handle either sizes or addresses, and convert to and from pages. They are the easiest to use provided you assume that the address space is flat and that the pages aren't grouped into clicks, but they are MD and have the worse spelling. This is sort of backwards again. It is MD layers that should use shorter spelling of their variables and APIs, and hard-code assumptions. i386 mostly uses atop(), and most of these uses are doubly logically wrong, since they are mostly for sizes and not for addresses, amd are very MD: - ctob: 13 instances - btoc: 0 - atop: 34 instances (counting its definition). Most are for segment limits, this are for sizes, thus are abuses. - ptoa: 13 ... mostly for sizes. Confusion between this and ctob is apparently perfectly divided. - i386_ptob: 3 instances. Just 1 use in pmap.c duplicated for xen. - i386_btop: 9 instances. Just 4+2 uses in pmap.c's, 2 in pmap.h (in a macros and an inline that expand to many more uses) One of the reasons for putting all types declarations in the same file although this gives inefficiencies by requiring the compiler to read and parse very large files to get the few definitions that are actually, is to avoid the convolutions and ifdefs for minimising the declarations. Convolutions and ifdefs for other purposes defeat this to some extent. Although I was responsible for some of the tiny _foo.h files like which are used to minimise namespace problems, I don't like the profileration of such files to handle even tinier problems. The worst that I have noticed are _null.h (this should be handled in machine/_types.h, where it used to be possible to handle it without ifdefs), _align.h, and *stdint.h (there are now 4 layers of convolutions with internal branches for : - /usr/include/stdint.h -> sys/stdint.h (only a symlink) - sys/stdint.h includes sys/_stdint.h and machine/_stdint.h - sys/_stdint.h is a mistake to allow sys/types.h to include it instead of declaring historical pollution for itself, but only for some pollution that is now standard in -- types.h still declares things like u_int8_t unconditionally for itself; the handling of these is a bit simpler because they don't need ifdefs to prevent re-declaration in . Now it is harder to see what types.h declares. - machine/_stdint.h was the correct implementation. Now it includes x86/_stdint.h on amd64 and i386. - x86/_stdint.h. Most of the details are now here, 4 layers deep, with ifdefs. Ideally, everything would be in directly. I don't know how to do it in a layer, but is it too much to ask for only 2 layers? Hmm, I do know how to do it in 1 layer -- flatten it at install time. Anyone who cared about efficiency and readability would do this :-). But I usually read the uninstalled sources. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Feb 28 23:30:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C28F9106564A; Tue, 28 Feb 2012 23:30:19 +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 B168F8FC14; Tue, 28 Feb 2012 23:30:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1SNUJK9097118; Tue, 28 Feb 2012 23:30:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SNUJ2a097116; Tue, 28 Feb 2012 23:30:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201202282330.q1SNUJ2a097116@svn.freebsd.org> From: Xin LI Date: Tue, 28 Feb 2012 23:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232277 - stable/9/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, 28 Feb 2012 23:30:19 -0000 Author: delphij Date: Tue Feb 28 23:30:19 2012 New Revision: 232277 URL: http://svn.freebsd.org/changeset/base/232277 Log: MFC r228924: In POSIX.1-2008: P_tmpdir [OB XSI] Default directory prefix for tempnam(). This macro is used in a lot of places in legacy applications, and is why we see a lot of programs written for e.g. Linux store volatile temporary files in /var/tmp and not /tmp. Modified: stable/9/include/stdio.h Directory Properties: stable/9/include/ (props changed) Modified: stable/9/include/stdio.h ============================================================================== --- stable/9/include/stdio.h Tue Feb 28 22:30:58 2012 (r232276) +++ stable/9/include/stdio.h Tue Feb 28 23:30:19 2012 (r232277) @@ -202,7 +202,7 @@ __END_DECLS /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ #if __XSI_VISIBLE -#define P_tmpdir "/var/tmp/" +#define P_tmpdir "/tmp/" #endif #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ #define TMP_MAX 308915776 From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 00:00:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E692106567E; Wed, 29 Feb 2012 00:00:43 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 344208FC15; Wed, 29 Feb 2012 00:00:34 +0000 (UTC) Received: from julian-mac.elischer.org (c-67-180-24-15.hsd1.ca.comcast.net [67.180.24.15]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id q1T00V8P004509 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 28 Feb 2012 16:00:32 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4F4D6AA4.9040208@freebsd.org> Date: Tue, 28 Feb 2012 16:00:36 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19 MIME-Version: 1.0 To: Mikolaj Golub References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org> <86zkc3bell.fsf@in138.ua3> In-Reply-To: <86zkc3bell.fsf@in138.ua3> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Robert Watson , Konstantin Belousov Subject: Re: svn commit: r232181 - 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: Wed, 29 Feb 2012 00:00:43 -0000 On 2/27/12 11:29 PM, Mikolaj Golub wrote: > On Mon, 27 Feb 2012 22:34:25 -0800 Julian Elischer wrote: > > JE> I don't think this belongs in the kernel by default. It's not exactl a > JE> call for backout but It's teh next thing short of that. a call for "do > JE> you REALLY think we need this particular specific case catered for?" > > The main goal of the patch was to provide ability to get another process > umask. It looks like usefulness of this is not questioned here. well that's exactly what I AM questioning.. how often will this be used? one person using this once in all of history isn't a real requirement for inclusion. It seems to me that someone is more likely to figure out a sneaky way to use this in a bad way than to want to use it in the way you expect. From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 00:30:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 336F41065673; Wed, 29 Feb 2012 00:30:19 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20B528FC18; Wed, 29 Feb 2012 00:30:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T0UIS2098979; Wed, 29 Feb 2012 00:30:18 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T0UItT098971; Wed, 29 Feb 2012 00:30:18 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201202290030.q1T0UItT098971@svn.freebsd.org> From: Martin Matuska Date: Wed, 29 Feb 2012 00:30: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: r232278 - in head: sys/compat/linprocfs sys/compat/linsysfs sys/fs/procfs sys/fs/pseudofs sys/kern sys/sys usr.sbin/jail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 00:30:19 -0000 Author: mm Date: Wed Feb 29 00:30:18 2012 New Revision: 232278 URL: http://svn.freebsd.org/changeset/base/232278 Log: Add procfs to jail-mountable filesystems. Reviewed by: jamie MFC after: 1 week Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linsysfs/linsysfs.c head/sys/fs/procfs/procfs.c head/sys/fs/pseudofs/pseudofs.h head/sys/kern/kern_jail.c head/sys/sys/jail.h head/usr.sbin/jail/jail.8 Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Tue Feb 28 23:30:19 2012 (r232277) +++ head/sys/compat/linprocfs/linprocfs.c Wed Feb 29 00:30:18 2012 (r232278) @@ -1460,7 +1460,7 @@ linprocfs_uninit(PFS_INIT_ARGS) return (0); } -PSEUDOFS(linprocfs, 1); +PSEUDOFS(linprocfs, 1, 0); MODULE_DEPEND(linprocfs, linux, 1, 1, 1); MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1); Modified: head/sys/compat/linsysfs/linsysfs.c ============================================================================== --- head/sys/compat/linsysfs/linsysfs.c Tue Feb 28 23:30:19 2012 (r232277) +++ head/sys/compat/linsysfs/linsysfs.c Wed Feb 29 00:30:18 2012 (r232278) @@ -280,5 +280,5 @@ linsysfs_uninit(PFS_INIT_ARGS) return (0); } -PSEUDOFS(linsysfs, 1); +PSEUDOFS(linsysfs, 1, 0); MODULE_DEPEND(linsysfs, linux, 1, 1, 1); Modified: head/sys/fs/procfs/procfs.c ============================================================================== --- head/sys/fs/procfs/procfs.c Tue Feb 28 23:30:19 2012 (r232277) +++ head/sys/fs/procfs/procfs.c Wed Feb 29 00:30:18 2012 (r232278) @@ -209,4 +209,4 @@ procfs_uninit(PFS_INIT_ARGS) return (0); } -PSEUDOFS(procfs, 1); +PSEUDOFS(procfs, 1, PR_ALLOW_MOUNT_PROCFS); Modified: head/sys/fs/pseudofs/pseudofs.h ============================================================================== --- head/sys/fs/pseudofs/pseudofs.h Tue Feb 28 23:30:19 2012 (r232277) +++ head/sys/fs/pseudofs/pseudofs.h Wed Feb 29 00:30:18 2012 (r232278) @@ -31,6 +31,8 @@ #ifndef _PSEUDOFS_H_INCLUDED #define _PSEUDOFS_H_INCLUDED +#include + /* * Opaque structures */ @@ -271,7 +273,7 @@ int pfs_destroy (struct pfs_node *pn); /* * Now for some initialization magic... */ -#define PSEUDOFS(name, version) \ +#define PSEUDOFS(name, version, jflag) \ \ static struct pfs_info name##_info = { \ #name, \ @@ -281,6 +283,8 @@ static struct pfs_info name##_info = { \ static int \ _##name##_mount(struct mount *mp) { \ + if (jflag && !prison_allow(curthread->td_ucred, jflag)) \ + return (EPERM); \ return pfs_mount(&name##_info, mp); \ } \ \ @@ -303,7 +307,7 @@ static struct vfsops name##_vfsops = { .vfs_uninit = _##name##_uninit, \ .vfs_unmount = pfs_unmount, \ }; \ -VFS_SET(name##_vfsops, name, VFCF_SYNTHETIC); \ +VFS_SET(name##_vfsops, name, VFCF_SYNTHETIC | (jflag ? VFCF_JAIL : 0)); \ MODULE_VERSION(name, version); \ MODULE_DEPEND(name, pseudofs, 1, 1, 1); Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Tue Feb 28 23:30:19 2012 (r232277) +++ head/sys/kern/kern_jail.c Wed Feb 29 00:30:18 2012 (r232278) @@ -204,6 +204,7 @@ static char *pr_allow_names[] = { "allow.mount.devfs", "allow.mount.nullfs", "allow.mount.zfs", + "allow.mount.procfs", }; const size_t pr_allow_names_size = sizeof(pr_allow_names); @@ -218,6 +219,7 @@ static char *pr_allow_nonames[] = { "allow.mount.nodevfs", "allow.mount.nonullfs", "allow.mount.nozfs", + "allow.mount.noprocfs", }; const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames); @@ -4206,6 +4208,10 @@ SYSCTL_PROC(_security_jail, OID_AUTO, mo CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_NULLFS, sysctl_jail_default_allow, "I", "Processes in jail can mount the nullfs file system"); +SYSCTL_PROC(_security_jail, OID_AUTO, mount_procfs_allowed, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + NULL, PR_ALLOW_MOUNT_PROCFS, sysctl_jail_default_allow, "I", + "Processes in jail can mount the procfs file system"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_zfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_ZFS, sysctl_jail_default_allow, "I", @@ -4356,6 +4362,8 @@ SYSCTL_JAIL_PARAM(_allow_mount, devfs, C "B", "Jail may mount the devfs file system"); SYSCTL_JAIL_PARAM(_allow_mount, nullfs, CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may mount the nullfs file system"); +SYSCTL_JAIL_PARAM(_allow_mount, procfs, CTLTYPE_INT | CTLFLAG_RW, + "B", "Jail may mount the procfs file system"); SYSCTL_JAIL_PARAM(_allow_mount, zfs, CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may mount the zfs file system"); Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Tue Feb 28 23:30:19 2012 (r232277) +++ head/sys/sys/jail.h Wed Feb 29 00:30:18 2012 (r232278) @@ -226,7 +226,8 @@ struct prison_racct { #define PR_ALLOW_MOUNT_DEVFS 0x0080 #define PR_ALLOW_MOUNT_NULLFS 0x0100 #define PR_ALLOW_MOUNT_ZFS 0x0200 -#define PR_ALLOW_ALL 0x03ff +#define PR_ALLOW_MOUNT_PROCFS 0x0400 +#define PR_ALLOW_ALL 0x07ff /* * OSD methods Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Tue Feb 28 23:30:19 2012 (r232277) +++ head/usr.sbin/jail/jail.8 Wed Feb 29 00:30:18 2012 (r232278) @@ -428,6 +428,14 @@ This permission is effective only togeth and if .Va enforce_statfs is set to a value lower than 2. +.It Va allow.mount.procfs +privileged users inside the jail will be able to mount and unmount the +procfs file system. +This permission is effective only together with +.Va allow.mount +and if +.Va enforce_statfs +is set to a value lower than 2. .It Va allow.mount.zfs privileged users inside the jail will be able to mount and unmount the ZFS file system. From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 00:37:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AEDC106564A; Wed, 29 Feb 2012 00:37:33 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 179958FC12; Wed, 29 Feb 2012 00:37:33 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 0C3AB25D3A02; Wed, 29 Feb 2012 00:37:32 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 270A1BDB5FC; Wed, 29 Feb 2012 00:37:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id RMQics467oua; Wed, 29 Feb 2012 00:37:29 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 97A6DBDB5FA; Wed, 29 Feb 2012 00:37:29 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201202290030.q1T0UItT098971@svn.freebsd.org> Date: Wed, 29 Feb 2012 00:37:28 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <80B3B04F-C7CC-4D83-963A-20092347C84F@lists.zabbadoz.net> References: <201202290030.q1T0UItT098971@svn.freebsd.org> To: Martin Matuska X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232278 - in head: sys/compat/linprocfs sys/compat/linsysfs sys/fs/procfs sys/fs/pseudofs sys/kern sys/sys usr.sbin/jail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 00:37:33 -0000 On 29. Feb 2012, at 00:30 , Martin Matuska wrote: > Author: mm > Date: Wed Feb 29 00:30:18 2012 > New Revision: 232278 > URL: http://svn.freebsd.org/changeset/base/232278 >=20 > Log: > Add procfs to jail-mountable filesystems. >=20 The man page lacks a .Dd update? I also think this one should come with a very big red warning in the man = page that you can easily compromise your host security I fear unless things = changed in "proc" land. > Reviewed by: jamie > MFC after: 1 week >=20 > Modified: > head/sys/compat/linprocfs/linprocfs.c > head/sys/compat/linsysfs/linsysfs.c > head/sys/fs/procfs/procfs.c > head/sys/fs/pseudofs/pseudofs.h > head/sys/kern/kern_jail.c > head/sys/sys/jail.h > head/usr.sbin/jail/jail.8 .. > Modified: head/usr.sbin/jail/jail.8 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/usr.sbin/jail/jail.8 Tue Feb 28 23:30:19 2012 = (r232277) > +++ head/usr.sbin/jail/jail.8 Wed Feb 29 00:30:18 2012 = (r232278) > @@ -428,6 +428,14 @@ This permission is effective only togeth > and if > .Va enforce_statfs > is set to a value lower than 2. > +.It Va allow.mount.procfs > +privileged users inside the jail will be able to mount and unmount = the > +procfs file system. > +This permission is effective only together with > +.Va allow.mount > +and if > +.Va enforce_statfs > +is set to a value lower than 2. > .It Va allow.mount.zfs > privileged users inside the jail will be able to mount and unmount the > ZFS file system. --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 00:45:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48EC61065676; Wed, 29 Feb 2012 00:45:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au [211.29.132.196]) by mx1.freebsd.org (Postfix) with ESMTP id D3E9E8FC0C; Wed, 29 Feb 2012 00:45:36 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1T0jVJM026388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 11:45:33 +1100 Date: Wed, 29 Feb 2012 11:45:31 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201202281939.q1SJdtYr084858@svn.freebsd.org> Message-ID: <20120229105104.K1479@besplex.bde.org> References: <201202281939.q1SJdtYr084858@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: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Wed, 29 Feb 2012 00:45:37 -0000 On Tue, 28 Feb 2012, Tijl Coosemans wrote: > Log: > Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace > amd64/i386/pc98 endian.h with stubs. > > In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been > resolved by reimplementing the macro in terms of __bswap32(x). As a side > effect __bswap64_var(x) is now implemented using two bswap instructions on > i386 and should be much faster. __bswap32_const(x) has been reimplemented > in terms of __bswap16(x) for consistency. The files now have enough in common for me to be happy with centralizing them. The trip through would have to be avoided to complete the cleanup. I don't know how to do that. Maybe install can produce a direct symlink. We should try harder to not install both x86/foo.h and machine/foo.h, so pathnames and don't start being used in applications and then having to be supported for compatibility. The patch is unreadable due to significant reimplementations, even without the move. So I looked at the resulting x86/endian.h: % ... % #ifdef __cplusplus % extern "C" { % #endif This ifdef is old style bug: - it is a hard-coded spelling of __BEGIN_DECLS - it is placed around the whole file. Most of the file consists of macro definitions. __BEGIN_DECLS would obviously make no sense around macro definitions. - the rest of the file consists of inline function declarations. Since these aren't extern, 'extern "C"' makes no sense for them, though it isn't so clear that __BEGIN_DECLS makes no sense for them. - the log message for the commit that added it is not good, but at least says that C++ support is added. % #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) This ifdef is still misplaced. Defining the 'const' versions doesn't require the gcc builtin, and it is further from requiring gcc asm. % % #define __bswap64_const(_x) \ % (((_x) >> 56) | \ % (((_x) >> 40) & (0xffULL << 8)) | \ % (((_x) >> 24) & (0xffULL << 16)) | \ % (((_x) >> 8) & (0xffULL << 24)) | \ % (((_x) << 8) & (0xffULL << 32)) | \ % (((_x) << 24) & (0xffULL << 40)) | \ % (((_x) << 40) & (0xffULL << 48)) | \ % ((_x) << 56)) I think this can be simplified in the same way as the `var' case should have been simplified, by building it up out of 2 __bswap32_const()s... % % #define __bswap32_const(_x) \ % (((_x) >> 24) | \ % (((_x) & (0xff << 16)) >> 8) | \ % (((_x) & (0xff << 8)) << 8) | \ % ((_x) << 24)) ... and this can be built out of 2 __bswap16_const()s', though it is short enough already. Building up would be essential for __bswap_2^N and good for N > 64. % % #define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) % % static __inline __uint64_t % __bswap64_var(__uint64_t __x) % { % % return __bswap64_const(__x); % } This seems to be a pessimization for amd64, and doesn't match your claim that it now uses 2 bswap instructions on i386. It is the old i386 version. amd64 used to use a single 64-bit bswap in asm here. Last time I looked (only on i386), gcc was incapable of turning either __bswap64_const() or __bswap32_const() into 2 or 1 bswap instructions, but generated pessimial code using shifts and masks. Only clang generated the 2 or 1 bswaps. There is a PR about bswap64 being pessimal on i386. The following seems to be optimal for gcc on i386. It uses the building-up method. See the PR for other details. @ #define _KERNEL @ #define I486_CPU @ @ #include @ #include @ @ uint64_t x, y; @ @ int @ main(void) @ { @ /* @ * Follow is a better __bswap64(). It doesn't even need const and @ * var subcases. @ */ @ y = __bswap32(x) | (uint64_t)__bswap32(x >> 32) << 32; @ return (0); @ } Expanding on its comment, we probably don't even need the const subcase for consts, but can just use the above expression for consts too. However, this only works right for i386. For amd64, there are the following cases: - const case, compiler either gcc or clang: the above expression should work - variable case, gcc: needs the inline with a 64-bit bswap, unless gcc has become smarter - variable case, clang: the above expression won't work if __bswap32() uses an inline asm with a 32-bit bswap like it does now, since clang will be forced to generate 2 32-bit bswaps. To recover to single 64-bit bswap, either write it in inline asm for clang too, or maybe use the general 64-bit 'const' expression (written like it is now, not as in my version above). I think clang translates the big const expression into a single 64-bit bswap, not 2 32-bit ones like it does on i386. % % Extra blank line (old style bug duplicated). % ... % #define __bswap64(_x) \ % (__builtin_constant_p(_x) ? \ % __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) Can be replaced by a "building-up" expression except for complications with clang on amd64. % % #define __bswap32(_x) \ % (__builtin_constant_p(_x) ? \ % __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) Can be replaced by a "building-up" expression except for complications for gcc. (We already killed the asm for __bswap16_var(), so the optimization problem now is to turn the general expression for __bswap32() into a single 32-bit bswap instruction. Only clang does this automatically. % % #define __bswap16(_x) \ % (__builtin_constant_p(_x) ? \ % __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) Need a primitive somewhere -- no building up for this :-). % #ifdef __cplusplus % } % #endif Brackets the 'extern "C"' style bug. but looks uglier with a brace all by itself. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 00:52:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68E15106566C; Wed, 29 Feb 2012 00:52:57 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 491608FC13; Wed, 29 Feb 2012 00:52:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T0qvF7099730; Wed, 29 Feb 2012 00:52:57 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T0qv1E099725; Wed, 29 Feb 2012 00:52:57 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201202290052.q1T0qv1E099725@svn.freebsd.org> From: Andrew Thompson Date: Wed, 29 Feb 2012 00:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232279 - in stable/9: share/man/man4 sys/i386/conf 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, 29 Feb 2012 00:52:57 -0000 Author: thompsa Date: Wed Feb 29 00:52:56 2012 New Revision: 232279 URL: http://svn.freebsd.org/changeset/base/232279 Log: MFC r232008,232010,232080,232089 Using the flowid in the mbuf assumes the network card is giving a good hash for the traffic flow, this may not be the case giving poor traffic distribution. Add a sysctl which allows us to fall back to our own flow hash code. PR: kern/164901 Modified: stable/9/share/man/man4/lagg.4 stable/9/sys/net/ieee8023ad_lacp.c stable/9/sys/net/if_lagg.c stable/9/sys/net/if_lagg.h Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/share/man/man4/lagg.4 ============================================================================== --- stable/9/share/man/man4/lagg.4 Wed Feb 29 00:30:18 2012 (r232278) +++ stable/9/share/man/man4/lagg.4 Wed Feb 29 00:52:56 2012 (r232279) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 18, 2010 +.Dd February 23, 2012 .Dt LAGG 4 .Os .Sh NAME @@ -133,6 +133,21 @@ variable in .Pp The MTU of the first interface to be added is used as the lagg MTU. All additional interfaces are required to have exactly the same value. +.Pp +The +.Ic loadbalance +and +.Ic lacp +modes will use the RSS hash from the network card if available to avoid +computing one, this may give poor traffic distribution if the hash is invalid +or uses less of the protocol header information. +Local hash computation can be forced per interface by setting the +.Va net.link.lagg.X.use_flowid +.Xr sysctl 8 +variable to zero where X is the interface number. +The default for new interfaces is set via the +.Va net.link.lagg.default_use_flowid +.Xr sysctl 8 . .Sh EXAMPLES Create a 802.3ad link aggregation using LACP with two .Xr bge 4 Modified: stable/9/sys/net/ieee8023ad_lacp.c ============================================================================== --- stable/9/sys/net/ieee8023ad_lacp.c Wed Feb 29 00:30:18 2012 (r232278) +++ stable/9/sys/net/ieee8023ad_lacp.c Wed Feb 29 00:52:56 2012 (r232279) @@ -812,7 +812,7 @@ lacp_select_tx_port(struct lagg_softc *s return (NULL); } - if (m->m_flags & M_FLOWID) + if (sc->use_flowid && (m->m_flags & M_FLOWID)) hash = m->m_pkthdr.flowid; else hash = lagg_hashmbuf(m, lsc->lsc_hashkey); Modified: stable/9/sys/net/if_lagg.c ============================================================================== --- stable/9/sys/net/if_lagg.c Wed Feb 29 00:30:18 2012 (r232278) +++ stable/9/sys/net/if_lagg.c Wed Feb 29 00:52:56 2012 (r232279) @@ -171,6 +171,11 @@ static int lagg_failover_rx_all = 0; /* SYSCTL_INT(_net_link_lagg, OID_AUTO, failover_rx_all, CTLFLAG_RW, &lagg_failover_rx_all, 0, "Accept input from any interface in a failover lagg"); +static int def_use_flowid = 1; /* Default value for using M_FLOWID */ +TUNABLE_INT("net.link.lagg.default_use_flowid", &def_use_flowid); +SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid, CTLFLAG_RW, + &def_use_flowid, 0, + "Default setting for using flow id for load sharing"); static int lagg_modevent(module_t mod, int type, void *data) @@ -261,6 +266,8 @@ lagg_clone_create(struct if_clone *ifc, struct ifnet *ifp; int i, error = 0; static const u_char eaddr[6]; /* 00:00:00:00:00:00 */ + struct sysctl_oid *oid; + char num[14]; /* sufficient for 32 bits */ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); ifp = sc->sc_ifp = if_alloc(IFT_ETHER); @@ -269,6 +276,15 @@ lagg_clone_create(struct if_clone *ifc, return (ENOSPC); } + sysctl_ctx_init(&sc->ctx); + snprintf(num, sizeof(num), "%u", unit); + sc->use_flowid = def_use_flowid; + oid = SYSCTL_ADD_NODE(&sc->ctx, &SYSCTL_NODE_CHILDREN(_net_link, lagg), + OID_AUTO, num, CTLFLAG_RD, NULL, ""); + SYSCTL_ADD_INT(&sc->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "use_flowid", CTLTYPE_INT|CTLFLAG_RW, &sc->use_flowid, sc->use_flowid, + "Use flow id for load sharing"); + sc->sc_proto = LAGG_PROTO_NONE; for (i = 0; lagg_protos[i].ti_proto != LAGG_PROTO_NONE; i++) { if (lagg_protos[i].ti_proto == LAGG_PROTO_DEFAULT) { @@ -349,6 +365,7 @@ lagg_clone_destroy(struct ifnet *ifp) LAGG_WUNLOCK(sc); + sysctl_ctx_free(&sc->ctx); ifmedia_removeall(&sc->sc_media); ether_ifdetach(ifp); if_free_type(ifp, IFT_ETHER); @@ -1676,7 +1693,7 @@ lagg_lb_start(struct lagg_softc *sc, str struct lagg_port *lp = NULL; uint32_t p = 0; - if (m->m_flags & M_FLOWID) + if (sc->use_flowid && (m->m_flags & M_FLOWID)) p = m->m_pkthdr.flowid; else p = lagg_hashmbuf(m, lb->lb_key); Modified: stable/9/sys/net/if_lagg.h ============================================================================== --- stable/9/sys/net/if_lagg.h Wed Feb 29 00:30:18 2012 (r232278) +++ stable/9/sys/net/if_lagg.h Wed Feb 29 00:52:56 2012 (r232279) @@ -21,6 +21,8 @@ #ifndef _NET_LAGG_H #define _NET_LAGG_H +#include + /* * Global definitions */ @@ -202,6 +204,8 @@ struct lagg_softc { eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; #endif + struct sysctl_ctx_list ctx; /* sysctl variables */ + int use_flowid; /* use M_FLOWID */ }; struct lagg_port { From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 01:36:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 638011065670; Wed, 29 Feb 2012 01:36:01 +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 44CA98FC1D; Wed, 29 Feb 2012 01:36:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T1a1Rm001370; Wed, 29 Feb 2012 01:36:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T1a1de001366; Wed, 29 Feb 2012 01:36:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202290136.q1T1a1de001366@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 01:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232283 - stable/9/sys/fs/msdosfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 01:36:01 -0000 Author: kib Date: Wed Feb 29 01:36:00 2012 New Revision: 232283 URL: http://svn.freebsd.org/changeset/base/232283 Log: MFC r231998: Use DOINGASYNC() to test for async allowance, to honor VFS syncing requests. Modified: stable/9/sys/fs/msdosfs/msdosfs_denode.c stable/9/sys/fs/msdosfs/msdosfs_lookup.c stable/9/sys/fs/msdosfs/msdosfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_denode.c Wed Feb 29 01:35:21 2012 (r232282) +++ stable/9/sys/fs/msdosfs/msdosfs_denode.c Wed Feb 29 01:36:00 2012 (r232283) @@ -431,7 +431,7 @@ detrunc(dep, length, flags, cred, td) if (allerror) printf("detrunc(): vtruncbuf error %d\n", allerror); #endif - error = deupdat(dep, !(DETOV(dep)->v_mount->mnt_flag & MNT_ASYNC)); + error = deupdat(dep, !DOINGASYNC((DETOV(dep)))); if (error != 0 && allerror == 0) allerror = error; #ifdef MSDOSFS_DEBUG @@ -510,7 +510,7 @@ deextend(dep, length, cred) } dep->de_FileSize = length; dep->de_flag |= DE_UPDATE | DE_MODIFIED; - return (deupdat(dep, !(DETOV(dep)->v_mount->mnt_flag & MNT_ASYNC))); + return (deupdat(dep, !DOINGASYNC(DETOV(dep)))); } /* Modified: stable/9/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_lookup.c Wed Feb 29 01:35:21 2012 (r232282) +++ stable/9/sys/fs/msdosfs/msdosfs_lookup.c Wed Feb 29 01:36:00 2012 (r232283) @@ -690,7 +690,7 @@ createde(dep, ddep, depp, cnp) while (--ddep->de_fndcnt >= 0) { if (!(ddep->de_fndoffset & pmp->pm_crbomask)) { - if (DETOV(ddep)->v_mount->mnt_flag & MNT_ASYNC) + if (DOINGASYNC(DETOV(ddep))) bdwrite(bp); else if ((error = bwrite(bp)) != 0) return error; @@ -720,7 +720,7 @@ createde(dep, ddep, depp, cnp) } } - if (DETOV(ddep)->v_mount->mnt_flag & MNT_ASYNC) + if (DOINGASYNC(DETOV(ddep))) bdwrite(bp); else if ((error = bwrite(bp)) != 0) return error; @@ -1022,7 +1022,7 @@ removede(pdep, dep) || ep->deAttributes != ATTR_WIN95) break; } - if (DETOV(pdep)->v_mount->mnt_flag & MNT_ASYNC) + if (DOINGASYNC(DETOV(pdep))) bdwrite(bp); else if ((error = bwrite(bp)) != 0) return error; Modified: stable/9/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_vnops.c Wed Feb 29 01:35:21 2012 (r232282) +++ stable/9/sys/fs/msdosfs/msdosfs_vnops.c Wed Feb 29 01:36:00 2012 (r232283) @@ -1249,7 +1249,7 @@ abortit: putushort(dotdotp->deStartCluster, dp->de_StartCluster); if (FAT32(pmp)) putushort(dotdotp->deHighClust, dp->de_StartCluster >> 16); - if (fvp->v_mount->mnt_flag & MNT_ASYNC) + if (DOINGASYNC(fvp)) bdwrite(bp); else if ((error = bwrite(bp)) != 0) { /* XXX should downgrade to ro here, fs is corrupt */ @@ -1383,7 +1383,7 @@ msdosfs_mkdir(ap) putushort(denp[1].deHighClust, pdep->de_StartCluster >> 16); } - if (ap->a_dvp->v_mount->mnt_flag & MNT_ASYNC) + if (DOINGASYNC(ap->a_dvp)) bdwrite(bp); else if ((error = bwrite(bp)) != 0) goto bad; From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 01:39:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED3A1106566B; Wed, 29 Feb 2012 01:39:39 +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 D849F8FC16; Wed, 29 Feb 2012 01:39:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T1dd8U001564; Wed, 29 Feb 2012 01:39:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T1ddtj001562; Wed, 29 Feb 2012 01:39:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202290139.q1T1ddtj001562@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 01:39:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232285 - stable/9/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 01:39:41 -0000 Author: kib Date: Wed Feb 29 01:39:39 2012 New Revision: 232285 URL: http://svn.freebsd.org/changeset/base/232285 Log: MFC r232003: Properly lock DQREF() with dqhlock. Missed locking caused counter corruption. Assert that the dq reference value is sane before decrementing it. Modified: stable/9/sys/ufs/ufs/ufs_quota.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_quota.c Wed Feb 29 01:38:36 2012 (r232284) +++ stable/9/sys/ufs/ufs/ufs_quota.c Wed Feb 29 01:39:39 2012 (r232285) @@ -1469,6 +1469,7 @@ dqrele(struct vnode *vp, struct dquot *d if (dq == NODQUOT) return; DQH_LOCK(); + KASSERT(dq->dq_cnt > 0, ("Lost dq %p reference 1", dq)); if (dq->dq_cnt > 1) { dq->dq_cnt--; DQH_UNLOCK(); @@ -1479,6 +1480,7 @@ sync: (void) dqsync(vp, dq); DQH_LOCK(); + KASSERT(dq->dq_cnt > 0, ("Lost dq %p reference 2", dq)); if (--dq->dq_cnt > 0) { DQH_UNLOCK(); @@ -1658,6 +1660,7 @@ quotaref(vp, qrp) */ found = 0; ip = VTOI(vp); + mtx_lock(&dqhlock); for (i = 0; i < MAXQUOTAS; i++) { if ((dq = ip->i_dquot[i]) == NODQUOT) continue; @@ -1665,6 +1668,7 @@ quotaref(vp, qrp) qrp[i] = dq; found++; } + mtx_unlock(&dqhlock); return (found); } From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 01:56:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19206106566B; Wed, 29 Feb 2012 01:56:24 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id A359D8FC0A; Wed, 29 Feb 2012 01:56:23 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1T1uLqB006250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 12:56:22 +1100 Date: Wed, 29 Feb 2012 12:56:21 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20120229105104.K1479@besplex.bde.org> Message-ID: <20120229115001.F1479@besplex.bde.org> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120229105104.K1479@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Tijl Coosemans , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Wed, 29 Feb 2012 01:56:24 -0000 On Wed, 29 Feb 2012, Bruce Evans wrote: > On Tue, 28 Feb 2012, Tijl Coosemans wrote: > > The patch is unreadable due to significant reimplementations, even without > the move. So I looked at the resulting x86/endian.h: Oops. I somehow looked at the old i386 version. The committed version is mostly OK, and fixes or avoids most of the bugs that I pointed out: % #ifdef __cplusplus % extern "C" { % #endif Still have this. % #define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) % % #define __bswap16(_x) \ % (__builtin_constant_p(_x) ? \ % __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) There seems to be no need for the const and var cases for 16 bits (use the expression for the const case unconditionally, with more casts in it). We haven't remove the bogus underscores in macro parameter names yet. % % #define __bswap32_const(_x) \ % (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) Now uses "building-up". % % #define __bswap32(_x) \ % (__builtin_constant_p(_x) ? \ % __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) The technical considerations described in my previous mail prevent killing the separate cases and using pure building up from 16 bits to 32 and 64 bits. This is quite confusing. __bswap32_const() is perfectly general since it uses the general __bswap16() macros, but it is spelled with a `const'. OTOH, __bswap32() is perfectly general by name and functionality, but is only useful for the `var' case. % ... % static __inline __uint16_t % __bswap16_var(__uint16_t _x) % { % % return (__bswap16_const(_x)); % } Not needed, since we killed the asm for the 16-bit case. % % static __inline __uint32_t % __bswap32_var(__uint32_t _x) % { % % __asm ("bswap %0" : "+r" (_x)); % return (_x); % } % % static __inline __uint64_t % __bswap64_var(__uint64_t _x) % { % #ifdef _LP64 Tab instead of space after ifdef. I think it is gcc and not _LP64 that needs this help. % __asm ("bswap %0" : "+r" (_x)); % return (_x); % #else % return (__bswap64_const(_x)); The use of `const' here confused me into thinking that this still uses the old slow `const' code. % #endif % } % ... % #ifdef __cplusplus % } % #endif Still have this. The best cleanups seem to be: - use general building up with no asms and no inline functions for the default case (put this in a MI header) - use asms for gcc. I think the following works for minimizing the ifdefs for this: - start with bswap32(), etc., defined directly to the default using building up (I'm trying to avoid having the __bswap32() layer too) - to override this, just #undef it and redefine it with a gcc asm in it (it seems best to use a statement expression and not an inline) or: - start with __bswap32() defined to the default using building up - normally define bswap32 to __bswap32. Otherwise, define bswap32 to our special asm or C implementation. or: - some combination of the above. We can use __bswap32 in an inline function with the same name, and then #undef the macro: % #define __bswap32(x) (...) % % int % (__bswap32)(int _x) % { % #ifdef asm_case % {( asm(... % #else % return (__bswap32(_x)); % #endif % } % % #undef __bswap32 This technique permits the default macros to use the best names and not require adorning them with _const or _var or maybe even __ and then needing more layers to #define them back to the best names. I don't know how to do this without turning the macro into an inline function. There is related magic for macros that I forget. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 02:01:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 282D1106564A; Wed, 29 Feb 2012 02:01:49 +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 148098FC18; Wed, 29 Feb 2012 02:01:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T21mD8002304; Wed, 29 Feb 2012 02:01:48 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T21mLQ002302; Wed, 29 Feb 2012 02:01:48 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201202290201.q1T21mLQ002302@svn.freebsd.org> From: David Xu Date: Wed, 29 Feb 2012 02:01: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: r232286 - 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, 29 Feb 2012 02:01:49 -0000 Author: davidxu Date: Wed Feb 29 02:01:48 2012 New Revision: 232286 URL: http://svn.freebsd.org/changeset/base/232286 Log: initialize clock ID and flags only when copying timespec, a _umtx_time copy already contains these fields. Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Wed Feb 29 01:39:39 2012 (r232285) +++ head/sys/kern/kern_umtx.c Wed Feb 29 02:01:48 2012 (r232286) @@ -2937,11 +2937,11 @@ umtx_copyin_umtx_time(const void *addr, { int error; - tp->_clockid = CLOCK_REALTIME; - tp->_flags = 0; - if (size <= sizeof(struct timespec)) + if (size <= sizeof(struct timespec)) { + tp->_clockid = CLOCK_REALTIME; + tp->_flags = 0; error = copyin(addr, &tp->_timeout, sizeof(struct timespec)); - else + } else error = copyin(addr, tp, sizeof(struct _umtx_time)); if (error != 0) return (error); From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 04:05:31 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2005F1065673; Wed, 29 Feb 2012 04:05:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 9E31D8FC1A; Wed, 29 Feb 2012 04:05:30 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1T45Qlw019787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 15:05:27 +1100 Date: Wed, 29 Feb 2012 15:05:26 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Best In-Reply-To: <20120228194520.GA56030@freebsd.org> Message-ID: <20120229141447.F2092@besplex.bde.org> References: <201202261514.q1QFET0v070810@svn.freebsd.org> <20120228194520.GA56030@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Jilles Tjoelker , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r232183 - 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, 29 Feb 2012 04:05:31 -0000 On Tue, 28 Feb 2012, Alexander Best wrote: > On Sun Feb 26 12, Jilles Tjoelker wrote: >> Log: >> Fix fchmod() and fchown() on fifos. >> >> The new fifo implementation in r232055 broke fchmod() and fchown() on fifos. >> Postfix needs this. > > clang seems to have a problem with this commit: > > usr/subversion-src/sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of K&R function parameter is not compatible with the parameter type 'mode_t' (aka 'unsigned short') declared in a previous prototype [-Werror] > mode_t mode; > ^ > /usr/subversion-src/sys/kern/sys_pipe.c:155:19: note: previous declaration is here > static fo_chmod_t pipe_chmod; > ^ > 1 error generated. > *** Error code 1 Indeed, sys_pipe.c still uses mostly K&R-style function definitions, and the recent change was compatible with this to a fault. It is an old bug in gcc that it accepts function definitions that don't match their prototype. The most common error is the one here -- the function definition is K&R and has a type smaller than its promotion; the prototype must give the promoted type to match, but this breaks it for use with function definitions that are not K&R and use the narrow type. It is an old design error to have APIs that pass narrowed types. Passing narrowed types is normally just a pessimization. The ABI normally requires passing a widened value. The widened value may have garbage in the extra bits, but for safety and to support missing prototypes, in practice callers must sign-extend or zero-extend the narrow value. The for safety and to support missing prototypes, in practice callees can't trust callers to have done this, so they force to a narrow value. Then to actually use the value, they often have to widen it again. The result is often a couple of extra instructions after optimizing away only half of the logical extra conversions for this. So the supposed optimization of passing narrow types is usually a pessimization. Maybe this is a good pessimization for private APIs, but it shouldn't be required for external ones. Narrow types in syscalls are especially bad. Now the C API doesn't really extend across the syscall boundary, so both sides have to force the above conversions or depend on the compiler doing them because it fears missing prototypes. In practice, FreeBSD depends on the compiler doing them for most or all arches. The narrow mode_t for open(2) is worst. It is the only narrow type in in a core syscall, and has further problems. The prototype for open() is "int open(const char *path, int flags, ...);", with the only option for "..." being a mode_t. open() is thus variadic, but variadic functions really can't be passed a narrowed type like mode_t, and syscalls can't really pass this either. FreeBSD used to depend on various type puns near here, and still has my XXX comments in syscalls.master about them, but some of them have been fixed. The largest one is that the kernel assumes that the mode_t arg is always there. It copies stack garbage if it is not there, and only later checks the flags and avoids using the stack garbage when there is no arg there. This is not too bad if done intentionally. It must be arranged that the stack garbage is in accessible memory, but it always is in practice. The kernel is carefully to access the arg as an int and not as a mode_t, and to pass it down through too many layers as an int. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 05:01:40 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87E43106564A; Wed, 29 Feb 2012 05:01:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id 07CC88FC1A; Wed, 29 Feb 2012 05:01:39 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1T51aSK019498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 16:01:37 +1100 Date: Wed, 29 Feb 2012 16:01:36 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201202282217.q1SMHrIk094780@svn.freebsd.org> Message-ID: <20120229151223.K2273@besplex.bde.org> References: <201202282217.q1SMHrIk094780@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: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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: Wed, 29 Feb 2012 05:01:40 -0000 On Tue, 28 Feb 2012, Tijl Coosemans wrote: > Log: > Copy amd64 setjmp.h to x86 and replace amd64/i386/pc98 setjmp.h with stubs. This may be correct (except for comment), but it is confusing. > Added: > head/sys/x86/include/setjmp.h > - copied unchanged from r232268, head/sys/amd64/include/setjmp.h > Modified: > head/sys/amd64/include/setjmp.h > head/sys/i386/include/setjmp.h > head/sys/pc98/include/setjmp.h > > Modified: head/sys/amd64/include/setjmp.h > ============================================================================== > --- head/sys/amd64/include/setjmp.h Tue Feb 28 22:15:46 2012 (r232274) > +++ head/sys/amd64/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275) > @@ -1,50 +1,6 @@ > ... > -#define _JBLEN 12 /* Size of the jmp_buf on AMD64. */ > - > -/* > - * jmp_buf and sigjmp_buf are encapsulated in different structs to force > - * compile-time diagnostics for mismatches. The structs are the same > - * internally to avoid some run-time errors for mismatches. > - */ > -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE > -typedef struct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1]; > -#endif > - > -typedef struct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1]; On amd64, the comment was specific to amd64 (but with amd64 misspelled as AMD64), and actually matched the code. > Modified: head/sys/i386/include/setjmp.h > ============================================================================== > --- head/sys/i386/include/setjmp.h Tue Feb 28 22:15:46 2012 (r232274) > +++ head/sys/i386/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275) > @@ -1,50 +1,6 @@ > -#define _JBLEN 11 /* Size of the jmp_buf on x86. */ > - > -/* > - * jmp_buf and sigjmp_buf are encapsulated in different structs to force > - * compile-time diagnostics for mismatches. The structs are the same > - * internally to avoid some run-time errors for mismatches. > - */ > -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE > -typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; > -#endif > - > -typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1]; On i386, the comment had a differently wrong name for the old code, and mismatched the old code, but is correct for the new code. _JBLEN was apparently 1 less than what it was claimed to be on i386. I forget what the extra 1 is for. > Copied: head/sys/x86/include/setjmp.h (from r232268, head/sys/amd64/include/setjmp.h) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/x86/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275, copy of r232268, head/sys/amd64/include/setjmp.h) > @@ -0,0 +1,50 @@ > ... > +#define _JBLEN 12 /* Size of the jmp_buf on AMD64. */ This code looks wrong, since _JBLEN was only 11 for i386, but binary compatibility of the jmp_buf is preserved by the extra 1 in it. This comment is wrong, since the code is no longer just for AMD64 (sic), and the comment makes it look more like the code has an off-by-1 error for !AMD64. > + > +/* > + * jmp_buf and sigjmp_buf are encapsulated in different structs to force > + * compile-time diagnostics for mismatches. The structs are the same > + * internally to avoid some run-time errors for mismatches. > + */ > +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE > +typedef struct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1]; > +#endif > + > +typedef struct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1]; No extra 1 for either now. The extra 1 was apparently a placeholder for the signal mask and became obsolete 15-20 years ago. 4.4BSD-Lite2 claims not to support the signal mask, and doesn't have space for it in the plain jmp_buf. setjmp.h was in src/include and was moved to MD files to clean up its ifdefs. Now we're barely escaping putting the ifdefs back in the x86 version, sigh. Ifdefs are really needed, since the i386 version is too small to have space for mxcsr, and mxcsr is only hacked into the amd64 version by packing it using the doubled space given by long entries. >From the 4.4BSD-Lite2 version: % #if defined(hp300) || defined(__hp300__) || defined(luna68k) || defined(__luna68k__) % #define _JBLEN 17 % #endif % % #if defined(i386) || defined(__i386__) % #define _JBLEN 10 % #endif % % #if defined(mips) || defined(__mips__) % #define _JBLEN 83 % #endif % % #if defined(sparc) || defined(__sparc__) % #define _JBLEN 10 % #endif % % #if defined(tahoe) || defined(__tahoe__) % #define _JBLEN 10 % #endif % % #if defined(vax) || defined(__vax__) % #define _JBLEN 10 % #endif % % #ifndef _ANSI_SOURCE % /* % * WARNING: sigsetjmp() isn't supported yet, this is a placeholder. % */ % typedef int sigjmp_buf[_JBLEN + 1]; % #endif /* not ANSI */ % % typedef int jmp_buf[_JBLEN]; The extra 1 seems to have been nonsense there too. BSD has always (?) saved the signal mask in the ordinary jmp_buf. 4.4BSD-Lite2 seems to do this, and could hardly have worked without it. So _JBLEN was already large enough and didn't need a placeholder for the signal mask. But I now vaguely remember stealing this extra 1 for the FP control word. It was sloppy not to update the comment. Later, jb left the extra 1 and the comment alone. The commit log says that _JBLEN was left in case something (mis)uses it. I think it should be removed. It should only be used in the 2 jmp_buf structs, and now that sigsetjmp() has been standard for so long, and since making the structure layouts identical is best for any system which saves the signal mask in setjmp() and probably also on any system that doesn't, I don't see any need for separate jmp_buf structs (just use separate typedefs using the same struct). Next, I don't see why can't be MI except for the definition of _JBLEN. _JBLEN can be declared in some harmless MD header that is already usually included. Since we removed machine/ansi.h, machine/types.h seems to be the only suitable one. Here is what current arches have in their machine/setjmp.h: amd64, i386: not much arm: has lots of comments and register offsets. These are defined as _JB_REG_* so they aren't pollution, but there is no reason to export them to the application either. The actual structs are the usual 2 arrays of ints, with the extra 1 for both the comment not matching the code, as on i386. The extra 1 is unused, or at least has no _JB_REG_* for it. ia64: has lots of namespace-pollution definitions under a __BSD_VISIBLE ifdef. The structs are arrays of long doubles! This defeats my idea of using a MI array of register_t's. _JBLEN could be expanded for long doubles, but __align() would be required too, and it gets messier than a separate file. mips: just the usual extra 1 (now 4 instances for 32/64 doubling) and the usual comment not matching the code. powerpc: like x86 sparc64: just the usual extra 1. The comment is fixed by removing it. So the extra 1 seems to be just a ~20-year old mistake, faithfully propagated to all arches except amd64 i386, with unfaithful propagation just fixed for i386. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 05:14:00 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0CD80106566B; Wed, 29 Feb 2012 05:14:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 5F5F48FC0A; Wed, 29 Feb 2012 05:13:58 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1T5DtDp018501 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 16:13:56 +1100 Date: Wed, 29 Feb 2012 16:13:55 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201202282222.26343.tijl@freebsd.org> Message-ID: <20120229160522.W2514@besplex.bde.org> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <4F4D3F5D.70905@FreeBSD.org> <201202282222.26343.tijl@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, Dimitry Andric Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Wed, 29 Feb 2012 05:14:00 -0000 On Tue, 28 Feb 2012, Tijl Coosemans wrote: > On Tuesday 28 February 2012 21:55:57 Dimitry Andric wrote: >> On 2012-02-28 20:39, Tijl Coosemans wrote: >>> Log: >>> Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace >>> amd64/i386/pc98 endian.h with stubs. >>> >>> In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been >>> resolved by reimplementing the macro in terms of __bswap32(x). As a side >>> effect __bswap64_var(x) is now implemented using two bswap instructions on >>> i386 and should be much faster. __bswap32_const(x) has been reimplemented >>> in terms of __bswap16(x) for consistency. >> ... >>> +#define __bswap32_const(_x) \ >>> + (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) >>> + >>> +#define __bswap32(_x) \ >>> + (__builtin_constant_p(_x) ? \ >>> + __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) >>> + >>> +#define __bswap64_const(_x) \ >>> + (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32)) >> >> Hmm, shouldn't __bswap32_const() be implemented in terms of >> __bswap16_const(), and similarly for __bswap64_const(), which should be >> implemented in terms of __bswap32_const()? >> >> The whole reason for the difficult dance with __builtin_constant_p is to >> allow for compile-time resolving of bswap'd constants. Invoking the >> regular __bswap() macros doesn't gain you anything here. > > __bswap64_const is also used in __bswap64_var, so its argument isn't > always a compile time constant and then __bswap32 becomes __bswap32_var. > If it is a constant __bswap32 becomes __bswap32_const (even at -O0). I cleaned this up a bit according to ideas in my previous mails, and added a comment about the confusing use of __bswap64_const() (now named __bswap64_gen()) in __bswap64_var(): % Index: endian.h % =================================================================== % RCS file: /home/ncvs/src/sys/x86/include/endian.h,v % retrieving revision 1.1 % diff -u -2 -r1.1 endian.h % --- endian.h 28 Feb 2012 19:39:54 -0000 1.1 % +++ endian.h 29 Feb 2012 03:10:33 -0000 % @@ -37,8 +37,4 @@ % #include % % -#ifdef __cplusplus % -extern "C" { % -#endif % - % /* % * Define the order of 32-bit words in 64-bit words. % @@ -68,32 +64,24 @@ % #endif % % -#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) % - % -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) % - % -#define __bswap16(_x) \ % - (__builtin_constant_p(_x) ? \ % - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) % - % -#define __bswap32_const(_x) \ % - (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) % - % -#define __bswap32(_x) \ % - (__builtin_constant_p(_x) ? \ % - __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) % +#define ___bswap16(x) (__uint16_t)((x) << 8 | (x) >> 8) % +#define __bswap16(x) (___bswap16((__uint16_t)(x))) % +#define __bswap32_gen(x) \ % + (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16)) % +#define __bswap64_gen(x) \ % + (((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32)) % % -#define __bswap64_const(_x) \ % - (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32)) % - % -#define __bswap64(_x) \ % - (__builtin_constant_p(_x) ? \ % - __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) % +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) % % -static __inline __uint16_t % -__bswap16_var(__uint16_t _x) % -{ % +/* % + * The following messes are old optimizations for gcc. The messes have % + * been reduced significantly, but I don't know how to implement the % + * preferred way of defining defaults above and overriding them cleanly % + * here. Even clang needs help for the 64-bit case, so to keep the % + * ifdefs sane we use this for the 32-bit case with clang too. % + */ % % - return (__bswap16_const(_x)); % -} % +#define __bswap32(x) \ % + (__builtin_constant_p(x) ? \ % + __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) % % static __inline __uint32_t % @@ -105,34 +93,35 @@ % } % % +#define __bswap64(x) \ % + (__builtin_constant_p(x) ? \ % + __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x)) % + % static __inline __uint64_t % __bswap64_var(__uint64_t _x) % { % -#ifdef _LP64 % + % +#ifdef _LP64 % __asm ("bswap %0" : "+r" (_x)); % return (_x); % #else % - return (__bswap64_const(_x)); % + /* % + * It is important for the optimizations that the following is not % + * really generic, but expands to 2 __bswap32_var()'s. % + */ % + return (__bswap64_gen(_x)); % #endif % } % % -#define __htonl(x) __bswap32(x) % -#define __htons(x) __bswap16(x) % -#define __ntohl(x) __bswap32(x) % -#define __ntohs(x) __bswap16(x) % - % -#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */ % +#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ % % -/* % - * No optimizations are available for this compiler. Fall back to % - * non-optimized functions by defining the constant usually used to prevent % - * redefinition. % - */ % -#define _BYTEORDER_FUNC_DEFINED % +#define __bswap32(x) (__bswap32_gen((__uint32_t)(x))) % +#define __bswap64(x) (__bswap64_gen((__uint64_t)(x))) % % #endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ % % -#ifdef __cplusplus % -} % -#endif % +#define __htonl(x) __bswap32(x) % +#define __htons(x) __bswap16(x) % +#define __ntohl(x) __bswap32(x) % +#define __ntohs(x) __bswap16(x) % % #endif /* !_MACHINE_ENDIAN_H_ */ This passes simple tests, but I had to restore some messes for clang that I originally left out to get clang to optimize __bswap64() like it did before for the `var' case. clang apparently only understands the general expression for __bswapN() up to N = 32. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 05:41:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 956201065676; Wed, 29 Feb 2012 05:41:30 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 675C88FC12; Wed, 29 Feb 2012 05:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T5fU3T010963; Wed, 29 Feb 2012 05:41:30 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T5fU7r010961; Wed, 29 Feb 2012 05:41:30 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201202290541.q1T5fU7r010961@svn.freebsd.org> From: Alan Cox Date: Wed, 29 Feb 2012 05:41: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: r232288 - 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, 29 Feb 2012 05:41:30 -0000 Author: alc Date: Wed Feb 29 05:41:29 2012 New Revision: 232288 URL: http://svn.freebsd.org/changeset/base/232288 Log: Simplify kmem_alloc() by eliminating code that existed on account of external pagers in Mach. FreeBSD doesn't implement external pagers. Moreover, it don't pageout the kernel object. So, the reasons for having code don't hold. Reviewed by: kib MFC after: 6 weeks Modified: head/sys/vm/vm_kern.c Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Wed Feb 29 02:04:41 2012 (r232287) +++ head/sys/vm/vm_kern.c Wed Feb 29 05:41:29 2012 (r232288) @@ -161,7 +161,6 @@ kmem_alloc(map, size) { vm_offset_t addr; vm_offset_t offset; - vm_offset_t i; size = round_page(size); @@ -187,35 +186,6 @@ kmem_alloc(map, size) vm_map_unlock(map); /* - * Guarantee that there are pages already in this object before - * calling vm_map_wire. This is to prevent the following - * scenario: - * - * 1) Threads have swapped out, so that there is a pager for the - * kernel_object. 2) The kmsg zone is empty, and so we are - * kmem_allocing a new page for it. 3) vm_map_wire calls vm_fault; - * there is no page, but there is a pager, so we call - * pager_data_request. But the kmsg zone is empty, so we must - * kmem_alloc. 4) goto 1 5) Even if the kmsg zone is not empty: when - * we get the data back from the pager, it will be (very stale) - * non-zero data. kmem_alloc is defined to return zero-filled memory. - * - * We're intentionally not activating the pages we allocate to prevent a - * race with page-out. vm_map_wire will wire the pages. - */ - VM_OBJECT_LOCK(kernel_object); - for (i = 0; i < size; i += PAGE_SIZE) { - vm_page_t mem; - - mem = vm_page_grab(kernel_object, OFF_TO_IDX(offset + i), - VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_RETRY); - mem->valid = VM_PAGE_BITS_ALL; - KASSERT((mem->oflags & VPO_UNMANAGED) != 0, - ("kmem_alloc: page %p is managed", mem)); - } - VM_OBJECT_UNLOCK(kernel_object); - - /* * And finally, mark the data as non-pageable. */ (void) vm_map_wire(map, addr, addr + size, From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 05:48:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 783C8106566B; Wed, 29 Feb 2012 05:48:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 631578FC15; Wed, 29 Feb 2012 05:48:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T5mUjg011234; Wed, 29 Feb 2012 05:48:30 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T5mUfd011230; Wed, 29 Feb 2012 05:48:30 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201202290548.q1T5mUfd011230@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Wed, 29 Feb 2012 05:48: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: r232289 - in head/sys/mips/cavium: . octe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 05:48:30 -0000 Author: gonzo Date: Wed Feb 29 05:48:29 2012 New Revision: 232289 URL: http://svn.freebsd.org/changeset/base/232289 Log: Revert part of old logic of assigning MAC addressess: - Reserver respective number of addresses for managment port - octm uses base address directly - other drivers get MACs on "first come first served" basis Reviewed by: juli Modified: head/sys/mips/cavium/files.octeon1 head/sys/mips/cavium/if_octm.c head/sys/mips/cavium/octe/ethernet-common.c Modified: head/sys/mips/cavium/files.octeon1 ============================================================================== --- head/sys/mips/cavium/files.octeon1 Wed Feb 29 05:41:29 2012 (r232288) +++ head/sys/mips/cavium/files.octeon1 Wed Feb 29 05:48:29 2012 (r232289) @@ -24,7 +24,6 @@ mips/cavium/cryptocteon/cryptocteon.c o mips/mips/octeon_cop2_swtch.S standard mips/mips/octeon_cop2.c standard -# octm must be first, so management ports get the first MAC addresses mips/cavium/if_octm.c optional octm contrib/octeon-sdk/cvmx-mgmt-port.c optional octm Modified: head/sys/mips/cavium/if_octm.c ============================================================================== --- head/sys/mips/cavium/if_octm.c Wed Feb 29 05:41:29 2012 (r232288) +++ head/sys/mips/cavium/if_octm.c Wed Feb 29 05:48:29 2012 (r232289) @@ -63,7 +63,6 @@ #include #include #include -#include "octe/ethernet-common.h" struct octm_softc { struct ifnet *sc_ifp; @@ -177,10 +176,10 @@ octm_attach(device_t dev) /* * Set MAC address for this management port. */ - if (cvm_assign_mac_address(&mac, NULL) != 0) { - device_printf(dev, "unable to allocate MAC address.\n"); - return (ENXIO); - } + mac = 0; + memcpy((u_int8_t *)&mac + 2, cvmx_sysinfo_get()->mac_addr_base, 6); + mac += sc->sc_port; + cvmx_mgmt_port_set_mac(sc->sc_port, mac); /* No watermark for input ring. */ Modified: head/sys/mips/cavium/octe/ethernet-common.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-common.c Wed Feb 29 05:41:29 2012 (r232288) +++ head/sys/mips/cavium/octe/ethernet-common.c Wed Feb 29 05:48:29 2012 (r232289) @@ -46,8 +46,8 @@ __FBSDID("$FreeBSD$"); extern int octeon_is_simulation(void); -static uint64_t mac_addr = 0; -static uint32_t mac_offset = 0; +static uint64_t cvm_oct_mac_addr = 0; +static uint32_t cvm_oct_mac_addr_offset = 0; /** * Set the multicast list. Currently unimplemented. @@ -102,22 +102,42 @@ void cvm_oct_common_set_multicast_list(s int cvm_assign_mac_address(uint64_t *macp, uint8_t *octets) { /* Initialize from global MAC address base; fail if not set */ - if (mac_addr == 0) { - memcpy((uint8_t *)&mac_addr + 2, cvmx_sysinfo_get()->mac_addr_base, 6); - if (mac_addr == 0) + if (cvm_oct_mac_addr == 0) { + memcpy((uint8_t *)&cvm_oct_mac_addr + 2, + cvmx_sysinfo_get()->mac_addr_base, 6); + + if (cvm_oct_mac_addr == 0) return ENXIO; + + /* + * The offset from mac_addr_base that should be used for the next port + * that is configured. By convention, if any mgmt ports exist on the + * chip, they get the first mac addresses. The ports controlled by + * driver that use this function are numbered sequencially following + * any mgmt addresses that may exist. + * + * XXX Would be nice if __cvmx_mgmt_port_num_ports() were + * not static to cvmx-mgmt-port.c. + */ + if (OCTEON_IS_MODEL(OCTEON_CN56XX)) + cvm_oct_mac_addr_offset = 1; + else if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN63XX)) + cvm_oct_mac_addr_offset = 2; + else + cvm_oct_mac_addr_offset = 0; + cvm_oct_mac_addr += cvm_oct_mac_addr_offset; } - if (mac_offset >= cvmx_sysinfo_get()->mac_addr_count) + if (cvm_oct_mac_addr_offset >= cvmx_sysinfo_get()->mac_addr_count) return ENXIO; /* Out of addresses to assign */ if (macp) - *macp = mac_addr; + *macp = cvm_oct_mac_addr; if (octets) - memcpy(octets, (u_int8_t *)&mac_addr + 2, 6); + memcpy(octets, (u_int8_t *)&cvm_oct_mac_addr + 2, 6); - mac_addr++; - mac_offset++; + cvm_oct_mac_addr++; + cvm_oct_mac_addr_offset++; return 0; } From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 06:19:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A4E3106566B; Wed, 29 Feb 2012 06:19:01 +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 1B09F8FC15; Wed, 29 Feb 2012 06:19:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T6J0H9012251; Wed, 29 Feb 2012 06:19:00 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T6J0h3012246; Wed, 29 Feb 2012 06:19:00 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201202290619.q1T6J0h3012246@svn.freebsd.org> From: David Xu Date: Wed, 29 Feb 2012 06:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232290 - in stable/9: lib/libc/sys sys/compat/freebsd32 sys/i386/conf 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: Wed, 29 Feb 2012 06:19:01 -0000 Author: davidxu Date: Wed Feb 29 06:19:00 2012 New Revision: 232290 URL: http://svn.freebsd.org/changeset/base/232290 Log: MFC 230857: If multiple threads call kevent() to get AIO events on same kqueue fd, it is possible that a single AIO event will be reported to multiple threads, it is not threading friendly, and the existing API can not control this behavior. Allocate a kevent flags field sigev_notify_kevent_flags for AIO event notification in sigevent, and allow user to pass EV_CLEAR, EV_DISPATCH or EV_ONESHOT to AIO kernel code, user can control whether the event should be cleared once it is retrieved by a thread. This change should be comptaible with existing application, because the field should have already been zero-filled, and no additional action will be taken by kernel. PR: kern/156567 MFC 231006: Add 32-bit compat code for AIO kevent flags introduced in revision 230857. MFC 231724: Add notes about sigev_notify_kevent_flags introduced in revision 230857 which enables thread-friendly polling on same fd for AIO events. Reviewed by: delphij MFC 231777: Bump .Dd date for previous revision. Modified: stable/9/lib/libc/sys/kqueue.2 stable/9/sys/compat/freebsd32/freebsd32_signal.h stable/9/sys/kern/vfs_aio.c stable/9/sys/sys/signal.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/lib/libc/sys/kqueue.2 ============================================================================== --- stable/9/lib/libc/sys/kqueue.2 Wed Feb 29 05:48:29 2012 (r232289) +++ stable/9/lib/libc/sys/kqueue.2 Wed Feb 29 06:19:00 2012 (r232290) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2009 +.Dd February 15, 2012 .Dt KQUEUE 2 .Os .Sh NAME @@ -322,6 +322,9 @@ The sigevent portion of the AIO request .Va sigev_notify_kqueue containing the descriptor of the kqueue that the event should be attached to, +.Va sigev_notify_kevent_flags +containing the kevent flags which should be EV_ONESHOT, EV_CLEAR or +EV_DISPATCH, .Va sigev_value containing the udata value, and .Va sigev_notify Modified: stable/9/sys/compat/freebsd32/freebsd32_signal.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_signal.h Wed Feb 29 05:48:29 2012 (r232289) +++ stable/9/sys/compat/freebsd32/freebsd32_signal.h Wed Feb 29 06:19:00 2012 (r232290) @@ -92,6 +92,7 @@ struct sigevent32 { uint32_t _function; uint32_t _attribute; } _sigev_thread; + unsigned short _kevent_flags; uint32_t __spare__[8]; } _sigev_un; }; Modified: stable/9/sys/kern/vfs_aio.c ============================================================================== --- stable/9/sys/kern/vfs_aio.c Wed Feb 29 05:48:29 2012 (r232289) +++ stable/9/sys/kern/vfs_aio.c Wed Feb 29 06:19:00 2012 (r232290) @@ -1524,6 +1524,7 @@ aio_aqueue(struct thread *td, struct aio int error; int fd, kqfd; int jid; + u_short evflags; if (p->p_aioinfo == NULL) aio_init_aioinfo(p); @@ -1640,10 +1641,15 @@ aio_aqueue(struct thread *td, struct aio if (aiocbe->uaiocb.aio_sigevent.sigev_notify != SIGEV_KEVENT) goto no_kqueue; + evflags = aiocbe->uaiocb.aio_sigevent.sigev_notify_kevent_flags; + if ((evflags & ~(EV_CLEAR | EV_DISPATCH | EV_ONESHOT)) != 0) { + error = EINVAL; + goto aqueue_fail; + } kqfd = aiocbe->uaiocb.aio_sigevent.sigev_notify_kqueue; kev.ident = (uintptr_t)aiocbe->uuaiocb; kev.filter = EVFILT_AIO; - kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1; + kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1 | evflags; kev.data = (intptr_t)aiocbe; kev.udata = aiocbe->uaiocb.aio_sigevent.sigev_value.sival_ptr; error = kqfd_register(kqfd, &kev, td, 1); @@ -2688,6 +2694,7 @@ convert_sigevent32(struct sigevent32 *si break; case SIGEV_KEVENT: CP(*sig32, *sig, sigev_notify_kqueue); + CP(*sig32, *sig, sigev_notify_kevent_flags); PTRIN_CP(*sig32, *sig, sigev_value.sival_ptr); break; default: Modified: stable/9/sys/sys/signal.h ============================================================================== --- stable/9/sys/sys/signal.h Wed Feb 29 05:48:29 2012 (r232289) +++ stable/9/sys/sys/signal.h Wed Feb 29 06:19:00 2012 (r232290) @@ -169,12 +169,14 @@ struct sigevent { void (*_function)(union sigval); void *_attribute; /* pthread_attr_t * */ } _sigev_thread; + unsigned short _kevent_flags; long __spare__[8]; } _sigev_un; }; #if __BSD_VISIBLE #define sigev_notify_kqueue sigev_signo +#define sigev_notify_kevent_flags _sigev_un._kevent_flags #define sigev_notify_thread_id _sigev_un._threadid #endif #define sigev_notify_function _sigev_un._sigev_thread._function From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 07:33:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97A83106564A; Wed, 29 Feb 2012 07:33:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A05E8FC08; Wed, 29 Feb 2012 07:33:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T7X8Ul014649; Wed, 29 Feb 2012 07:33:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T7X8ew014647; Wed, 29 Feb 2012 07:33:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201202290733.q1T7X8ew014647@svn.freebsd.org> From: Martin Matuska Date: Wed, 29 Feb 2012 07: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: r232291 - head/usr.sbin/jail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 07:33:08 -0000 Author: mm Date: Wed Feb 29 07:33:07 2012 New Revision: 232291 URL: http://svn.freebsd.org/changeset/base/232291 Log: Bump .Dd to reflect latest update Reported by: bz MFC after: 1 week Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Wed Feb 29 06:19:00 2012 (r232290) +++ head/usr.sbin/jail/jail.8 Wed Feb 29 07:33:07 2012 (r232291) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2012 +.Dd February 29, 2012 .Dt JAIL 8 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 07:44:58 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9C3F1106566B; Wed, 29 Feb 2012 07:44:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail26.syd.optusnet.com.au (mail26.syd.optusnet.com.au [211.29.133.167]) by mx1.freebsd.org (Postfix) with ESMTP id 1C9288FC13; Wed, 29 Feb 2012 07:44:57 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail26.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1T7is0t032294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 18:44:55 +1100 Date: Wed, 29 Feb 2012 18:44:54 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20120229160522.W2514@besplex.bde.org> Message-ID: <20120229181608.S2887@besplex.bde.org> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <4F4D3F5D.70905@FreeBSD.org> <201202282222.26343.tijl@freebsd.org> <20120229160522.W2514@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, Tijl Coosemans , src-committers@FreeBSD.org, Dimitry Andric , svn-src-all@FreeBSD.org Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Wed, 29 Feb 2012 07:44:58 -0000 On Wed, 29 Feb 2012, Bruce Evans wrote: > I cleaned this up a bit according to ideas in my previous mails, and > added a comment about the confusing use of __bswap64_const() (now > named __bswap64_gen()) in __bswap64_var(): A minor problem with only having a macro version for __bswap64() turned up: > % -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) > % - > % -#define __bswap16(_x) \ > % - (__builtin_constant_p(_x) ? \ > % - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) > ... > % +#define ___bswap16(x) (__uint16_t)((x) << 8 | (x) >> 8) > % +#define __bswap16(x) (___bswap16((__uint16_t)(x))) When x a non-volatile variable, gcc and clang produce the good code "rolw $8,x" for "x = __bswap16(x);" on short x. But when x a a volatile variable, gcc and clang produce fairly horrible code, with 2 loads of x corresponding to the 2 accesses to x. This is probably required by volatile semantics, and is a problem for all unsafe macros, especially when their name says that they are safe (oops). When __bswap16 is implemented as an inline function for the var case like it used to be, it only loads x once and there are no problems with volatile variables. Optimizing to "rolw $8,x" might still be possible iff x is not volatile, but load-modify-store is probably better anyway. So any macro version must use gcc features to be safe. The following seems to work: #define __bswap16(x) __extension__ ({ __uint16_t __x = x; (__uint16_t)(__x << 8 | __x >> 8); }) clang now produces "rolw $8,x" when x is volatile. This seems to violate volatile semantics. gcc produces load-rolw-store then. Both produce "rolw $8,x" when x is not volatile. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 07:46:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 584CC106564A; Wed, 29 Feb 2012 07:46:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 1360D8FC15; Wed, 29 Feb 2012 07:46:59 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:bc57:d88a:c160:9c9f] (unknown [IPv6:2001:7b8:3a7:0:bc57:d88a:c160:9c9f]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 4C8185C37; Wed, 29 Feb 2012 08:46:58 +0100 (CET) Message-ID: <4F4DD7F3.3040903@FreeBSD.org> Date: Wed, 29 Feb 2012 08:46:59 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120216 Thunderbird/11.0 MIME-Version: 1.0 To: Giovanni Trematerra References: <201202282145.q1SLjLpO093657@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.4a1pre 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: r232271 - 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, 29 Feb 2012 07:46:59 -0000 On 2012-02-28 23:11, Giovanni Trematerra wrote: > On Tue, Feb 28, 2012 at 10:45 PM, Dimitry Andric wrote: >> Author: dim >> Date: Tue Feb 28 21:45:21 2012 >> New Revision: 232271 >> URL: http://svn.freebsd.org/changeset/base/232271 ... > It introduces a style(9) violation, though. > I think it should be in this way > > pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, > struct thread *td) > > Anyway that's not a problem I can take care of this and other style violations > during next weeks. Is there any interest in changing the other K&R definitions in this file to C99? Or does that cause too much churn? I tried to make this change as minimal as possible to make it compile. Btw, style(9) doesn't say anything about a maximum line width, maybe that should be added explicitly...:) From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 07:50:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEB801065672; Wed, 29 Feb 2012 07:50:52 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 66AAF8FC16; Wed, 29 Feb 2012 07:50:51 +0000 (UTC) Received: by eekd17 with SMTP id d17so2181563eek.13 for ; Tue, 28 Feb 2012 23:50:50 -0800 (PST) Received-SPF: pass (google.com: domain of to.my.trociny@gmail.com designates 10.213.20.19 as permitted sender) client-ip=10.213.20.19; Authentication-Results: mr.google.com; spf=pass (google.com: domain of to.my.trociny@gmail.com designates 10.213.20.19 as permitted sender) smtp.mail=to.my.trociny@gmail.com; dkim=pass header.i=to.my.trociny@gmail.com Received: from mr.google.com ([10.213.20.19]) by 10.213.20.19 with SMTP id d19mr326667ebb.37.1330501850388 (num_hops = 1); Tue, 28 Feb 2012 23:50:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=YukvTL0m9QDPPhrapHkR8DaKHCz/VX8u6mAL6mQh+Xg=; b=kx052zZYDIc8ICCI6JZsRDtwTZ/BKcbGk8JvMdM6JC9fURteDP1I0BhI64TV0R/W0H mgYj4M0uYHYWkdjqaQrgJa39icixDlN56bD1qijzqBdYul10EkMNzX6Ab1nP24trC7Kw zUd9ABWA0hWL+IXQ+ibdFyWQmHL5IIdYhZul4= Received: by 10.213.20.19 with SMTP id d19mr279731ebb.37.1330501850248; Tue, 28 Feb 2012 23:50:50 -0800 (PST) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id i10sm39898463eea.8.2012.02.28.23.50.46 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 23:50:47 -0800 (PST) From: Mikolaj Golub To: Julian Elischer Organization: TOA Ukraine References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org> <86zkc3bell.fsf@in138.ua3> <4F4D6AA4.9040208@freebsd.org> Sender: Mikolaj Golub Date: Wed, 29 Feb 2012 09:50:44 +0200 In-Reply-To: <4F4D6AA4.9040208@freebsd.org> (Julian Elischer's message of "Tue, 28 Feb 2012 16:00:36 -0800") Message-ID: <86vcmqaxij.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Robert Watson , Konstantin Belousov Subject: Re: svn commit: r232181 - 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: Wed, 29 Feb 2012 07:50:52 -0000 On Tue, 28 Feb 2012 16:00:36 -0800 Julian Elischer wrote: JE> On 2/27/12 11:29 PM, Mikolaj Golub wrote: >> On Mon, 27 Feb 2012 22:34:25 -0800 Julian Elischer wrote: >> >> JE> I don't think this belongs in the kernel by default. It's not exactl a >> JE> call for backout but It's teh next thing short of that. a call for "do >> JE> you REALLY think we need this particular specific case catered for?" >> >> The main goal of the patch was to provide ability to get another process >> umask. It looks like usefulness of this is not questioned here. JE> well that's exactly what I AM questioning.. how often will this be used? JE> one person using this once in all of history isn't a real requirement JE> for inclusion. This information may be very useful when troubleshooting unexpected behavior of the application. Dmitry Banschikov, who was asking for this functionality and eventually provided the patch, said that it needed this investigating an issue with an application which created files with unexpected permissions. It turned out the issue was with wrong usage of su(1), which may interpret '-c' option as a login class or as a command to run, so the umask specified in the login class was not applied. Then it wrote an utility to read a process umask via kvm to troubleshoot this. I don't think this situation is in the class "one person using this once in all of history". In my practice I have not face a situation when I need to know umask of another process and it will be good if I never need this. But if I need it eventually I would like to have a quick and easy way to do this. Also for me after applying the patch 'procstat -sa' output on my hosts was rather educational. JE> It seems to me that someone is more likely to figure out a sneaky way JE> to use this in a bad way than to want to use it in the way you expect. Being this someone I would use much easier sneaky ways to make a mess for processes running with my uid. -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 08:15:42 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07831106566C; Wed, 29 Feb 2012 08:15:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 912A08FC0C; Wed, 29 Feb 2012 08:15:40 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1T8Fb0I011532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Feb 2012 19:15:38 +1100 Date: Wed, 29 Feb 2012 19:15:37 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric In-Reply-To: <4F4DD7F3.3040903@FreeBSD.org> Message-ID: <20120229184924.E2993@besplex.bde.org> References: <201202282145.q1SLjLpO093657@svn.freebsd.org> <4F4DD7F3.3040903@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, Giovanni Trematerra , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r232271 - 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, 29 Feb 2012 08:15:42 -0000 On Wed, 29 Feb 2012, Dimitry Andric wrote: > On 2012-02-28 23:11, Giovanni Trematerra wrote: >> On Tue, Feb 28, 2012 at 10:45 PM, Dimitry Andric wrote: > ... >> It introduces a style(9) violation, though. >> I think it should be in this way >> >> pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, >> struct thread *td) Indeed. > Is there any interest in changing the other K&R definitions in this file > to C99? Or does that cause too much churn? I tried to make this change > as minimal as possible to make it compile. It is just churn for me. > Btw, style(9) doesn't say anything about a maximum line width, maybe > that should be added explicitly...:) Everything in style(9) is supposed to be implicit if not stated explicitly, but the examples of the line length limit have been especially broken by changing it into man page. Manpage formatting adds a 5-space left margin which starts by breaking all the literal examples of indentation by tabs -- e.g., leading tabs become a leading tab followed by 5 spaces, or 13 spaces if you filter the man page through col -bx. Any examples of the limit of 79 columns look like they are broken since they became non-examples with 84 columns *the maximum length is actually 5+77, not counting bad examples due to expansion of verbose VCS ids). I recently noticed another class of breakage: there were many examples of vertical whitespace, with none between statements except always 1 blank line before most block comments in groups of statements. Changing to a man page destroyed _all_ examples of this by turning all the block comments before statements into meta-comments in man page text instead of in C comments, and by adding more meta-comments in man page text; then to make things look right, there must be blank lines separating the man page text from the C code, and you can't tell if these blank lines are part of the literal examples of C code or just mdoc formatting. 4 explicit rules about blank lines remain, and none of these is in C function. 1 explicit rule about an empty line remains, but it is about the empty line after null declarations at the beginning of a function. It goes without saying that there is a blank line after non-null declarations at the beginning of a function, but most examples of this are now indistinguishable from man page paragraph breaks and the others are hard to see. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 09:10:07 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E885106564A; Wed, 29 Feb 2012 09:10:07 +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 16D838FC0C; Wed, 29 Feb 2012 09:10:05 +0000 (UTC) Received: from porto.starpoint.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 LAA13698; Wed, 29 Feb 2012 11:10:04 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S2fXw-0008pg-1b; Wed, 29 Feb 2012 11:10:04 +0200 Message-ID: <4F4DEB72.8050107@FreeBSD.org> Date: Wed, 29 Feb 2012 11:10:10 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Tijl Coosemans References: <201202281815.q1SIFSbB082030@svn.freebsd.org> In-Reply-To: <201202281815.q1SIFSbB082030@svn.freebsd.org> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r232261 - in head/sys: amd64/include i386/include pc98/include x86/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: Wed, 29 Feb 2012 09:10:07 -0000 on 28/02/2012 20:15 Tijl Coosemans said the following: > Author: tijl > Date: Tue Feb 28 18:15:28 2012 > New Revision: 232261 > URL: http://svn.freebsd.org/changeset/base/232261 > > Log: > Copy amd64 _types.h to x86 and merge with i386 _types.h. Replace existing > amd64/i386/pc98 _types.h with stubs. These header changes seem to be quite significant with potentially long-term consequences. If they have been thoroughly reviewed and discussed then it makes sense to not withhold at least "Reviewed by" line. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 09:14:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9AD05106564A; Wed, 29 Feb 2012 09:14:12 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 4AEEA8FC12; Wed, 29 Feb 2012 09:14:12 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1S2fcH-000AGW-SK; Wed, 29 Feb 2012 13:14:33 +0400 Date: Wed, 29 Feb 2012 13:14:33 +0400 From: Slawa Olhovchenkov To: Luigi Rizzo Message-ID: <20120229091433.GC97848@zxy.spb.ru> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> <20120228073122.GC57270@onelab2.iet.unipi.it> <20120228203523.GB97848@zxy.spb.ru> <20120228215856.GA99692@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120228215856.GA99692@onelab2.iet.unipi.it> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Ben Kaduk Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 09:14:12 -0000 On Tue, Feb 28, 2012 at 10:58:56PM +0100, Luigi Rizzo wrote: > On Wed, Feb 29, 2012 at 12:35:23AM +0400, Slawa Olhovchenkov wrote: > ... > > > > > ?3. The two changes above unfortunately require an API change, so while > > > > > ? ? at it add a version field and some spares to the ioctl() argument > > > > > ? ? to help detect mismatches. > > > > > > > > Is it worth bumping __FreeBSD_version? > > > > > > I don't think it is necessary. > > > There is basically no code that uses the netmap API except for > > > the examples in tools/tools/netmap, and i now have a NETMAP_API macro > > > > no code in *FreeBSD base system*, yes? > > because I am write tools uses the netmap API now. > > i am glad to hear that, and the NETMAP_API will serve you well > because you can use the same also on the Linux version of netmap Can you explain some detail about netmap? 1. What is order of send packets from different rings? 2. What is time packets sent? I am need sustain desired value of transfer rate. From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 09:33:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F37C11065672; Wed, 29 Feb 2012 09:33:12 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id AB2098FC16; Wed, 29 Feb 2012 09:33:12 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 38CDC7300A; Wed, 29 Feb 2012 10:51:26 +0100 (CET) Date: Wed, 29 Feb 2012 10:51:26 +0100 From: Luigi Rizzo To: Slawa Olhovchenkov Message-ID: <20120229095126.GA6942@onelab2.iet.unipi.it> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> <20120228073122.GC57270@onelab2.iet.unipi.it> <20120228203523.GB97848@zxy.spb.ru> <20120228215856.GA99692@onelab2.iet.unipi.it> <20120229091433.GC97848@zxy.spb.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120229091433.GC97848@zxy.spb.ru> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Ben Kaduk Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 09:33:13 -0000 On Wed, Feb 29, 2012 at 01:14:33PM +0400, Slawa Olhovchenkov wrote: > On Tue, Feb 28, 2012 at 10:58:56PM +0100, Luigi Rizzo wrote: > > > On Wed, Feb 29, 2012 at 12:35:23AM +0400, Slawa Olhovchenkov wrote: > > ... > > > > > > ?3. The two changes above unfortunately require an API change, so while > > > > > > ? ? at it add a version field and some spares to the ioctl() argument > > > > > > ? ? to help detect mismatches. > > > > > > > > > > Is it worth bumping __FreeBSD_version? > > > > > > > > I don't think it is necessary. > > > > There is basically no code that uses the netmap API except for > > > > the examples in tools/tools/netmap, and i now have a NETMAP_API macro > > > > > > no code in *FreeBSD base system*, yes? > > > because I am write tools uses the netmap API now. > > > > i am glad to hear that, and the NETMAP_API will serve you well > > because you can use the same also on the Linux version of netmap > > Can you explain some detail about netmap? > > 1. What is order of send packets from different rings? > 2. What is time packets sent? I am need sustain desired value of > transfer rate. Same as with the standard API: 1. it is the hardware that decides that. You can make no assumptions. 2. once again, once you have issued the system call, it is the hardware that decides when it will send packets out. From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 09:45:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFAA5106564A; Wed, 29 Feb 2012 09:45:41 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 9D0538FC1B; Wed, 29 Feb 2012 09:45:41 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1S2g6l-000B8K-ER; Wed, 29 Feb 2012 13:46:03 +0400 Date: Wed, 29 Feb 2012 13:46:03 +0400 From: Slawa Olhovchenkov To: Luigi Rizzo Message-ID: <20120229094603.GD97848@zxy.spb.ru> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> <20120228073122.GC57270@onelab2.iet.unipi.it> <20120228203523.GB97848@zxy.spb.ru> <20120228215856.GA99692@onelab2.iet.unipi.it> <20120229091433.GC97848@zxy.spb.ru> <20120229095126.GA6942@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120229095126.GA6942@onelab2.iet.unipi.it> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Ben Kaduk Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 09:45:42 -0000 On Wed, Feb 29, 2012 at 10:51:26AM +0100, Luigi Rizzo wrote: > On Wed, Feb 29, 2012 at 01:14:33PM +0400, Slawa Olhovchenkov wrote: > > On Tue, Feb 28, 2012 at 10:58:56PM +0100, Luigi Rizzo wrote: > > > > > On Wed, Feb 29, 2012 at 12:35:23AM +0400, Slawa Olhovchenkov wrote: > > > ... > > > > > > > ?3. The two changes above unfortunately require an API change, so while > > > > > > > ? ? at it add a version field and some spares to the ioctl() argument > > > > > > > ? ? to help detect mismatches. > > > > > > > > > > > > Is it worth bumping __FreeBSD_version? > > > > > > > > > > I don't think it is necessary. > > > > > There is basically no code that uses the netmap API except for > > > > > the examples in tools/tools/netmap, and i now have a NETMAP_API macro > > > > > > > > no code in *FreeBSD base system*, yes? > > > > because I am write tools uses the netmap API now. > > > > > > i am glad to hear that, and the NETMAP_API will serve you well > > > because you can use the same also on the Linux version of netmap > > > > Can you explain some detail about netmap? > > > > 1. What is order of send packets from different rings? > > 2. What is time packets sent? I am need sustain desired value of > > transfer rate. > > Same as with the standard API: > > 1. it is the hardware that decides that. You can make no assumptions. > 2. once again, once you have issued the system call, > it is the hardware that decides when it will send packets out. Realy? I don't do any system call now and see transmited packets (in dev.ix.0.mac_stats.tx_frames_XXX stats). 3. Jumbo frames support only throw tunable hw.netmap.buf_size? From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 09:47:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C54271065670; Wed, 29 Feb 2012 09:47:27 +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 AAB7B8FC08; Wed, 29 Feb 2012 09:47:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T9lR99019269; Wed, 29 Feb 2012 09:47:27 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T9lRDV019249; Wed, 29 Feb 2012 09:47:27 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202290947.q1T9lRDV019249@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 29 Feb 2012 09:47:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232292 - in stable/9: contrib/netcat contrib/pf/pfctl etc/rc.d share/man/man4 sys/contrib/pf/net sys/fs/nfsclient sys/i386/conf sys/kern sys/net sys/netinet sys/netinet/ipfw sys/netine... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 09:47:27 -0000 Author: bz Date: Wed Feb 29 09:47:26 2012 New Revision: 232292 URL: http://svn.freebsd.org/changeset/base/232292 Log: MFC r231852,232127: Merge multi-FIB IPv6 support. Extend the so far IPv4-only support for multiple routing tables (FIBs) introduced in r178888 to IPv6 providing feature parity. This includes an extended rtalloc(9) KPI for IPv6, the necessary adjustments to the network stack, and user land support as in netstat. Sponsored by: Cisco Systems, Inc. Modified: stable/9/contrib/netcat/netcat.c stable/9/contrib/pf/pfctl/parse.y stable/9/etc/rc.d/routing stable/9/share/man/man4/faith.4 stable/9/sys/contrib/pf/net/pf.c stable/9/sys/contrib/pf/net/pf_ioctl.c stable/9/sys/contrib/pf/net/pf_lb.c stable/9/sys/contrib/pf/net/pf_norm.c stable/9/sys/contrib/pf/net/pfvar.h stable/9/sys/fs/nfsclient/nfs_clport.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/kern/uipc_socket.c stable/9/sys/net/flowtable.c stable/9/sys/net/if_faith.c stable/9/sys/net/route.c stable/9/sys/net/route.h stable/9/sys/netinet/in.c stable/9/sys/netinet/ipfw/ip_fw2.c stable/9/sys/netinet/sctp_os_bsd.h stable/9/sys/netinet/tcp_subr.c stable/9/sys/netinet6/icmp6.c stable/9/sys/netinet6/in6.c stable/9/sys/netinet6/in6_gif.c stable/9/sys/netinet6/in6_ifattach.c stable/9/sys/netinet6/in6_mcast.c stable/9/sys/netinet6/in6_rmx.c stable/9/sys/netinet6/in6_src.c stable/9/sys/netinet6/in6_var.h stable/9/sys/netinet6/ip6_forward.c stable/9/sys/netinet6/ip6_input.c stable/9/sys/netinet6/ip6_output.c stable/9/sys/netinet6/ip6_var.h stable/9/sys/netinet6/nd6.c stable/9/sys/netinet6/nd6_nbr.c stable/9/sys/netinet6/nd6_rtr.c stable/9/sys/netinet6/raw_ip6.c stable/9/sys/netipsec/ipsec_output.c stable/9/sys/nfs/bootp_subr.c stable/9/sys/nfsclient/nfs_vfsops.c stable/9/usr.bin/netstat/route.c Directory Properties: stable/9/contrib/netcat/ (props changed) stable/9/contrib/pf/ (props changed) stable/9/etc/ (props changed) stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/usr.bin/netstat/ (props changed) Modified: stable/9/contrib/netcat/netcat.c ============================================================================== --- stable/9/contrib/netcat/netcat.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/contrib/netcat/netcat.c Wed Feb 29 09:47:26 2012 (r232292) @@ -605,8 +605,10 @@ remote_connect(const char *host, const c #endif if (rtableid) { - if (setfib(rtableid) == -1) - err(1, "setfib"); + if (setsockopt(s, SOL_SOCKET, SO_SETFIB, &rtableid, + sizeof(rtableid)) == -1) + err(1, "setsockopt(.., SO_SETFIB, %u, ..)", + rtableid); } /* Bind to a local port or source address if specified. */ @@ -678,8 +680,11 @@ local_listen(char *host, char *port, str continue; if (rtableid) { - if (setfib(rtableid) == -1) - err(1, "setfib"); + ret = setsockopt(s, SOL_SOCKET, SO_SETFIB, &rtableid, + sizeof(rtableid)); + if (ret == -1) + err(1, "setsockopt(.., SO_SETFIB, %u, ..)", + rtableid); } ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); Modified: stable/9/contrib/pf/pfctl/parse.y ============================================================================== --- stable/9/contrib/pf/pfctl/parse.y Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/contrib/pf/pfctl/parse.y Wed Feb 29 09:47:26 2012 (r232292) @@ -33,6 +33,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -335,6 +338,7 @@ int expand_skip_interface(struct node_ int check_rulestate(int); int getservice(char *); int rule_label(struct pf_rule *, char *); +int rt_tableid_max(void); void mv_rules(struct pf_ruleset *, struct pf_ruleset *); void decide_address_family(struct node_host *, sa_family_t *); @@ -1174,7 +1178,7 @@ scrub_opt : NODF { scrub_opts.randomid = 1; } | RTABLE NUMBER { - if ($2 < 0 /* || $2 > RT_TABLEID_MAX */) { + if ($2 < 0 || $2 > rt_tableid_max()) { yyerror("invalid rtable id"); YYERROR; } @@ -1322,7 +1326,7 @@ antispoof_opt : label { antispoof_opts.label = $1; } | RTABLE NUMBER { - if ($2 < 0 /* || $2 > RT_TABLEID_MAX */ ) { + if ($2 < 0 || $2 > rt_tableid_max()) { yyerror("invalid rtable id"); YYERROR; } @@ -2361,7 +2365,7 @@ filter_opt : USER uids { filter_opts.prob = 1; } | RTABLE NUMBER { - if ($2 < 0 /* || $2 > RT_TABLEID_MAX */ ) { + if ($2 < 0 || $2 > rt_tableid_max()) { yyerror("invalid rtable id"); YYERROR; } @@ -4190,7 +4194,7 @@ tagged : /* empty */ { $$.neg = 0; $$. rtable : /* empty */ { $$ = -1; } | RTABLE NUMBER { - if ($2 < 0 /* || $2 > RT_TABLEID_MAX */ ) { + if ($2 < 0 || $2 > rt_tableid_max()) { yyerror("invalid rtable id"); YYERROR; } @@ -6051,3 +6055,23 @@ pfctl_load_anchors(int dev, struct pfctl return (0); } + +int +rt_tableid_max(void) +{ +#ifdef __FreeBSD__ + int fibs; + size_t l = sizeof(fibs); + + if (sysctlbyname("net.fibs", &fibs, &l, NULL, 0) == -1) + fibs = 16; /* XXX RT_MAXFIBS, at least limit it some. */ + /* + * As the OpenBSD code only compares > and not >= we need to adjust + * here given we only accept values of 0..n and want to avoid #ifdefs + * in the grammer. + */ + return (fibs - 1); +#else + return (RT_TABLEID_MAX); +#endif +} Modified: stable/9/etc/rc.d/routing ============================================================================== --- stable/9/etc/rc.d/routing Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/etc/rc.d/routing Wed Feb 29 09:47:26 2012 (r232292) @@ -137,12 +137,22 @@ static_inet() static_inet6() { - local _action i + local _action i fibs _action=$1 + # get the number of FIBs supported. + fibs=`sysctl -n net.fibs` + : ${fibs:=1} + # disallow "internal" addresses to appear on the wire - route ${_action} -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject - route ${_action} -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject + i=0 + while test ${i} -lt ${fibs}; do + setfib -F ${i} route ${_action} \ + -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject + setfib -F ${i} route ${_action} \ + -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject + i=$((i + 1)) + done case ${ipv6_defaultrouter} in [Nn][Oo] | '') @@ -214,8 +224,14 @@ static_inet6() # for the host case, you will allow to omit the identifiers. # Under this configuration, the packets will go to the default # interface. - route ${_action} -inet6 fe80:: -prefixlen 10 ::1 -reject - route ${_action} -inet6 ff02:: -prefixlen 16 ::1 -reject + i=0 + while test ${i} -lt ${fibs}; do + setfib -F ${i} route ${_action} \ + -inet6 fe80:: -prefixlen 10 ::1 -reject + setfib -F ${i} route ${_action} \ + -inet6 ff02:: -prefixlen 16 ::1 -reject + i=$((i + 1)) + done case ${ipv6_default_interface} in '') Modified: stable/9/share/man/man4/faith.4 ============================================================================== --- stable/9/share/man/man4/faith.4 Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/share/man/man4/faith.4 Wed Feb 29 09:47:26 2012 (r232292) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 10, 1999 +.Dd January 23, 2012 .Dt FAITH 4 .Os .Sh NAME @@ -58,7 +58,7 @@ variable in .Xr rc.conf 5 . .Pp Special action will be taken when IPv6 TCP traffic is seen on a router, -and the routing table suggests to route it to the +and the default routing table suggests to route it to the .Nm interface. In this case, the packet will be accepted by the router, Modified: stable/9/sys/contrib/pf/net/pf.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/contrib/pf/net/pf.c Wed Feb 29 09:47:26 2012 (r232292) @@ -320,7 +320,7 @@ u_int8_t pf_get_wscale(struct mbuf *, u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, sa_family_t); u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, - u_int16_t); + int, u_int16_t); void pf_set_rt_ifp(struct pf_state *, struct pf_addr *); int pf_check_proto_cksum(struct mbuf *, int, int, @@ -3137,7 +3137,7 @@ pf_get_mss(struct mbuf *m, int off, u_in } u_int16_t -pf_calc_mss(struct pf_addr *addr, sa_family_t af, u_int16_t offer) +pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) { #ifdef INET struct sockaddr_in *dst; @@ -3166,11 +3166,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam dst->sin_len = sizeof(*dst); dst->sin_addr = addr->v4; #ifdef __FreeBSD__ -#ifdef RTF_PRCLONING - rtalloc_ign(&ro, (RTF_CLONING | RTF_PRCLONING)); -#else /* !RTF_PRCLONING */ - in_rtalloc_ign(&ro, 0, 0); -#endif + in_rtalloc_ign(&ro, 0, rtableid); #else /* ! __FreeBSD__ */ rtalloc_noclone(&ro, NO_CLONING); #endif @@ -3186,12 +3182,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam dst6->sin6_len = sizeof(*dst6); dst6->sin6_addr = addr->v6; #ifdef __FreeBSD__ -#ifdef RTF_PRCLONING - rtalloc_ign((struct route *)&ro6, - (RTF_CLONING | RTF_PRCLONING)); -#else /* !RTF_PRCLONING */ - rtalloc_ign((struct route *)&ro6, 0); -#endif + in6_rtalloc_ign(&ro6, 0, rtableid); #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro6, NO_CLONING); #endif @@ -3532,14 +3523,14 @@ pf_test_rule(struct pf_rule **rm, struct else if (r->proto && r->proto != pd->proto) r = r->skip[PF_SKIP_PROTO].ptr; else if (PF_MISMATCHAW(&r->src.addr, saddr, af, - r->src.neg, kif)) + r->src.neg, kif, M_GETFIB(m))) r = r->skip[PF_SKIP_SRC_ADDR].ptr; /* tcp/udp only. port_op always 0 in other cases */ else if (r->src.port_op && !pf_match_port(r->src.port_op, r->src.port[0], r->src.port[1], sport)) r = r->skip[PF_SKIP_SRC_PORT].ptr; else if (PF_MISMATCHAW(&r->dst.addr, daddr, af, - r->dst.neg, NULL)) + r->dst.neg, NULL, M_GETFIB(m))) r = r->skip[PF_SKIP_DST_ADDR].ptr; /* tcp/udp only. port_op always 0 in other cases */ else if (r->dst.port_op && !pf_match_port(r->dst.port_op, @@ -3988,9 +3979,10 @@ pf_create_state(struct pf_rule *r, struc } s->src.seqhi = htonl(arc4random()); /* Find mss option */ + int rtid = M_GETFIB(m); mss = pf_get_mss(m, off, th->th_off, pd->af); - mss = pf_calc_mss(pd->src, pd->af, mss); - mss = pf_calc_mss(pd->dst, pd->af, mss); + mss = pf_calc_mss(pd->src, pd->af, rtid, mss); + mss = pf_calc_mss(pd->dst, pd->af, rtid, mss); s->src.mss = mss; #ifdef __FreeBSD__ pf_send_tcp(NULL, r, pd->af, pd->dst, pd->src, th->th_dport, @@ -4072,10 +4064,10 @@ pf_test_fragment(struct pf_rule **rm, in else if (r->proto && r->proto != pd->proto) r = r->skip[PF_SKIP_PROTO].ptr; else if (PF_MISMATCHAW(&r->src.addr, pd->src, af, - r->src.neg, kif)) + r->src.neg, kif, M_GETFIB(m))) r = r->skip[PF_SKIP_SRC_ADDR].ptr; else if (PF_MISMATCHAW(&r->dst.addr, pd->dst, af, - r->dst.neg, NULL)) + r->dst.neg, NULL, M_GETFIB(m))) r = r->skip[PF_SKIP_DST_ADDR].ptr; else if (r->tos && !(r->tos == pd->tos)) r = TAILQ_NEXT(r, entries); @@ -5677,7 +5669,8 @@ pf_pull_hdr(struct mbuf *m, int off, voi } int -pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif) +pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, + int rtableid) { #ifdef __FreeBSD__ #ifdef RADIX_MPATH @@ -5751,13 +5744,21 @@ pf_routable(struct pf_addr *addr, sa_fam goto out; #ifdef __FreeBSD__ -/* XXX MRT not always INET */ /* stick with table 0 though */ + switch (af) { +#ifdef INET6 + case AF_INET6: + in6_rtalloc_ign(&ro, 0, rtableid); + break; +#endif #ifdef INET - if (af == AF_INET) - in_rtalloc_ign((struct route *)&ro, 0, 0); - else + case AF_INET: + in_rtalloc_ign((struct route *)&ro, 0, rtableid); + break; #endif - rtalloc_ign((struct route *)&ro, 0); + default: + rtalloc_ign((struct route *)&ro, 0); /* No/default FIB. */ + break; + } #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); #endif @@ -5803,7 +5804,8 @@ out: } int -pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw) +pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw, + int rtableid) { struct sockaddr_in *dst; #ifdef INET6 @@ -5835,16 +5837,21 @@ pf_rtlabel_match(struct pf_addr *addr, s } #ifdef __FreeBSD__ -# ifdef RTF_PRCLONING - rtalloc_ign((struct route *)&ro, (RTF_CLONING|RTF_PRCLONING)); -# else /* !RTF_PRCLONING */ + switch (af) { +#ifdef INET6 + case AF_INET6: + in6_rtalloc_ign(&ro, 0, rtableid); + break; +#endif #ifdef INET - if (af == AF_INET) - in_rtalloc_ign((struct route *)&ro, 0, 0); - else + case AF_INET: + in_rtalloc_ign((struct route *)&ro, 0, rtableid); + break; #endif + default: rtalloc_ign((struct route *)&ro, 0); -# endif + break; + } #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); #endif @@ -5927,7 +5934,7 @@ pf_route(struct mbuf **m, struct pf_rule if (r->rt == PF_FASTROUTE) { #ifdef __FreeBSD__ - in_rtalloc(ro, 0); + in_rtalloc_ign(ro, 0, M_GETFIB(m0)); #else rtalloc(ro); #endif @@ -6893,7 +6900,7 @@ done: ("pf: dropping packet with ip options\n")); } - if ((s && s->tag) || r->rtableid) + if ((s && s->tag) || r->rtableid >= 0) #ifdef __FreeBSD__ pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag); #else @@ -7437,7 +7444,7 @@ done: ("pf: dropping packet with dangerous v6 headers\n")); } - if ((s && s->tag) || r->rtableid) + if ((s && s->tag) || r->rtableid >= 0) #ifdef __FreeBSD__ pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag); #else Modified: stable/9/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf_ioctl.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/contrib/pf/net/pf_ioctl.c Wed Feb 29 09:47:26 2012 (r232292) @@ -1754,7 +1754,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a } #ifdef __FreeBSD__ /* ROUTING */ - if (rule->rtableid > 0 && rule->rtableid > rt_numfibs) + if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs) #else if (rule->rtableid > 0 && !rtable_exists(rule->rtableid)) #endif @@ -2035,7 +2035,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a if (newrule->rtableid > 0 && #ifdef __FreeBSD__ /* ROUTING */ - newrule->rtableid > rt_numfibs) + newrule->rtableid >= rt_numfibs) #else !rtable_exists(newrule->rtableid)) #endif Modified: stable/9/sys/contrib/pf/net/pf_lb.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf_lb.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/contrib/pf/net/pf_lb.c Wed Feb 29 09:47:26 2012 (r232292) @@ -261,7 +261,7 @@ pf_match_translation(struct pf_pdesc *pd else if (r->proto && r->proto != pd->proto) r = r->skip[PF_SKIP_PROTO].ptr; else if (PF_MISMATCHAW(&src->addr, saddr, pd->af, - src->neg, kif)) + src->neg, kif, M_GETFIB(m))) r = r->skip[src == &r->src ? PF_SKIP_SRC_ADDR : PF_SKIP_DST_ADDR].ptr; else if (src->port_op && !pf_match_port(src->port_op, @@ -269,10 +269,11 @@ pf_match_translation(struct pf_pdesc *pd r = r->skip[src == &r->src ? PF_SKIP_SRC_PORT : PF_SKIP_DST_PORT].ptr; else if (dst != NULL && - PF_MISMATCHAW(&dst->addr, daddr, pd->af, dst->neg, NULL)) + PF_MISMATCHAW(&dst->addr, daddr, pd->af, dst->neg, NULL, + M_GETFIB(m))) r = r->skip[PF_SKIP_DST_ADDR].ptr; else if (xdst != NULL && PF_MISMATCHAW(xdst, daddr, pd->af, - 0, NULL)) + 0, NULL, M_GETFIB(m))) r = TAILQ_NEXT(r, entries); else if (dst != NULL && dst->port_op && !pf_match_port(dst->port_op, dst->port[0], Modified: stable/9/sys/contrib/pf/net/pf_norm.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf_norm.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/contrib/pf/net/pf_norm.c Wed Feb 29 09:47:26 2012 (r232292) @@ -1163,11 +1163,11 @@ pf_normalize_ip(struct mbuf **m0, int di r = r->skip[PF_SKIP_PROTO].ptr; else if (PF_MISMATCHAW(&r->src.addr, (struct pf_addr *)&h->ip_src.s_addr, AF_INET, - r->src.neg, kif)) + r->src.neg, kif, M_GETFIB(m))) r = r->skip[PF_SKIP_SRC_ADDR].ptr; else if (PF_MISMATCHAW(&r->dst.addr, (struct pf_addr *)&h->ip_dst.s_addr, AF_INET, - r->dst.neg, NULL)) + r->dst.neg, NULL, M_GETFIB(m))) r = r->skip[PF_SKIP_DST_ADDR].ptr; #ifdef __FreeBSD__ else if (r->match_tag && !pf_match_tag(m, r, &tag, pd->pf_mtag)) @@ -1428,11 +1428,11 @@ pf_normalize_ip6(struct mbuf **m0, int d #endif else if (PF_MISMATCHAW(&r->src.addr, (struct pf_addr *)&h->ip6_src, AF_INET6, - r->src.neg, kif)) + r->src.neg, kif, M_GETFIB(m))) r = r->skip[PF_SKIP_SRC_ADDR].ptr; else if (PF_MISMATCHAW(&r->dst.addr, (struct pf_addr *)&h->ip6_dst, AF_INET6, - r->dst.neg, NULL)) + r->dst.neg, NULL, M_GETFIB(m))) r = r->skip[PF_SKIP_DST_ADDR].ptr; else break; @@ -1593,13 +1593,13 @@ pf_normalize_tcp(int dir, struct pfi_kif else if (r->proto && r->proto != pd->proto) r = r->skip[PF_SKIP_PROTO].ptr; else if (PF_MISMATCHAW(&r->src.addr, pd->src, af, - r->src.neg, kif)) + r->src.neg, kif, M_GETFIB(m))) r = r->skip[PF_SKIP_SRC_ADDR].ptr; else if (r->src.port_op && !pf_match_port(r->src.port_op, r->src.port[0], r->src.port[1], th->th_sport)) r = r->skip[PF_SKIP_SRC_PORT].ptr; else if (PF_MISMATCHAW(&r->dst.addr, pd->dst, af, - r->dst.neg, NULL)) + r->dst.neg, NULL, M_GETFIB(m))) r = r->skip[PF_SKIP_DST_ADDR].ptr; else if (r->dst.port_op && !pf_match_port(r->dst.port_op, r->dst.port[0], r->dst.port[1], th->th_dport)) Modified: stable/9/sys/contrib/pf/net/pfvar.h ============================================================================== --- stable/9/sys/contrib/pf/net/pfvar.h Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/contrib/pf/net/pfvar.h Wed Feb 29 09:47:26 2012 (r232292) @@ -402,14 +402,18 @@ extern struct mtx pf_task_mtx; #endif /* PF_INET6_ONLY */ #endif /* PF_INET_INET6 */ -#define PF_MISMATCHAW(aw, x, af, neg, ifp) \ +/* + * XXX callers not FIB-aware in our version of pf yet. + * OpenBSD fixed it later it seems, 2010/05/07 13:33:16 claudio. + */ +#define PF_MISMATCHAW(aw, x, af, neg, ifp, rtid) \ ( \ (((aw)->type == PF_ADDR_NOROUTE && \ - pf_routable((x), (af), NULL)) || \ + pf_routable((x), (af), NULL, (rtid))) || \ (((aw)->type == PF_ADDR_URPFFAILED && (ifp) != NULL && \ - pf_routable((x), (af), (ifp))) || \ + pf_routable((x), (af), (ifp), (rtid))) || \ ((aw)->type == PF_ADDR_RTLABEL && \ - !pf_rtlabel_match((x), (af), (aw))) || \ + !pf_rtlabel_match((x), (af), (aw), (rtid))) || \ ((aw)->type == PF_ADDR_TABLE && \ !pfr_match_addr((aw)->p.tbl, (x), (af))) || \ ((aw)->type == PF_ADDR_DYNIFTL && \ @@ -1977,8 +1981,10 @@ int pf_normalize_tcp_stateful(struct mbu u_int32_t pf_state_expires(const struct pf_state *); void pf_purge_expired_fragments(void); -int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *); -int pf_rtlabel_match(struct pf_addr *, sa_family_t, struct pf_addr_wrap *); +int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *, + int); +int pf_rtlabel_match(struct pf_addr *, sa_family_t, struct pf_addr_wrap *, + int); #ifdef __FreeBSD__ int pf_socket_lookup(int, struct pf_pdesc *, struct inpcb *); #else Modified: stable/9/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clport.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/fs/nfsclient/nfs_clport.c Wed Feb 29 09:47:26 2012 (r232292) @@ -976,7 +976,8 @@ nfscl_getmyip(struct nfsmount *nmp, int sad.sin_len = sizeof (struct sockaddr_in); sad.sin_addr.s_addr = sin->sin_addr.s_addr; CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred)); - rt = rtalloc1((struct sockaddr *)&sad, 0, 0UL); + rt = rtalloc1_fib((struct sockaddr *)&sad, 0, 0UL, + curthread->td_proc->p_fibnum); if (rt != NULL) { if (rt->rt_ifp != NULL && rt->rt_ifa != NULL && @@ -1001,7 +1002,8 @@ nfscl_getmyip(struct nfsmount *nmp, int sad6.sin6_len = sizeof (struct sockaddr_in6); sad6.sin6_addr = sin6->sin6_addr; CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred)); - rt = rtalloc1((struct sockaddr *)&sad6, 0, 0UL); + rt = rtalloc1_fib((struct sockaddr *)&sad6, 0, 0UL, + curthread->td_proc->p_fibnum); if (rt != NULL) { if (rt->rt_ifp != NULL && rt->rt_ifa != NULL && Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Wed Feb 29 09:47:26 2012 (r232292) @@ -459,10 +459,10 @@ nfs_mountroot(struct mount *mp) sin.sin_len = sizeof(sin); /* XXX MRT use table 0 for this sort of thing */ CURVNET_SET(TD_TO_VNET(td)); - error = rtrequest(RTM_ADD, (struct sockaddr *)&sin, + error = rtrequest_fib(RTM_ADD, (struct sockaddr *)&sin, (struct sockaddr *)&nd->mygateway, (struct sockaddr *)&mask, - RTF_UP | RTF_GATEWAY, NULL); + RTF_UP | RTF_GATEWAY, NULL, RT_DEFAULT_FIB); CURVNET_RESTORE(); if (error) panic("nfs_mountroot: RTM_ADD: %d", error); Modified: stable/9/sys/kern/uipc_socket.c ============================================================================== --- stable/9/sys/kern/uipc_socket.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/kern/uipc_socket.c Wed Feb 29 09:47:26 2012 (r232292) @@ -392,6 +392,7 @@ socreate(int dom, struct socket **aso, i so->so_type = type; so->so_cred = crhold(cred); if ((prp->pr_domain->dom_family == PF_INET) || + (prp->pr_domain->dom_family == PF_INET6) || (prp->pr_domain->dom_family == PF_ROUTE)) so->so_fibnum = td->td_proc->p_fibnum; else @@ -2498,12 +2499,13 @@ sosetopt(struct socket *so, struct socko case SO_SETFIB: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); - if (optval < 0 || optval > rt_numfibs) { + if (optval < 0 || optval >= rt_numfibs) { error = EINVAL; goto bad; } if (so->so_proto != NULL && ((so->so_proto->pr_domain->dom_family == PF_INET) || + (so->so_proto->pr_domain->dom_family == PF_INET6) || (so->so_proto->pr_domain->dom_family == PF_ROUTE))) { so->so_fibnum = optval; /* Note: ignore error */ Modified: stable/9/sys/net/flowtable.c ============================================================================== --- stable/9/sys/net/flowtable.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/net/flowtable.c Wed Feb 29 09:47:26 2012 (r232292) @@ -373,7 +373,7 @@ SYSCTL_VNET_PROC(_net_inet_flowtable, OI #ifndef RADIX_MPATH static void -in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fibnum) +rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fibnum) { rtalloc_ign_fib(ro, 0, fibnum); @@ -1314,7 +1314,7 @@ flowtable_alloc(char *name, int nentry, #ifdef RADIX_MPATH ft->ft_rtalloc = rtalloc_mpath_fib; #else - ft->ft_rtalloc = in_rtalloc_ign_wrapper; + ft->ft_rtalloc = rtalloc_ign_wrapper; #endif if (flags & FL_PCPU) { ft->ft_lock = flowtable_pcpu_lock; Modified: stable/9/sys/net/if_faith.c ============================================================================== --- stable/9/sys/net/if_faith.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/net/if_faith.c Wed Feb 29 09:47:26 2012 (r232292) @@ -338,7 +338,7 @@ faithprefix(in6) sin6.sin6_family = AF_INET6; sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_addr = *in6; - rt = rtalloc1((struct sockaddr *)&sin6, 0, 0UL); + rt = in6_rtalloc1((struct sockaddr *)&sin6, 0, 0UL, RT_DEFAULT_FIB); if (rt && rt->rt_ifp && rt->rt_ifp->if_type == IFT_FAITH && (rt->rt_ifp->if_flags & IFF_UP) != 0) ret = 1; Modified: stable/9/sys/net/route.c ============================================================================== --- stable/9/sys/net/route.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/net/route.c Wed Feb 29 09:47:26 2012 (r232292) @@ -35,6 +35,7 @@ ***********************************************************************/ #include "opt_inet.h" +#include "opt_inet6.h" #include "opt_route.h" #include "opt_mrouting.h" #include "opt_mpath.h" @@ -72,7 +73,11 @@ SYSCTL_UINT(_net, OID_AUTO, fibs, CTLFLA /* * Allow the boot code to allow LESS than RT_MAXFIBS to be used. * We can't do more because storage is statically allocated for now. - * (for compatibility reasons.. this will change). + * (for compatibility reasons.. this will change. When this changes, code should + * be refactored to protocol independent parts and protocol dependent parts, + * probably hanging of domain(9) specific storage to not need the full + * fib * af RNH allocation etc. but allow tuning the number of tables per + * address family). */ TUNABLE_INT("net.fibs", &rt_numfibs); @@ -82,6 +87,9 @@ TUNABLE_INT("net.fibs", &rt_numfibs); * changes for the FIB of the caller when adding a new set of addresses * to an interface. XXX this is a shotgun aproach to a problem that needs * a more fine grained solution.. that will come. + * XXX also has the problems getting the FIB from curthread which will not + * always work given the fib can be overridden and prefixes can be added + * from the network stack context. */ u_int rt_add_addr_allfibs = 1; SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RW, @@ -196,27 +204,23 @@ vnet_route_init(const void *unused __unu V_rtzone = uma_zcreate("rtentry", sizeof(struct rtentry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); for (dom = domains; dom; dom = dom->dom_next) { - if (dom->dom_rtattach) { - for (table = 0; table < rt_numfibs; table++) { - if ( (fam = dom->dom_family) == AF_INET || - table == 0) { - /* for now only AF_INET has > 1 table */ - /* XXX MRT - * rtattach will be also called - * from vfs_export.c but the - * offset will be 0 - * (only for AF_INET and AF_INET6 - * which don't need it anyhow) - */ - rnh = rt_tables_get_rnh_ptr(table, fam); - if (rnh == NULL) - panic("%s: rnh NULL", __func__); - dom->dom_rtattach((void **)rnh, - dom->dom_rtoffset); - } else { - break; - } - } + if (dom->dom_rtattach == NULL) + continue; + + for (table = 0; table < rt_numfibs; table++) { + fam = dom->dom_family; + if (table != 0 && fam != AF_INET6 && fam != AF_INET) + break; + + /* + * XXX MRT rtattach will be also called from + * vfs_export.c but the offset will be 0 (only for + * AF_INET and AF_INET6 which don't need it anyhow). + */ + rnh = rt_tables_get_rnh_ptr(table, fam); + if (rnh == NULL) + panic("%s: rnh NULL", __func__); + dom->dom_rtattach((void **)rnh, dom->dom_rtoffset); } } } @@ -233,20 +237,19 @@ vnet_route_uninit(const void *unused __u struct radix_node_head **rnh; for (dom = domains; dom; dom = dom->dom_next) { - if (dom->dom_rtdetach) { - for (table = 0; table < rt_numfibs; table++) { - if ( (fam = dom->dom_family) == AF_INET || - table == 0) { - /* For now only AF_INET has > 1 tbl. */ - rnh = rt_tables_get_rnh_ptr(table, fam); - if (rnh == NULL) - panic("%s: rnh NULL", __func__); - dom->dom_rtdetach((void **)rnh, - dom->dom_rtoffset); - } else { - break; - } - } + if (dom->dom_rtdetach == NULL) + continue; + + for (table = 0; table < rt_numfibs; table++) { + fam = dom->dom_family; + + if (table != 0 && fam != AF_INET6 && fam != AF_INET) + break; + + rnh = rt_tables_get_rnh_ptr(table, fam); + if (rnh == NULL) + panic("%s: rnh NULL", __func__); + dom->dom_rtdetach((void **)rnh, dom->dom_rtoffset); } } } @@ -274,7 +277,8 @@ sys_setfib(struct thread *td, struct set void rtalloc(struct route *ro) { - rtalloc_ign_fib(ro, 0UL, 0); + + rtalloc_ign_fib(ro, 0UL, RT_DEFAULT_FIB); } void @@ -294,7 +298,7 @@ rtalloc_ign(struct route *ro, u_long ign RTFREE(rt); ro->ro_rt = NULL; } - ro->ro_rt = rtalloc1_fib(&ro->ro_dst, 1, ignore, 0); + ro->ro_rt = rtalloc1_fib(&ro->ro_dst, 1, ignore, RT_DEFAULT_FIB); if (ro->ro_rt) RT_UNLOCK(ro->ro_rt); } @@ -324,7 +328,8 @@ rtalloc_ign_fib(struct route *ro, u_long struct rtentry * rtalloc1(struct sockaddr *dst, int report, u_long ignflags) { - return (rtalloc1_fib(dst, report, ignflags, 0)); + + return (rtalloc1_fib(dst, report, ignflags, RT_DEFAULT_FIB)); } struct rtentry * @@ -339,8 +344,15 @@ rtalloc1_fib(struct sockaddr *dst, int r int needlock; KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum")); - if (dst->sa_family != AF_INET) /* Only INET supports > 1 fib now */ - fibnum = 0; + switch (dst->sa_family) { + case AF_INET6: + case AF_INET: + /* We support multiple FIBs. */ + break; + default: + fibnum = RT_DEFAULT_FIB; + break; + } rnh = rt_tables_get_rnh(fibnum, dst->sa_family); newrt = NULL; if (rnh == NULL) @@ -486,7 +498,8 @@ rtredirect(struct sockaddr *dst, int flags, struct sockaddr *src) { - rtredirect_fib(dst, gateway, netmask, flags, src, 0); + + rtredirect_fib(dst, gateway, netmask, flags, src, RT_DEFAULT_FIB); } void @@ -617,7 +630,8 @@ out: int rtioctl(u_long req, caddr_t data) { - return (rtioctl_fib(req, data, 0)); + + return (rtioctl_fib(req, data, RT_DEFAULT_FIB)); } /* @@ -647,7 +661,8 @@ rtioctl_fib(u_long req, caddr_t data, u_ struct ifaddr * ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway) { - return (ifa_ifwithroute_fib(flags, dst, gateway, 0)); + + return (ifa_ifwithroute_fib(flags, dst, gateway, RT_DEFAULT_FIB)); } struct ifaddr * @@ -732,7 +747,9 @@ rtrequest(int req, int flags, struct rtentry **ret_nrt) { - return (rtrequest_fib(req, dst, gateway, netmask, flags, ret_nrt, 0)); + + return (rtrequest_fib(req, dst, gateway, netmask, flags, ret_nrt, + RT_DEFAULT_FIB)); } int @@ -771,7 +788,8 @@ rtrequest_fib(int req, int rt_getifa(struct rt_addrinfo *info) { - return (rt_getifa_fib(info, 0)); + + return (rt_getifa_fib(info, RT_DEFAULT_FIB)); } /* @@ -1029,8 +1047,16 @@ rtrequest1_fib(int req, struct rt_addrin #define senderr(x) { error = x ; goto bad; } KASSERT((fibnum < rt_numfibs), ("rtrequest1_fib: bad fibnum")); - if (dst->sa_family != AF_INET) /* Only INET supports > 1 fib now */ - fibnum = 0; + switch (dst->sa_family) { + case AF_INET6: + case AF_INET: + /* We support multiple FIBs. */ + break; + default: + fibnum = RT_DEFAULT_FIB; + break; + } + /* * Find the correct routing tree to use for this Address Family */ @@ -1136,8 +1162,7 @@ rtrequest1_fib(int req, struct rt_addrin rt->rt_flags = RTF_UP | flags; rt->rt_fibnum = fibnum; /* - * Add the gateway. Possibly re-malloc-ing the storage for it - * + * Add the gateway. Possibly re-malloc-ing the storage for it. */ RT_LOCK(rt); if ((error = rt_setgate(rt, dst, gateway)) != 0) { @@ -1186,12 +1211,15 @@ rtrequest1_fib(int req, struct rt_addrin #ifdef FLOWTABLE rt0 = NULL; - /* XXX - * "flow-table" only support IPv4 at the moment. - * XXX-BZ as of r205066 it would support IPv6. - */ + /* "flow-table" only supports IPv6 and IPv4 at the moment. */ + switch (dst->sa_family) { +#ifdef INET6 + case AF_INET6: +#endif #ifdef INET - if (dst->sa_family == AF_INET) { + case AF_INET: +#endif +#if defined(INET6) || defined(INET) rn = rnh->rnh_matchaddr(dst, rnh); if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { struct sockaddr *mask; @@ -1230,9 +1258,9 @@ rtrequest1_fib(int req, struct rt_addrin } } } +#endif/* INET6 || INET */ } -#endif -#endif +#endif /* FLOWTABLE */ /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); @@ -1254,9 +1282,18 @@ rtrequest1_fib(int req, struct rt_addrin } #ifdef FLOWTABLE else if (rt0 != NULL) { + switch (dst->sa_family) { +#ifdef INET6 + case AF_INET6: + flowtable_route_flush(V_ip6_ft, rt0); + break; +#endif #ifdef INET - flowtable_route_flush(V_ip_ft, rt0); + case AF_INET: + flowtable_route_flush(V_ip_ft, rt0); + break; #endif + } RTFREE(rt0); } #endif @@ -1388,8 +1425,17 @@ rtinit1(struct ifaddr *ifa, int cmd, int dst = ifa->ifa_addr; netmask = ifa->ifa_netmask; } - if ( dst->sa_family != AF_INET) - fibnum = 0; + if (dst->sa_len == 0) + return(EINVAL); + switch (dst->sa_family) { + case AF_INET6: + case AF_INET: + /* We support multiple FIBs. */ + break; + default: + fibnum = RT_DEFAULT_FIB; + break; + } if (fibnum == -1) { if (rt_add_addr_allfibs == 0 && cmd == (int)RTM_ADD) { startfib = endfib = curthread->td_proc->p_fibnum; @@ -1402,8 +1448,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int startfib = fibnum; endfib = fibnum; } - if (dst->sa_len == 0) - return(EINVAL); /* * If it's a delete, check that if it exists, @@ -1427,9 +1471,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int * Now go through all the requested tables (fibs) and do the * requested action. Realistically, this will either be fib 0 * for protocols that don't do multiple tables or all the - * tables for those that do. XXX For this version only AF_INET. - * When that changes code should be refactored to protocol - * independent parts and protocol dependent parts. + * tables for those that do. */ for ( fibnum = startfib; fibnum <= endfib; fibnum++) { if (cmd == RTM_DELETE) { @@ -1569,12 +1611,14 @@ rtinit1(struct ifaddr *ifa, int cmd, int return (error); } +#ifndef BURN_BRIDGES /* special one for inet internal use. may not use. */ int rtinit_fib(struct ifaddr *ifa, int cmd, int flags) { return (rtinit1(ifa, cmd, flags, -1)); } +#endif /* * Set up a routing table entry, normally @@ -1584,7 +1628,7 @@ int rtinit(struct ifaddr *ifa, int cmd, int flags) { struct sockaddr *dst; - int fib = 0; + int fib = RT_DEFAULT_FIB; if (flags & RTF_HOST) { dst = ifa->ifa_dstaddr; @@ -1592,7 +1636,12 @@ rtinit(struct ifaddr *ifa, int cmd, int dst = ifa->ifa_addr; } - if (dst->sa_family == AF_INET) + switch (dst->sa_family) { + case AF_INET6: + case AF_INET: + /* We do support multiple FIBs. */ fib = -1; + break; + } return (rtinit1(ifa, cmd, flags, fib)); } Modified: stable/9/sys/net/route.h ============================================================================== --- stable/9/sys/net/route.h Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/net/route.h Wed Feb 29 09:47:26 2012 (r232292) @@ -111,6 +111,7 @@ struct rt_metrics { #endif #endif +#define RT_DEFAULT_FIB 0 /* Explicitly mark fib=0 restricted cases */ extern u_int rt_numfibs; /* number fo usable routing tables */ /* * XXX kernel function pointer `rt_output' is visible to applications. @@ -405,8 +406,10 @@ void rtredirect(struct sockaddr *, stru int rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **); +#ifndef BURN_BRIDGES /* defaults to "all" FIBs */ int rtinit_fib(struct ifaddr *, int, int); +#endif /* XXX MRT NEW VERSIONS THAT USE FIBs * For now the protocol indepedent versions are the same as the AF_INET ones Modified: stable/9/sys/netinet/in.c ============================================================================== --- stable/9/sys/netinet/in.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/netinet/in.c Wed Feb 29 09:47:26 2012 (r232292) @@ -938,7 +938,7 @@ in_ifinit(struct ifnet *ifp, struct in_i bzero(&ia_ro, sizeof(ia_ro)); *((struct sockaddr_in *)(&ia_ro.ro_dst)) = ia->ia_addr; - rtalloc_ign_fib(&ia_ro, 0, 0); + rtalloc_ign_fib(&ia_ro, 0, RT_DEFAULT_FIB); if ((ia_ro.ro_rt != NULL) && (ia_ro.ro_rt->rt_ifp != NULL) && (ia_ro.ro_rt->rt_ifp == V_loif)) { RT_LOCK(ia_ro.ro_rt); Modified: stable/9/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw2.c Wed Feb 29 07:33:07 2012 (r232291) +++ stable/9/sys/netinet/ipfw/ip_fw2.c Wed Feb 29 09:47:26 2012 (r232292) @@ -496,7 +496,7 @@ search_ip6_addr_net (struct in6_addr * i } static int -verify_path6(struct in6_addr *src, struct ifnet *ifp) +verify_path6(struct in6_addr *src, struct ifnet *ifp, u_int fib) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 09:50:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85B481065674; Wed, 29 Feb 2012 09:50:11 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 03C358FC13; Wed, 29 Feb 2012 09:50:10 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 083767300A; Wed, 29 Feb 2012 11:08:25 +0100 (CET) Date: Wed, 29 Feb 2012 11:08:25 +0100 From: Luigi Rizzo To: Slawa Olhovchenkov Message-ID: <20120229100825.GA7148@onelab2.iet.unipi.it> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> <20120228073122.GC57270@onelab2.iet.unipi.it> <20120228203523.GB97848@zxy.spb.ru> <20120228215856.GA99692@onelab2.iet.unipi.it> <20120229091433.GC97848@zxy.spb.ru> <20120229095126.GA6942@onelab2.iet.unipi.it> <20120229094603.GD97848@zxy.spb.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120229094603.GD97848@zxy.spb.ru> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Ben Kaduk Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 09:50:11 -0000 On Wed, Feb 29, 2012 at 01:46:03PM +0400, Slawa Olhovchenkov wrote: > On Wed, Feb 29, 2012 at 10:51:26AM +0100, Luigi Rizzo wrote: > > > On Wed, Feb 29, 2012 at 01:14:33PM +0400, Slawa Olhovchenkov wrote: > > > On Tue, Feb 28, 2012 at 10:58:56PM +0100, Luigi Rizzo wrote: > > > > > > > On Wed, Feb 29, 2012 at 12:35:23AM +0400, Slawa Olhovchenkov wrote: > > > > ... > > > > > > > > ?3. The two changes above unfortunately require an API change, so while > > > > > > > > ? ? at it add a version field and some spares to the ioctl() argument > > > > > > > > ? ? to help detect mismatches. > > > > > > > > > > > > > > Is it worth bumping __FreeBSD_version? > > > > > > > > > > > > I don't think it is necessary. > > > > > > There is basically no code that uses the netmap API except for > > > > > > the examples in tools/tools/netmap, and i now have a NETMAP_API macro > > > > > > > > > > no code in *FreeBSD base system*, yes? > > > > > because I am write tools uses the netmap API now. > > > > > > > > i am glad to hear that, and the NETMAP_API will serve you well > > > > because you can use the same also on the Linux version of netmap > > > > > > Can you explain some detail about netmap? > > > > > > 1. What is order of send packets from different rings? > > > 2. What is time packets sent? I am need sustain desired value of > > > transfer rate. > > > > Same as with the standard API: > > > > 1. it is the hardware that decides that. You can make no assumptions. > > 2. once again, once you have issued the system call, > > it is the hardware that decides when it will send packets out. > > Realy? I don't do any system call now and see transmited packets > (in dev.ix.0.mac_stats.tx_frames_XXX stats). you MUST issue system calls (ioctl() or poll()) ) to have packets sent out. Please re-read the manpage. > 3. Jumbo frames support only throw tunable hw.netmap.buf_size? yes but in practice forget jumbo frames. There is no guarantees that the code works for buf_size > 4096 . Unless you want to use them to support NFS and 8K filesystem blocks (in which case there is a point - you have no fragmentation), jumbo frames are only useful with low-performance drivers. With netmap you have no such an issue. cheers luigi From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 10:01:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C47FC106564A; Wed, 29 Feb 2012 10:01:51 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 6FAAD8FC12; Wed, 29 Feb 2012 10:01:51 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1S2gMO-000BTS-Pj; Wed, 29 Feb 2012 14:02:12 +0400 Date: Wed, 29 Feb 2012 14:02:12 +0400 From: Slawa Olhovchenkov To: Luigi Rizzo Message-ID: <20120229100212.GE97848@zxy.spb.ru> References: <201202271905.q1RJ52Se032771@svn.freebsd.org> <20120228073122.GC57270@onelab2.iet.unipi.it> <20120228203523.GB97848@zxy.spb.ru> <20120228215856.GA99692@onelab2.iet.unipi.it> <20120229091433.GC97848@zxy.spb.ru> <20120229095126.GA6942@onelab2.iet.unipi.it> <20120229094603.GD97848@zxy.spb.ru> <20120229100825.GA7148@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120229100825.GA7148@onelab2.iet.unipi.it> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Ben Kaduk Subject: Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 10:01:52 -0000 On Wed, Feb 29, 2012 at 11:08:25AM +0100, Luigi Rizzo wrote: > On Wed, Feb 29, 2012 at 01:46:03PM +0400, Slawa Olhovchenkov wrote: > > On Wed, Feb 29, 2012 at 10:51:26AM +0100, Luigi Rizzo wrote: > > > > > On Wed, Feb 29, 2012 at 01:14:33PM +0400, Slawa Olhovchenkov wrote: > > > > On Tue, Feb 28, 2012 at 10:58:56PM +0100, Luigi Rizzo wrote: > > > > > > > > > On Wed, Feb 29, 2012 at 12:35:23AM +0400, Slawa Olhovchenkov wrote: > > > > > ... > > > > > > > > > ?3. The two changes above unfortunately require an API change, so while > > > > > > > > > ? ? at it add a version field and some spares to the ioctl() argument > > > > > > > > > ? ? to help detect mismatches. > > > > > > > > > > > > > > > > Is it worth bumping __FreeBSD_version? > > > > > > > > > > > > > > I don't think it is necessary. > > > > > > > There is basically no code that uses the netmap API except for > > > > > > > the examples in tools/tools/netmap, and i now have a NETMAP_API macro > > > > > > > > > > > > no code in *FreeBSD base system*, yes? > > > > > > because I am write tools uses the netmap API now. > > > > > > > > > > i am glad to hear that, and the NETMAP_API will serve you well > > > > > because you can use the same also on the Linux version of netmap > > > > > > > > Can you explain some detail about netmap? > > > > > > > > 1. What is order of send packets from different rings? > > > > 2. What is time packets sent? I am need sustain desired value of > > > > transfer rate. > > > > > > Same as with the standard API: > > > > > > 1. it is the hardware that decides that. You can make no assumptions. > > > 2. once again, once you have issued the system call, > > > it is the hardware that decides when it will send packets out. > > > > Realy? I don't do any system call now and see transmited packets > > (in dev.ix.0.mac_stats.tx_frames_XXX stats). > > you MUST issue system calls (ioctl() or poll()) ) to have packets > sent out. Please re-read the manpage. Ah, pool(). I am don't clean understand this, please write some more in manpage. > > 3. Jumbo frames support only throw tunable hw.netmap.buf_size? > > yes but in practice forget jumbo frames. There is no guarantees > that the code works for buf_size > 4096 . > > Unless you want to use them to support NFS and 8K filesystem blocks > (in which case there is a point - you have no fragmentation), > jumbo frames are only useful with low-performance drivers. > With netmap you have no such an issue. This is (suuport jumbo frames) not for performance, but for compatibility and simplify application: one way for generation/capturing small and jumbo packets. From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 12:03:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 894A11065676; Wed, 29 Feb 2012 12:03:06 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5B94E8FC18; Wed, 29 Feb 2012 12:03:06 +0000 (UTC) Received: from c0147.aw.cl.cam.ac.uk (c0147.aw.cl.cam.ac.uk [128.232.100.147]) by cyrus.watson.org (Postfix) with ESMTPSA id 4836E46B0A; Wed, 29 Feb 2012 07:03:05 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <86vcmqaxij.fsf@in138.ua3> Date: Wed, 29 Feb 2012 12:03:00 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <9557FCA0-7428-4794-8A27-9888F42974CA@freebsd.org> References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org> <86zkc3bell.fsf@in138.ua3> <4F4D6AA4.9040208@freebsd.org> <86vcmqaxij.fsf@in138.ua3> To: Mikolaj Golub X-Mailer: Apple Mail (2.1257) Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Konstantin Belousov , Julian Elischer Subject: Re: svn commit: r232181 - 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: Wed, 29 Feb 2012 12:03:06 -0000 On 29 Feb 2012, at 07:50, Mikolaj Golub wrote: > JE> well that's exactly what I AM questioning.. how often will this = be used? > JE> one person using this once in all of history isn't a real = requirement > JE> for inclusion. >=20 > This information may be very useful when troubleshooting unexpected = behavior > of the application. >=20 > Dmitry Banschikov, who was asking for this functionality and = eventually > provided the patch, said that it needed this investigating an issue = with an > application which created files with unexpected permissions. It turned = out the > issue was with wrong usage of su(1), which may interpret '-c' option = as a > login class or as a command to run, so the umask specified in the = login class > was not applied. Then it wrote an utility to read a process umask via = kvm to > troubleshoot this. >=20 > I don't think this situation is in the class "one person using this = once in > all of history". >=20 > In my practice I have not face a situation when I need to know umask = of > another process and it will be good if I never need this. But if I = need it > eventually I would like to have a quick and easy way to do this. >=20 > Also for me after applying the patch 'procstat -sa' output on my hosts = was > rather educational. >=20 > JE> It seems to me that someone is more likely to figure out a sneaky = way > JE> to use this in a bad way than to want to use it in the way you = expect. >=20 > Being this someone I would use much easier sneaky ways to make a mess = for > processes running with my uid. I think the monitoring aspect of the patch is fine. The bit I was worried about was external umask changes. This can cause = race conditions for applications that manage their umask -- for example, = bsdtar, if I recall correctly. It's one thing to use a debugger to force = an application to change its umask -- the developer needs to know they = are changing application behaviour. But exposing a feature that can lead = to correct applications but incorrect results is a risky thing to do, = hence my objection. I think given the other objections, it would be wise to remove write = access to process umasks, but retain read access for procstat (which is = quite useful, I agree). Robert= From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 12:13:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA0A91065673; Wed, 29 Feb 2012 12:13:05 +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 9BF398FC15; Wed, 29 Feb 2012 12:13:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TCD5SV026245; Wed, 29 Feb 2012 12:13:05 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TCD5Xh026244; Wed, 29 Feb 2012 12:13:05 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201202291213.q1TCD5Xh026244@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 29 Feb 2012 12:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232294 - stable/9/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, 29 Feb 2012 12:13:05 -0000 Author: bz Date: Wed Feb 29 12:13:05 2012 New Revision: 232294 URL: http://svn.freebsd.org/changeset/base/232294 Log: Record MFC of r230981 (by hrs) done with r232292: Fix input validation in SO_SETFIB. Modified: Directory Properties: stable/9/sys/ (props changed) From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 12:37:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9109A106564A; Wed, 29 Feb 2012 12:37:31 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 29B2B8FC21; Wed, 29 Feb 2012 12:37:29 +0000 (UTC) Received: by eaaf13 with SMTP id f13so346317eaa.13 for ; Wed, 29 Feb 2012 04:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of to.my.trociny@gmail.com designates 10.14.202.65 as permitted sender) client-ip=10.14.202.65; Authentication-Results: mr.google.com; spf=pass (google.com: domain of to.my.trociny@gmail.com designates 10.14.202.65 as permitted sender) smtp.mail=to.my.trociny@gmail.com; dkim=pass header.i=to.my.trociny@gmail.com Received: from mr.google.com ([10.14.202.65]) by 10.14.202.65 with SMTP id c41mr64151eeo.79.1330519049132 (num_hops = 1); Wed, 29 Feb 2012 04:37:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=VEHFXFfXeEcW2EgmGi5tMggAwWXDi/UE7w5S8m6C+x0=; b=L6st7rAIwFHXGzB2QwLlaRQtoDHvNPvspsOwH8GTikmqqFGY7bw4Lx6VzykyzAUBRd TpzsetpZwlQTpQkrB5V3KmeScGy2rijkiC3NVH/ekhXajkf9eIogFUPi6gvigPr9opxB iKr5p4iC+OOid21kbuBd17WHe4Fv37tnvxSjM= Received: by 10.14.202.65 with SMTP id c41mr50372eeo.79.1330519048776; Wed, 29 Feb 2012 04:37:28 -0800 (PST) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id o49sm82387863eeb.7.2012.02.29.04.37.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Feb 2012 04:37:27 -0800 (PST) From: Mikolaj Golub To: "Robert N. M. Watson" Organization: TOA Ukraine References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org> <86zkc3bell.fsf@in138.ua3> <4F4D6AA4.9040208@freebsd.org> <86vcmqaxij.fsf@in138.ua3> <9557FCA0-7428-4794-8A27-9888F42974CA@freebsd.org> Sender: Mikolaj Golub Date: Wed, 29 Feb 2012 14:37:25 +0200 In-Reply-To: <9557FCA0-7428-4794-8A27-9888F42974CA@freebsd.org> (Robert N. M. Watson's message of "Wed, 29 Feb 2012 12:03:00 +0000") Message-ID: <86mx81byt6.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Konstantin Belousov , Julian Elischer Subject: Re: svn commit: r232181 - 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: Wed, 29 Feb 2012 12:37:31 -0000 --=-=-= On Wed, 29 Feb 2012 12:03:00 +0000 Robert N. M. Watson wrote: RNMW> I think the monitoring aspect of the patch is fine. RNMW> The bit I was worried about was external umask changes. This can cause RNMW> race conditions for applications that manage their umask -- for RNMW> example, bsdtar, if I recall correctly. It's one thing to use a RNMW> debugger to force an application to change its umask -- the developer RNMW> needs to know they are changing application behaviour. But exposing a RNMW> feature that can lead to correct applications but incorrect results is RNMW> a risky thing to do, hence my objection. RNMW> I think given the other objections, it would be wise to remove write RNMW> access to process umasks, but retain read access for procstat (which is RNMW> quite useful, I agree). I still don't see why having a sysctl RW is worse than asking users to run something like in the attach when they need to change umask for another process, but ok, if people don't like RW I will remove it. -- Mikolaj Golub --=-=-=-- From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 12:44:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7859D106564A; Wed, 29 Feb 2012 12:44:35 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A1BB8FC13; Wed, 29 Feb 2012 12:44:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TCiZaO027252; Wed, 29 Feb 2012 12:44:35 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TCiZZi027249; Wed, 29 Feb 2012 12:44:35 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201202291244.q1TCiZZi027249@svn.freebsd.org> From: Olivier Houchard Date: Wed, 29 Feb 2012 12:44: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: r232295 - in head/sys/arm: mv xscale/i8134x X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 12:44:35 -0000 Author: cognet Date: Wed Feb 29 12:44:34 2012 New Revision: 232295 URL: http://svn.freebsd.org/changeset/base/232295 Log: Make sure we do not provide the page 0 to the VM. It can't handle it properly, because pmap_extract() returns 0 when there's no mapping. PR: arm/154227 MFC after: 1 week Modified: head/sys/arm/mv/mv_machdep.c head/sys/arm/xscale/i8134x/crb_machdep.c Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Wed Feb 29 12:13:05 2012 (r232294) +++ head/sys/arm/mv/mv_machdep.c Wed Feb 29 12:44:34 2012 (r232295) @@ -287,9 +287,19 @@ physmap_init(void) availmem_regions[i].mr_start + availmem_regions[i].mr_size, availmem_regions[i].mr_size); - phys_avail[j] = availmem_regions[i].mr_start; - phys_avail[j + 1] = availmem_regions[i].mr_start + - availmem_regions[i].mr_size; + /* + * We should not map the page at PA 0x0000000, the VM can't + * handle it, as pmap_extract() == 0 means failure. + */ + if (availmem_regions[i].mr_start > 0 || + availmem_regions[i].mr_size > PAGE_SIZE) { + phys_avail[j] = availmem_regions[i].mr_start; + if (phys_avail[j] == 0) + phys_avail[j] += PAGE_SIZE; + phys_avail[j + 1] = availmem_regions[i].mr_start + + availmem_regions[i].mr_size; + } else + j -= 2; } phys_avail[j] = 0; phys_avail[j + 1] = 0; Modified: head/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- head/sys/arm/xscale/i8134x/crb_machdep.c Wed Feb 29 12:13:05 2012 (r232294) +++ head/sys/arm/xscale/i8134x/crb_machdep.c Wed Feb 29 12:44:34 2012 (r232295) @@ -381,8 +381,8 @@ initarm(void *arg, void *arg2) i = 0; #ifdef ARM_USE_SMALL_ALLOC - phys_avail[i++] = 0x00000000; - phys_avail[i++] = 0x00001000; /* + phys_avail[i++] = 0x00001000; + phys_avail[i++] = 0x00002000; /* *XXX: Gross hack to get our * pages in the vm_page_array . */ From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 13:25:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A1881065672; Wed, 29 Feb 2012 13:25: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 446AA8FC18; Wed, 29 Feb 2012 13:25:16 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q1TDP8MJ095279; Wed, 29 Feb 2012 15:25:08 +0200 (EET) (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.5/8.14.5) with ESMTP id q1TDP7sO095290; Wed, 29 Feb 2012 15:25:07 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q1TDP793095289; Wed, 29 Feb 2012 15:25:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Feb 2012 15:25:07 +0200 From: Konstantin Belousov To: Mikolaj Golub Message-ID: <20120229132507.GB55074@deviant.kiev.zoral.com.ua> References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org> <86zkc3bell.fsf@in138.ua3> <4F4D6AA4.9040208@freebsd.org> <86vcmqaxij.fsf@in138.ua3> <9557FCA0-7428-4794-8A27-9888F42974CA@freebsd.org> <86mx81byt6.fsf@in138.ua3> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BLc7wQ/ocIv/2Jnx" Content-Disposition: inline In-Reply-To: <86mx81byt6.fsf@in138.ua3> 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=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Robert N. M. Watson" , Konstantin Belousov , Julian Elischer Subject: Re: svn commit: r232181 - 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: Wed, 29 Feb 2012 13:25:17 -0000 --BLc7wQ/ocIv/2Jnx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 29, 2012 at 02:37:25PM +0200, Mikolaj Golub wrote: >=20 > On Wed, 29 Feb 2012 12:03:00 +0000 Robert N. M. Watson wrote: >=20 > RNMW> I think the monitoring aspect of the patch is fine. >=20 > RNMW> The bit I was worried about was external umask changes. This can c= ause > RNMW> race conditions for applications that manage their umask -- for > RNMW> example, bsdtar, if I recall correctly. It's one thing to use a > RNMW> debugger to force an application to change its umask -- the develo= per > RNMW> needs to know they are changing application behaviour. But exposin= g a > RNMW> feature that can lead to correct applications but incorrect result= s is > RNMW> a risky thing to do, hence my objection. >=20 > RNMW> I think given the other objections, it would be wise to remove wri= te > RNMW> access to process umasks, but retain read access for procstat (whi= ch is > RNMW> quite useful, I agree). >=20 > I still don't see why having a sysctl RW is worse than asking users to run > something like in the attach when they need to change umask for another > process, but ok, if people don't like RW I will remove it. >=20 What is done is attach is much worse then the sysctl, just because debugger attach often causes spurious EINTR, indeed seriously disrupting applications, as opposed to some uncertain damage that could be done in theory. *shrug* --BLc7wQ/ocIv/2Jnx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9OJzIACgkQC3+MBN1Mb4jPdwCfWaju5cIqfcqalflDzQgHP56X lZAAn2KukOrLxcDEbZHWuAiKx/vQcg5/ =gYNz -----END PGP SIGNATURE----- --BLc7wQ/ocIv/2Jnx-- From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 14:43:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DB1B106564A; Wed, 29 Feb 2012 14:43: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 791688FC16; Wed, 29 Feb 2012 14:43:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TEhRH5031109; Wed, 29 Feb 2012 14:43:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TEhR4B031107; Wed, 29 Feb 2012 14:43:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202291443.q1TEhR4B031107@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 14:43: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: r232296 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 14:43:27 -0000 Author: kib Date: Wed Feb 29 14:43:27 2012 New Revision: 232296 URL: http://svn.freebsd.org/changeset/base/232296 Log: Merge a split multi-line comment. MFC after: 1 week Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Wed Feb 29 12:44:34 2012 (r232295) +++ head/sys/fs/nullfs/null_subr.c Wed Feb 29 14:43:27 2012 (r232296) @@ -213,12 +213,9 @@ null_nodeget(mp, lowervp, vpp) /* * We do not serialize vnode creation, instead we will check for * duplicates later, when adding new vnode to hash. - * * Note that duplicate can only appear in hash if the lowervp is * locked LK_SHARED. - */ - - /* + * * Do the MALLOC before the getnewvnode since doing so afterward * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 14:44:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D87651065688; Wed, 29 Feb 2012 14:44:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3B9A8FC08; Wed, 29 Feb 2012 14:44:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TEig85031200; Wed, 29 Feb 2012 14:44:42 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TEigYD031198; Wed, 29 Feb 2012 14:44:42 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201202291444.q1TEigYD031198@svn.freebsd.org> From: Ed Maste Date: Wed, 29 Feb 2012 14:44: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: r232297 - head/usr.sbin/tzsetup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 14:44:43 -0000 Author: emaste Date: Wed Feb 29 14:44:42 2012 New Revision: 232297 URL: http://svn.freebsd.org/changeset/base/232297 Log: Grammar: tzsetup now has more than one option. Modified: head/usr.sbin/tzsetup/tzsetup.8 Modified: head/usr.sbin/tzsetup/tzsetup.8 ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.8 Wed Feb 29 14:43:27 2012 (r232296) +++ head/usr.sbin/tzsetup/tzsetup.8 Wed Feb 29 14:44:42 2012 (r232297) @@ -49,7 +49,7 @@ utility also determines whether any adju the hardware clock does not keep .Tn UTC . .Pp -The following option is available: +The following options are available: .Bl -tag -offset indent -width Fl .It Fl C Ar chroot_directory Open all files and directories relative to From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:06:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C391106566C; Wed, 29 Feb 2012 15:06:00 +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 67DF38FC15; Wed, 29 Feb 2012 15:06:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TF60dU031986; Wed, 29 Feb 2012 15:06:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TF60xx031984; Wed, 29 Feb 2012 15:06:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202291506.q1TF60xx031984@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 15:06: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: r232299 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 15:06:00 -0000 Author: kib Date: Wed Feb 29 15:06:00 2012 New Revision: 232299 URL: http://svn.freebsd.org/changeset/base/232299 Log: Move the code to destroy half-contructed nullfs vnode into helper function null_destroy_proto() from null_insmntque_dtr(). Also apply null_destroy_proto() in null_nodeget() when we raced and a vnode is found in the hash, so the currently allocated protonode shall be destroyed. Lock the vnode interlock around reassigning the v_vnlock. In fact, this path will not be exercised after several later commits, since null_nodeget() cannot take shared-locked lowervp at all due to insmntque() requirements. Reported by: rea Tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Wed Feb 29 14:50:17 2012 (r232298) +++ head/sys/fs/nullfs/null_subr.c Wed Feb 29 15:06:00 2012 (r232299) @@ -169,17 +169,26 @@ null_hashins(mp, xp) } static void -null_insmntque_dtr(struct vnode *vp, void *xp) +null_destroy_proto(struct vnode *vp, void *xp) { - vput(((struct null_node *)xp)->null_lowervp); + VI_LOCK(vp); vp->v_data = NULL; vp->v_vnlock = &vp->v_lock; - free(xp, M_NULLFSNODE); vp->v_op = &dead_vnodeops; + VI_UNLOCK(vp); (void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vgone(vp); vput(vp); + free(xp, M_NULLFSNODE); +} + +static void +null_insmntque_dtr(struct vnode *vp, void *xp) +{ + + vput(((struct null_node *)xp)->null_lowervp); + null_destroy_proto(vp, xp); } /* @@ -247,9 +256,7 @@ null_nodeget(mp, lowervp, vpp) *vpp = null_hashins(mp, xp); if (*vpp != NULL) { vrele(lowervp); - vp->v_vnlock = &vp->v_lock; - xp->null_lowervp = NULL; - vrele(vp); + null_destroy_proto(vp, xp); return (0); } *vpp = vp; From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:06:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B3471065679; Wed, 29 Feb 2012 15:06:40 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 770D58FC12; Wed, 29 Feb 2012 15:06:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TF6e0N032046; Wed, 29 Feb 2012 15:06:40 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TF6efq032044; Wed, 29 Feb 2012 15:06:40 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202291506.q1TF6efq032044@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 29 Feb 2012 15:06: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: r232300 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 15:06:40 -0000 Author: pluknet Date: Wed Feb 29 15:06:40 2012 New Revision: 232300 URL: http://svn.freebsd.org/changeset/base/232300 Log: Update the description for -s flag after r232182. When displaying security credential information show also process umask. X-MFC-with: r232182 Modified: head/usr.bin/procstat/procstat.1 Modified: head/usr.bin/procstat/procstat.1 ============================================================================== --- head/usr.bin/procstat/procstat.1 Wed Feb 29 15:06:00 2012 (r232299) +++ head/usr.bin/procstat/procstat.1 Wed Feb 29 15:06:40 2012 (r232300) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2011 +.Dd February 29, 2012 .Dt PROCSTAT 1 .Os .Sh NAME @@ -329,6 +329,8 @@ effective group ID real group ID .It SVGID saved group ID +.It UMASK +file creation mode mask .It FLAGS credential flags .It GROUPS From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:09:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D595A106564A; Wed, 29 Feb 2012 15:09:20 +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 C18CD8FC08; Wed, 29 Feb 2012 15:09:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TF9K4M032173; Wed, 29 Feb 2012 15:09:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TF9Kt0032171; Wed, 29 Feb 2012 15:09:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202291509.q1TF9Kt0032171@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 15:09: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: r232301 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 15:09:20 -0000 Author: kib Date: Wed Feb 29 15:09:20 2012 New Revision: 232301 URL: http://svn.freebsd.org/changeset/base/232301 Log: Always request exclusive lock for the lower vnode in nullfs_vget(). The null_nodeget() requires exclusive lock on lowervp to be able to insmntque() new vnode. Reported by: rea Tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Wed Feb 29 15:06:40 2012 (r232300) +++ head/sys/fs/nullfs/null_vfsops.c Wed Feb 29 15:09:20 2012 (r232301) @@ -312,6 +312,12 @@ nullfs_vget(mp, ino, flags, vpp) struct vnode **vpp; { int error; + + KASSERT((flags & LK_TYPE_MASK) != 0, + ("nullfs_vget: no lock requested")); + flags &= ~LK_TYPE_MASK; + flags |= LK_EXCLUSIVE; + error = VFS_VGET(MOUNTTONULLMOUNT(mp)->nullm_vfs, ino, flags, vpp); if (error) return (error); From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:10:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48D06106567A; Wed, 29 Feb 2012 15:10:35 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29EB18FC17; Wed, 29 Feb 2012 15:10:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TFAZvf032270; Wed, 29 Feb 2012 15:10:35 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TFAZDN032266; Wed, 29 Feb 2012 15:10:35 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <201202291510.q1TFAZDN032266@svn.freebsd.org> From: Remko Lodder Date: Wed, 29 Feb 2012 15:10:35 +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: r232302 - in stable/7/share/man: man7 man8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 15:10:35 -0000 Author: remko Date: Wed Feb 29 15:10:34 2012 New Revision: 232302 URL: http://svn.freebsd.org/changeset/base/232302 Log: MFC r124468 Move the sticky manual from section 8 to section 7 like NetBSD has, since this is not a command on itself. PR: 124468 Added: stable/7/share/man/man7/sticky.7 - copied unchanged from r218998, head/share/man/man7/sticky.7 Deleted: stable/7/share/man/man8/sticky.8 Modified: stable/7/share/man/man7/Makefile stable/7/share/man/man8/Makefile Directory Properties: stable/7/share/man/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man8/ (props changed) Modified: stable/7/share/man/man7/Makefile ============================================================================== --- stable/7/share/man/man7/Makefile Wed Feb 29 15:09:20 2012 (r232301) +++ stable/7/share/man/man7/Makefile Wed Feb 29 15:10:34 2012 (r232302) @@ -23,6 +23,7 @@ MAN= adding_user.7 \ security.7 \ sprog.7 \ stdint.7 \ + sticky.7 \ tuning.7 MLINKS= intro.7 miscellaneous.7 Copied: stable/7/share/man/man7/sticky.7 (from r218998, head/share/man/man7/sticky.7) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/share/man/man7/sticky.7 Wed Feb 29 15:10:34 2012 (r232302, copy of r218998, head/share/man/man7/sticky.7) @@ -0,0 +1,82 @@ +.\" Copyright (c) 1980, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)sticky.8 8.1 (Berkeley) 6/5/93 +.\" $FreeBSD$ +.\" +.Dd June 5, 1993 +.Dt STICKY 7 +.Os +.Sh NAME +.Nm sticky +.Nd sticky text and append-only directories +.Sh DESCRIPTION +A special file mode, called the +.Em sticky bit +(mode S_ISTXT), +is used to indicate special treatment +for directories. +It is ignored for regular files. +See +.Xr chmod 2 +or +the file +.In sys/stat.h +for an explanation of file modes. +.Sh STICKY DIRECTORIES +A directory whose `sticky bit' is set +becomes an append-only directory, or, more accurately, +a directory in which the deletion of files is restricted. +A file in a sticky directory may only be removed or renamed +by a user if the user has write permission for the directory and +the user is the owner of the file, the owner of the directory, +or the super-user. +This feature is usefully applied to directories such as +.Pa /tmp +which must be publicly writable but +should deny users the license to arbitrarily +delete or rename each others' files. +.Pp +Any user may create a sticky directory. +See +.Xr chmod 1 +for details about modifying file modes. +.Sh HISTORY +A +.Nm +command appeared in +.At 32v . +.Sh BUGS +Neither +.Xr open 2 +nor +.Xr mkdir 2 +will create a file with the sticky bit set. Modified: stable/7/share/man/man8/Makefile ============================================================================== --- stable/7/share/man/man8/Makefile Wed Feb 29 15:09:20 2012 (r232301) +++ stable/7/share/man/man8/Makefile Wed Feb 29 15:10:34 2012 (r232302) @@ -10,7 +10,6 @@ MAN= crash.8 \ rc.sendmail.8 \ rc.subr.8 \ rescue.8 \ - sticky.8 \ yp.8 MLINKS= rc.8 rc.atm.8 \ From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:15:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3535106564A; Wed, 29 Feb 2012 15:15: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 CF1278FC1D; Wed, 29 Feb 2012 15:15:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TFFaiP032471; Wed, 29 Feb 2012 15:15:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TFFaiT032469; Wed, 29 Feb 2012 15:15:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202291515.q1TFFaiT032469@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 15:15: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: r232303 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 15:15:37 -0000 Author: kib Date: Wed Feb 29 15:15:36 2012 New Revision: 232303 URL: http://svn.freebsd.org/changeset/base/232303 Log: In null_reclaim(), assert that reclaimed vnode is fully constructed, instead of accepting half-constructed vnode. Previous code cannot decide what to do with such vnode anyway, and although processing it for hash removal, paniced later when getting rid of nullfs reference on lowervp. While there, remove initializations from the declaration block. Tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Wed Feb 29 15:10:34 2012 (r232302) +++ head/sys/fs/nullfs/null_vnops.c Wed Feb 29 15:15:36 2012 (r232303) @@ -697,12 +697,18 @@ null_inactive(struct vop_inactive_args * static int null_reclaim(struct vop_reclaim_args *ap) { - struct vnode *vp = ap->a_vp; - struct null_node *xp = VTONULL(vp); - struct vnode *lowervp = xp->null_lowervp; + struct vnode *vp; + struct null_node *xp; + struct vnode *lowervp; + + vp = ap->a_vp; + xp = VTONULL(vp); + lowervp = xp->null_lowervp; + + KASSERT(lowervp != NULL && vp->v_vnlock != &vp->v_lock, + ("Reclaiming inclomplete null vnode %p", vp)); - if (lowervp) - null_hashrem(xp); + null_hashrem(xp); /* * Use the interlock to protect the clearing of v_data to * prevent faults in null_lock(). @@ -713,10 +719,7 @@ null_reclaim(struct vop_reclaim_args *ap vp->v_object = NULL; vp->v_vnlock = &vp->v_lock; VI_UNLOCK(vp); - if (lowervp) - vput(lowervp); - else - panic("null_reclaim: reclaiming a node with no lowervp"); + vput(lowervp); free(xp, M_NULLFSNODE); return (0); From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:18:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 569991065674; Wed, 29 Feb 2012 15:18:05 +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 4277E8FC1A; Wed, 29 Feb 2012 15:18:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TFI4uA032586; Wed, 29 Feb 2012 15:18:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TFI4Ks032584; Wed, 29 Feb 2012 15:18:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202291518.q1TFI4Ks032584@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 15:18: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: r232304 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 15:18:05 -0000 Author: kib Date: Wed Feb 29 15:18:04 2012 New Revision: 232304 URL: http://svn.freebsd.org/changeset/base/232304 Log: Document that null_nodeget() cannot take shared-locked lowervp due to insmntque() requirements. Tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Wed Feb 29 15:15:36 2012 (r232303) +++ head/sys/fs/nullfs/null_subr.c Wed Feb 29 15:18:04 2012 (r232304) @@ -209,7 +209,11 @@ null_nodeget(mp, lowervp, vpp) struct vnode *vp; int error; - ASSERT_VOP_LOCKED(lowervp, "lowervp"); + /* + * The insmntque1() call below requires the exclusive lock on + * the nullfs vnode. + */ + ASSERT_VOP_ELOCKED(lowervp, "lowervp"); KASSERT(lowervp->v_usecount >= 1, ("Unreferenced vnode %p\n", lowervp)); /* Lookup the hash firstly */ From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:18:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D70EC106566B; Wed, 29 Feb 2012 15:18:53 +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 C337B8FC19; Wed, 29 Feb 2012 15:18:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TFIr3g032641; Wed, 29 Feb 2012 15:18:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TFIrWJ032639; Wed, 29 Feb 2012 15:18:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202291518.q1TFIrWJ032639@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 15:18: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: r232305 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 15:18:53 -0000 Author: kib Date: Wed Feb 29 15:18:53 2012 New Revision: 232305 URL: http://svn.freebsd.org/changeset/base/232305 Log: Allow shared locks for reads when lower filesystem accept shared locking. Tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Wed Feb 29 15:18:04 2012 (r232304) +++ head/sys/fs/nullfs/null_vfsops.c Wed Feb 29 15:18:53 2012 (r232305) @@ -185,7 +185,8 @@ nullfs_mount(struct mount *mp) MNT_IUNLOCK(mp); } MNT_ILOCK(mp); - mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE; + mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & + (MNTK_MPSAFE | MNTK_SHARED_WRITES); MNT_IUNLOCK(mp); mp->mnt_data = xmp; vfs_getnewfsid(mp); From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:21:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B5885106566B; Wed, 29 Feb 2012 15:21: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 848AD8FC0A; Wed, 29 Feb 2012 15:21:51 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 21A6D46B17; Wed, 29 Feb 2012 10:21:51 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A79A1B924; Wed, 29 Feb 2012 10:21:50 -0500 (EST) From: John Baldwin To: Konstantin Belousov Date: Wed, 29 Feb 2012 09:36:02 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <86mx81byt6.fsf@in138.ua3> <20120229132507.GB55074@deviant.kiev.zoral.com.ua> In-Reply-To: <20120229132507.GB55074@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201202290936.02309.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 29 Feb 2012 10:21:50 -0500 (EST) Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Mikolaj Golub , "Robert N. M. Watson" , svn-src-head@freebsd.org, Julian Elischer Subject: Re: svn commit: r232181 - 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: Wed, 29 Feb 2012 15:21:51 -0000 On Wednesday, February 29, 2012 8:25:07 am Konstantin Belousov wrote: > On Wed, Feb 29, 2012 at 02:37:25PM +0200, Mikolaj Golub wrote: > > > > On Wed, 29 Feb 2012 12:03:00 +0000 Robert N. M. Watson wrote: > > > > RNMW> I think the monitoring aspect of the patch is fine. > > > > RNMW> The bit I was worried about was external umask changes. This can cause > > RNMW> race conditions for applications that manage their umask -- for > > RNMW> example, bsdtar, if I recall correctly. It's one thing to use a > > RNMW> debugger to force an application to change its umask -- the developer > > RNMW> needs to know they are changing application behaviour. But exposing a > > RNMW> feature that can lead to correct applications but incorrect results is > > RNMW> a risky thing to do, hence my objection. > > > > RNMW> I think given the other objections, it would be wise to remove write > > RNMW> access to process umasks, but retain read access for procstat (which is > > RNMW> quite useful, I agree). > > > > I still don't see why having a sysctl RW is worse than asking users to run > > something like in the attach when they need to change umask for another > > process, but ok, if people don't like RW I will remove it. > > > What is done is attach is much worse then the sysctl, just because > debugger attach often causes spurious EINTR, indeed seriously disrupting > applications, as opposed to some uncertain damage that could be done in > theory. kgdb doesn't though, and presumably for umask you would change it via kgdb, so from the running process' perspective it would look the same as changing it via sysctl. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 15:33:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E651C1065675; Wed, 29 Feb 2012 15:33:39 +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 696038FC1D; Wed, 29 Feb 2012 15:33:39 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q1TFXTrq015364; Wed, 29 Feb 2012 17:33:29 +0200 (EET) (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.5/8.14.5) with ESMTP id q1TFXSco097409; Wed, 29 Feb 2012 17:33:28 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q1TFXSFs097408; Wed, 29 Feb 2012 17:33:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Feb 2012 17:33:28 +0200 From: Konstantin Belousov To: John Baldwin Message-ID: <20120229153328.GG55074@deviant.kiev.zoral.com.ua> References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <86mx81byt6.fsf@in138.ua3> <20120229132507.GB55074@deviant.kiev.zoral.com.ua> <201202290936.02309.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cl8+tZBacEYae1bh" Content-Disposition: inline In-Reply-To: <201202290936.02309.jhb@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=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Mikolaj Golub , "Robert N. M. Watson" , svn-src-head@freebsd.org, Julian Elischer Subject: Re: svn commit: r232181 - 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: Wed, 29 Feb 2012 15:33:40 -0000 --cl8+tZBacEYae1bh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 29, 2012 at 09:36:02AM -0500, John Baldwin wrote: > On Wednesday, February 29, 2012 8:25:07 am Konstantin Belousov wrote: > > On Wed, Feb 29, 2012 at 02:37:25PM +0200, Mikolaj Golub wrote: > > >=20 > > > On Wed, 29 Feb 2012 12:03:00 +0000 Robert N. M. Watson wrote: > > >=20 > > > RNMW> I think the monitoring aspect of the patch is fine. > > >=20 > > > RNMW> The bit I was worried about was external umask changes. This c= an cause > > > RNMW> race conditions for applications that manage their umask -- for > > > RNMW> example, bsdtar, if I recall correctly. It's one thing to use a > > > RNMW> debugger to force an application to change its umask -- the de= veloper > > > RNMW> needs to know they are changing application behaviour. But exp= osing a > > > RNMW> feature that can lead to correct applications but incorrect re= sults is > > > RNMW> a risky thing to do, hence my objection. > > >=20 > > > RNMW> I think given the other objections, it would be wise to remove= write > > > RNMW> access to process umasks, but retain read access for procstat = (which is > > > RNMW> quite useful, I agree). > > >=20 > > > I still don't see why having a sysctl RW is worse than asking users t= o run > > > something like in the attach when they need to change umask for anoth= er > > > process, but ok, if people don't like RW I will remove it. > > >=20 > > What is done is attach is much worse then the sysctl, just because > > debugger attach often causes spurious EINTR, indeed seriously disrupting > > applications, as opposed to some uncertain damage that could be done in > > theory. >=20 > kgdb doesn't though, and presumably for umask you would change it via kgd= b, so > from the running process' perspective it would look the same as changing = it via > sysctl. Right, but an idea of the change was to allow to do this for somebody who does not know how to perform it in kgdb. Not to mention that kgdb -w is risky, e.g. because filedesc might have changed under kgdb, so you would write over freed memory. --cl8+tZBacEYae1bh Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9ORUgACgkQC3+MBN1Mb4hkgQCg4eZSfK8M8FK2ywsijJ7pD58F kQAAoOUtORWe6fX3d8qK10JBlXRHZUG9 =NiSX -----END PGP SIGNATURE----- --cl8+tZBacEYae1bh-- From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 16:16:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3557106566C; Wed, 29 Feb 2012 16:16:36 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C30458FC14; Wed, 29 Feb 2012 16:16:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TGGav9034587; Wed, 29 Feb 2012 16:16:36 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TGGa6f034585; Wed, 29 Feb 2012 16:16:36 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201202291616.q1TGGa6f034585@svn.freebsd.org> From: Martin Matuska Date: Wed, 29 Feb 2012 16:16: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: r232307 - head/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: Wed, 29 Feb 2012 16:16:36 -0000 Author: mm Date: Wed Feb 29 16:16:36 2012 New Revision: 232307 URL: http://svn.freebsd.org/changeset/base/232307 Log: Add "export" to devfs_opts[] and return EOPNOTSUPP if called with it. Fixes mountd warnings. Reported by: kib MFC after: 1 week Modified: head/sys/fs/devfs/devfs_vfsops.c Modified: head/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- head/sys/fs/devfs/devfs_vfsops.c Wed Feb 29 16:16:00 2012 (r232306) +++ head/sys/fs/devfs/devfs_vfsops.c Wed Feb 29 16:16:36 2012 (r232307) @@ -58,7 +58,7 @@ static vfs_root_t devfs_root; static vfs_statfs_t devfs_statfs; static const char *devfs_opts[] = { - "from", "ruleset", NULL + "from", "export", "ruleset", NULL }; /* @@ -91,6 +91,9 @@ devfs_mount(struct mount *mp) if (vfs_filteropt(mp->mnt_optnew, devfs_opts)) return (EINVAL); + if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) + return (EOPNOTSUPP); + if (vfs_getopt(mp->mnt_optnew, "ruleset", NULL, NULL) == 0 && (vfs_scanopt(mp->mnt_optnew, "ruleset", "%d", &rsnum) != 1 || rsnum < 0 || rsnum > 65535)) { From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 17:47:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92D9E1065678; Wed, 29 Feb 2012 17:47:01 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC2698FC12; Wed, 29 Feb 2012 17:47:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1THl1Vq037744; Wed, 29 Feb 2012 17:47:01 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1THl1ls037743; Wed, 29 Feb 2012 17:47:01 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201202291747.q1THl1ls037743@svn.freebsd.org> From: "Justin T. Gibbs" Date: Wed, 29 Feb 2012 17:47: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: r232308 - head/sys/xen/interface/io X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 17:47:04 -0000 Author: gibbs Date: Wed Feb 29 17:47:01 2012 New Revision: 232308 URL: http://svn.freebsd.org/changeset/base/232308 Log: blkif interface comment cleanups. No functional changes sys/xen/interface/io/blkif.h: o Insert space in "Red Hat". o Fix typo "discard-aligment" -> "discard-alignment" o Fix typo "unamp" -> "unmap" o Fix typo "formated" -> "formatted" o Clarify the text for "params". o Clarify the text for "sector-size". o Clarify the text for "max-requests" in the backend section. Modified: head/sys/xen/interface/io/blkif.h Modified: head/sys/xen/interface/io/blkif.h ============================================================================== --- head/sys/xen/interface/io/blkif.h Wed Feb 29 16:16:36 2012 (r232307) +++ head/sys/xen/interface/io/blkif.h Wed Feb 29 17:47:01 2012 (r232308) @@ -59,7 +59,7 @@ * All data in the XenStore is stored as strings. Nodes specifying numeric * values are encoded in decimal. Integer value ranges listed below are * expressed as fixed sized integer types capable of storing the conversion - * of a properly formated node string, without loss of information. + * of a properly formatted node string, without loss of information. * * Any specified default value is in effect if the corresponding XenBus node * is not present in the XenStore. @@ -67,6 +67,9 @@ * XenStore nodes in sections marked "PRIVATE" are solely for use by the * driver side whose XenBus tree contains them. * + * XenStore nodes marked "DEPRECATED" in their notes section should only be + * used to provide interoperability with legacy implementations. + * * See the XenBus state transition diagram below for details on when XenBus * nodes must be published and when they can be queried. * @@ -85,9 +88,9 @@ * params * Values: string * - * A free formatted string providing sufficient information for the - * backend driver to open the backing device. (e.g. the path to the - * file or block device representing the backing store.) + * Data used by the backend driver to locate and configure the backing + * device. The format and semantics of this data vary according to the + * backing device in use and are outside the scope of this specification. * * type * Values: "file", "phy", "tap" @@ -137,7 +140,7 @@ * max-ring-pages * Values: * Default Value: 1 - * Notes: 2, 3 + * Notes: DEPRECATED, 2, 3 * * The maximum supported size of the request ring buffer in units of * machine pages. The value must be a power of 2. @@ -146,8 +149,8 @@ * Default Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE) * Maximum Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages) * - * The maximum number of concurrent, logical requests that will be - * issued by the backend. + * The maximum number of concurrent, logical requests supported by + * the backend. * * Note: A logical request may span multiple ring entries. * @@ -170,7 +173,7 @@ * *------------------------- Backend Device Properties ------------------------- * - * discard-aligment + * discard-alignment * Values: * Default Value: 0 * Notes: 4, 5 @@ -203,7 +206,8 @@ * sector-size * Values: * - * The native sector size, in bytes, of the backend device. + * The size, in bytes, of the individually addressible data blocks + * on the backend device. * * sectors * Values: @@ -234,8 +238,8 @@ * Values: * Notes: 6 * - * For a frontend providing a multi-page ring, a "num-ring-pages" sized - * list of nodes, each containing a Xen grant reference granting + * For a frontend providing a multi-page ring, a "number of ring pages" + * sized list of nodes, each containing a Xen grant reference granting * permission for the backend to map the page of the ring located * at page index "%u". Page indexes are zero based. * @@ -260,7 +264,7 @@ * Values: * Default Value: 1 * Maximum Value: MAX(max-ring-pages,(0x1 << max-ring-page-order)) - * Notes: 2, 3 + * Notes: DEPRECATED, 2, 3 * * The size of the frontend allocated request ring buffer in units of * machine pages. The value must be a power of 2. @@ -311,11 +315,11 @@ * ----- * (1) Multi-page ring buffer scheme first developed in the Citrix XenServer * PV drivers. - * (2) Multi-page ring buffer scheme first used in some RedHat distributions + * (2) Multi-page ring buffer scheme first used in some Red Hat distributions * including a distribution deployed on certain nodes of the Amazon * EC2 cluster. * (3) Support for multi-page ring buffers was implemented independently, - * in slightly different forms, by both Citrix and RedHat/Amazon. + * in slightly different forms, by both Citrix and Red Hat/Amazon. * For full interoperability, block front and backends should publish * identical ring parameters, adjusted for unit differences, to the * XenStore nodes used in both schemes. @@ -437,7 +441,7 @@ * discarded region on the device must be rendered unrecoverable before the * command returns. * - * This operation is analogous to performing a trim (ATA) or unamp (SCSI), + * This operation is analogous to performing a trim (ATA) or unmap (SCSI), * command on a native device. * * More information about trim/unmap operations can be found at: From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 18:11:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C9DB106566C; Wed, 29 Feb 2012 18:11:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C25E8FC17; Wed, 29 Feb 2012 18:11:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TIBYlX038655; Wed, 29 Feb 2012 18:11:34 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TIBYim038653; Wed, 29 Feb 2012 18:11:34 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201202291811.q1TIBYim038653@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 29 Feb 2012 18:11: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: r232309 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 18:11:34 -0000 Author: jkim Date: Wed Feb 29 18:11:33 2012 New Revision: 232309 URL: http://svn.freebsd.org/changeset/base/232309 Log: Fix a long standing bug. The caller expects a non-zero value for success. Luckily keyboard probing was turned off by default from the first revision. Submitted by: Alexander Sack (asack at niksun dot com) MFC after: 3 days Modified: head/sys/boot/i386/libi386/vidconsole.c Modified: head/sys/boot/i386/libi386/vidconsole.c ============================================================================== --- head/sys/boot/i386/libi386/vidconsole.c Wed Feb 29 17:47:01 2012 (r232308) +++ head/sys/boot/i386/libi386/vidconsole.c Wed Feb 29 18:11:33 2012 (r232309) @@ -623,10 +623,10 @@ probe_keyboard(void) #endif if (i == KBD_ECHO) { /* got the right answer */ - return (0); + return (1); } } - return (1); + return (0); } #endif /* KEYBOARD_PROBE */ From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 18:23:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id CF1B21065670; Wed, 29 Feb 2012 18:23:58 +0000 (UTC) Date: Wed, 29 Feb 2012 18:23:58 +0000 From: Alexey Dokuchaev To: Jung-uk Kim Message-ID: <20120229182358.GA67664@FreeBSD.org> References: <201202291811.q1TIBYim038653@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201202291811.q1TIBYim038653@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232309 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 18:23:58 -0000 On Wed, Feb 29, 2012 at 06:11:34PM +0000, Jung-uk Kim wrote: > Author: jkim > Date: Wed Feb 29 18:11:33 2012 > New Revision: 232309 > URL: http://svn.freebsd.org/changeset/base/232309 > > Log: > Fix a long standing bug. The caller expects a non-zero value for success. > Luckily keyboard probing was turned off by default from the first revision. Could it be related to the resume brokenesss I've reported earlier on -stable@, or this code path does not touch it? ./danfe From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 18:40:45 2012 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 7A730106564A; Wed, 29 Feb 2012 18:40:43 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Alexey Dokuchaev Date: Wed, 29 Feb 2012 13:40:34 -0500 User-Agent: KMail/1.6.2 References: <201202291811.q1TIBYim038653@svn.freebsd.org> <20120229182358.GA67664@FreeBSD.org> In-Reply-To: <20120229182358.GA67664@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201202291340.37625.jkim@FreeBSD.org> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r232309 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 18:40:45 -0000 On Wednesday 29 February 2012 01:23 pm, Alexey Dokuchaev wrote: > On Wed, Feb 29, 2012 at 06:11:34PM +0000, Jung-uk Kim wrote: > > Author: jkim > > Date: Wed Feb 29 18:11:33 2012 > > New Revision: 232309 > > URL: http://svn.freebsd.org/changeset/base/232309 > > > > Log: > > Fix a long standing bug. The caller expects a non-zero value > > for success. Luckily keyboard probing was turned off by default > > from the first revision. > > Could it be related to the resume brokenesss I've reported earlier > on -stable@, or this code path does not touch it? No. This is a loader fix and it is turned off by default as I noted. Jung-uk Kim From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 18:42:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B0EC1065672; Wed, 29 Feb 2012 18:42:00 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 099448FC1A; Wed, 29 Feb 2012 18:42:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TIfxMX039724; Wed, 29 Feb 2012 18:41:59 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TIfx1r039722; Wed, 29 Feb 2012 18:41:59 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201202291841.q1TIfx1r039722@svn.freebsd.org> From: "Justin T. Gibbs" Date: Wed, 29 Feb 2012 18:41:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232310 - stable/9/sys/dev/xen/blkback X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 18:42:00 -0000 Author: gibbs Date: Wed Feb 29 18:41:59 2012 New Revision: 232310 URL: http://svn.freebsd.org/changeset/base/232310 Log: MFC r231883 =========== Fix regression in the handling of blkback close events for devices that are unplugged via QEMU. sys/dev/xen/blkback/blkback.c: Toolstack initiated closures change the frontend's state to Closing. The backend must change to Closing as well, even if we can't actually close yet, in order for the frontend to notice and start the closing process. Modified: stable/9/sys/dev/xen/blkback/blkback.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/xen/blkback/blkback.c ============================================================================== --- stable/9/sys/dev/xen/blkback/blkback.c Wed Feb 29 18:11:33 2012 (r232309) +++ stable/9/sys/dev/xen/blkback/blkback.c Wed Feb 29 18:41:59 2012 (r232310) @@ -3955,16 +3955,12 @@ xbb_frontend_changed(device_t dev, Xenbu xbb_connect(xbb); break; case XenbusStateClosing: - /* - * Frontend has acknowledged Closing request. - * Wait for Closed state. - */ - break; case XenbusStateClosed: mtx_lock(&xbb->lock); xbb_shutdown(xbb); mtx_unlock(&xbb->lock); - xenbus_set_state(xbb->dev, XenbusStateClosed); + if (frontend_state == XenbusStateClosed) + xenbus_set_state(xbb->dev, XenbusStateClosed); break; default: xenbus_dev_fatal(xbb->dev, EINVAL, "saw state %d at frontend", From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 19:18:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F3E4106566B; Wed, 29 Feb 2012 19:18:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E94C08FC17; Wed, 29 Feb 2012 19:18:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TJIWxe041043; Wed, 29 Feb 2012 19:18:32 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TJIWek041041; Wed, 29 Feb 2012 19:18:32 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202291918.q1TJIWek041041@svn.freebsd.org> From: Dimitry Andric Date: Wed, 29 Feb 2012 19:18: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: r232311 - 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: Wed, 29 Feb 2012 19:18:33 -0000 Author: dim Date: Wed Feb 29 19:18:32 2012 New Revision: 232311 URL: http://svn.freebsd.org/changeset/base/232311 Log: Regenerate src.conf(5) after r231530 (and to correct a little screwup with the WITH_CLANG_EXTRAS fragment I added). Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Feb 29 18:41:59 2012 (r232310) +++ head/share/man/man5/src.conf.5 Wed Feb 29 19:18:32 2012 (r232311) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru .\" $FreeBSD$ -.Dd February 6, 2012 +.Dd February 29, 2012 .Dt SRC.CONF 5 .Os .Sh NAME @@ -284,7 +284,7 @@ Set to build the Clang C/C++ compiler. It is a default setting on amd64/amd64, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. .It Va WITH_CLANG_EXTRAS -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 23:56:22Z dim Set to build additional clang and llvm tools, such as bugpoint. .It Va WITHOUT_CPP .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru @@ -956,7 +956,7 @@ When set, it also enforces the following .\" from FreeBSD: head/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru Set to not build USB-related programs and libraries. .It Va WITHOUT_UTMPX -.\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 230060 2012-01-13 15:40:49Z ed +.\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 231530 2012-02-11 20:28:42Z ed Set to not build user accounting tools such as .Xr last 1 , .Xr users 1 , @@ -964,7 +964,7 @@ Set to not build user accounting tools s .Xr ac 8 , .Xr lastlogin 8 and -.Xr utxrm 8 . +.Xr utx 8 . .It Va WITHOUT_WIRELESS .\" from FreeBSD: head/tools/build/options/WITHOUT_WIRELESS 183242 2008-09-21 22:02:26Z sam Set to not build programs used for 802.11 wireless networks; especially From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 19:50:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 749A7106564A; Wed, 29 Feb 2012 19:50:50 +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 635CD8FC13; Wed, 29 Feb 2012 19:50:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TJoofo042042; Wed, 29 Feb 2012 19:50:50 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TJoo3R042040; Wed, 29 Feb 2012 19:50:50 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201202291950.q1TJoo3R042040@svn.freebsd.org> From: Christian Brueffer Date: Wed, 29 Feb 2012 19:50: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: r232312 - head/tools/regression/security/cap_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: Wed, 29 Feb 2012 19:50:50 -0000 Author: brueffer Date: Wed Feb 29 19:50:49 2012 New Revision: 232312 URL: http://svn.freebsd.org/changeset/base/232312 Log: Fix order of arguments to lseek(). PR: 160867 Submitted by: Henning Petersen MFC after: 1 week Modified: head/tools/regression/security/cap_test/cap_test_capmode.c Modified: head/tools/regression/security/cap_test/cap_test_capmode.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test_capmode.c Wed Feb 29 19:18:32 2012 (r232311) +++ head/tools/regression/security/cap_test/cap_test_capmode.c Wed Feb 29 19:50:49 2012 (r232312) @@ -117,7 +117,7 @@ test_capmode(void) CHECK_SYSCALL_SUCCEEDS(close, fd_close); CHECK_SYSCALL_SUCCEEDS(dup, fd_file); CHECK_SYSCALL_SUCCEEDS(fstat, fd_file, &sb); - CHECK_SYSCALL_SUCCEEDS(lseek, fd_file, SEEK_SET, 0); + CHECK_SYSCALL_SUCCEEDS(lseek, fd_file, 0, SEEK_SET); CHECK_SYSCALL_SUCCEEDS(msync, &fd_file, 8192, MS_ASYNC); CHECK_SYSCALL_SUCCEEDS(profil, NULL, 0, 0, 0); CHECK_SYSCALL_SUCCEEDS(read, fd_file, &ch, sizeof(ch)); From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 20:13:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15224106566C; Wed, 29 Feb 2012 20:13:54 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0456E8FC15; Wed, 29 Feb 2012 20:13:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TKDrV3042994; Wed, 29 Feb 2012 20:13:53 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TKDr09042992; Wed, 29 Feb 2012 20:13:53 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201202292013.q1TKDr09042992@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 29 Feb 2012 20:13: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: r232313 - 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: Wed, 29 Feb 2012 20:13:54 -0000 Author: pluknet Date: Wed Feb 29 20:13:53 2012 New Revision: 232313 URL: http://svn.freebsd.org/changeset/base/232313 Log: Add myself, and show marck@ as my mentor. Approved by: marck (mentor) Modified: head/share/misc/committers-doc.dot Modified: head/share/misc/committers-doc.dot ============================================================================== --- head/share/misc/committers-doc.dot Wed Feb 29 19:50:49 2012 (r232312) +++ head/share/misc/committers-doc.dot Wed Feb 29 20:13:53 2012 (r232313) @@ -72,6 +72,7 @@ maxim [label="Maxim Konovalov\nmaxim@Fre miwi [label="Martin Wilke\nmiwi@FreeBSD.org\n2007/10/26"] murray [label="Murray Stokely\nmurray@FreeBSD.org\n2000/04/05"] pav [label="Pav Lucistnik\npav@FreeBSD.org\n2005/08/12"] +pluknet [label="Sergey Kandaurov\npluknet@FreeBSD.org\n2012/02/14"] remko [label="Remko Lodder\nremko@FreeBSD.org\n2004/10/16"] rene [label="Rene Ladan\nrene@FreeBSD.org\n2008/11/03"] roam [label="Peter Pentchev\nroam@FreeBSD.org\n2003/02/14"] @@ -129,6 +130,7 @@ keramida -> gjb keramida -> pav marck -> bvs +marck -> pluknet marck -> taras maxim -> taras From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 20:22:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEAB41065670; Wed, 29 Feb 2012 20:22:45 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3DD08FC1B; Wed, 29 Feb 2012 20:22:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TKMjwe043331; Wed, 29 Feb 2012 20:22:45 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TKMjNw043326; Wed, 29 Feb 2012 20:22:45 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201202292022.q1TKMjNw043326@svn.freebsd.org> From: Andrew Thompson Date: Wed, 29 Feb 2012 20:22:45 +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: r232314 - in stable/8: share/man/man4 sys/i386/conf 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, 29 Feb 2012 20:22:45 -0000 Author: thompsa Date: Wed Feb 29 20:22:45 2012 New Revision: 232314 URL: http://svn.freebsd.org/changeset/base/232314 Log: MFC r232008,232010,232080,232089 Using the flowid in the mbuf assumes the network card is giving a good hash for the traffic flow, this may not be the case giving poor traffic distribution. Add a sysctl which allows us to fall back to our own flow hash code. PR: kern/164901 Approved by: re (bz) Modified: stable/8/share/man/man4/lagg.4 stable/8/sys/net/ieee8023ad_lacp.c stable/8/sys/net/if_lagg.c stable/8/sys/net/if_lagg.h Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/share/man/man4/lagg.4 ============================================================================== --- stable/8/share/man/man4/lagg.4 Wed Feb 29 20:13:53 2012 (r232313) +++ stable/8/share/man/man4/lagg.4 Wed Feb 29 20:22:45 2012 (r232314) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 18, 2010 +.Dd February 23, 2012 .Dt LAGG 4 .Os .Sh NAME @@ -133,6 +133,21 @@ variable in .Pp The MTU of the first interface to be added is used as the lagg MTU. All additional interfaces are required to have exactly the same value. +.Pp +The +.Ic loadbalance +and +.Ic lacp +modes will use the RSS hash from the network card if available to avoid +computing one, this may give poor traffic distribution if the hash is invalid +or uses less of the protocol header information. +Local hash computation can be forced per interface by setting the +.Va net.link.lagg.X.use_flowid +.Xr sysctl 8 +variable to zero where X is the interface number. +The default for new interfaces is set via the +.Va net.link.lagg.default_use_flowid +.Xr sysctl 8 . .Sh EXAMPLES Create a 802.3ad link aggregation using LACP with two .Xr bge 4 Modified: stable/8/sys/net/ieee8023ad_lacp.c ============================================================================== --- stable/8/sys/net/ieee8023ad_lacp.c Wed Feb 29 20:13:53 2012 (r232313) +++ stable/8/sys/net/ieee8023ad_lacp.c Wed Feb 29 20:22:45 2012 (r232314) @@ -812,7 +812,7 @@ lacp_select_tx_port(struct lagg_softc *s return (NULL); } - if (m->m_flags & M_FLOWID) + if (sc->use_flowid && (m->m_flags & M_FLOWID)) hash = m->m_pkthdr.flowid; else hash = lagg_hashmbuf(m, lsc->lsc_hashkey); Modified: stable/8/sys/net/if_lagg.c ============================================================================== --- stable/8/sys/net/if_lagg.c Wed Feb 29 20:13:53 2012 (r232313) +++ stable/8/sys/net/if_lagg.c Wed Feb 29 20:22:45 2012 (r232314) @@ -167,6 +167,11 @@ static int lagg_failover_rx_all = 0; /* SYSCTL_INT(_net_link_lagg, OID_AUTO, failover_rx_all, CTLFLAG_RW, &lagg_failover_rx_all, 0, "Accept input from any interface in a failover lagg"); +static int def_use_flowid = 1; /* Default value for using M_FLOWID */ +TUNABLE_INT("net.link.lagg.default_use_flowid", &def_use_flowid); +SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid, CTLFLAG_RW, + &def_use_flowid, 0, + "Default setting for using flow id for load sharing"); static int lagg_modevent(module_t mod, int type, void *data) @@ -257,6 +262,8 @@ lagg_clone_create(struct if_clone *ifc, struct ifnet *ifp; int i, error = 0; static const u_char eaddr[6]; /* 00:00:00:00:00:00 */ + struct sysctl_oid *oid; + char num[14]; /* sufficient for 32 bits */ sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); ifp = sc->sc_ifp = if_alloc(IFT_ETHER); @@ -265,6 +272,15 @@ lagg_clone_create(struct if_clone *ifc, return (ENOSPC); } + sysctl_ctx_init(&sc->ctx); + snprintf(num, sizeof(num), "%u", unit); + sc->use_flowid = def_use_flowid; + oid = SYSCTL_ADD_NODE(&sc->ctx, &SYSCTL_NODE_CHILDREN(_net_link, lagg), + OID_AUTO, num, CTLFLAG_RD, NULL, ""); + SYSCTL_ADD_INT(&sc->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "use_flowid", CTLTYPE_INT|CTLFLAG_RW, &sc->use_flowid, sc->use_flowid, + "Use flow id for load sharing"); + sc->sc_proto = LAGG_PROTO_NONE; for (i = 0; lagg_protos[i].ti_proto != LAGG_PROTO_NONE; i++) { if (lagg_protos[i].ti_proto == LAGG_PROTO_DEFAULT) { @@ -344,6 +360,7 @@ lagg_clone_destroy(struct ifnet *ifp) LAGG_WUNLOCK(sc); + sysctl_ctx_free(&sc->ctx); ifmedia_removeall(&sc->sc_media); ether_ifdetach(ifp); if_free_type(ifp, IFT_ETHER); @@ -1668,7 +1685,7 @@ lagg_lb_start(struct lagg_softc *sc, str struct lagg_port *lp = NULL; uint32_t p = 0; - if (m->m_flags & M_FLOWID) + if (sc->use_flowid && (m->m_flags & M_FLOWID)) p = m->m_pkthdr.flowid; else p = lagg_hashmbuf(m, lb->lb_key); Modified: stable/8/sys/net/if_lagg.h ============================================================================== --- stable/8/sys/net/if_lagg.h Wed Feb 29 20:13:53 2012 (r232313) +++ stable/8/sys/net/if_lagg.h Wed Feb 29 20:22:45 2012 (r232314) @@ -21,6 +21,8 @@ #ifndef _NET_LAGG_H #define _NET_LAGG_H +#include + /* * Global definitions */ @@ -202,6 +204,8 @@ struct lagg_softc { eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; #endif + struct sysctl_ctx_list ctx; /* sysctl variables */ + int use_flowid; /* use M_FLOWID */ }; struct lagg_port { From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 20:58:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FCDE1065672; Wed, 29 Feb 2012 20:58:22 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F33478FC16; Wed, 29 Feb 2012 20:58:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TKwLxZ044711; Wed, 29 Feb 2012 20:58:21 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TKwLBD044709; Wed, 29 Feb 2012 20:58:21 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201202292058.q1TKwLBD044709@svn.freebsd.org> From: Andrew Thompson Date: Wed, 29 Feb 2012 20: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: r232315 - head/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, 29 Feb 2012 20:58:22 -0000 Author: thompsa Date: Wed Feb 29 20:58:21 2012 New Revision: 232315 URL: http://svn.freebsd.org/changeset/base/232315 Log: Use a more appropriate default for the maximum number of addresses in the bridge forwarding table. PR: docs/164564 Discussed with: brueffer Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Feb 29 20:22:45 2012 (r232314) +++ head/sys/net/if_bridge.c Wed Feb 29 20:58:21 2012 (r232315) @@ -144,10 +144,10 @@ __FBSDID("$FreeBSD$"); #define BRIDGE_RTHASH_MASK (BRIDGE_RTHASH_SIZE - 1) /* - * Maximum number of addresses to cache. + * Default maximum number of addresses to cache. */ #ifndef BRIDGE_RTABLE_MAX -#define BRIDGE_RTABLE_MAX 100 +#define BRIDGE_RTABLE_MAX 2000 #endif /* From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 21:11:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 69B07106566B; Wed, 29 Feb 2012 21:11:03 +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 58A978FC17; Wed, 29 Feb 2012 21:11:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TLB3X0045194; Wed, 29 Feb 2012 21:11:03 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TLB34G045191; Wed, 29 Feb 2012 21:11:03 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201202292111.q1TLB34G045191@svn.freebsd.org> From: Christian Brueffer Date: Wed, 29 Feb 2012 21:11: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: r232316 - head/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 21:11:03 -0000 Author: brueffer Date: Wed Feb 29 21:11:02 2012 New Revision: 232316 URL: http://svn.freebsd.org/changeset/base/232316 Log: Update bridge(4) default values. PR: 164564 Submitted by: "Rudy (bulk)" MFC after: 2 weeks Modified: head/sbin/ifconfig/ifconfig.8 Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Wed Feb 29 20:58:21 2012 (r232315) +++ head/sbin/ifconfig/ifconfig.8 Wed Feb 29 21:11:02 2012 (r232316) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd January 4, 2012 +.Dd February 29, 2012 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2106,7 +2106,7 @@ it is removed from the bridge. .It Cm maxaddr Ar size Set the size of the bridge address cache to .Ar size . -The default is 100 entries. +The default is 2000 entries. .It Cm timeout Ar seconds Set the timeout of address cache entries to .Ar seconds @@ -2114,7 +2114,7 @@ seconds. If .Ar seconds is zero, then address cache entries will not be expired. -The default is 240 seconds. +The default is 1200 seconds. .It Cm addr Display the addresses that have been learned by the bridge. .It Cm static Ar interface-name Ar address From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 21:38:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FD0C1065687; Wed, 29 Feb 2012 21:38:32 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14CBB8FC13; Wed, 29 Feb 2012 21:38:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TLcV7W046110; Wed, 29 Feb 2012 21:38:31 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TLcVFv046104; Wed, 29 Feb 2012 21:38:31 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201202292138.q1TLcVFv046104@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 29 Feb 2012 21:38: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: r232317 - in head: . 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: Wed, 29 Feb 2012 21:38:32 -0000 Author: trociny Date: Wed Feb 29 21:38:31 2012 New Revision: 232317 URL: http://svn.freebsd.org/changeset/base/232317 Log: Introduce VOP_UNP_BIND(), VOP_UNP_CONNECT(), and VOP_UNP_DETACH() operations for setting and accessing vnode's v_socket field. The operations are necessary to implement proper unix socket handling on layered file systems like nullfs(5). This change fixes the long standing issue with nullfs(5) being in that unix sockets did not work between lower and upper layers: if we bound to a socket on the lower layer we could connect only to the lower path; if we bound to the upper layer we could connect only to the upper path. The new behavior is one can connect to both the lower and the upper paths regardless what layer path one binds to. PR: kern/51583, kern/159663 Suggested by: kib Reviewed by: arch MFC after: 2 weeks Modified: head/UPDATING head/sys/kern/uipc_usrreq.c head/sys/kern/vfs_default.c head/sys/kern/vnode_if.src head/sys/sys/vnode.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Feb 29 21:11:02 2012 (r232316) +++ head/UPDATING Wed Feb 29 21:38:31 2012 (r232317) @@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20120229: + Now unix domain sockets behave "as expected" on nullfs(5). Previously + nullfs(5) did not pass through all behaviours to the underlying layer, + as a result if we bound to a socket on the lower layer we could connect + only to the lower path; if we bound to the upper layer we could connect + only to the upper path. The new behavior is one can connect to both the + lower and the upper paths regardless what layer path one binds to. + 20120211: The getifaddrs upgrade path broken with 20111215 has been restored. If you have upgraded in between 20111215 and 20120209 you need to Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Wed Feb 29 21:11:02 2012 (r232316) +++ head/sys/kern/uipc_usrreq.c Wed Feb 29 21:38:31 2012 (r232317) @@ -542,7 +542,7 @@ restart: UNP_LINK_WLOCK(); UNP_PCB_LOCK(unp); - vp->v_socket = unp->unp_socket; + VOP_UNP_BIND(vp, unp->unp_socket); unp->unp_vnode = vp; unp->unp_addr = soun; unp->unp_flags &= ~UNP_BINDING; @@ -638,7 +638,7 @@ uipc_detach(struct socket *so) * XXXRW: Should assert vp->v_socket == so. */ if ((vp = unp->unp_vnode) != NULL) { - unp->unp_vnode->v_socket = NULL; + VOP_UNP_DETACH(vp); unp->unp_vnode = NULL; } unp2 = unp->unp_conn; @@ -1308,7 +1308,7 @@ unp_connect(struct socket *so, struct so * and to protect simultaneous locking of multiple pcbs. */ UNP_LINK_WLOCK(); - so2 = vp->v_socket; + VOP_UNP_CONNECT(vp, &so2); if (so2 == NULL) { error = ECONNREFUSED; goto bad2; @@ -2318,17 +2318,15 @@ vfs_unp_reclaim(struct vnode *vp) active = 0; UNP_LINK_WLOCK(); - so = vp->v_socket; + VOP_UNP_CONNECT(vp, &so); if (so == NULL) goto done; unp = sotounpcb(so); if (unp == NULL) goto done; UNP_PCB_LOCK(unp); - if (unp->unp_vnode != NULL) { - KASSERT(unp->unp_vnode == vp, - ("vfs_unp_reclaim: vp != unp->unp_vnode")); - vp->v_socket = NULL; + if (unp->unp_vnode == vp) { + VOP_UNP_DETACH(vp); unp->unp_vnode = NULL; active = 1; } Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Wed Feb 29 21:11:02 2012 (r232316) +++ head/sys/kern/vfs_default.c Wed Feb 29 21:38:31 2012 (r232317) @@ -123,6 +123,9 @@ struct vop_vector default_vnodeops = { .vop_unlock = vop_stdunlock, .vop_vptocnp = vop_stdvptocnp, .vop_vptofh = vop_stdvptofh, + .vop_unp_bind = vop_stdunp_bind, + .vop_unp_connect = vop_stdunp_connect, + .vop_unp_detach = vop_stdunp_detach, }; /* @@ -1037,6 +1040,30 @@ vop_stdadvise(struct vop_advise_args *ap return (error); } +int +vop_stdunp_bind(struct vop_unp_bind_args *ap) +{ + + ap->a_vp->v_socket = ap->a_socket; + return (0); +} + +int +vop_stdunp_connect(struct vop_unp_connect_args *ap) +{ + + *ap->a_socket = ap->a_vp->v_socket; + return (0); +} + +int +vop_stdunp_detach(struct vop_unp_detach_args *ap) +{ + + ap->a_vp->v_socket = NULL; + return (0); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Wed Feb 29 21:11:02 2012 (r232316) +++ head/sys/kern/vnode_if.src Wed Feb 29 21:38:31 2012 (r232317) @@ -640,6 +640,26 @@ vop_advise { IN int advice; }; +%% unp_bind vp E E E + +vop_unp_bind { + IN struct vnode *vp; + IN struct socket *socket; +}; + +%% unp_connect vp L L L + +vop_unp_connect { + IN struct vnode *vp; + OUT struct socket **socket; +}; + +%% unp_detach vp = = = + +vop_unp_detach { + IN struct vnode *vp; +}; + # The VOPs below are spares at the end of the table to allow new VOPs to be # added in stable branches without breaking the KBI. New VOPs in HEAD should # be added above these spares. When merging a new VOP to a stable branch, Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Feb 29 21:11:02 2012 (r232316) +++ head/sys/sys/vnode.h Wed Feb 29 21:38:31 2012 (r232317) @@ -703,6 +703,9 @@ int vop_stdpathconf(struct vop_pathconf_ int vop_stdpoll(struct vop_poll_args *); int vop_stdvptocnp(struct vop_vptocnp_args *ap); int vop_stdvptofh(struct vop_vptofh_args *ap); +int vop_stdunp_bind(struct vop_unp_bind_args *ap); +int vop_stdunp_connect(struct vop_unp_connect_args *ap); +int vop_stdunp_detach(struct vop_unp_detach_args *ap); int vop_eopnotsupp(struct vop_generic_args *ap); int vop_ebadf(struct vop_generic_args *ap); int vop_einval(struct vop_generic_args *ap); From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 22:06:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06523106566B; Wed, 29 Feb 2012 22:06: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 D079A8FC08; Wed, 29 Feb 2012 22:06:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TM6imu047054; Wed, 29 Feb 2012 22:06:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TM6iGn047052; Wed, 29 Feb 2012 22:06:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201202292206.q1TM6iGn047052@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Feb 2012 22:06: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: r232318 - 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: Wed, 29 Feb 2012 22:06:45 -0000 Author: jhb Date: Wed Feb 29 22:06:44 2012 New Revision: 232318 URL: http://svn.freebsd.org/changeset/base/232318 Log: Use pci_printf() instead of a home-rolled version in the VPD parsing code. Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Feb 29 21:38:31 2012 (r232317) +++ head/sys/dev/pci/pci.c Wed Feb 29 22:06:44 2012 (r232318) @@ -878,10 +878,9 @@ pci_read_vpd(device_t pcib, pcicfgregs * remain |= byte2 << 8; if (remain > (0x7f*4 - vrs.off)) { state = -1; - printf( - "pci%d:%d:%d:%d: invalid VPD data, remain %#x\n", - cfg->domain, cfg->bus, cfg->slot, - cfg->func, remain); + pci_printf(cfg, + "invalid VPD data, remain %#x\n", + remain); } name = byte & 0x7f; } else { @@ -953,10 +952,8 @@ pci_read_vpd(device_t pcib, pcicfgregs * * if this happens, we can't trust the rest * of the VPD. */ - printf( - "pci%d:%d:%d:%d: bad keyword length: %d\n", - cfg->domain, cfg->bus, cfg->slot, - cfg->func, dflen); + pci_printf(cfg, "bad keyword length: %d\n", + dflen); cksumvalid = 0; state = -1; break; @@ -989,10 +986,8 @@ pci_read_vpd(device_t pcib, pcicfgregs * cksumvalid = 1; else { if (bootverbose) - printf( - "pci%d:%d:%d:%d: bad VPD cksum, remain %hhu\n", - cfg->domain, cfg->bus, - cfg->slot, cfg->func, + pci_printf(cfg, + "bad VPD cksum, remain %hhu\n", vrs.cksum); cksumvalid = 0; state = -1; @@ -1070,9 +1065,7 @@ pci_read_vpd(device_t pcib, pcicfgregs * break; default: - printf("pci%d:%d:%d:%d: invalid state: %d\n", - cfg->domain, cfg->bus, cfg->slot, cfg->func, - state); + pci_printf(cfg, "invalid state: %d\n", state); state = -1; break; } @@ -1089,8 +1082,7 @@ pci_read_vpd(device_t pcib, pcicfgregs * } if (state < -1) { /* I/O error, clean up */ - printf("pci%d:%d:%d:%d: failed to read VPD data.\n", - cfg->domain, cfg->bus, cfg->slot, cfg->func); + pci_printf(cfg, "failed to read VPD data.\n"); if (cfg->vpd.vpd_ident != NULL) { free(cfg->vpd.vpd_ident, M_DEVBUF); cfg->vpd.vpd_ident = NULL; From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 22:35:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B1D6106564A; Wed, 29 Feb 2012 22:35:10 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A2C88FC08; Wed, 29 Feb 2012 22:35:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TMZ9AY048115; Wed, 29 Feb 2012 22:35:09 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TMZ9oe048113; Wed, 29 Feb 2012 22:35:09 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201202292235.q1TMZ9oe048113@svn.freebsd.org> From: Olivier Houchard Date: Wed, 29 Feb 2012 22:35: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: r232320 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 22:35:10 -0000 Author: cognet Date: Wed Feb 29 22:35:09 2012 New Revision: 232320 URL: http://svn.freebsd.org/changeset/base/232320 Log: Use srandom() to init the PRNG, not srand(), since we use random(). This is harmless because srandom() is called somewhere else, with time(NULL) as a seed, but this is more correct. Obtained from: https://bitbucket.org/mux/csup Pointyhat to: not mux, somebody else MFC after: 1 week Modified: head/usr.bin/csup/auth.c Modified: head/usr.bin/csup/auth.c ============================================================================== --- head/usr.bin/csup/auth.c Wed Feb 29 22:21:58 2012 (r232319) +++ head/usr.bin/csup/auth.c Wed Feb 29 22:35:09 2012 (r232320) @@ -293,7 +293,7 @@ auth_makechallenge(struct config *config gettimeofday(&tv, NULL); pid = getpid(); ppid = getppid(); - srand(tv.tv_usec ^ tv.tv_sec ^ pid); + srandom(tv.tv_usec ^ tv.tv_sec ^ pid); addrlen = sizeof(laddr); error = getsockname(config->socket, (struct sockaddr *)&laddr, &addrlen); if (error < 0) { From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 22:41:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61533106564A; Wed, 29 Feb 2012 22:41:41 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 506668FC12; Wed, 29 Feb 2012 22:41:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TMffJh048361; Wed, 29 Feb 2012 22:41:41 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TMffCk048359; Wed, 29 Feb 2012 22:41:41 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201202292241.q1TMffCk048359@svn.freebsd.org> From: Andrew Thompson Date: Wed, 29 Feb 2012 22:41: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: r232321 - 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: Wed, 29 Feb 2012 22:41:41 -0000 Author: thompsa Date: Wed Feb 29 22:41:40 2012 New Revision: 232321 URL: http://svn.freebsd.org/changeset/base/232321 Log: Correct the description for CTLFLAG_TUN and CTLFLAG_RDTUN, the declaring of a system tunable has never been implemented. This flag is only used by sysctl(8) to provide a helpful error message. Discussed with: dwhite, kan Modified: head/share/man/man9/sysctl.9 Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Wed Feb 29 22:35:09 2012 (r232320) +++ head/share/man/man9/sysctl.9 Wed Feb 29 22:41:40 2012 (r232321) @@ -138,9 +138,9 @@ This sysctl can be written to by process .It Dv CTLFLAG_SKIP When iterating the sysctl name space, do not list this sysctl. .It Dv CTLFLAG_TUN -Also declare a system tunable with the same name to initialize this variable. +Advisory flag that a system tunable also exists for this variable. .It Dv CTLFLAG_RDTUN -Also declare a system tunable with the same name to initialize this variable; +Advisory flag that a system tunable also exists for this variable; however, the run-time variable is read-only. .El .Pp From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 22:58:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 905311065672; Wed, 29 Feb 2012 22:58:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B9F48FC0A; Wed, 29 Feb 2012 22:58:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TMwqRp049001; Wed, 29 Feb 2012 22:58:52 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TMwqYk048993; Wed, 29 Feb 2012 22:58:52 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202292258.q1TMwqYk048993@svn.freebsd.org> From: Dimitry Andric Date: Wed, 29 Feb 2012 22:58: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: r232322 - in head: . gnu/usr.bin/cc/c++ gnu/usr.bin/cc/cc gnu/usr.bin/cc/cpp share/mk sys/conf tools/build/options usr.bin/clang/clang X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Feb 2012 22:58:52 -0000 Author: dim Date: Wed Feb 29 22:58:51 2012 New Revision: 232322 URL: http://svn.freebsd.org/changeset/base/232322 Log: Add a WITH_CLANG_IS_CC option for src.conf(5), disabled by default, that installs clang as /usr/bin/cc, /usr/bin/c++ and /usr/bin/cpp. Note this does *not* disable building and installing gcc, which will still be available as /usr/bin/gcc, /usr/bin/g++ and /usr/bin/gcpp. If you want to disable gcc completely, you must use WITHOUT_GCC. MFC after: 2 weeks Added: head/gnu/usr.bin/cc/cpp/gcpp.1 - copied unchanged from r232312, head/contrib/gcc/doc/cpp.1 head/tools/build/options/WITH_CLANG_IS_CC (contents, props changed) Modified: head/Makefile.inc1 head/gnu/usr.bin/cc/c++/Makefile head/gnu/usr.bin/cc/cc/Makefile head/gnu/usr.bin/cc/cpp/Makefile head/share/mk/bsd.own.mk head/share/mk/bsd.sys.mk head/sys/conf/kern.mk head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk head/usr.bin/clang/clang/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Feb 29 22:41:40 2012 (r232321) +++ head/Makefile.inc1 Wed Feb 29 22:58:51 2012 (r232322) @@ -1108,6 +1108,10 @@ _aicasm= sys/modules/aic7xxx/aicasm _share= share/syscons/scrnmaps .endif +.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") +_gcc_tools= gnu/usr.bin/cc/cc_tools +.endif + .if ${MK_KERBEROS} != "no" _kerberos5_tools= kerberos5/tools .endif @@ -1136,7 +1140,7 @@ build-tools: ${MAKE} DIRPRFX=${_tool}/ build-tools .endfor .for _tool in \ - gnu/usr.bin/cc/cc_tools \ + ${_gcc_tools} \ ${_kerberos5_tools} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ cd ${.CURDIR}/${_tool}; \ @@ -1166,14 +1170,12 @@ _kgzip= usr.sbin/kgzip _binutils= gnu/usr.bin/binutils .endif -.if ${MK_CLANG} != "no" -.if ${CC:T:Mclang} == "clang" +.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") _clang= usr.bin/clang _clang_libs= lib/clang .endif -.endif -.if ${MK_GCC} != "no" +.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") _cc= gnu/usr.bin/cc .endif Modified: head/gnu/usr.bin/cc/c++/Makefile ============================================================================== --- head/gnu/usr.bin/cc/c++/Makefile Wed Feb 29 22:41:40 2012 (r232321) +++ head/gnu/usr.bin/cc/c++/Makefile Wed Feb 29 22:58:51 2012 (r232322) @@ -1,14 +1,18 @@ # $FreeBSD$ +.include + .include "../Makefile.inc" .include "../Makefile.fe" .PATH: ${GCCDIR}/cp -PROG= c++ +PROG= g++ SRCS+= g++spec.c -LINKS= ${BINDIR}/c++ ${BINDIR}/g++ -LINKS+= ${BINDIR}/c++ ${BINDIR}/CC +.if ${MK_CLANG_IS_CC} == "no" +LINKS= ${BINDIR}/g++ ${BINDIR}/c++ +LINKS+= ${BINDIR}/g++ ${BINDIR}/CC +.endif NO_MAN= DPADD= ${LIBCPP} ${LIBIBERTY} Modified: head/gnu/usr.bin/cc/cc/Makefile ============================================================================== --- head/gnu/usr.bin/cc/cc/Makefile Wed Feb 29 22:41:40 2012 (r232321) +++ head/gnu/usr.bin/cc/cc/Makefile Wed Feb 29 22:58:51 2012 (r232322) @@ -1,15 +1,20 @@ # $FreeBSD$ +.include + .include "../Makefile.inc" .include "../Makefile.fe" -PROG= cc +PROG= gcc MAN= gcc.1 SRCS+= gccspec.c NO_SHARED?=yes -LINKS= ${BINDIR}/cc ${BINDIR}/gcc -MLINKS= gcc.1 cc.1 gcc.1 c++.1 gcc.1 g++.1 gcc.1 CC.1 +MLINKS= gcc.1 g++.1 +.if ${MK_CLANG_IS_CC} == "no" +LINKS= ${BINDIR}/gcc ${BINDIR}/cc +MLINKS+= gcc.1 cc.1 gcc.1 c++.1 gcc.1 CC.1 +.endif .include Modified: head/gnu/usr.bin/cc/cpp/Makefile ============================================================================== --- head/gnu/usr.bin/cc/cpp/Makefile Wed Feb 29 22:41:40 2012 (r232321) +++ head/gnu/usr.bin/cc/cpp/Makefile Wed Feb 29 22:58:51 2012 (r232322) @@ -1,10 +1,16 @@ # $FreeBSD$ +.include .include "../Makefile.inc" .include "../Makefile.fe" -PROG= cpp +PROG= gcpp SRCS+= cppspec.c +.if ${MK_CLANG_IS_CC} == "no" +LINKS= ${BINDIR}/gcpp ${BINDIR}/cpp +MLINKS= gcpp.1 cpp.1 +.endif + .include Copied: head/gnu/usr.bin/cc/cpp/gcpp.1 (from r232312, head/contrib/gcc/doc/cpp.1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/cc/cpp/gcpp.1 Wed Feb 29 22:58:51 2012 (r232322, copy of r232312, head/contrib/gcc/doc/cpp.1) @@ -0,0 +1,929 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "CPP 1" +.TH CPP 1 "2007-07-19" "gcc-4.2.1" "GNU" +.SH "NAME" +cpp \- The C Preprocessor +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +cpp [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR] + [\fB\-I\fR\fIdir\fR...] [\fB\-iquote\fR\fIdir\fR...] + [\fB\-W\fR\fIwarn\fR...] + [\fB\-M\fR|\fB\-MM\fR] [\fB\-MG\fR] [\fB\-MF\fR \fIfilename\fR] + [\fB\-MP\fR] [\fB\-MQ\fR \fItarget\fR...] + [\fB\-MT\fR \fItarget\fR...] + [\fB\-P\fR] [\fB\-fno\-working\-directory\fR] + [\fB\-x\fR \fIlanguage\fR] [\fB\-std=\fR\fIstandard\fR] + \fIinfile\fR \fIoutfile\fR +.PP +Only the most useful options are listed here; see below for the remainder. +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The C preprocessor, often known as \fIcpp\fR, is a \fImacro processor\fR +that is used automatically by the C compiler to transform your program +before compilation. It is called a macro processor because it allows +you to define \fImacros\fR, which are brief abbreviations for longer +constructs. +.PP +The C preprocessor is intended to be used only with C and \*(C+ source +code. In the past, it has been abused as a general text processor. It +will choke on input which does not obey C's lexical rules. For +example, apostrophes will be interpreted as the beginning of character +constants, and cause errors. Also, you cannot rely on it preserving +characteristics of the input which are not significant to C\-family +languages. If a Makefile is preprocessed, all the hard tabs will be +removed, and the Makefile will not work. +.PP +Having said that, you can often get away with using cpp on things which +are not C. Other Algol-ish programming languages are often safe +(Pascal, Ada, etc.) So is assembly, with caution. \fB\-traditional\-cpp\fR +mode preserves more white space, and is otherwise more permissive. Many +of the problems can be avoided by writing C or \*(C+ style comments +instead of native language comments, and keeping macros simple. +.PP +Wherever possible, you should use a preprocessor geared to the language +you are writing in. Modern versions of the \s-1GNU\s0 assembler have macro +facilities. Most high level programming languages have their own +conditional compilation and inclusion mechanism. If all else fails, +try a true general text processor, such as \s-1GNU\s0 M4. +.PP +C preprocessors vary in some details. This manual discusses the \s-1GNU\s0 C +preprocessor, which provides a small superset of the features of \s-1ISO\s0 +Standard C. In its default mode, the \s-1GNU\s0 C preprocessor does not do a +few things required by the standard. These are features which are +rarely, if ever, used, and may cause surprising changes to the meaning +of a program which does not expect them. To get strict \s-1ISO\s0 Standard C, +you should use the \fB\-std=c89\fR or \fB\-std=c99\fR options, depending +on which version of the standard you want. To get all the mandatory +diagnostics, you must also use \fB\-pedantic\fR. +.PP +This manual describes the behavior of the \s-1ISO\s0 preprocessor. To +minimize gratuitous differences, where the \s-1ISO\s0 preprocessor's +behavior does not conflict with traditional semantics, the +traditional preprocessor should behave the same way. The various +differences that do exist are detailed in the section \fBTraditional +Mode\fR. +.PP +For clarity, unless noted otherwise, references to \fB\s-1CPP\s0\fR in this +manual refer to \s-1GNU\s0 \s-1CPP\s0. +.SH "OPTIONS" +.IX Header "OPTIONS" +The C preprocessor expects two file names as arguments, \fIinfile\fR and +\&\fIoutfile\fR. The preprocessor reads \fIinfile\fR together with any +other files it specifies with \fB#include\fR. All the output generated +by the combined input files is written in \fIoutfile\fR. +.PP +Either \fIinfile\fR or \fIoutfile\fR may be \fB\-\fR, which as +\&\fIinfile\fR means to read from standard input and as \fIoutfile\fR +means to write to standard output. Also, if either file is omitted, it +means the same as if \fB\-\fR had been specified for that file. +.PP +Unless otherwise noted, or the option ends in \fB=\fR, all options +which take an argument may have that argument appear either immediately +after the option, or with a space between option and argument: +\&\fB\-Ifoo\fR and \fB\-I foo\fR have the same effect. +.PP +Many options have multi-letter names; therefore multiple single-letter +options may \fInot\fR be grouped: \fB\-dM\fR is very different from +\&\fB\-d\ \-M\fR. +.IP "\fB\-D\fR \fIname\fR" 4 +.IX Item "-D name" +Predefine \fIname\fR as a macro, with definition \f(CW1\fR. +.IP "\fB\-D\fR \fIname\fR\fB=\fR\fIdefinition\fR" 4 +.IX Item "-D name=definition" +The contents of \fIdefinition\fR are tokenized and processed as if +they appeared during translation phase three in a \fB#define\fR +directive. In particular, the definition will be truncated by +embedded newline characters. +.Sp +If you are invoking the preprocessor from a shell or shell-like +program you may need to use the shell's quoting syntax to protect +characters such as spaces that have a meaning in the shell syntax. +.Sp +If you wish to define a function-like macro on the command line, write +its argument list with surrounding parentheses before the equals sign +(if any). Parentheses are meaningful to most shells, so you will need +to quote the option. With \fBsh\fR and \fBcsh\fR, +\&\fB\-D'\fR\fIname\fR\fB(\fR\fIargs...\fR\fB)=\fR\fIdefinition\fR\fB'\fR works. +.Sp +\&\fB\-D\fR and \fB\-U\fR options are processed in the order they +are given on the command line. All \fB\-imacros\fR \fIfile\fR and +\&\fB\-include\fR \fIfile\fR options are processed after all +\&\fB\-D\fR and \fB\-U\fR options. +.IP "\fB\-U\fR \fIname\fR" 4 +.IX Item "-U name" +Cancel any previous definition of \fIname\fR, either built in or +provided with a \fB\-D\fR option. +.IP "\fB\-undef\fR" 4 +.IX Item "-undef" +Do not predefine any system-specific or GCC-specific macros. The +standard predefined macros remain defined. +.IP "\fB\-I\fR \fIdir\fR" 4 +.IX Item "-I dir" +Add the directory \fIdir\fR to the list of directories to be searched +for header files. +.Sp +Directories named by \fB\-I\fR are searched before the standard +system include directories. If the directory \fIdir\fR is a standard +system include directory, the option is ignored to ensure that the +default search order for system directories and the special treatment +of system headers are not defeated +\&. +.IP "\fB\-o\fR \fIfile\fR" 4 +.IX Item "-o file" +Write output to \fIfile\fR. This is the same as specifying \fIfile\fR +as the second non-option argument to \fBcpp\fR. \fBgcc\fR has a +different interpretation of a second non-option argument, so you must +use \fB\-o\fR to specify the output file. +.IP "\fB\-Wall\fR" 4 +.IX Item "-Wall" +Turns on all optional warnings which are desirable for normal code. +At present this is \fB\-Wcomment\fR, \fB\-Wtrigraphs\fR, +\&\fB\-Wmultichar\fR and a warning about integer promotion causing a +change of sign in \f(CW\*(C`#if\*(C'\fR expressions. Note that many of the +preprocessor's warnings are on by default and have no options to +control them. +.IP "\fB\-Wcomment\fR" 4 +.IX Item "-Wcomment" +.PD 0 +.IP "\fB\-Wcomments\fR" 4 +.IX Item "-Wcomments" +.PD +Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR +comment, or whenever a backslash-newline appears in a \fB//\fR comment. +(Both forms have the same effect.) +.IP "\fB\-Wtrigraphs\fR" 4 +.IX Item "-Wtrigraphs" +Most trigraphs in comments cannot affect the meaning of the program. +However, a trigraph that would form an escaped newline (\fB??/\fR at +the end of a line) can, by changing where the comment begins or ends. +Therefore, only trigraphs that would form escaped newlines produce +warnings inside a comment. +.Sp +This option is implied by \fB\-Wall\fR. If \fB\-Wall\fR is not +given, this option is still enabled unless trigraphs are enabled. To +get trigraph conversion without warnings, but get the other +\&\fB\-Wall\fR warnings, use \fB\-trigraphs \-Wall \-Wno\-trigraphs\fR. +.IP "\fB\-Wtraditional\fR" 4 +.IX Item "-Wtraditional" +Warn about certain constructs that behave differently in traditional and +\&\s-1ISO\s0 C. Also warn about \s-1ISO\s0 C constructs that have no traditional C +equivalent, and problematic constructs which should be avoided. +.IP "\fB\-Wimport\fR" 4 +.IX Item "-Wimport" +Warn the first time \fB#import\fR is used. +.IP "\fB\-Wundef\fR" 4 +.IX Item "-Wundef" +Warn whenever an identifier which is not a macro is encountered in an +\&\fB#if\fR directive, outside of \fBdefined\fR. Such identifiers are +replaced with zero. +.IP "\fB\-Wunused\-macros\fR" 4 +.IX Item "-Wunused-macros" +Warn about macros defined in the main file that are unused. A macro +is \fIused\fR if it is expanded or tested for existence at least once. +The preprocessor will also warn if the macro has not been used at the +time it is redefined or undefined. +.Sp +Built-in macros, macros defined on the command line, and macros +defined in include files are not warned about. +.Sp +\&\fINote:\fR If a macro is actually used, but only used in skipped +conditional blocks, then \s-1CPP\s0 will report it as unused. To avoid the +warning in such a case, you might improve the scope of the macro's +definition by, for example, moving it into the first skipped block. +Alternatively, you could provide a dummy use with something like: +.Sp +.Vb 2 +\& #if defined the_macro_causing_the_warning +\& #endif +.Ve +.IP "\fB\-Wendif\-labels\fR" 4 +.IX Item "-Wendif-labels" +Warn whenever an \fB#else\fR or an \fB#endif\fR are followed by text. +This usually happens in code of the form +.Sp +.Vb 5 +\& #if FOO +\& ... +\& #else FOO +\& ... +\& #endif FOO +.Ve +.Sp +The second and third \f(CW\*(C`FOO\*(C'\fR should be in comments, but often are not +in older programs. This warning is on by default. +.IP "\fB\-Werror\fR" 4 +.IX Item "-Werror" +Make all warnings into hard errors. Source code which triggers warnings +will be rejected. +.IP "\fB\-Wsystem\-headers\fR" 4 +.IX Item "-Wsystem-headers" +Issue warnings for code in system headers. These are normally unhelpful +in finding bugs in your own code, therefore suppressed. If you are +responsible for the system library, you may want to see them. +.IP "\fB\-w\fR" 4 +.IX Item "-w" +Suppress all warnings, including those which \s-1GNU\s0 \s-1CPP\s0 issues by default. +.IP "\fB\-pedantic\fR" 4 +.IX Item "-pedantic" +Issue all the mandatory diagnostics listed in the C standard. Some of +them are left out by default, since they trigger frequently on harmless +code. +.IP "\fB\-pedantic\-errors\fR" 4 +.IX Item "-pedantic-errors" +Issue all the mandatory diagnostics, and make all mandatory diagnostics +into errors. This includes mandatory diagnostics that \s-1GCC\s0 issues +without \fB\-pedantic\fR but treats as warnings. +.IP "\fB\-M\fR" 4 +.IX Item "-M" +Instead of outputting the result of preprocessing, output a rule +suitable for \fBmake\fR describing the dependencies of the main +source file. The preprocessor outputs one \fBmake\fR rule containing +the object file name for that source file, a colon, and the names of all +the included files, including those coming from \fB\-include\fR or +\&\fB\-imacros\fR command line options. +.Sp +Unless specified explicitly (with \fB\-MT\fR or \fB\-MQ\fR), the +object file name consists of the basename of the source file with any +suffix replaced with object file suffix. If there are many included +files then the rule is split into several lines using \fB\e\fR\-newline. +The rule has no commands. +.Sp +This option does not suppress the preprocessor's debug output, such as +\&\fB\-dM\fR. To avoid mixing such debug output with the dependency +rules you should explicitly specify the dependency output file with +\&\fB\-MF\fR, or use an environment variable like +\&\fB\s-1DEPENDENCIES_OUTPUT\s0\fR. Debug output +will still be sent to the regular output stream as normal. +.Sp +Passing \fB\-M\fR to the driver implies \fB\-E\fR, and suppresses +warnings with an implicit \fB\-w\fR. +.IP "\fB\-MM\fR" 4 +.IX Item "-MM" +Like \fB\-M\fR but do not mention header files that are found in +system header directories, nor header files that are included, +directly or indirectly, from such a header. +.Sp +This implies that the choice of angle brackets or double quotes in an +\&\fB#include\fR directive does not in itself determine whether that +header will appear in \fB\-MM\fR dependency output. This is a +slight change in semantics from \s-1GCC\s0 versions 3.0 and earlier. +.IP "\fB\-MF\fR \fIfile\fR" 4 +.IX Item "-MF file" +When used with \fB\-M\fR or \fB\-MM\fR, specifies a +file to write the dependencies to. If no \fB\-MF\fR switch is given +the preprocessor sends the rules to the same place it would have sent +preprocessed output. +.Sp +When used with the driver options \fB\-MD\fR or \fB\-MMD\fR, +\&\fB\-MF\fR overrides the default dependency output file. +.IP "\fB\-MG\fR" 4 +.IX Item "-MG" +In conjunction with an option such as \fB\-M\fR requesting +dependency generation, \fB\-MG\fR assumes missing header files are +generated files and adds them to the dependency list without raising +an error. The dependency filename is taken directly from the +\&\f(CW\*(C`#include\*(C'\fR directive without prepending any path. \fB\-MG\fR +also suppresses preprocessed output, as a missing header file renders +this useless. +.Sp +This feature is used in automatic updating of makefiles. +.IP "\fB\-MP\fR" 4 +.IX Item "-MP" +This option instructs \s-1CPP\s0 to add a phony target for each dependency +other than the main file, causing each to depend on nothing. These +dummy rules work around errors \fBmake\fR gives if you remove header +files without updating the \fIMakefile\fR to match. +.Sp +This is typical output: +.Sp +.Vb 1 +\& test.o: test.c test.h +.Ve +.Sp +.Vb 1 +\& test.h: +.Ve +.IP "\fB\-MT\fR \fItarget\fR" 4 +.IX Item "-MT target" +Change the target of the rule emitted by dependency generation. By +default \s-1CPP\s0 takes the name of the main input file, including any path, +deletes any file suffix such as \fB.c\fR, and appends the platform's +usual object suffix. The result is the target. +.Sp +An \fB\-MT\fR option will set the target to be exactly the string you +specify. If you want multiple targets, you can specify them as a single +argument to \fB\-MT\fR, or use multiple \fB\-MT\fR options. +.Sp +For example, \fB\-MT\ '$(objpfx)foo.o'\fR might give +.Sp +.Vb 1 +\& $(objpfx)foo.o: foo.c +.Ve +.IP "\fB\-MQ\fR \fItarget\fR" 4 +.IX Item "-MQ target" +Same as \fB\-MT\fR, but it quotes any characters which are special to +Make. \fB\-MQ\ '$(objpfx)foo.o'\fR gives +.Sp +.Vb 1 +\& $$(objpfx)foo.o: foo.c +.Ve +.Sp +The default target is automatically quoted, as if it were given with +\&\fB\-MQ\fR. +.IP "\fB\-MD\fR" 4 +.IX Item "-MD" +\&\fB\-MD\fR is equivalent to \fB\-M \-MF\fR \fIfile\fR, except that +\&\fB\-E\fR is not implied. The driver determines \fIfile\fR based on +whether an \fB\-o\fR option is given. If it is, the driver uses its +argument but with a suffix of \fI.d\fR, otherwise it take the +basename of the input file and applies a \fI.d\fR suffix. +.Sp +If \fB\-MD\fR is used in conjunction with \fB\-E\fR, any +\&\fB\-o\fR switch is understood to specify the dependency output file, but if used without \fB\-E\fR, each \fB\-o\fR +is understood to specify a target object file. +.Sp +Since \fB\-E\fR is not implied, \fB\-MD\fR can be used to generate +a dependency output file as a side-effect of the compilation process. +.IP "\fB\-MMD\fR" 4 +.IX Item "-MMD" +Like \fB\-MD\fR except mention only user header files, not system +header files. +.IP "\fB\-x c\fR" 4 +.IX Item "-x c" +.PD 0 +.IP "\fB\-x c++\fR" 4 +.IX Item "-x c++" +.IP "\fB\-x assembler-with-cpp\fR" 4 +.IX Item "-x assembler-with-cpp" +.PD +Specify the source language: C, \*(C+, or assembly. This has nothing +to do with standards conformance or extensions; it merely selects which +base syntax to expect. If you give none of these options, cpp will +deduce the language from the extension of the source file: \&\fB.c\fR, +\fB.cc\fR, or \fB.S\fR. Some other common extensions for \*(C+ and +assembly are also recognized. If cpp does not recognize the extension, +it will treat the file as C; this is the most generic mode. +.Sp +\&\fINote:\fR Previous versions of cpp accepted a \fB\-lang\fR option +which selected both the language and the standards conformance level. +This option has been removed, because it conflicts with the \fB\-l\fR +option. +.IP "\fB\-std=\fR\fIstandard\fR" 4 +.IX Item "-std=standard" +.PD 0 +.IP "\fB\-ansi\fR" 4 +.IX Item "-ansi" +.PD +Specify the standard to which the code should conform. Currently \s-1CPP\s0 +knows about C and \*(C+ standards; others may be added in the future. +.Sp +\&\fIstandard\fR +may be one of: +.RS 4 +.ie n .IP """iso9899:1990""" 4 +.el .IP "\f(CWiso9899:1990\fR" 4 +.IX Item "iso9899:1990" +.PD 0 +.ie n .IP """c89""" 4 +.el .IP "\f(CWc89\fR" 4 +.IX Item "c89" +.PD +The \s-1ISO\s0 C standard from 1990. \fBc89\fR is the customary shorthand for +this version of the standard. +.Sp +The \fB\-ansi\fR option is equivalent to \fB\-std=c89\fR. +.ie n .IP """iso9899:199409""" 4 +.el .IP "\f(CWiso9899:199409\fR" 4 +.IX Item "iso9899:199409" +The 1990 C standard, as amended in 1994. +.ie n .IP """iso9899:1999""" 4 +.el .IP "\f(CWiso9899:1999\fR" 4 +.IX Item "iso9899:1999" +.PD 0 +.ie n .IP """c99""" 4 +.el .IP "\f(CWc99\fR" 4 +.IX Item "c99" +.ie n .IP """iso9899:199x""" 4 +.el .IP "\f(CWiso9899:199x\fR" 4 +.IX Item "iso9899:199x" +.ie n .IP """c9x""" 4 +.el .IP "\f(CWc9x\fR" 4 +.IX Item "c9x" +.PD +The revised \s-1ISO\s0 C standard, published in December 1999. Before +publication, this was known as C9X. +.ie n .IP """gnu89""" 4 +.el .IP "\f(CWgnu89\fR" 4 +.IX Item "gnu89" +The 1990 C standard plus \s-1GNU\s0 extensions. This is the default. +.ie n .IP """gnu99""" 4 +.el .IP "\f(CWgnu99\fR" 4 +.IX Item "gnu99" +.PD 0 +.ie n .IP """gnu9x""" 4 +.el .IP "\f(CWgnu9x\fR" 4 +.IX Item "gnu9x" +.PD +The 1999 C standard plus \s-1GNU\s0 extensions. +.ie n .IP """c++98""" 4 +.el .IP "\f(CWc++98\fR" 4 +.IX Item "c++98" +The 1998 \s-1ISO\s0 \*(C+ standard plus amendments. +.ie n .IP """gnu++98""" 4 +.el .IP "\f(CWgnu++98\fR" 4 +.IX Item "gnu++98" +The same as \fB\-std=c++98\fR plus \s-1GNU\s0 extensions. This is the +default for \*(C+ code. +.RE +.RS 4 +.RE +.IP "\fB\-I\-\fR" 4 +.IX Item "-I-" +Split the include path. Any directories specified with \fB\-I\fR +options before \fB\-I\-\fR are searched only for headers requested with +\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for +\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR. If additional directories are +specified with \fB\-I\fR options after the \fB\-I\-\fR, those +directories are searched for all \fB#include\fR directives. +.Sp +In addition, \fB\-I\-\fR inhibits the use of the directory of the current +file directory as the first search directory for \f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR. +.Sp +This option has been deprecated. +.IP "\fB\-nostdinc\fR" 4 +.IX Item "-nostdinc" +Do not search the standard system directories for header files. +Only the directories you have specified with \fB\-I\fR options +(and the directory of the current file, if appropriate) are searched. +.IP "\fB\-nostdinc++\fR" 4 +.IX Item "-nostdinc++" +Do not search for header files in the \*(C+\-specific standard directories, +but do still search the other standard directories. (This option is +used when building the \*(C+ library.) +.IP "\fB\-include\fR \fIfile\fR" 4 +.IX Item "-include file" +Process \fIfile\fR as if \f(CW\*(C`#include "file"\*(C'\fR appeared as the first +line of the primary source file. However, the first directory searched +for \fIfile\fR is the preprocessor's working directory \fIinstead of\fR +the directory containing the main source file. If not found there, it +is searched for in the remainder of the \f(CW\*(C`#include "..."\*(C'\fR search +chain as normal. +.Sp +If multiple \fB\-include\fR options are given, the files are included +in the order they appear on the command line. +.IP "\fB\-imacros\fR \fIfile\fR" 4 +.IX Item "-imacros file" +Exactly like \fB\-include\fR, except that any output produced by +scanning \fIfile\fR is thrown away. Macros it defines remain defined. +This allows you to acquire all the macros from a header without also +processing its declarations. +.Sp +All files specified by \fB\-imacros\fR are processed before all files +specified by \fB\-include\fR. +.IP "\fB\-idirafter\fR \fIdir\fR" 4 +.IX Item "-idirafter dir" +Search \fIdir\fR for header files, but do it \fIafter\fR all +directories specified with \fB\-I\fR and the standard system directories +have been exhausted. \fIdir\fR is treated as a system include directory. +.IP "\fB\-iprefix\fR \fIprefix\fR" 4 +.IX Item "-iprefix prefix" +Specify \fIprefix\fR as the prefix for subsequent \fB\-iwithprefix\fR +options. If the prefix represents a directory, you should include the +final \fB/\fR. +.IP "\fB\-iwithprefix\fR \fIdir\fR" 4 +.IX Item "-iwithprefix dir" +.PD 0 +.IP "\fB\-iwithprefixbefore\fR \fIdir\fR" 4 +.IX Item "-iwithprefixbefore dir" +.PD +Append \fIdir\fR to the prefix specified previously with +\&\fB\-iprefix\fR, and add the resulting directory to the include search +path. \fB\-iwithprefixbefore\fR puts it in the same place \fB\-I\fR +would; \fB\-iwithprefix\fR puts it where \fB\-idirafter\fR would. +.IP "\fB\-isysroot\fR \fIdir\fR" 4 +.IX Item "-isysroot dir" +This option is like the \fB\-\-sysroot\fR option, but applies only to +header files. See the \fB\-\-sysroot\fR option for more information. +.IP "\fB\-imultilib\fR \fIdir\fR" 4 +.IX Item "-imultilib dir" +Use \fIdir\fR as a subdirectory of the directory containing +target-specific \*(C+ headers. +.IP "\fB\-isystem\fR \fIdir\fR" 4 +.IX Item "-isystem dir" +Search \fIdir\fR for header files, after all directories specified by +\&\fB\-I\fR but before the standard system directories. Mark it +as a system directory, so that it gets the same special treatment as +is applied to the standard system directories. +.IP "\fB\-iquote\fR \fIdir\fR" 4 +.IX Item "-iquote dir" +Search \fIdir\fR only for header files requested with +\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for +\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR, before all directories specified by +\&\fB\-I\fR and before the standard system directories. +.IP "\fB\-fdollars\-in\-identifiers\fR" 4 +.IX Item "-fdollars-in-identifiers" +Accept \fB$\fR in identifiers. +.IP "\fB\-fextended\-identifiers\fR" 4 +.IX Item "-fextended-identifiers" +Accept universal character names in identifiers. This option is +experimental; in a future version of \s-1GCC\s0, it will be enabled by +default for C99 and \*(C+. +.IP "\fB\-fpreprocessed\fR" 4 +.IX Item "-fpreprocessed" +Indicate to the preprocessor that the input file has already been +preprocessed. This suppresses things like macro expansion, trigraph +conversion, escaped newline splicing, and processing of most directives. +The preprocessor still recognizes and removes comments, so that you can +pass a file preprocessed with \fB\-C\fR to the compiler without +problems. In this mode the integrated preprocessor is little more than +a tokenizer for the front ends. +.Sp +\&\fB\-fpreprocessed\fR is implicit if the input file has one of the +extensions \fB.i\fR, \fB.ii\fR or \fB.mi\fR. These are the +extensions that \s-1GCC\s0 uses for preprocessed files created by +\&\fB\-save\-temps\fR. +.IP "\fB\-ftabstop=\fR\fIwidth\fR" 4 +.IX Item "-ftabstop=width" +Set the distance between tab stops. This helps the preprocessor report +correct column numbers in warnings or errors, even if tabs appear on the +line. If the value is less than 1 or greater than 100, the option is +ignored. The default is 8. +.IP "\fB\-fexec\-charset=\fR\fIcharset\fR" 4 +.IX Item "-fexec-charset=charset" +Set the execution character set, used for string and character +constants. The default is \s-1UTF\-8\s0. \fIcharset\fR can be any encoding +supported by the system's \f(CW\*(C`iconv\*(C'\fR library routine. +.IP "\fB\-fwide\-exec\-charset=\fR\fIcharset\fR" 4 +.IX Item "-fwide-exec-charset=charset" +Set the wide execution character set, used for wide string and +character constants. The default is \s-1UTF\-32\s0 or \s-1UTF\-16\s0, whichever +corresponds to the width of \f(CW\*(C`wchar_t\*(C'\fR. As with +\&\fB\-fexec\-charset\fR, \fIcharset\fR can be any encoding supported +by the system's \f(CW\*(C`iconv\*(C'\fR library routine; however, you will have +problems with encodings that do not fit exactly in \f(CW\*(C`wchar_t\*(C'\fR. +.IP "\fB\-finput\-charset=\fR\fIcharset\fR" 4 +.IX Item "-finput-charset=charset" +Set the input character set, used for translation from the character +set of the input file to the source character set used by \s-1GCC\s0. If the +locale does not specify, or \s-1GCC\s0 cannot get this information from the +locale, the default is \s-1UTF\-8\s0. This can be overridden by either the locale +or this command line option. Currently the command line option takes +precedence if there's a conflict. \fIcharset\fR can be any encoding +supported by the system's \f(CW\*(C`iconv\*(C'\fR library routine. +.IP "\fB\-fworking\-directory\fR" 4 +.IX Item "-fworking-directory" +Enable generation of linemarkers in the preprocessor output that will +let the compiler know the current working directory at the time of +preprocessing. When this option is enabled, the preprocessor will +emit, after the initial linemarker, a second linemarker with the +current working directory followed by two slashes. \s-1GCC\s0 will use this +directory, when it's present in the preprocessed input, as the +directory emitted as the current working directory in some debugging +information formats. This option is implicitly enabled if debugging +information is enabled, but this can be inhibited with the negated +form \fB\-fno\-working\-directory\fR. If the \fB\-P\fR flag is +present in the command line, this option has no effect, since no +\&\f(CW\*(C`#line\*(C'\fR directives are emitted whatsoever. +.IP "\fB\-fno\-show\-column\fR" 4 +.IX Item "-fno-show-column" +Do not print column numbers in diagnostics. This may be necessary if +diagnostics are being scanned by a program that does not understand the +column numbers, such as \fBdejagnu\fR. +.IP "\fB\-A\fR \fIpredicate\fR\fB=\fR\fIanswer\fR" 4 +.IX Item "-A predicate=answer" +Make an assertion with the predicate \fIpredicate\fR and answer +\&\fIanswer\fR. This form is preferred to the older form \fB\-A\fR +\&\fIpredicate\fR\fB(\fR\fIanswer\fR\fB)\fR, which is still supported, because +it does not use shell special characters. +.IP "\fB\-A \-\fR\fIpredicate\fR\fB=\fR\fIanswer\fR" 4 +.IX Item "-A -predicate=answer" +Cancel an assertion with the predicate \fIpredicate\fR and answer +\&\fIanswer\fR. +.IP "\fB\-dCHARS\fR" 4 +.IX Item "-dCHARS" +\&\fI\s-1CHARS\s0\fR is a sequence of one or more of the following characters, +and must not be preceded by a space. Other characters are interpreted +by the compiler proper, or reserved for future versions of \s-1GCC\s0, and so +are silently ignored. If you specify characters whose behavior +conflicts, the result is undefined. +.RS 4 +.IP "\fBM\fR" 4 +.IX Item "M" +Instead of the normal output, generate a list of \fB#define\fR +directives for all the macros defined during the execution of the +preprocessor, including predefined macros. This gives you a way of +finding out what is predefined in your version of the preprocessor. +Assuming you have no file \fIfoo.h\fR, the command +.Sp +.Vb 1 +\& touch foo.h; cpp -dM foo.h +.Ve +.Sp +will show all the predefined macros. +.IP "\fBD\fR" 4 +.IX Item "D" +Like \fBM\fR except in two respects: it does \fInot\fR include the +predefined macros, and it outputs \fIboth\fR the \fB#define\fR +directives and the result of preprocessing. Both kinds of output go to +the standard output file. +.IP "\fBN\fR" 4 +.IX Item "N" +Like \fBD\fR, but emit only the macro names, not their expansions. +.IP "\fBI\fR" 4 +.IX Item "I" +Output \fB#include\fR directives in addition to the result of +preprocessing. +.RE +.RS 4 +.RE +.IP "\fB\-P\fR" 4 +.IX Item "-P" +Inhibit generation of linemarkers in the output from the preprocessor. +This might be useful when running the preprocessor on something that is +not C code, and will be sent to a program which might be confused by the +linemarkers. +.IP "\fB\-C\fR" 4 +.IX Item "-C" +Do not discard comments. All comments are passed through to the output +file, except for comments in processed directives, which are deleted +along with the directive. +.Sp +You should be prepared for side effects when using \fB\-C\fR; it +causes the preprocessor to treat comments as tokens in their own right. +For example, comments appearing at the start of what would be a +directive line have the effect of turning that line into an ordinary +source line, since the first token on the line is no longer a \fB#\fR. +.IP "\fB\-CC\fR" 4 +.IX Item "-CC" +Do not discard comments, including during macro expansion. This is +like \fB\-C\fR, except that comments contained within macros are +also passed through to the output file where the macro is expanded. +.Sp +In addition to the side-effects of the \fB\-C\fR option, the +\&\fB\-CC\fR option causes all \*(C+\-style comments inside a macro +to be converted to C\-style comments. This is to prevent later use +of that macro from inadvertently commenting out the remainder of +the source line. +.Sp +The \fB\-CC\fR option is generally used to support lint comments. +.IP "\fB\-traditional\-cpp\fR" 4 +.IX Item "-traditional-cpp" +Try to imitate the behavior of old-fashioned C preprocessors, as +opposed to \s-1ISO\s0 C preprocessors. +.IP "\fB\-trigraphs\fR" 4 +.IX Item "-trigraphs" +Process trigraph sequences. +.IP "\fB\-remap\fR" 4 +.IX Item "-remap" +Enable special code to work around file systems which only permit very +short file names, such as \s-1MS\-DOS\s0. +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +.PD 0 +.IP "\fB\-\-target\-help\fR" 4 +.IX Item "--target-help" +.PD +Print text describing all the command line options instead of +preprocessing anything. +.IP "\fB\-v\fR" 4 +.IX Item "-v" +Verbose mode. Print out \s-1GNU\s0 \s-1CPP\s0's version number at the beginning of +execution, and report the final form of the include path. +.IP "\fB\-H\fR" 4 +.IX Item "-H" +Print the name of each header file used, in addition to other normal +activities. Each name is indented to show how deep in the +\&\fB#include\fR stack it is. Precompiled header files are also +printed, even if they are found to be invalid; an invalid precompiled +header file is printed with \fB...x\fR and a valid one with \fB...!\fR . +.IP "\fB\-version\fR" 4 +.IX Item "-version" +.PD 0 +.IP "\fB\-\-version\fR" 4 +.IX Item "--version" +.PD +Print out \s-1GNU\s0 \s-1CPP\s0's version number. With one dash, proceed to +preprocess as normal. With two dashes, exit immediately. +.SH "ENVIRONMENT" +.IX Header "ENVIRONMENT" +This section describes the environment variables that affect how \s-1CPP\s0 +operates. You can use them to specify directories or prefixes to use +when searching for include files, or to control dependency output. +.PP +Note that you can also specify places to search using options such as +\&\fB\-I\fR, and control dependency output with options like +\&\fB\-M\fR. These take precedence over +environment variables, which in turn take precedence over the +configuration of \s-1GCC\s0. +.IP "\fB\s-1CPATH\s0\fR" 4 +.IX Item "CPATH" +.PD 0 +.IP "\fBC_INCLUDE_PATH\fR" 4 +.IX Item "C_INCLUDE_PATH" +.IP "\fB\s-1CPLUS_INCLUDE_PATH\s0\fR" 4 +.IX Item "CPLUS_INCLUDE_PATH" +.PD +Each variable's value is a list of directories separated by a special +character, much like \fB\s-1PATH\s0\fR, in which to look for header files. +The special character, \f(CW\*(C`PATH_SEPARATOR\*(C'\fR, is target-dependent and +determined at \s-1GCC\s0 build time. For Microsoft Windows-based targets it is a +semicolon, and for almost all other targets it is a colon. +.Sp +\&\fB\s-1CPATH\s0\fR specifies a list of directories to be searched as if +specified with \fB\-I\fR, but after any paths given with \fB\-I\fR +options on the command line. This environment variable is used +regardless of which language is being preprocessed. +.Sp +The remaining environment variables apply only when preprocessing the +particular language indicated. Each specifies a list of directories +to be searched as if specified with \fB\-isystem\fR, but after any +paths given with \fB\-isystem\fR options on the command line. +.Sp +In all these variables, an empty element instructs the compiler to +search its current working directory. Empty elements can appear at the +beginning or end of a path. For instance, if the value of +\&\fB\s-1CPATH\s0\fR is \f(CW\*(C`:/special/include\*(C'\fR, that has the same +effect as \fB\-I.\ \-I/special/include\fR. +.IP "\fB\s-1DEPENDENCIES_OUTPUT\s0\fR" 4 +.IX Item "DEPENDENCIES_OUTPUT" +If this variable is set, its value specifies how to output +dependencies for Make based on the non-system header files processed +by the compiler. System header files are ignored in the dependency +output. +.Sp +The value of \fB\s-1DEPENDENCIES_OUTPUT\s0\fR can be just a file name, in +which case the Make rules are written to that file, guessing the target +name from the source file name. Or the value can have the form +\&\fIfile\fR\fB \fR\fItarget\fR, in which case the rules are written to +file \fIfile\fR using \fItarget\fR as the target name. +.Sp *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 23:06:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D45CF106566B; Wed, 29 Feb 2012 23:06:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C37AB8FC08; Wed, 29 Feb 2012 23:06:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1TN6mii049322; Wed, 29 Feb 2012 23:06:48 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1TN6mXc049320; Wed, 29 Feb 2012 23:06:48 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201202292306.q1TN6mXc049320@svn.freebsd.org> From: Dimitry Andric Date: Wed, 29 Feb 2012 23:06: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: r232323 - 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: Wed, 29 Feb 2012 23:06:50 -0000 Author: dim Date: Wed Feb 29 23:06:48 2012 New Revision: 232323 URL: http://svn.freebsd.org/changeset/base/232323 Log: Regenerate src.conf(5) after r232322. MFC after: 2 weeks Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Feb 29 22:58:51 2012 (r232322) +++ head/share/man/man5/src.conf.5 Wed Feb 29 23:06:48 2012 (r232323) @@ -276,6 +276,8 @@ When set, it also enforces the following .Bl -item -compact .It .Va WITHOUT_CLANG_EXTRAS +.It +.Va WITHOUT_CLANG_IS_CC .El .It Va WITH_CLANG .\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru @@ -286,6 +288,15 @@ amd64/amd64, i386/i386, pc98/i386, power .It Va WITH_CLANG_EXTRAS .\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 23:56:22Z dim Set to build additional clang and llvm tools, such as bugpoint. +.It Va WITH_CLANG_IS_CC +.\" from FreeBSD: head/tools/build/options/WITH_CLANG_IS_CC 232322 2012-02-29 22:58:51Z dim +Set to install the Clang C/C++ compiler as +.Pa /usr/bin/cc +, +.Pa /usr/bin/c++ +and +.Pa /usr/bin/cpp +. .It Va WITHOUT_CPP .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru Set to not build @@ -342,6 +353,8 @@ When set, it also enforces the following .It .Va WITHOUT_CLANG .It +.Va WITHOUT_CLANG_IS_CC +.It .Va WITHOUT_GROFF .El .It Va WITHOUT_DICT @@ -948,6 +961,8 @@ When set, it also enforces the following .It .Va WITHOUT_CLANG .It +.Va WITHOUT_CLANG_IS_CC +.It .Va WITHOUT_GCC .It .Va WITHOUT_GDB From owner-svn-src-all@FreeBSD.ORG Wed Feb 29 23:44:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E424106564A; Wed, 29 Feb 2012 23:44:51 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id DB31D8FC13; Wed, 29 Feb 2012 23:44:50 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 05FFB25D385E; Wed, 29 Feb 2012 23:44:49 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 2972ABDC6CA; Wed, 29 Feb 2012 23:44:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id HGBbOlS7dpPb; Wed, 29 Feb 2012 23:44:48 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 0CAB9BDC6C8; Wed, 29 Feb 2012 23:44:47 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201202292138.q1TLcVFv046104@svn.freebsd.org> Date: Wed, 29 Feb 2012 23:44:47 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <14D2BDEC-B9C7-4B2D-AF2C-60598CCE1EBF@lists.zabbadoz.net> References: <201202292138.q1TLcVFv046104@svn.freebsd.org> To: Mikolaj Golub , John Baldwin , Konstantin Belousov X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232317 - in head: . 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: Wed, 29 Feb 2012 23:44:51 -0000 On 29. Feb 2012, at 21:38 , Mikolaj Golub wrote: > Author: trociny > Date: Wed Feb 29 21:38:31 2012 > New Revision: 232317 > URL: http://svn.freebsd.org/changeset/base/232317 >=20 > Log: > Introduce VOP_UNP_BIND(), VOP_UNP_CONNECT(), and VOP_UNP_DETACH() > operations for setting and accessing vnode's v_socket field. >=20 > The operations are necessary to implement proper unix socket handling > on layered file systems like nullfs(5). >=20 > This change fixes the long standing issue with nullfs(5) being in = that > unix sockets did not work between lower and upper layers: if we bound > to a socket on the lower layer we could connect only to the lower > path; if we bound to the upper layer we could connect only to the > upper path. The new behavior is one can connect to both the lower and > the upper paths regardless what layer path one binds to. At this point I wonder if jhb has added (enough) spares with an earlier = MFC of another change or whether we'll break thing again? >=20 > PR: kern/51583, kern/159663 > Suggested by: kib > Reviewed by: arch > MFC after: 2 weeks --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 00:22:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ACB6A106566C; Thu, 1 Mar 2012 00:22:52 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B48C8FC19; Thu, 1 Mar 2012 00:22:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q210MqeL051820; Thu, 1 Mar 2012 00:22:52 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q210Mqb4051818; Thu, 1 Mar 2012 00:22:52 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201203010022.q210Mqb4051818@svn.freebsd.org> From: Justin Hibbits Date: Thu, 1 Mar 2012 00:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232324 - stable/9/sys/modules/scc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 00:22:52 -0000 Author: jhibbits Date: Thu Mar 1 00:22:52 2012 New Revision: 232324 URL: http://svn.freebsd.org/changeset/base/232324 Log: MFC r232176: Fix the scc(4) module build. Without the file it's missing a required symbol. Approved by: nwhitehorn (mentor) Modified: stable/9/sys/modules/scc/Makefile Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/modules/scc/Makefile ============================================================================== --- stable/9/sys/modules/scc/Makefile Wed Feb 29 23:06:48 2012 (r232323) +++ stable/9/sys/modules/scc/Makefile Thu Mar 1 00:22:52 2012 (r232324) @@ -6,7 +6,7 @@ scc_bfe= scc_bfe_ebus.c scc_bfe_sbus.c .endif .if ${MACHINE_CPUARCH} == "powerpc" -scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c +scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c scc_dev_quicc.c .endif KMOD= scc From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 03:53:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE1D7106566B; Thu, 1 Mar 2012 03:53:08 +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 849898FC0A; Thu, 1 Mar 2012 03:53:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q213r8NQ059225; Thu, 1 Mar 2012 03:53:08 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q213r8YQ059222; Thu, 1 Mar 2012 03:53:08 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201203010353.q213r8YQ059222@svn.freebsd.org> From: Rick Macklem Date: Thu, 1 Mar 2012 03:53: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: r232327 - 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: Thu, 01 Mar 2012 03:53:08 -0000 Author: rmacklem Date: Thu Mar 1 03:53:07 2012 New Revision: 232327 URL: http://svn.freebsd.org/changeset/base/232327 Log: Fix the NFS clients so that they use copyin() instead of bcopy(), when doing direct I/O. This direct I/O code is not enabled by default. Submitted by: kib (earlier version) Reviewed by: kib MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/nfsclient/nfs_bio.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Thu Mar 1 00:54:08 2012 (r232326) +++ head/sys/fs/nfsclient/nfs_clbio.c Thu Mar 1 03:53:07 2012 (r232327) @@ -820,7 +820,21 @@ do_sync: t_uio->uio_segflg = UIO_SYSSPACE; t_uio->uio_rw = UIO_WRITE; t_uio->uio_td = td; - bcopy(uiop->uio_iov->iov_base, t_iov->iov_base, size); + KASSERT(uiop->uio_segflg == UIO_USERSPACE || + uiop->uio_segflg == UIO_SYSSPACE, + ("nfs_directio_write: Bad uio_segflg")); + if (uiop->uio_segflg == UIO_USERSPACE) { + error = copyin(uiop->uio_iov->iov_base, + t_iov->iov_base, size); + if (error != 0) + goto err_free; + } else + /* + * UIO_SYSSPACE may never happen, but handle + * it just in case it does. + */ + bcopy(uiop->uio_iov->iov_base, t_iov->iov_base, + size); bp->b_flags |= B_DIRECT; bp->b_iocmd = BIO_WRITE; if (cred != NOCRED) { @@ -831,6 +845,7 @@ do_sync: bp->b_caller1 = (void *)t_uio; bp->b_vp = vp; error = ncl_asyncio(nmp, bp, NOCRED, td); +err_free: if (error) { free(t_iov->iov_base, M_NFSDIRECTIO); free(t_iov, M_NFSDIRECTIO); Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Thu Mar 1 00:54:08 2012 (r232326) +++ head/sys/nfsclient/nfs_bio.c Thu Mar 1 03:53:07 2012 (r232327) @@ -814,7 +814,21 @@ do_sync: t_uio->uio_segflg = UIO_SYSSPACE; t_uio->uio_rw = UIO_WRITE; t_uio->uio_td = td; - bcopy(uiop->uio_iov->iov_base, t_iov->iov_base, size); + KASSERT(uiop->uio_segflg == UIO_USERSPACE || + uiop->uio_segflg == UIO_SYSSPACE, + ("nfs_directio_write: Bad uio_segflg")); + if (uiop->uio_segflg == UIO_USERSPACE) { + error = copyin(uiop->uio_iov->iov_base, + t_iov->iov_base, size); + if (error != 0) + goto err_free; + } else + /* + * UIO_SYSSPACE may never happen, but handle + * it just in case it does. + */ + bcopy(uiop->uio_iov->iov_base, t_iov->iov_base, + size); bp->b_flags |= B_DIRECT; bp->b_iocmd = BIO_WRITE; if (cred != NOCRED) { @@ -825,6 +839,7 @@ do_sync: bp->b_caller1 = (void *)t_uio; bp->b_vp = vp; error = nfs_asyncio(nmp, bp, NOCRED, td); +err_free: if (error) { free(t_iov->iov_base, M_NFSDIRECTIO); free(t_iov, M_NFSDIRECTIO); From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 06:38:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9CCA1065673; Thu, 1 Mar 2012 06:38:02 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id A3C568FC15; Thu, 1 Mar 2012 06:38:01 +0000 (UTC) Received: by eekd17 with SMTP id d17so69153eek.13 for ; Wed, 29 Feb 2012 22:38:00 -0800 (PST) Received-SPF: pass (google.com: domain of to.my.trociny@gmail.com designates 10.14.193.134 as permitted sender) client-ip=10.14.193.134; Authentication-Results: mr.google.com; spf=pass (google.com: domain of to.my.trociny@gmail.com designates 10.14.193.134 as permitted sender) smtp.mail=to.my.trociny@gmail.com; dkim=pass header.i=to.my.trociny@gmail.com Received: from mr.google.com ([10.14.193.134]) by 10.14.193.134 with SMTP id k6mr2166575een.114.1330583880824 (num_hops = 1); Wed, 29 Feb 2012 22:38:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=iCrD0/H0VObRN9GzUkWDYfQM7jUt7TdcOvDVI2CNLU4=; b=X1C268VzpmJjXsh67f8G/qF+qIAQw39RaqYj6JWRDmjsC29SCFXaGA+UyOA+BJPqvD /LhNXRniILvdUk3+Q8XZo/k0MpmT7aIiuPiKuXyZKPvVo3cWeR9R7S1obuMe7z751jQs BgIsJjL7wIjytpjDqOap5EBdJeMpe21KMGdo4= Received: by 10.14.193.134 with SMTP id k6mr1664066een.114.1330583880731; Wed, 29 Feb 2012 22:38:00 -0800 (PST) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id w60sm3744461eeb.4.2012.02.29.22.37.58 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Feb 2012 22:37:59 -0800 (PST) From: Mikolaj Golub To: "Bjoern A. Zeeb" Organization: TOA Ukraine References: <201202292138.q1TLcVFv046104@svn.freebsd.org> <14D2BDEC-B9C7-4B2D-AF2C-60598CCE1EBF@lists.zabbadoz.net> Sender: Mikolaj Golub Date: Thu, 01 Mar 2012 08:37:56 +0200 In-Reply-To: <14D2BDEC-B9C7-4B2D-AF2C-60598CCE1EBF@lists.zabbadoz.net> (Bjoern A. Zeeb's message of "Wed, 29 Feb 2012 23:44:47 +0000") Message-ID: <86ty28aksb.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , John Baldwin Subject: Re: svn commit: r232317 - in head: . 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, 01 Mar 2012 06:38:03 -0000 On Wed, 29 Feb 2012 23:44:47 +0000 Bjoern A. Zeeb wrote: BAZ> On 29. Feb 2012, at 21:38 , Mikolaj Golub wrote: >> Author: trociny >> Date: Wed Feb 29 21:38:31 2012 >> New Revision: 232317 >> URL: http://svn.freebsd.org/changeset/base/232317 >> >> Log: >> Introduce VOP_UNP_BIND(), VOP_UNP_CONNECT(), and VOP_UNP_DETACH() >> operations for setting and accessing vnode's v_socket field. >> >> The operations are necessary to implement proper unix socket handling >> on layered file systems like nullfs(5). >> >> This change fixes the long standing issue with nullfs(5) being in that >> unix sockets did not work between lower and upper layers: if we bound >> to a socket on the lower layer we could connect only to the lower >> path; if we bound to the upper layer we could connect only to the >> upper path. The new behavior is one can connect to both the lower and >> the upper paths regardless what layer path one binds to. BAZ> At this point I wonder if jhb has added (enough) spares with an earlier MFC of another change or whether we'll break thing again? That is why I asked about this on arch@ and was waiting several days for people opinion :-). The response I had was: do MFC if jhb does not have any plans for the vop spares (and he does not). I can change "MFC after" to 2 months or undef, and I will be fine with any other solution proposed. >> >> PR: kern/51583, kern/159663 >> Suggested by: kib >> Reviewed by: arch >> MFC after: 2 weeks BAZ> -- BAZ> Bjoern A. Zeeb You have to have visions! BAZ> It does not matter how good you are. It matters what good you do! -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 07:21:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B7901106566C for ; Thu, 1 Mar 2012 07:21:28 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4002B8FC14 for ; Thu, 1 Mar 2012 07:21:27 +0000 (UTC) Received: by bkcjc3 with SMTP id jc3so249942bkc.13 for ; Wed, 29 Feb 2012 23:21:26 -0800 (PST) Received-SPF: pass (google.com: domain of andrey@zonov.org designates 10.204.136.219 as permitted sender) client-ip=10.204.136.219; Authentication-Results: mr.google.com; spf=pass (google.com: domain of andrey@zonov.org designates 10.204.136.219 as permitted sender) smtp.mail=andrey@zonov.org Received: from mr.google.com ([10.204.136.219]) by 10.204.136.219 with SMTP id s27mr1904810bkt.116.1330586486431 (num_hops = 1); Wed, 29 Feb 2012 23:21:26 -0800 (PST) Received: by 10.204.136.219 with SMTP id s27mr1532360bkt.116.1330586486184; Wed, 29 Feb 2012 23:21:26 -0800 (PST) Received: from [10.254.254.77] (ppp95-165-130-131.pppoe.spdop.ru. [95.165.130.131]) by mx.google.com with ESMTPS id w15sm1613768bku.0.2012.02.29.23.21.25 (version=SSLv3 cipher=OTHER); Wed, 29 Feb 2012 23:21:25 -0800 (PST) Message-ID: <4F4F2375.3080209@zonov.org> Date: Thu, 01 Mar 2012 11:21:25 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Andrew Thompson References: <201202292241.q1TMffCk048359@svn.freebsd.org> In-Reply-To: <201202292241.q1TMffCk048359@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlWaMC3QMX0fJg59H9Z5n/fvSL+tN4Gox0aPL3JHmPSFHc09LP/R7FAkzSGox5WKtZHhZ7s Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232321 - 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, 01 Mar 2012 07:21:28 -0000 On 01.03.2012 2:41, Andrew Thompson wrote: > Author: thompsa > Date: Wed Feb 29 22:41:40 2012 > New Revision: 232321 > URL: http://svn.freebsd.org/changeset/base/232321 > > Log: > Correct the description for CTLFLAG_TUN and CTLFLAG_RDTUN, the declaring of a > system tunable has never been implemented. This flag is only used by sysctl(8) > to provide a helpful error message. > Thanks! I also think we should remove all CTLFLAG_TUN flags which are combination with CTLFLAG_RW. -- Andrey Zonov From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 08:23:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AB961065688; Thu, 1 Mar 2012 08:23:00 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D82F8FC14; Thu, 1 Mar 2012 08:23:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q218Mxaa068132; Thu, 1 Mar 2012 08:22:59 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q218MxMt068129; Thu, 1 Mar 2012 08:22:59 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201203010822.q218MxMt068129@svn.freebsd.org> From: Martin Matuska Date: Thu, 1 Mar 2012 08:22:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232328 - stable/9/cddl/contrib/opensolaris/cmd/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, 01 Mar 2012 08:23:00 -0000 Author: mm Date: Thu Mar 1 08:22:59 2012 New Revision: 232328 URL: http://svn.freebsd.org/changeset/base/232328 Log: MFC r232064: Import illumos changeset 13608 [1]: add support for "-t " argument to zfs get References: https://www.illumos.org/issues/1936 Update zfs(8) manpage in respect of [1]. Fix typo in zfs(8) manpage. Obtained from: illumos (issue #1936) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Mar 1 03:53:07 2012 (r232327) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Mar 1 08:22:59 2012 (r232328) @@ -1,5 +1,5 @@ '\" te -.\" Copyright (c) 2011, Martin Matuska . +.\" Copyright (c) 2012, Martin Matuska . .\" All Rights Reserved. .\" .\" The contents of this file are subject to the terms of the @@ -18,8 +18,8 @@ .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. .\" Copyright (c) 2011 by Delphix. All rights reserved. +.\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2011, Pawel Jakub Dawidek .\" .\" $FreeBSD$ @@ -113,6 +113,7 @@ .Op Fl r Ns | Ns Fl d Ar depth .Op Fl Hp .Op Fl o Ar all | field Ns Op , Ns Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... .Op Fl s Ar source Ns Op , Ns Ar ... .Ar all | property Ns Op , Ns Ar ... .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot @@ -1753,7 +1754,7 @@ A comma-separated list of types to displ is one of .Sy filesystem , snapshot , volume , No or Sy all . For example, specifying -.Fl o Cm snapshot +.Fl t Cm snapshot displays only snapshots. .It Fl s Ar property A property for sorting the output by column in ascending order based on the @@ -1811,6 +1812,7 @@ section. .Op Fl r Ns | Ns Fl d Ar depth .Op Fl Hp .Op Fl o Ar all | field Ns Op , Ns Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... .Op Fl s Ar source Ns Op , Ns Ar ... .Ar all | property Ns Op , Ns Ar ... .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot @@ -1871,6 +1873,14 @@ Default values are The keyword .Cm all specifies all columns. +.It Fl t Ar type Ns Op , Ns Ar ... +A comma-separated list of types to display, where +.Ar type +is one of +.Sy filesystem , snapshot , volume , No or Sy all . +For example, specifying +.Fl t Cm snapshot +displays only snapshots. .It Fl s Ar source Ns Op , Ns Ar ... A comma-separated list of sources to display. Those properties coming from a source other than those in this list are ignored. Each source must be one of Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Mar 1 03:53:07 2012 (r232327) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Mar 1 08:22:59 2012 (r232328) @@ -227,7 +227,8 @@ get_usage(zfs_help_t idx) "[%][,...]\n")); case HELP_GET: return (gettext("\tget [-rHp] [-d max] " - "[-o \"all\" | field[,...]] [-s source[,...]]\n" + "[-o \"all\" | field[,...]] [-t type[,...]] " + "[-s source[,...]]\n" "\t <\"all\" | property[,...]> " "[filesystem|volume|snapshot] ...\n")); case HELP_INHERIT: @@ -1473,6 +1474,7 @@ zfs_do_get(int argc, char **argv) { zprop_get_cbdata_t cb = { 0 }; int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS; + int types = ZFS_TYPE_DATASET; char *value, *fields; int ret = 0; int limit = 0; @@ -1489,7 +1491,7 @@ zfs_do_get(int argc, char **argv) cb.cb_type = ZFS_TYPE_DATASET; /* check options */ - while ((c = getopt(argc, argv, ":d:o:s:rHp")) != -1) { + while ((c = getopt(argc, argv, ":d:o:s:rt:Hp")) != -1) { switch (c) { case 'p': cb.cb_literal = B_TRUE; @@ -1607,6 +1609,37 @@ zfs_do_get(int argc, char **argv) } break; + case 't': + types = 0; + flags &= ~ZFS_ITER_PROP_LISTSNAPS; + while (*optarg != '\0') { + static char *type_subopts[] = { "filesystem", + "volume", "snapshot", "all", NULL }; + + switch (getsubopt(&optarg, type_subopts, + &value)) { + case 0: + types |= ZFS_TYPE_FILESYSTEM; + break; + case 1: + types |= ZFS_TYPE_VOLUME; + break; + case 2: + types |= ZFS_TYPE_SNAPSHOT; + break; + case 3: + types = ZFS_TYPE_DATASET; + break; + + default: + (void) fprintf(stderr, + gettext("invalid type '%s'\n"), + value); + usage(B_FALSE); + } + } + break; + case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -1650,7 +1683,7 @@ zfs_do_get(int argc, char **argv) cb.cb_first = B_TRUE; /* run for each object */ - ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_DATASET, NULL, + ret = zfs_for_each(argc, argv, flags, types, NULL, &cb.cb_proplist, limit, get_callback, &cb); if (cb.cb_proplist == &fake_name) From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 09:06:00 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C3961065672; Thu, 1 Mar 2012 09:06:00 +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 B54BF8FC0C; Thu, 1 Mar 2012 09:05:58 +0000 (UTC) Received: from porto.starpoint.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 LAA03304; Thu, 01 Mar 2012 11:05:55 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S31xT-000CKO-7O; Thu, 01 Mar 2012 11:05:55 +0200 Message-ID: <4F4F3BFB.5030104@FreeBSD.org> Date: Thu, 01 Mar 2012 11:06:03 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Andrey Zonov References: <201202292241.q1TMffCk048359@svn.freebsd.org> <4F4F2375.3080209@zonov.org> In-Reply-To: <4F4F2375.3080209@zonov.org> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andrew Thompson Subject: Re: svn commit: r232321 - 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, 01 Mar 2012 09:06:00 -0000 on 01/03/2012 09:21 Andrey Zonov said the following: > On 01.03.2012 2:41, Andrew Thompson wrote: >> Author: thompsa >> Date: Wed Feb 29 22:41:40 2012 >> New Revision: 232321 >> URL: http://svn.freebsd.org/changeset/base/232321 >> >> Log: >> Correct the description for CTLFLAG_TUN and CTLFLAG_RDTUN, the declaring of a >> system tunable has never been implemented. This flag is only used by sysctl(8) >> to provide a helpful error message. >> > > Thanks! > > I also think we should remove all CTLFLAG_TUN flags which are combination with > CTLFLAG_RW. Why? -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 09:11:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 944B71065677 for ; Thu, 1 Mar 2012 09:11:25 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1E7888FC17 for ; Thu, 1 Mar 2012 09:11:24 +0000 (UTC) Received: by wibhn6 with SMTP id hn6so262145wib.13 for ; Thu, 01 Mar 2012 01:11:24 -0800 (PST) Received-SPF: pass (google.com: domain of andrey@zonov.org designates 10.180.78.233 as permitted sender) client-ip=10.180.78.233; Authentication-Results: mr.google.com; spf=pass (google.com: domain of andrey@zonov.org designates 10.180.78.233 as permitted sender) smtp.mail=andrey@zonov.org Received: from mr.google.com ([10.180.78.233]) by 10.180.78.233 with SMTP id e9mr95999wix.0.1330593084157 (num_hops = 1); Thu, 01 Mar 2012 01:11:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.78.233 with SMTP id e9mr78004wix.0.1330593084001; Thu, 01 Mar 2012 01:11:24 -0800 (PST) Received: by 10.180.94.9 with HTTP; Thu, 1 Mar 2012 01:11:23 -0800 (PST) X-Originating-IP: [95.108.170.17] In-Reply-To: <4F4F3BFB.5030104@FreeBSD.org> References: <201202292241.q1TMffCk048359@svn.freebsd.org> <4F4F2375.3080209@zonov.org> <4F4F3BFB.5030104@FreeBSD.org> Date: Thu, 1 Mar 2012 13:11:23 +0400 Message-ID: From: Andrey Zonov To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmusF6ZNsWxI2+RX5MsBthgJfeNFbDSfJ84Sr2GDyJU28iKBf2H2KvF1c3AHutVByoqPo02 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r232321 - 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, 01 Mar 2012 09:11:25 -0000 On Thu, Mar 1, 2012 at 1:06 PM, Andriy Gapon wrote: > on 01/03/2012 09:21 Andrey Zonov said the following: >> On 01.03.2012 2:41, Andrew Thompson wrote: >>> Author: thompsa >>> Date: Wed Feb 29 22:41:40 2012 >>> New Revision: 232321 >>> URL: http://svn.freebsd.org/changeset/base/232321 >>> >>> Log: >>> =A0 =A0Correct the description for CTLFLAG_TUN and CTLFLAG_RDTUN, the d= eclaring of a >>> =A0 =A0system tunable has never been implemented. This flag is only use= d by sysctl(8) >>> =A0 =A0to provide a helpful error message. >>> >> >> Thanks! >> >> I also think we should remove all CTLFLAG_TUN flags which are combinatio= n with >> CTLFLAG_RW. > > Why? It doesn't make sense. For (CTLFLAG_RD|CTLFLAG_TUN) there is relevant code in sysctl(8), but for (CTLFLAG_RW|CTLFLAG_TUN) there is no any code, or did I miss something? --=20 Andrey Zonov From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 09:44:46 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD310106564A; Thu, 1 Mar 2012 09:44:46 +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 5FA058FC08; Thu, 1 Mar 2012 09:44:44 +0000 (UTC) Received: from porto.starpoint.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 LAA03657; Thu, 01 Mar 2012 11:44:39 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S32Yx-000CM0-5L; Thu, 01 Mar 2012 11:44:39 +0200 Message-ID: <4F4F450D.3060607@FreeBSD.org> Date: Thu, 01 Mar 2012 11:44:45 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Andrey Zonov References: <201202292241.q1TMffCk048359@svn.freebsd.org> <4F4F2375.3080209@zonov.org> <4F4F3BFB.5030104@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.3.5 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, Andrew Thompson Subject: Re: svn commit: r232321 - 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, 01 Mar 2012 09:44:46 -0000 on 01/03/2012 11:11 Andrey Zonov said the following: > It doesn't make sense. For (CTLFLAG_RD|CTLFLAG_TUN) there is relevant > code in sysctl(8), but for (CTLFLAG_RW|CTLFLAG_TUN) there is no any > code, or did I miss something? In the existing code - no. But I would appreciate if e.g. sysctl -d could report that a sysctl also has a twin tunable. I can imagine that there could be things which are better be set to a certain value from the very start (via a tunable) rather than switched to that value later in a boot process (via sysctl). Extra user-friendly information doesn't hurt, IMO. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 10:11:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F8C6106566B for ; Thu, 1 Mar 2012 10:11:03 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id A13328FC0C for ; Thu, 1 Mar 2012 10:11:02 +0000 (UTC) Received: by wibhn6 with SMTP id hn6so306805wib.13 for ; Thu, 01 Mar 2012 02:11:01 -0800 (PST) Received-SPF: pass (google.com: domain of andrey@zonov.org designates 10.180.89.71 as permitted sender) client-ip=10.180.89.71; Authentication-Results: mr.google.com; spf=pass (google.com: domain of andrey@zonov.org designates 10.180.89.71 as permitted sender) smtp.mail=andrey@zonov.org Received: from mr.google.com ([10.180.89.71]) by 10.180.89.71 with SMTP id bm7mr516890wib.20.1330596661709 (num_hops = 1); Thu, 01 Mar 2012 02:11:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.89.71 with SMTP id bm7mr420524wib.20.1330596661546; Thu, 01 Mar 2012 02:11:01 -0800 (PST) Received: by 10.180.94.9 with HTTP; Thu, 1 Mar 2012 02:11:01 -0800 (PST) X-Originating-IP: [95.108.170.17] In-Reply-To: <4F4F450D.3060607@FreeBSD.org> References: <201202292241.q1TMffCk048359@svn.freebsd.org> <4F4F2375.3080209@zonov.org> <4F4F3BFB.5030104@FreeBSD.org> <4F4F450D.3060607@FreeBSD.org> Date: Thu, 1 Mar 2012 14:11:01 +0400 Message-ID: From: Andrey Zonov To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQlKB+gRtESe76GwBtlsMKTxvbKeEKbP8cujqD0JOV0cdq1pXwtaWdriP/Sx/uAAHgkJECfC Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r232321 - 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, 01 Mar 2012 10:11:03 -0000 On Thu, Mar 1, 2012 at 1:44 PM, Andriy Gapon wrote: > on 01/03/2012 11:11 Andrey Zonov said the following: >> It doesn't make sense. =A0For (CTLFLAG_RD|CTLFLAG_TUN) there is relevant >> code in sysctl(8), but for (CTLFLAG_RW|CTLFLAG_TUN) there is no any >> code, or did I miss something? > > In the existing code - no. > But I would appreciate if e.g. sysctl -d could report that a sysctl also = has a > twin tunable. =A0I can imagine that there could be things which are bette= r be set > to a certain value from the very start (via a tunable) rather than switch= ed to > that value later in a boot process (via sysctl). > Extra user-friendly information doesn't hurt, IMO. That would be very usefull, I also thought of it, but for now we've got many tunables+sysctls that don't mark as CTLFLAG_TUN. One quick example is: vm.pmap.shpgperproc --=20 Andrey Zonov From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 10:21:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B3C91065672; Thu, 1 Mar 2012 10:21:10 +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 562AF8FC0C; Thu, 1 Mar 2012 10:21:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21ALARn072248; Thu, 1 Mar 2012 10:21:10 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21ALAm7072246; Thu, 1 Mar 2012 10:21:10 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201203011021.q21ALAm7072246@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 1 Mar 2012 10:21: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: r232329 - head/usr.bin/rctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 10:21:10 -0000 Author: trasz Date: Thu Mar 1 10:21:10 2012 New Revision: 232329 URL: http://svn.freebsd.org/changeset/base/232329 Log: Use proper "maxproc" name, not "nproc". PR: docs/162172 Modified: head/usr.bin/rctl/rctl.8 Modified: head/usr.bin/rctl/rctl.8 ============================================================================== --- head/usr.bin/rctl/rctl.8 Thu Mar 1 08:22:59 2012 (r232328) +++ head/usr.bin/rctl/rctl.8 Thu Mar 1 10:21:10 2012 (r232329) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 22, 2011 +.Dd March 1, 2012 .Dt RCTL 8 .Os .Sh NAME @@ -117,8 +117,8 @@ A filter is a rule for which one of more For example, a filter that matches every rule could be written as ":::=/", or, in short, ":". A filter that matches all the login classes would be "loginclass:". -A filter that matches all defined rules for nproc resource would be -"::nproc". +A filter that matches all defined rules for maxproc resource would be +"::maxproc". .Pp .Sh RESOURCES .Bl -column -offset 3n "pseudoterminals" From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 11:03:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96415106564A; Thu, 1 Mar 2012 11:03:39 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81EDC8FC0C; Thu, 1 Mar 2012 11:03:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21B3d9p075587; Thu, 1 Mar 2012 11:03:39 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21B3dc8075585; Thu, 1 Mar 2012 11:03:39 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203011103.q21B3dc8075585@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 1 Mar 2012 11:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232331 - 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, 01 Mar 2012 11:03:40 -0000 Author: pluknet Date: Thu Mar 1 11:03:39 2012 New Revision: 232331 URL: http://svn.freebsd.org/changeset/base/232331 Log: Document ifnet refcount. MFC after: 1 week Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Thu Mar 1 10:55:01 2012 (r232330) +++ head/share/man/man9/ifnet.9 Thu Mar 1 11:03:39 2012 (r232331) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2012 +.Dd March 1, 2012 .Dt IFNET 9 .Os .Sh NAME @@ -256,6 +256,11 @@ if a unit number is not associated with (Initialized by driver (usually via .Fn if_initname ) . ) +.It Va if_refcount +.Pq Vt u_int +The reference count. +(Initialized by +.Fn if_alloc . ) .It Va if_addrhead .Pq Vt "struct ifaddrhead" The head of the @@ -340,6 +345,20 @@ The output queue. .\"(Initialized by driver.) .El .Pp +References to +.Vt ifnet +structures are gained by calling the +.Fn if_ref +function and released by calling the +.Fn if_rele +function. +They are used to allow kernel code walking global interface lists +to release the +.Vt ifnet +lock yet keep the +.Vt ifnet +structure stable. +.Pp There are in addition a number of function pointers which the driver must initialize to complete its interface with the generic interface layer: From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 12:03:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B37A106566B; Thu, 1 Mar 2012 12:03:53 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0647A8FC17; Thu, 1 Mar 2012 12:03:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21C3qXT077485; Thu, 1 Mar 2012 12:03:52 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21C3qVS077483; Thu, 1 Mar 2012 12:03:52 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203011203.q21C3qVS077483@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 1 Mar 2012 12:03: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: r232333 - 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, 01 Mar 2012 12:03:53 -0000 Author: pluknet Date: Thu Mar 1 12:03:52 2012 New Revision: 232333 URL: http://svn.freebsd.org/changeset/base/232333 Log: Document ifunit_ref function. MFC after: 1 week Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Thu Mar 1 11:55:28 2012 (r232332) +++ head/share/man/man9/ifnet.9 Thu Mar 1 12:03:52 2012 (r232333) @@ -66,6 +66,8 @@ .Fn if_allmulti "struct ifnet *ifp" "int amswitch" .Ft "struct ifnet *" .Fn ifunit "const char *name" +.Ft "struct ifnet *" +.Fn ifunit_ref "const char *name" .Ft void .Fn if_up "struct ifnet *ifp" .\" @@ -1151,6 +1153,14 @@ Return an .Vt ifnet pointer for the interface named .Fa name . +.It Fn ifunit_ref +Return a reference-counted (via +.Fn ifa_ref ) +.Vt ifnet +pointer for the interface named +.Fa name . +This is a preferred function over +.Fn ifunit . .It Fn ifioctl Process the ioctl request .Fa cmd , From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 12:16:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 42987106566B; Thu, 1 Mar 2012 12:16:01 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D9CF8FC16; Thu, 1 Mar 2012 12:16:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21CG170077967; Thu, 1 Mar 2012 12:16:01 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21CG1s2077965; Thu, 1 Mar 2012 12:16:01 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203011216.q21CG1s2077965@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 1 Mar 2012 12:16: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: r232334 - 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, 01 Mar 2012 12:16:01 -0000 Author: pluknet Date: Thu Mar 1 12:16:00 2012 New Revision: 232334 URL: http://svn.freebsd.org/changeset/base/232334 Log: Reflect that ifa_ifwithnet() gained ignore_ptp argument. MFC after: 1 week Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Thu Mar 1 12:03:52 2012 (r232333) +++ head/share/man/man9/ifnet.9 Thu Mar 1 12:16:00 2012 (r232334) @@ -77,7 +77,7 @@ .Ft "struct ifaddr *" .Fn ifa_ifwithdstaddr "struct sockaddr *addr" .Ft "struct ifaddr *" -.Fn ifa_ifwithnet "struct sockaddr *addr" +.Fn ifa_ifwithnet "struct sockaddr *addr" "int ignore_ptp" .Ft "struct ifaddr *" .Fn ifaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp" .Ft void @@ -1323,6 +1323,9 @@ subject to its configured netmask, or a address whose remote address is .Fa addr if one is found. +If +.Fa ignore_ptp +is true, skip point-to-point interface addresses. .Pp .Fn ifaof_ifpforaddr returns the most specific address configured on interface From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 12:30:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 614CF106564A; Thu, 1 Mar 2012 12:30:58 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C8DF8FC08; Thu, 1 Mar 2012 12:30:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21CUwfv078451; Thu, 1 Mar 2012 12:30:58 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21CUwXv078449; Thu, 1 Mar 2012 12:30:58 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203011230.q21CUwXv078449@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 1 Mar 2012 12:30: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: r232335 - 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, 01 Mar 2012 12:30:58 -0000 Author: pluknet Date: Thu Mar 1 12:30:57 2012 New Revision: 232335 URL: http://svn.freebsd.org/changeset/base/232335 Log: Refine r232333 [1] and put note about ifnet refcount caller responsibility. Spotted by: gavin [1] MFC after: 1 week Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Thu Mar 1 12:16:00 2012 (r232334) +++ head/share/man/man9/ifnet.9 Thu Mar 1 12:30:57 2012 (r232335) @@ -1159,8 +1159,11 @@ Return a reference-counted (via .Vt ifnet pointer for the interface named .Fa name . -This is a preferred function over +This is the preferred function over .Fn ifunit . +The caller is responsible for releasing the reference with +.Fn if_rele +when it is finished with the ifnet. .It Fn ifioctl Process the ioctl request .Fa cmd , From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 12:37:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0316106564A; Thu, 1 Mar 2012 12:37:03 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 5BB098FC17; Thu, 1 Mar 2012 12:37:03 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1S35G9-0008Xf-J1; Thu, 01 Mar 2012 16:37:25 +0400 Date: Thu, 1 Mar 2012 16:37:25 +0400 From: Slawa Olhovchenkov To: Gavin Atkinson Message-ID: <20120301123725.GF97848@zxy.spb.ru> References: <201201171352.q0HDq5n2092953@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201171352.q0HDq5n2092953@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r230266 - in stable/9/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 12:37:03 -0000 On Tue, Jan 17, 2012 at 01:52:05PM +0000, Gavin Atkinson wrote: > Author: gavin > Date: Tue Jan 17 13:52:04 2012 > New Revision: 230266 > URL: http://svn.freebsd.org/changeset/base/230266 > > Log: > Merge r229085 from head: > > Default to not performing the early-boot memory tests when we detect we > are booting inside a VM. There are three reasons to disable this: > > o It causes the VM host to believe that all the tested pages or RAM are > in use. This in turn may force the host to page out pages of RAM > belonging to other VMs, or otherwise cause problems with fair resource > sharing on the VM cluster. > o It adds significant time to the boot process (around 1 second/Gig in > testing) > o It is unnecessary - the host should have already verified that the > memory is functional etc. > > Note that this simply changes the default when in a VM - it can still be > overridden using the hw.memtest.tests tunable. > > Early MFC requested by: bz How about similar behaviour for /boot/loader? From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 12:52:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1330106566B; Thu, 1 Mar 2012 12:52:14 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBF678FC13; Thu, 1 Mar 2012 12:52:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21CqE6s079162; Thu, 1 Mar 2012 12:52:14 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21CqEJ2079160; Thu, 1 Mar 2012 12:52:14 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203011252.q21CqEJ2079160@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 1 Mar 2012 12:52: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: r232336 - 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, 01 Mar 2012 12:52:14 -0000 Author: pluknet Date: Thu Mar 1 12:52:14 2012 New Revision: 232336 URL: http://svn.freebsd.org/changeset/base/232336 Log: Changes in ifaddr refcounting: ifa_refcnt IFAREF/IFAFREE macros moved to ifa_ref()/ifa_free() refcounting functions. MFC after: 1 week Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Thu Mar 1 12:30:57 2012 (r232335) +++ head/share/man/man9/ifnet.9 Thu Mar 1 12:52:14 2012 (r232336) @@ -81,8 +81,9 @@ .Ft "struct ifaddr *" .Fn ifaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp" .Ft void -.Fn ifafree "struct ifaddr *ifa" -.Fn IFAFREE "struct ifaddr *ifa" +.Fn ifa_ref "struct ifaddr *ifa" +.Ft void +.Fn ifa_free "struct ifaddr *ifa" .\" .Ss "Interface Multicast Address Functions" .Ft int @@ -999,14 +1000,11 @@ external routing protocol. .Pp References to .Vt ifaddr -structures are gained manually, by incrementing the -.Va ifa_refcnt -member. -References are released by calling either the -.Fn ifafree -function or the -.Fn IFAFREE -macro. +structures are gained by calling the +.Fn ifa_ref +function and released by calling the +.Fn ifa_free +function. .Pp .Fn ifa_rtrequest is a pointer to a function which receives callouts from the routing From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 13:10:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF0A4106564A; Thu, 1 Mar 2012 13:10:18 +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 96D178FC1C; Thu, 1 Mar 2012 13:10:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21DAIFP079777; Thu, 1 Mar 2012 13:10:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21DAIs1079768; Thu, 1 Mar 2012 13:10:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203011310.q21DAIs1079768@svn.freebsd.org> From: Alexander Motin Date: Thu, 1 Mar 2012 13: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: r232337 - in head: share/man/man4 sys/conf sys/dev/sound/pci sys/modules/sound/driver sys/modules/sound/driver/hdspe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 13:10:18 -0000 Author: mav Date: Thu Mar 1 13:10:18 2012 New Revision: 232337 URL: http://svn.freebsd.org/changeset/base/232337 Log: Add driver for the RME HDSPe AIO/RayDAT sound cards -- snd_hdspe(4). Cards are expensive and so rare, so leave the driver as module. Submitted by: Ruslan Bukin MFC after: 2 weeks Added: head/share/man/man4/snd_hdspe.4 (contents, props changed) head/sys/dev/sound/pci/hdspe-pcm.c (contents, props changed) head/sys/dev/sound/pci/hdspe.c (contents, props changed) head/sys/dev/sound/pci/hdspe.h (contents, props changed) head/sys/modules/sound/driver/hdspe/ head/sys/modules/sound/driver/hdspe/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/pcm.4 head/sys/conf/NOTES head/sys/conf/files head/sys/modules/sound/driver/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Mar 1 12:52:14 2012 (r232336) +++ head/share/man/man4/Makefile Thu Mar 1 13:10:18 2012 (r232337) @@ -414,6 +414,7 @@ MAN= aac.4 \ snd_fm801.4 \ snd_gusc.4 \ snd_hda.4 \ + snd_hdspe.4 \ snd_ich.4 \ snd_maestro3.4 \ snd_maestro.4 \ Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Thu Mar 1 12:52:14 2012 (r232336) +++ head/share/man/man4/pcm.4 Thu Mar 1 13:10:18 2012 (r232337) @@ -113,6 +113,8 @@ The following bridge device drivers are .It .Xr snd_hda 4 (enabled by default on amd64, i386) .It +.Xr snd_hdspe 4 +.It .Xr snd_ich 4 (enabled by default on amd64, i386) .It .Xr snd_maestro 4 @@ -723,6 +725,7 @@ A device node is not created properly. .Xr snd_fm801 4 , .Xr snd_gusc 4 , .Xr snd_hda 4 , +.Xr snd_hdspe 4 , .Xr snd_ich 4 , .Xr snd_maestro 4 , .Xr snd_maestro3 4 , Added: head/share/man/man4/snd_hdspe.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/snd_hdspe.4 Thu Mar 1 13:10:18 2012 (r232337) @@ -0,0 +1,76 @@ +.\" Copyright (c) 2012 Ruslan Bukin +.\" 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 February 13, 2012 +.Dt SND_HDSPE 4 +.Os +.Sh NAME +.Nm snd_hdspe +.Nd "RME HDSPe brigde device driver" +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device sound" +.Cd "device snd_hdspe" +.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 +snd_hdspe_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +bridge driver allows the generic audio driver +.Xr sound 4 +to attach to RME HDSPe audio devices. +.Sh HARDWARE +The +.Nm +driver supports the following audio devices: +.Pp +.Bl -bullet -compact +.It +RME HDSPe AIO +.It +RME HDSPe RayDAT +.El +.Sh SEE ALSO +.Xr sound 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Ruslan Bukin . Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Mar 1 12:52:14 2012 (r232336) +++ head/sys/conf/NOTES Thu Mar 1 13:10:18 2012 (r232337) @@ -2257,6 +2257,7 @@ device sound # snd_gusc: Gravis UltraSound ISA PnP/non-PnP. # snd_hda: Intel High Definition Audio (Controller) and # compatible. +# snd_hdspe: RME HDSPe AIO and RayDAT. # snd_ich: Intel ICH AC'97 and some more audio controllers # embedded in a chipset, for example nVidia # nForce controllers. @@ -2296,6 +2297,7 @@ device snd_ess device snd_fm801 device snd_gusc device snd_hda +device snd_hdspe device snd_ich device snd_maestro device snd_maestro3 Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Mar 1 12:52:14 2012 (r232336) +++ head/sys/conf/files Thu Mar 1 13:10:18 2012 (r232337) @@ -1770,6 +1770,8 @@ dev/sound/pci/hda/hdaa_patches.c optiona dev/sound/pci/hda/hdac.c optional snd_hda pci dev/sound/pci/hda/hdac_if.m optional snd_hda pci dev/sound/pci/hda/hdacc.c optional snd_hda pci +dev/sound/pci/hdspe.c optional snd_hdspe pci +dev/sound/pci/hdspe-pcm.c optional snd_hdspe pci dev/sound/pcm/ac97.c optional sound dev/sound/pcm/ac97_if.m optional sound dev/sound/pcm/ac97_patch.c optional sound Added: head/sys/dev/sound/pci/hdspe-pcm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/sound/pci/hdspe-pcm.c Thu Mar 1 13:10:18 2012 (r232337) @@ -0,0 +1,709 @@ +/*- + * Copyright (c) 2012 Ruslan Bukin + * 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. + */ + +/* + * RME HDSPe driver for FreeBSD (pcm-part). + * Supported cards: AIO, RayDAT. + */ + +#include +#include +#include + +#include +#include + +#include + +SND_DECLARE_FILE("$FreeBSD$"); + +struct hdspe_latency { + uint32_t n; + uint32_t period; + float ms; +}; + +static struct hdspe_latency latency_map[] = { + { 7, 32, 0.7 }, + { 0, 64, 1.5 }, + { 1, 128, 3 }, + { 2, 256, 6 }, + { 3, 512, 12 }, + { 4, 1024, 23 }, + { 5, 2048, 46 }, + { 6, 4096, 93 }, + + { 0, 0, 0 }, +}; + +struct hdspe_rate { + uint32_t speed; + uint32_t reg; +}; + +static struct hdspe_rate rate_map[] = { + { 32000, (HDSPE_FREQ_32000) }, + { 44100, (HDSPE_FREQ_44100) }, + { 48000, (HDSPE_FREQ_48000) }, + { 64000, (HDSPE_FREQ_32000 | HDSPE_FREQ_DOUBLE) }, + { 88200, (HDSPE_FREQ_44100 | HDSPE_FREQ_DOUBLE) }, + { 96000, (HDSPE_FREQ_48000 | HDSPE_FREQ_DOUBLE) }, + { 128000, (HDSPE_FREQ_32000 | HDSPE_FREQ_QUAD) }, + { 176400, (HDSPE_FREQ_44100 | HDSPE_FREQ_QUAD) }, + { 192000, (HDSPE_FREQ_48000 | HDSPE_FREQ_QUAD) }, + + { 0, 0 }, +}; + + +static int +hdspe_hw_mixer(struct sc_chinfo *ch, unsigned int dst, + unsigned int src, unsigned short data) +{ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + int offs = 0; + + if (ch->dir == PCMDIR_PLAY) + offs = 64; + + hdspe_write_4(sc, HDSPE_MIXER_BASE + + ((offs + src + 128 * dst) * sizeof(uint32_t)), + data & 0xFFFF); + + return 0; +}; + +static int +hdspechan_setgain(struct sc_chinfo *ch) +{ + + hdspe_hw_mixer(ch, ch->lslot, ch->lslot, + ch->lvol * HDSPE_MAX_GAIN / 100); + hdspe_hw_mixer(ch, ch->rslot, ch->rslot, + ch->rvol * HDSPE_MAX_GAIN / 100); + + return 0; +} + +static int +hdspemixer_init(struct snd_mixer *m) +{ + struct sc_pcminfo *scp = mix_getdevinfo(m); + struct sc_info *sc = scp->sc; + int mask; + + if (sc == NULL) + return -1; + + mask = SOUND_MASK_PCM; + + if (scp->hc->play) + mask |= SOUND_MASK_VOLUME; + + if (scp->hc->rec) + mask |= SOUND_MASK_RECLEV; + + snd_mtxlock(sc->lock); + pcm_setflags(scp->dev, pcm_getflags(scp->dev) | SD_F_SOFTPCMVOL); + mix_setdevs(m, mask); + snd_mtxunlock(sc->lock); + + return 0; +} + +static int +hdspemixer_set(struct snd_mixer *m, unsigned dev, + unsigned left, unsigned right) +{ + struct sc_pcminfo *scp = mix_getdevinfo(m); + struct sc_chinfo *ch; + int i; + +#if 0 + device_printf(scp->dev, "hdspemixer_set() %d %d\n", + left,right); +#endif + + for (i = 0; i < scp->chnum; i++) { + ch = &scp->chan[i]; + if ((dev == SOUND_MIXER_VOLUME && ch->dir == PCMDIR_PLAY) || + (dev == SOUND_MIXER_RECLEV && ch->dir == PCMDIR_REC)) { + ch->lvol = left; + ch->rvol = right; + if (ch->run) + hdspechan_setgain(ch); + } + } + + return 0; +} + +static kobj_method_t hdspemixer_methods[] = { + KOBJMETHOD(mixer_init, hdspemixer_init), + KOBJMETHOD(mixer_set, hdspemixer_set), + KOBJMETHOD_END +}; +MIXER_DECLARE(hdspemixer); + +static void +hdspechan_enable(struct sc_chinfo *ch, int value) +{ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + int reg; + + if (ch->dir == PCMDIR_PLAY) + reg = HDSPE_OUT_ENABLE_BASE; + else + reg = HDSPE_IN_ENABLE_BASE; + + ch->run = value; + + hdspe_write_1(sc, reg + (4 * ch->lslot), value); + hdspe_write_1(sc, reg + (4 * ch->rslot), value); +} + +static int +hdspe_running(struct sc_info *sc) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + int i, j, devcount, err; + device_t *devlist; + + if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + goto bad; + + for (i = 0; i < devcount; i++) { + scp = device_get_ivars(devlist[i]); + for (j = 0; j < scp->chnum; j++) { + ch = &scp->chan[j]; + if (ch->run) + goto bad; + } + } + + return 0; +bad: + +#if 0 + device_printf(sc->dev,"hdspe is running\n"); +#endif + + return 1; +} + +static void +hdspe_start_audio(struct sc_info *sc) +{ + + sc->ctrl_register |= (HDSPE_AUDIO_INT_ENABLE | HDSPE_ENABLE); + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); +} + +static void +hdspe_stop_audio(struct sc_info *sc) +{ + + if (hdspe_running(sc) == 1) + return; + + sc->ctrl_register &= ~(HDSPE_AUDIO_INT_ENABLE | HDSPE_ENABLE); + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); +} + +/* Multiplex / demultiplex: 2.0 <-> 2 x 1.0. */ +static void +buffer_copy(struct sc_chinfo *ch) +{ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + int length,src,dst; + int ssize, dsize; + int i; + + length = sndbuf_getready(ch->buffer) / + (4 /* Bytes per sample. */ * 2 /* channels */); + + if (ch->dir == PCMDIR_PLAY) { + src = sndbuf_getreadyptr(ch->buffer); + } else { + src = sndbuf_getfreeptr(ch->buffer); + } + + src /= 4; /* Bytes per sample. */ + dst = src / 2; /* Destination buffer twice smaller. */ + + ssize = ch->size / 4; + dsize = ch->size / 8; + + /* + * Use two fragment buffer to avoid sound clipping. + */ + + for (i = 0; i < sc->period * 2 /* fragments */; i++) { + if (ch->dir == PCMDIR_PLAY) { + sc->pbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->lslot] = + ch->data[src]; + sc->pbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->rslot] = + ch->data[src + 1]; + + } else { + ch->data[src] = + sc->rbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->lslot]; + ch->data[src+1] = + sc->rbuf[dst + HDSPE_CHANBUF_SAMPLES * ch->rslot]; + } + + dst+=1; + dst %= dsize; + src+=2; + src %= ssize; + } +} + +static int +clean(struct sc_chinfo *ch){ + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + uint32_t *buf = sc->rbuf; + + if (ch->dir == PCMDIR_PLAY) { + buf = sc->pbuf; + } + + bzero(buf + HDSPE_CHANBUF_SAMPLES * ch->lslot, HDSPE_CHANBUF_SIZE); + bzero(buf + HDSPE_CHANBUF_SAMPLES * ch->rslot, HDSPE_CHANBUF_SIZE); + + return 0; +} + + +/* Channel interface. */ +static void * +hdspechan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, + struct pcm_channel *c, int dir) +{ + struct sc_pcminfo *scp = devinfo; + struct sc_info *sc = scp->sc; + struct sc_chinfo *ch; + int num; + + snd_mtxlock(sc->lock); + num = scp->chnum; + + ch = &scp->chan[num]; + ch->lslot = scp->hc->left; + ch->rslot = scp->hc->right; + ch->run = 0; + ch->lvol = 0; + ch->rvol = 0; + + ch->size = HDSPE_CHANBUF_SIZE * 2 /* slots */; + ch->data = malloc(ch->size, M_HDSPE, M_NOWAIT); + + ch->buffer = b; + ch->channel = c; + ch->parent = scp; + + ch->dir = dir; + + snd_mtxunlock(sc->lock); + + if (sndbuf_setup(ch->buffer, ch->data, ch->size) != 0) { + device_printf(scp->dev, "Can't setup sndbuf.\n"); + return NULL; + } + + return ch; +} + +static int +hdspechan_trigger(kobj_t obj, void *data, int go) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + + snd_mtxlock(sc->lock); + switch (go) { + case PCMTRIG_START: +#if 0 + device_printf(scp->dev, "hdspechan_trigger(): start\n"); +#endif + hdspechan_enable(ch, 1); + hdspechan_setgain(ch); + hdspe_start_audio(sc); + break; + + case PCMTRIG_STOP: + case PCMTRIG_ABORT: +#if 0 + device_printf(scp->dev, "hdspechan_trigger(): stop or abort\n"); +#endif + clean(ch); + hdspechan_enable(ch, 0); + hdspe_stop_audio(sc); + break; + + case PCMTRIG_EMLDMAWR: + case PCMTRIG_EMLDMARD: + if(ch->run) + buffer_copy(ch); + break; + } + + snd_mtxunlock(sc->lock); + + return 0; +} + +static uint32_t +hdspechan_getptr(kobj_t obj, void *data) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + uint32_t ret, pos; + + snd_mtxlock(sc->lock); + ret = hdspe_read_2(sc, HDSPE_STATUS_REG); + snd_mtxunlock(sc->lock); + + pos = ret & HDSPE_BUF_POSITION_MASK; + pos *= 2; /* Hardbuf twice bigger. */ + + return pos; +} + +static int +hdspechan_free(kobj_t obj, void *data) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + +#if 0 + device_printf(scp->dev, "hdspechan_free()\n"); +#endif + snd_mtxlock(sc->lock); + if (ch->data != NULL) { + free(ch->data, M_HDSPE); + ch->data = NULL; + } + snd_mtxunlock(sc->lock); + + return 0; +} + +static int +hdspechan_setformat(kobj_t obj, void *data, uint32_t format) +{ + struct sc_chinfo *ch = data; + +#if 0 + struct sc_pcminfo *scp = ch->parent; + device_printf(scp->dev, "hdspechan_setformat(%d)\n", format); +#endif + + ch->format = format; + + return 0; +} + +static uint32_t +hdspechan_setspeed(kobj_t obj, void *data, uint32_t speed) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + struct hdspe_rate *hr = NULL; + long long period; + int threshold; + int i; + +#if 0 + device_printf(scp->dev, "hdspechan_setspeed(%d)\n", speed); +#endif + + if (hdspe_running(sc) == 1) + goto end; + + /* First look for equal frequency. */ + for (i = 0; rate_map[i].speed != 0; i++) { + if (rate_map[i].speed == speed) + hr = &rate_map[i]; + } + + /* If no match, just find nearest. */ + if (hr == NULL) { + for (i = 0; rate_map[i].speed != 0; i++) { + hr = &rate_map[i]; + threshold = hr->speed + ((rate_map[i + 1].speed != 0) ? + ((rate_map[i + 1].speed - hr->speed) >> 1) : 0); + if (speed < threshold) + break; + } + } + + switch (sc->type) { + case RAYDAT: + case AIO: + period = HDSPE_FREQ_AIO; + break; + default: + /* Unsupported card. */ + goto end; + } + + /* Write frequency on the device. */ + sc->ctrl_register &= ~HDSPE_FREQ_MASK; + sc->ctrl_register |= hr->reg; + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); + + speed = hr->speed; + if (speed > 96000) + speed /= 4; + else if (speed > 48000) + speed /= 2; + + /* Set DDS value. */ + period /= speed; + hdspe_write_4(sc, HDSPE_FREQ_REG, period); + + sc->speed = hr->speed; +end: + return sc->speed; +} + +static uint32_t +hdspechan_setblocksize(kobj_t obj, void *data, uint32_t blocksize) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct sc_info *sc = scp->sc; + struct hdspe_latency *hl = NULL; + int threshold; + int i; + +#if 0 + device_printf(scp->dev, "hdspechan_setblocksize(%d)\n", blocksize); +#endif + + if (hdspe_running(sc) == 1) + goto end; + + if (blocksize > HDSPE_LAT_BYTES_MAX) + blocksize = HDSPE_LAT_BYTES_MAX; + else if (blocksize < HDSPE_LAT_BYTES_MIN) + blocksize = HDSPE_LAT_BYTES_MIN; + + blocksize /= 4 /* samples */; + + /* First look for equal latency. */ + for (i = 0; latency_map[i].period != 0; i++) { + if (latency_map[i].period == blocksize) { + hl = &latency_map[i]; + } + } + + /* If no match, just find nearest. */ + if (hl == NULL) { + for (i = 0; latency_map[i].period != 0; i++) { + hl = &latency_map[i]; + threshold = hl->period + ((latency_map[i + 1].period != 0) ? + ((latency_map[i + 1].period - hl->period) >> 1) : 0); + if (blocksize < threshold) + break; + } + } + + snd_mtxlock(sc->lock); + sc->ctrl_register &= ~HDSPE_LAT_MASK; + sc->ctrl_register |= hdspe_encode_latency(hl->n); + hdspe_write_4(sc, HDSPE_CONTROL_REG, sc->ctrl_register); + sc->period = hl->period; + snd_mtxunlock(sc->lock); + +#if 0 + device_printf(scp->dev, "New period=%d\n", sc->period); +#endif + + sndbuf_resize(ch->buffer, (HDSPE_CHANBUF_SIZE * 2) / (sc->period * 4), + (sc->period * 4)); +end: + return sndbuf_getblksz(ch->buffer); +} + +static uint32_t hdspe_rfmt[] = { + SND_FORMAT(AFMT_S32_LE, 2, 0), + 0 +}; + +static struct pcmchan_caps hdspe_rcaps = {32000, 192000, hdspe_rfmt, 0}; + +static uint32_t hdspe_pfmt[] = { + SND_FORMAT(AFMT_S32_LE, 2, 0), + 0 +}; + +static struct pcmchan_caps hdspe_pcaps = {32000, 192000, hdspe_pfmt, 0}; + +static struct pcmchan_caps * +hdspechan_getcaps(kobj_t obj, void *data) +{ + struct sc_chinfo *ch = data; + +#if 0 + struct sc_pcminfo *scl = ch->parent; + device_printf(scp->dev, "hdspechan_getcaps()\n"); +#endif + + return (ch->dir == PCMDIR_PLAY) ? + &hdspe_pcaps : &hdspe_rcaps; +} + +static kobj_method_t hdspechan_methods[] = { + KOBJMETHOD(channel_init, hdspechan_init), + KOBJMETHOD(channel_free, hdspechan_free), + KOBJMETHOD(channel_setformat, hdspechan_setformat), + KOBJMETHOD(channel_setspeed, hdspechan_setspeed), + KOBJMETHOD(channel_setblocksize, hdspechan_setblocksize), + KOBJMETHOD(channel_trigger, hdspechan_trigger), + KOBJMETHOD(channel_getptr, hdspechan_getptr), + KOBJMETHOD(channel_getcaps, hdspechan_getcaps), + KOBJMETHOD_END +}; +CHANNEL_DECLARE(hdspechan); + + +static int +hdspe_pcm_probe(device_t dev) +{ + +#if 0 + device_printf(dev,"hdspe_pcm_probe()\n"); +#endif + + return 0; +} + +static uint32_t +hdspe_pcm_intr(struct sc_pcminfo *scp) { + struct sc_chinfo *ch; + struct sc_info *sc = scp->sc; + int i; + + for (i = 0; i < scp->chnum; i++) { + ch = &scp->chan[i]; + snd_mtxunlock(sc->lock); + chn_intr(ch->channel); + snd_mtxlock(sc->lock); + } + + return 0; +} + +static int +hdspe_pcm_attach(device_t dev) +{ + struct sc_pcminfo *scp; + char status[SND_STATUSLEN]; + char desc[64]; + int i, err; + + scp = device_get_ivars(dev); + scp->ih = &hdspe_pcm_intr; + + bzero(desc, sizeof(desc)); + snprintf(desc, sizeof(desc), "HDSPe AIO [%s]", scp->hc->descr); + device_set_desc_copy(dev, desc); + + /* + * We don't register interrupt handler with snd_setup_intr + * in pcm device. Mark pcm device as MPSAFE manually. + */ + pcm_setflags(dev, pcm_getflags(dev) | SD_F_MPSAFE); + + err = pcm_register(dev, scp, scp->hc->play, scp->hc->rec); + if (err) { + device_printf(dev, "Can't register pcm.\n"); + return ENXIO; + } + + scp->chnum = 0; + for (i = 0; i < scp->hc->play; i++) { + pcm_addchan(dev, PCMDIR_PLAY, &hdspechan_class, scp); + scp->chnum++; + } + + for (i = 0; i < scp->hc->rec; i++) { + pcm_addchan(dev, PCMDIR_REC, &hdspechan_class, scp); + scp->chnum++; + } + + snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + rman_get_start(scp->sc->cs), + rman_get_start(scp->sc->irq), + PCM_KLDSTRING(snd_hdspe)); + pcm_setstatus(dev, status); + + mixer_init(dev, &hdspemixer_class, scp); + + return 0; +} + +static int +hdspe_pcm_detach(device_t dev) +{ + int err; + + err = pcm_unregister(dev); + if (err) { + device_printf(dev, "Can't unregister device.\n"); + return err; + } + + return 0; +} + +static device_method_t hdspe_pcm_methods[] = { + DEVMETHOD(device_probe, hdspe_pcm_probe), + DEVMETHOD(device_attach, hdspe_pcm_attach), + DEVMETHOD(device_detach, hdspe_pcm_detach), + { 0, 0 } +}; + +static driver_t hdspe_pcm_driver = { + "pcm", + hdspe_pcm_methods, + PCM_SOFTC_SIZE, +}; + +DRIVER_MODULE(snd_hdspe_pcm, hdspe, hdspe_pcm_driver, pcm_devclass, 0, 0); +MODULE_DEPEND(snd_hdspe, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); +MODULE_VERSION(snd_hdspe, 1); Added: head/sys/dev/sound/pci/hdspe.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/sound/pci/hdspe.c Thu Mar 1 13:10:18 2012 (r232337) @@ -0,0 +1,410 @@ +/*- + * Copyright (c) 2012 Ruslan Bukin + * 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. + */ + +/* + * RME HDSPe driver for FreeBSD. + * Supported cards: AIO, RayDAT. + */ + +#include +#include +#include + +#include +#include + +#include + +SND_DECLARE_FILE("$FreeBSD$"); + +static struct hdspe_channel chan_map_aio[] = { + { 0, 1, "line", 1, 1 }, + { 6, 7, "phone", 1, 0 }, + { 8, 9, "aes", 1, 1 }, + { 10, 11, "s/pdif", 1, 1 }, + { 12, 16, "adat", 1, 1 }, + + /* Single or double speed. */ + { 14, 18, "adat", 1, 1 }, + + /* Single speed only. */ + { 13, 15, "adat", 1, 1 }, + { 17, 19, "adat", 1, 1 }, + + { 0, 0, NULL, 0, 0 }, +}; + +static struct hdspe_channel chan_map_rd[] = { + { 0, 1, "aes", 1, 1 }, + { 2, 3, "s/pdif", 1, 1 }, + { 4, 5, "adat", 1, 1 }, + { 6, 7, "adat", 1, 1 }, + { 8, 9, "adat", 1, 1 }, + { 10, 11, "adat", 1, 1 }, + + /* Single or double speed. */ + { 12, 13, "adat", 1, 1 }, + { 14, 15, "adat", 1, 1 }, + { 16, 17, "adat", 1, 1 }, + { 18, 19, "adat", 1, 1 }, + + /* Single speed only. */ + { 20, 21, "adat", 1, 1 }, + { 22, 23, "adat", 1, 1 }, + { 24, 25, "adat", 1, 1 }, + { 26, 27, "adat", 1, 1 }, + { 28, 29, "adat", 1, 1 }, + { 30, 31, "adat", 1, 1 }, + { 32, 33, "adat", 1, 1 }, + { 34, 35, "adat", 1, 1 }, + + { 0, 0, NULL, 0, 0 }, +}; + +static void +hdspe_intr(void *p) +{ + struct sc_info *sc = (struct sc_info *)p; + struct sc_pcminfo *scp; + device_t *devlist; + int devcount, status; + int i, err; + + snd_mtxlock(sc->lock); + + status = hdspe_read_1(sc, HDSPE_STATUS_REG); + if (status & HDSPE_AUDIO_IRQ_PENDING) { + if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + return; + + for (i = 0; i < devcount; i++) { + scp = device_get_ivars(devlist[i]); + if (scp->ih != NULL) + scp->ih(scp); + } + + hdspe_write_1(sc, HDSPE_INTERRUPT_ACK, 0); + } + + snd_mtxunlock(sc->lock); +} + +static void +hdspe_dmapsetmap(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ +#if 0 + struct sc_info *sc = (struct sc_info *)arg; + device_printf(sc->dev, "hdspe_dmapsetmap()\n"); +#endif +} + +static int +hdspe_alloc_resources(struct sc_info *sc) +{ + + /* Allocate resource. */ + sc->csid = PCIR_BAR(0); + sc->cs = bus_alloc_resource(sc->dev, SYS_RES_MEMORY, + &sc->csid, 0, ~0, 1, RF_ACTIVE); + + if (!sc->cs) { + device_printf(sc->dev, "Unable to map SYS_RES_MEMORY.\n"); + return (ENXIO); + } + sc->cst = rman_get_bustag(sc->cs); + sc->csh = rman_get_bushandle(sc->cs); + + + /* Allocate interrupt resource. */ + sc->irqid = 0; + sc->irq = bus_alloc_resource(sc->dev, SYS_RES_IRQ, &sc->irqid, + 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); + + if (!sc->irq || + bus_setup_intr(sc->dev, sc->irq, INTR_MPSAFE | INTR_TYPE_AV, + NULL, hdspe_intr, sc, &sc->ih)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 14:39:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AED461065670; Thu, 1 Mar 2012 14:39:01 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A1598FC22; Thu, 1 Mar 2012 14:39:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21Ed1mi083127; Thu, 1 Mar 2012 14:39:01 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21Ed1oa083125; Thu, 1 Mar 2012 14:39:01 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201203011439.q21Ed1oa083125@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 1 Mar 2012 14:39: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: r232339 - head/lib/libc/uuid X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 14:39:01 -0000 Author: ae Date: Thu Mar 1 14:39:01 2012 New Revision: 232339 URL: http://svn.freebsd.org/changeset/base/232339 Log: Note that memory should be freed after uuid_to_string(3) call. MFC after: 1 week Modified: head/lib/libc/uuid/uuid.3 Modified: head/lib/libc/uuid/uuid.3 ============================================================================== --- head/lib/libc/uuid/uuid.3 Thu Mar 1 14:01:16 2012 (r232338) +++ head/lib/libc/uuid/uuid.3 Thu Mar 1 14:39:01 2012 (r232339) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 13, 2008 +.Dd March 1, 2012 .Dt UUID 3 .Os .Sh NAME @@ -84,6 +84,15 @@ A 16-bit hash value can be obtained by c .Fn uuid_hash . .Pp The +.Fn uuid_to_string +function set +.Fa *str +to be a pointer to a buffer sufficiently large to hold the string. +This pointer should be passed to +.Xr free 3 +to release the allocated storage when it is no longer needed. +.Pp +The .Fn uuid_enc_le and .Fn uuid_enc_be @@ -116,7 +125,7 @@ The UUID does not have a known version. .It Dv uuid_s_invalid_string_uuid The string representation of an UUID is not valid. .It Dv uuid_s_no_memory -The meaning of the code escaped the writers mind. +The function can not allocate memory to store an UUID representation. .El .Sh SEE ALSO .Xr uuidgen 1 , From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 15:09:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0D38106566C; Thu, 1 Mar 2012 15:09:41 +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 A29D28FC14; Thu, 1 Mar 2012 15:09:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21F9fYB084206; Thu, 1 Mar 2012 15:09:41 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21F9f2p084204; Thu, 1 Mar 2012 15:09:41 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201203011509.q21F9f2p084204@svn.freebsd.org> From: Jamie Gritton Date: Thu, 1 Mar 2012 15:09: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: r232342 - head/lib/libjail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 15:09:41 -0000 Author: jamie Date: Thu Mar 1 15:09:41 2012 New Revision: 232342 URL: http://svn.freebsd.org/changeset/base/232342 Log: Handle the case where a boolean parameter is also a node. PR: bin/165515 MFC after: 2 weeks Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Thu Mar 1 15:08:58 2012 (r232341) +++ head/lib/libjail/jail.c Thu Mar 1 15:09:41 2012 (r232342) @@ -885,36 +885,20 @@ jailparam_type(struct jailparam *jp) * the "no" counterpart to a boolean. */ nname = nononame(jp->jp_name); - if (nname != NULL) { - snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", nname); - free(nname); - miblen = sizeof(mib) - 2 * sizeof(int); - if (sysctl(mib, 2, mib + 2, &miblen, desc.s, - strlen(desc.s)) >= 0) { - mib[1] = 4; - desclen = sizeof(desc); - if (sysctl(mib, (miblen / sizeof(int)) + 2, - &desc, &desclen, NULL, 0) < 0) { - snprintf(jail_errmsg, - JAIL_ERRMSGLEN, - "sysctl(0.4.%s): %s", desc.s, - strerror(errno)); - return (-1); - } - if ((desc.i & CTLTYPE) == CTLTYPE_INT && - desc.s[0] == 'B') { - jp->jp_ctltype = desc.i; - jp->jp_flags |= JP_NOBOOL; - jp->jp_valuelen = sizeof(int); - return (0); - } - } + if (nname == NULL) { + unknown_parameter: + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "unknown parameter: %s", jp->jp_name); + errno = ENOENT; + return (-1); } - unknown_parameter: - snprintf(jail_errmsg, JAIL_ERRMSGLEN, - "unknown parameter: %s", jp->jp_name); - errno = ENOENT; - return (-1); + snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", nname); + free(nname); + miblen = sizeof(mib) - 2 * sizeof(int); + if (sysctl(mib, 2, mib + 2, &miblen, desc.s, + strlen(desc.s)) < 0) + goto unknown_parameter; + jp->jp_flags |= JP_NOBOOL; } mib_desc: mib[1] = 4; @@ -925,6 +909,16 @@ jailparam_type(struct jailparam *jp) "sysctl(0.4.%s): %s", jp->jp_name, strerror(errno)); return (-1); } + jp->jp_ctltype = desc.i; + /* If this came from removing a "no", it better be a boolean. */ + if (jp->jp_flags & JP_NOBOOL) { + if ((desc.i & CTLTYPE) == CTLTYPE_INT && desc.s[0] == 'B') { + jp->jp_valuelen = sizeof(int); + return (0); + } + else if ((desc.i & CTLTYPE) != CTLTYPE_NODE) + goto unknown_parameter; + } /* See if this is an array type. */ p = strchr(desc.s, '\0'); isarray = 0; @@ -935,7 +929,6 @@ jailparam_type(struct jailparam *jp) p[-2] = 0; } /* Look for types we understand. */ - jp->jp_ctltype = desc.i; switch (desc.i & CTLTYPE) { case CTLTYPE_INT: if (desc.s[0] == 'B') From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 15:51:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CB121065670; Thu, 1 Mar 2012 15:51:20 +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 476798FC16; Thu, 1 Mar 2012 15:51:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21FpK5L085481; Thu, 1 Mar 2012 15:51:20 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21FpKd6085479; Thu, 1 Mar 2012 15:51:20 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201203011551.q21FpKd6085479@svn.freebsd.org> From: Jaakko Heinonen Date: Thu, 1 Mar 2012 15:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232343 - stable/9/sbin/mount_ntfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 15:51:20 -0000 Author: jh Date: Thu Mar 1 15:51:19 2012 New Revision: 232343 URL: http://svn.freebsd.org/changeset/base/232343 Log: MFC r230642: Remove trailing whitespace. Modified: stable/9/sbin/mount_ntfs/mount_ntfs.c Directory Properties: stable/9/sbin/mount_ntfs/ (props changed) Modified: stable/9/sbin/mount_ntfs/mount_ntfs.c ============================================================================== --- stable/9/sbin/mount_ntfs/mount_ntfs.c Thu Mar 1 15:09:41 2012 (r232342) +++ stable/9/sbin/mount_ntfs/mount_ntfs.c Thu Mar 1 15:51:19 2012 (r232343) @@ -160,7 +160,7 @@ main(int argc, char *argv[]) } /* - * Resolve the mountpoint with realpath(3) and remove unnecessary + * Resolve the mountpoint with realpath(3) and remove unnecessary * slashes from the devicename if there are any. */ (void)checkpath(dir, mntpath); From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 16:53:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 285C31065678; Thu, 1 Mar 2012 16:53:03 +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 ED2748FC17; Thu, 1 Mar 2012 16:53:02 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id A412046B23; Thu, 1 Mar 2012 11:53:02 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0FCB8B991; Thu, 1 Mar 2012 11:53:02 -0500 (EST) From: John Baldwin To: "Bjoern A. Zeeb" Date: Thu, 1 Mar 2012 09:33:56 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202292138.q1TLcVFv046104@svn.freebsd.org> <14D2BDEC-B9C7-4B2D-AF2C-60598CCE1EBF@lists.zabbadoz.net> In-Reply-To: <14D2BDEC-B9C7-4B2D-AF2C-60598CCE1EBF@lists.zabbadoz.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203010933.56172.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Mar 2012 11:53:02 -0500 (EST) Cc: Mikolaj Golub , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r232317 - in head: . 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, 01 Mar 2012 16:53:03 -0000 On Wednesday, February 29, 2012 6:44:47 pm Bjoern A. Zeeb wrote: > > On 29. Feb 2012, at 21:38 , Mikolaj Golub wrote: > > > Author: trociny > > Date: Wed Feb 29 21:38:31 2012 > > New Revision: 232317 > > URL: http://svn.freebsd.org/changeset/base/232317 > > > > Log: > > Introduce VOP_UNP_BIND(), VOP_UNP_CONNECT(), and VOP_UNP_DETACH() > > operations for setting and accessing vnode's v_socket field. > > > > The operations are necessary to implement proper unix socket handling > > on layered file systems like nullfs(5). > > > > This change fixes the long standing issue with nullfs(5) being in that > > unix sockets did not work between lower and upper layers: if we bound > > to a socket on the lower layer we could connect only to the lower > > path; if we bound to the upper layer we could connect only to the > > upper path. The new behavior is one can connect to both the lower and > > the upper paths regardless what layer path one binds to. > > At this point I wonder if jhb has added (enough) spares with an earlier MFC of another change or whether we'll break thing again? Well, we added 5. This will use up 3 of the 5 in 9. Presumably most new VOPs would be added one at a time, so having 2 available still gives us some room. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 17:35:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9164D106566B; Thu, 1 Mar 2012 17:35:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63C2B8FC0A; Thu, 1 Mar 2012 17:35:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21HZHG0088982; Thu, 1 Mar 2012 17:35:17 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21HZHpi088980; Thu, 1 Mar 2012 17:35:17 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201203011735.q21HZHpi088980@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 1 Mar 2012 17:35: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: r232347 - head/sbin/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: Thu, 01 Mar 2012 17:35:17 -0000 Author: luigi Date: Thu Mar 1 17:35:16 2012 New Revision: 232347 URL: http://svn.freebsd.org/changeset/base/232347 Log: remove some write-only variables. There is another block of code that is now useless as the computation is done in the kernel. Modified: head/sbin/ipfw/dummynet.c Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Thu Mar 1 16:40:12 2012 (r232346) +++ head/sbin/ipfw/dummynet.c Thu Mar 1 17:35:16 2012 (r232347) @@ -761,7 +761,6 @@ ipfw_config_pipe(int ac, char **av) { int i, j; char *end; - void *par = NULL; struct dn_id *buf, *base; struct dn_sch *sch = NULL; struct dn_link *p = NULL; @@ -905,7 +904,6 @@ ipfw_config_pipe(int ac, char **av) * per-flow queue, mask is dst_ip, dst_port, * src_ip, src_port, proto measured in bits */ - par = NULL; bzero(mask, sizeof(*mask)); end = NULL; @@ -1179,7 +1177,6 @@ end_mask: if (fs->flags & DN_IS_RED) { size_t len; int lookup_depth, avg_pkt_size; - double w_q; if (fs->min_th >= fs->max_th) errx(EX_DATAERR, "min_th %d must be < than max_th %d", @@ -1205,6 +1202,7 @@ end_mask: "net.inet.ip.dummynet.red_avg_pkt_size must" " be greater than zero"); +#if 0 /* the following computation is now done in the kernel */ /* * Ticks needed for sending a medium-sized packet. * Unfortunately, when we are configuring a WF2Q+ queue, we @@ -1214,19 +1212,16 @@ end_mask: * correct. But on the other hand, why do we want RED with * WF2Q+ ? */ -#if 0 if (p.bandwidth==0) /* this is a WF2Q+ queue */ s = 0; else s = (double)ck.hz * avg_pkt_size * 8 / p.bandwidth; -#endif /* * max idle time (in ticks) before avg queue size becomes 0. * NOTA: (3/w_q) is approx the value x so that * (1-w_q)^x < 10^-3. */ w_q = ((double)fs->w_q) / (1 << SCALE_RED); -#if 0 // go in kernel idle = s * 3. / w_q; fs->lookup_step = (int)idle / lookup_depth; if (!fs->lookup_step) @@ -1235,7 +1230,7 @@ end_mask: for (t = fs->lookup_step; t > 1; --t) weight *= 1 - w_q; fs->lookup_weight = (int)(weight * (1 << SCALE_RED)); -#endif +#endif /* code moved in the kernel */ } } From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 17:51:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7286E106567F; Thu, 1 Mar 2012 17:51:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42ECC8FC29; Thu, 1 Mar 2012 17:51:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21HpGEZ089493; Thu, 1 Mar 2012 17:51:16 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21HpGt4089490; Thu, 1 Mar 2012 17:51:16 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203011751.q21HpGt4089490@svn.freebsd.org> From: Dimitry Andric Date: Thu, 1 Mar 2012 17:51:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232348 - in stable/9/sys: conf modules/hpt27xx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 17:51:16 -0000 Author: dim Date: Thu Mar 1 17:51:15 2012 New Revision: 232348 URL: http://svn.freebsd.org/changeset/base/232348 Log: MFC r231982: When building with clang, disable -Wformat-security for sys/dev/hpt27xx/osm_bsd.c, since it gets the following warnings: sys/dev/hpt27xx/osm_bsd.c:1180:25: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] S_IRUSR | S_IWUSR, driver_name); ^~~~~~~~~~~ @/dev/hpt27xx/hpt27xx_config.h:46:21: note: expanded from: #define driver_name hpt27xx_driver_name ^~~~~~~~~~~~~~~~~~~ Since 'hpt27xx_driver_name' is a constant string symbol (coming from the proprietary hpt27xx_lib.o file), there is no security problem. Because this driver is provided by the vendor, and applying changes requires re-certification and other bureaucratic exercises, just disable the warning for now. Modified: stable/9/sys/conf/kern.mk stable/9/sys/modules/hpt27xx/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Thu Mar 1 17:35:16 2012 (r232347) +++ stable/9/sys/conf/kern.mk Thu Mar 1 17:51:15 2012 (r232348) @@ -22,6 +22,7 @@ NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-cou NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow NO_WUNUSED_VALUE= -Wno-unused-value NO_WSELF_ASSIGN= -Wno-self-assign +NO_WFORMAT_SECURITY= -Wno-format-security # Several other warnings which might be useful in some cases, but not severe # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. Modified: stable/9/sys/modules/hpt27xx/Makefile ============================================================================== --- stable/9/sys/modules/hpt27xx/Makefile Thu Mar 1 17:35:16 2012 (r232347) +++ stable/9/sys/modules/hpt27xx/Makefile Thu Mar 1 17:51:15 2012 (r232348) @@ -12,3 +12,6 @@ hpt27xx_lib.o: uudecode -p < ${HPT27XX}/$(MACHINE_ARCH)-elf.hpt27xx_lib.o.uu > ${.TARGET} .include + +CWARNFLAGS.osm_bsd.c= ${NO_WFORMAT_SECURITY} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 17:54:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CA78106566B; Thu, 1 Mar 2012 17:54:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07FD58FC08; Thu, 1 Mar 2012 17:54:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21Hs7bl089628; Thu, 1 Mar 2012 17:54:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21Hs7XX089626; Thu, 1 Mar 2012 17:54:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203011754.q21Hs7XX089626@svn.freebsd.org> From: Dimitry Andric Date: Thu, 1 Mar 2012 17:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232349 - stable/9/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 17:54:08 -0000 Author: dim Date: Thu Mar 1 17:54:07 2012 New Revision: 232349 URL: http://svn.freebsd.org/changeset/base/232349 Log: MFC r232074: Use a better way to silence unneeded internal declaration warnings in several sys/cam/ctl files. Suggested by: ed Reviewed by: ken Modified: stable/9/sys/cam/ctl/ctl_private.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/9/sys/cam/ctl/ctl_private.h Thu Mar 1 17:51:15 2012 (r232348) +++ stable/9/sys/cam/ctl/ctl_private.h Thu Mar 1 17:54:07 2012 (r232349) @@ -297,7 +297,7 @@ struct ctl_page_index { #define CTL_PAGE_DEFAULT 0x02 #define CTL_PAGE_SAVED 0x03 -static struct ctl_page_index page_index_template[] = { +static const struct ctl_page_index page_index_template[] = { {SMS_FORMAT_DEVICE_PAGE, 0, sizeof(struct scsi_format_page), NULL, CTL_PAGE_FLAG_DISK_ONLY, NULL, NULL}, {SMS_RIGID_DISK_PAGE, 0, sizeof(struct scsi_rigid_disk_page), NULL, From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 18:17:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 984D1106566B; Thu, 1 Mar 2012 18:17:45 +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 83AE48FC17; Thu, 1 Mar 2012 18:17:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21IHj0i090404; Thu, 1 Mar 2012 18:17:45 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21IHja2090402; Thu, 1 Mar 2012 18:17:45 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201203011817.q21IHja2090402@svn.freebsd.org> From: Jaakko Heinonen Date: Thu, 1 Mar 2012 18:17: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: r232350 - 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, 01 Mar 2012 18:17:45 -0000 Author: jh Date: Thu Mar 1 18:17:45 2012 New Revision: 232350 URL: http://svn.freebsd.org/changeset/base/232350 Log: Since r199137 namei() returns EINVAL for DELETE and RENAME operations if the last component of the pathname is ".". Reviewed by: kib MFC after: 1 week Modified: head/share/man/man9/namei.9 Modified: head/share/man/man9/namei.9 ============================================================================== --- head/share/man/man9/namei.9 Thu Mar 1 17:54:07 2012 (r232349) +++ head/share/man/man9/namei.9 Thu Mar 1 18:17:45 2012 (r232350) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 21, 2005 +.Dd March 1, 2012 .Dt NAMEI 9 .Os .Sh NAME @@ -340,6 +340,13 @@ permissions. Too many symbolic links were encountered in translating the pathname. .It Bq Er EISDIR An attempt is made to open a directory with write mode specified. +.It Bq Er EINVAL +The last component of the pathname specified for a +.Dv DELETE +or +.Dv RENAME +operation is +.Ql \&. . .It Bq Er EROFS An attempt is made to modify a file or directory on a read-only file system. .El From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 18:45:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55ABB106566C; Thu, 1 Mar 2012 18:45:26 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F0678FC17; Thu, 1 Mar 2012 18:45:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21IjQsv091359; Thu, 1 Mar 2012 18:45:26 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21IjQqt091350; Thu, 1 Mar 2012 18:45:26 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201203011845.q21IjQqt091350@svn.freebsd.org> From: Kirk McKusick Date: Thu, 1 Mar 2012 18:45: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: r232351 - in head/sys: kern sys ufs/ffs ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 18:45:26 -0000 Author: mckusick Date: Thu Mar 1 18:45:25 2012 New Revision: 232351 URL: http://svn.freebsd.org/changeset/base/232351 Log: This change avoids a kernel deadlock on "snaplk" when using snapshots on UFS filesystems running with journaled soft updates. This is the first of several bugs that need to be fixed before removing the restriction added in -r230250 to prevent the use of snapshots on filesystems running with journaled soft updates. The deadlock occurs when holding the snapshot lock (snaplk) and then trying to flush an inode via ffs_update(). We become blocked by another process trying to flush a different inode contained in the same inode block that we need. It holds the inode block for which we are waiting locked. When it tries to write the inode block, it gets blocked waiting for the our snaplk when it calls ffs_copyonwrite() to see if the inode block needs to be copied in our snapshot. The most obvious place that this deadlock arises is in the ffs_copyonwrite() routine when it updates critical metadata in a snapshot and tries to write it out before proceeding. The fix here is to write the data and indirect block pointer for the snapshot, but to skip the call to ffs_update() to write the snapshot inode. To ensure that we will never have to update a pointer in the inode itself, the ffs_snapshot() routine that creates the snapshot has to ensure that all the direct blocks are allocated as part of the creation of the snapshot. A less obvious place that this deadlock occurs is when we hold the snaplk because we are deleting a snapshot. In the course of doing the deletion, we need to allocate various soft update dependency structures and allocate some journal space. If we hit a resource limit while doing this we decrease the resources in use by flushing out an existing dirty file to get it to give up the soft dependency resources that it holds. The flush can cause an ffs_update() to be done on the inode for the file that we have selected to flush resulting in the same deadlock as described above when the inode that we have chosen to flush resides in the same inode block as the snapshot inode that we hold. The fix is to defer cleaning up any time that the inode on which we are operating is a snapshot. Help and review by: Jeff Roberson Tested by: Peter Holm MFC (to 9 only) after: 2 weeks Modified: head/sys/kern/vfs_bio.c head/sys/sys/buf.h head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/inode.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/kern/vfs_bio.c Thu Mar 1 18:45:25 2012 (r232351) @@ -782,21 +782,6 @@ bremfreel(struct buf *bp) } } - -/* - * Get a buffer with the specified data. Look in the cache first. We - * must clear BIO_ERROR and B_INVAL prior to initiating I/O. If B_CACHE - * is set, the buffer is valid and we do not have to do anything ( see - * getblk() ). This is really just a special case of breadn(). - */ -int -bread(struct vnode * vp, daddr_t blkno, int size, struct ucred * cred, - struct buf **bpp) -{ - - return (breadn(vp, blkno, size, 0, 0, 0, cred, bpp)); -} - /* * Attempt to initiate asynchronous I/O on read-ahead blocks. We must * clear BIO_ERROR and B_INVAL prior to initiating I/O . If B_CACHE is set, @@ -834,19 +819,28 @@ breada(struct vnode * vp, daddr_t * rabl } /* - * Operates like bread, but also starts asynchronous I/O on - * read-ahead blocks. + * Entry point for bread() and breadn() via #defines in sys/buf.h. + * + * Get a buffer with the specified data. Look in the cache first. We + * must clear BIO_ERROR and B_INVAL prior to initiating I/O. If B_CACHE + * is set, the buffer is valid and we do not have to do anything, see + * getblk(). Also starts asynchronous I/O on read-ahead blocks. */ int -breadn(struct vnode * vp, daddr_t blkno, int size, - daddr_t * rablkno, int *rabsize, - int cnt, struct ucred * cred, struct buf **bpp) +breadn_flags(struct vnode * vp, daddr_t blkno, int size, + daddr_t * rablkno, int *rabsize, int cnt, + struct ucred * cred, int flags, struct buf **bpp) { struct buf *bp; int rv = 0, readwait = 0; CTR3(KTR_BUF, "breadn(%p, %jd, %d)", vp, blkno, size); - *bpp = bp = getblk(vp, blkno, size, 0, 0, 0); + /* + * Can only return NULL if GB_LOCK_NOWAIT flag is specified. + */ + *bpp = bp = getblk(vp, blkno, size, 0, 0, flags); + if (bp == NULL) + return (EBUSY); /* if not found in cache, do some I/O */ if ((bp->b_flags & B_CACHE) == 0) { Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/sys/buf.h Thu Mar 1 18:45:25 2012 (r232351) @@ -479,10 +479,13 @@ void bwillwrite(void); int buf_dirty_count_severe(void); void bremfree(struct buf *); void bremfreef(struct buf *); /* XXX Force bremfree, only for nfs. */ -int bread(struct vnode *, daddr_t, int, struct ucred *, struct buf **); +#define bread(vp, blkno, size, cred, bpp) \ + breadn_flags(vp, blkno, size, 0, 0, 0, cred, 0, bpp) +#define breadn(vp, blkno, size, rablkno, rabsize, cnt, cred, bpp) \ + breadn_flags(vp, blkno, size, rablkno, rabsize, cnt, cred, 0, bpp) +int breadn_flags(struct vnode *, daddr_t, int, daddr_t *, int *, int, + struct ucred *, int, struct buf **); void breada(struct vnode *, daddr_t *, int *, int, struct ucred *); -int breadn(struct vnode *, daddr_t, int, daddr_t *, int *, int, - struct ucred *, struct buf **); void bdwrite(struct buf *); void bawrite(struct buf *); void bdirty(struct buf *); Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/ufs/ffs/ffs_extern.h Thu Mar 1 18:45:25 2012 (r232351) @@ -167,6 +167,13 @@ void softdep_freework(struct workhead *) #define FLUSH_INODES_WAIT 2 #define FLUSH_BLOCKS 3 #define FLUSH_BLOCKS_WAIT 4 +/* + * Flag to ffs_syncinode() to request flushing of data only, + * but skip the ffs_update() on the inode itself. Used to avoid + * deadlock when flushing snapshot inodes while holding snaplk. + * Avoid bit conflicts with MNT_WAIT values in sys/mount.h + */ +#define NO_INO_UPDT 0x10 int ffs_rdonly(struct inode *); Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/ufs/ffs/ffs_inode.c Thu Mar 1 18:45:25 2012 (r232351) @@ -81,7 +81,7 @@ ffs_update(vp, waitfor) struct fs *fs; struct buf *bp; struct inode *ip; - int error; + int flags, error; ASSERT_VOP_ELOCKED(vp, "ffs_update"); ufs_itimes(vp); @@ -92,11 +92,36 @@ ffs_update(vp, waitfor) fs = ip->i_fs; if (fs->fs_ronly && ip->i_ump->um_fsckpid == 0) return (0); - error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), - (int)fs->fs_bsize, NOCRED, &bp); - if (error) { - brelse(bp); - return (error); + /* + * If we are updating a snapshot and another process is currently + * writing the buffer containing the inode for this snapshot then + * a deadlock can occur when it tries to check the snapshot to see + * if that block needs to be copied. Thus when updating a snapshot + * we check to see if the buffer is already locked, and if it is + * we drop the snapshot lock until the buffer has been written + * and is available to us. We have to grab a reference to the + * snapshot vnode to prevent it from being removed while we are + * waiting for the buffer. + */ + flags = 0; + if (IS_SNAPSHOT(ip)) + flags = GB_LOCK_NOWAIT; + error = breadn_flags(ip->i_devvp, + fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int) fs->fs_bsize, 0, 0, 0, NOCRED, flags, &bp); + if (error != 0) { + if (error != EBUSY) { + brelse(bp); + return (error); + } + KASSERT((IS_SNAPSHOT(ip)), ("EBUSY from non-snapshot")); + vref(vp); /* Protect against ffs_snapgone() */ + VOP_UNLOCK(vp, 0); + (void) bread(ip->i_devvp, + fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int) fs->fs_bsize, NOCRED, &bp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vrele(vp); } if (DOINGSOFTDEP(vp)) softdep_update_inodeblock(ip, bp, waitfor); @@ -108,16 +133,16 @@ ffs_update(vp, waitfor) else *((struct ufs2_dinode *)bp->b_data + ino_to_fsbo(fs, ip->i_number)) = *ip->i_din2; - if (waitfor && !DOINGASYNC(vp)) { - return (bwrite(bp)); - } else if (vm_page_count_severe() || buf_dirty_count_severe()) { - return (bwrite(bp)); + if ((waitfor && !DOINGASYNC(vp)) || + (vm_page_count_severe() || buf_dirty_count_severe())) { + error = bwrite(bp); } else { if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); - return (0); + error = 0; } + return (error); } #define SINGLE 0 /* index of single indirect block */ @@ -253,7 +278,7 @@ ffs_truncate(vp, length, flags, cred, td } if (fs->fs_ronly) panic("ffs_truncate: read-only filesystem"); - if ((ip->i_flags & SF_SNAPSHOT) != 0) + if (IS_SNAPSHOT(ip)) ffs_snapremove(vp); vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0; osize = ip->i_size; Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/ufs/ffs/ffs_snapshot.c Thu Mar 1 18:45:25 2012 (r232351) @@ -203,6 +203,7 @@ ffs_snapshot(mp, snapfile) ufs2_daddr_t numblks, blkno, *blkp, *snapblklist; int error, cg, snaploc; int i, size, len, loc; + ufs2_daddr_t blockno; uint64_t flag; struct timespec starttime = {0, 0}, endtime; char saved_nice = 0; @@ -529,7 +530,7 @@ loop: (xvp->v_usecount == 0 && (xvp->v_iflag & (VI_OWEINACT | VI_DOINGINACT)) == 0) || xvp->v_type == VNON || - (VTOI(xvp)->i_flags & SF_SNAPSHOT)) { + IS_SNAPSHOT(VTOI(xvp))) { VI_UNLOCK(xvp); MNT_ILOCK(mp); continue; @@ -815,21 +816,26 @@ out1: if (space != NULL) free(space, M_UFSMNT); /* - * If another process is currently writing the buffer containing - * the inode for this snapshot then a deadlock can occur. Drop - * the snapshot lock until the buffer has been written. + * Preallocate all the direct blocks in the snapshot inode so + * that we never have to write the inode itself to commit an + * update to the contents of the snapshot. Note that once + * created, the size of the snapshot will never change, so + * there will never be a need to write the inode except to + * update the non-integrity-critical time fields and + * allocated-block count. */ - VREF(vp); /* Protect against ffs_snapgone() */ - VOP_UNLOCK(vp, 0); - (void) bread(ip->i_devvp, - fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), - (int) fs->fs_bsize, NOCRED, &nbp); - brelse(nbp); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (ip->i_effnlink == 0) - error = ENOENT; /* Snapshot file unlinked */ - else - vrele(vp); /* Drop extra reference */ + for (blockno = 0; blockno < NDADDR; blockno++) { + if (DIP(ip, i_db[blockno]) != 0) + continue; + error = UFS_BALLOC(vp, lblktosize(fs, blockno), + fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); + if (error) + break; + error = readblock(vp, bp, blockno); + bawrite(bp); + if (error != 0) + break; + } done: free(copy_fs->fs_csp, M_UFSMNT); free(copy_fs, M_UFSMNT); @@ -1902,7 +1908,7 @@ retry: bawrite(cbp); if ((vtype == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); continue; } /* @@ -1913,7 +1919,7 @@ retry: bawrite(cbp); if ((vtype == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); break; } savedcbp = cbp; @@ -1931,7 +1937,7 @@ retry: bawrite(savedcbp); if ((vtype == VDIR || dopersistence) && VTOI(vp)->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); } /* * If we have been unable to allocate a block in which to do @@ -1987,9 +1993,9 @@ ffs_snapshot_mount(mp) continue; } ip = VTOI(vp); - if ((ip->i_flags & SF_SNAPSHOT) == 0 || ip->i_size == + if (!IS_SNAPSHOT(ip) || ip->i_size == lblktosize(fs, howmany(fs->fs_size, fs->fs_frag))) { - if ((ip->i_flags & SF_SNAPSHOT) == 0) { + if (!IS_SNAPSHOT(ip)) { reason = "non-snapshot"; } else { reason = "old format snapshot"; @@ -2250,7 +2256,7 @@ ffs_copyonwrite(devvp, bp) int launched_async_io, prev_norunningbuf; long saved_runningbufspace; - if (devvp != bp->b_vp && (VTOI(bp->b_vp)->i_flags & SF_SNAPSHOT) != 0) + if (devvp != bp->b_vp && IS_SNAPSHOT(VTOI(bp->b_vp))) return (0); /* Update on a snapshot file */ if (td->td_pflags & TDP_COWINPROGRESS) panic("ffs_copyonwrite: recursive call"); @@ -2395,7 +2401,7 @@ ffs_copyonwrite(devvp, bp) bawrite(cbp); if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); else launched_async_io = 1; continue; @@ -2408,7 +2414,7 @@ ffs_copyonwrite(devvp, bp) bawrite(cbp); if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR || dopersistence) && ip->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); else launched_async_io = 1; break; @@ -2428,7 +2434,7 @@ ffs_copyonwrite(devvp, bp) bawrite(savedcbp); if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR || dopersistence) && VTOI(vp)->i_effnlink > 0) - (void) ffs_syncvnode(vp, MNT_WAIT); + (void) ffs_syncvnode(vp, MNT_WAIT|NO_INO_UPDT); else launched_async_io = 1; } @@ -2478,7 +2484,7 @@ ffs_sync_snap(mp, waitfor) } TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) { vp = ITOV(ip); - ffs_syncvnode(vp, waitfor); + ffs_syncvnode(vp, waitfor|NO_INO_UPDT); } lockmgr(&sn->sn_lock, LK_RELEASE, NULL); } Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Mar 1 18:45:25 2012 (r232351) @@ -2827,7 +2827,12 @@ softdep_prealloc(vp, waitok) { struct ufsmount *ump; - if (DOINGSUJ(vp) == 0) + /* + * Nothing to do if we are not running journaled soft updates. + * If we currently hold the snapshot lock, we must avoid handling + * other resources that could cause deadlock. + */ + if (DOINGSUJ(vp) == 0 || IS_SNAPSHOT(VTOI(vp))) return (0); ump = VFSTOUFS(vp->v_mount); ACQUIRE_LOCK(&lk); @@ -2873,7 +2878,12 @@ softdep_prelink(dvp, vp) ump = VFSTOUFS(dvp->v_mount); mtx_assert(&lk, MA_OWNED); - if (journal_space(ump, 0)) + /* + * Nothing to do if we have sufficient journal space. + * If we currently hold the snapshot lock, we must avoid + * handling other resources that could cause deadlock. + */ + if (journal_space(ump, 0) || (vp && IS_SNAPSHOT(VTOI(vp)))) return; stat_journal_low++; FREE_LOCK(&lk); @@ -4304,11 +4314,15 @@ inodedep_lookup_ip(ip) struct inode *ip; { struct inodedep *inodedep; + int dflags; KASSERT(ip->i_nlink >= ip->i_effnlink, ("inodedep_lookup_ip: bad delta")); - (void) inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, - DEPALLOC, &inodedep); + dflags = DEPALLOC; + if (IS_SNAPSHOT(ip)) + dflags |= NODELAY; + (void) inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, dflags, + &inodedep); inodedep->id_nlinkdelta = ip->i_nlink - ip->i_effnlink; return (inodedep); @@ -4696,7 +4710,7 @@ softdep_setup_inomapdep(bp, ip, newinum, * the cylinder group map from which it was allocated. */ ACQUIRE_LOCK(&lk); - if ((inodedep_lookup(mp, newinum, DEPALLOC|NODELAY, &inodedep))) + if ((inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep))) panic("softdep_setup_inomapdep: dependency %p for new" "inode already exists", inodedep); bmsafemap = bmsafemap_lookup(mp, bp, ino_to_cg(fs, newinum)); @@ -5437,6 +5451,7 @@ softdep_setup_allocindir_page(ip, lbn, b struct allocindir *aip; struct pagedep *pagedep; struct mount *mp; + int dflags; if (lbn != nbp->b_lblkno) panic("softdep_setup_allocindir_page: lbn %jd != lblkno %jd", @@ -5444,7 +5459,10 @@ softdep_setup_allocindir_page(ip, lbn, b ASSERT_VOP_LOCKED(ITOV(ip), "softdep_setup_allocindir_page"); mp = UFSTOVFS(ip->i_ump); aip = newallocindir(ip, ptrno, newblkno, oldblkno, lbn); - (void) inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep); + dflags = DEPALLOC; + if (IS_SNAPSHOT(ip)) + dflags |= NODELAY; + (void) inodedep_lookup(mp, ip->i_number, dflags, &inodedep); /* * If we are allocating a directory page, then we must * allocate an associated pagedep to track additions and @@ -5474,11 +5492,15 @@ softdep_setup_allocindir_meta(nbp, ip, b struct inodedep *inodedep; struct allocindir *aip; ufs_lbn_t lbn; + int dflags; lbn = nbp->b_lblkno; ASSERT_VOP_LOCKED(ITOV(ip), "softdep_setup_allocindir_meta"); aip = newallocindir(ip, ptrno, newblkno, 0, lbn); - inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, DEPALLOC, &inodedep); + dflags = DEPALLOC; + if (IS_SNAPSHOT(ip)) + dflags |= NODELAY; + inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, dflags, &inodedep); WORKLIST_INSERT(&nbp->b_dep, &aip->ai_block.nb_list); if (setup_allocindir_phase2(bp, ip, inodedep, aip, lbn)) panic("softdep_setup_allocindir_meta: Block already existed"); @@ -6085,11 +6107,7 @@ softdep_journal_freeblocks(ip, cred, len struct mount *mp; ufs2_daddr_t extblocks, datablocks; ufs_lbn_t tmpval, lbn, lastlbn; - int frags; - int lastoff, iboff; - int allocblock; - int error, i; - int needj; + int frags, lastoff, iboff, allocblock, needj, dflags, error, i; fs = ip->i_fs; mp = UFSTOVFS(ip->i_ump); @@ -6107,7 +6125,10 @@ softdep_journal_freeblocks(ip, cred, len * we don't need to journal the block frees. The canceled journals * for the allocations will suffice. */ - inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep); + dflags = DEPALLOC; + if (IS_SNAPSHOT(ip)) + dflags |= NODELAY; + inodedep_lookup(mp, ip->i_number, dflags, &inodedep); if ((inodedep->id_state & (UNLINKED | DEPCOMPLETE)) == UNLINKED && length == 0) needj = 0; @@ -6232,7 +6253,7 @@ softdep_journal_freeblocks(ip, cred, len *((struct ufs2_dinode *)bp->b_data + ino_to_fsbo(fs, ip->i_number)) = *ip->i_din2; ACQUIRE_LOCK(&lk); - (void) inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep); + (void) inodedep_lookup(mp, ip->i_number, dflags, &inodedep); if ((inodedep->id_state & IOSTARTED) != 0) panic("softdep_setup_freeblocks: inode busy"); /* @@ -6310,7 +6331,7 @@ softdep_journal_freeblocks(ip, cred, len } ACQUIRE_LOCK(&lk); - inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep); + inodedep_lookup(mp, ip->i_number, dflags, &inodedep); TAILQ_INSERT_TAIL(&inodedep->id_freeblklst, freeblks, fb_next); freeblks->fb_state |= DEPCOMPLETE | ONDEPLIST; /* @@ -6398,7 +6419,7 @@ softdep_setup_freeblocks(ip, length, fla struct fs *fs; ufs2_daddr_t extblocks, datablocks; struct mount *mp; - int i, delay, error; + int i, delay, error, dflags; ufs_lbn_t tmpval; ufs_lbn_t lbn; @@ -6463,7 +6484,10 @@ softdep_setup_freeblocks(ip, length, fla * Find and eliminate any inode dependencies. */ ACQUIRE_LOCK(&lk); - (void) inodedep_lookup(mp, ip->i_number, DEPALLOC, &inodedep); + dflags = DEPALLOC; + if (IS_SNAPSHOT(ip)) + dflags |= NODELAY; + (void) inodedep_lookup(mp, ip->i_number, dflags, &inodedep); if ((inodedep->id_state & IOSTARTED) != 0) panic("softdep_setup_freeblocks: inode busy"); /* @@ -8029,7 +8053,7 @@ softdep_setup_directory_add(bp, dp, diro dap->da_pagedep = pagedep; LIST_INSERT_HEAD(&pagedep->pd_diraddhd[DIRADDHASH(offset)], dap, da_pdlist); - inodedep_lookup(mp, newinum, DEPALLOC, &inodedep); + inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep); /* * If we're journaling, link the diradd into the jaddref so it * may be completed after the journal entry is written. Otherwise, @@ -8631,8 +8655,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirre * the number of freefile and freeblks structures. */ ACQUIRE_LOCK(&lk); - if (!(ip->i_flags & SF_SNAPSHOT) && - dep_current[D_DIRREM] > max_softdeps / 2) + if (!IS_SNAPSHOT(ip) && dep_current[D_DIRREM] > max_softdeps / 2) (void) request_cleanup(ITOV(dp)->v_mount, FLUSH_BLOCKS); FREE_LOCK(&lk); dirrem = malloc(sizeof(struct dirrem), @@ -8866,11 +8889,11 @@ softdep_setup_directory_change(bp, dp, i /* * Lookup the jaddref for this journal entry. We must finish * initializing it and make the diradd write dependent on it. - * If we're not journaling Put it on the id_bufwait list if the inode - * is not yet written. If it is written, do the post-inode write - * processing to put it on the id_pendinghd list. + * If we're not journaling, put it on the id_bufwait list if the + * inode is not yet written. If it is written, do the post-inode + * write processing to put it on the id_pendinghd list. */ - inodedep_lookup(mp, newinum, DEPALLOC, &inodedep); + inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep); if (MOUNTEDSUJ(mp)) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); @@ -8912,9 +8935,13 @@ softdep_change_linkcnt(ip) struct inode *ip; /* the inode with the increased link count */ { struct inodedep *inodedep; + int dflags; ACQUIRE_LOCK(&lk); - inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, DEPALLOC, &inodedep); + dflags = DEPALLOC; + if (IS_SNAPSHOT(ip)) + dflags |= NODELAY; + inodedep_lookup(UFSTOVFS(ip->i_ump), ip->i_number, dflags, &inodedep); if (ip->i_nlink < ip->i_effnlink) panic("softdep_change_linkcnt: bad delta"); inodedep->id_nlinkdelta = ip->i_nlink - ip->i_effnlink; @@ -12544,22 +12571,25 @@ softdep_request_cleanup(fs, vp, cred, re ufs2_daddr_t needed; int error; - mp = vp->v_mount; - ump = VFSTOUFS(mp); - mtx_assert(UFS_MTX(ump), MA_OWNED); - if (resource == FLUSH_BLOCKS_WAIT) - stat_cleanup_blkrequests += 1; - else - stat_cleanup_inorequests += 1; - /* * If we are being called because of a process doing a * copy-on-write, then it is not safe to process any * worklist items as we will recurse into the copyonwrite * routine. This will result in an incoherent snapshot. + * If the vnode that we hold is a snapshot, we must avoid + * handling other resources that could cause deadlock. */ - if (curthread->td_pflags & TDP_COWINPROGRESS) + if ((curthread->td_pflags & TDP_COWINPROGRESS) || IS_SNAPSHOT(VTOI(vp))) return (0); + + if (resource == FLUSH_BLOCKS_WAIT) + stat_cleanup_blkrequests += 1; + else + stat_cleanup_inorequests += 1; + + mp = vp->v_mount; + ump = VFSTOUFS(mp); + mtx_assert(UFS_MTX(ump), MA_OWNED); UFS_UNLOCK(ump); error = ffs_update(vp, 1); if (error != 0) { Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/ufs/ffs/ffs_vnops.c Thu Mar 1 18:45:25 2012 (r232351) @@ -216,8 +216,10 @@ ffs_syncvnode(struct vnode *vp, int wait struct buf *bp; struct buf *nbp; ufs_lbn_t lbn; - int error, wait, passes; + int error, wait, passes, noupdate; + noupdate = waitfor & NO_INO_UPDT; + waitfor &= ~NO_INO_UPDT; ip = VTOI(vp); ip->i_flag &= ~IN_NEEDSYNC; bo = &vp->v_bufobj; @@ -300,7 +302,10 @@ next: } if (waitfor != MNT_WAIT) { BO_UNLOCK(bo); - return (ffs_update(vp, waitfor)); + if (noupdate) + return (0); + else + return (ffs_update(vp, waitfor)); } /* Drain IO to see if we're done. */ bufobj_wwait(bo, 0, 0); @@ -317,7 +322,7 @@ next: */ if (bo->bo_dirty.bv_cnt > 0) { /* Write the inode after sync passes to flush deps. */ - if (wait && DOINGSOFTDEP(vp)) { + if (wait && DOINGSOFTDEP(vp) && noupdate == 0) { BO_UNLOCK(bo); ffs_update(vp, MNT_WAIT); BO_LOCK(bo); @@ -332,7 +337,9 @@ next: #endif } BO_UNLOCK(bo); - error = ffs_update(vp, MNT_WAIT); + error = 0; + if (noupdate == 0) + error = ffs_update(vp, MNT_WAIT); if (DOINGSUJ(vp)) softdep_journal_fsync(VTOI(vp)); return (error); Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Thu Mar 1 18:17:45 2012 (r232350) +++ head/sys/ufs/ufs/inode.h Thu Mar 1 18:45:25 2012 (r232351) @@ -158,6 +158,7 @@ struct inode { #define SHORTLINK(ip) \ (((ip)->i_ump->um_fstype == UFS1) ? \ (caddr_t)(ip)->i_din1->di_db : (caddr_t)(ip)->i_din2->di_db) +#define IS_SNAPSHOT(ip) ((ip)->i_flags & SF_SNAPSHOT) /* * Structure used to pass around logical block paths generated by From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 19:09:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2974B1065672; Thu, 1 Mar 2012 19:09:29 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11C228FC17; Thu, 1 Mar 2012 19:09:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21J9TK2092124; Thu, 1 Mar 2012 19:09:29 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21J9STU092118; Thu, 1 Mar 2012 19:09:28 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201203011909.q21J9STU092118@svn.freebsd.org> From: "Justin T. Gibbs" Date: Thu, 1 Mar 2012 19:09:28 +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: r232352 - in stable/8/sys: dev/xen/blkback dev/xen/blkfront xen/interface/io xen/xenbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 19:09:29 -0000 Author: gibbs Date: Thu Mar 1 19:09:28 2012 New Revision: 232352 URL: http://svn.freebsd.org/changeset/base/232352 Log: MFC r231743,231836-231837,231839,231883,232308 Xen PV block interface enhancements Approved by: re (kib) Reviewed by: cperciva Tested by: cperciva Sponsored by: Spectra Logic Corporation r231743 ======= Enhance documentation, improve interoperability, and fix defects in FreeBSD's front and back Xen blkif interface drivers. sys/dev/xen/blkfront/block.h: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: Replace FreeBSD specific multi-page ring impelementation with support for both the Citrix and Amazon/RedHat versions of this extension. sys/dev/xen/blkfront/blkfront.c: o Add a per-instance sysctl tree that exposes all negotiated transport parameters (ring pages, max number of requests, max request size, max number of segments). o In blkfront_vdevice_to_unit() add a missing return statement so that we properly identify the unit number for high numbered xvd devices. sys/dev/xen/blkback/blkback.c: o Add static dtrace probes for several events in this driver. o Defer connection shutdown processing until the front-end enters the closed state. This avoids prematurely tearing down the connection when buggy front-ends transition to the closing state, even though the device is open and they veto the close request from the tool stack. o Add nodes for maximum request size and the number of active ring pages to the exising, per-instance, sysctl tree. o Miscelaneous style cleanup. sys/xen/interface/io/blkif.h: o Add extensive documentation of the XenStore nodes used to implement the blkif interface. o Document the startup sequence between a front and back driver. o Add structures and documenatation for the "discard" feature (AKA Trim). o Cleanup some definitions related to FreeBSD's request number/size/segment-limit extension. sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: sys/xen/xenbus/xenbusvar.h: Add the convenience function xenbus_get_otherend_state() and use it to simplify some logic in both block-front and block-back. r231836 ======= Fix "_" vs. "-" typo in a comment. No functional changes. r231837 ======= Fix typo in a printf string: "specificed" -> "specified". r231839 ======= Fix a bug in the calculation of the maximum I/O request size. The previous code did not limit the I/O request size based on the maximum number of segments supported by the back-end. In current practice, since the only back-end supporting chained requests is the FreeBSD implementation, this limit was never exceeded. sys/dev/xen/blkfront/block.h: Add two macros, XBF_SEGS_TO_SIZE() and XBF_SIZE_TO_SEGS(), to centralize the logic of reserving a segment to deal with non-page-aligned I/Os. sys/dev/xen/blkfront/blkfront.c: o When negotiating transfer parameters, limit the max_request_size we use and publish, if it is greater than the maximum, unaligned, I/O we can support with the number of segments advertised by the backend. o Don't unilaterally reduce the I/O size published to the disk layer by a single page. max_request_size is already properly limited in the transfer parameter negotiation code. o Fix typos in printf strings: "max_requests_segments" -> "max_request_segments" "specificed" -> "specified" r231883 ======= Fix regression in the handling of blkback close events for devices that are unplugged via QEMU. sys/dev/xen/blkback/blkback.c: Toolstack initiated closures change the frontend's state to Closing. The backend must change to Closing as well, even if we can't actually close yet, in order for the frontend to notice and start the closing process. r232308 ======= blkif interface comment cleanups. No functional changes sys/xen/interface/io/blkif.h: o Insert space in "Red Hat". o Fix typo "discard-aligment" -> "discard-alignment" o Fix typo "unamp" -> "unmap" o Fix typo "formated" -> "formatted" o Clarify the text for "params". o Clarify the text for "sector-size". o Clarify the text for "max-requests" in the backend section. Modified: stable/8/sys/dev/xen/blkback/blkback.c stable/8/sys/dev/xen/blkfront/blkfront.c stable/8/sys/dev/xen/blkfront/block.h stable/8/sys/xen/interface/io/blkif.h stable/8/sys/xen/xenbus/xenbusvar.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/xen/blkback/blkback.c ============================================================================== --- stable/8/sys/dev/xen/blkback/blkback.c Thu Mar 1 18:45:25 2012 (r232351) +++ stable/8/sys/dev/xen/blkback/blkback.c Thu Mar 1 19:09:28 2012 (r232352) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); * a FreeBSD domain to other domains. */ +#include "opt_kdtrace.h" + #include #include #include @@ -63,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -124,7 +127,7 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "Xen Block Back Driver Data"); #ifdef XBB_DEBUG -#define DPRINTF(fmt, args...) \ +#define DPRINTF(fmt, args...) \ printf("xbb(%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) #else #define DPRINTF(fmt, args...) do {} while(0) @@ -134,7 +137,7 @@ MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "X * The maximum mapped region size per request we will allow in a negotiated * block-front/back communication channel. */ -#define XBB_MAX_REQUEST_SIZE \ +#define XBB_MAX_REQUEST_SIZE \ MIN(MAXPHYS, BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) /** @@ -142,9 +145,9 @@ MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "X * segment blocks) per request we will allow in a negotiated block-front/back * communication channel. */ -#define XBB_MAX_SEGMENTS_PER_REQUEST \ - (MIN(UIO_MAXIOV, \ - MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ +#define XBB_MAX_SEGMENTS_PER_REQUEST \ + (MIN(UIO_MAXIOV, \ + MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ (XBB_MAX_REQUEST_SIZE / PAGE_SIZE) + 1))) /** @@ -980,9 +983,10 @@ xbb_get_gntaddr(struct xbb_xen_reqlist * static uint8_t * xbb_get_kva(struct xbb_softc *xbb, int nr_pages) { - intptr_t first_clear, num_clear; + intptr_t first_clear; + intptr_t num_clear; uint8_t *free_kva; - int i; + int i; KASSERT(nr_pages != 0, ("xbb_get_kva of zero length")); @@ -1681,19 +1685,19 @@ xbb_dispatch_io(struct xbb_softc *xbb, s req_ring_idx++; switch (xbb->abi) { case BLKIF_PROTOCOL_NATIVE: - sg = BLKRING_GET_SG_REQUEST(&xbb->rings.native, - req_ring_idx); + sg = BLKRING_GET_SEG_BLOCK(&xbb->rings.native, + req_ring_idx); break; case BLKIF_PROTOCOL_X86_32: { - sg = BLKRING_GET_SG_REQUEST(&xbb->rings.x86_32, - req_ring_idx); + sg = BLKRING_GET_SEG_BLOCK(&xbb->rings.x86_32, + req_ring_idx); break; } case BLKIF_PROTOCOL_X86_64: { - sg = BLKRING_GET_SG_REQUEST(&xbb->rings.x86_64, - req_ring_idx); + sg = BLKRING_GET_SEG_BLOCK(&xbb->rings.x86_64, + req_ring_idx); break; } default: @@ -1817,8 +1821,8 @@ xbb_run_queue(void *context, int pending struct xbb_xen_reqlist *reqlist; - xbb = (struct xbb_softc *)context; - rings = &xbb->rings; + xbb = (struct xbb_softc *)context; + rings = &xbb->rings; /* * Work gather and dispatch loop. Note that we have a bias here @@ -2032,6 +2036,13 @@ xbb_intr(void *arg) taskqueue_enqueue(xbb->io_taskqueue, &xbb->io_task); } +SDT_PROVIDER_DEFINE(xbb); +SDT_PROBE_DEFINE1(xbb, kernel, xbb_dispatch_dev, flush, flush, "int"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_dev, read, read, "int", "uint64_t", + "uint64_t"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_dev, write, write, "int", + "uint64_t", "uint64_t"); + /*----------------------------- Backend Handlers -----------------------------*/ /** * Backend handler for character device access. @@ -2087,6 +2098,9 @@ xbb_dispatch_dev(struct xbb_softc *xbb, nreq->pendcnt = 1; + SDT_PROBE1(xbb, kernel, xbb_dispatch_dev, flush, + device_get_unit(xbb->dev)); + (*dev_data->csw->d_strategy)(bio); return (0); @@ -2181,6 +2195,17 @@ xbb_dispatch_dev(struct xbb_softc *xbb, bios[bio_idx]->bio_bcount); } #endif + if (operation == BIO_READ) { + SDT_PROBE3(xbb, kernel, xbb_dispatch_dev, read, + device_get_unit(xbb->dev), + bios[bio_idx]->bio_offset, + bios[bio_idx]->bio_length); + } else if (operation == BIO_WRITE) { + SDT_PROBE3(xbb, kernel, xbb_dispatch_dev, write, + device_get_unit(xbb->dev), + bios[bio_idx]->bio_offset, + bios[bio_idx]->bio_length); + } (*dev_data->csw->d_strategy)(bios[bio_idx]); } @@ -2193,6 +2218,12 @@ fail_free_bios: return (error); } +SDT_PROBE_DEFINE1(xbb, kernel, xbb_dispatch_file, flush, flush, "int"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_file, read, read, "int", "uint64_t", + "uint64_t"); +SDT_PROBE_DEFINE3(xbb, kernel, xbb_dispatch_file, write, write, "int", + "uint64_t", "uint64_t"); + /** * Backend handler for file access. * @@ -2237,6 +2268,9 @@ xbb_dispatch_file(struct xbb_softc *xbb, case BIO_FLUSH: { struct mount *mountpoint; + SDT_PROBE1(xbb, kernel, xbb_dispatch_file, flush, + device_get_unit(xbb->dev)); + vfs_is_locked = VFS_LOCK_GIANT(xbb->vn->v_mount); (void) vn_start_write(xbb->vn, &mountpoint, V_WAIT); @@ -2336,6 +2370,10 @@ xbb_dispatch_file(struct xbb_softc *xbb, switch (operation) { case BIO_READ: + SDT_PROBE3(xbb, kernel, xbb_dispatch_file, read, + device_get_unit(xbb->dev), xuio.uio_offset, + xuio.uio_resid); + vn_lock(xbb->vn, LK_EXCLUSIVE | LK_RETRY); /* @@ -2366,6 +2404,10 @@ xbb_dispatch_file(struct xbb_softc *xbb, case BIO_WRITE: { struct mount *mountpoint; + SDT_PROBE3(xbb, kernel, xbb_dispatch_file, write, + device_get_unit(xbb->dev), xuio.uio_offset, + xuio.uio_resid); + (void)vn_start_write(xbb->vn, &mountpoint, V_WAIT); vn_lock(xbb->vn, LK_EXCLUSIVE | LK_RETRY); @@ -3028,6 +3070,8 @@ xbb_collect_frontend_info(struct xbb_sof const char *otherend_path; int error; u_int ring_idx; + u_int ring_page_order; + size_t ring_size; otherend_path = xenbus_get_otherend_path(xbb->dev); @@ -3035,23 +3079,19 @@ xbb_collect_frontend_info(struct xbb_sof * Protocol defaults valid even if all negotiation fails. */ xbb->ring_config.ring_pages = 1; - xbb->max_requests = BLKIF_MAX_RING_REQUESTS(PAGE_SIZE); xbb->max_request_segments = BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK; xbb->max_request_size = xbb->max_request_segments * PAGE_SIZE; /* * Mandatory data (used in all versions of the protocol) first. */ - error = xs_gather(XST_NIL, otherend_path, - "ring-ref", "%" PRIu32, - &xbb->ring_config.ring_ref[0], - "event-channel", "%" PRIu32, - &xbb->ring_config.evtchn, - NULL); + error = xs_scanf(XST_NIL, otherend_path, + "event-channel", NULL, "%" PRIu32, + &xbb->ring_config.evtchn); if (error != 0) { xenbus_dev_fatal(xbb->dev, error, - "Unable to retrieve ring information from " - "frontend %s. Unable to connect.", + "Unable to retrieve event-channel information " + "from frontend %s. Unable to connect.", xenbus_get_otherend_path(xbb->dev)); return (error); } @@ -3065,10 +3105,20 @@ xbb_collect_frontend_info(struct xbb_sof * we must use independant calls in order to guarantee * we don't miss information in a sparsly populated front-end * tree. + * + * \note xs_scanf() does not update variables for unmatched + * fields. */ + ring_page_order = 0; + (void)xs_scanf(XST_NIL, otherend_path, + "ring-page-order", NULL, "%u", + &ring_page_order); + xbb->ring_config.ring_pages = 1 << ring_page_order; (void)xs_scanf(XST_NIL, otherend_path, - "ring-pages", NULL, "%u", + "num-ring-pages", NULL, "%u", &xbb->ring_config.ring_pages); + ring_size = PAGE_SIZE * xbb->ring_config.ring_pages; + xbb->max_requests = BLKIF_MAX_RING_REQUESTS(ring_size); (void)xs_scanf(XST_NIL, otherend_path, "max-requests", NULL, "%u", @@ -3084,7 +3134,7 @@ xbb_collect_frontend_info(struct xbb_sof if (xbb->ring_config.ring_pages > XBB_MAX_RING_PAGES) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed ring-pages of %u " + "Front-end specified ring-pages of %u " "exceeds backend limit of %zu. " "Unable to connect.", xbb->ring_config.ring_pages, @@ -3092,7 +3142,7 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } else if (xbb->max_requests > XBB_MAX_REQUESTS) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed max_requests of %u " + "Front-end specified max_requests of %u " "exceeds backend limit of %u. " "Unable to connect.", xbb->max_requests, @@ -3100,7 +3150,7 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } else if (xbb->max_request_segments > XBB_MAX_SEGMENTS_PER_REQUEST) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed max_requests_segments " + "Front-end specified max_requests_segments " "of %u exceeds backend limit of %u. " "Unable to connect.", xbb->max_request_segments, @@ -3108,7 +3158,7 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } else if (xbb->max_request_size > XBB_MAX_REQUEST_SIZE) { xenbus_dev_fatal(xbb->dev, EINVAL, - "Front-end specificed max_request_size " + "Front-end specified max_request_size " "of %u exceeds backend limit of %u. " "Unable to connect.", xbb->max_request_size, @@ -3116,22 +3166,39 @@ xbb_collect_frontend_info(struct xbb_sof return (EINVAL); } - /* If using a multi-page ring, pull in the remaining references. */ - for (ring_idx = 1; ring_idx < xbb->ring_config.ring_pages; ring_idx++) { - char ring_ref_name[]= "ring_refXX"; - - snprintf(ring_ref_name, sizeof(ring_ref_name), - "ring-ref%u", ring_idx); - error = xs_scanf(XST_NIL, otherend_path, - ring_ref_name, NULL, "%" PRIu32, - &xbb->ring_config.ring_ref[ring_idx]); + if (xbb->ring_config.ring_pages == 1) { + error = xs_gather(XST_NIL, otherend_path, + "ring-ref", "%" PRIu32, + &xbb->ring_config.ring_ref[0], + NULL); if (error != 0) { xenbus_dev_fatal(xbb->dev, error, - "Failed to retriev grant reference " - "for page %u of shared ring. Unable " - "to connect.", ring_idx); + "Unable to retrieve ring information " + "from frontend %s. Unable to " + "connect.", + xenbus_get_otherend_path(xbb->dev)); return (error); } + } else { + /* Multi-page ring format. */ + for (ring_idx = 0; ring_idx < xbb->ring_config.ring_pages; + ring_idx++) { + char ring_ref_name[]= "ring_refXX"; + + snprintf(ring_ref_name, sizeof(ring_ref_name), + "ring-ref%u", ring_idx); + error = xs_scanf(XST_NIL, otherend_path, + ring_ref_name, NULL, "%" PRIu32, + &xbb->ring_config.ring_ref[ring_idx]); + if (error != 0) { + xenbus_dev_fatal(xbb->dev, error, + "Failed to retriev grant " + "reference for page %u of " + "shared ring. Unable " + "to connect.", ring_idx); + return (error); + } + } } error = xs_gather(XST_NIL, otherend_path, @@ -3197,8 +3264,8 @@ xbb_alloc_requests(struct xbb_softc *xbb static int xbb_alloc_request_lists(struct xbb_softc *xbb) { - int i; struct xbb_xen_reqlist *reqlist; + int i; /* * If no requests can be merged, we need 1 request list per @@ -3318,7 +3385,7 @@ xbb_publish_backend_info(struct xbb_soft static void xbb_connect(struct xbb_softc *xbb) { - int error; + int error; if (xenbus_get_state(xbb->dev) == XenbusStateConnected) return; @@ -3399,7 +3466,8 @@ xbb_connect(struct xbb_softc *xbb) static int xbb_shutdown(struct xbb_softc *xbb) { - int error; + XenbusState frontState; + int error; DPRINTF("\n"); @@ -3413,6 +3481,20 @@ xbb_shutdown(struct xbb_softc *xbb) if ((xbb->flags & XBBF_IN_SHUTDOWN) != 0) return (EAGAIN); + xbb->flags |= XBBF_IN_SHUTDOWN; + mtx_unlock(&xbb->lock); + + if (xenbus_get_state(xbb->dev) < XenbusStateClosing) + xenbus_set_state(xbb->dev, XenbusStateClosing); + + frontState = xenbus_get_otherend_state(xbb->dev); + mtx_lock(&xbb->lock); + xbb->flags &= ~XBBF_IN_SHUTDOWN; + + /* The front can submit I/O until entering the closed state. */ + if (frontState < XenbusStateClosed) + return (EAGAIN); + DPRINTF("\n"); /* Indicate shutdown is in progress. */ @@ -3434,19 +3516,6 @@ xbb_shutdown(struct xbb_softc *xbb) DPRINTF("\n"); - /* - * Before unlocking mutex, set this flag to prevent other threads from - * getting into this function - */ - xbb->flags |= XBBF_IN_SHUTDOWN; - mtx_unlock(&xbb->lock); - - if (xenbus_get_state(xbb->dev) < XenbusStateClosing) - xenbus_set_state(xbb->dev, XenbusStateClosing); - - mtx_lock(&xbb->lock); - xbb->flags &= ~XBBF_IN_SHUTDOWN; - /* Indicate to xbb_detach() that is it safe to proceed. */ wakeup(xbb); @@ -3573,6 +3642,16 @@ xbb_setup_sysctl(struct xbb_softc *xbb) "max_request_segments", CTLFLAG_RD, &xbb->max_request_segments, 0, "maximum number of pages per requests (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_request_size", CTLFLAG_RD, + &xbb->max_request_size, 0, + "maximum size in bytes of a request (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "ring_pages", CTLFLAG_RD, + &xbb->ring_config.ring_pages, 0, + "communication channel pages (negotiated)"); } /** @@ -3587,6 +3666,7 @@ xbb_attach(device_t dev) { struct xbb_softc *xbb; int error; + u_int max_ring_page_order; DPRINTF("Attaching to %s\n", xenbus_get_node(dev)); @@ -3621,6 +3701,10 @@ xbb_attach(device_t dev) return (error); } + /* + * Amazon EC2 client compatility. They refer to max-ring-pages + * instead of to max-ring-page-order. + */ error = xs_printf(XST_NIL, xenbus_get_node(xbb->dev), "max-ring-pages", "%zu", XBB_MAX_RING_PAGES); if (error) { @@ -3629,6 +3713,15 @@ xbb_attach(device_t dev) return (error); } + max_ring_page_order = flsl(XBB_MAX_RING_PAGES) - 1; + error = xs_printf(XST_NIL, xenbus_get_node(xbb->dev), + "max-ring-page-order", "%u", max_ring_page_order); + if (error) { + xbb_attach_failed(xbb, error, "writing %s/max-ring-page-order", + xenbus_get_node(xbb->dev)); + return (error); + } + error = xs_printf(XST_NIL, xenbus_get_node(xbb->dev), "max-requests", "%u", XBB_MAX_REQUESTS); if (error) { Modified: stable/8/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/8/sys/dev/xen/blkfront/blkfront.c Thu Mar 1 18:45:25 2012 (r232351) +++ stable/8/sys/dev/xen/blkfront/blkfront.c Thu Mar 1 19:09:28 2012 (r232352) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -139,7 +140,7 @@ static int xb_dump(void *, void *, vm_of * with blkfront as the emulated drives, easing transition slightly. */ static void -blkfront_vdevice_to_unit(int vdevice, int *unit, const char **name) +blkfront_vdevice_to_unit(uint32_t vdevice, int *unit, const char **name) { static struct vdev_info { int major; @@ -186,6 +187,7 @@ blkfront_vdevice_to_unit(int vdevice, in if (vdevice & (1 << 28)) { *unit = (vdevice & ((1 << 28) - 1)) >> 8; *name = "xbd"; + return; } for (i = 0; info[i].major; i++) { @@ -407,6 +409,40 @@ blkfront_probe(device_t dev) return (ENXIO); } +static void +xb_setup_sysctl(struct xb_softc *xb) +{ + struct sysctl_ctx_list *sysctl_ctx = NULL; + struct sysctl_oid *sysctl_tree = NULL; + + sysctl_ctx = device_get_sysctl_ctx(xb->xb_dev); + if (sysctl_ctx == NULL) + return; + + sysctl_tree = device_get_sysctl_tree(xb->xb_dev); + if (sysctl_tree == NULL) + return; + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_requests", CTLFLAG_RD, &xb->max_requests, -1, + "maximum outstanding requests (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_request_segments", CTLFLAG_RD, + &xb->max_request_segments, 0, + "maximum number of pages per requests (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_request_size", CTLFLAG_RD, + &xb->max_request_size, 0, + "maximum size in bytes of a request (negotiated)"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "ring_pages", CTLFLAG_RD, + &xb->ring_pages, 0, + "communication channel pages (negotiated)"); +} + /* * Setup supplies the backend dir, virtual device. We place an event * channel and shared frame entries. We watch backend to wait if it's @@ -417,14 +453,14 @@ blkfront_attach(device_t dev) { struct xb_softc *sc; const char *name; + uint32_t vdevice; int error; - int vdevice; int i; int unit; /* FIXME: Use dynamic device id if this is not set. */ error = xs_scanf(XST_NIL, xenbus_get_node(dev), - "virtual-device", NULL, "%i", &vdevice); + "virtual-device", NULL, "%" PRIu32, &vdevice); if (error) { xenbus_dev_fatal(dev, error, "reading virtual-device"); device_printf(dev, "Couldn't determine virtual device.\n"); @@ -449,6 +485,8 @@ blkfront_attach(device_t dev) sc->vdevice = vdevice; sc->connected = BLKIF_STATE_DISCONNECTED; + xb_setup_sysctl(sc); + /* Wait for backend device to publish its protocol capabilities. */ xenbus_set_state(dev, XenbusStateInitialising); @@ -501,6 +539,7 @@ blkfront_initialize(struct xb_softc *sc) { const char *otherend_path; const char *node_path; + uint32_t max_ring_page_order; int error; int i; @@ -513,10 +552,10 @@ blkfront_initialize(struct xb_softc *sc) * Protocol defaults valid even if negotiation for a * setting fails. */ + max_ring_page_order = 0; sc->ring_pages = 1; - sc->max_requests = BLKIF_MAX_RING_REQUESTS(PAGE_SIZE); sc->max_request_segments = BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK; - sc->max_request_size = (sc->max_request_segments - 1) * PAGE_SIZE; + sc->max_request_size = XBF_SEGS_TO_SIZE(sc->max_request_segments); sc->max_request_blocks = BLKIF_SEGS_TO_BLOCKS(sc->max_request_segments); /* @@ -526,13 +565,25 @@ blkfront_initialize(struct xb_softc *sc) * we must use independant calls in order to guarantee * we don't miss information in a sparsly populated back-end * tree. + * + * \note xs_scanf() does not update variables for unmatched + * fields. */ otherend_path = xenbus_get_otherend_path(sc->xb_dev); node_path = xenbus_get_node(sc->xb_dev); + + /* Support both backend schemes for relaying ring page limits. */ + (void)xs_scanf(XST_NIL, otherend_path, + "max-ring-page-order", NULL, "%" PRIu32, + &max_ring_page_order); + sc->ring_pages = 1 << max_ring_page_order; (void)xs_scanf(XST_NIL, otherend_path, "max-ring-pages", NULL, "%" PRIu32, &sc->ring_pages); + if (sc->ring_pages < 1) + sc->ring_pages = 1; + sc->max_requests = BLKIF_MAX_RING_REQUESTS(sc->ring_pages * PAGE_SIZE); (void)xs_scanf(XST_NIL, otherend_path, "max-requests", NULL, "%" PRIu32, &sc->max_requests); @@ -552,6 +603,16 @@ blkfront_initialize(struct xb_softc *sc) sc->ring_pages = XBF_MAX_RING_PAGES; } + if (powerof2(sc->ring_pages) == 0) { + uint32_t new_page_limit; + + new_page_limit = 0x01 << (fls(sc->ring_pages) - 1); + device_printf(sc->xb_dev, "Back-end specified ring-pages of " + "%u is not a power of 2. Limited to %u.\n", + sc->ring_pages, new_page_limit); + sc->ring_pages = new_page_limit; + } + if (sc->max_requests > XBF_MAX_REQUESTS) { device_printf(sc->xb_dev, "Back-end specified max_requests of " "%u limited to front-end limit of %u.\n", @@ -560,8 +621,8 @@ blkfront_initialize(struct xb_softc *sc) } if (sc->max_request_segments > XBF_MAX_SEGMENTS_PER_REQUEST) { - device_printf(sc->xb_dev, "Back-end specificed " - "max_requests_segments of %u limited to " + device_printf(sc->xb_dev, "Back-end specified " + "max_request_segments of %u limited to " "front-end limit of %u.\n", sc->max_request_segments, XBF_MAX_SEGMENTS_PER_REQUEST); @@ -569,12 +630,23 @@ blkfront_initialize(struct xb_softc *sc) } if (sc->max_request_size > XBF_MAX_REQUEST_SIZE) { - device_printf(sc->xb_dev, "Back-end specificed " + device_printf(sc->xb_dev, "Back-end specified " "max_request_size of %u limited to front-end " "limit of %u.\n", sc->max_request_size, XBF_MAX_REQUEST_SIZE); sc->max_request_size = XBF_MAX_REQUEST_SIZE; } + + if (sc->max_request_size > XBF_SEGS_TO_SIZE(sc->max_request_segments)) { + device_printf(sc->xb_dev, "Back-end specified " + "max_request_size of %u limited to front-end " + "limit of %u. (Too few segments.)\n", + sc->max_request_size, + XBF_SEGS_TO_SIZE(sc->max_request_segments)); + sc->max_request_size = + XBF_SEGS_TO_SIZE(sc->max_request_segments); + } + sc->max_request_blocks = BLKIF_SEGS_TO_BLOCKS(sc->max_request_segments); /* Allocate datastructures based on negotiated values. */ @@ -625,11 +697,20 @@ blkfront_initialize(struct xb_softc *sc) if (setup_blkring(sc) != 0) return; + /* Support both backend schemes for relaying ring page limits. */ error = xs_printf(XST_NIL, node_path, - "ring-pages","%u", sc->ring_pages); + "num-ring-pages","%u", sc->ring_pages); if (error) { xenbus_dev_fatal(sc->xb_dev, error, - "writing %s/ring-pages", + "writing %s/num-ring-pages", + node_path); + return; + } + error = xs_printf(XST_NIL, node_path, + "ring-page-order","%u", fls(sc->ring_pages) - 1); + if (error) { + xenbus_dev_fatal(sc->xb_dev, error, + "writing %s/ring-page-order", node_path); return; } @@ -711,25 +792,31 @@ setup_blkring(struct xb_softc *sc) return (error); } } - error = xs_printf(XST_NIL, xenbus_get_node(sc->xb_dev), - "ring-ref","%u", sc->ring_ref[0]); - if (error) { - xenbus_dev_fatal(sc->xb_dev, error, "writing %s/ring-ref", - xenbus_get_node(sc->xb_dev)); - return (error); - } - for (i = 1; i < sc->ring_pages; i++) { - char ring_ref_name[]= "ring_refXX"; - - snprintf(ring_ref_name, sizeof(ring_ref_name), "ring-ref%u", i); + if (sc->ring_pages == 1) { error = xs_printf(XST_NIL, xenbus_get_node(sc->xb_dev), - ring_ref_name, "%u", sc->ring_ref[i]); + "ring-ref", "%u", sc->ring_ref[0]); if (error) { - xenbus_dev_fatal(sc->xb_dev, error, "writing %s/%s", - xenbus_get_node(sc->xb_dev), - ring_ref_name); + xenbus_dev_fatal(sc->xb_dev, error, + "writing %s/ring-ref", + xenbus_get_node(sc->xb_dev)); return (error); } + } else { + for (i = 0; i < sc->ring_pages; i++) { + char ring_ref_name[]= "ring_refXX"; + + snprintf(ring_ref_name, sizeof(ring_ref_name), + "ring-ref%u", i); + error = xs_printf(XST_NIL, xenbus_get_node(sc->xb_dev), + ring_ref_name, "%u", sc->ring_ref[i]); + if (error) { + xenbus_dev_fatal(sc->xb_dev, error, + "writing %s/%s", + xenbus_get_node(sc->xb_dev), + ring_ref_name); + return (error); + } + } } error = bind_listening_port_to_irqhandler( @@ -795,7 +882,7 @@ blkfront_connect(struct xb_softc *sc) unsigned int binfo; int err, feature_barrier; - if( (sc->connected == BLKIF_STATE_CONNECTED) || + if( (sc->connected == BLKIF_STATE_CONNECTED) || (sc->connected == BLKIF_STATE_SUSPENDED) ) return; @@ -923,15 +1010,13 @@ blkif_close(struct disk *dp) return (ENXIO); sc->xb_flags &= ~XB_OPEN; if (--(sc->users) == 0) { - /* Check whether we have been instructed to close. We will - have ignored this request initially, as the device was - still mounted. */ - device_t dev = sc->xb_dev; - XenbusState state = - xenbus_read_driver_state(xenbus_get_otherend_path(dev)); - - if (state == XenbusStateClosing) - blkfront_closing(dev); + /* + * Check whether we have been instructed to close. We will + * have ignored this request initially, as the device was + * still mounted. + */ + if (xenbus_get_otherend_state(sc->xb_dev) == XenbusStateClosing) + blkfront_closing(sc->xb_dev); } return (0); } @@ -1033,7 +1118,7 @@ blkif_queue_cb(void *arg, bus_dma_segmen struct xb_command *cm; blkif_request_t *ring_req; struct blkif_request_segment *sg; - struct blkif_request_segment *last_block_sg; + struct blkif_request_segment *last_block_sg; grant_ref_t *sg_ref; vm_paddr_t buffer_ma; uint64_t fsect, lsect; @@ -1104,12 +1189,12 @@ blkif_queue_cb(void *arg, bus_dma_segmen nsegs--; } block_segs = MIN(nsegs, BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK); - if (block_segs == 0) - break; + if (block_segs == 0) + break; - sg = BLKRING_GET_SG_REQUEST(&sc->ring, sc->ring.req_prod_pvt); + sg = BLKRING_GET_SEG_BLOCK(&sc->ring, sc->ring.req_prod_pvt); sc->ring.req_prod_pvt++; - last_block_sg = sg + block_segs; + last_block_sg = sg + block_segs; } if (cm->operation == BLKIF_OP_READ) Modified: stable/8/sys/dev/xen/blkfront/block.h ============================================================================== --- stable/8/sys/dev/xen/blkfront/block.h Thu Mar 1 18:45:25 2012 (r232351) +++ stable/8/sys/dev/xen/blkfront/block.h Thu Mar 1 19:09:28 2012 (r232352) @@ -35,6 +35,32 @@ #include /** + * Given a number of blkif segments, compute the maximum I/O size supported. + * + * \note This calculation assumes that all but the first and last segments + * of the I/O are fully utilized. + * + * \note We reserve a segement from the maximum supported by the transport to + * guarantee we can handle an unaligned transfer without the need to + * use a bounce buffer. + */ +#define XBF_SEGS_TO_SIZE(segs) \ + (((segs) - 1) * PAGE_SIZE) + +/** + * Compute the maximum number of blkif segments requried to represent + * an I/O of the given size. + * + * \note This calculation assumes that all but the first and last segments + * of the I/O are fully utilized. + * + * \note We reserve a segement to guarantee we can handle an unaligned + * transfer without the need to use a bounce buffer. + */ +#define XBF_SIZE_TO_SEGS(size) \ + ((size / PAGE_SIZE) + 1) + +/** * The maximum number of outstanding requests blocks (request headers plus * additional segment blocks) we will allow in a negotiated block-front/back * communication channel. @@ -44,22 +70,18 @@ /** * The maximum mapped region size per request we will allow in a negotiated * block-front/back communication channel. - * - * \note We reserve a segement from the maximum supported by the transport to - * guarantee we can handle an unaligned transfer without the need to - * use a bounce buffer.. */ -#define XBF_MAX_REQUEST_SIZE \ - MIN(MAXPHYS, (BLKIF_MAX_SEGMENTS_PER_REQUEST - 1) * PAGE_SIZE) +#define XBF_MAX_REQUEST_SIZE \ + MIN(MAXPHYS, XBF_SEGS_TO_SIZE(BLKIF_MAX_SEGMENTS_PER_REQUEST)) /** * The maximum number of segments (within a request header and accompanying * segment blocks) per request we will allow in a negotiated block-front/back * communication channel. */ -#define XBF_MAX_SEGMENTS_PER_REQUEST \ - (MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ - (XBF_MAX_REQUEST_SIZE / PAGE_SIZE) + 1)) +#define XBF_MAX_SEGMENTS_PER_REQUEST \ + (MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ + XBF_SIZE_TO_SEGS(XBF_MAX_REQUEST_SIZE))) /** * The maximum number of shared memory ring pages we will allow in a Modified: stable/8/sys/xen/interface/io/blkif.h ============================================================================== --- stable/8/sys/xen/interface/io/blkif.h Thu Mar 1 18:45:25 2012 (r232351) +++ stable/8/sys/xen/interface/io/blkif.h Thu Mar 1 19:09:28 2012 (r232352) @@ -1,8 +1,8 @@ /****************************************************************************** * blkif.h - * + * * Unified block-device I/O interface for Xen guest OSes. - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the @@ -22,6 +22,7 @@ * DEALINGS IN THE SOFTWARE. * * Copyright (c) 2003-2004, Keir Fraser + * Copyright (c) 2012, Spectra Logic Corporation */ #ifndef __XEN_PUBLIC_IO_BLKIF_H__ @@ -35,7 +36,7 @@ * notification can be made conditional on req_event (i.e., the generic * hold-off mechanism provided by the ring macros). Backends must set * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()). - * + * * Back->front notifications: When enqueuing a new response, sending a * notification can be made conditional on rsp_event (i.e., the generic * hold-off mechanism provided by the ring macros). Frontends must set @@ -48,37 +49,417 @@ #define blkif_sector_t uint64_t /* + * Feature and Parameter Negotiation + * ================================= + * The two halves of a Xen block driver utilize nodes within the XenStore to + * communicate capabilities and to negotiate operating parameters. This + * section enumerates these nodes which reside in the respective front and + * backend portions of the XenStore, following the XenBus convention. + * + * All data in the XenStore is stored as strings. Nodes specifying numeric + * values are encoded in decimal. Integer value ranges listed below are + * expressed as fixed sized integer types capable of storing the conversion + * of a properly formatted node string, without loss of information. + * + * Any specified default value is in effect if the corresponding XenBus node + * is not present in the XenStore. + * + * XenStore nodes in sections marked "PRIVATE" are solely for use by the + * driver side whose XenBus tree contains them. + * + * XenStore nodes marked "DEPRECATED" in their notes section should only be + * used to provide interoperability with legacy implementations. + * + * See the XenBus state transition diagram below for details on when XenBus + * nodes must be published and when they can be queried. + * + ***************************************************************************** + * Backend XenBus Nodes + ***************************************************************************** + * + *------------------ Backend Device Identification (PRIVATE) ------------------ + * + * mode + * Values: "r" (read only), "w" (writable) + * + * The read or write access permissions to the backing store to be + * granted to the frontend. + * + * params + * Values: string + * + * Data used by the backend driver to locate and configure the backing + * device. The format and semantics of this data vary according to the + * backing device in use and are outside the scope of this specification. + * + * type + * Values: "file", "phy", "tap" + * + * The type of the backing device/object. + * + *--------------------------------- Features --------------------------------- + * + * feature-barrier + * Values: 0/1 (boolean) + * Default Value: 0 + * + * A value of "1" indicates that the backend can process requests + * containing the BLKIF_OP_WRITE_BARRIER request opcode. Requests + * of this type may still be returned at any time with the + * BLKIF_RSP_EOPNOTSUPP result code. + * + * feature-flush-cache + * Values: 0/1 (boolean) + * Default Value: 0 + * + * A value of "1" indicates that the backend can process requests + * containing the BLKIF_OP_FLUSH_DISKCACHE request opcode. Requests + * of this type may still be returned at any time with the + * BLKIF_RSP_EOPNOTSUPP result code. + * + * feature-discard + * Values: 0/1 (boolean) + * Default Value: 0 + * + * A value of "1" indicates that the backend can process requests + * containing the BLKIF_OP_DISCARD request opcode. Requests + * of this type may still be returned at any time with the + * BLKIF_RSP_EOPNOTSUPP result code. + * + *----------------------- Request Transport Parameters ------------------------ + * + * max-ring-page-order + * Values: + * Default Value: 0 + * Notes: 1, 3 + * + * The maximum supported size of the request ring buffer in units of + * lb(machine pages). (e.g. 0 == 1 page, 1 = 2 pages, 2 == 4 pages, + * etc.). + * + * max-ring-pages + * Values: + * Default Value: 1 + * Notes: DEPRECATED, 2, 3 + * + * The maximum supported size of the request ring buffer in units of + * machine pages. The value must be a power of 2. + * + * max-requests + * Default Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE) + * Maximum Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages) + * + * The maximum number of concurrent, logical requests supported by + * the backend. + * + * Note: A logical request may span multiple ring entries. + * + * max-request-segments + * Values: + * Default Value: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK + * Maximum Value: BLKIF_MAX_SEGMENTS_PER_REQUEST + * + * The maximum value of blkif_request.nr_segments supported by + * the backend. + * + * max-request-size + * Values: + * Default Value: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE + * Maximum Value: BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE + * + * The maximum amount of data, in bytes, that can be referenced by a + * request type that accesses frontend memory (currently BLKIF_OP_READ, + * BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER). + * + *------------------------- Backend Device Properties ------------------------- + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 19:17:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B320F1065672; Thu, 1 Mar 2012 19:17:56 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E5208FC0A; Thu, 1 Mar 2012 19:17:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21JHu7j092421; Thu, 1 Mar 2012 19:17:56 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21JHuOZ092419; Thu, 1 Mar 2012 19:17:56 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201203011917.q21JHuOZ092419@svn.freebsd.org> From: Davide Italiano Date: Thu, 1 Mar 2012 19:17: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: r232353 - 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: Thu, 01 Mar 2012 19:17:56 -0000 Author: davide Date: Thu Mar 1 19:17:56 2012 New Revision: 232353 URL: http://svn.freebsd.org/changeset/base/232353 Log: Replace the three spaces with one tag. Reported by: pjd Approved by: gnn (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Mar 1 19:09:28 2012 (r232352) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Mar 1 19:17:56 2012 (r232353) @@ -217,7 +217,7 @@ 07/11 Jesus R. Camou born in Hermosillo, Sonora, Mexico, 1983 07/15 Gary Jennejohn born in Rochester, New York, United States, 1950 07/16 Suleiman Souhlal born in Roma, Italy, 1983 -07/16 Davide Italiano born in Milazzo, Italy, 1989 +07/16 Davide Italiano born in Milazzo, Italy, 1989 07/17 Michael Chin-Yuan Wu born in Taipei, Taiwan, Republic of China, 1980 07/19 Masafumi NAKANE born in Okazaki, Aichi, Japan, 1972 07/19 Simon L. Nielsen born in Copenhagen, Denmark, 1980 From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 19:35:07 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07BDC106566B; Thu, 1 Mar 2012 19:35:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 85F5A8FC0A; Thu, 1 Mar 2012 19:35:06 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q21JYLZw063313; Thu, 1 Mar 2012 23:34:21 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q21JYLS5063312; Thu, 1 Mar 2012 23:34:21 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 1 Mar 2012 23:34:21 +0400 From: Gleb Smirnoff To: Luigi Rizzo Message-ID: <20120301193421.GC13644@FreeBSD.org> References: <201203011735.q21HZHpi088980@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201203011735.q21HZHpi088980@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r232347 - head/sbin/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: Thu, 01 Mar 2012 19:35:07 -0000 Luigi, On Thu, Mar 01, 2012 at 05:35:17PM +0000, Luigi Rizzo wrote: L> Author: luigi L> Date: Thu Mar 1 17:35:16 2012 L> New Revision: 232347 L> URL: http://svn.freebsd.org/changeset/base/232347 L> L> Log: L> remove some write-only variables. L> There is another block of code that is now useless as the computation L> is done in the kernel. Why ifdef dead code instead of just deleting it? -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 19:41:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED12C106566B; Thu, 1 Mar 2012 19:41:18 +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 C2D8D8FC17; Thu, 1 Mar 2012 19:41:18 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 7CB1F46B2C; Thu, 1 Mar 2012 14:41:18 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 07898B996; Thu, 1 Mar 2012 14:41:18 -0500 (EST) From: John Baldwin To: Dimitry Andric Date: Thu, 1 Mar 2012 14:34:12 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202292258.q1TMwqYk048993@svn.freebsd.org> In-Reply-To: <201202292258.q1TMwqYk048993@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201203011434.12583.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Mar 2012 14:41:18 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232322 - in head: . gnu/usr.bin/cc/c++ gnu/usr.bin/cc/cc gnu/usr.bin/cc/cpp share/mk sys/conf tools/build/options usr.bin/clang/clang X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 19:41:19 -0000 On Wednesday, February 29, 2012 5:58:52 pm Dimitry Andric wrote: > Author: dim > Date: Wed Feb 29 22:58:51 2012 > New Revision: 232322 > URL: http://svn.freebsd.org/changeset/base/232322 > > Log: > Add a WITH_CLANG_IS_CC option for src.conf(5), disabled by default, that > installs clang as /usr/bin/cc, /usr/bin/c++ and /usr/bin/cpp. > > Note this does *not* disable building and installing gcc, which will > still be available as /usr/bin/gcc, /usr/bin/g++ and /usr/bin/gcpp. If > you want to disable gcc completely, you must use WITHOUT_GCC. > > MFC after: 2 weeks This seems to have broken the ability to build world on older machines. Specifically, I have a little netbook whose last world was from May 2011 and when I tried to do a buildworld today, it blew up with this trying to do a build: > make buildworld "/usr/src/Makefile.inc1", line 1111: Malformed conditional (${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang")) "/usr/src/Makefile.inc1", line 1113: if-less endif "/usr/src/Makefile.inc1", line 1173: Malformed conditional (${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")) "/usr/src/Makefile.inc1", line 1176: if-less endif "/usr/src/Makefile.inc1", line 1178: Malformed conditional (${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang")) "/usr/src/Makefile.inc1", line 1180: if-less endif "/usr/src/Makefile.inc1", line 1241: Malformed conditional (${MK_LIBCPLUSPLUS} != "no") "/usr/src/Makefile.inc1", line 1243: if-less endif make: fatal errors encountered -- cannot continue *** Error code 1 Stop in /usr/src. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 19:43:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFF0F106566C; Thu, 1 Mar 2012 19:43:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4DA98FC19; Thu, 1 Mar 2012 19:43:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21JhSqO093258; Thu, 1 Mar 2012 19:43:28 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21JhSgV093255; Thu, 1 Mar 2012 19:43:28 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201203011943.q21JhSgV093255@svn.freebsd.org> From: Ed Maste Date: Thu, 1 Mar 2012 19:43:28 +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: r232354 - in stable/8/sys: amd64/amd64 i386/conf i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 19:43:29 -0000 Author: emaste Date: Thu Mar 1 19:43:28 2012 New Revision: 232354 URL: http://svn.freebsd.org/changeset/base/232354 Log: MFC r232267: Workaround for PCIe 4GB boundary issue Enforce a boundary of no more than 4GB - transfers crossing a 4GB boundary can lead to data corruption due to PCIe limitations. This change is a less-intrusive workaround that can be quickly merged back to older branches; a cleaner implementation will arrive in HEAD later but may require KPI changes. This change is based on a suggestion by jhb@. Approved by: re Reviewed by: jhb (MFC) Reviewed by: jhb, scottl (original) Sponsored by: Sandvine Incorporated Modified: stable/8/sys/amd64/amd64/busdma_machdep.c stable/8/sys/i386/i386/busdma_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/amd64/amd64/busdma_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/busdma_machdep.c Thu Mar 1 19:17:56 2012 (r232353) +++ stable/8/sys/amd64/amd64/busdma_machdep.c Thu Mar 1 19:43:28 2012 (r232354) @@ -216,6 +216,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; + /* Always enforce at least a 4GB boundary. */ + if (boundary == 0 || boundary > ((bus_addr_t)1 << 32)) + boundary = (bus_size_t)1 << 32; + /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; Modified: stable/8/sys/i386/i386/busdma_machdep.c ============================================================================== --- stable/8/sys/i386/i386/busdma_machdep.c Thu Mar 1 19:17:56 2012 (r232353) +++ stable/8/sys/i386/i386/busdma_machdep.c Thu Mar 1 19:43:28 2012 (r232354) @@ -226,6 +226,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; +#if defined(PAE) + /* Need at least a 4GB boundary, PAE limitations require 2GB */ + if (boundary == 0 || boundary > ((bus_addr_t)1 << 31)) + boundary = (bus_size_t)1 << 31; +#endif + /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 19:54:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC7321065673; Thu, 1 Mar 2012 19:54:35 +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 BB2918FC14; Thu, 1 Mar 2012 19:54:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21JsZAM093673; Thu, 1 Mar 2012 19:54:35 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21JsZZP093670; Thu, 1 Mar 2012 19:54:35 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201203011954.q21JsZZP093670@svn.freebsd.org> From: Christian Brueffer Date: Thu, 1 Mar 2012 19:54: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: r232355 - in head/release/doc: en_US.ISO8859-1/hardware 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: Thu, 01 Mar 2012 19:54:35 -0000 Author: brueffer Date: Thu Mar 1 19:54:35 2012 New Revision: 232355 URL: http://svn.freebsd.org/changeset/base/232355 Log: Add snd_hdspe(4) to the hardware notes. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml head/release/doc/share/misc/dev.archlist.txt Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Thu Mar 1 19:43:28 2012 (r232354) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Thu Mar 1 19:54:35 2012 (r232355) @@ -1409,6 +1409,8 @@ &hwlist.snd.hda; + &hwlist.snd.hdspe; + &hwlist.snd.ich; &hwlist.snd.maestro; Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Thu Mar 1 19:43:28 2012 (r232354) +++ head/release/doc/share/misc/dev.archlist.txt Thu Mar 1 19:54:35 2012 (r232355) @@ -131,6 +131,7 @@ snd_ess i386,amd64 snd_fm801 i386,amd64 snd_gusc i386,amd64 snd_hda i386,amd64 +snd_hdspe i386,amd64 snd_ich i386,amd64 snd_maestro i386,amd64 snd_maestro3 i386,amd64 From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 19:58:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF9E1106564A; Thu, 1 Mar 2012 19:58: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 AC53F8FC0A; Thu, 1 Mar 2012 19:58:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21JwZH4093859; Thu, 1 Mar 2012 19:58:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21JwZ8C093846; Thu, 1 Mar 2012 19:58:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203011958.q21JwZ8C093846@svn.freebsd.org> From: John Baldwin Date: Thu, 1 Mar 2012 19:58: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: r232356 - in head/sys: arm/arm ia64/ia64 kern mips/mips powerpc/powerpc powerpc/ps3 sparc64/include sparc64/sparc64 sys x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 19:58:35 -0000 Author: jhb Date: Thu Mar 1 19:58:34 2012 New Revision: 232356 URL: http://svn.freebsd.org/changeset/base/232356 Log: - Change contigmalloc() to use the vm_paddr_t type instead of an unsigned long for specifying a boundary constraint. - Change bus_dma tags to use bus_addr_t instead of bus_size_t for boundary constraints. These allow boundary constraints to be fully expressed for cases where sizeof(bus_addr_t) != sizeof(bus_size_t). Specifically, it allows a driver to properly specify a 4GB boundary in a PAE kernel. Note that this cannot be safely MFC'd without a lot of compat shims due to KBI changes, so I do not intend to merge it. Reviewed by: scottl Modified: head/sys/arm/arm/busdma_machdep.c head/sys/ia64/ia64/busdma_machdep.c head/sys/kern/kern_malloc.c head/sys/mips/mips/busdma_machdep.c head/sys/powerpc/powerpc/busdma_machdep.c head/sys/powerpc/powerpc/iommu_if.m head/sys/powerpc/ps3/ps3bus.c head/sys/sparc64/include/bus_dma.h head/sys/sparc64/sparc64/bus_machdep.c head/sys/sys/bus_dma.h head/sys/sys/malloc.h head/sys/x86/x86/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/arm/arm/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -68,7 +68,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -332,7 +332,7 @@ _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 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, @@ -378,12 +378,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, * 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); + 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 = MIN(parent->boundary, newtag->boundary); if ((newtag->filter != NULL) || ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) Modified: head/sys/ia64/ia64/busdma_machdep.c ============================================================================== --- head/sys/ia64/ia64/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/ia64/ia64/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -139,7 +139,7 @@ static __inline int run_filter(bus_dma_t static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t len) { - bus_size_t bndy; + bus_addr_t bndy; int retval; retval = 0; @@ -199,7 +199,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ 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_addr_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) Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/kern/kern_malloc.c Thu Mar 1 19:58:34 2012 (r232356) @@ -418,7 +418,7 @@ malloc_type_freed(struct malloc_type *mt void * contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, - unsigned long boundary) + vm_paddr_t boundary) { void *ret; Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/mips/mips/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -67,7 +67,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -310,7 +310,7 @@ _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 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, @@ -356,13 +356,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, * 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); + 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); + MIN(parent->boundary, newtag->boundary); if ((newtag->filter != NULL) || ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) newtag->flags |= BUS_DMA_COULD_BOUNCE; Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/powerpc/powerpc/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -63,7 +63,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -219,7 +219,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ 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 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, Modified: head/sys/powerpc/powerpc/iommu_if.m ============================================================================== --- head/sys/powerpc/powerpc/iommu_if.m Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/powerpc/powerpc/iommu_if.m Thu Mar 1 19:58:34 2012 (r232356) @@ -41,7 +41,7 @@ METHOD int map { bus_addr_t lowaddr; bus_addr_t highaddr; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; void *cookie; }; Modified: head/sys/powerpc/ps3/ps3bus.c ============================================================================== --- head/sys/powerpc/ps3/ps3bus.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/powerpc/ps3/ps3bus.c Thu Mar 1 19:58:34 2012 (r232356) @@ -64,7 +64,7 @@ static int ps3bus_activate_resource(devi int rid, struct resource *res); static bus_dma_tag_t ps3bus_get_dma_tag(device_t dev, device_t child); static int ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs, bus_addr_t min, bus_addr_t max, bus_size_t alignment, - bus_size_t boundary, void *cookie); + bus_addr_t boundary, void *cookie); static int ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs, int nsegs, void *cookie); static int ps3_gettime(device_t dev, struct timespec *ts); @@ -697,7 +697,7 @@ fail: static int ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs, - bus_addr_t min, bus_addr_t max, bus_size_t alignment, bus_size_t boundary, + bus_addr_t min, bus_addr_t max, bus_size_t alignment, bus_addr_t boundary, void *cookie) { struct ps3bus_devinfo *dinfo = cookie; Modified: head/sys/sparc64/include/bus_dma.h ============================================================================== --- head/sys/sparc64/include/bus_dma.h Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sparc64/include/bus_dma.h Thu Mar 1 19:58:34 2012 (r232356) @@ -103,7 +103,7 @@ struct bus_dma_tag { void *dt_cookie; /* cookie used in the guts */ bus_dma_tag_t dt_parent; bus_size_t dt_alignment; - bus_size_t dt_boundary; + bus_addr_t dt_boundary; bus_addr_t dt_lowaddr; bus_addr_t dt_highaddr; bus_dma_filter_t *dt_filter; Modified: head/sys/sparc64/sparc64/bus_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/bus_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sparc64/sparc64/bus_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -185,7 +185,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ 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_addr_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) Modified: head/sys/sys/bus_dma.h ============================================================================== --- head/sys/sys/bus_dma.h Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sys/bus_dma.h Thu Mar 1 19:58:34 2012 (r232356) @@ -169,7 +169,7 @@ void busdma_lock_mutex(void *arg, bus_dm */ /* XXX Should probably allow specification of alignment */ 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 boundary, bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filtfunc, void *filtfuncarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/sys/malloc.h Thu Mar 1 19:58:34 2012 (r232356) @@ -171,7 +171,7 @@ typedef void malloc_type_list_func_t(str void contigfree(void *addr, unsigned long size, struct malloc_type *type); void *contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, - unsigned long boundary) __malloc_like; + vm_paddr_t boundary) __malloc_like; void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like; void malloc_init(void *); Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Thu Mar 1 19:54:35 2012 (r232355) +++ head/sys/x86/x86/busdma_machdep.c Thu Mar 1 19:58:34 2012 (r232356) @@ -63,7 +63,7 @@ struct bounce_zone; struct bus_dma_tag { bus_dma_tag_t parent; bus_size_t alignment; - bus_size_t boundary; + bus_addr_t boundary; bus_addr_t lowaddr; bus_addr_t highaddr; bus_dma_filter_t *filter; @@ -218,7 +218,7 @@ dflt_lock(void *arg, bus_dma_lock_op_t o */ 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 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, From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:03:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 695D2106566C; Thu, 1 Mar 2012 20:03:45 +0000 (UTC) (envelope-from ak@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 596728FC13; Thu, 1 Mar 2012 20:03:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21K3jFD094083; Thu, 1 Mar 2012 20:03:45 GMT (envelope-from ak@svn.freebsd.org) Received: (from ak@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21K3jSb094081; Thu, 1 Mar 2012 20:03:45 GMT (envelope-from ak@svn.freebsd.org) Message-Id: <201203012003.q21K3jSb094081@svn.freebsd.org> From: Alex Kozlov Date: Thu, 1 Mar 2012 20:03: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: r232357 - 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: Thu, 01 Mar 2012 20:03:45 -0000 Author: ak (ports committer) Date: Thu Mar 1 20:03:44 2012 New Revision: 232357 URL: http://svn.freebsd.org/changeset/base/232357 Log: Add myself Approved by: itetcu (mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Thu Mar 1 19:58:34 2012 (r232356) +++ head/share/misc/committers-ports.dot Thu Mar 1 20:03:44 2012 (r232357) @@ -44,6 +44,7 @@ node [color=lightblue2, style=filled, bg ache [label="Andrey Chernov\nache@FreeBSD.org\n1994/11/15"] acm [label="Jose Alonso Cardenas Marquez\nacm@FreeBSD.org\n2006/07/18"] ahze [label="Michael Johnson\nahze@FreeBSD.org\n2004/10/29"] +ak [label="Alex Kozlov\nak@FreeBSD.org\n2012/02/29"] ale [label="Alex Dupre\nale@FreeBSD.org\n2004/01/12"] alepulver [label="Alejandro Pulver\nalepulver@FreeBSD.org\n2006/04/01"] alexbl [label="Alexander Botero-Lowry\nalexbl@FreeBSD.org\n2006/09/11"] @@ -245,6 +246,8 @@ delphij -> rafan demon -> mat +eadler -> ak + edwin -> cperciva edwin -> erwin edwin -> linimon @@ -296,6 +299,7 @@ glewis -> jkim ijliao -> leeym +itetcu -> ak itetcu -> araujo itetcu -> dryice itetcu -> sahil From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:10:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD1A8106564A; Thu, 1 Mar 2012 20:10:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC7958FC15; Thu, 1 Mar 2012 20:10:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21KAtWo094365; Thu, 1 Mar 2012 20:10:55 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KAtwA094364; Thu, 1 Mar 2012 20:10:55 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201203012010.q21KAtwA094364@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 1 Mar 2012 20:10: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: r232358 - head/sys/dev/usb/storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 20:10:56 -0000 Author: hselasky Date: Thu Mar 1 20:10:54 2012 New Revision: 232358 URL: http://svn.freebsd.org/changeset/base/232358 Log: Close a detach race. Make sure all pending CCB's get canceled at device detach. MFC after: 1 week Modified: head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Thu Mar 1 20:03:44 2012 (r232357) +++ head/sys/dev/usb/storage/umass.c Thu Mar 1 20:10:54 2012 (r232358) @@ -1056,6 +1056,11 @@ umass_detach(device_t dev) #if (__FreeBSD_version >= 700037) mtx_lock(&sc->sc_mtx); #endif + + /* cancel any leftover CCB's */ + + umass_cancel_ccb(sc); + umass_cam_detach_sim(sc); #if (__FreeBSD_version >= 700037) @@ -1607,8 +1612,7 @@ umass_command_start(struct umass_softc * if (sc->sc_xfer[sc->sc_last_xfer_index]) { usbd_transfer_start(sc->sc_xfer[sc->sc_last_xfer_index]); } else { - ccb->ccb_h.status = CAM_TID_INVALID; - xpt_done(ccb); + umass_cancel_ccb(sc); } } From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:19:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85259106564A; Thu, 1 Mar 2012 20:19:22 +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 74AC48FC13; Thu, 1 Mar 2012 20:19:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21KJMUj094702; Thu, 1 Mar 2012 20:19:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KJMis094699; Thu, 1 Mar 2012 20:19:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203012019.q21KJMis094699@svn.freebsd.org> From: John Baldwin Date: Thu, 1 Mar 2012 20:19: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: r232359 - 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, 01 Mar 2012 20:19:22 -0000 Author: jhb Date: Thu Mar 1 20:19:21 2012 New Revision: 232359 URL: http://svn.freebsd.org/changeset/base/232359 Log: Update for adjusted types for boundary arguments in 232356. Modified: head/share/man/man9/bus_dma.9 head/share/man/man9/contigmalloc.9 Modified: head/share/man/man9/bus_dma.9 ============================================================================== --- head/share/man/man9/bus_dma.9 Thu Mar 1 20:10:54 2012 (r232358) +++ head/share/man/man9/bus_dma.9 Thu Mar 1 20:19:21 2012 (r232359) @@ -82,7 +82,7 @@ .In machine/bus.h .Ft int .Fn 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_addr_t boundary" "bus_addr_t lowaddr" "bus_addr_t highaddr" \ "bus_dma_filter_t *filtfunc" "void *filtfuncarg" "bus_size_t maxsize" \ "int nsegments" "bus_size_t maxsegsz" "int flags" "bus_dma_lock_t *lockfunc" \ "void *lockfuncarg" "bus_dma_tag_t *dmat" Modified: head/share/man/man9/contigmalloc.9 ============================================================================== --- head/share/man/man9/contigmalloc.9 Thu Mar 1 20:10:54 2012 (r232358) +++ head/share/man/man9/contigmalloc.9 Thu Mar 1 20:19:21 2012 (r232359) @@ -42,7 +42,7 @@ .Fa "vm_paddr_t low" .Fa "vm_paddr_t high" .Fa "unsigned long alignment" -.Fa "unsigned long boundary" +.Fa "vm_paddr_t boundary" .Fc .Ft void .Fo contigfree From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:20:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B4BFB106564A; Thu, 1 Mar 2012 20:20:55 +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 A40658FC18; Thu, 1 Mar 2012 20:20:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21KKtZi094859; Thu, 1 Mar 2012 20:20:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KKtuG094854; Thu, 1 Mar 2012 20:20:55 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203012020.q21KKtuG094854@svn.freebsd.org> From: John Baldwin Date: Thu, 1 Mar 2012 20:20: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: r232360 - in head: share/man/man9 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, 01 Mar 2012 20:20:55 -0000 Author: jhb Date: Thu Mar 1 20:20:55 2012 New Revision: 232360 URL: http://svn.freebsd.org/changeset/base/232360 Log: Add pci_save_state() and pci_restore_state() wrappers around pci_cfg_save() and pci_cfg_restore() for device drivers to use when saving and restoring state (e.g. to handle device-specific resets). Reviewed by: imp MFC after: 2 weeks Modified: head/share/man/man9/Makefile head/share/man/man9/pci.9 head/sys/dev/pci/pci.c head/sys/dev/pci/pcivar.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Mar 1 20:19:21 2012 (r232359) +++ head/share/man/man9/Makefile Thu Mar 1 20:20:55 2012 (r232360) @@ -980,6 +980,8 @@ MLINKS+=pci.9 pci_disable_busmaster.9 \ pci.9 pci_find_device.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_restore_state.9 \ + pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Thu Mar 1 20:19:21 2012 (r232359) +++ head/share/man/man9/pci.9 Thu Mar 1 20:20:55 2012 (r232360) @@ -38,6 +38,8 @@ .Nm pci_disable_io , .Nm pci_set_powerstate , .Nm pci_get_powerstate , +.Nm pci_save_state , +.Nm pci_restore_state , .Nm pci_find_bsf , .Nm pci_find_dbsf , .Nm pci_find_device @@ -63,6 +65,10 @@ .Fn pci_get_powerstate "device_t dev" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft void +.Fn pci_save_state "device_t dev" +.Ft void +.Fn pci_restore_state "device_t dev" .Ft device_t .Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t @@ -188,6 +194,26 @@ of is set. .Pp The +.Fn pci_save_state +and +.Fn pci_restore_state +functions can be used by a device driver to save and restore standard PCI +config registers. +The +.Fn pci_save_state +function must be invoked while the device has valid state before +.Fn pci_restore_state +can be used. +If the device is not in the fully-powered state +.Pq Dv PCI_POWERSTATE_D0 +when +.Fn pci_restore_state +is invoked, +then the device will be transitioned to +.Dv PCI_POWERSTATE_D0 +before any config registers are restored. +.Pp +The .Fn pci_find_bsf function looks up the .Vt device_t Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Mar 1 20:19:21 2012 (r232359) +++ head/sys/dev/pci/pci.c Thu Mar 1 20:20:55 2012 (r232360) @@ -4426,3 +4426,22 @@ pci_cfg_save(device_t dev, struct pci_de if (pci_get_powerstate(dev) != PCI_POWERSTATE_D3) pci_set_powerstate(dev, PCI_POWERSTATE_D3); } + +/* Wrapper APIs suitable for device driver use. */ +void +pci_save_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_save(dev, dinfo, 0); +} + +void +pci_restore_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_restore(dev, dinfo); +} Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Thu Mar 1 20:19:21 2012 (r232359) +++ head/sys/dev/pci/pcivar.h Thu Mar 1 20:20:55 2012 (r232360) @@ -467,6 +467,8 @@ int pci_msi_device_blacklisted(device_t void pci_ht_map_msi(device_t dev, uint64_t addr); int pci_get_max_read_req(device_t dev); +void pci_restore_state(device_t dev); +void pci_save_state(device_t dev); int pci_set_max_read_req(device_t dev, int size); #endif /* _SYS_BUS_H_ */ From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:22:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B6F81065670; Thu, 1 Mar 2012 20:22:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 086388FC08; Thu, 1 Mar 2012 20:22:28 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:d534:8303:3be7:974] (unknown [IPv6:2001:7b8:3a7:0:d534:8303:3be7:974]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 688625C37; Thu, 1 Mar 2012 21:22:26 +0100 (CET) Message-ID: <4F4FDA83.2010702@FreeBSD.org> Date: Thu, 01 Mar 2012 21:22:27 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120216 Thunderbird/11.0 MIME-Version: 1.0 To: John Baldwin References: <201202292258.q1TMwqYk048993@svn.freebsd.org> <201203011434.12583.jhb@freebsd.org> In-Reply-To: <201203011434.12583.jhb@freebsd.org> X-Enigmail-Version: 1.4a1pre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232322 - in head: . gnu/usr.bin/cc/c++ gnu/usr.bin/cc/cc gnu/usr.bin/cc/cpp share/mk sys/conf tools/build/options usr.bin/clang/clang X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 20:22:28 -0000 On 2012-03-01 20:34, John Baldwin wrote: > On Wednesday, February 29, 2012 5:58:52 pm Dimitry Andric wrote: >> Author: dim >> Date: Wed Feb 29 22:58:51 2012 >> New Revision: 232322 >> URL: http://svn.freebsd.org/changeset/base/232322 >> >> Log: >> Add a WITH_CLANG_IS_CC option for src.conf(5), disabled by default, that >> installs clang as /usr/bin/cc, /usr/bin/c++ and /usr/bin/cpp. >> >> Note this does *not* disable building and installing gcc, which will >> still be available as /usr/bin/gcc, /usr/bin/g++ and /usr/bin/gcpp. If >> you want to disable gcc completely, you must use WITHOUT_GCC. >> >> MFC after: 2 weeks > > This seems to have broken the ability to build world on older machines. > Specifically, I have a little netbook whose last world was from May 2011 and > when I tried to do a buildworld today, it blew up with this trying to do a > build: > >> make buildworld > "/usr/src/Makefile.inc1", line 1111: Malformed conditional (${MK_GCC} != "no" > && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang")) > "/usr/src/Makefile.inc1", line 1113: if-less endif > "/usr/src/Makefile.inc1", line 1173: Malformed conditional (${MK_CLANG} != > "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")) > "/usr/src/Makefile.inc1", line 1176: if-less endif > "/usr/src/Makefile.inc1", line 1178: Malformed conditional (${MK_GCC} != "no" > && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang")) > "/usr/src/Makefile.inc1", line 1180: if-less endif > "/usr/src/Makefile.inc1", line 1241: Malformed conditional (${MK_LIBCPLUSPLUS} > != "no") > "/usr/src/Makefile.inc1", line 1243: if-less endif > make: fatal errors encountered -- cannot continue > *** Error code 1 Strange, it's like it isn't reading the updated bsd.own.mk (which is where all the MK_XXX settings originate). Are you sure your tree is completely updated? What are your make.conf and src.conf settings? From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:25:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAB651065688; Thu, 1 Mar 2012 20:25:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8C9F8FC0A; Thu, 1 Mar 2012 20:25:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21KPIrq095053; Thu, 1 Mar 2012 20:25:18 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KPIKX095051; Thu, 1 Mar 2012 20:25:18 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201203012025.q21KPIKX095051@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 1 Mar 2012 20:25: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: r232361 - head/sys/dev/usb/storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 20:25:18 -0000 Author: hselasky Date: Thu Mar 1 20:25:17 2012 New Revision: 232361 URL: http://svn.freebsd.org/changeset/base/232361 Log: Style change: Expand redundant #if's. Remove a couple of empty lines. MFC after: 1 week Modified: head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Thu Mar 1 20:20:55 2012 (r232360) +++ head/sys/dev/usb/storage/umass.c Thu Mar 1 20:25:17 2012 (r232361) @@ -137,14 +137,6 @@ __FBSDID("$FreeBSD$"); #include -#define UMASS_EXT_BUFFER -#ifdef UMASS_EXT_BUFFER -/* this enables loading of virtual buffers into DMA */ -#define UMASS_USB_FLAGS .ext_buffer=1, -#else -#define UMASS_USB_FLAGS -#endif - #ifdef USB_DEBUG #define DIF(m, x) \ do { \ @@ -542,7 +534,7 @@ static struct usb_config umass_bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer=1,}, .callback = &umass_t_bbb_data_read_callback, .timeout = 0, /* overwritten later */ }, @@ -561,7 +553,7 @@ static struct usb_config umass_bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer=1,}, .callback = &umass_t_bbb_data_write_callback, .timeout = 0, /* overwritten later */ }, @@ -634,7 +626,7 @@ static struct usb_config umass_cbi_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer=1,}, .callback = &umass_t_cbi_data_read_callback, .timeout = 0, /* overwritten later */ }, @@ -653,7 +645,7 @@ static struct usb_config umass_cbi_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer=1,}, .callback = &umass_t_cbi_data_write_callback, .timeout = 0, /* overwritten later */ }, @@ -1053,9 +1045,7 @@ umass_detach(device_t dev) usbd_transfer_unsetup(sc->sc_xfer, UMASS_T_MAX); -#if (__FreeBSD_version >= 700037) mtx_lock(&sc->sc_mtx); -#endif /* cancel any leftover CCB's */ @@ -1063,9 +1053,8 @@ umass_detach(device_t dev) umass_cam_detach_sim(sc); -#if (__FreeBSD_version >= 700037) mtx_unlock(&sc->sc_mtx); -#endif + mtx_destroy(&sc->sc_mtx); return (0); /* success */ @@ -1206,7 +1195,6 @@ umass_t_bbb_reset1_callback(struct usb_x default: /* Error */ umass_tr_error(xfer, error); return; - } } @@ -1245,7 +1233,6 @@ tr_transferred: default: /* Error */ umass_tr_error(xfer, error); return; - } } @@ -1331,7 +1318,6 @@ umass_t_bbb_command_callback(struct usb_ default: /* Error */ umass_tr_error(xfer, error); return; - } } @@ -1340,19 +1326,12 @@ umass_t_bbb_data_read_callback(struct us { struct umass_softc *sc = usbd_xfer_softc(xfer); uint32_t max_bulk = usbd_xfer_max_len(xfer); -#ifndef UMASS_EXT_BUFFER - struct usb_page_cache *pc; -#endif int actlen, sumlen; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: -#ifndef UMASS_EXT_BUFFER - pc = usbd_xfer_get_frame(xfer, 0); - usbd_copy_out(pc, 0, sc->sc_transfer.data_ptr, actlen); -#endif sc->sc_transfer.data_rem -= actlen; sc->sc_transfer.data_ptr += actlen; sc->sc_transfer.actlen += actlen; @@ -1374,12 +1353,9 @@ umass_t_bbb_data_read_callback(struct us } usbd_xfer_set_timeout(xfer, sc->sc_transfer.data_timeout); -#ifdef UMASS_EXT_BUFFER usbd_xfer_set_frame_data(xfer, 0, sc->sc_transfer.data_ptr, max_bulk); -#else - usbd_xfer_set_frame_len(xfer, 0, max_bulk); -#endif + usbd_transfer_submit(xfer); return; @@ -1390,7 +1366,6 @@ umass_t_bbb_data_read_callback(struct us umass_transfer_start(sc, UMASS_T_BBB_DATA_RD_CS); } return; - } } @@ -1406,9 +1381,6 @@ umass_t_bbb_data_write_callback(struct u { struct umass_softc *sc = usbd_xfer_softc(xfer); uint32_t max_bulk = usbd_xfer_max_len(xfer); -#ifndef UMASS_EXT_BUFFER - struct usb_page_cache *pc; -#endif int actlen, sumlen; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); @@ -1436,14 +1408,8 @@ umass_t_bbb_data_write_callback(struct u } usbd_xfer_set_timeout(xfer, sc->sc_transfer.data_timeout); -#ifdef UMASS_EXT_BUFFER usbd_xfer_set_frame_data(xfer, 0, sc->sc_transfer.data_ptr, max_bulk); -#else - pc = usbd_xfer_get_frame(xfer, 0); - usbd_copy_in(pc, 0, sc->sc_transfer.data_ptr, max_bulk); - usbd_xfer_set_frame_len(xfer, 0, max_bulk); -#endif usbd_transfer_submit(xfer); return; @@ -1455,7 +1421,6 @@ umass_t_bbb_data_write_callback(struct u umass_transfer_start(sc, UMASS_T_BBB_DATA_WR_CS); } return; - } } @@ -1581,7 +1546,6 @@ tr_error: umass_transfer_start(sc, UMASS_T_BBB_DATA_RD_CS); } return; - } } @@ -1732,7 +1696,6 @@ umass_t_cbi_reset1_callback(struct usb_x else umass_transfer_start(sc, UMASS_T_CBI_RESET2); break; - } } @@ -1787,7 +1750,6 @@ tr_transferred: default: /* Error */ umass_tr_error(xfer, error); break; - } } @@ -1877,19 +1839,12 @@ umass_t_cbi_data_read_callback(struct us { struct umass_softc *sc = usbd_xfer_softc(xfer); uint32_t max_bulk = usbd_xfer_max_len(xfer); -#ifndef UMASS_EXT_BUFFER - struct usb_page_cache *pc; -#endif int actlen, sumlen; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: -#ifndef UMASS_EXT_BUFFER - pc = usbd_xfer_get_frame(xfer, 0); - usbd_copy_out(pc, 0, sc->sc_transfer.data_ptr, actlen); -#endif sc->sc_transfer.data_rem -= actlen; sc->sc_transfer.data_ptr += actlen; sc->sc_transfer.actlen += actlen; @@ -1911,12 +1866,9 @@ umass_t_cbi_data_read_callback(struct us } usbd_xfer_set_timeout(xfer, sc->sc_transfer.data_timeout); -#ifdef UMASS_EXT_BUFFER usbd_xfer_set_frame_data(xfer, 0, sc->sc_transfer.data_ptr, max_bulk); -#else - usbd_xfer_set_frame_len(xfer, 0, max_bulk); -#endif + usbd_transfer_submit(xfer); break; @@ -1928,7 +1880,6 @@ umass_t_cbi_data_read_callback(struct us umass_transfer_start(sc, UMASS_T_CBI_DATA_RD_CS); } break; - } } @@ -1944,9 +1895,6 @@ umass_t_cbi_data_write_callback(struct u { struct umass_softc *sc = usbd_xfer_softc(xfer); uint32_t max_bulk = usbd_xfer_max_len(xfer); -#ifndef UMASS_EXT_BUFFER - struct usb_page_cache *pc; -#endif int actlen, sumlen; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); @@ -1974,14 +1922,8 @@ umass_t_cbi_data_write_callback(struct u } usbd_xfer_set_timeout(xfer, sc->sc_transfer.data_timeout); -#ifdef UMASS_EXT_BUFFER usbd_xfer_set_frame_data(xfer, 0, sc->sc_transfer.data_ptr, max_bulk); -#else - pc = usbd_xfer_get_frame(xfer, 0); - usbd_copy_in(pc, 0, sc->sc_transfer.data_ptr, max_bulk); - usbd_xfer_set_frame_len(xfer, 0, max_bulk); -#endif usbd_transfer_submit(xfer); break; @@ -1994,7 +1936,6 @@ umass_t_cbi_data_write_callback(struct u umass_transfer_start(sc, UMASS_T_CBI_DATA_WR_CS); } break; - } } @@ -2096,7 +2037,6 @@ tr_setup: usbd_errstr(error)); umass_tr_error(xfer, error); break; - } } @@ -2125,9 +2065,7 @@ umass_cam_attach_sim(struct umass_softc DEVNAME_SIM, sc /* priv */ , sc->sc_unit /* unit number */ , -#if (__FreeBSD_version >= 700037) &sc->sc_mtx /* mutex */ , -#endif 1 /* maximum device openings */ , 0 /* maximum tagged device openings */ , devq); @@ -2137,27 +2075,15 @@ umass_cam_attach_sim(struct umass_softc return (ENOMEM); } -#if (__FreeBSD_version >= 700037) mtx_lock(&sc->sc_mtx); -#endif -#if (__FreeBSD_version >= 700048) - if (xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit) != CAM_SUCCESS) { + if (xpt_bus_register(sc->sc_sim, sc->sc_dev, + sc->sc_unit) != CAM_SUCCESS) { mtx_unlock(&sc->sc_mtx); return (ENOMEM); } -#else - if (xpt_bus_register(sc->sc_sim, sc->sc_unit) != CAM_SUCCESS) { -#if (__FreeBSD_version >= 700037) - mtx_unlock(&sc->sc_mtx); -#endif - return (ENOMEM); - } -#endif - -#if (__FreeBSD_version >= 700037) mtx_unlock(&sc->sc_mtx); -#endif + return (0); } @@ -2208,11 +2134,6 @@ umass_cam_action(struct cam_sim *sim, un xpt_done(ccb); return; } - if (sc) { -#if (__FreeBSD_version < 700037) - mtx_lock(&sc->sc_mtx); -#endif - } /* * Verify, depending on the operation to perform, that we either got * a valid sc, because an existing target was referenced, or @@ -2415,12 +2336,11 @@ umass_cam_action(struct cam_sim *sim, un strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->bus_id = sc->sc_unit; -#if (__FreeBSD_version >= 700025) cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_2; cpi->transport = XPORT_USB; cpi->transport_version = 0; -#endif + if (sc == NULL) { cpi->base_transfer_speed = 0; cpi->max_lun = 0; @@ -2472,16 +2392,12 @@ umass_cam_action(struct cam_sim *sim, un cam_sim_path(sc->sc_sim), ccb->ccb_h.target_id, ccb->ccb_h.target_lun); -#if (__FreeBSD_version >= 700025) cts->protocol = PROTO_SCSI; cts->protocol_version = SCSI_REV_2; cts->transport = XPORT_USB; cts->transport_version = 0; cts->xport_specific.valid = 0; -#else - cts->valid = 0; - cts->flags = 0; /* no disconnection, tagging */ -#endif + ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; @@ -2524,11 +2440,6 @@ umass_cam_action(struct cam_sim *sim, un } done: -#if (__FreeBSD_version < 700037) - if (sc) { - mtx_unlock(&sc->sc_mtx); - } -#endif return; } From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:32:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A81E41065741; Thu, 1 Mar 2012 20:32: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 7E2868FC13; Thu, 1 Mar 2012 20:32:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21KW3QS095324; Thu, 1 Mar 2012 20:32:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KW325095322; Thu, 1 Mar 2012 20:32:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203012032.q21KW325095322@svn.freebsd.org> From: John Baldwin Date: Thu, 1 Mar 2012 20:32: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: r232362 - 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, 01 Mar 2012 20:32:03 -0000 Author: jhb Date: Thu Mar 1 20:32:02 2012 New Revision: 232362 URL: http://svn.freebsd.org/changeset/base/232362 Log: Sort function prototypes. Modified: head/share/man/man9/pci.9 Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Thu Mar 1 20:25:17 2012 (r232361) +++ head/share/man/man9/pci.9 Thu Mar 1 20:32:02 2012 (r232362) @@ -30,51 +30,51 @@ .Os .Sh NAME .Nm pci , -.Nm pci_read_config , -.Nm pci_write_config , -.Nm pci_enable_busmaster , .Nm pci_disable_busmaster , -.Nm pci_enable_io , .Nm pci_disable_io , -.Nm pci_set_powerstate , -.Nm pci_get_powerstate , -.Nm pci_save_state , -.Nm pci_restore_state , +.Nm pci_enable_busmaster , +.Nm pci_enable_io , .Nm pci_find_bsf , .Nm pci_find_dbsf , -.Nm pci_find_device +.Nm pci_find_device , +.Nm pci_get_powerstate , +.Nm pci_read_config , +.Nm pci_restore_state , +.Nm pci_save_state , +.Nm pci_set_powerstate , +.Nm pci_write_config .Nd PCI bus interface .Sh SYNOPSIS .In sys/bus.h .In dev/pci/pcivar.h .In dev/pci/pcireg.h .In machine/pci_cfgreg.h -.Ft void -.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" -.Ft int -.Fn pci_enable_busmaster "device_t dev" .Ft int .Fn pci_disable_busmaster "device_t dev" .Ft int -.Fn pci_enable_io "device_t dev" "int space" -.Ft int .Fn pci_disable_io "device_t dev" "int space" .Ft int -.Fn pci_set_powerstate "device_t dev" "int state" +.Fn pci_enable_busmaster "device_t dev" .Ft int -.Fn pci_get_powerstate "device_t dev" -.Ft uint32_t -.Fn pci_read_config "device_t dev" "int reg" "int width" -.Ft void -.Fn pci_save_state "device_t dev" -.Ft void -.Fn pci_restore_state "device_t dev" +.Fn pci_enable_io "device_t dev" "int space" .Ft device_t .Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t .Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t .Fn pci_find_device "uint16_t vendor" "uint16_t device" +.Ft int +.Fn pci_get_powerstate "device_t dev" +.Ft uint32_t +.Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft void +.Fn pci_restore_state "device_t dev" +.Ft void +.Fn pci_save_state "device_t dev" +.Ft int +.Fn pci_set_powerstate "device_t dev" "int state" +.Ft void +.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" .Sh DESCRIPTION The .Nm From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:32:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A679E10656DC for ; Thu, 1 Mar 2012 20:32:27 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 397558FC25 for ; Thu, 1 Mar 2012 20:32:26 +0000 (UTC) Received: by wibhn6 with SMTP id hn6so248056wib.13 for ; Thu, 01 Mar 2012 12:32:26 -0800 (PST) Received-SPF: pass (google.com: domain of juli@clockworksquid.com designates 10.180.104.137 as permitted sender) client-ip=10.180.104.137; Authentication-Results: mr.google.com; spf=pass (google.com: domain of juli@clockworksquid.com designates 10.180.104.137 as permitted sender) smtp.mail=juli@clockworksquid.com Received: from mr.google.com ([10.180.104.137]) by 10.180.104.137 with SMTP id ge9mr14052947wib.20.1330633946295 (num_hops = 1); Thu, 01 Mar 2012 12:32:26 -0800 (PST) Received: by 10.180.104.137 with SMTP id ge9mr11268853wib.20.1330633946211; Thu, 01 Mar 2012 12:32:26 -0800 (PST) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.227.209.78 with HTTP; Thu, 1 Mar 2012 12:32:06 -0800 (PST) In-Reply-To: <201202290548.q1T5mUfd011230@svn.freebsd.org> References: <201202290548.q1T5mUfd011230@svn.freebsd.org> From: Juli Mallett Date: Thu, 1 Mar 2012 12:32:06 -0800 X-Google-Sender-Auth: IGqJXlDh2EXYGvMVVQNJ084ZnKA Message-ID: To: Oleksandr Tymoshenko Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnQpEShIIg4oCFURwBpQtmPqdv3seist9d815maE8puLwgYCHALcf84xi1rlZPVvb9/bje6 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232289 - in head/sys/mips/cavium: . octe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 20:32:27 -0000 On Tue, Feb 28, 2012 at 21:48, Oleksandr Tymoshenko wro= te: > Author: gonzo > Date: Wed Feb 29 05:48:29 2012 > New Revision: 232289 > URL: http://svn.freebsd.org/changeset/base/232289 > > Log: > =C2=A0Revert part of old logic of assigning MAC addressess: > > =C2=A0- Reserver respective number of addresses for managment port > =C2=A0- octm uses base address directly > =C2=A0- other drivers get MACs on "first come first served" basis Thank you :) Hopefully {down,up,side}stream consumers that dislike the logic used to determine the number of management ports will find it easy enough to isolate that logic with an ifdef now, and everyone will be happy. I appreciate the work you put in to maintain consistency with and without octm in the kernel while keeping the abstracted MAC allocation interface. From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:36:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B48FD106564A; Thu, 1 Mar 2012 20:36:50 +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 A43CC8FC16; Thu, 1 Mar 2012 20:36:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21Kaojn095531; Thu, 1 Mar 2012 20:36:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KaoHQ095529; Thu, 1 Mar 2012 20:36:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203012036.q21KaoHQ095529@svn.freebsd.org> From: John Baldwin Date: Thu, 1 Mar 2012 20:36: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: r232363 - 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, 01 Mar 2012 20:36:50 -0000 Author: jhb Date: Thu Mar 1 20:36:50 2012 New Revision: 232363 URL: http://svn.freebsd.org/changeset/base/232363 Log: Update the documentation on pci_get/set_powerstate(). These methods are not ACPI-specific at all, but deal with PCI power states. Also, pci_set_powerstate() fails with EOPNOTSUPP if a request is made that the underlying device does not support rather than falling back to somehow setting D0. Modified: head/share/man/man9/pci.9 Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Thu Mar 1 20:32:02 2012 (r232362) +++ head/share/man/man9/pci.9 Thu Mar 1 20:36:50 2012 (r232363) @@ -145,13 +145,13 @@ the configuration space. .Pp The .Fn pci_get_powerstate -function returns the current ACPI power state of the device +function returns the current power state of the device .Fa dev . If the device does not support power management capabilities, then the default state of .Dv PCI_POWERSTATE_D0 is returned. -The following power states are defined by ACPI: +The following power states are defined by PCI: .Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN" .It Dv PCI_POWERSTATE_D0 State in which device is on and running. @@ -183,15 +183,13 @@ The .Fn pci_set_powerstate function is used to transition the device .Fa dev -to the ACPI power state +to the PCI power state .Fa state . -It checks to see if the device is PCI 2.2 compliant. -If so, it checks the -capabilities pointer to determine which power states the device supports. -If the device does not have power management capabilities, the default state -of -.Dv PCI_POWERSTATE_D0 -is set. +If the device does not support power management capabilities or +it does not support the specific power state +.Fa state , +then the function will fail with +.Er EOPNOTSUPP . .Pp The .Fn pci_save_state From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:43:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98472106566C; Thu, 1 Mar 2012 20:43:41 +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 6D60F8FC13; Thu, 1 Mar 2012 20:43:41 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 11D7D46B1A; Thu, 1 Mar 2012 15:43:41 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 96EC9B966; Thu, 1 Mar 2012 15:43:40 -0500 (EST) From: John Baldwin To: Dimitry Andric Date: Thu, 1 Mar 2012 15:38:24 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202292258.q1TMwqYk048993@svn.freebsd.org> <201203011434.12583.jhb@freebsd.org> <4F4FDA83.2010702@FreeBSD.org> In-Reply-To: <4F4FDA83.2010702@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201203011538.24647.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Mar 2012 15:43:40 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232322 - in head: . gnu/usr.bin/cc/c++ gnu/usr.bin/cc/cc gnu/usr.bin/cc/cpp share/mk sys/conf tools/build/options usr.bin/clang/clang X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 20:43:41 -0000 On Thursday, March 01, 2012 3:22:27 pm Dimitry Andric wrote: > On 2012-03-01 20:34, John Baldwin wrote: > > On Wednesday, February 29, 2012 5:58:52 pm Dimitry Andric wrote: > >> Author: dim > >> Date: Wed Feb 29 22:58:51 2012 > >> New Revision: 232322 > >> URL: http://svn.freebsd.org/changeset/base/232322 > >> > >> Log: > >> Add a WITH_CLANG_IS_CC option for src.conf(5), disabled by default, that > >> installs clang as /usr/bin/cc, /usr/bin/c++ and /usr/bin/cpp. > >> > >> Note this does *not* disable building and installing gcc, which will > >> still be available as /usr/bin/gcc, /usr/bin/g++ and /usr/bin/gcpp. If > >> you want to disable gcc completely, you must use WITHOUT_GCC. > >> > >> MFC after: 2 weeks > > > > This seems to have broken the ability to build world on older machines. > > Specifically, I have a little netbook whose last world was from May 2011 and > > when I tried to do a buildworld today, it blew up with this trying to do a > > build: > > > >> make buildworld > > "/usr/src/Makefile.inc1", line 1111: Malformed conditional (${MK_GCC} != "no" > > && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang")) > > "/usr/src/Makefile.inc1", line 1113: if-less endif > > "/usr/src/Makefile.inc1", line 1173: Malformed conditional (${MK_CLANG} != > > "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")) > > "/usr/src/Makefile.inc1", line 1176: if-less endif > > "/usr/src/Makefile.inc1", line 1178: Malformed conditional (${MK_GCC} != "no" > > && (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang")) > > "/usr/src/Makefile.inc1", line 1180: if-less endif > > "/usr/src/Makefile.inc1", line 1241: Malformed conditional (${MK_LIBCPLUSPLUS} > > != "no") > > "/usr/src/Makefile.inc1", line 1243: if-less endif > > make: fatal errors encountered -- cannot continue > > *** Error code 1 > > Strange, it's like it isn't reading the updated bsd.own.mk (which is > where all the MK_XXX settings originate). Are you sure your tree is > completely updated? What are your make.conf and src.conf settings? Turns out to be a false alarm, my tree wasn't fully updated due to csup(1) sucking. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:45:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E8E11065672; Thu, 1 Mar 2012 20:45:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DF3F8FC13; Thu, 1 Mar 2012 20:45:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21KjIDD095869; Thu, 1 Mar 2012 20:45:18 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KjIfu095868; Thu, 1 Mar 2012 20:45:18 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201203012045.q21KjIfu095868@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 1 Mar 2012 20:45: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: r232364 - head/tools/regression/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 20:45:18 -0000 Author: hselasky Date: Thu Mar 1 20:45:17 2012 New Revision: 232364 URL: http://svn.freebsd.org/changeset/base/232364 Log: Add regression test for USB enumeration. MFC after: 1 week Added: head/tools/regression/usb/ head/tools/regression/usb/usb_enum.t (contents, props changed) Added: head/tools/regression/usb/usb_enum.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usb/usb_enum.t Thu Mar 1 20:45:17 2012 (r232364) @@ -0,0 +1,30 @@ +#!/bin/sh +# $FreeBSD$ + +# +# About: +# This script implements a simple USB enumeration test +# +# Usage: +# ./usb_enum.t ugenX.Y +# + +echo "1..100" + +if [ "$1" = "" ]; then +# First Root HUB +DEV="ugen0.1" +else +# Custom device +DEV="$1" +fi + +for N in $(jot 100 1) +do +if [ -c /dev/$DEV ] && [ -r /dev/$DEV ] && usbconfig -d $DEV reset ; then +echo "ok $N" +else +echo "not ok $N" +fi +done + From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 20:58:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E3AE106564A; Thu, 1 Mar 2012 20:58:21 +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 547C58FC1A; Thu, 1 Mar 2012 20:58:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21KwLXS096396; Thu, 1 Mar 2012 20:58:21 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21KwLXZ096393; Thu, 1 Mar 2012 20:58:21 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201203012058.q21KwLXZ096393@svn.freebsd.org> From: Alexander Kabaev Date: Thu, 1 Mar 2012 20: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: r232365 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 20:58:21 -0000 Author: kan Date: Thu Mar 1 20:58:20 2012 New Revision: 232365 URL: http://svn.freebsd.org/changeset/base/232365 Log: Provide pre/post transfer method callbacks for icbbb clients. These are helful when making certain drivers work on both Linux and FreeBSD without changing the code flow too much. Reviewed by: kib, wlosh MFC after: 1 month Modified: head/sys/dev/iicbus/iicbb.c head/sys/dev/iicbus/iicbb_if.m Modified: head/sys/dev/iicbus/iicbb.c ============================================================================== --- head/sys/dev/iicbus/iicbb.c Thu Mar 1 20:45:17 2012 (r232364) +++ head/sys/dev/iicbus/iicbb.c Thu Mar 1 20:58:20 2012 (r232365) @@ -76,6 +76,7 @@ static int iicbb_stop(device_t); static int iicbb_write(device_t, const char *, int, int *, int); static int iicbb_read(device_t, char *, int, int *, int, int); static int iicbb_reset(device_t, u_char, u_char, u_char *); +static int iicbb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs); static device_method_t iicbb_methods[] = { /* device interface */ @@ -95,7 +96,7 @@ static device_method_t iicbb_methods[] = DEVMETHOD(iicbus_write, iicbb_write), DEVMETHOD(iicbus_read, iicbb_read), DEVMETHOD(iicbus_reset, iicbb_reset), - DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), + DEVMETHOD(iicbus_transfer, iicbb_transfer), { 0, 0 } }; @@ -424,6 +425,21 @@ iicbb_read(device_t dev, char * buf, int return (0); } +static int +iicbb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) +{ + int error; + + error = IICBB_PRE_XFER(device_get_parent(dev)); + if (error) + return (error); + + error = iicbus_transfer_gen(dev, msgs, nmsgs); + + IICBB_POST_XFER(device_get_parent(dev)); + return (error); +} + DRIVER_MODULE(iicbus, iicbb, iicbus_driver, iicbus_devclass, 0, 0); MODULE_DEPEND(iicbb, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); Modified: head/sys/dev/iicbus/iicbb_if.m ============================================================================== --- head/sys/dev/iicbus/iicbb_if.m Thu Mar 1 20:45:17 2012 (r232364) +++ head/sys/dev/iicbus/iicbb_if.m Thu Mar 1 20:58:20 2012 (r232365) @@ -31,13 +31,50 @@ INTERFACE iicbb; # +# Default implementation of optional methods +# +CODE { + static int + null_pre_xfer(device_t dev) + { + return 0; + } + + static void + null_post_xfer(device_t dev) + + { + } + + static int + null_callback(device_t dev, int index, caddr_t data) + { + return 0; + } +}; + +# # iicbus callback # METHOD int callback { device_t dev; int index; caddr_t data; -}; +} DEFAULT null_callback; + +# +# Prepare device for I2C transfer +# +METHOD int pre_xfer { + device_t dev; +} DEFAULT null_pre_xfer; + +# +# Cleanup device after I2C transfer +# +METHOD void post_xfer { + device_t dev; +} DEFAULT null_post_xfer; # # Set I2C bus data line From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 21:23:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5E0F106566C; Thu, 1 Mar 2012 21:23:27 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 939438FC14; Thu, 1 Mar 2012 21:23:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21LNRRk097323; Thu, 1 Mar 2012 21:23:27 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21LNRMF097318; Thu, 1 Mar 2012 21:23:27 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201203012123.q21LNRMF097318@svn.freebsd.org> From: Davide Italiano Date: Thu, 1 Mar 2012 21:23: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: r232366 - in head: lib/libpmc sys/dev/hwpmc 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, 01 Mar 2012 21:23:27 -0000 Author: davide Date: Thu Mar 1 21:23:26 2012 New Revision: 232366 URL: http://svn.freebsd.org/changeset/base/232366 Log: - Add support for the Intel Sandy Bridge microarchitecture (both core and uncore counting events) - New manpages with event lists. - Add MSRs for the Intel Sandy Bridge microarchitecture Reviewed by: attilio, brueffer, fabient Approved by: gnn (mentor) MFC after: 3 weeks Added: head/lib/libpmc/pmc.sandybridge.3 (contents, props changed) head/lib/libpmc/pmc.sandybridgeuc.3 (contents, props changed) Modified: head/lib/libpmc/Makefile head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/hwpmc_intel.c head/sys/dev/hwpmc/hwpmc_uncore.c head/sys/dev/hwpmc/hwpmc_uncore.h head/sys/dev/hwpmc/pmc_events.h head/sys/sys/pmc.h Modified: head/lib/libpmc/Makefile ============================================================================== --- head/lib/libpmc/Makefile Thu Mar 1 20:58:20 2012 (r232365) +++ head/lib/libpmc/Makefile Thu Mar 1 21:23:26 2012 (r232366) @@ -35,6 +35,8 @@ MAN+= pmc.p5.3 MAN+= pmc.p6.3 MAN+= pmc.corei7.3 MAN+= pmc.corei7uc.3 +MAN+= pmc.sandybridge.3 +MAN+= pmc.sandybridgeuc.3 MAN+= pmc.westmere.3 MAN+= pmc.westmereuc.3 MAN+= pmc.tsc.3 Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Thu Mar 1 20:58:20 2012 (r232365) +++ head/lib/libpmc/libpmc.c Thu Mar 1 21:23:26 2012 (r232366) @@ -179,6 +179,11 @@ static const struct pmc_event_descr core __PMC_EV_ALIAS_COREI7() }; +static const struct pmc_event_descr sandybridge_event_table[] = +{ + __PMC_EV_ALIAS_SANDYBRIDGE() +}; + static const struct pmc_event_descr westmere_event_table[] = { __PMC_EV_ALIAS_WESTMERE() @@ -189,6 +194,11 @@ static const struct pmc_event_descr core __PMC_EV_ALIAS_COREI7UC() }; +static const struct pmc_event_descr sandybridgeuc_event_table[] = +{ + __PMC_EV_ALIAS_SANDYBRIDGEUC() +}; + static const struct pmc_event_descr westmereuc_event_table[] = { __PMC_EV_ALIAS_WESTMEREUC() @@ -208,6 +218,7 @@ PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); @@ -242,9 +253,11 @@ PMC_CLASS_TABLE_DESC(atom, IAP, atom, ia PMC_CLASS_TABLE_DESC(core, IAP, core, iap); PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap); PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap); +PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap); PMC_CLASS_TABLE_DESC(westmere, IAP, westmere, iap); PMC_CLASS_TABLE_DESC(ucf, UCF, ucf, ucf); PMC_CLASS_TABLE_DESC(corei7uc, UCP, corei7uc, ucp); +PMC_CLASS_TABLE_DESC(sandybridgeuc, UCP, sandybridgeuc, ucp); PMC_CLASS_TABLE_DESC(westmereuc, UCP, westmereuc, ucp); #endif #if defined(__i386__) @@ -530,6 +543,8 @@ static struct pmc_event_alias core2_alia #define atom_aliases_without_iaf core2_aliases_without_iaf #define corei7_aliases core2_aliases #define corei7_aliases_without_iaf core2_aliases_without_iaf +#define sandybridge_aliases core2_aliases +#define sandybridge_aliases_without_iaf core2_aliases_without_iaf #define westmere_aliases core2_aliases #define westmere_aliases_without_iaf core2_aliases_without_iaf @@ -2562,6 +2577,10 @@ pmc_event_names_of_class(enum pmc_class ev = corei7_event_table; count = PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_SANDYBRIDGE: + ev = sandybridge_event_table; + count = PMC_EVENT_TABLE_SIZE(sandybridge); + break; case PMC_CPU_INTEL_WESTMERE: ev = westmere_event_table; count = PMC_EVENT_TABLE_SIZE(westmere); @@ -2583,6 +2602,10 @@ pmc_event_names_of_class(enum pmc_class ev = corei7uc_event_table; count = PMC_EVENT_TABLE_SIZE(corei7uc); break; + case PMC_CPU_INTEL_SANDYBRIDGE: + ev = sandybridgeuc_event_table; + count = PMC_EVENT_TABLE_SIZE(sandybridgeuc); + break; case PMC_CPU_INTEL_WESTMERE: ev = westmereuc_event_table; count = PMC_EVENT_TABLE_SIZE(westmereuc); @@ -2814,6 +2837,11 @@ pmc_init(void) pmc_class_table[n++] = &corei7uc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(corei7); break; + case PMC_CPU_INTEL_SANDYBRIDGE: + pmc_class_table[n++] = &ucf_class_table_descr; + pmc_class_table[n++] = &sandybridgeuc_class_table_descr; + PMC_MDEP_INIT_INTEL_V2(sandybridge); + break; case PMC_CPU_INTEL_WESTMERE: pmc_class_table[n++] = &ucf_class_table_descr; pmc_class_table[n++] = &westmereuc_class_table_descr; @@ -2937,6 +2965,10 @@ _pmc_name_of_event(enum pmc_event pe, en ev = corei7_event_table; evfence = corei7_event_table + PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_SANDYBRIDGE: + ev = sandybridge_event_table; + evfence = sandybridge_event_table + PMC_EVENT_TABLE_SIZE(sandybridge); + break; case PMC_CPU_INTEL_WESTMERE: ev = westmere_event_table; evfence = westmere_event_table + PMC_EVENT_TABLE_SIZE(westmere); @@ -2953,6 +2985,10 @@ _pmc_name_of_event(enum pmc_event pe, en ev = corei7uc_event_table; evfence = corei7uc_event_table + PMC_EVENT_TABLE_SIZE(corei7uc); break; + case PMC_CPU_INTEL_SANDYBRIDGE: + ev = sandybridgeuc_event_table; + evfence = sandybridgeuc_event_table + PMC_EVENT_TABLE_SIZE(sandybridgeuc); + break; case PMC_CPU_INTEL_WESTMERE: ev = westmereuc_event_table; evfence = westmereuc_event_table + PMC_EVENT_TABLE_SIZE(westmereuc); Added: head/lib/libpmc/pmc.sandybridge.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmc/pmc.sandybridge.3 Thu Mar 1 21:23:26 2012 (r232366) @@ -0,0 +1,932 @@ +.\" Copyright (c) 2012 Davide Italiano +.\" 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 AUTHORS 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 AUTHORS 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 February 12, 2012 +.Dt PMC.SANDYBRIDGE 3 +.Os +.Sh NAME +.Nm pmc.sandybridge +.Nd measurement events for +.Tn Intel +.Tn Sandy Bridge +family CPUs +.Sh LIBRARY +.Lb libpmc +.Sh SYNOPSIS +.In pmc.h +.Sh DESCRIPTION +.Tn Intel +.Tn "Sandy Bridge" +CPUs contain PMCs conforming to the version 3 of the +.Tn Intel +performance measurement architecture. +These CPUs may contain up to three classes of PMCs: +.Bl -tag -width "Li PMC_CLASS_IAP" +.It Li PMC_CLASS_IAF +Fixed-function counters that count only one hardware event per counter. +.It Li PMC_CLASS_IAP +Programmable counters that may be configured to count one of a defined +set of hardware events. +.It Li PMC_CLASS_TSC +These PMCs are documented in +.Xr pmc.tsc 3 . +.El +.Pp +The number of PMCs available in each class and their widths need to be +determined at run time by calling +.Xr pmc_cpuinfo 3 . +.Pp +Intel Sandy Bridge PMCs are documented in +.Rs +.%B "Intel(R) 64 and IA-32 Architectures Software Developers Manual" +.%T "Volume 3B: System Programming Guide, Part 2" +.%N "Order Number: 253669-039US" +.%D May 2011 +.%Q "Intel Corporation" +.Re +.Ss SANDY BRIDGE FIXED FUNCTION PMCS +These PMCs and their supported events are documented in +.Xr pmc.iaf 3 . +.Ss SANDY BRIDGE PROGRAMMABLE PMCS +The programmable PMCs support the following capabilities: +.Bl -column "PMC_CAP_INTERRUPT" "Support" +.It Em Capability Ta Em Support +.It PMC_CAP_CASCADE Ta \&No +.It PMC_CAP_EDGE Ta Yes +.It PMC_CAP_INTERRUPT Ta Yes +.It PMC_CAP_INVERT Ta Yes +.It PMC_CAP_READ Ta Yes +.It PMC_CAP_PRECISE Ta \&No +.It PMC_CAP_SYSTEM Ta Yes +.It PMC_CAP_TAGGING Ta \&No +.It PMC_CAP_THRESHOLD Ta Yes +.It PMC_CAP_USER Ta Yes +.It PMC_CAP_WRITE Ta Yes +.El +.Ss Event Qualifiers +Event specifiers for these PMCs support the following common +qualifiers: +.Bl -tag -width indent +.It Li rsp= Ns Ar value +Configure the Off-core Response bits. +.Bl -tag -width indent +.It Li DMND_DATA_RD +Counts the number of demand and DCU prefetch data reads of full +and partial cachelines as well as demand data page table entry +cacheline reads. +Does not count L2 data read prefetches or instruction fetches. +.It Li DMND_RFO +Counts the number of demand and DCU prefetch reads for ownership +(RFO) requests generated by a write to data cacheline. +Does not count L2 RFO. +.It Li DMND_IFETCH +Counts the number of demand and DCU prefetch instruction cacheline +reads. +Does not count L2 code read prefetches. +.It Li WB +Counts the number of writeback (modified to exclusive) transactions. +.It Li PF_DATA_RD +Counts the number of data cacheline reads generated by L2 prefetchers. +.It Li PF_RFO +Counts the number of RFO requests generated by L2 prefetchers. +.It Li PF_IFETCH +Counts the number of code reads generated by L2 prefetchers. +.It Li OTHER +Counts one of the following transaction types, including L3 invalidate, +I/O, full or partial writes, WC or non-temporal stores, CLFLUSH, Fences, +lock, unlock, split lock. +.It Li UNCORE_HIT +L3 Hit: local or remote home requests that hit L3 cache in the uncore +with no coherency actions required (snooping). +.It Li OTHER_CORE_HIT_SNP +L3 Hit: local or remote home requests that hit L3 cache in the uncore +and was serviced by another core with a cross core snoop where no modified +copies were found (clean). +.It Li OTHER_CORE_HITM +L3 Hit: local or remote home requests that hit L3 cache in the uncore +and was serviced by another core with a cross core snoop where modified +copies were found (HITM). +.It Li REMOTE_CACHE_FWD +L3 Miss: local homed requests that missed the L3 cache and was serviced +by forwarded data following a cross package snoop where no modified +copies found. +(Remote home requests are not counted) +.It Li REMOTE_DRAM +L3 Miss: remote home requests that missed the L3 cache and were serviced +by remote DRAM. +.It Li LOCAL_DRAM +L3 Miss: local home requests that missed the L3 cache and were serviced +by local DRAM. +.It Li NON_DRAM +Non-DRAM requests that were serviced by IOH. +.El +.It Li cmask= Ns Ar value +Configure the PMC to increment only if the number of configured +events measured in a cycle is greater than or equal to +.Ar value . +.It Li edge +Configure the PMC to count the number of de-asserted to asserted +transitions of the conditions expressed by the other qualifiers. +If specified, the counter will increment only once whenever a +condition becomes true, irrespective of the number of clocks during +which the condition remains true. +.It Li inv +Invert the sense of comparison when the +.Dq Li cmask +qualifier is present, making the counter increment when the number of +events per cycle is less than the value specified by the +.Dq Li cmask +qualifier. +.It Li os +Configure the PMC to count events happening at processor privilege +level 0. +.It Li usr +Configure the PMC to count events occurring at privilege levels 1, 2 +or 3. +.El +.Pp +If neither of the +.Dq Li os +or +.Dq Li usr +qualifiers are specified, the default is to enable both. +.Ss Event Specifiers (Programmable PMCs) +Sandy Bridge programmable PMCs support the following events: +.Bl -tag -width indent +.It Li LD_BLOCKS.DATA_UNKNOWN +.Pq EVENT_03H, Umask 01H +Blocked loads due to store buffer blocks with unknown data. +.It Li LD_BLOCKS.STORE_FORWARD +.Pq Event 03H, Umask 02H +Loads blocked by overlapping with store buffer that cannot be forwarded. +.It Li LD_BLOCKS.NO_SR +.Pq Event 03H, Umask 08H +# of Split loads blocked due to resource not available. +.It Li LD_BLOCKS.ALL_BLOCK +.Pq EVENT_03H, Umask 10H +Number of cases where any load is blocked but has no DCU miss. +.It Li MISALIGN_MEM_REF.LOADS +.Pq Event 05H, Umask 01H +Speculative cache-line split load uops dispatched to L1D. +.It Li MISALIGN_MEM_REF.STORES +.Pq Event 05H, Umask 02H +Speculative cache-line split Store-address uops dispatched to L1D. +.It Li LD_BLOCKS_PARTIAL.ADDRESS_ALIAS +.Pq Event 07H, Umask 01H +False dependencies in MOB due to partial compare on address. +.It Li LD_BLOCKS_PARTIAL.ALL_STA_BLOCK +.Pq Event 07H, Umask 08H +The number of times that load operations are temporarily blocked because of +older stores, with addresses that are not yet known. +A load operation may incur more than one block of this type. +.It LI DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK +.Pq Event 08H, Umask 01H +Misses in all TLB levels that cause a page walk of any page size. +.It Li DTLB_LOAD_MISSES.WALK_COMPLETED +.Pq Event 08H, Umask 02H +Misses in all TLB levels that caused page walk completed of any size. +.It Li DTLB_LOAD_MISSES.WALK_DURATION +.Pq Event 08H, Umask 04H +Cycle PMH is busy with a walk. +.It Li DTLB_LOAD_MISSES.STLB_HIT +.Pq Event 08H, Umask 10H +Number of cache load STLB hits. +No page walk. +.It Li INT_MISC.RECOVERY_CYCLES +.Pq Event 0DH, Umask 03H +Cycles waiting to recover after Machine Clears or JEClear. +Set Cmask = 1. +Set Edge to count occurrences +.It Li INT_MISC.RAT_STALL_CYCLES +.Pq Event 0DH, Umask 40H +Cycles RAT external stall is sent to IDQ for this thread. +.It Li UOPS_ISSUED.ANY +.Pq Event 0EH, Umask 01H +Increments each cycle the # of Uops issued by the RAT to RS. +Set Cmask = 1, Inv = 1, Any= 1 to count stalled cycles of this core. +Set Cmask = 1, Inv = 1 to count stalled cycles +.It Li FP_COMP_OPS_EXE.X87 +.Pq Event 10H, Umask 01H +Counts number of X87 uops executed. +.It Li FP_COMP_OPS_EXE.SSE_FP_PACKED_DOUBLE +.Pq Event 10H, Umask 10H +Counts number of SSE* double precision FP packed uops executed. +.It Li FP_COMP_OPS_EXE.SSE_FP_SCALAR_SINGLE +.Pq Event 10H, Umask 20H +Counts number of SSE* single precision FP scalar uops executed. +.It Li FP_COMP_OPS_EXE.SSE_PACKED_SINGLE +.Pq Event 10H, Umask 40H +Counts number of SSE* single precision FP packed uops executed. +.It LiFP_COMP_OPS_EXE.SSE_SCALAR_DOUBLE +.Pq Event 10H, Umask 80H +Counts number of SSE* double precision FP scalar uops executed. +.It Li SIMD_FP_256.PACKED_SINGLE +.Pq Event 11H, Umask 01H +Counts 256-bit packed single-precision floating-point instructions. +.It Li SIMD_FP_256.PACKED_DOUBLE +.Pq Event 11H, Umask 02H +Counts 256-bit packed double-precision floating-point instructions. +.It Li ARITH.FPU_DIV_ACTIVE +.Pq Event 14H, Umask 01H +Cycles that the divider is active, includes INT and FP. +Set 'edge =1, cmask=1' to count the number of divides. +.It Li INSTS_WRITTEN_TO_IQ.INSTS +.Pq Event 17H, Umask 01H +Counts the number of instructions written into the IQ every cycle. +.It Li L2_RQSTS.DEMAND_DATA_RD_HIT +.Pq Event 24H, Umask 01H +Demand Data Read requests that hit L2 cache. +.It Li L2_RQSTS.ALL_DEMAND_DATA_RD +.Pq Event 24H, Umask 03H +Counts any demand and L1 HW prefetch data load requests to L2. +.It Li L2_RQSTS.RFO_HITS +.Pq Event 24H, Umask 04H +Counts the number of store RFO requests that hit the L2 cache. +.It Li L2_RQSTS.RFO_MISS +.Pq Event 24H, Umask 08H +Counts the number of store RFO requests that miss the L2 cache. +.It Li L2_RQSTS.ALL_RFO +.Pq Event 24H, Umask 0CH +Counts all L2 store RFO requests. +.It Li L2_RQSTS.CODE_RD_HIT +.Pq Event 24H, Umask 10H +Number of instruction fetches that hit the L2 cache. +.It Li L2_RQSTS.CODE_RD_MISS +.Pq Event 24H, Umask 20H +Number of instruction fetches that missed the L2 cache. +.It Li L2_RQSTS.ALL_CODE_RD +.Pq Event 24H, Umask 30H +Counts all L2 code requests. +.It Li L2_RQSTS.PF_HIT +.Pq Event 24H, Umask 40H +Requests from L2 Hardware prefetcher that hit L2. +.It Li L2_RQSTS.PF_MISS +.Pq Event 24H, Umask 80H +Requests from L2 Hardware prefetcher that missed L2. +.It Li L2_RQSTS.ALL_PF +.Pq Event 24H, Umask C0H +Any requests from L2 Hardware prefetchers. +.It Li L2_STORE_LOCK_RQSTS.MISS +.Pq Event 27H, Umask 01H +RFOs that miss cache lines. +.It Li L2_STORE_LOCK_RQSTS.HIT_E +.Pq Event 27H, Umask 04H +RFOs that hit cache lines in E state. +.It Li L2_STORE_LOCK_RQSTS.HIT_M +.Pq EVENT_27H, Umask 08H +RFOs that hit cache lines in M state. +.It Li L2_STORE_LOCK_RQSTS.ALL +.Pq EVENT_27H, Umask 0FH +RFOs that access cache lines in any state. +.It Li L2_L1D_WB_RQSTS.HIT_E +.Pq Event 28H, Umask 04H +Not rejected writebacks from L1D to L2 cache lines in E state. +.It Li L2_L1D_WB_RQSTS.HIT_M +.Pq Event 28H, Umask 08H +Not rejected writebacks from L1D to L2 cache lines in M state. +.It Li LONGEST_LAT_CACHE.REFERENCE +.Pq Event 2EH, Umask 4FH +This event counts requests originating from the core that reference a cache +line in the last level cache. +.It Li LONGEST_LAT_CACHE.MISS +.Pq Event 2EH, Umask 41H +This event counts each cache miss condition for references to the last level +cache. +.It Li CPU_CLK_UNHALTED.THREAD_P +.Pq Event 3CH, Umask 00H +Counts the number of thread cycles while the thread is not in a halt state. +The thread enters the halt state when it is running the HLT instruction. +The core frequency may change from time to time due to power or thermal +throttling. +.It Li CPU_CLK_THREAD_UNHALTED.REF_XCLK +.Pq Event 3CH, Umask 01H +Increments at the frequency of XCLK (100 MHz) when not halted. +.It Li L1D_PEND_MISS.PENDING +.Pq Event 48H, Umask 01H +Increments the number of outstanding L1D misses every cycle. +Set Cmask = 1 and Edge =1 to count occurrences. +Counter 2 only; Set Cmask = 1 to count cycles. +.It Li DTLB_STORE_MISSES.MISS_CAUSES_A_WALK +.Pq Event 49H, Umask 01H Miss in all TLB levels causes an page walk of any +page size (4K/2M/4M/1G). +.It Li DTLB_STORE_MISSES.WALK_COMPLETED +.Pq Event 49H, Umask 02H +Miss in all TLB levels causes a page walk that completes of any page size +(4K/2M/4M/1G). +.It Li DTLB_STORE_MISSES.WALK_DURATION +.Pq Event 49H, Umask 04H +Cycles PMH is busy with this walk. +.It Li DTLB_STORE_MISSES.STLB_HIT +.Pq Event 49H, Umask 10H +Store operations that miss the first TLB level but hit the second and do not +cause page walks. +.It Li LOAD_HIT_PRE.SW_PF +.Pq Event 4CH, Umask 01H +Not SW-prefetch load dispatches that hit fill buffer allocated for S/W prefetch. +.It Li LOAD_HIT_PER.HW_PF +.Pq Event 4CH, Umask 02H +Not SW-prefetch load dispatches that hit fill buffer allocated for H/W prefetch. +.It Li HW_PRE_REQ.DL1_MISS +.Pq Event 4EH, Umask 02H +Hardware Prefetch requests that miss the L1D cache. +A request is being counted each time it access the cache & miss it, including +if a block is applicable or if hit the Fill Buffer for example. +This accounts for both L1 streamer and IP-based (IPP) HW prefetchers. +.It Li L1D.REPLACEMENT +.Pq Event 51H, Umask 01H +Counts the number of lines brought into the L1 data cache. +.It Li L1D.ALLOCATED_IN_M +.Pq Event 51H, Umask 02H +Counts the number of allocations of modified L1D cache lines. +.It Li L1D.EVICTION +.Pq Event 51H, Umask 04H +Counts the number of modified lines evicted from the L1 data cache due to +replacement. +.It Li L1D.ALL_M_REPLACEMENT +.Pq Event 51H, Umask 08H +Cache lines in M state evicted out of L1D due to Snoop HitM or dirty line +replacement. +.It Li PARTIAL_RAT_STALLS.FLAGS_MERGE_UOP +.Pq Event 59H, Umask 20H +Increments the number of flags-merge uops in flight each cycle. +Set Cmask = 1 to count cycles. +.It Li PARTIAL_RAT_STALLS.SLOW_LEA_WINDOW +.Pq Event 59H, Umask 40H +Cycles with at least one slow LEA uop allocated. +.It Li PARTIAL_RAT_STALLS.MUL_SINGLE_UOP +.Pq Event 59H, Umask 80H +Number of Multiply packed/scalar single precision uops allocated. +.It Li RESOURCE_STALLS2.ALL_FL_EMPTY +.Pq Event 5BH, Umask 0CH +Cycles stalled due to free list empty. +.It Li RESOURCE_STALLS2.ALL_PRF_CONTROL +.Pq Event 5BH, Umask 0FH +Cycles stalled due to control structures full for physical registers. +.It Li RESOURCE_STALLS2.BOB_FULL +.Pq Event 5BH, Umask 40H +Cycles Allocator is stalled due to Branch Order Buffer. +.It Li RESOURCE_STALLS2.OOO_RSRC +.Pq Event 5BH, Umask 4FH +Cycles stalled due to out of order resources full. +.It Li CPL_CYCLES.RING0 +.Pq Event 5CH, Umask 01H +Unhalted core cycles when the thread is in ring 0. +Use Edge to count transition +.It Li CPL_CYCLES.RING123 +.Pq Event 5CH, Umask 02H +Unhalted core cycles when the thread is not in ring 0. +.It Li RS_EVENTS.EMPTY_CYCLES +.Pq Event 5EH, Umask 01H +Cycles the RS is empty for the thread. +.It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD +.Pq Event 60H, Umask 01H +Offcore outstanding Demand Data Read transactions in SQ to uncore. +Set Cmask=1 to count cycles. +.It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO +.Pq Event 60H, Umask 04H +Offcore outstanding RFO store transactions in SQ to uncore. +Set Cmask=1 to count cycles. +.It Li OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD +.Pq Event 60H, Umask 08H +Offcore outstanding cacheable data read transactions in SQ to uncore. +Set Cmask=1 to count cycles. +.It Li LOCK_CYCLES.SPLIT_LOCK_UC_LOCK_DURATION +.Pq Event 63H, Umask 01H +Cycles in which the L1D and L2 are locked, due to a UC lock or split lock. +.It Li LOCK_CYCLES.CACHE_LOCK_DURATION +.Pq Event 63H, Umask 02H +Cycles in which the L1D is locked. +.It Li IDQ.EMPTY +.Pq Event 79H, Umask 02H +Counts cycles the IDQ is empty. +.It Li IQD.MITE_UOPS +.Pq Event 79H, Umask 04H +Increment each cycle # of uops delivered to IDQ from MITE path. +Set Cmask = 1 to count cycles. +Can combine Umask 04H and 20H +.It Li IDQ.DSB_UOPS +.Pq Event 79H, Umask 08H +Increment each cycle. +# of uops delivered to IDQ from DSB path. +Set Cmask = 1 to count cycles. +Can combine Umask 08H and 10H +.It Li IDQ.MS_DSB_UOPS +.Pq Event 79H, Umask 10H +Increment each cycle # of uops delivered to IDQ when MS busy by DSB. +Set Cmask = 1 to count cycles MS is busy. +Set Cmask=1 and Edge=1 to count MS activations. +Can combine Umask 08H and 10H +.It Li IDQ.MS_MITE_UOPS +.Pq Event 79H, Umask 20H +Increment each cycle # of uops delivered to IDQ when MS is busy by MITE. +Set Cmask = 1 to count cycles. +Can combine Umask 04H and 20H +.It Li IDQ.MS_UOPS +.Pq Event 79H, Umask 30H +Increment each cycle # of uops delivered to IDQ from MS by either DSB or MITE. +Set Cmask = 1 to count cycles. +Can combine Umask 04H, 08H and 30H +.It Li ICACHE.MISSES +.Pq Event 80H, Umask 02H +Number of Instruction Cache, Streaming Buffer and Victim Cache Misses. +Includes UC accesses. +.It Li ITLB_MISSES.MISS_CAUSES_A_WALK +.Pq Event 85H, Umask 01H +Misses in all ITLB levels that cause page walks. +.It Li ITLB_MISSES.WALK_COMPLETED +.Pq Event 85H, Umask 02H +Misses in all ITLB levels that cause completed page walks. +.It Li ITLB_MISSES.WALK_DURATION +.Pq Event 85H, Umask 04H +Cycle PMH is busy with a walk. +.It Li ITLB_MISSES.STLB_HIT +.Pq Event 85H, Umask 10H +Number of cache load STLB hits. +No page walk. +.It Li ILD_STALL.LCP +.Pq Event 87H, Umask 01H +Stalls caused by changing prefix length of the instruction. +.It Li ILD_STALL.IQ_FULL +.Pq Event 87H, Umask 04H +Stall cycles due to IQ is full. +.It Li BR_INST_EXEC.COND +.Pq Event 88H, Umask 01H +Qualify conditional near branch instructions executed, but not necessarily +retired. +Must combine with umask 40H, 80H +.It Li BR_INST_EXEC.DIRECT_JMP +.Pq Event 88H, Umask 02H +Qualify all unconditional near branch instructions excluding calls and indirect +branches. +Must combine with umask 80H +.It Li BR_INST_EXEC.INDIRECT_JMP_NON_CALL_RET +.Pq Event 88H, Umask 04H +Qualify executed indirect near branch instructions that are not calls nor +returns. +Must combine with umask 80H +.It Li BR_INST_EXEC.RETURN_NEAR +.Pq Event 88H, Umask 08H +Qualify indirect near branches that have a return mnemonic. +Must combine with umask 80H +.It Li BR_INST_EXEC.DIRECT_NEAR_CALL +.Pq Event 88H, Umask 10H +Qualify unconditional near call branch instructions, excluding non call branch, +executed. +Must combine with umask 80H +.It Li BR_INST_EXEC.INDIRECT_NEAR_CALL +.Pq Event 88H, Umask 20H +Qualify indirect near calls, including both register and memory indirect, +executed. +Must combine with umask 80H +.It Li BR_INST_EXEC.NONTAKEN +.Pq Event 88H, Umask 40H +Qualify non-taken near branches executed. +Applicable to umask 01H only +.It Li BR_INST_EXEC.TAKEN +.Pq Event 88H, Umask 80H +Qualify taken near branches executed. +Must combine with 01H,02H, 04H, 08H, 10H, 20H +.It Li BR_INST_EXE.ALL_BRANCHES +.Pq Event 88H, Umask FFH +Counts all near executed branches (not necessarily retired). +.It Li BR_MISP_EXEC.COND +.Pq Event 89H, Umask 01H +Qualify conditional near branch instructions mispredicted. +Must combine with umask 40H, 80H +.It Li BR_MISP_EXEC.INDIRECT_JMP_NON_CALL_RET +.Pq Event 89H, Umask 04H +Qualify mispredicted indirect near branch instructions that are not calls nor +returns. +Must combine with umask 80H +.It Li BR_MISP_EXEC.RETURN_NEAR +.Pq Event 89H, Umask 08H +Qualify mispredicted indirect near branches that have a return mnemonic. +Must combine with umask 80H +.It Li BR_MISP_EXEC.DIRECT_NEAR_CALL +.Pq Event 89H, Umask 10H +Qualify mispredicted unconditional near call branch instructions, excluding non +call branch, executed. +Must combine with umask 80H +.It Li BR_MISP_EXEC.INDIRECT_NEAR_CALL +.Pq Event 89H, Umask 20H +Qualify mispredicted indirect near calls, including both register and memory +indirect, executed. +Must combine with umask 80H +.It Li BR_MISP_EXEC.NONTAKEN +.Pq Event 89H, Umask 40H +Qualify mispredicted non-taken near branches executed. +Applicable to umask 01H only +.It Li BR_MISP_EXEC.TAKEN +.Pq Event 89H, Umask 80H +Qualify mispredicted taken near branches executed. +Must combine with 01H,02H, 04H, 08H, 10H, 20H +.It Li BR_MISP_EXEC.ALL_BRANCHES +.Pq Event 89H, Umask FFH +Counts all near executed branches (not necessarily retired). +.It Li IDQ_UOPS_NOT_DELIVERED.CORE +.Pq Event 9CH, Umask 01H +Count number of non-delivered uops to RAT per thread. +Use Cmask to qualify uop b/w +.It Li UOPS_DISPATCHED_PORT.PORT_0 +.Pq Event A1H, Umask 01H +Cycles which a Uop is dispatched on port 0. +.It Li UOPS_DISPATCHED_PORT.PORT_1 +.Pq Event A1H, Umask 02H +Cycles which a Uop is dispatched on port 1. +.It Li UOPS_DISPATCHED_PORT.PORT_2_LD +.Pq Event A1H, Umask 04H +Cycles which a load uop is dispatched on port 2. +.It Li UOPS_DISPATCHED_PORT.PORT_2_STA +.Pq Event A1H, Umask 08H +Cycles which a store address uop is dispatched on port 2. +.It Li UOPS_DISPATCHED_PORT.PORT_2 +.Pq Event A1H, Umask 0CH +Cycles which a Uop is dispatched on port 2. +.It Li UOPS_DISPATCHED_PORT.PORT_3_LD +.Pq Event A1H, Umask 10H +Cycles which a load uop is dispatched on port 3. +.It Li UOPS_DISPATCHED_PORT.PORT_3_STA +.Pq Event A1H, Umask 20H +Cycles which a store address uop is dispatched on port 3. +.It Li UOPS_DISPATCHED_PORT.PORT_3 +.Pq Event A1H, Umask 30H +.Pq Cycles which a Uop is dispatched on port 3. +.It Li UOPS_DISPATCHED_PORT.PORT_4 +.Pq Event A1H, Umask 40H +Cycles which a Uop is dispatched on port 4. +.It Li UOPS_DISPATCHED_PORT.PORT_5 +.Pq Event A1H, Umask 80H +Cycles which a Uop is dispatched on port 5. +.It Li RESOURCE_STALLS.ANY +.Pq Event A2H, Umask 01H +Cycles Allocation is stalled due to Resource Related reason. +.It Li RESOURCE_STALLS.LB +.Pq Event A2H, Umask 02H +Counts the cycles of stall due to lack of load buffers. +.It Li RESOURCE_STALLS.LB +.Pq Event A2H, Umask 04H +Cycles stalled due to no eligible RS entry available. +.It Li RESOURCE_STALLS.SB +.Pq Event A2H, Umask 08H +Cycles stalled due to no store buffers available. +(not including draining form sync) +.It Li RESOURCE_STALLS.ROB +.Pq Event A2H, Umask 10H +Cycles stalled due to re-order buffer full. +.It Li RESOURCE_STALLS.FCSW +.Pq Event A2H, Umask 20H +Cycles stalled due to writing the FPU control word. +.It Li RESOURCE_STALLS.MXCSR +.Pq Event A2H, Umask 40H +Cycles stalled due to the MXCSR register rename occurring to close to a previous +MXCSR rename. +.It Li RESOURCE_STALLS.OTHER +.Pq Event A2H, Umask 80H +Cycles stalled while execution was stalled due to other resource issues. +.It Li DSB2MITE_SWITCHES.COUNT +.Pq Event ABH, Umask 01H +Number of DSB to MITE switches. +.It Li DSB2MITE_SWITCHES.PENALTY_CYCLES +.Pq Event ABH, Umask 02H +Cycles DSB to MITE switches caused delay. +.It Li DSB_FILL.OTHER_CANCEL +.Pq Event ACH, Umask 02H +Cases of cancelling valid DSB fill not because of exceeding way limit. +.It Li DSB_FILL.EXCEED_DSB_LINES +.Pq Event ACH, Umask 08H +DSB Fill encountered > 3 DSB lines. +.It Li DSB_FILL.ALL_CANCEL +.Pq Event ACH, Umask 0AH +Cases of cancelling valid Decode Stream Buffer (DSB) fill not because of exceeding +way limit. +.It Li ITLB.ITLB_FLUSH +.Pq Event AEH, Umask 01H +Counts the number of ITLB flushes, includes 4k/2M/4M pages. +.It Li OFFCORE_REQUESTS.DEMAND_DATA_RD +.Pq Event B0H, Umask 01H +Demand data read requests sent to uncore. +.It Li OFFCORE_REQUESTS.DEMAND_RFO +.Pq Event B0H, Umask 04H +Demand RFO read requests sent to uncore, including regular RFOs, locks, ItoM. +.It Li OFFCORE_REQUESTS.ALL_DATA_RD +.Pq Event B0H, Umask 08H +Data read requests sent to uncore (demand and prefetch). +.It Li UOPS_DISPATCHED.THREAD +.Pq Event B1H, Umask 01H +Counts total number of uops to be dispatched per-thread each cycle. +Set Cmask = 1, INV =1 to count stall cycles. +.It Li UOPS_DISPATCHED.CORE +.Pq Event B1H, Umask 02H +Counts total number of uops to be dispatched per-core each cycle. +Do not need to set ANY +.It Li OFFCORE_REQUESTS_BUFFER.SQ_FULL +.Pq Event B2H, Umask 01H +Offcore requests buffer cannot take more entries for this thread core. +.It Li AGU_BYPASS_CANCEL.COUNT +.Pq Event B6H, Umask 01H +Counts executed load operations with all the following traits: 1. addressing +of the format [base + offset], 2. the offset is between 1 and 2047, 3. the +address specified in the base register is in one page and the address +[base+offset] is in another page. +.It Li OFF_CORE_RESPONSE_0 +.Pq Event B7H, Umask 01H +Off-core Response Performance Monitoring; PMC0 only. +Requires programming MSR 01A6H +.It Li OFF_CORE_RESPONSE_1 +.Pq Event BBH, Umask 01H +Off-core Response Performance Monitoring. PMC3 only. +Requires programming MSR 01A7H +.It Li TLB_FLUSH.DTLB_THREAD +.Pq Event BDH, Umask 01H +DTLB flush attempts of the thread-specific entries. +.It Li TLB_FLUSH.STLB_ANY +.Pq Event BDH, Umask 20H +Count number of STLB flush attempts. +.It Li L1D_BLOCKS.BANK_CONFLICT_CYCLES +.Pq Event BFH, Umask 05H +Cycles when dispatched loads are cancelled due to L1D bank conflicts with other +load ports. +cmask=1 +.It Li INST_RETIRED.ANY_P +.Pq Event C0H, Umask 00H +Number of instructions at retirement. +.It Li INST_RETIRED.PREC_DIST +.Pq Event C0H, Umask 01H +Precise instruction retired event with HW to reduce effect of PEBS shadow in IP +distribution PMC1 only; Must quiesce other PMCs. +.It Li INST_RETIRED.X87 +.Pq Event C0H, Umask 02H +X87 instruction retired event. +.It Li OTHER_ASSISTS.ITLB_MISS_RETIRED +.Pq Event C1H, Umask 02H +Instructions that experienced an ITLB miss. +.It Li OTHER_ASSISTS.AVX_STORE +.Pq Event C1H, Umask 08H +Number of assists associated with 256-bit AVX store operations. +.It Li OTHER_ASSISTS.AVX_TO_SSE +.Pq Event C1H, Umask 10H +Number of transitions from AVX256 to legacy SSE when penalty applicable. +.It Li OTHER_ASSISTS.SSE_TO_AVX +.Pq Event C1H, Umask 20H +Number of transitions from SSE to AVX-256 when penalty applicable. +.It Li UOPS_RETIRED.ALL +.Pq Event C2H, Umask 01H +Counts the number of micro-ops retired. +Use cmask=1 and invert to count active cycles or stalled cycles. +.It Li UOPS_RETIRED.RETIRE_SLOTS +.Pq Event C2H, Umask 02H +Counts the number of retirement slots used each cycle. +.It Li MACHINE_CLEARS.MEMORY_ORDERING +.Pq Event C3H, Umask 02H +Counts the number of machine clears due to memory order conflicts. +.It Li MACHINE_CLEARS.SMC +.Pq Event C3H, Umask 04H +Counts the number of times that a program writes to a code section. +.It Li MACHINE_CLEARS.MASKMOV +.Pq Event C3H, Umask 20H +Counts the number of executed AVX masked load operations that refer to an +illegal address range with the mask bits set to 0. +.It Li BR_INST_RETIRED.ALL_BRANCH +.Pq Event C4H, Umask 00H +Branch instructions at retirement. +.It Li BR_INST_RETIRED.CONDITIONAL +.Pq Event C4H, Umask 01H +Counts the number of conditional branch instructions retired. +.It Li BR_INST_RETIRED.NEAR_CALL +.Pq Event C4H, Umask 02H +Direct and indirect near call instructions retired. +.It Li BR_INST_RETIRED.ALL_BRANCHES +.Pq Event C4H, Umask 04H +Counts the number of branch instructions retired. +.It Li BR_INST_RETIRED.NEAR_RETURN +.Pq Event C4H, Umask 08H +Counts the number of near return instructions retired. +.It Li BR_INST_RETIRED.NOT_TAKEN +.Pq Event C4H, Umask 10H +Counts the number of not taken branch instructions retired. +.It Li BR_INST_RETIRED.NEAR_TAKEN +.Pq Event C4H, Umask 20H +Number of near taken branches retired. +.It Li BR_INST_RETIRED.FAR_BRANCH +.Pq Event C4H, Umask 40H +Number of far branches retired. +.It Li BR_MISP_RETIRED.ALL_BRANCHES +.Pq Event C5H, Umask 00H +Mispredicted branch instructions at retirement. +.It Li BR_MISP_RETIRED.CONDITIONAL +.Pq Event C5H, Umask 01H +Mispredicted conditional branch instructions retired. +.It Li BR_MISP_RETIRED.NEAR_CALL +.Pq Event C5H, Umask 02H +Direct and indirect mispredicted near call instructions retired. +.It Li BR_MISP_RETIRED.ALL_BRANCH +.Pq Event C5H, Umask 04H +Mispredicted macro branch instructions retired. +.It Li BR_MISP_RETIRED.NOT_TAKEN +.Pq Event C5H, Umask 10H +Mispredicted not taken branch instructions retired. +.It Li BR_MISP_RETIRED.TAKEN +.Pq Event C5H, Umask 20H +Mispredicted taken branch instructions retired. +.It Li FP_ASSIST.X87_OUTPUT +.Pq Event CAH, Umask 02H +Number of X87 assists due to output value. +.It Li FP_ASSIST.X87_INPUT +.Pq Event CAH, Umask 04H +Number of X87 assists due to input value. +.It Li FP_ASSIST.SIMD_OUTPUT +.Pq Event CAH, Umask 08H +Number of SIMD FP assists due to Output values. +.It Li FP_ASSIST.SIMD_INPUT +.Pq Event CAH, Umask 10H +Number of SIMD FP assists due to input values. +.It Li FP_ASSIST.ANY +.Pq Event CAH, Umask 1EH +Cycles with any input/output SSE* or FP assists. +.It Li ROB_MISC_EVENTS.LBR_INSERTS +.Pq Event CCH, Umask 20H +Count cases of saving new LBR records by hardware. +.It Li MEM_TRANS_RETIRED.LOAD_LATENCY +.Pq Event CDH, Umask 01H +Sample loads with specified latency threshold. +PMC3 only. +Specify threshold in MSR 0x3F6. +.It Li MEM_TRANS_RETIRED.PRECISE_STORE +.Pq Event CDH, Umask 02H +Sample stores and collect precise store operation via PEBS record. +PMC3 only. +.It Li MEM_UOP_RETIRED.LOADS +.Pq Event D0H, Umask 01H +Qualify retired memory uops that are loads. +Combine with umask 10H, 20H, 40H, 80H. +.It Li MEM_UOP_RETIRED.STORES +.Pq Event D0H, Umask 02H +Qualify retired memory uops that are stores. +Combine with umask 10H, 20H, 40H, 80H. +.It Li MEM_UOP_RETIRED.STLB_MISS +.Pq Event D0H, Umask 10H +Qualify retired memory uops with STLB miss. +Must combine with umask 01H, 02H, to produce counts. +.It Li MEM_UOP_RETIRED.LOCK +.Pq Event D0H, Umask 20H +Qualify retired memory uops with lock. +Must combine with umask 01H, 02H, to produce counts. +.It Li MEM_UOP_RETIRED.SPLIT +.Pq Event D0H, Umask 40H +Qualify retired memory uops with line split. +Must combine with umask 01H, 02H, to produce counts. +.It Li MEM_UOP_RETIRED_ALL +.Pq Event D0H, Umask 80H +Qualify any retired memory uops. +Must combine with umask 01H, 02H, to produce counts. +.It Li MEM_LOAD_UOPS_RETIRED.L1_HIT +.Pq Event D1H, Umask 01H +Retired load uops with L1 cache hits as data sources. +Must combine with umask 01H, 02H, to produce counts. +.It Li MEM_LOAD_UOPS_RETIRED.L2_HIT +.Pq Event D1H, Umask 02H +Retired load uops with L2 cache hits as data sources. +.It Li MEM_LOAD_UOPS_RETIRED.LLC_HIT +.Pq Event D1H, Umask 04H +Retired load uops which data sources were data hits in LLC without snoops +required. +.It Li MEM_LOAD_UOPS_RETIRED.HIT_LFB +.Pq Event D1H, Umask 40H +Retired load uops which data sources were load uops missed L1 but hit FB due +to preceding miss to the same cache line with data not ready. +.It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS +.Pq Event D2H, Umask 01H +Retired load uops which data sources were LLC hit and cross-core snoop missed in +on-pkg core cache. +.It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT +.Pq Event D2H, Umask 02H +Retired load uops which data sources were LLC and cross-core snoop hits in +on-pkg core cache. +.It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM +.Pq Event D2H, Umask 04H +Retired load uops which data sources were HitM responses from shared LLC. +.It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE +.Pq Event D2H, Umask 08H +Retired load uops which data sources were hits in LLC without snoops required. +.It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS +.Pq Event D4H, Umask 02H +Retired load uops with unknown information as data source in cache serviced the load. +.It Li L2_TRANS.DEMAND_DATA_RD +.Pq Event F0H, Umask 01H +Demand Data Read requests that access L2 cache. +.It Li L2_TRANS.RF0 +.Pq Event F0H, Umask 02H +RFO requests that access L2 cache. +.It Li L2_TRANS.CODE_RD +.Pq Event F0H, Umask 04H +L2 cache accesses when fetching instructions. +.It Li L2_TRANS.ALL_PF +.Pq Event F0H, Umask 08H +L2 or LLC HW prefetches that access L2 cache. +.It Li L2_TRANS.L1D_WB +.Pq Event F0H, Umask 10H +L1D writebacks that access L2 cache. +.It Li L2_TRANS.L2_FILL +.Pq Event F0H, Umask 20H +L2 fill requests that access L2 cache. +.It Li L2_TRANS.L2_WB +.Pq Event F0H, Umask 40H +L2 writebacks that access L2 cache. +.It Li L2_TRANS.ALL_REQUESTS +.Pq Event F0H, Umask 80H +Transactions accessing L2 pipe. +.It Li L2_LINES_IN.I +.Pq Event F1H, Umask 01H +L2 cache lines in I state filling L2. +Counting does not cover rejects. +.It Li L2_LINES_IN.S +.Pq Event F1H, Umask 02H +L2 cache lines in S state filling L2. +Counting does not cover rejects. +.It Li L2_LINES_IN.E +.Pq Event F1H, Umask 04H +L2 cache lines in E state filling L2. +Counting does not cover rejects. +.It Li L2_LINES-IN.ALL +.Pq Event F1H, Umask 07H +L2 cache lines filling L2. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 21:47:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 077AC106564A; Thu, 1 Mar 2012 21:47:43 +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 D37458FC0A; Thu, 1 Mar 2012 21:47:42 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 70BAE46B0A; Thu, 1 Mar 2012 16:47:42 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EBF6AB948; Thu, 1 Mar 2012 16:47:41 -0500 (EST) From: John Baldwin To: Peter Holm Date: Thu, 1 Mar 2012 16:47:41 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201110311501.p9VF1lrf020688@svn.freebsd.org> In-Reply-To: <201110311501.p9VF1lrf020688@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201203011647.41313.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Mar 2012 16:47:42 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 21:47:43 -0000 On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > Author: pho > Date: Mon Oct 31 15:01:47 2011 > New Revision: 226967 > URL: http://svn.freebsd.org/changeset/base/226967 > > Log: > The kern_renameat() looks up the fvp using the DELETE flag, which causes > the removal of the name cache entry for fvp. > > Reported by: Anton Yuzhaninov > In collaboration with: kib > MFC after: 1 week > > Modified: > head/sys/ufs/ufs/ufs_vnops.c So I ran into this at work recently, and even this fix applied I was still seeing rename()'s that were seemingly not taking effect. After getting some extra KTR traces, I figured out that the same purge needs to be applied to the destination vnode. Specifically, the issue I ran into was that was renaming 'foo' to 'bar', but lookups for 'bar' were still returning the old file. The reason was that a lookup after the namei(RENAME) of the destination while ufs_rename() had its locks dropped was readding the name cache entry for 'bar', and then a cache_lookup() of 'bar' would return the old vnode as long as that vnode was valid (e.g. if it had a link in another location, or other processes had an open file descriptor for it). I'm currently testing the patch below: Index: ufs/ufs/ufs_vnops.c =================================================================== --- ufs/ufs/ufs_vnops.c (revision 225498) +++ ufs/ufs/ufs_vnops.c (working copy) @@ -1519,8 +1539,15 @@ * ufs_lookup_ino() and then VFS_VGET(), another thread might do a * normal lookup of the from name just before the VFS_VGET() call, * causing the cache entry to be re-instantiated. + * + * The same issue also applies to tvp if it exists as + * otherwise we may have a stale name cache entry for the new + * name that references the old i-node if it has other links + * or open file descriptors. */ cache_purge(fvp); + if (tvp) + cache_purge(tvp); unlockout: vput(fdvp); Index: fs/tmpfs/tmpfs_vnops.c =================================================================== --- fs/tmpfs/tmpfs_vnops.c (revision 225498) +++ fs/tmpfs/tmpfs_vnops.c (working copy) @@ -1090,6 +1090,8 @@ tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE); } cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); error = 0; -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 21:56:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA5FB106566C; Thu, 1 Mar 2012 21:56:21 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id A4A498FC1C; Thu, 1 Mar 2012 21:56:21 +0000 (UTC) Received: from julian-mac.elischer.org (c-67-180-24-15.hsd1.ca.comcast.net [67.180.24.15]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id q21LuJI7077703 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 1 Mar 2012 13:56:20 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4F4FF088.4040508@freebsd.org> Date: Thu, 01 Mar 2012 13:56:24 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19 MIME-Version: 1.0 To: Konstantin Belousov References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <86mx81byt6.fsf@in138.ua3> <20120229132507.GB55074@deviant.kiev.zoral.com.ua> <201202290936.02309.jhb@freebsd.org> <20120229153328.GG55074@deviant.kiev.zoral.com.ua> In-Reply-To: <20120229153328.GG55074@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , John Baldwin , svn-src-all@freebsd.org, Mikolaj Golub , "Robert N. M. Watson" , svn-src-head@freebsd.org Subject: Re: svn commit: r232181 - 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: Thu, 01 Mar 2012 21:56:22 -0000 On 2/29/12 7:33 AM, Konstantin Belousov wrote: > On Wed, Feb 29, 2012 at 09:36:02AM -0500, John Baldwin wrote: >> On Wednesday, February 29, 2012 8:25:07 am Konstantin Belousov wrote: >>> On Wed, Feb 29, 2012 at 02:37:25PM +0200, Mikolaj Golub wrote: >>>> On Wed, 29 Feb 2012 12:03:00 +0000 Robert N. M. Watson wrote: >>>> >>>> RNMW> I think the monitoring aspect of the patch is fine. >>>> >>>> RNMW> The bit I was worried about was external umask changes. This can cause >>>> RNMW> race conditions for applications that manage their umask -- for >>>> RNMW> example, bsdtar, if I recall correctly. It's one thing to use a >>>> RNMW> debugger to force an application to change its umask -- the developer >>>> RNMW> needs to know they are changing application behaviour. But exposing a >>>> RNMW> feature that can lead to correct applications but incorrect results is >>>> RNMW> a risky thing to do, hence my objection. >>>> >>>> RNMW> I think given the other objections, it would be wise to remove write >>>> RNMW> access to process umasks, but retain read access for procstat (which is >>>> RNMW> quite useful, I agree). >>>> >>>> I still don't see why having a sysctl RW is worse than asking users to run >>>> something like in the attach when they need to change umask for another >>>> process, but ok, if people don't like RW I will remove it. >>>> >>> What is done is attach is much worse then the sysctl, just because >>> debugger attach often causes spurious EINTR, indeed seriously disrupting >>> applications, as opposed to some uncertain damage that could be done in >>> theory. >> kgdb doesn't though, and presumably for umask you would change it via kgdb, so >> from the running process' perspective it would look the same as changing it via >> sysctl. > Right, but an idea of the change was to allow to do this for somebody who > does not know how to perform it in kgdb. Not to mention that kgdb -w > is risky, e.g. because filedesc might have changed under kgdb, so you would > write over freed memory. but it's lowering the bar TOO much I think, From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 22:13:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90F92106564A; Thu, 1 Mar 2012 22:13:11 +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 80C178FC17; Thu, 1 Mar 2012 22:13:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21MDB5x099036; Thu, 1 Mar 2012 22:13:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21MDBg4099034; Thu, 1 Mar 2012 22:13:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203012213.q21MDBg4099034@svn.freebsd.org> From: John Baldwin Date: Thu, 1 Mar 2012 22:13: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: r232367 - 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: Thu, 01 Mar 2012 22:13:11 -0000 Author: jhb Date: Thu Mar 1 22:13:10 2012 New Revision: 232367 URL: http://svn.freebsd.org/changeset/base/232367 Log: Properly handle failures in igb_setup_msix() by returning 0 if MSI or MSI-X allocation fails. Reviewed by: jfv MFC after: 2 weeks Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Thu Mar 1 21:23:26 2012 (r232366) +++ head/sys/dev/e1000/if_igb.c Thu Mar 1 22:13:10 2012 (r232367) @@ -2711,7 +2711,7 @@ igb_setup_msix(struct adapter *adapter) "MSIX Configuration Problem, " "%d vectors configured, but %d queues wanted!\n", msgs, want); - return (ENXIO); + return (0); } if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) { device_printf(adapter->dev, @@ -2721,9 +2721,11 @@ igb_setup_msix(struct adapter *adapter) } msi: msgs = pci_msi_count(dev); - if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); - return (msgs); + if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) { + device_printf(adapter->dev," Using MSI interrupt\n"); + return (msgs); + } + return (0); } /********************************************************************* From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 22:32:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F06B61065672; Thu, 1 Mar 2012 22:32:30 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF8D18FC17; Thu, 1 Mar 2012 22:32:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21MWUms000504; Thu, 1 Mar 2012 22:32:30 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21MWUbp000502; Thu, 1 Mar 2012 22:32:30 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201203012232.q21MWUbp000502@svn.freebsd.org> From: Sean Bruno Date: Thu, 1 Mar 2012 22:32:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232368 - stable/9/sys/dev/isci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 22:32:31 -0000 Author: sbruno Date: Thu Mar 1 22:32:30 2012 New Revision: 232368 URL: http://svn.freebsd.org/changeset/base/232368 Log: MFC r232225 Update PCI-IDs with devices found on Intel SDP Return BUS_PROBE_DEFAULT so that non-default drivers may be loaded Modified: stable/9/sys/dev/isci/isci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/isci/isci.c ============================================================================== --- stable/9/sys/dev/isci/isci.c Thu Mar 1 22:13:10 2012 (r232367) +++ stable/9/sys/dev/isci/isci.c Thu Mar 1 22:32:30 2012 (r232368) @@ -98,7 +98,11 @@ static struct _pcsid { 0x1d688086, "Intel(R) C600 Series Chipset SAS Controller" }, { 0x1d698086, "Intel(R) C600 Series Chipset SAS Controller" }, { 0x1d6a8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, - { 0x1d6b8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, + { 0x1d6b8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, + { 0x1d6c8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6d8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6e8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6f8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, { 0x00000000, NULL } }; @@ -114,7 +118,7 @@ isci_probe (device_t device) if (ep->desc) { device_set_desc(device, ep->desc); - return (0); + return (BUS_PROBE_DEFAULT); } else return (ENXIO); From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 22:36:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2156B1065674; Thu, 1 Mar 2012 22:36:43 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 107998FC15; Thu, 1 Mar 2012 22:36:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21Magf7000725; Thu, 1 Mar 2012 22:36:42 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21MagtS000723; Thu, 1 Mar 2012 22:36:42 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201203012236.q21MagtS000723@svn.freebsd.org> From: Sean Bruno Date: Thu, 1 Mar 2012 22:36:42 +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: r232369 - stable/7/sys/dev/isci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Mar 2012 22:36:43 -0000 Author: sbruno Date: Thu Mar 1 22:36:42 2012 New Revision: 232369 URL: http://svn.freebsd.org/changeset/base/232369 Log: MFC r232225 Update PCI-IDs with devices found on Intel SDP Return BUS_PROBE_DEFAULT so that non-default drivers may be loaded Modified: stable/7/sys/dev/isci/isci.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/isci/isci.c ============================================================================== --- stable/7/sys/dev/isci/isci.c Thu Mar 1 22:32:30 2012 (r232368) +++ stable/7/sys/dev/isci/isci.c Thu Mar 1 22:36:42 2012 (r232369) @@ -98,7 +98,11 @@ static struct _pcsid { 0x1d688086, "Intel(R) C600 Series Chipset SAS Controller" }, { 0x1d698086, "Intel(R) C600 Series Chipset SAS Controller" }, { 0x1d6a8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, - { 0x1d6b8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, + { 0x1d6b8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, + { 0x1d6c8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6d8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6e8086, "Intel(R) C600 Series Chipset SAS Controller" }, + { 0x1d6f8086, "Intel(R) C600 Series Chipset SAS Controller (SATA mode)" }, { 0x00000000, NULL } }; @@ -114,7 +118,7 @@ isci_probe (device_t device) if (ep->desc) { device_set_desc(device, ep->desc); - return (0); + return (BUS_PROBE_DEFAULT); } else return (ENXIO); From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 22:46:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 96C84106564A; Thu, 1 Mar 2012 22:46:15 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay010.isp.belgacom.be (mailrelay010.isp.belgacom.be [195.238.6.177]) by mx1.freebsd.org (Postfix) with ESMTP id B68478FC24; Thu, 1 Mar 2012 22:46:13 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEFALb7T09bsWst/2dsb2JhbAA9BrEZgnGBCIF9AQEEAScvIwULCw4KLjkeBogUCbkGihCCbgEBBgEBBQEDAQQBAgECBAEBAQUFAQQCAj6FJwqEGgSIHKAS Received: from 45.107-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.107.45]) by relay.skynet.be with ESMTP; 01 Mar 2012 23:46:04 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q21Mk2nU046311; Thu, 1 Mar 2012 23:46:03 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Bruce Evans Date: Thu, 1 Mar 2012 23:45:54 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201202281815.q1SIFSbB082030@svn.freebsd.org> <20120229071721.G989@besplex.bde.org> In-Reply-To: <20120229071721.G989@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2527463.E7el3J74Ju"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201203012346.00228.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232261 - in head/sys: amd64/include i386/include pc98/include x86/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: Thu, 01 Mar 2012 22:46:15 -0000 --nextPart2527463.E7el3J74Ju Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Wednesday 29 February 2012 00:26:43 Bruce Evans wrote: > On Tue, 28 Feb 2012, Tijl Coosemans wrote: >=20 >> Log: >> Copy amd64 _types.h to x86 and merge with i386 _types.h. Replace existi= ng >> amd64/i386/pc98 _types.h with stubs. >=20 > I don't like this much. It gives 2 layers of convolutions for readers > (humans and compilers) to slowly untangle. There is another layer of > include files for compatibility (but both layers are still used by > default), and lots of ifdefs. The whole point of 1 file per arch was > to avoid such ifdefs. This might be OK if arches were actually identical > for the APIs in these files, but for types there are lots of differences > between 32-bit and 64-bit machines. amd64 isn't just a 64-bit machine. i386 support is one of its core features. In hindsight, I believe it was a mistake to create a separate amd64 include directory. There wouldn't be any stub headers if the original i386 headers had been extended instead, as was done for powerpc64 and powerpc. But so be it. Eventually, hopefully, x86 will be installed as the machine directory and then the stub layer will disappear. =46or now, the approach I'm taking is to only merge headers that can be included by user code. I don't want to stuff too many changes in one commit, which means the current batch of patches are pure merges and little else. The resulting headers are bug for bug compatible with the original headers. I also try to keep the number of ifdefs down but to keep diffs small and easier to review I don't want to excessively rearrange files just to eliminate an extra ifdef. The resulting headers are meant to be similar to existing powerpc and mips headers. Once that's done we can look into fixing any bugs and structural problems for all architectures. Changing some of the type definitions like you suggest below is something that can be discussed, but it requires a lot more thought and testing than what I'm currently trying to accomplish which is to make cc -m32 work and to prevent further deviations between amd64 and i386 such as __clock_t. I've also been working on mapping out all the ISO C and POSIX library requirements which should give me a better idea of how to organise the headers. Currently the C (and C++) standards are done and I've started with the various POSIX standards. So far it seems a lot can be moved to sys because many type definitions (and their limits) aren't machine dependent but LP64/ILP32 dependent. With several architectures (x86, powerpc, mips and armv8 in the future?) already supporting both, there's a lot of duplication that can be removed by supporting both from sys instead. It would remove some of the stubs like _inttypes.h and _stdint.h, maybe _limits.h. > The differences can be reduced by spelling 32/64-bit types as > [unsigned] long and by always using the basic type instead of a > derived type. Old code (e.g., FreeBSD-3) did this, but now almost > everything is declared using the derived fixed-width types > int32_t/int64_t etc., so there is always a spelling difference for > 32/64-bit types. The only exceptions are floating point types, and > the broken __clock_t type. > clock_t is unsigned long on i386, but is int32_t on amd64. This > is backwards at best. I think this brokenness came from NetBSD. > _BSD_CLOCK_T_ was correct (unsigned long) for all arches in 4.4BSD, > and i386 just didn't break this. But now __clock_t is broken for > all arches except i386: it is __uint32_t on arm and powerpc, which > is just a different spelling for the 32-bit case and is at least > ABI-compatible for the 64-bit case, but for all other arches > including all 64-bit ones, it broken to __int32_t. Perhaps the > difference is explained by "long" being bad for ABI compatibility. > Old code like 4.4BSD-Lite1 used long excessively (since technically, > int might be only 16 bits). Even pid_t was long in 4.4BSD-Lite1. > NetBSD changed many of these longs to ints or int32_t's for ABI > compatibility and/or because 64 bit longs are just too wide, and > FreeBSD eventually picked up these changes (mostly via 4.4BSD-Lite2 > for general typedefs and directly from NetBSD for 64-bit arches). > So pid_t is now int32_t and clock_t is mostly broken. clock_t > really needs all 64 bits if they are readily available, but has > been reduced to 31, especially when 64 are readily available. > OTOH, if you just want ABI and API compatibility for clock_t, > then it should have been changed to uint32_t for all arches and > not defined in any MD types file. There is now a minor API > compatibility for printing clock_t's -- %lu format must be used > on i386, %u on others, and %d on most. Except for the gratuitous > loss of unsignedness, this is just a special case of printing > a typedefed types. clock_t may also be a floating point type, > so the only good way to print it is to convert it to [long] double > and then worry about the correct floating point format (how much > precision should it have?...). The __clock_t case is a perfect example of how duplication leads to differentiation and differentiation to portability issues. Currently clock(3) only starts to return negative values after about six months of cpu time, so I think it's relative safe to change the type to uint32_t. I haven't checked the other cases where this type is used though. >> Copied and modified: head/sys/x86/include/_types.h (from r232259, head/s= ys/amd64/include/_types.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/amd64/include/_types.h Tue Feb 28 15:52:01 2012 (r232259, c= opy source) >> +++ head/sys/x86/include/_types.h Tue Feb 28 18:15:28 2012 (r232261) >> @@ -54,19 +54,41 @@ typedef short __int16_t; >> typedef unsigned short __uint16_t; >> typedef int __int32_t; >> typedef unsigned int __uint32_t; >> +#ifdef _LP64 >> typedef long __int64_t; >> typedef unsigned long __uint64_t; >=20 > This is about the only ifdef that is really needed. >=20 >> +#else >> +#ifndef lint >> +__extension__ >=20 > An old bug -- work around broken lints. Although messy, this is not > messy enough to be correct -- __extension__ is a hard-coded gccism. > Elsewhere, in much less important code than this, there are messy > ifdefs to avoid hard-coded gccisms. Maybe define __extension for lint and various compilers in cdefs.h? >> +#endif >> +/* LONGLONG */ >=20 > long long has only been standard for 13 years now, so broken lints > still need this messy markup. Personally, I would just remove lint. Modern compilers produce many of the same warnings if not more in case of clang. It has been marked obsolete in SUSv2 (1997) and removed in SUSv3 (2001). And it only supports C90 so with C99 and now C11 it's becoming more and more difficult/messy to hide new language features from it. >> +typedef long long __int64_t; >> +#ifndef lint >> +__extension__ >> +#endif >> +/* LONGLONG */ >> +typedef unsigned long long __uint64_t; >> +#endif >=20 > I ifdefed all this correctly 15+ years ago so that it compiled (but > didn't run if *int64_t was used) for a non-gcc K&R compiler. The > long long abomination was not used, and __attribute__(()) was used > to declare *int64_t, but only under a gcc ifdef. This wasn't broken > until 8 Jan 2011 by, erm, us. We also added the __extensions__. > The justification was that long long is now standard. But there > are still the old messes for lint, and new breakage for non-gcc to > support C90. I don't remember the exact details but I think the non-gcc case already used long long and we made the gcc case use long long as well because LL and ULL suffixes were used in limits and INT64_C macros anyway. >> /* >> * Standard type definitions. >> */ >> +#ifdef _LP64 >> typedef __int32_t __clock_t; /* clock()... */ >> typedef __int64_t __critical_t; >> typedef double __double_t; >> typedef float __float_t; >> typedef __int64_t __intfptr_t; >> -typedef __int64_t __intmax_t; >> typedef __int64_t __intptr_t; >> +#else >> +typedef unsigned long __clock_t; >> +typedef __int32_t __critical_t; >> +typedef long double __double_t; >> +typedef long double __float_t; >> +typedef __int32_t __intfptr_t; >> +typedef __int32_t __intptr_t; >> +#endif >=20 > [unsigned] long would work without ifdefs for everything except to > preserve the broken __clock_t, and the FP types. Except for i386's > with correctly-sized longs (64 bits). We may have discussed these > too. >=20 >> @@ -75,6 +97,7 @@ typedef __int8_t __int_least8_t; >> typedef __int16_t __int_least16_t; >> typedef __int32_t __int_least32_t; >> typedef __int64_t __int_least64_t; >> +#ifdef _LP64 >> typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ >> typedef __int64_t __register_t; >> typedef __int64_t __segsz_t; /* segment size (in pages) */ >> @@ -82,8 +105,18 @@ typedef __uint64_t __size_t; /* sizeof( >> typedef __int64_t __ssize_t; /* byte count or error */ >> typedef __int64_t __time_t; /* time()... */ >> typedef __uint64_t __uintfptr_t; >> -typedef __uint64_t __uintmax_t; >> typedef __uint64_t __uintptr_t; >> +#else >> +typedef __int32_t __ptrdiff_t; >> +typedef __int32_t __register_t; >> +typedef __int32_t __segsz_t; >> +typedef __uint32_t __size_t; >> +typedef __int32_t __ssize_t; >> +typedef __int32_t __time_t; >> +typedef __uint32_t __uintfptr_t; >> +typedef __uint32_t __uintptr_t; >> +#endif >=20 > [unsigned] long would work without ifdefs for all of these, since all > these expanded naturally to the register width. Perhaps a better way, > which also works for i386's with correctly-sized longs, is to define > almost everything in terms of registers -- as __[u]register_t. register_t is a machine dependent type and the others are LP64/ILP32 dependent, so they're not strictly related. MIPS N32 is an example of that. As for using long, I'm not sure. It has the same size as int, but they aren't the same in format strings. >> +typedef __uint64_t __uintmax_t; >> typedef __uint32_t __uint_fast8_t; >> typedef __uint32_t __uint_fast16_t; >> typedef __uint32_t __uint_fast32_t; >> @@ -92,12 +125,23 @@ typedef __uint8_t __uint_least8_t; >> typedef __uint16_t __uint_least16_t; >> typedef __uint32_t __uint_least32_t; >> typedef __uint64_t __uint_least64_t; >> +#ifdef _LP64 >> typedef __uint64_t __u_register_t; >> typedef __uint64_t __vm_offset_t; >> -typedef __int64_t __vm_ooffset_t; >> typedef __uint64_t __vm_paddr_t; >> -typedef __uint64_t __vm_pindex_t; >> typedef __uint64_t __vm_size_t; >> +#else >> +typedef __uint32_t __u_register_t; >> +typedef __uint32_t __vm_offset_t; >> +#ifdef PAE >> +typedef __uint64_t __vm_paddr_t; >> +#else >> +typedef __uint32_t __vm_paddr_t; >> +#endif >> +typedef __uint32_t __vm_size_t; >> +#endif >> +typedef __int64_t __vm_ooffset_t; >> +typedef __uint64_t __vm_pindex_t; >=20 > Similarly. The patch, and possibly the ifdefs, are hard to read here. > There's a nested ifdef for PAE. PAE doesn't apply for amd64. The > above assumes that the cases where it doesn't apply are classified > by !_LP64. I'm not sure yet about what should happen with these vm types. I'm not entirely convinced yet that all these "invisible" types are really necessary at all. > x86/include didn't have many files in it before this and similar > commits in the same batch, and the first file that I looked at in > it has various new and old convolutions and bugs: >=20 > x86/include/_align.h: > % /* > % * Round p (pointer or byte index) up to a correctly-aligned value > % * for all data types (int, long, ...). The result is unsigned int > % * and must be cast to any desired pointer type. > % */ >=20 > This comment was blindly copied from i386. It doesn't match the > code below. >=20 > % #define _ALIGNBYTES (sizeof(register_t) - 1) > % #define _ALIGN(p) (((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) >=20 > This code is broken, since it uses register_t and uintptr_t which are not > necessarily defined here. Old code was careful to use only basic types, > so that no undocumented prerequisites are required and so that this not > broken when the undocumented prerequisites are not accidentally supplied. >=20 > The type of the result is actually uintptr_t. On i386, uintptr_t is > just a different spelling of unsigned int. On amd64, it is different. >=20 > This file shouldn't exist. >=20 > {amd64,i386,pc98}/include/_align.h just include x86/include/_align.h. > They shouldn't exist either. I agree, but I want to finish mapping out the various POSIX standards first before looking into where the FreeBSD specific headers fit in. > i386/include/param.h: > % #include >=20 > This include is misplaced (outside of the idempotency ifdef for this > file). The definitions used to be here for technical reasons in > their correct implementation. There used to be an ifdef here so that > this file could be included to define only the alignment macros so > as to not get namespace pollution in unusual cases. This was > "cleaned up" for the unusual cases to pessimize the usual cases. > The cleanups have rotted, so they now have not just 1, but 2 layers > of nested includes of _align.h to untangle to see what this file is > doing. 2 layers give about the same level of obfuscation as the > correct implementation, plus more inefficiencies than only 1 layer. >=20 > %=20 > % #ifndef _I386_INCLUDE_PARAM_H_ > % #define _I386_INCLUDE_PARAM_H_ > %=20 > % /* > % * Machine dependent constants for Intel 386. > % */ > %=20 > % /* > % * Round p (pointer or byte index) up to a correctly-aligned value > % * for all data types (int, long, ...). The result is unsigned int > % * and must be cast to any desired pointer type. > % */ >=20 > The comment is still correct for the definitions here. >=20 > % #ifndef _ALIGNBYTES > % #define _ALIGNBYTES (sizeof(int) - 1) > % #endif > % #ifndef _ALIGN > % #define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) > % #endif >=20 > But these definitions are unreachable, since is > included unconditionally, and it defines the alignment macros > unconditionally. >=20 > %=20 > % >=20 > Mistakes near here also added this style bug (extra blank line). >=20 > % #define __HAVE_ACPI >=20 > amd64/include/param.h: > % * $FreeBSD: src/sys/amd64/include/param.h,v 1.37 2011/07/19 13:00:30 a= ttilio Exp $ > % */ > %=20 > % >=20 > Extra blank lines are scattered randomly and happen to be in different > places. >=20 > % #ifndef _AMD64_INCLUDE_PARAM_H_ > % #define _AMD64_INCLUDE_PARAM_H_ > %=20 > % #include >=20 > Unlike for i386, this is placed almost correctly. It is inside the > idempotency ifdef... >=20 > %=20 > % /* > % * Machine dependent constants for AMD64. > % */ >=20 > ... but not inside the comment that should describe everything in this > file. >=20 > %=20 > % >=20 > Another random extra blank line. Or not so random. >=20 > Unlike for i386, the old definitions are not kept here. They used to > be placed up where the include is now on i386 (outside of the idempotency > ifdef). They used to use u_long to avoid prerequisites and have a > correct comment for them. For i386 there are now 2 correct comments > about them (but with confusing spelling in one), while for amd64 there > is only 1 incorrect comment. >=20 > % ... > % #define ALIGNBYTES _ALIGNBYTES > % #define ALIGN(p) _ALIGN(p) >=20 > These (and ALIGNED_POINTER()) are the primary APIs for these macros > (the APIs with underscores are just to keep them out of the namespace > in POSIX headers). The above definitions of the primary APIs are > completely MI once the underscored versions are defined, so they > shouldn't be defined here or in any other MD header. >=20 > Just about all of the amd64 and i386 param.h are the same, although > not as MI as ALIGNBYTES etc. I don't really want the definitions > moved to x86 though. They are bad enough where they are. OK. I don't think this header is important to user code. > Other bugs in them include: > - amd64_btop() and amd64_ptob() are named gratuitously differently > than i386_btop() and i386_ptob(). Names like md_btop() and > md_btop() or just btop() and btop() would be better. Not having > these APIs might be better still. There is considerable confusion > between these APIs and others that give the same results, and since > the results are the same and there is no type checking, it is > unlikely that the logically correct API is always used: > - the corresponding "MI" APIs are ctob() and btoc(). These are > ancient. 'c' in them means 'clicks' (groups of pages). Groups > of more than one page have never been used in FreeBSD. The > implementation of these macros is sort of backwards, with the > assumption that the group size is always 1 page hard-coded in > their definitions via PAGE_MASK and PAGE_SHIFT. > - atop() and ptoa() may also be "MI", but have MD implementations. > They are confusingly similar to ctob() and btoc(). 'p' (page) > in them always means the same as 'c' (clicks) in practice. 'a' > (address) in them always means the same as 'b' (address in bytes, > or size in bytes) in practice. The logical differences are > subtle. There isn't even a MI API like atop() for for sizes > instead of addresses. > - {amd64,i386}_btop() and {amd64,i386}_ptob() logically handle either > sizes or addresses, and convert to and from pages. They are the > easiest to use provided you assume that the address space is flat > and that the pages aren't grouped into clicks, but they are MD > and have the worse spelling. This is sort of backwards again. It > is MD layers that should use shorter spelling of their variables > and APIs, and hard-code assumptions. i386 mostly uses atop(), and > most of these uses are doubly logically wrong, since they are > mostly for sizes and not for addresses, amd are very MD: > - ctob: 13 instances > - btoc: 0 > - atop: 34 instances (counting its definition). Most are for segment > limits, this are for sizes, thus are abuses. > - ptoa: 13 ... mostly for sizes. Confusion between this and ctob is > apparently perfectly divided. > - i386_ptob: 3 instances. Just 1 use in pmap.c duplicated for xen. > - i386_btop: 9 instances. Just 4+2 uses in pmap.c's, 2 in pmap.h > (in a macros and an inline that expand to many more uses) >=20 > One of the reasons for putting all types declarations in the same file > although this gives inefficiencies by requiring the compiler to read > and parse very large files to get the few definitions that are actually, > is to avoid the convolutions and ifdefs for minimising the declarations. > Convolutions and ifdefs for other purposes defeat this to some extent. > Although I was responsible for some of the tiny _foo.h files like > which are used to minimise namespace problems, I don't > like the profileration of such files to handle even tinier problems. > The worst that I have noticed are _null.h (this should be handled in > machine/_types.h, where it used to be possible to handle it without > ifdefs), _align.h, and *stdint.h (there are now 4 layers of convolutions > with internal branches for : > - /usr/include/stdint.h -> sys/stdint.h (only a symlink) > - sys/stdint.h includes sys/_stdint.h and machine/_stdint.h > - sys/_stdint.h is a mistake to allow sys/types.h to include it > instead of declaring historical pollution for itself, but only > for some pollution that is now standard in -- types.h > still declares things like u_int8_t unconditionally for itself; > the handling of these is a bit simpler because they don't need > ifdefs to prevent re-declaration in . Now it is harder > to see what types.h declares. > - machine/_stdint.h was the correct implementation. Now it includes > x86/_stdint.h on amd64 and i386. > - x86/_stdint.h. Most of the details are now here, 4 layers deep, > with ifdefs. >=20 > Ideally, everything would be in directly. I don't know how > to do it in a layer, but is it too much to ask for only 2 layers? > Hmm, I do know how to do it in 1 layer -- flatten it at install time. > Anyone who cared about efficiency and readability would do this :-). > But I usually read the uninstalled sources. If you allow ifdef _LP64 in sys/stdint.h everything in machine/_stdint.h could be moved there, except the sig_atomic_t limits which seems to be another __clock_t case. --nextPart2527463.E7el3J74Ju Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk9P/CcACgkQfoCS2CCgtiuugQD/ZkZVTSuRdfJER363OpF4DoN1 PVR3SpuWq4oRHb+o6v4A/3ouyuJYHkUtcgAfjWSBoN6bfQRqiSHtfaK/sbcNU7lV =mcAP -----END PGP SIGNATURE----- --nextPart2527463.E7el3J74Ju-- From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 22:46:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A660106564A; Thu, 1 Mar 2012 22:46:26 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay007.isp.belgacom.be (mailrelay007.isp.belgacom.be [195.238.6.173]) by mx1.freebsd.org (Postfix) with ESMTP id 1DD2C8FC15; Thu, 1 Mar 2012 22:46:24 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAFAE/7T09bsWst/2dsb2JhbABDsRmCcYEIgX0BAQVWIxALDgouOR4GiB25Bo0WDQ8CAj4UCQKFCAqEGgSIHKAS Received: from 45.107-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.107.45]) by relay.skynet.be with ESMTP; 01 Mar 2012 23:46:23 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q21MkMG0046321; Thu, 1 Mar 2012 23:46:22 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Bruce Evans Date: Thu, 1 Mar 2012 23:46:20 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120229160522.W2514@besplex.bde.org> <20120229181608.S2887@besplex.bde.org> In-Reply-To: <20120229181608.S2887@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1956764.VNK7ZdMx6j"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201203012346.20648.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Thu, 01 Mar 2012 22:46:26 -0000 --nextPart1956764.VNK7ZdMx6j Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Wednesday 29 February 2012 08:44:54 Bruce Evans wrote: > On Wed, 29 Feb 2012, Bruce Evans wrote: >> I cleaned this up a bit according to ideas in my previous mails, and >> added a comment about the confusing use of __bswap64_const() (now >> named __bswap64_gen()) in __bswap64_var(): >=20 > A minor problem with only having a macro version for __bswap64() turned > up: >=20 >> % -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) >> % - >> % -#define __bswap16(_x) \ >> % - (__builtin_constant_p(_x) ? \ >> % - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) >> ... >> % +#define ___bswap16(x) (__uint16_t)((x) << 8 | (x) >> 8) >> % +#define __bswap16(x) (___bswap16((__uint16_t)(x))) >=20 > When x a non-volatile variable, gcc and clang produce the good code > "rolw $8,x" for "x =3D __bswap16(x);" on short x. But when x a a volatile > variable, gcc and clang produce fairly horrible code, with 2 loads of > x corresponding to the 2 accesses to x. This is probably required by > volatile semantics, and is a problem for all unsafe macros, especially > when their name says that they are safe (oops). When __bswap16 is > implemented as an inline function for the var case like it used to be, > it only loads x once and there are no problems with volatile variables. > Optimizing to "rolw $8,x" might still be possible iff x is not volatile, > but load-modify-store is probably better anyway. >=20 > So any macro version must use gcc features to be safe. The following > seems to work: >=20 > #define __bswap16(x) __extension__ ({ __uint16_t __x =3D x; > (__uint16_t)(__x << 8 | __x >> 8); }) >=20 > clang now produces "rolw $8,x" when x is volatile. This seems to > violate volatile semantics. gcc produces load-rolw-store then. Both > produce "rolw $8,x" when x is not volatile. I'll have a closer look at the patch tomorrow, but the Intel documentation for the bswap instruction recommends to use xchg for bswap16. --nextPart1956764.VNK7ZdMx6j Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk9P/DwACgkQfoCS2CCgtisrzAD8CaKRjS8jxXFheUkmozl9Jftg JcGmz5jhnUHDF8n+jwcA/2m5oLN7xxWOJUFlsK4bf4aiaa99HYRcs5ZUwnlkgzwA =Zegu -----END PGP SIGNATURE----- --nextPart1956764.VNK7ZdMx6j-- From owner-svn-src-all@FreeBSD.ORG Thu Mar 1 22:47:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C39DD106566B; Thu, 1 Mar 2012 22:47:38 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay007.isp.belgacom.be (mailrelay007.isp.belgacom.be [195.238.6.173]) by mx1.freebsd.org (Postfix) with ESMTP id 7D1CC8FC1C; Thu, 1 Mar 2012 22:47:37 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAFAE/7T09bsWst/2dsb2JhbABDsRmCcYEIgX0BAQVWIxALDgouOR4GiB25BooBgn0EBAIMAwUEAgwEAgI+FIUTCoQaBIgcoBKBUw Received: from 45.107-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.107.45]) by relay.skynet.be with ESMTP; 01 Mar 2012 23:47:36 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q21MlZFu046337; Thu, 1 Mar 2012 23:47:35 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Bruce Evans Date: Thu, 1 Mar 2012 23:47:32 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <20120229151223.K2273@besplex.bde.org> In-Reply-To: <20120229151223.K2273@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1475720.AtHMusYaJp"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201203012347.32984.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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: Thu, 01 Mar 2012 22:47:38 -0000 --nextPart1475720.AtHMusYaJp Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Wednesday 29 February 2012 06:01:36 Bruce Evans wrote: > On Tue, 28 Feb 2012, Tijl Coosemans wrote: >=20 >> Log: >> Copy amd64 setjmp.h to x86 and replace amd64/i386/pc98 setjmp.h with st= ubs. >=20 > This may be correct (except for comment), but it is confusing. >=20 >> Added: >> head/sys/x86/include/setjmp.h >> - copied unchanged from r232268, head/sys/amd64/include/setjmp.h >> Modified: >> head/sys/amd64/include/setjmp.h >> head/sys/i386/include/setjmp.h >> head/sys/pc98/include/setjmp.h >> >> Modified: head/sys/amd64/include/setjmp.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/amd64/include/setjmp.h Tue Feb 28 22:15:46 2012 (r232274) >> +++ head/sys/amd64/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275) >> @@ -1,50 +1,6 @@ >> ... >> -#define _JBLEN 12 /* Size of the jmp_buf on AMD64. */ >> - >> -/* >> - * jmp_buf and sigjmp_buf are encapsulated in different structs to force >> - * compile-time diagnostics for mismatches. The structs are the same >> - * internally to avoid some run-time errors for mismatches. >> - */ >> -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE >> -typedef struct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1]; >> -#endif >> - >> -typedef struct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1]; >=20 > On amd64, the comment was specific to amd64 (but with amd64 misspelled > as AMD64), and actually matched the code. >=20 >> Modified: head/sys/i386/include/setjmp.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/i386/include/setjmp.h Tue Feb 28 22:15:46 2012 (r232274) >> +++ head/sys/i386/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275) >> @@ -1,50 +1,6 @@ >> -#define _JBLEN 11 /* Size of the jmp_buf on x86. */ >> - >> -/* >> - * jmp_buf and sigjmp_buf are encapsulated in different structs to force >> - * compile-time diagnostics for mismatches. The structs are the same >> - * internally to avoid some run-time errors for mismatches. >> - */ >> -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE >> -typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; >> -#endif >> - >> -typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1]; >=20 > On i386, the comment had a differently wrong name for the old code, and > mismatched the old code, but is correct for the new code. >=20 > _JBLEN was apparently 1 less than what it was claimed to be on i386. > I forget what the extra 1 is for. >=20 >> Copied: head/sys/x86/include/setjmp.h (from r232268, head/sys/amd64/incl= ude/setjmp.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 >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/sys/x86/include/setjmp.h Tue Feb 28 22:17:52 2012 (r232275, cop= y of r232268, head/sys/amd64/include/setjmp.h) >> @@ -0,0 +1,50 @@ >> ... >> +#define _JBLEN 12 /* Size of the jmp_buf on AMD64. */ >=20 > This code looks wrong, since _JBLEN was only 11 for i386, but binary > compatibility of the jmp_buf is preserved by the extra 1 in it. >=20 > This comment is wrong, since the code is no longer just for AMD64 (sic), > and the comment makes it look more like the code has an off-by-1 error > for !AMD64. >=20 >> + >> +/* >> + * jmp_buf and sigjmp_buf are encapsulated in different structs to force >> + * compile-time diagnostics for mismatches. The structs are the same >> + * internally to avoid some run-time errors for mismatches. >> + */ >> +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE >> +typedef struct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1]; >> +#endif >> + >> +typedef struct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1]; >=20 > No extra 1 for either now. >=20 > The extra 1 was apparently a placeholder for the signal mask and became > obsolete 15-20 years ago. 4.4BSD-Lite2 claims not to support the signal > mask, and doesn't have space for it in the plain jmp_buf. setjmp.h > was in src/include and was moved to MD files to clean up its ifdefs. > Now we're barely escaping putting the ifdefs back in the x86 version, > sigh. Ifdefs are really needed, since the i386 version is too small > to have space for mxcsr, and mxcsr is only hacked into the amd64 version > by packing it using the doubled space given by long entries. >=20 > From the 4.4BSD-Lite2 version: > % #if defined(hp300) || defined(__hp300__) || defined(luna68k) || defined= (__luna68k__) > % #define _JBLEN 17 > % #endif > %=20 > % #if defined(i386) || defined(__i386__) > % #define _JBLEN 10 > % #endif > %=20 > % #if defined(mips) || defined(__mips__) > % #define _JBLEN 83 > % #endif > %=20 > % #if defined(sparc) || defined(__sparc__) > % #define _JBLEN 10 > % #endif > %=20 > % #if defined(tahoe) || defined(__tahoe__) > % #define _JBLEN 10 > % #endif > %=20 > % #if defined(vax) || defined(__vax__) > % #define _JBLEN 10 > % #endif > %=20 > % #ifndef _ANSI_SOURCE > % /* > % * WARNING: sigsetjmp() isn't supported yet, this is a placeholder. > % */ > % typedef int sigjmp_buf[_JBLEN + 1]; > % #endif /* not ANSI */ > %=20 > % typedef int jmp_buf[_JBLEN]; >=20 > The extra 1 seems to have been nonsense there too. BSD has always (?) > saved the signal mask in the ordinary jmp_buf. 4.4BSD-Lite2 seems to > do this, and could hardly have worked without it. So _JBLEN was already > large enough and didn't need a placeholder for the signal mask. But > I now vaguely remember stealing this extra 1 for the FP control word. > It was sloppy not to update the comment. Later, jb left the extra 1 > and the comment alone. The commit log says that _JBLEN was left in > case something (mis)uses it. I think it should be removed. It should > only be used in the 2 jmp_buf structs, and now that sigsetjmp() has > been standard for so long, and since making the structure layouts > identical is best for any system which saves the signal mask in setjmp() > and probably also on any system that doesn't, I don't see any need for > separate jmp_buf structs (just use separate typedefs using the same > struct). >=20 > Next, I don't see why can't be MI except for the definition > of _JBLEN. _JBLEN can be declared in some harmless MD header that is > already usually included. Since we removed machine/ansi.h, > machine/types.h seems to be the only suitable one. >=20 > Here is what current arches have in their machine/setjmp.h: >=20 > amd64, i386: not much > arm: has lots of comments and register offsets. These are defined as > _JB_REG_* so they aren't pollution, but there is no reason to > export them to the application either. The actual > structs are the usual 2 arrays of ints, with the extra 1 for > both the comment not matching the code, as on i386. The extra > 1 is unused, or at least has no _JB_REG_* for it. > ia64: has lots of namespace-pollution definitions under a __BSD_VISIBLE > ifdef. The structs are arrays of long doubles! This defeats > my idea of using a MI array of register_t's. _JBLEN could be > expanded for long doubles, but __align() would be required too, > and it gets messier than a separate file. > mips: just the usual extra 1 (now 4 instances for 32/64 doubling) and > the usual comment not matching the code. > powerpc: like x86 > sparc64: just the usual extra 1. The comment is fixed by removing it. >=20 > So the extra 1 seems to be just a ~20-year old mistake, faithfully > propagated to all arches except amd64 i386, with unfaithful propagation > just fixed for i386. If we could add the returns_twice attribute to setjmp() then the compiler makes sure all registers are dead before calling it and jmp_buf wouldn't have to be that big. Also, from ISO C: "All accessible objects have values, and all other components of the abstract machine [249] have state, as of the time the longjmp function was called" "[249] This includes, but is not limited to, the floating-point status flags and the state of open files." So I think storing mxcsr in jmp_buf is incorrect. --nextPart1475720.AtHMusYaJp Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk9P/IQACgkQfoCS2CCgtiu9jgEAgfuPYDxt5ThKBNCqUnEHFwk6 YlHVXn3NFICGgFN5lQEA/0/Gu9IBCYckJVzIbehov8bpQRsb7bKIjdzVa6addSop =0hlp -----END PGP SIGNATURE----- --nextPart1475720.AtHMusYaJp-- From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 00:00:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22C671065674 for ; Fri, 2 Mar 2012 00:00:33 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay02.pair.com (relay02.pair.com [209.68.5.16]) by mx1.freebsd.org (Postfix) with SMTP id CE63C8FC13 for ; Fri, 2 Mar 2012 00:00:32 +0000 (UTC) Received: (qmail 73669 invoked from network); 1 Mar 2012 23:33:51 -0000 Received: from 87.58.144.241 (HELO x2.osted.lan) (87.58.144.241) by relay02.pair.com with SMTP; 1 Mar 2012 23:33:51 -0000 X-pair-Authenticated: 87.58.144.241 Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.4/8.14.4) with ESMTP id q21NXp0V025217; Fri, 2 Mar 2012 00:33:51 +0100 (CET) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.4/8.14.4/Submit) id q21NXpro025216; Fri, 2 Mar 2012 00:33:51 +0100 (CET) (envelope-from pho) Date: Fri, 2 Mar 2012 00:33:51 +0100 From: Peter Holm To: John Baldwin Message-ID: <20120301233351.GA24773@x2.osted.lan> References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201203011647.41313.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203011647.41313.jhb@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: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 00:00:33 -0000 On Thu, Mar 01, 2012 at 04:47:41PM -0500, John Baldwin wrote: > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > Author: pho > > Date: Mon Oct 31 15:01:47 2011 > > New Revision: 226967 > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > Log: > > The kern_renameat() looks up the fvp using the DELETE flag, which causes > > the removal of the name cache entry for fvp. > > > > Reported by: Anton Yuzhaninov > > In collaboration with: kib > > MFC after: 1 week > > > > Modified: > > head/sys/ufs/ufs/ufs_vnops.c > > So I ran into this at work recently, and even this fix applied I was still > seeing rename()'s that were seemingly not taking effect. After getting some > extra KTR traces, I figured out that the same purge needs to be applied to the > destination vnode. Specifically, the issue I ran into was that was renaming > 'foo' to 'bar', but lookups for 'bar' were still returning the old file. The > reason was that a lookup after the namei(RENAME) of the destination while > ufs_rename() had its locks dropped was readding the name cache entry for > 'bar', and then a cache_lookup() of 'bar' would return the old vnode as long > as that vnode was valid (e.g. if it had a link in another location, or other > processes had an open file descriptor for it). I'm currently testing the > patch below: > You wouldn't happen to have a small test scenario that demonstrates this? I'm not able to reproduce the problem, based on your description. I'll try some more tomorrow. - Peter From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 00:15:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B2E91065672; Fri, 2 Mar 2012 00:15:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A2128FC0A; Fri, 2 Mar 2012 00:15:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q220FDea004232; Fri, 2 Mar 2012 00:15:13 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q220FDpD004230; Fri, 2 Mar 2012 00:15:13 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201203020015.q220FDpD004230@svn.freebsd.org> From: Hiroki Sato Date: Fri, 2 Mar 2012 00:15:13 +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: r232370 - 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, 02 Mar 2012 00:15:14 -0000 Author: hrs Date: Fri Mar 2 00:15:13 2012 New Revision: 232370 URL: http://svn.freebsd.org/changeset/base/232370 Log: MFC r230981: Fix input validation in SO_SETFIB socket option. Approved by: re (bz) Modified: stable/8/sys/kern/uipc_socket.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/uipc_socket.c ============================================================================== --- stable/8/sys/kern/uipc_socket.c Thu Mar 1 22:36:42 2012 (r232369) +++ stable/8/sys/kern/uipc_socket.c Fri Mar 2 00:15:13 2012 (r232370) @@ -2492,7 +2492,7 @@ sosetopt(struct socket *so, struct socko case SO_SETFIB: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); - if (optval < 0 || optval > rt_numfibs) { + if (optval < 0 || optval >= rt_numfibs) { error = EINVAL; goto bad; } From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 00:15:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 292E5106566C; Fri, 2 Mar 2012 00:15:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 183D68FC15; Fri, 2 Mar 2012 00:15:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q220FqLE004286; Fri, 2 Mar 2012 00:15:52 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q220FqO2004284; Fri, 2 Mar 2012 00:15:52 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201203020015.q220FqO2004284@svn.freebsd.org> From: Hiroki Sato Date: Fri, 2 Mar 2012 00:15: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: r232371 - stable/8/sbin/route X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 00:15:53 -0000 Author: hrs Date: Fri Mar 2 00:15:52 2012 New Revision: 232371 URL: http://svn.freebsd.org/changeset/base/232371 Log: MFC r230989: Fix a possible infinite loop in "route flush" on 64-bit archs. Approved by: re (bz) Modified: stable/8/sbin/route/route.c Directory Properties: stable/8/sbin/route/ (props changed) Modified: stable/8/sbin/route/route.c ============================================================================== --- stable/8/sbin/route/route.c Fri Mar 2 00:15:13 2012 (r232370) +++ stable/8/sbin/route/route.c Fri Mar 2 00:15:52 2012 (r232371) @@ -460,8 +460,8 @@ netname(struct sockaddr *sa) * Guess at the subnet mask, assuming reasonable * width subnet fields. */ - while (in.s_addr &~ mask) - mask = (long)mask >> subnetshift; + while (in.s_addr & ~mask) + mask |= mask >> subnetshift; net = in.s_addr & mask; while ((mask & 1) == 0) mask >>= 1, net >>= 1; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 00:21:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 989BA106566C; Fri, 2 Mar 2012 00:21:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 875C48FC1B; Fri, 2 Mar 2012 00:21:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q220L87G004557; Fri, 2 Mar 2012 00:21:08 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q220L801004555; Fri, 2 Mar 2012 00:21:08 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201203020021.q220L801004555@svn.freebsd.org> From: Ed Maste Date: Fri, 2 Mar 2012 00:21:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232372 - stable/9/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 00:21:08 -0000 Author: emaste Date: Fri Mar 2 00:21:07 2012 New Revision: 232372 URL: http://svn.freebsd.org/changeset/base/232372 Log: MFC r232267: Workaround for PCIe 4GB boundary issue Enforce a boundary of no more than 4GB - transfers crossing a 4GB boundary can lead to data corruption due to PCIe limitations. This change is a less-intrusive workaround that can be quickly merged back to older branches; a cleaner implementation will arrive in HEAD later but may require KPI changes. This change is based on a suggestion by jhb@. Sponsored by: Sandvine Incorporated Modified: stable/9/sys/x86/x86/busdma_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/x86/x86/busdma_machdep.c ============================================================================== --- stable/9/sys/x86/x86/busdma_machdep.c Fri Mar 2 00:15:52 2012 (r232371) +++ stable/9/sys/x86/x86/busdma_machdep.c Fri Mar 2 00:21:07 2012 (r232372) @@ -227,6 +227,14 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; + /* Always enforce at least a 4GB (2GB for PAE) boundary. */ +#if defined(__amd64__) + if (boundary == 0 || boundary > ((bus_addr_t)1 << 32)) + boundary = (bus_size_t)1 << 32; +#elif defined(PAE) + if (boundary == 0 || boundary > ((bus_addr_t)1 << 31)) + boundary = (bus_size_t)1 << 31; +#endif /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 02:23:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EC0E7106564A; Fri, 2 Mar 2012 02:23:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 83ED38FC13; Fri, 2 Mar 2012 02:23:56 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q222NmPS006269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Mar 2012 13:23:54 +1100 Date: Fri, 2 Mar 2012 13:23:48 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201203012346.20648.tijl@freebsd.org> Message-ID: <20120302130435.J929@besplex.bde.org> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120229160522.W2514@besplex.bde.org> <20120229181608.S2887@besplex.bde.org> <201203012346.20648.tijl@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, Dimitry Andric , Bruce Evans Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 02:23:57 -0000 On Thu, 1 Mar 2012, Tijl Coosemans wrote: > On Wednesday 29 February 2012 08:44:54 Bruce Evans wrote: >> ... >> So any macro version must use gcc features to be safe. The following >> seems to work: >> >> #define __bswap16(x) __extension__ ({ __uint16_t __x = x; >> (__uint16_t)(__x << 8 | __x >> 8); }) >> >> clang now produces "rolw $8,x" when x is volatile. This seems to >> violate volatile semantics. gcc produces load-rolw-store then. Both >> produce "rolw $8,x" when x is not volatile. > > I'll have a closer look at the patch tomorrow, but the Intel > documentation for the bswap instruction recommends to use xchg for > bswap16. That's what i386 used to do, using an asm (see for example the RELENG_4 version), but the asm was replaced by C code and the compiler apparently knows better. This might depend on -mtune. I tested with the default, which is poorly documented and hard to remember, but what I remember is that it is for a really old Intel CPU. Checking the documentation shows that the default might be the same as -mtune=generic which is the same as -mtune=i686, where i686 seems to be undocumented but seems to be similar to pentiumpro. I would have to run old tests to verify this. There must also be magic to break i386 support, so that bswap gets used. The current default is certainly not -march=i386 like it used to be, but the details of what it now is seem to be undocumented. It doesn't include SSE support, since it is only for a really old Intel CPU; just one that is not quite as old as plain i386. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 02:53:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7AAD1065670; Fri, 2 Mar 2012 02:53:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6D8E8FC15; Fri, 2 Mar 2012 02:53:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q222riEl010126; Fri, 2 Mar 2012 02:53:44 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q222riIG010124; Fri, 2 Mar 2012 02:53:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201203020253.q222riIG010124@svn.freebsd.org> From: Adrian Chadd Date: Fri, 2 Mar 2012 02:53: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: r232373 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 02:53:44 -0000 Author: adrian Date: Fri Mar 2 02:53:43 2012 New Revision: 232373 URL: http://svn.freebsd.org/changeset/base/232373 Log: Attempt to catch scan cancellations at exactly the wrong time from occuring. The scan code unlocks the comlock and calls into the driver. It then assumes the state hasn't changed from underneath it. Although I haven't seen this particular condition trigger, I'd like to be informed if I or anyone else sees it. What I'm thinking may occur: * A cancellation comes in during the scan_end call; * the cancel flag is set; * but it's never checked, so scandone isn't updated; * .. and the interface stays in the STA power save mode. It's a subtle race, if it even exists. PR: kern/163318 Modified: head/sys/net80211/ieee80211_scan.c Modified: head/sys/net80211/ieee80211_scan.c ============================================================================== --- head/sys/net80211/ieee80211_scan.c Fri Mar 2 00:21:07 2012 (r232372) +++ head/sys/net80211/ieee80211_scan.c Fri Mar 2 02:53:43 2012 (r232373) @@ -960,6 +960,19 @@ scan_task(void *arg, int pending) IEEE80211_LOCK(ic); /* + * Since a cancellation may have occured during one of the + * driver calls (whilst unlocked), update scandone. + */ + if (scandone == 0 && + ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0)) { + /* XXX printf? */ + if_printf(vap->iv_ifp, + "%s: OOPS! scan cancelled during driver call!\n", + __func__); + } + scandone |= ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0); + + /* * Record scan complete time. Note that we also do * this when canceled so any background scan will * not be restarted for a while. From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 02:57:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 416A7106566C; Fri, 2 Mar 2012 02:57:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 309FB8FC18; Fri, 2 Mar 2012 02:57:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q222vBQZ010270; Fri, 2 Mar 2012 02:57:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q222vAhj010268; Fri, 2 Mar 2012 02:57:10 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201203020257.q222vAhj010268@svn.freebsd.org> From: Adrian Chadd Date: Fri, 2 Mar 2012 02:57: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: r232374 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 02:57:11 -0000 Author: adrian Date: Fri Mar 2 02:57:10 2012 New Revision: 232374 URL: http://svn.freebsd.org/changeset/base/232374 Log: Wrap the scan code state change stuff behind ATH_LOCK and the PCU fiddling behind the PCU lock. sc_scanning is being checked without ATH_LOCK behind held and could in theory run from multiple threads. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Mar 2 02:53:43 2012 (r232373) +++ head/sys/dev/ath/if_ath.c Fri Mar 2 02:57:10 2012 (r232374) @@ -5637,11 +5637,16 @@ ath_scan_start(struct ieee80211com *ic) /* XXX calibration timer? */ + ATH_LOCK(sc); sc->sc_scanning = 1; sc->sc_syncbeacon = 0; rfilt = ath_calcrxfilter(sc); + ATH_UNLOCK(sc); + + ATH_PCU_LOCK(sc); ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, ifp->if_broadcastaddr, 0); + ATH_PCU_UNLOCK(sc); DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0\n", __func__, rfilt, ether_sprintf(ifp->if_broadcastaddr)); @@ -5655,12 +5660,17 @@ ath_scan_end(struct ieee80211com *ic) struct ath_hal *ah = sc->sc_ah; u_int32_t rfilt; + ATH_LOCK(sc); sc->sc_scanning = 0; rfilt = ath_calcrxfilter(sc); + ATH_UNLOCK(sc); + + ATH_PCU_LOCK(sc); ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, sc->sc_curbssid, sc->sc_curaid); ath_hal_process_noisefloor(ah); + ATH_PCU_UNLOCK(sc); DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0x%x\n", __func__, rfilt, ether_sprintf(sc->sc_curbssid), From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 03:11:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D19251065670; Fri, 2 Mar 2012 03:11:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0FBA8FC1C; Fri, 2 Mar 2012 03:11:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q223BraV011054; Fri, 2 Mar 2012 03:11:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q223Brfh011052; Fri, 2 Mar 2012 03:11:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201203020311.q223Brfh011052@svn.freebsd.org> From: Adrian Chadd Date: Fri, 2 Mar 2012 03:11: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: r232375 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 03:11:53 -0000 Author: adrian Date: Fri Mar 2 03:11:53 2012 New Revision: 232375 URL: http://svn.freebsd.org/changeset/base/232375 Log: Wrap another ATH_LOCK around the scanning flag. PR: kern/163318 Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Mar 2 02:57:10 2012 (r232374) +++ head/sys/dev/ath/if_ath.c Fri Mar 2 03:11:53 2012 (r232375) @@ -5690,8 +5690,10 @@ ath_set_channel(struct ieee80211com *ic) * beacon timers. Note that since we only hear beacons in * sta/ibss mode this has no effect in other operating modes. */ + ATH_LOCK(sc); if (!sc->sc_scanning && ic->ic_curchan == ic->ic_bsschan) sc->sc_syncbeacon = 1; + ATH_UNLOCK(sc); } /* From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 04:11:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1AFF106566B; Fri, 2 Mar 2012 04:11:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail16.syd.optusnet.com.au (mail16.syd.optusnet.com.au [211.29.132.197]) by mx1.freebsd.org (Postfix) with ESMTP id 379988FC08; Fri, 2 Mar 2012 04:11:25 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail16.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q224BLZX000806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Mar 2012 15:11:23 +1100 Date: Fri, 2 Mar 2012 15:11:21 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201203012347.32984.tijl@freebsd.org> Message-ID: <20120302132403.P929@besplex.bde.org> References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <20120229151223.K2273@besplex.bde.org> <201203012347.32984.tijl@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, Bruce Evans Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 04:11:26 -0000 On Thu, 1 Mar 2012, Tijl Coosemans wrote: > On Wednesday 29 February 2012 06:01:36 Bruce Evans wrote: >> ... >> Here is what current arches have in their machine/setjmp.h: >> >> amd64, i386: not much >> arm: has lots of comments and register offsets. These are defined as >> _JB_REG_* so they aren't pollution, but there is no reason to >> export them to the application either. The actual >> structs are the usual 2 arrays of ints, with the extra 1 for >> both the comment not matching the code, as on i386. The extra >> 1 is unused, or at least has no _JB_REG_* for it. >> ia64: has lots of namespace-pollution definitions under a __BSD_VISIBLE >> ifdef. The structs are arrays of long doubles! This defeats >> my idea of using a MI array of register_t's. _JBLEN could be >> expanded for long doubles, but __align() would be required too, >> and it gets messier than a separate file. >> mips: just the usual extra 1 (now 4 instances for 32/64 doubling) and >> the usual comment not matching the code. >> powerpc: like x86 >> sparc64: just the usual extra 1. The comment is fixed by removing it. >> >> So the extra 1 seems to be just a ~20-year old mistake, faithfully >> propagated to all arches except amd64 i386, with unfaithful propagation >> just fixed for i386. > > If we could add the returns_twice attribute to setjmp() then the > compiler makes sure all registers are dead before calling it and > jmp_buf wouldn't have to be that big. I think compilers already do stuff like that automatically. They have to for setjmp() to work. Since there was no way to declare such attributes 20 years ago, compilers had to know that setjmp() was special and make it work when it only has a Standard C declaration (and some magic in its inmplementation). > Also, from ISO C: "All accessible objects have values, and all other > components of the abstract machine [249] have state, as of the time the > longjmp function was called" > > "[249] This includes, but is not limited to, the floating-point status > flags and the state of open files." > > So I think storing mxcsr in jmp_buf is incorrect. This is a well known bug in ISO C. ISO C never even tried to support longjmp() from signal handlers, but we do. Supporting them requires restoring significant parts of the FP environment. I fixed this for the i387 control word in FreeBSD about 20 years ago. This was required even to support float to integer conversions on i386. The situation with these has changed a bit. It was: - there is a default rounding mode. C didn't support changing it. It is normally round-to-nearest. But for float to integer conversions, it is round-towards-zero. To implement the latter, compilers switch the mode to the latter mode. In old versions of FreeBSD, and still with COMPAT4 signal handlers, handling of the FP state in signal handlers was mostly incorrect. Signal handlers were passed the current FP state, except for clobbering the exception flags for SIGFPE's for hardware FP exceptions. Thus it was normal for signal handlers to see the rounding mode switched to round-towards-zero. This is not part of the abstract machine. A normal rounding mode must be restored somehow. C90 didn't support changing the rounding mode, so it would have been correct for C90 to hard-code the rounding mode at the time of main() in signal handlers if you knew what that was (it really should be set in crt or inherited across exec, instead of being hard-coded in the kernel like it is in FreeBSD). But i387 supports changing the rounding mode. It is simplest to restore it to that at the time of the setjmp(). Now, things are even more complicated: - signal handlers are normally passed a clean FP state. (Since C barely supports signal handlers, it doesn't say anything about this). Now, longjmp() from a signal handler would return this clean state if no FP state is restored, unless the signal handler does some FP operations that dirty its clean state. Returning the clean state has much the same effect in simple cases as restoring the state at the time of the setjmp(), because nothing except the compiler doing the float to integer conversions changes the state from its default, and the longjmp() takes us to a point where the compiler is not doing these conversions so it is correct for the normal state to be restored. There is now the minor simplication that i386 with SSE doesn't need the mode switch for floats, and i386 with SSE2 doesn't need it for doubles; but i386 still needs it for long doubles. There is the minor complication that the signal handler may be COMPAT4, in which case its FP state is not clean and the old method must be used -- longjmp() can hardly be expected to tell which type the signal handler is and adjust its behaviour to match. - C now supports changing the rounding mode. Its requirement that longjmp() not restore the previous rounding mode may be correct for some cases, but it is broken for longjmp() out of signal handlers: - suppose the signal handler gets a clean state, as in FreeBSD. Then any longjmp() out of a signal handler that doesn't restore the rounding mode (or any other part of the FP env) resets to the clean state (which should be the same as the default state); this state may differ from the state at the time of the setjmp() and also from the state at the time of the signal. This is broken. Perhaps the - suppose the signal handler doesn't get a clean state. Who knows what it is? Standards don't specify this. Even if the signal handler understands everything, then it will have a hard time cleaning up the state so that it is right at the time of the longjmp(). Note that it is not just SIGFPE handlers for hardware FP exceptions that would need to understand everything about FP to do the right thing. _All_ signal handlers would need this, since for example a harmless SIGINT handler might be interrupting a FP operation that changes the FP env in ways outside of the abstract machine. Next, there are the FP exception flags. C90 doesn't support these, and I didn't worry about these 20 years ago. I just put the i386 FP control word in jmp_buf, and used fninit to clean out everything else in the FP env. Now, C99 supports these. These should not be changed by longjmp(). However, for the case of longjmp() from a signal handler, if nothing is restored, then all of them will be be cleared by the longjmp() in the usual case where the signal handler doesn't dirty its clean state. Worse, if the signal handler dirties it state and doesn't do this intentionally to prepare for the longjmp(), then the main part of the program gets its exception flags replaced by the signal handler. Again, it is very difficult for signal handlers to understand FP well enough to do the right thing. SIGFPE ones have to understand a little more here. They have to understand that the kernel doesn't understand this stuff, so it has destroyed the exception flags in the saved state after only making a lossy copy of them (in the signal code). Destruction of the exception flags allows the case of returning from a signal handler to sort of work (the SIGFPE doesn't repeat). This problem only occurs if signals for FP exceptions are unmasked. Otherwise, SIGFPE never occurs for FP exceptions, but only for integer exceptions like division by 0. The amd64 _setjmp.S and setjmp.S (but not its sigsetjmp.S) save mxcsr in setjmp but only restores the non-flags from it in longjmp; it loses the fninit (except in sigsetjmp.S): % setjmp: % fnstcw 64(%rcx) /* 8; fpu cw */ % stmxcsr 68(%rcx) /* and mxcsr */ % longjmp: % /* Restore the mxcsr, but leave exception flags intact. */ % stmxcsr -4(%rsp) % movl 68(%rdx),%eax % andl $0xffffffc0,%eax % movl -4(%rsp),%edi % andl $0x3f,%edi % xorl %eax,%edi % movl %edi,-4(%rsp) % ldmxcsr -4(%rsp) % ... % // lost fninit here % fldcw 64(%rdx) For longjmp() from signal handlers, leaving the exception flags intact is worse than useless, since these are only the signal handler's exception flags (it would be better to clear them). On i386, the bugs are similar, except the mxcsr is not touched: - fninit has been removed from _setjmp.S and setjmp.S - sigsetjmp.S has not been touched (so it is missing mxcsr handling, but still does fninit). Removing the fninits is very large breakage in the i386 case. amd64 doesn't support COMPAT4 signal handlers. Thus its signal handlers start with a clean state and fninit in them only cleans up any dirt made by the signal handler, and there is rarely even minor dirt. But for i386 with a COMPAT4 signal handler, when a signal interrupts an FP operation, the i387 FP stack always has something on it. This needs to be cleaned before or by longmp() if longjmp() is used to quit the signal handler. Without COMPAT4 signal handlers, the only obvious bug is that leaving the i387 exception flags intact is worse than useless, the same as for then the sr part of mxcsr. Other things in the FP env are less portable so they are less used so they cause fewer problems. Standards don't support many other things, so the implementation can be correct for them even if the standard requires brokenness for other parts of the env. i387 precision control is an example. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 05:10:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8B8A106564A; Fri, 2 Mar 2012 05:10:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 2EE208FC0C; Fri, 2 Mar 2012 05:10:47 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q225Acel016885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Mar 2012 16:10:42 +1100 Date: Fri, 2 Mar 2012 16:10:38 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201203012346.00228.tijl@freebsd.org> Message-ID: <20120302151400.Y1224@besplex.bde.org> References: <201202281815.q1SIFSbB082030@svn.freebsd.org> <20120229071721.G989@besplex.bde.org> <201203012346.00228.tijl@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, Bruce Evans Subject: Re: svn commit: r232261 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 05:10:48 -0000 On Thu, 1 Mar 2012, Tijl Coosemans wrote: > On Wednesday 29 February 2012 00:26:43 Bruce Evans wrote: > The __clock_t case is a perfect example of how duplication leads to > differentiation and differentiation to portability issues. Currently > clock(3) only starts to return negative values after about six months > of cpu time, so I think it's relative safe to change the type to > uint32_t. I haven't checked the other cases where this type is used > though. This reminds me that clock_t is still essentially useless. The system has an accuracy of sub-microseconds for many times, but clock(3) is dumbed down to give give the semi-historical accuracy of 1/128 (1/60 miht be fully historical). The only other use of clock_t in FreeBSD is the SYSV compatibility cruft API times(3). This is a larger dumbing down of getrusage(3). Without the dumbing down, CLOCKS_PER_SEC would be something like 1e9 and a 32-bit clock_t would overflow after 4 seconds, so it would have to be 64 bits. Grepping for clock_t shows some nice bugs in pthread_condattr(3). It declares some parameters as "clock_t * restrict clock_id" and "clock_t clock_id". This is nonsense, since clock ids aren't clock ticks. POSIX specifies correct declarations "clockid_t * restrict clock_id" and "clockid_t clock_id". matches POSIX except it doesn't say "restrict". The man page is missing pthread_getcpuclockid() but has the other 2 (with type errors). >>> Copied and modified: head/sys/x86/include/_types.h (from r232259, head/sys/amd64/include/_types.h) >>> ============================================================================== >>> --- head/sys/amd64/include/_types.h Tue Feb 28 15:52:01 2012 (r232259, copy source) >>> +++ head/sys/x86/include/_types.h Tue Feb 28 18:15:28 2012 (r232261) >>> @@ -54,19 +54,41 @@ typedef short __int16_t; >>> +#else >>> +#ifndef lint >>> +__extension__ >> >> An old bug -- work around broken lints. Although messy, this is not >> messy enough to be correct -- __extension__ is a hard-coded gccism. >> Elsewhere, in much less important code than this, there are messy >> ifdefs to avoid hard-coded gccisms. > > Maybe define __extension for lint and various compilers in cdefs.h? Wouldn't lint still trip over the actual extension? lint needs to understand __extension__ more than most gcc things so that we can kill its warnings for things that it is further from understanding. Hopefully this can be done less obtrusively than with ifdefs. >>> @@ -82,8 +105,18 @@ typedef __uint64_t __size_t; /* sizeof( >>> typedef __int64_t __ssize_t; /* byte count or error */ >>> typedef __int64_t __time_t; /* time()... */ >>> typedef __uint64_t __uintfptr_t; >>> -typedef __uint64_t __uintmax_t; >>> typedef __uint64_t __uintptr_t; >>> +#else >>> +typedef __int32_t __ptrdiff_t; >>> +typedef __int32_t __register_t; >>> +typedef __int32_t __segsz_t; >>> +typedef __uint32_t __size_t; >>> +typedef __int32_t __ssize_t; >>> +typedef __int32_t __time_t; >>> +typedef __uint32_t __uintfptr_t; >>> +typedef __uint32_t __uintptr_t; >>> +#endif >> >> [unsigned] long would work without ifdefs for all of these, since all >> these expanded naturally to the register width. Perhaps a better way, >> which also works for i386's with correctly-sized longs, is to define >> almost everything in terms of registers -- as __[u]register_t. > > register_t is a machine dependent type and the others are LP64/ILP32 > dependent, so they're not strictly related. MIPS N32 is an example of > that. It will work for most arches. It's only if you want to put everything in 1 "MI" types.h file that the details are hard to know. > As for using long, I'm not sure. It has the same size as int, but they > aren't the same in format strings. Yes, since these types escape to MI APIs, the longs give slightly larger problems for printf formats (you shouldn't print any foo_t using %d, but it mostly works for 32-bit types, and changing the basic type to long would break this). >>> +typedef __uint32_t __vm_paddr_t; >>> +#endif >>> +typedef __uint32_t __vm_size_t; >>> +#endif >>> +typedef __int64_t __vm_ooffset_t; >>> +typedef __uint64_t __vm_pindex_t; >> >> Similarly. The patch, and possibly the ifdefs, are hard to read here. >> There's a nested ifdef for PAE. PAE doesn't apply for amd64. The >> above assumes that the cases where it doesn't apply are classified >> by !_LP64. > > I'm not sure yet about what should happen with these vm types. I'm not > entirely convinced yet that all these "invisible" types are really > necessary at all. It's too late to change vm types. The distinction between addresses and sizes became useful first with file offsets (vm_ooffset_t. BTW, what is an o offset?) and then for physical offsets. >> Ideally, everything would be in directly. I don't know how >> to do it in a layer, but is it too much to ask for only 2 layers? >> Hmm, I do know how to do it in 1 layer -- flatten it at install time. >> Anyone who cared about efficiency and readability would do this :-). >> But I usually read the uninstalled sources. > > If you allow ifdef _LP64 in sys/stdint.h everything in machine/_stdint.h > could be moved there, except the sig_atomic_t limits which seems to be > another __clock_t case. Not sure I like the former. The current definitions for sig_atomic_t seem to be weird only for arm (it is long there, but int for all other 32-bit arches including for the 64 bit half of 32/64-bit ones). I don't like 64 bits or even 32 bits for it. Strictly, a signal handler cannot touch any global variable except to write to a a sig_atomic_t one. And sig_atomic_t might be 8 bits. So portable code can't do much more than set a single bit in a sig_atomic_t. So sig_atomic_t might as well be 8 bits if this is atomic. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 05:16:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 886801065670; Fri, 2 Mar 2012 05:16:54 +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 77F708FC1D; Fri, 2 Mar 2012 05:16:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q225GsSg014844; Fri, 2 Mar 2012 05:16:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q225GsZD014842; Fri, 2 Mar 2012 05:16:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203020516.q225GsZD014842@svn.freebsd.org> From: Alexander Motin Date: Fri, 2 Mar 2012 05:16: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: r232376 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 05:16:54 -0000 Author: mav Date: Fri Mar 2 05:16:53 2012 New Revision: 232376 URL: http://svn.freebsd.org/changeset/base/232376 Log: Add ahci(4) and siis(4) to the hardware notes. MFC after: 1 week Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Fri Mar 2 03:11:53 2012 (r232375) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Fri Mar 2 05:16:53 2012 (r232376) @@ -748,6 +748,8 @@ &hwlist.ahc; + &hwlist.ahci; + &hwlist.ahd; &hwlist.aic; @@ -818,6 +820,8 @@ &hwlist.pst; + &hwlist.siis; + &hwlist.stg; &hwlist.sym; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 05:55:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A09D31065674; Fri, 2 Mar 2012 05:55:45 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E1EC8FC14; Fri, 2 Mar 2012 05:55:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q225tjOF015987; Fri, 2 Mar 2012 05:55:45 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q225tjlf015984; Fri, 2 Mar 2012 05:55:45 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203020555.q225tjlf015984@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 2 Mar 2012 05:55: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: r232377 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 05:55:45 -0000 Author: pluknet Date: Fri Mar 2 05:55:45 2012 New Revision: 232377 URL: http://svn.freebsd.org/changeset/base/232377 Log: Kill EoL whitespaces, and minor lint. Modified: head/lib/libpmc/pmc.sandybridge.3 head/lib/libpmc/pmc.sandybridgeuc.3 Modified: head/lib/libpmc/pmc.sandybridge.3 ============================================================================== --- head/lib/libpmc/pmc.sandybridge.3 Fri Mar 2 05:16:53 2012 (r232376) +++ head/lib/libpmc/pmc.sandybridge.3 Fri Mar 2 05:55:45 2012 (r232377) @@ -25,11 +25,11 @@ .\" $FreeBSD$ .\" .Dd February 12, 2012 -.Dt PMC.SANDYBRIDGE 3 -.Os +.Dt PMC.SANDYBRIDGE 3 +.Os .Sh NAME .Nm pmc.sandybridge -.Nd measurement events for +.Nd measurement events for .Tn Intel .Tn Sandy Bridge family CPUs @@ -56,10 +56,10 @@ These PMCs are documented in .El .Pp The number of PMCs available in each class and their widths need to be -determined at run time by calling +determined at run time by calling .Xr pmc_cpuinfo 3 . .Pp -Intel Sandy Bridge PMCs are documented in +Intel Sandy Bridge PMCs are documented in .Rs .%B "Intel(R) 64 and IA-32 Architectures Software Developers Manual" .%T "Volume 3B: System Programming Guide, Part 2" @@ -75,7 +75,7 @@ The programmable PMCs support the follow .Bl -column "PMC_CAP_INTERRUPT" "Support" .It Em Capability Ta Em Support .It PMC_CAP_CASCADE Ta \&No -.It PMC_CAP_EDGE Ta Yes +.It PMC_CAP_EDGE Ta Yes .It PMC_CAP_INTERRUPT Ta Yes .It PMC_CAP_INVERT Ta Yes .It PMC_CAP_READ Ta Yes @@ -96,15 +96,15 @@ Configure the Off-core Response bits. .It Li DMND_DATA_RD Counts the number of demand and DCU prefetch data reads of full and partial cachelines as well as demand data page table entry -cacheline reads. +cacheline reads. Does not count L2 data read prefetches or instruction fetches. .It Li DMND_RFO Counts the number of demand and DCU prefetch reads for ownership -(RFO) requests generated by a write to data cacheline. +(RFO) requests generated by a write to data cacheline. Does not count L2 RFO. .It Li DMND_IFETCH Counts the number of demand and DCU prefetch instruction cacheline -reads. +reads. Does not count L2 code read prefetches. .It Li WB Counts the number of writeback (modified to exclusive) transactions. @@ -132,7 +132,7 @@ copies were found (HITM). .It Li REMOTE_CACHE_FWD L3 Miss: local homed requests that missed the L3 cache and was serviced by forwarded data following a cross package snoop where no modified -copies found. +copies found. (Remote home requests are not counted) .It Li REMOTE_DRAM L3 Miss: remote home requests that missed the L3 cache and were serviced @@ -177,276 +177,276 @@ qualifiers are specified, the default is Sandy Bridge programmable PMCs support the following events: .Bl -tag -width indent .It Li LD_BLOCKS.DATA_UNKNOWN -.Pq EVENT_03H, Umask 01H +.Pq EVENT_03H, Umask 01H Blocked loads due to store buffer blocks with unknown data. .It Li LD_BLOCKS.STORE_FORWARD -.Pq Event 03H, Umask 02H +.Pq Event 03H, Umask 02H Loads blocked by overlapping with store buffer that cannot be forwarded. .It Li LD_BLOCKS.NO_SR -.Pq Event 03H, Umask 08H +.Pq Event 03H, Umask 08H # of Split loads blocked due to resource not available. -.It Li LD_BLOCKS.ALL_BLOCK -.Pq EVENT_03H, Umask 10H +.It Li LD_BLOCKS.ALL_BLOCK +.Pq EVENT_03H, Umask 10H Number of cases where any load is blocked but has no DCU miss. -.It Li MISALIGN_MEM_REF.LOADS -.Pq Event 05H, Umask 01H +.It Li MISALIGN_MEM_REF.LOADS +.Pq Event 05H, Umask 01H Speculative cache-line split load uops dispatched to L1D. .It Li MISALIGN_MEM_REF.STORES -.Pq Event 05H, Umask 02H +.Pq Event 05H, Umask 02H Speculative cache-line split Store-address uops dispatched to L1D. .It Li LD_BLOCKS_PARTIAL.ADDRESS_ALIAS -.Pq Event 07H, Umask 01H +.Pq Event 07H, Umask 01H False dependencies in MOB due to partial compare on address. -.It Li LD_BLOCKS_PARTIAL.ALL_STA_BLOCK -.Pq Event 07H, Umask 08H -The number of times that load operations are temporarily blocked because of -older stores, with addresses that are not yet known. +.It Li LD_BLOCKS_PARTIAL.ALL_STA_BLOCK +.Pq Event 07H, Umask 08H +The number of times that load operations are temporarily blocked because of +older stores, with addresses that are not yet known. A load operation may incur more than one block of this type. .It LI DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK -.Pq Event 08H, Umask 01H +.Pq Event 08H, Umask 01H Misses in all TLB levels that cause a page walk of any page size. -.It Li DTLB_LOAD_MISSES.WALK_COMPLETED -.Pq Event 08H, Umask 02H +.It Li DTLB_LOAD_MISSES.WALK_COMPLETED +.Pq Event 08H, Umask 02H Misses in all TLB levels that caused page walk completed of any size. -.It Li DTLB_LOAD_MISSES.WALK_DURATION -.Pq Event 08H, Umask 04H +.It Li DTLB_LOAD_MISSES.WALK_DURATION +.Pq Event 08H, Umask 04H Cycle PMH is busy with a walk. .It Li DTLB_LOAD_MISSES.STLB_HIT -.Pq Event 08H, Umask 10H -Number of cache load STLB hits. +.Pq Event 08H, Umask 10H +Number of cache load STLB hits. No page walk. -.It Li INT_MISC.RECOVERY_CYCLES -.Pq Event 0DH, Umask 03H -Cycles waiting to recover after Machine Clears or JEClear. +.It Li INT_MISC.RECOVERY_CYCLES +.Pq Event 0DH, Umask 03H +Cycles waiting to recover after Machine Clears or JEClear. Set Cmask = 1. Set Edge to count occurrences -.It Li INT_MISC.RAT_STALL_CYCLES -.Pq Event 0DH, Umask 40H +.It Li INT_MISC.RAT_STALL_CYCLES +.Pq Event 0DH, Umask 40H Cycles RAT external stall is sent to IDQ for this thread. .It Li UOPS_ISSUED.ANY -.Pq Event 0EH, Umask 01H -Increments each cycle the # of Uops issued by the RAT to RS. +.Pq Event 0EH, Umask 01H +Increments each cycle the # of Uops issued by the RAT to RS. Set Cmask = 1, Inv = 1, Any= 1 to count stalled cycles of this core. Set Cmask = 1, Inv = 1 to count stalled cycles -.It Li FP_COMP_OPS_EXE.X87 -.Pq Event 10H, Umask 01H +.It Li FP_COMP_OPS_EXE.X87 +.Pq Event 10H, Umask 01H Counts number of X87 uops executed. -.It Li FP_COMP_OPS_EXE.SSE_FP_PACKED_DOUBLE -.Pq Event 10H, Umask 10H +.It Li FP_COMP_OPS_EXE.SSE_FP_PACKED_DOUBLE +.Pq Event 10H, Umask 10H Counts number of SSE* double precision FP packed uops executed. .It Li FP_COMP_OPS_EXE.SSE_FP_SCALAR_SINGLE -.Pq Event 10H, Umask 20H +.Pq Event 10H, Umask 20H Counts number of SSE* single precision FP scalar uops executed. .It Li FP_COMP_OPS_EXE.SSE_PACKED_SINGLE .Pq Event 10H, Umask 40H Counts number of SSE* single precision FP packed uops executed. -.It LiFP_COMP_OPS_EXE.SSE_SCALAR_DOUBLE +.It LiFP_COMP_OPS_EXE.SSE_SCALAR_DOUBLE .Pq Event 10H, Umask 80H Counts number of SSE* double precision FP scalar uops executed. .It Li SIMD_FP_256.PACKED_SINGLE -.Pq Event 11H, Umask 01H +.Pq Event 11H, Umask 01H Counts 256-bit packed single-precision floating-point instructions. .It Li SIMD_FP_256.PACKED_DOUBLE .Pq Event 11H, Umask 02H Counts 256-bit packed double-precision floating-point instructions. .It Li ARITH.FPU_DIV_ACTIVE -.Pq Event 14H, Umask 01H +.Pq Event 14H, Umask 01H Cycles that the divider is active, includes INT and FP. Set 'edge =1, cmask=1' to count the number of divides. -.It Li INSTS_WRITTEN_TO_IQ.INSTS -.Pq Event 17H, Umask 01H +.It Li INSTS_WRITTEN_TO_IQ.INSTS +.Pq Event 17H, Umask 01H Counts the number of instructions written into the IQ every cycle. -.It Li L2_RQSTS.DEMAND_DATA_RD_HIT -.Pq Event 24H, Umask 01H +.It Li L2_RQSTS.DEMAND_DATA_RD_HIT +.Pq Event 24H, Umask 01H Demand Data Read requests that hit L2 cache. .It Li L2_RQSTS.ALL_DEMAND_DATA_RD -.Pq Event 24H, Umask 03H +.Pq Event 24H, Umask 03H Counts any demand and L1 HW prefetch data load requests to L2. .It Li L2_RQSTS.RFO_HITS .Pq Event 24H, Umask 04H Counts the number of store RFO requests that hit the L2 cache. -.It Li L2_RQSTS.RFO_MISS +.It Li L2_RQSTS.RFO_MISS .Pq Event 24H, Umask 08H Counts the number of store RFO requests that miss the L2 cache. -.It Li L2_RQSTS.ALL_RFO -.Pq Event 24H, Umask 0CH +.It Li L2_RQSTS.ALL_RFO +.Pq Event 24H, Umask 0CH Counts all L2 store RFO requests. -.It Li L2_RQSTS.CODE_RD_HIT +.It Li L2_RQSTS.CODE_RD_HIT .Pq Event 24H, Umask 10H Number of instruction fetches that hit the L2 cache. -.It Li L2_RQSTS.CODE_RD_MISS +.It Li L2_RQSTS.CODE_RD_MISS .Pq Event 24H, Umask 20H Number of instruction fetches that missed the L2 cache. -.It Li L2_RQSTS.ALL_CODE_RD -.Pq Event 24H, Umask 30H +.It Li L2_RQSTS.ALL_CODE_RD +.Pq Event 24H, Umask 30H Counts all L2 code requests. -.It Li L2_RQSTS.PF_HIT -.Pq Event 24H, Umask 40H +.It Li L2_RQSTS.PF_HIT +.Pq Event 24H, Umask 40H Requests from L2 Hardware prefetcher that hit L2. -.It Li L2_RQSTS.PF_MISS +.It Li L2_RQSTS.PF_MISS .Pq Event 24H, Umask 80H Requests from L2 Hardware prefetcher that missed L2. -.It Li L2_RQSTS.ALL_PF +.It Li L2_RQSTS.ALL_PF .Pq Event 24H, Umask C0H Any requests from L2 Hardware prefetchers. -.It Li L2_STORE_LOCK_RQSTS.MISS -.Pq Event 27H, Umask 01H +.It Li L2_STORE_LOCK_RQSTS.MISS +.Pq Event 27H, Umask 01H RFOs that miss cache lines. -.It Li L2_STORE_LOCK_RQSTS.HIT_E -.Pq Event 27H, Umask 04H +.It Li L2_STORE_LOCK_RQSTS.HIT_E +.Pq Event 27H, Umask 04H RFOs that hit cache lines in E state. .It Li L2_STORE_LOCK_RQSTS.HIT_M .Pq EVENT_27H, Umask 08H RFOs that hit cache lines in M state. -.It Li L2_STORE_LOCK_RQSTS.ALL -.Pq EVENT_27H, Umask 0FH +.It Li L2_STORE_LOCK_RQSTS.ALL +.Pq EVENT_27H, Umask 0FH RFOs that access cache lines in any state. -.It Li L2_L1D_WB_RQSTS.HIT_E -.Pq Event 28H, Umask 04H +.It Li L2_L1D_WB_RQSTS.HIT_E +.Pq Event 28H, Umask 04H Not rejected writebacks from L1D to L2 cache lines in E state. -.It Li L2_L1D_WB_RQSTS.HIT_M -.Pq Event 28H, Umask 08H +.It Li L2_L1D_WB_RQSTS.HIT_M +.Pq Event 28H, Umask 08H Not rejected writebacks from L1D to L2 cache lines in M state. -.It Li LONGEST_LAT_CACHE.REFERENCE +.It Li LONGEST_LAT_CACHE.REFERENCE .Pq Event 2EH, Umask 4FH -This event counts requests originating from the core that reference a cache +This event counts requests originating from the core that reference a cache line in the last level cache. -.It Li LONGEST_LAT_CACHE.MISS -.Pq Event 2EH, Umask 41H -This event counts each cache miss condition for references to the last level +.It Li LONGEST_LAT_CACHE.MISS +.Pq Event 2EH, Umask 41H +This event counts each cache miss condition for references to the last level cache. -.It Li CPU_CLK_UNHALTED.THREAD_P -.Pq Event 3CH, Umask 00H -Counts the number of thread cycles while the thread is not in a halt state. -The thread enters the halt state when it is running the HLT instruction. -The core frequency may change from time to time due to power or thermal +.It Li CPU_CLK_UNHALTED.THREAD_P +.Pq Event 3CH, Umask 00H +Counts the number of thread cycles while the thread is not in a halt state. +The thread enters the halt state when it is running the HLT instruction. +The core frequency may change from time to time due to power or thermal throttling. -.It Li CPU_CLK_THREAD_UNHALTED.REF_XCLK -.Pq Event 3CH, Umask 01H +.It Li CPU_CLK_THREAD_UNHALTED.REF_XCLK +.Pq Event 3CH, Umask 01H Increments at the frequency of XCLK (100 MHz) when not halted. -.It Li L1D_PEND_MISS.PENDING -.Pq Event 48H, Umask 01H -Increments the number of outstanding L1D misses every cycle. +.It Li L1D_PEND_MISS.PENDING +.Pq Event 48H, Umask 01H +Increments the number of outstanding L1D misses every cycle. Set Cmask = 1 and Edge =1 to count occurrences. Counter 2 only; Set Cmask = 1 to count cycles. -.It Li DTLB_STORE_MISSES.MISS_CAUSES_A_WALK -.Pq Event 49H, Umask 01H Miss in all TLB levels causes an page walk of any +.It Li DTLB_STORE_MISSES.MISS_CAUSES_A_WALK +.Pq Event 49H, Umask 01H Miss in all TLB levels causes an page walk of any page size (4K/2M/4M/1G). -.It Li DTLB_STORE_MISSES.WALK_COMPLETED -.Pq Event 49H, Umask 02H -Miss in all TLB levels causes a page walk that completes of any page size +.It Li DTLB_STORE_MISSES.WALK_COMPLETED +.Pq Event 49H, Umask 02H +Miss in all TLB levels causes a page walk that completes of any page size (4K/2M/4M/1G). -.It Li DTLB_STORE_MISSES.WALK_DURATION -.Pq Event 49H, Umask 04H +.It Li DTLB_STORE_MISSES.WALK_DURATION +.Pq Event 49H, Umask 04H Cycles PMH is busy with this walk. -.It Li DTLB_STORE_MISSES.STLB_HIT -.Pq Event 49H, Umask 10H -Store operations that miss the first TLB level but hit the second and do not +.It Li DTLB_STORE_MISSES.STLB_HIT +.Pq Event 49H, Umask 10H +Store operations that miss the first TLB level but hit the second and do not cause page walks. -.It Li LOAD_HIT_PRE.SW_PF -.Pq Event 4CH, Umask 01H +.It Li LOAD_HIT_PRE.SW_PF +.Pq Event 4CH, Umask 01H Not SW-prefetch load dispatches that hit fill buffer allocated for S/W prefetch. -.It Li LOAD_HIT_PER.HW_PF -.Pq Event 4CH, Umask 02H +.It Li LOAD_HIT_PER.HW_PF +.Pq Event 4CH, Umask 02H Not SW-prefetch load dispatches that hit fill buffer allocated for H/W prefetch. -.It Li HW_PRE_REQ.DL1_MISS -.Pq Event 4EH, Umask 02H -Hardware Prefetch requests that miss the L1D cache. -A request is being counted each time it access the cache & miss it, including +.It Li HW_PRE_REQ.DL1_MISS +.Pq Event 4EH, Umask 02H +Hardware Prefetch requests that miss the L1D cache. +A request is being counted each time it access the cache & miss it, including if a block is applicable or if hit the Fill Buffer for example. This accounts for both L1 streamer and IP-based (IPP) HW prefetchers. -.It Li L1D.REPLACEMENT +.It Li L1D.REPLACEMENT .Pq Event 51H, Umask 01H Counts the number of lines brought into the L1 data cache. -.It Li L1D.ALLOCATED_IN_M -.Pq Event 51H, Umask 02H +.It Li L1D.ALLOCATED_IN_M +.Pq Event 51H, Umask 02H Counts the number of allocations of modified L1D cache lines. .It Li L1D.EVICTION .Pq Event 51H, Umask 04H -Counts the number of modified lines evicted from the L1 data cache due to +Counts the number of modified lines evicted from the L1 data cache due to replacement. .It Li L1D.ALL_M_REPLACEMENT -.Pq Event 51H, Umask 08H -Cache lines in M state evicted out of L1D due to Snoop HitM or dirty line +.Pq Event 51H, Umask 08H +Cache lines in M state evicted out of L1D due to Snoop HitM or dirty line replacement. .It Li PARTIAL_RAT_STALLS.FLAGS_MERGE_UOP -.Pq Event 59H, Umask 20H +.Pq Event 59H, Umask 20H Increments the number of flags-merge uops in flight each cycle. Set Cmask = 1 to count cycles. .It Li PARTIAL_RAT_STALLS.SLOW_LEA_WINDOW -.Pq Event 59H, Umask 40H +.Pq Event 59H, Umask 40H Cycles with at least one slow LEA uop allocated. .It Li PARTIAL_RAT_STALLS.MUL_SINGLE_UOP -.Pq Event 59H, Umask 80H +.Pq Event 59H, Umask 80H Number of Multiply packed/scalar single precision uops allocated. -.It Li RESOURCE_STALLS2.ALL_FL_EMPTY -.Pq Event 5BH, Umask 0CH +.It Li RESOURCE_STALLS2.ALL_FL_EMPTY +.Pq Event 5BH, Umask 0CH Cycles stalled due to free list empty. -.It Li RESOURCE_STALLS2.ALL_PRF_CONTROL -.Pq Event 5BH, Umask 0FH +.It Li RESOURCE_STALLS2.ALL_PRF_CONTROL +.Pq Event 5BH, Umask 0FH Cycles stalled due to control structures full for physical registers. -.It Li RESOURCE_STALLS2.BOB_FULL -.Pq Event 5BH, Umask 40H +.It Li RESOURCE_STALLS2.BOB_FULL +.Pq Event 5BH, Umask 40H Cycles Allocator is stalled due to Branch Order Buffer. .It Li RESOURCE_STALLS2.OOO_RSRC -.Pq Event 5BH, Umask 4FH +.Pq Event 5BH, Umask 4FH Cycles stalled due to out of order resources full. .It Li CPL_CYCLES.RING0 -.Pq Event 5CH, Umask 01H +.Pq Event 5CH, Umask 01H Unhalted core cycles when the thread is in ring 0. Use Edge to count transition .It Li CPL_CYCLES.RING123 .Pq Event 5CH, Umask 02H Unhalted core cycles when the thread is not in ring 0. .It Li RS_EVENTS.EMPTY_CYCLES -.Pq Event 5EH, Umask 01H +.Pq Event 5EH, Umask 01H Cycles the RS is empty for the thread. .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD -.Pq Event 60H, Umask 01H +.Pq Event 60H, Umask 01H Offcore outstanding Demand Data Read transactions in SQ to uncore. Set Cmask=1 to count cycles. .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO -.Pq Event 60H, Umask 04H +.Pq Event 60H, Umask 04H Offcore outstanding RFO store transactions in SQ to uncore. Set Cmask=1 to count cycles. .It Li OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD -.Pq Event 60H, Umask 08H +.Pq Event 60H, Umask 08H Offcore outstanding cacheable data read transactions in SQ to uncore. Set Cmask=1 to count cycles. .It Li LOCK_CYCLES.SPLIT_LOCK_UC_LOCK_DURATION -.Pq Event 63H, Umask 01H +.Pq Event 63H, Umask 01H Cycles in which the L1D and L2 are locked, due to a UC lock or split lock. .It Li LOCK_CYCLES.CACHE_LOCK_DURATION .Pq Event 63H, Umask 02H Cycles in which the L1D is locked. .It Li IDQ.EMPTY -.Pq Event 79H, Umask 02H +.Pq Event 79H, Umask 02H Counts cycles the IDQ is empty. -.It Li IQD.MITE_UOPS -.Pq Event 79H, Umask 04H -Increment each cycle # of uops delivered to IDQ from MITE path. +.It Li IQD.MITE_UOPS +.Pq Event 79H, Umask 04H +Increment each cycle # of uops delivered to IDQ from MITE path. Set Cmask = 1 to count cycles. Can combine Umask 04H and 20H .It Li IDQ.DSB_UOPS -.Pq Event 79H, Umask 08H -Increment each cycle. -# of uops delivered to IDQ from DSB path. +.Pq Event 79H, Umask 08H +Increment each cycle. +# of uops delivered to IDQ from DSB path. Set Cmask = 1 to count cycles. Can combine Umask 08H and 10H -.It Li IDQ.MS_DSB_UOPS -.Pq Event 79H, Umask 10H -Increment each cycle # of uops delivered to IDQ when MS busy by DSB. -Set Cmask = 1 to count cycles MS is busy. +.It Li IDQ.MS_DSB_UOPS +.Pq Event 79H, Umask 10H +Increment each cycle # of uops delivered to IDQ when MS busy by DSB. +Set Cmask = 1 to count cycles MS is busy. Set Cmask=1 and Edge=1 to count MS activations. Can combine Umask 08H and 10H .It Li IDQ.MS_MITE_UOPS -.Pq Event 79H, Umask 20H -Increment each cycle # of uops delivered to IDQ when MS is busy by MITE. +.Pq Event 79H, Umask 20H +Increment each cycle # of uops delivered to IDQ when MS is busy by MITE. Set Cmask = 1 to count cycles. Can combine Umask 04H and 20H -.It Li IDQ.MS_UOPS -.Pq Event 79H, Umask 30H -Increment each cycle # of uops delivered to IDQ from MS by either DSB or MITE. +.It Li IDQ.MS_UOPS +.Pq Event 79H, Umask 30H +Increment each cycle # of uops delivered to IDQ from MS by either DSB or MITE. Set Cmask = 1 to count cycles. Can combine Umask 04H, 08H and 30H .It Li ICACHE.MISSES @@ -457,38 +457,38 @@ Includes UC accesses. .Pq Event 85H, Umask 01H Misses in all ITLB levels that cause page walks. .It Li ITLB_MISSES.WALK_COMPLETED -.Pq Event 85H, Umask 02H +.Pq Event 85H, Umask 02H Misses in all ITLB levels that cause completed page walks. -.It Li ITLB_MISSES.WALK_DURATION -.Pq Event 85H, Umask 04H +.It Li ITLB_MISSES.WALK_DURATION +.Pq Event 85H, Umask 04H Cycle PMH is busy with a walk. .It Li ITLB_MISSES.STLB_HIT -.Pq Event 85H, Umask 10H -Number of cache load STLB hits. +.Pq Event 85H, Umask 10H +Number of cache load STLB hits. No page walk. .It Li ILD_STALL.LCP -.Pq Event 87H, Umask 01H +.Pq Event 87H, Umask 01H Stalls caused by changing prefix length of the instruction. .It Li ILD_STALL.IQ_FULL -.Pq Event 87H, Umask 04H +.Pq Event 87H, Umask 04H Stall cycles due to IQ is full. .It Li BR_INST_EXEC.COND -.Pq Event 88H, Umask 01H -Qualify conditional near branch instructions executed, but not necessarily +.Pq Event 88H, Umask 01H +Qualify conditional near branch instructions executed, but not necessarily retired. Must combine with umask 40H, 80H -.It Li BR_INST_EXEC.DIRECT_JMP -.Pq Event 88H, Umask 02H -Qualify all unconditional near branch instructions excluding calls and indirect +.It Li BR_INST_EXEC.DIRECT_JMP +.Pq Event 88H, Umask 02H +Qualify all unconditional near branch instructions excluding calls and indirect branches. Must combine with umask 80H .It Li BR_INST_EXEC.INDIRECT_JMP_NON_CALL_RET -.Pq Event 88H, Umask 04H -Qualify executed indirect near branch instructions that are not calls nor +.Pq Event 88H, Umask 04H +Qualify executed indirect near branch instructions that are not calls nor returns. Must combine with umask 80H .It Li BR_INST_EXEC.RETURN_NEAR -.Pq Event 88H, Umask 08H +.Pq Event 88H, Umask 08H Qualify indirect near branches that have a return mnemonic. Must combine with umask 80H .It Li BR_INST_EXEC.DIRECT_NEAR_CALL @@ -497,49 +497,49 @@ Qualify unconditional near call branch i executed. Must combine with umask 80H .It Li BR_INST_EXEC.INDIRECT_NEAR_CALL -.Pq Event 88H, Umask 20H -Qualify indirect near calls, including both register and memory indirect, +.Pq Event 88H, Umask 20H +Qualify indirect near calls, including both register and memory indirect, executed. Must combine with umask 80H .It Li BR_INST_EXEC.NONTAKEN -.Pq Event 88H, Umask 40H +.Pq Event 88H, Umask 40H Qualify non-taken near branches executed. Applicable to umask 01H only .It Li BR_INST_EXEC.TAKEN -.Pq Event 88H, Umask 80H -Qualify taken near branches executed. +.Pq Event 88H, Umask 80H +Qualify taken near branches executed. Must combine with 01H,02H, 04H, 08H, 10H, 20H .It Li BR_INST_EXE.ALL_BRANCHES -.Pq Event 88H, Umask FFH +.Pq Event 88H, Umask FFH Counts all near executed branches (not necessarily retired). .It Li BR_MISP_EXEC.COND -.Pq Event 89H, Umask 01H -Qualify conditional near branch instructions mispredicted. +.Pq Event 89H, Umask 01H +Qualify conditional near branch instructions mispredicted. Must combine with umask 40H, 80H .It Li BR_MISP_EXEC.INDIRECT_JMP_NON_CALL_RET -.Pq Event 89H, Umask 04H -Qualify mispredicted indirect near branch instructions that are not calls nor +.Pq Event 89H, Umask 04H +Qualify mispredicted indirect near branch instructions that are not calls nor returns. Must combine with umask 80H -.It Li BR_MISP_EXEC.RETURN_NEAR -.Pq Event 89H, Umask 08H +.It Li BR_MISP_EXEC.RETURN_NEAR +.Pq Event 89H, Umask 08H Qualify mispredicted indirect near branches that have a return mnemonic. Must combine with umask 80H .It Li BR_MISP_EXEC.DIRECT_NEAR_CALL -.Pq Event 89H, Umask 10H -Qualify mispredicted unconditional near call branch instructions, excluding non +.Pq Event 89H, Umask 10H +Qualify mispredicted unconditional near call branch instructions, excluding non call branch, executed. Must combine with umask 80H .It Li BR_MISP_EXEC.INDIRECT_NEAR_CALL -.Pq Event 89H, Umask 20H -Qualify mispredicted indirect near calls, including both register and memory +.Pq Event 89H, Umask 20H +Qualify mispredicted indirect near calls, including both register and memory indirect, executed. Must combine with umask 80H .It Li BR_MISP_EXEC.NONTAKEN -.Pq Event 89H, Umask 40H +.Pq Event 89H, Umask 40H Qualify mispredicted non-taken near branches executed. Applicable to umask 01H only -.It Li BR_MISP_EXEC.TAKEN +.It Li BR_MISP_EXEC.TAKEN .Pq Event 89H, Umask 80H Qualify mispredicted taken near branches executed. Must combine with 01H,02H, 04H, 08H, 10H, 20H @@ -547,7 +547,7 @@ Must combine with 01H,02H, 04H, 08H, 10H .Pq Event 89H, Umask FFH Counts all near executed branches (not necessarily retired). .It Li IDQ_UOPS_NOT_DELIVERED.CORE -.Pq Event 9CH, Umask 01H +.Pq Event 9CH, Umask 01H Count number of non-delivered uops to RAT per thread. Use Cmask to qualify uop b/w .It Li UOPS_DISPATCHED_PORT.PORT_0 @@ -557,28 +557,28 @@ Cycles which a Uop is dispatched on port .Pq Event A1H, Umask 02H Cycles which a Uop is dispatched on port 1. .It Li UOPS_DISPATCHED_PORT.PORT_2_LD -.Pq Event A1H, Umask 04H +.Pq Event A1H, Umask 04H Cycles which a load uop is dispatched on port 2. .It Li UOPS_DISPATCHED_PORT.PORT_2_STA .Pq Event A1H, Umask 08H Cycles which a store address uop is dispatched on port 2. .It Li UOPS_DISPATCHED_PORT.PORT_2 -.Pq Event A1H, Umask 0CH +.Pq Event A1H, Umask 0CH Cycles which a Uop is dispatched on port 2. .It Li UOPS_DISPATCHED_PORT.PORT_3_LD -.Pq Event A1H, Umask 10H +.Pq Event A1H, Umask 10H Cycles which a load uop is dispatched on port 3. -.It Li UOPS_DISPATCHED_PORT.PORT_3_STA -.Pq Event A1H, Umask 20H +.It Li UOPS_DISPATCHED_PORT.PORT_3_STA +.Pq Event A1H, Umask 20H Cycles which a store address uop is dispatched on port 3. -.It Li UOPS_DISPATCHED_PORT.PORT_3 -.Pq Event A1H, Umask 30H +.It Li UOPS_DISPATCHED_PORT.PORT_3 +.Pq Event A1H, Umask 30H .Pq Cycles which a Uop is dispatched on port 3. -.It Li UOPS_DISPATCHED_PORT.PORT_4 +.It Li UOPS_DISPATCHED_PORT.PORT_4 .Pq Event A1H, Umask 40H Cycles which a Uop is dispatched on port 4. .It Li UOPS_DISPATCHED_PORT.PORT_5 -.Pq Event A1H, Umask 80H +.Pq Event A1H, Umask 80H Cycles which a Uop is dispatched on port 5. .It Li RESOURCE_STALLS.ANY .Pq Event A2H, Umask 01H @@ -587,30 +587,30 @@ Cycles Allocation is stalled due to Reso .Pq Event A2H, Umask 02H Counts the cycles of stall due to lack of load buffers. .It Li RESOURCE_STALLS.LB -.Pq Event A2H, Umask 04H +.Pq Event A2H, Umask 04H Cycles stalled due to no eligible RS entry available. .It Li RESOURCE_STALLS.SB -.Pq Event A2H, Umask 08H -Cycles stalled due to no store buffers available. +.Pq Event A2H, Umask 08H +Cycles stalled due to no store buffers available. (not including draining form sync) .It Li RESOURCE_STALLS.ROB .Pq Event A2H, Umask 10H Cycles stalled due to re-order buffer full. .It Li RESOURCE_STALLS.FCSW -.Pq Event A2H, Umask 20H +.Pq Event A2H, Umask 20H Cycles stalled due to writing the FPU control word. .It Li RESOURCE_STALLS.MXCSR .Pq Event A2H, Umask 40H -Cycles stalled due to the MXCSR register rename occurring to close to a previous +Cycles stalled due to the MXCSR register rename occurring to close to a previous MXCSR rename. .It Li RESOURCE_STALLS.OTHER -.Pq Event A2H, Umask 80H +.Pq Event A2H, Umask 80H Cycles stalled while execution was stalled due to other resource issues. .It Li DSB2MITE_SWITCHES.COUNT .Pq Event ABH, Umask 01H Number of DSB to MITE switches. .It Li DSB2MITE_SWITCHES.PENALTY_CYCLES -.Pq Event ABH, Umask 02H +.Pq Event ABH, Umask 02H Cycles DSB to MITE switches caused delay. .It Li DSB_FILL.OTHER_CANCEL .Pq Event ACH, Umask 02H @@ -619,43 +619,43 @@ Cases of cancelling valid DSB fill not b .Pq Event ACH, Umask 08H DSB Fill encountered > 3 DSB lines. .It Li DSB_FILL.ALL_CANCEL -.Pq Event ACH, Umask 0AH -Cases of cancelling valid Decode Stream Buffer (DSB) fill not because of exceeding +.Pq Event ACH, Umask 0AH +Cases of cancelling valid Decode Stream Buffer (DSB) fill not because of exceeding way limit. .It Li ITLB.ITLB_FLUSH .Pq Event AEH, Umask 01H Counts the number of ITLB flushes, includes 4k/2M/4M pages. .It Li OFFCORE_REQUESTS.DEMAND_DATA_RD -.Pq Event B0H, Umask 01H +.Pq Event B0H, Umask 01H Demand data read requests sent to uncore. -.It Li OFFCORE_REQUESTS.DEMAND_RFO -.Pq Event B0H, Umask 04H +.It Li OFFCORE_REQUESTS.DEMAND_RFO +.Pq Event B0H, Umask 04H Demand RFO read requests sent to uncore, including regular RFOs, locks, ItoM. .It Li OFFCORE_REQUESTS.ALL_DATA_RD -.Pq Event B0H, Umask 08H +.Pq Event B0H, Umask 08H Data read requests sent to uncore (demand and prefetch). .It Li UOPS_DISPATCHED.THREAD -.Pq Event B1H, Umask 01H +.Pq Event B1H, Umask 01H Counts total number of uops to be dispatched per-thread each cycle. Set Cmask = 1, INV =1 to count stall cycles. .It Li UOPS_DISPATCHED.CORE -.Pq Event B1H, Umask 02H +.Pq Event B1H, Umask 02H Counts total number of uops to be dispatched per-core each cycle. Do not need to set ANY .It Li OFFCORE_REQUESTS_BUFFER.SQ_FULL -.Pq Event B2H, Umask 01H +.Pq Event B2H, Umask 01H Offcore requests buffer cannot take more entries for this thread core. .It Li AGU_BYPASS_CANCEL.COUNT -.Pq Event B6H, Umask 01H -Counts executed load operations with all the following traits: 1. addressing -of the format [base + offset], 2. the offset is between 1 and 2047, 3. the -address specified in the base register is in one page and the address +.Pq Event B6H, Umask 01H +Counts executed load operations with all the following traits: 1. addressing +of the format [base + offset], 2. the offset is between 1 and 2047, 3. the +address specified in the base register is in one page and the address [base+offset] is in another page. -.It Li OFF_CORE_RESPONSE_0 +.It Li OFF_CORE_RESPONSE_0 .Pq Event B7H, Umask 01H Off-core Response Performance Monitoring; PMC0 only. Requires programming MSR 01A6H -.It Li OFF_CORE_RESPONSE_1 +.It Li OFF_CORE_RESPONSE_1 .Pq Event BBH, Umask 01H Off-core Response Performance Monitoring. PMC3 only. Requires programming MSR 01A7H @@ -663,96 +663,96 @@ Requires programming MSR 01A7H .Pq Event BDH, Umask 01H DTLB flush attempts of the thread-specific entries. .It Li TLB_FLUSH.STLB_ANY -.Pq Event BDH, Umask 20H +.Pq Event BDH, Umask 20H Count number of STLB flush attempts. .It Li L1D_BLOCKS.BANK_CONFLICT_CYCLES -.Pq Event BFH, Umask 05H +.Pq Event BFH, Umask 05H Cycles when dispatched loads are cancelled due to L1D bank conflicts with other load ports. cmask=1 .It Li INST_RETIRED.ANY_P -.Pq Event C0H, Umask 00H +.Pq Event C0H, Umask 00H Number of instructions at retirement. .It Li INST_RETIRED.PREC_DIST .Pq Event C0H, Umask 01H -Precise instruction retired event with HW to reduce effect of PEBS shadow in IP +Precise instruction retired event with HW to reduce effect of PEBS shadow in IP distribution PMC1 only; Must quiesce other PMCs. .It Li INST_RETIRED.X87 -.Pq Event C0H, Umask 02H +.Pq Event C0H, Umask 02H X87 instruction retired event. .It Li OTHER_ASSISTS.ITLB_MISS_RETIRED -.Pq Event C1H, Umask 02H +.Pq Event C1H, Umask 02H Instructions that experienced an ITLB miss. .It Li OTHER_ASSISTS.AVX_STORE -.Pq Event C1H, Umask 08H +.Pq Event C1H, Umask 08H Number of assists associated with 256-bit AVX store operations. .It Li OTHER_ASSISTS.AVX_TO_SSE -.Pq Event C1H, Umask 10H +.Pq Event C1H, Umask 10H Number of transitions from AVX256 to legacy SSE when penalty applicable. .It Li OTHER_ASSISTS.SSE_TO_AVX -.Pq Event C1H, Umask 20H +.Pq Event C1H, Umask 20H Number of transitions from SSE to AVX-256 when penalty applicable. .It Li UOPS_RETIRED.ALL -.Pq Event C2H, Umask 01H +.Pq Event C2H, Umask 01H Counts the number of micro-ops retired. Use cmask=1 and invert to count active cycles or stalled cycles. .It Li UOPS_RETIRED.RETIRE_SLOTS -.Pq Event C2H, Umask 02H +.Pq Event C2H, Umask 02H Counts the number of retirement slots used each cycle. .It Li MACHINE_CLEARS.MEMORY_ORDERING -.Pq Event C3H, Umask 02H +.Pq Event C3H, Umask 02H Counts the number of machine clears due to memory order conflicts. -.It Li MACHINE_CLEARS.SMC +.It Li MACHINE_CLEARS.SMC .Pq Event C3H, Umask 04H Counts the number of times that a program writes to a code section. .It Li MACHINE_CLEARS.MASKMOV .Pq Event C3H, Umask 20H -Counts the number of executed AVX masked load operations that refer to an +Counts the number of executed AVX masked load operations that refer to an illegal address range with the mask bits set to 0. .It Li BR_INST_RETIRED.ALL_BRANCH .Pq Event C4H, Umask 00H Branch instructions at retirement. .It Li BR_INST_RETIRED.CONDITIONAL -.Pq Event C4H, Umask 01H +.Pq Event C4H, Umask 01H Counts the number of conditional branch instructions retired. .It Li BR_INST_RETIRED.NEAR_CALL -.Pq Event C4H, Umask 02H +.Pq Event C4H, Umask 02H Direct and indirect near call instructions retired. .It Li BR_INST_RETIRED.ALL_BRANCHES .Pq Event C4H, Umask 04H Counts the number of branch instructions retired. .It Li BR_INST_RETIRED.NEAR_RETURN -.Pq Event C4H, Umask 08H +.Pq Event C4H, Umask 08H Counts the number of near return instructions retired. .It Li BR_INST_RETIRED.NOT_TAKEN -.Pq Event C4H, Umask 10H +.Pq Event C4H, Umask 10H Counts the number of not taken branch instructions retired. .It Li BR_INST_RETIRED.NEAR_TAKEN -.Pq Event C4H, Umask 20H +.Pq Event C4H, Umask 20H Number of near taken branches retired. .It Li BR_INST_RETIRED.FAR_BRANCH -.Pq Event C4H, Umask 40H +.Pq Event C4H, Umask 40H Number of far branches retired. .It Li BR_MISP_RETIRED.ALL_BRANCHES -.Pq Event C5H, Umask 00H +.Pq Event C5H, Umask 00H Mispredicted branch instructions at retirement. .It Li BR_MISP_RETIRED.CONDITIONAL -.Pq Event C5H, Umask 01H +.Pq Event C5H, Umask 01H Mispredicted conditional branch instructions retired. .It Li BR_MISP_RETIRED.NEAR_CALL -.Pq Event C5H, Umask 02H +.Pq Event C5H, Umask 02H Direct and indirect mispredicted near call instructions retired. .It Li BR_MISP_RETIRED.ALL_BRANCH -.Pq Event C5H, Umask 04H +.Pq Event C5H, Umask 04H Mispredicted macro branch instructions retired. .It Li BR_MISP_RETIRED.NOT_TAKEN -.Pq Event C5H, Umask 10H +.Pq Event C5H, Umask 10H Mispredicted not taken branch instructions retired. .It Li BR_MISP_RETIRED.TAKEN -.Pq Event C5H, Umask 20H +.Pq Event C5H, Umask 20H Mispredicted taken branch instructions retired. .It Li FP_ASSIST.X87_OUTPUT -.Pq Event CAH, Umask 02H +.Pq Event CAH, Umask 02H Number of X87 assists due to output value. .It Li FP_ASSIST.X87_INPUT .Pq Event CAH, Umask 04H @@ -761,30 +761,30 @@ Number of X87 assists due to input value .Pq Event CAH, Umask 08H Number of SIMD FP assists due to Output values. .It Li FP_ASSIST.SIMD_INPUT -.Pq Event CAH, Umask 10H +.Pq Event CAH, Umask 10H Number of SIMD FP assists due to input values. .It Li FP_ASSIST.ANY -.Pq Event CAH, Umask 1EH +.Pq Event CAH, Umask 1EH Cycles with any input/output SSE* or FP assists. .It Li ROB_MISC_EVENTS.LBR_INSERTS -.Pq Event CCH, Umask 20H +.Pq Event CCH, Umask 20H Count cases of saving new LBR records by hardware. .It Li MEM_TRANS_RETIRED.LOAD_LATENCY .Pq Event CDH, Umask 01H -Sample loads with specified latency threshold. -PMC3 only. +Sample loads with specified latency threshold. +PMC3 only. Specify threshold in MSR 0x3F6. .It Li MEM_TRANS_RETIRED.PRECISE_STORE -.Pq Event CDH, Umask 02H -Sample stores and collect precise store operation via PEBS record. +.Pq Event CDH, Umask 02H +Sample stores and collect precise store operation via PEBS record. PMC3 only. .It Li MEM_UOP_RETIRED.LOADS .Pq Event D0H, Umask 01H -Qualify retired memory uops that are loads. +Qualify retired memory uops that are loads. Combine with umask 10H, 20H, 40H, 80H. .It Li MEM_UOP_RETIRED.STORES .Pq Event D0H, Umask 02H -Qualify retired memory uops that are stores. +Qualify retired memory uops that are stores. Combine with umask 10H, 20H, 40H, 80H. .It Li MEM_UOP_RETIRED.STLB_MISS .Pq Event D0H, Umask 10H @@ -797,101 +797,101 @@ Must combine with umask 01H, 02H, to pro .It Li MEM_UOP_RETIRED.SPLIT .Pq Event D0H, Umask 40H Qualify retired memory uops with line split. -Must combine with umask 01H, 02H, to produce counts. +Must combine with umask 01H, 02H, to produce counts. .It Li MEM_UOP_RETIRED_ALL -.Pq Event D0H, Umask 80H +.Pq Event D0H, Umask 80H Qualify any retired memory uops. Must combine with umask 01H, 02H, to produce counts. .It Li MEM_LOAD_UOPS_RETIRED.L1_HIT -.Pq Event D1H, Umask 01H +.Pq Event D1H, Umask 01H Retired load uops with L1 cache hits as data sources. Must combine with umask 01H, 02H, to produce counts. .It Li MEM_LOAD_UOPS_RETIRED.L2_HIT -.Pq Event D1H, Umask 02H +.Pq Event D1H, Umask 02H Retired load uops with L2 cache hits as data sources. .It Li MEM_LOAD_UOPS_RETIRED.LLC_HIT -.Pq Event D1H, Umask 04H -Retired load uops which data sources were data hits in LLC without snoops +.Pq Event D1H, Umask 04H +Retired load uops which data sources were data hits in LLC without snoops required. .It Li MEM_LOAD_UOPS_RETIRED.HIT_LFB -.Pq Event D1H, Umask 40H -Retired load uops which data sources were load uops missed L1 but hit FB due +.Pq Event D1H, Umask 40H +Retired load uops which data sources were load uops missed L1 but hit FB due to preceding miss to the same cache line with data not ready. .It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS -.Pq Event D2H, Umask 01H -Retired load uops which data sources were LLC hit and cross-core snoop missed in +.Pq Event D2H, Umask 01H +Retired load uops which data sources were LLC hit and cross-core snoop missed in on-pkg core cache. .It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT -.Pq Event D2H, Umask 02H -Retired load uops which data sources were LLC and cross-core snoop hits in +.Pq Event D2H, Umask 02H +Retired load uops which data sources were LLC and cross-core snoop hits in on-pkg core cache. .It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM -.Pq Event D2H, Umask 04H +.Pq Event D2H, Umask 04H Retired load uops which data sources were HitM responses from shared LLC. .It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE .Pq Event D2H, Umask 08H Retired load uops which data sources were hits in LLC without snoops required. .It Li MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS -.Pq Event D4H, Umask 02H +.Pq Event D4H, Umask 02H Retired load uops with unknown information as data source in cache serviced the load. .It Li L2_TRANS.DEMAND_DATA_RD -.Pq Event F0H, Umask 01H +.Pq Event F0H, Umask 01H Demand Data Read requests that access L2 cache. .It Li L2_TRANS.RF0 -.Pq Event F0H, Umask 02H +.Pq Event F0H, Umask 02H RFO requests that access L2 cache. .It Li L2_TRANS.CODE_RD -.Pq Event F0H, Umask 04H +.Pq Event F0H, Umask 04H L2 cache accesses when fetching instructions. .It Li L2_TRANS.ALL_PF -.Pq Event F0H, Umask 08H +.Pq Event F0H, Umask 08H L2 or LLC HW prefetches that access L2 cache. .It Li L2_TRANS.L1D_WB -.Pq Event F0H, Umask 10H +.Pq Event F0H, Umask 10H L1D writebacks that access L2 cache. .It Li L2_TRANS.L2_FILL -.Pq Event F0H, Umask 20H +.Pq Event F0H, Umask 20H L2 fill requests that access L2 cache. .It Li L2_TRANS.L2_WB -.Pq Event F0H, Umask 40H +.Pq Event F0H, Umask 40H L2 writebacks that access L2 cache. .It Li L2_TRANS.ALL_REQUESTS -.Pq Event F0H, Umask 80H +.Pq Event F0H, Umask 80H Transactions accessing L2 pipe. .It Li L2_LINES_IN.I .Pq Event F1H, Umask 01H -L2 cache lines in I state filling L2. +L2 cache lines in I state filling L2. Counting does not cover rejects. .It Li L2_LINES_IN.S -.Pq Event F1H, Umask 02H *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 06:26:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B9A31065672; Fri, 2 Mar 2012 06:26:44 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1D0588FC1D; Fri, 2 Mar 2012 06:26:42 +0000 (UTC) Received: by lagv3 with SMTP id v3so2283015lag.13 for ; Thu, 01 Mar 2012 22:26:41 -0800 (PST) Received-SPF: pass (google.com: domain of pluknet@gmail.com designates 10.112.29.6 as permitted sender) client-ip=10.112.29.6; Authentication-Results: mr.google.com; spf=pass (google.com: domain of pluknet@gmail.com designates 10.112.29.6 as permitted sender) smtp.mail=pluknet@gmail.com; dkim=pass header.i=pluknet@gmail.com Received: from mr.google.com ([10.112.29.6]) by 10.112.29.6 with SMTP id f6mr3824830lbh.69.1330669601788 (num_hops = 1); Thu, 01 Mar 2012 22:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rKJft/YQTOZh13QgG4Kr3PICnxF41QFd5CTf1TjwDHk=; b=SVXoYq0eYeRJ6aDXeezUiROxd4ODNTiSGG4LqPWTCFQ2u3YDbLSdR7DNL7XUhSTxVB 4GEAx7adhresrc6g0E8n8c7naoCoVt9C0baz4Uxao/qAklSzFaOBXES7Unr9xiBaehKt Z0wGWRG9B8flBrXyIwFtVJzI61NRn+Sqz9L/wfjIhS+TTKgdGQiTf2YsI73szfCJ5Ts6 Qz8h8sHxRHMA5OsDuWRKMa9WXpZ9XAkP+dELWuMD9bw954pM+ausYuDdDbg/9G9wVNrQ 57mst3rPXcxxvRm+RjCfFGJ6abeAoTjpVWBsEaB9C9Au7M+zf0EmKW3BSHwYHNfvvJ3J j3ZQ== MIME-Version: 1.0 Received: by 10.112.29.6 with SMTP id f6mr3138184lbh.69.1330669601693; Thu, 01 Mar 2012 22:26:41 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.152.108.204 with HTTP; Thu, 1 Mar 2012 22:26:41 -0800 (PST) In-Reply-To: <201203011439.q21Ed1oa083125@svn.freebsd.org> References: <201203011439.q21Ed1oa083125@svn.freebsd.org> Date: Fri, 2 Mar 2012 09:26:41 +0300 X-Google-Sender-Auth: kdFEE04G-xOoAF65I4pwiYmXnYw Message-ID: From: Sergey Kandaurov To: "Andrey V. Elsukov" 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: r232339 - head/lib/libc/uuid X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 06:26:44 -0000 On 1 March 2012 18:39, Andrey V. Elsukov wrote: > Author: ae > Date: Thu Mar =A01 14:39:01 2012 > New Revision: 232339 > URL: http://svn.freebsd.org/changeset/base/232339 > > Log: > =A0Note that memory should be freed after uuid_to_string(3) call. > > =A0MFC after: =A0 =A01 week PR: docs/161808 > > Modified: > =A0head/lib/libc/uuid/uuid.3 > > Modified: head/lib/libc/uuid/uuid.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/lib/libc/uuid/uuid.3 =A0 Thu Mar =A01 14:01:16 2012 =A0 =A0 =A0 = =A0(r232338) > +++ head/lib/libc/uuid/uuid.3 =A0 Thu Mar =A01 14:39:01 2012 =A0 =A0 =A0 = =A0(r232339) > @@ -25,7 +25,7 @@ > =A0.\" > =A0.\" $FreeBSD$ > =A0.\" > -.Dd August 13, 2008 > +.Dd March 1, 2012 > =A0.Dt UUID 3 > =A0.Os > =A0.Sh NAME > @@ -84,6 +84,15 @@ A 16-bit hash value can be obtained by c > =A0.Fn uuid_hash . > =A0.Pp > =A0The > +.Fn uuid_to_string > +function set > +.Fa *str > +to be a pointer to a buffer sufficiently large to hold the string. > +This pointer should be passed to > +.Xr free 3 > +to release the allocated storage when it is no longer needed. > +.Pp > +The > =A0.Fn uuid_enc_le > =A0and > =A0.Fn uuid_enc_be > @@ -116,7 +125,7 @@ The UUID does not have a known version. > =A0.It Dv uuid_s_invalid_string_uuid > =A0The string representation of an UUID is not valid. > =A0.It Dv uuid_s_no_memory > -The meaning of the code escaped the writers mind. > +The function can not allocate memory to store an UUID representation. > =A0.El > =A0.Sh SEE ALSO > =A0.Xr uuidgen 1 , --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 07:17:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3CB3106564A; Fri, 2 Mar 2012 07:17:22 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id A1C638FC08; Fri, 2 Mar 2012 07:17:22 +0000 (UTC) Received: from julian-mac.elischer.org (c-67-180-24-15.hsd1.ca.comcast.net [67.180.24.15]) (authenticated bits=0) by vps1.elischer.org (8.14.5/8.14.5) with ESMTP id q227HKPc002744 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 1 Mar 2012 23:17:21 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4F507405.5030901@freebsd.org> Date: Thu, 01 Mar 2012 23:17:25 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19 MIME-Version: 1.0 To: Bruce Evans References: <201202281815.q1SIFSbB082030@svn.freebsd.org> <20120229071721.G989@besplex.bde.org> <201203012346.00228.tijl@freebsd.org> <20120302151400.Y1224@besplex.bde.org> In-Reply-To: <20120302151400.Y1224@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Tijl Coosemans , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r232261 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 07:17:22 -0000 On 3/1/12 9:10 PM, Bruce Evans wrote: > > Grepping for clock_t shows some nice bugs in pthread_condattr(3). It > declares some parameters as "clock_t * restrict clock_id" and > "clock_t clock_id". This is nonsense, since clock ids aren't clock > ticks. POSIX specifies correct declarations "clockid_t * restrict > clock_id" and "clockid_t clock_id". matches POSIX > except it doesn't say "restrict". The man page is missing > pthread_getcpuclockid() but has the other 2 (with type errors). send patches to David Xu.. From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 07:22:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B296A1065686; Fri, 2 Mar 2012 07:22:04 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A26F98FC08; Fri, 2 Mar 2012 07:22:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q227M4EI018763; Fri, 2 Mar 2012 07:22:04 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q227M4r0018761; Fri, 2 Mar 2012 07:22:04 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201203020722.q227M4r0018761@svn.freebsd.org> From: Hiroki Sato Date: Fri, 2 Mar 2012 07:22: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: r232378 - head/sys/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: Fri, 02 Mar 2012 07:22:04 -0000 Author: hrs Date: Fri Mar 2 07:22:04 2012 New Revision: 232378 URL: http://svn.freebsd.org/changeset/base/232378 Log: Remove a redundant check. Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Fri Mar 2 05:55:45 2012 (r232377) +++ head/sys/netinet6/nd6.c Fri Mar 2 07:22:04 2012 (r232378) @@ -1345,16 +1345,6 @@ nd6_ioctl(u_long cmd, caddr_t data, stru struct ifaddr *ifa; struct in6_ifaddr *ia; - /* - * Try to clear ifdisabled flag when enabling - * accept_rtadv or auto_linklocal. - */ - if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && - !(ND.flags & ND6_IFF_IFDISABLED) && - (ND.flags & (ND6_IFF_ACCEPT_RTADV | - ND6_IFF_AUTO_LINKLOCAL))) - ND.flags &= ~ND6_IFF_IFDISABLED; - if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && !(ND.flags & ND6_IFF_IFDISABLED)) { /* ifdisabled 1->0 transision */ From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 07:23:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CB8D106566B; Fri, 2 Mar 2012 07:23:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C9E48FC0A; Fri, 2 Mar 2012 07:23:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q227NTFJ018837; Fri, 2 Mar 2012 07:23:29 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q227NToO018835; Fri, 2 Mar 2012 07:23:29 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201203020723.q227NToO018835@svn.freebsd.org> From: Hiroki Sato Date: Fri, 2 Mar 2012 07:23: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: r232379 - head/sys/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: Fri, 02 Mar 2012 07:23:29 -0000 Author: hrs Date: Fri Mar 2 07:23:28 2012 New Revision: 232379 URL: http://svn.freebsd.org/changeset/base/232379 Log: Allow to configure net.inet6.ip6.{accept_rtadv,no_radr} by the loader tunables as well because they have to be configured before interface initialization for AF_INET6. Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Mar 2 07:22:04 2012 (r232378) +++ head/sys/netinet6/ip6_input.c Fri Mar 2 07:23:28 2012 (r232379) @@ -163,6 +163,8 @@ ip6_init(void) TUNABLE_INT_FETCH("net.inet6.ip6.auto_linklocal", &V_ip6_auto_linklocal); + TUNABLE_INT_FETCH("net.inet6.ip6.accept_rtadv", &V_ip6_accept_rtadv); + TUNABLE_INT_FETCH("net.inet6.ip6.no_radr", &V_ip6_no_radr); TAILQ_INIT(&V_in6_ifaddrhead); From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 08:49:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F26E6106564A; Fri, 2 Mar 2012 08:49:07 +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 DBAFB8FC12; Fri, 2 Mar 2012 08:49:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q228n7JC021460; Fri, 2 Mar 2012 08:49:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q228n7JY021453; Fri, 2 Mar 2012 08:49:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203020849.q228n7JY021453@svn.freebsd.org> From: Alexander Motin Date: Fri, 2 Mar 2012 08:49: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: r232380 - in head: share/man/man4 sys/dev/ahci sys/dev/ata 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: Fri, 02 Mar 2012 08:49:08 -0000 Author: mav Date: Fri Mar 2 08:49:07 2012 New Revision: 232380 URL: http://svn.freebsd.org/changeset/base/232380 Log: Fix names of some Marvell SATA chips. It looks like chips with proprietary interface supported by mvs(4) are 88SX, while AHCI-like chips are 88SE. PR: kern/165271 Submitted by: Jia-Shiun Li MFC after: 1 week Modified: head/share/man/man4/ahci.4 head/share/man/man4/ata.4 head/sys/dev/ahci/ahci.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-ahci.c head/sys/dev/ata/chipsets/ata-marvell.c Modified: head/share/man/man4/ahci.4 ============================================================================== --- head/share/man/man4/ahci.4 Fri Mar 2 07:23:28 2012 (r232379) +++ head/share/man/man4/ahci.4 Fri Mar 2 08:49:07 2012 (r232380) @@ -146,7 +146,7 @@ subclass 6 (SATA) and programming interf .Pp Also, in cooperation with atamarvell and atajmicron drivers of ata(4), it supports AHCI part of legacy-PATA + AHCI-SATA combined controllers, -such as JMicron JMB36x and Marvell 88SX61xx. +such as JMicron JMB36x and Marvell 88SE61xx. .Sh FILES .Bl -tag -width /dev/led/ahcich*.locate .It Pa /dev/led/ahcich*.act Modified: head/share/man/man4/ata.4 ============================================================================== --- head/share/man/man4/ata.4 Fri Mar 2 07:23:28 2012 (r232379) +++ head/share/man/man4/ata.4 Fri Mar 2 08:49:07 2012 (r232380) @@ -193,8 +193,8 @@ IT8211F, IT8212F, IT8213F. .It JMicron: JMB360, JMB361, JMB363, JMB365, JMB366, JMB368. .It Marvell -88SX5040, 88SX5041, 88SX5080, 88SX5081, 88SX6041, 88SX6042, 88SX6081, 88SX6101, -88SX6102, 88SX6111, 88SX6121, 88SX6141, 88SX6145, 88SX7042. +88SX5040, 88SX5041, 88SX5080, 88SX5081, 88SX6041, 88SX6042, 88SX6081, 88SE6101, +88SE6102, 88SE6111, 88SE6121, 88SE6141, 88SE6145, 88SX7042. .It National: SC1100. .It NetCell: Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Fri Mar 2 07:23:28 2012 (r232379) +++ head/sys/dev/ahci/ahci.c Fri Mar 2 08:49:07 2012 (r232380) @@ -186,13 +186,13 @@ static struct { {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, {0x2366197b, 0x00, "JMicron JMB366", AHCI_Q_NOFORCE}, {0x2368197b, 0x00, "JMicron JMB368", AHCI_Q_NOFORCE}, - {0x611111ab, 0x00, "Marvell 88SX6111", AHCI_Q_NOFORCE | AHCI_Q_1CH | + {0x611111ab, 0x00, "Marvell 88SE6111", AHCI_Q_NOFORCE | AHCI_Q_1CH | AHCI_Q_EDGEIS}, - {0x612111ab, 0x00, "Marvell 88SX6121", AHCI_Q_NOFORCE | AHCI_Q_2CH | + {0x612111ab, 0x00, "Marvell 88SE6121", AHCI_Q_NOFORCE | AHCI_Q_2CH | AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, - {0x614111ab, 0x00, "Marvell 88SX6141", AHCI_Q_NOFORCE | AHCI_Q_4CH | + {0x614111ab, 0x00, "Marvell 88SE6141", AHCI_Q_NOFORCE | AHCI_Q_4CH | AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, - {0x614511ab, 0x00, "Marvell 88SX6145", AHCI_Q_NOFORCE | AHCI_Q_4CH | + {0x614511ab, 0x00, "Marvell 88SE6145", AHCI_Q_NOFORCE | AHCI_Q_4CH | AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, {0x91201b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_NOBSYRES}, {0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Fri Mar 2 07:23:28 2012 (r232379) +++ head/sys/dev/ata/ata-pci.h Fri Mar 2 08:49:07 2012 (r232380) @@ -278,12 +278,12 @@ struct ata_pci_controller { #define ATA_M88SX6042 0x604211ab #define ATA_M88SX6081 0x608111ab #define ATA_M88SX7042 0x704211ab -#define ATA_M88SX6101 0x610111ab -#define ATA_M88SX6102 0x610211ab -#define ATA_M88SX6111 0x611111ab -#define ATA_M88SX6121 0x612111ab -#define ATA_M88SX6141 0x614111ab -#define ATA_M88SX6145 0x614511ab +#define ATA_M88SE6101 0x610111ab +#define ATA_M88SE6102 0x610211ab +#define ATA_M88SE6111 0x611111ab +#define ATA_M88SE6121 0x612111ab +#define ATA_M88SE6141 0x614111ab +#define ATA_M88SE6145 0x614511ab #define ATA_MARVELL2_ID 0x1b4b #define ATA_MICRON_ID 0x1042 Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Fri Mar 2 07:23:28 2012 (r232379) +++ head/sys/dev/ata/chipsets/ata-ahci.c Fri Mar 2 08:49:07 2012 (r232380) @@ -180,12 +180,12 @@ ata_ahci_chipinit(device_t dev) ctlr->ichannels = ATA_INL(ctlr->r_res2, ATA_AHCI_PI); ctlr->channels = MAX(flsl(ctlr->ichannels), (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_NPMASK) + 1); - if (pci_get_devid(dev) == ATA_M88SX6111) + if (pci_get_devid(dev) == ATA_M88SE6111) ctlr->channels = 1; - else if (pci_get_devid(dev) == ATA_M88SX6121) + else if (pci_get_devid(dev) == ATA_M88SE6121) ctlr->channels = 2; - else if (pci_get_devid(dev) == ATA_M88SX6141 || - pci_get_devid(dev) == ATA_M88SX6145) + else if (pci_get_devid(dev) == ATA_M88SE6141 || + pci_get_devid(dev) == ATA_M88SE6145) ctlr->channels = 4; ctlr->reset = ata_ahci_reset; Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Fri Mar 2 07:23:28 2012 (r232379) +++ head/sys/dev/ata/chipsets/ata-marvell.c Fri Mar 2 08:49:07 2012 (r232380) @@ -108,12 +108,12 @@ ata_marvell_probe(device_t dev) { ATA_M88SX6042, 0, 4, MV_6042, ATA_SA300, "88SX6042" }, { ATA_M88SX6081, 0, 8, MV_60XX, ATA_SA300, "88SX6081" }, { ATA_M88SX7042, 0, 4, MV_7042, ATA_SA300, "88SX7042" }, - { ATA_M88SX6101, 0, 0, MV_61XX, ATA_UDMA6, "88SX6101" }, - { ATA_M88SX6102, 0, 0, MV_61XX, ATA_UDMA6, "88SX6102" }, - { ATA_M88SX6111, 0, 1, MV_61XX, ATA_UDMA6, "88SX6111" }, - { ATA_M88SX6121, 0, 2, MV_61XX, ATA_UDMA6, "88SX6121" }, - { ATA_M88SX6141, 0, 4, MV_61XX, ATA_UDMA6, "88SX6141" }, - { ATA_M88SX6145, 0, 4, MV_61XX, ATA_UDMA6, "88SX6145" }, + { ATA_M88SE6101, 0, 0, MV_61XX, ATA_UDMA6, "88SE6101" }, + { ATA_M88SE6102, 0, 0, MV_61XX, ATA_UDMA6, "88SE6102" }, + { ATA_M88SE6111, 0, 1, MV_61XX, ATA_UDMA6, "88SE6111" }, + { ATA_M88SE6121, 0, 2, MV_61XX, ATA_UDMA6, "88SE6121" }, + { ATA_M88SE6141, 0, 4, MV_61XX, ATA_UDMA6, "88SE6141" }, + { ATA_M88SE6145, 0, 4, MV_61XX, ATA_UDMA6, "88SE6145" }, { 0x91a41b4b, 0, 0, MV_91XX, ATA_UDMA6, "88SE912x" }, { 0, 0, 0, 0, 0, 0}}; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 09:30:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73480106566C; Fri, 2 Mar 2012 09:30:16 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D09F8FC20; Fri, 2 Mar 2012 09:30:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q229UGKC022801; Fri, 2 Mar 2012 09:30:16 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q229UGYd022798; Fri, 2 Mar 2012 09:30:16 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <201203020930.q229UGYd022798@svn.freebsd.org> From: Remko Lodder Date: Fri, 2 Mar 2012 09:30: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: r232381 - in stable/8/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 09:30:16 -0000 Author: remko Date: Fri Mar 2 09:30:16 2012 New Revision: 232381 URL: http://svn.freebsd.org/changeset/base/232381 Log: MFC r231713 Add additional Sierra 3G device. Original commit message: Add new USB device ID. MFC after: 3 days PR: usb/165154 PR: usb/165154 Approved by: re(kib), hselasky Modified: stable/8/sys/dev/usb/serial/u3g.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/8/sys/dev/usb/serial/u3g.c Fri Mar 2 08:49:07 2012 (r232380) +++ stable/8/sys/dev/usb/serial/u3g.c Fri Mar 2 09:30:16 2012 (r232381) @@ -432,6 +432,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(QUANTA, Q111, 0), U3G_DEV(SIERRA, AC402, 0), U3G_DEV(SIERRA, AC595U, 0), + U3G_DEV(SIERRA, AC313U, 0), U3G_DEV(SIERRA, AC597E, 0), U3G_DEV(SIERRA, AC875E, 0), U3G_DEV(SIERRA, AC875U, 0), Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Fri Mar 2 08:49:07 2012 (r232380) +++ stable/8/sys/dev/usb/usbdevs Fri Mar 2 09:30:16 2012 (r232381) @@ -2989,6 +2989,7 @@ product SIERRA E6892 0x6892 E6892 product SIERRA E6893 0x6893 E6893 product SIERRA MC8700 0x68A3 MC8700 product SIERRA AIRCARD875 0x6820 Aircard 875 HSDPA +product SIERRA AC313U 0x68aa Sierra Wireless AirCard 313U product SIERRA TRUINSTALL 0x0fff Aircard Tru Installer /* Sigmatel products */ From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 09:30:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CE250106568D; Fri, 2 Mar 2012 09:30:54 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8DCA8FC0C; Fri, 2 Mar 2012 09:30:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q229Us8u022852; Fri, 2 Mar 2012 09:30:54 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q229UsQC022850; Fri, 2 Mar 2012 09:30:54 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203020930.q229UsQC022850@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 2 Mar 2012 09:30: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: r232382 - 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, 02 Mar 2012 09:30:54 -0000 Author: pluknet Date: Fri Mar 2 09:30:54 2012 New Revision: 232382 URL: http://svn.freebsd.org/changeset/base/232382 Log: ifp->if_ioctl() has moved to u_long cmd in r36735. Somehow that change had not reached here together with ifioctl(). MFC after: 1 week Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Fri Mar 2 09:30:16 2012 (r232381) +++ head/share/man/man9/ifnet.9 Fri Mar 2 09:30:54 2012 (r232382) @@ -110,7 +110,7 @@ .Ft void .Fn \*(lp*if_qflush\*(rp "struct ifnet *ifp" .Ft int -.Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "int cmd" "caddr_t data" +.Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "u_long cmd" "caddr_t data" .Ft void .Fn \*(lp*if_watchdog\*(rp "struct ifnet *ifp" .Ft void From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 09:48:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85F34106566B; Fri, 2 Mar 2012 09:48:47 +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 713198FC16; Fri, 2 Mar 2012 09:48:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q229mlvS023423; Fri, 2 Mar 2012 09:48:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q229mlsm023421; Fri, 2 Mar 2012 09:48:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203020948.q229mlsm023421@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 2 Mar 2012 09:48: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: r232383 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 09:48:47 -0000 Author: kib Date: Fri Mar 2 09:48:46 2012 New Revision: 232383 URL: http://svn.freebsd.org/changeset/base/232383 Log: Do not expose unlocked unconstructed nullfs vnode on mount list. Lock the native nullfs vnode lock before switching the locks. Tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Fri Mar 2 09:30:54 2012 (r232382) +++ head/sys/fs/nullfs/null_subr.c Fri Mar 2 09:48:46 2012 (r232383) @@ -172,12 +172,12 @@ static void null_destroy_proto(struct vnode *vp, void *xp) { + lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); VI_LOCK(vp); vp->v_data = NULL; vp->v_vnlock = &vp->v_lock; vp->v_op = &dead_vnodeops; VI_UNLOCK(vp); - (void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vgone(vp); vput(vp); free(xp, M_NULLFSNODE); From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 09:52:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 05B90106564A; Fri, 2 Mar 2012 09:52:43 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E475F8FC14; Fri, 2 Mar 2012 09:52:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q229qgGQ023576; Fri, 2 Mar 2012 09:52:42 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q229qgGU023574; Fri, 2 Mar 2012 09:52:42 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203020952.q229qgGU023574@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 2 Mar 2012 09:52: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: r232384 - 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, 02 Mar 2012 09:52:43 -0000 Author: pluknet Date: Fri Mar 2 09:52:42 2012 New Revision: 232384 URL: http://svn.freebsd.org/changeset/base/232384 Log: Reflect the renaming of ifmaof_ifpforaddr() to if_findmulti() in r148652. MFC after: 1 week Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Fri Mar 2 09:48:46 2012 (r232383) +++ head/share/man/man9/ifnet.9 Fri Mar 2 09:52:42 2012 (r232384) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2012 +.Dd March 2, 2012 .Dt IFNET 9 .Os .Sh NAME @@ -91,7 +91,7 @@ .Ft int .Fn if_delmulti "struct ifnet *ifp" "struct sockaddr *sa" .Ft "struct ifmultiaddr *" -.Fn ifmaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp" +.Fn if_findmulti "struct ifnet *ifp" "struct sockaddr *sa" .Ss "Output queue macros" .Fn IF_DEQUEUE "struct ifqueue *ifq" "struct mbuf *m" .\" @@ -1347,7 +1347,7 @@ The .Fn if_addmulti , .Fn if_delmulti , and -.Fn ifmaof_ifpforaddr +.Fn if_findmulti functions provide support for requesting and relinquishing multicast group memberships, and for querying an interface's membership list, respectively. @@ -1404,11 +1404,11 @@ Both functions return zero on success, o standard error number on failure. .Pp The -.Fn ifmaof_ifpforaddr +.Fn if_findmulti function examines the membership list of interface .Fa ifp for an address matching -.Fa addr , +.Fa sa , and returns a pointer to that .Vt "struct ifmultiaddr" if one is found, else it returns a null pointer. From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 10:03:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 57007106564A; Fri, 2 Mar 2012 10:03:39 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 285EA8FC13; Fri, 2 Mar 2012 10:03:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22A3dBq023987; Fri, 2 Mar 2012 10:03:39 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22A3dY1023985; Fri, 2 Mar 2012 10:03:39 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201203021003.q22A3dY1023985@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 2 Mar 2012 10:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232385 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 10:03:39 -0000 Author: ru Date: Fri Mar 2 10:03:38 2012 New Revision: 232385 URL: http://svn.freebsd.org/changeset/base/232385 Log: Finally removed the stat() and fstat() calls from the opendir() code. They were made excessive in r205424 by opening with O_DIRECTORY. Also eliminated the fcntl() call used to set FD_CLOEXEC by opening with O_CLOEXEC. (fdopendir() still checks that the passed descriptor is a directory, and sets FD_CLOEXEC on it.) Reviewed by: ed Modified: head/lib/libc/gen/opendir.c Modified: head/lib/libc/gen/opendir.c ============================================================================== --- head/lib/libc/gen/opendir.c Fri Mar 2 09:52:42 2012 (r232384) +++ head/lib/libc/gen/opendir.c Fri Mar 2 10:03:38 2012 (r232385) @@ -66,7 +66,17 @@ opendir(const char *name) DIR * fdopendir(int fd) { + struct stat statb; + /* Check that fd is associated with a directory. */ + if (_fstat(fd, &statb) != 0) + return (NULL); + if (!S_ISDIR(statb.st_mode)) { + errno = ENOTDIR; + return (NULL); + } + if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) + return (NULL); return (__opendir_common(fd, NULL, DTF_HIDEW|DTF_NODUP)); } @@ -74,21 +84,11 @@ DIR * __opendir2(const char *name, int flags) { int fd; - struct stat statb; DIR *dir; int saved_errno; - /* - * stat() before _open() because opening of special files may be - * harmful. - */ - if (stat(name, &statb) != 0) - return (NULL); - if (!S_ISDIR(statb.st_mode)) { - errno = ENOTDIR; - return (NULL); - } - if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY)) == -1) + if ((fd = _open(name, + O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) return (NULL); dir = __opendir_common(fd, name, flags); @@ -119,19 +119,9 @@ __opendir_common(int fd, const char *nam int saved_errno; int unionstack; int fd2; - struct stat statb; - dirp = NULL; - /* _fstat() the open handler because the file may have changed. */ - if (_fstat(fd, &statb) != 0) - goto fail; - if (!S_ISDIR(statb.st_mode)) { - errno = ENOTDIR; - goto fail; - } - if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 || - (dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) - goto fail; + if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) + return (NULL); dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR)); LIST_INIT(&dirp->dd_td->td_locq); From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 11:32:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E8DF1065672; Fri, 2 Mar 2012 11:32: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 072008FC14; Fri, 2 Mar 2012 11:32:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22BWlgb028104; Fri, 2 Mar 2012 11:32:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22BWl86028098; Fri, 2 Mar 2012 11:32:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203021132.q22BWl86028098@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 2 Mar 2012 11:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232387 - in stable/9/sys: compat/linux compat/svr4 i386/ibcs2 i386/linux 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, 02 Mar 2012 11:32:48 -0000 Author: kib Date: Fri Mar 2 11:32:47 2012 New Revision: 232387 URL: http://svn.freebsd.org/changeset/base/232387 Log: MFC r231885: Fix misuse of the kernel map in miscellaneous image activators. Vnode-backed mappings cannot be put into the kernel map, since it is a system map. Modified: stable/9/sys/compat/linux/linux_misc.c stable/9/sys/compat/svr4/imgact_svr4.c stable/9/sys/i386/ibcs2/imgact_coff.c stable/9/sys/i386/linux/imgact_linux.c stable/9/sys/kern/imgact_gzip.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/linux/linux_misc.c ============================================================================== --- stable/9/sys/compat/linux/linux_misc.c Fri Mar 2 11:27:07 2012 (r232386) +++ stable/9/sys/compat/linux/linux_misc.c Fri Mar 2 11:32:47 2012 (r232387) @@ -229,9 +229,9 @@ linux_uselib(struct thread *td, struct l struct vattr attr; vm_offset_t vmaddr; unsigned long file_offset; - vm_offset_t buffer; unsigned long bss_size; char *library; + ssize_t aresid; int error; int locked, vfslocked; @@ -308,8 +308,8 @@ linux_uselib(struct thread *td, struct l if (error) goto cleanup; - /* Pull in executable header into kernel_map */ - error = vm_mmap(kernel_map, (vm_offset_t *)&a_out, PAGE_SIZE, + /* Pull in executable header into exec_map */ + error = vm_mmap(exec_map, (vm_offset_t *)&a_out, PAGE_SIZE, VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE, vp, 0); if (error) goto cleanup; @@ -402,24 +402,15 @@ linux_uselib(struct thread *td, struct l if (error) goto cleanup; - /* map file into kernel_map */ - error = vm_mmap(kernel_map, &buffer, - round_page(a_out->a_text + a_out->a_data + file_offset), - VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE, vp, - trunc_page(file_offset)); - if (error) + error = vn_rdwr(UIO_READ, vp, (void *)vmaddr, file_offset, + a_out->a_text + a_out->a_data, UIO_USERSPACE, 0, + td->td_ucred, NOCRED, &aresid, td); + if (error != 0) goto cleanup; - - /* copy from kernel VM space to user space */ - error = copyout(PTRIN(buffer + file_offset), - (void *)vmaddr, a_out->a_text + a_out->a_data); - - /* release temporary kernel space */ - vm_map_remove(kernel_map, buffer, buffer + - round_page(a_out->a_text + a_out->a_data + file_offset)); - - if (error) + if (aresid != 0) { + error = ENOEXEC; goto cleanup; + } } else { #ifdef DEBUG printf("uselib: Page aligned binary %lu\n", file_offset); @@ -463,10 +454,9 @@ cleanup: VFS_UNLOCK_GIANT(vfslocked); } - /* Release the kernel mapping. */ + /* Release the temporary mapping. */ if (a_out) - vm_map_remove(kernel_map, (vm_offset_t)a_out, - (vm_offset_t)a_out + PAGE_SIZE); + kmem_free_wakeup(exec_map, (vm_offset_t)a_out, PAGE_SIZE); return (error); } Modified: stable/9/sys/compat/svr4/imgact_svr4.c ============================================================================== --- stable/9/sys/compat/svr4/imgact_svr4.c Fri Mar 2 11:27:07 2012 (r232386) +++ stable/9/sys/compat/svr4/imgact_svr4.c Fri Mar 2 11:32:47 2012 (r232387) @@ -66,8 +66,8 @@ exec_svr4_imgact(imgp) struct vmspace *vmspace; vm_offset_t vmaddr; unsigned long virtual_offset, file_offset; - vm_offset_t buffer; unsigned long bss_size; + ssize_t aresid; int error; if (((a_out->a_magic >> 16) & 0xff) != 0x64) @@ -145,21 +145,15 @@ exec_svr4_imgact(imgp) if (error) goto fail; - error = vm_mmap(kernel_map, &buffer, - round_page(a_out->a_text + a_out->a_data + file_offset), - VM_PROT_READ, VM_PROT_READ, 0, - OBJT_VNODE, imgp->vp, trunc_page(file_offset)); - if (error) - goto fail; - - error = copyout((caddr_t)(buffer + file_offset), (caddr_t)vmaddr, - a_out->a_text + a_out->a_data); - - vm_map_remove(kernel_map, buffer, - buffer + round_page(a_out->a_text + a_out->a_data + file_offset)); - - if (error) - goto fail; + error = vn_rdwr(UIO_READ, imgp->vp, (void *)vmaddr, file_offset, + a_out->a_text + a_out->a_data, UIO_USERSPACE, 0, + curthread->td_ucred, NOCRED, &aresid, curthread); + if (error != 0) + goto fail; + if (aresid != 0) { + error = ENOEXEC; + goto fail; + } /* * remove write enable on the 'text' part Modified: stable/9/sys/i386/ibcs2/imgact_coff.c ============================================================================== --- stable/9/sys/i386/ibcs2/imgact_coff.c Fri Mar 2 11:27:07 2012 (r232386) +++ stable/9/sys/i386/ibcs2/imgact_coff.c Fri Mar 2 11:32:47 2012 (r232387) @@ -146,10 +146,7 @@ load_coff_section(struct vmspace *vmspac error = copyout(data_buf, (caddr_t) map_addr, copy_len); - if (vm_map_remove(exec_map, - (vm_offset_t) data_buf, - (vm_offset_t) data_buf + PAGE_SIZE)) - panic("load_coff_section vm_map_remove failed"); + kmem_free_wakeup(exec_map, (vm_offset_t)data_buf, PAGE_SIZE); return error; } @@ -280,11 +277,7 @@ coff_load_file(struct thread *td, char * error = 0; dealloc_and_fail: - if (vm_map_remove(exec_map, - (vm_offset_t) ptr, - (vm_offset_t) ptr + PAGE_SIZE)) - panic("%s vm_map_remove failed", __func__); - + kmem_free_wakeup(exec_map, (vm_offset_t)ptr, PAGE_SIZE); fail: VOP_UNLOCK(vp, 0); unlocked_fail: @@ -421,10 +414,7 @@ exec_coff_imgact(imgp) } free(libbuf, M_TEMP); } - if (vm_map_remove(exec_map, - (vm_offset_t) buf, - (vm_offset_t) buf + len)) - panic("exec_coff_imgact vm_map_remove failed"); + kmem_free_wakeup(exec_map, (vm_offset_t)buf, len); if (error) goto fail; } Modified: stable/9/sys/i386/linux/imgact_linux.c ============================================================================== --- stable/9/sys/i386/linux/imgact_linux.c Fri Mar 2 11:27:07 2012 (r232386) +++ stable/9/sys/i386/linux/imgact_linux.c Fri Mar 2 11:32:47 2012 (r232387) @@ -64,8 +64,8 @@ exec_linux_imgact(struct image_params *i struct vmspace *vmspace; vm_offset_t vmaddr; unsigned long virtual_offset, file_offset; - vm_offset_t buffer; unsigned long bss_size; + ssize_t aresid; int error; if (((a_out->a_magic >> 16) & 0xff) != 0x64) @@ -144,21 +144,15 @@ exec_linux_imgact(struct image_params *i if (error) goto fail; - error = vm_mmap(kernel_map, &buffer, - round_page(a_out->a_text + a_out->a_data + file_offset), - VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE, - imgp->vp, trunc_page(file_offset)); - if (error) - goto fail; - - error = copyout((void *)(uintptr_t)(buffer + file_offset), - (void *)vmaddr, a_out->a_text + a_out->a_data); - - vm_map_remove(kernel_map, buffer, - buffer + round_page(a_out->a_text + a_out->a_data + file_offset)); - - if (error) - goto fail; + error = vn_rdwr(UIO_READ, imgp->vp, (void *)vmaddr, file_offset, + a_out->a_text + a_out->a_data, UIO_USERSPACE, 0, + curthread->td_ucred, NOCRED, &aresid, curthread); + if (error != 0) + goto fail; + if (aresid != 0) { + error = ENOEXEC; + goto fail; + } /* * remove write enable on the 'text' part Modified: stable/9/sys/kern/imgact_gzip.c ============================================================================== --- stable/9/sys/kern/imgact_gzip.c Fri Mar 2 11:27:07 2012 (r232386) +++ stable/9/sys/kern/imgact_gzip.c Fri Mar 2 11:32:47 2012 (r232387) @@ -70,7 +70,7 @@ static int exec_gzip_imgact(imgp) struct image_params *imgp; { - int error, error2 = 0; + int error; const u_char *p = (const u_char *) imgp->image_header; struct imgact_gzip igz; struct inflate infl; @@ -136,22 +136,17 @@ exec_gzip_imgact(imgp) VM_PROT_READ|VM_PROT_EXECUTE,0); } - if (igz.inbuf) { - error2 = - vm_map_remove(kernel_map, (vm_offset_t) igz.inbuf, - (vm_offset_t) igz.inbuf + PAGE_SIZE); - } - if (igz.error || error || error2) { + if (igz.inbuf) + kmem_free_wakeup(exec_map, (vm_offset_t)igz.inbuf, PAGE_SIZE); + if (igz.error || error) { printf("Output=%lu ", igz.output); - printf("Inflate_error=%d igz.error=%d error2=%d where=%d\n", - error, igz.error, error2, igz.where); + printf("Inflate_error=%d igz.error=%d where=%d\n", + error, igz.error, igz.where); } if (igz.error) return igz.error; if (error) return ENOEXEC; - if (error2) - return error2; return 0; } @@ -314,18 +309,11 @@ NextByte(void *vp) if (igz->inbuf && igz->idx < (igz->offset + PAGE_SIZE)) { return igz->inbuf[(igz->idx++) - igz->offset]; } - if (igz->inbuf) { - error = vm_map_remove(kernel_map, (vm_offset_t) igz->inbuf, - (vm_offset_t) igz->inbuf + PAGE_SIZE); - if (error) { - igz->where = __LINE__; - igz->error = error; - return GZ_EOF; - } - } + if (igz->inbuf) + kmem_free_wakeup(exec_map, (vm_offset_t)igz->inbuf, PAGE_SIZE); igz->offset = igz->idx & ~PAGE_MASK; - error = vm_mmap(kernel_map, /* map */ + error = vm_mmap(exec_map, /* map */ (vm_offset_t *) & igz->inbuf, /* address */ PAGE_SIZE, /* size */ VM_PROT_READ, /* protection */ From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 11:47:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6184A106564A; Fri, 2 Mar 2012 11:47: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 4196E8FC18; Fri, 2 Mar 2012 11:47:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22BlZYH028615; Fri, 2 Mar 2012 11:47:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22BlZ56028611; Fri, 2 Mar 2012 11:47:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203021147.q22BlZ56028611@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 2 Mar 2012 11:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232388 - in stable/9/lib/libc: gen 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: Fri, 02 Mar 2012 11:47:35 -0000 Author: kib Date: Fri Mar 2 11:47:34 2012 New Revision: 232388 URL: http://svn.freebsd.org/changeset/base/232388 Log: MFC r231868: Fetch the aux vector for the static libc, and use the entries to initialize the cache of the system information as it was done for the dynamic libc. This removes several sysctls from the static binary startup. Use the aux vector to fill the single struct dl_phdr_info describing the static binary itself, to implement dl_iterate_phdr(3) for the static binaries. Modified: stable/9/lib/libc/gen/aux.c stable/9/lib/libc/gen/dlfcn.c stable/9/lib/libc/include/libc_private.h Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/aux.c ============================================================================== --- stable/9/lib/libc/gen/aux.c Fri Mar 2 11:32:47 2012 (r232387) +++ stable/9/lib/libc/gen/aux.c Fri Mar 2 11:47:34 2012 (r232388) @@ -1,5 +1,5 @@ /*- - * Copyright 2010 Konstantin Belousov . + * Copyright 2010, 2012 Konstantin Belousov . * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,10 +36,34 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -Elf_Auxinfo *__elf_aux_vector; +extern char **environ; +extern int _DYNAMIC; +#pragma weak _DYNAMIC -static pthread_once_t aux_once = PTHREAD_ONCE_INIT; +void *__elf_aux_vector; +static pthread_once_t aux_vector_once = PTHREAD_ONCE_INIT; + +static void +init_aux_vector_once(void) +{ + Elf_Addr *sp; + + sp = (Elf_Addr *)environ; + while (*sp++ != 0) + ; + __elf_aux_vector = (Elf_Auxinfo *)sp; +} +void +__init_elf_aux_vector(void) +{ + + if (&_DYNAMIC != NULL) + return; + _once(&aux_vector_once, init_aux_vector_once); +} + +static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; static char *canary, *pagesizes; @@ -86,6 +110,7 @@ _elf_aux_info(int aux, void *buf, int bu { int res; + __init_elf_aux_vector(); if (__elf_aux_vector == NULL) return (ENOSYS); _once(&aux_once, init_aux); Modified: stable/9/lib/libc/gen/dlfcn.c ============================================================================== --- stable/9/lib/libc/gen/dlfcn.c Fri Mar 2 11:32:47 2012 (r232387) +++ stable/9/lib/libc/gen/dlfcn.c Fri Mar 2 11:47:34 2012 (r232388) @@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "namespace.h" +#include +#include "un-namespace.h" +#include "libc_private.h" static char sorry[] = "Service unavailable"; @@ -138,13 +142,58 @@ _rtld_thread_init(void * li) _rtld_error(sorry); } +static pthread_once_t dl_phdr_info_once = PTHREAD_ONCE_INIT; +static struct dl_phdr_info phdr_info; + +static void +dl_init_phdr_info(void) +{ + Elf_Auxinfo *auxp; + size_t phent; + unsigned int i; + + phent = 0; + for (auxp = __elf_aux_vector; auxp->a_type != AT_NULL; auxp++) { + switch (auxp->a_type) { + case AT_BASE: + phdr_info.dlpi_addr = (Elf_Addr)auxp->a_un.a_ptr; + break; + case AT_EXECPATH: + phdr_info.dlpi_name = (const char *)auxp->a_un.a_ptr; + break; + case AT_PHDR: + phdr_info.dlpi_phdr = + (const Elf_Phdr *)auxp->a_un.a_ptr; + break; + case AT_PHENT: + phent = auxp->a_un.a_val; + break; + case AT_PHNUM: + phdr_info.dlpi_phnum = (Elf_Half)auxp->a_un.a_val; + break; + } + } + for (i = 0; i < phdr_info.dlpi_phnum; i++) { + if (phdr_info.dlpi_phdr[i].p_type == PT_TLS) { + phdr_info.dlpi_tls_modid = 1; + phdr_info.dlpi_tls_data = + (void*)phdr_info.dlpi_phdr[i].p_vaddr; + } + } + phdr_info.dlpi_adds = 1; +} + #pragma weak dl_iterate_phdr int dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *), void *data) { - _rtld_error(sorry); - return 0; + + __init_elf_aux_vector(); + if (__elf_aux_vector == NULL) + return (1); + _once(&dl_phdr_info_once, dl_init_phdr_info); + return (callback(&phdr_info, sizeof(phdr_info), data)); } #pragma weak fdlopen Modified: stable/9/lib/libc/include/libc_private.h ============================================================================== --- stable/9/lib/libc/include/libc_private.h Fri Mar 2 11:32:47 2012 (r232387) +++ stable/9/lib/libc/include/libc_private.h Fri Mar 2 11:47:34 2012 (r232388) @@ -44,6 +44,15 @@ extern int __isthreaded; /* + * Elf_Auxinfo *__elf_aux_vector, the pointer to the ELF aux vector + * provided by kernel. Either set for us by rtld, or found at runtime + * on stack for static binaries. + * + * Type is void to avoid polluting whole libc with ELF types. + */ +extern void *__elf_aux_vector; + +/* * libc should use libc_dlopen internally, which respects a global * flag where loading of new shared objects can be restricted. */ @@ -229,6 +238,7 @@ int _execvpe(const char *, char * const int _elf_aux_info(int aux, void *buf, int buflen); struct dl_phdr_info; int __elf_phdr_match_addr(struct dl_phdr_info *, void *); +void __init_elf_aux_vector(void); void _pthread_cancel_enter(int); void _pthread_cancel_leave(int); From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 11:50:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 17B25106566B; Fri, 2 Mar 2012 11:50:38 +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 02BDC8FC08; Fri, 2 Mar 2012 11:50:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22BobT1028756; Fri, 2 Mar 2012 11:50:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22BobPu028754; Fri, 2 Mar 2012 11:50:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203021150.q22BobPu028754@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 2 Mar 2012 11:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232389 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 11:50:38 -0000 Author: kib Date: Fri Mar 2 11:50:37 2012 New Revision: 232389 URL: http://svn.freebsd.org/changeset/base/232389 Log: MFC r231869: Document dl_iterate_phdr(3). MFC r231873: Fix cross-references. Added: stable/9/lib/libc/gen/dl_iterate_phdr.3 - copied, changed from r231869, head/lib/libc/gen/dl_iterate_phdr.3 Modified: Directory Properties: stable/9/lib/libc/ (props changed) Copied and modified: stable/9/lib/libc/gen/dl_iterate_phdr.3 (from r231869, head/lib/libc/gen/dl_iterate_phdr.3) ============================================================================== --- head/lib/libc/gen/dl_iterate_phdr.3 Fri Feb 17 10:51:40 2012 (r231869, copy source) +++ stable/9/lib/libc/gen/dl_iterate_phdr.3 Fri Mar 2 11:50:37 2012 (r232389) @@ -23,7 +23,7 @@ .Nd iterate over program headers .Sh LIBRARY For the dynamically linked binaries, the service is provided by -.Xr ld-elf.so.1 5 +.Xr ld-elf.so.1 1 dynamic linker. Statically linked programs use an implementation of .Fn dl_iterate_phdr @@ -105,7 +105,7 @@ returns the value returned by the last call executed. .Sh SEE ALSO .Xr ld 1 , -.Xr ld-elf.so 1 , +.Xr ld-elf.so.1 1 , .Xr dlopen 3 , .Xr elf 5 .Sh HISTORY From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 11:52:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6CC37106564A; Fri, 2 Mar 2012 11:52:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 930C18FC0A; Fri, 2 Mar 2012 11:52:45 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q22Bqfoc007368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Mar 2012 22:52:42 +1100 Date: Fri, 2 Mar 2012 22:52:41 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20120302130435.J929@besplex.bde.org> Message-ID: <20120302223355.Q2543@besplex.bde.org> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120229160522.W2514@besplex.bde.org> <20120229181608.S2887@besplex.bde.org> <201203012346.20648.tijl@freebsd.org> <20120302130435.J929@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Tijl Coosemans , src-committers@freebsd.org, Dimitry Andric , svn-src-all@freebsd.org Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 11:52:46 -0000 On Fri, 2 Mar 2012, Bruce Evans wrote: > On Thu, 1 Mar 2012, Tijl Coosemans wrote: > >> On Wednesday 29 February 2012 08:44:54 Bruce Evans wrote: >>> ... >>> So any macro version must use gcc features to be safe. The following >>> seems to work: >>> >>> #define __bswap16(x) __extension__ ({ __uint16_t __x = x; >>> (__uint16_t)(__x << 8 | __x >> 8); }) >>> >>> clang now produces "rolw $8,x" when x is volatile. This seems to >>> violate volatile semantics. gcc produces load-rolw-store then. Both >>> produce "rolw $8,x" when x is not volatile. >> >> I'll have a closer look at the patch tomorrow, but the Intel >> documentation for the bswap instruction recommends to use xchg for >> bswap16. > > That's what i386 used to do, using an asm (see for example the RELENG_4 > version), but the asm was replaced by C code and the compiler apparently > knows better. This might depend on -mtune. I tested with the default, > ... Here is another version. It has now been tested a bit at runtime. I had to restore almost all of the complications, so the following reduces to mostly style changes including comments about surprising details. It has 1 fix for clang (the comitted version doesn't work for clang). % Index: endian.h % =================================================================== % RCS file: /home/ncvs/src/sys/x86/include/endian.h,v % retrieving revision 1.1 % diff -u -2 -r1.1 endian.h % --- endian.h 28 Feb 2012 19:39:54 -0000 1.1 % +++ endian.h 2 Mar 2012 10:43:53 -0000 % @@ -37,8 +37,4 @@ % #include % % -#ifdef __cplusplus % -extern "C" { % -#endif % - % /* % * Define the order of 32-bit words in 64-bit words. % @@ -68,25 +64,17 @@ % #endif % % -#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) % - % -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) % +#define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8) % +#define __bswap32_gen(x) \ % + (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16)) % +#define __bswap64_gen(x) \ % + (((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32)) % % -#define __bswap16(_x) \ % - (__builtin_constant_p(_x) ? \ % - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) % - % -#define __bswap32_const(_x) \ % - (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) % - % -#define __bswap32(_x) \ % - (__builtin_constant_p(_x) ? \ % - __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) % +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) % % -#define __bswap64_const(_x) \ % - (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32)) % +/* The following mess is to avoid multiple evaluation of x. */ % % -#define __bswap64(_x) \ % - (__builtin_constant_p(_x) ? \ % - __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) % +#define __bswap16(x) \ % + (__builtin_constant_p(x) ? \ % + __bswap16_gen((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x))) For clang, x must be cast in the `var' clause too, since when x is something like 0x12345678 (having been passed here without conversion by __bswap32()), clang parses the `var' clause and warns about the implicit truncation of 0x12345678 to 0x5678 in it. This is a bug in clang -- when warning about fine details, it is important not to do it for non-problems. % % static __inline __uint16_t % @@ -94,7 +82,19 @@ % { % % - return (__bswap16_const(_x)); % + return (__bswap16_gen(_x)); % } % % +/* % + * The following messes are old optimizations for gcc. The messes have % + * been reduced significantly, but I don't know how to implement the % + * preferred way of defining defaults above and overriding them cleanly % + * here. Even clang needs help for the 64-bit case, so to keep the % + * ifdefs sane we use this for the 32-bit case with clang too. % + */ % + % +#define __bswap32(x) \ % + (__builtin_constant_p(x) ? \ % + __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) % + % static __inline __uint32_t % __bswap32_var(__uint32_t _x) % @@ -105,34 +105,37 @@ % } % % +#define __bswap64(x) \ % + (__builtin_constant_p(x) ? \ % + __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x)) % + % static __inline __uint64_t % __bswap64_var(__uint64_t _x) % { % -#ifdef _LP64 % + % +#ifdef _LP64 % __asm ("bswap %0" : "+r" (_x)); % return (_x); % #else % - return (__bswap64_const(_x)); % + /* % + * It is important for the optimizations that the following is not % + * really generic, but expands to 2 __bswap32_var()'s. % + */ % + return (__bswap64_gen(_x)); % #endif % } % % -#define __htonl(x) __bswap32(x) % -#define __htons(x) __bswap16(x) % -#define __ntohl(x) __bswap32(x) % -#define __ntohs(x) __bswap16(x) % +#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ % % -#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */ % - % -/* % - * No optimizations are available for this compiler. Fall back to % - * non-optimized functions by defining the constant usually used to prevent % - * redefinition. % - */ % -#define _BYTEORDER_FUNC_DEFINED % +/* XXX these are broken, since they evaluate x more than once. */ % +#define __bswap16(x) (__bswap16_gen((__uint16_t)(x))) % +#define __bswap32(x) (__bswap32_gen((__uint32_t)(x))) % +#define __bswap64(x) (__bswap64_gen((__uint64_t)(x))) % % #endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ % % -#ifdef __cplusplus % -} % -#endif % +#define __htonl(x) __bswap32(x) % +#define __htons(x) __bswap16(x) % +#define __ntohl(x) __bswap32(x) % +#define __ntohs(x) __bswap16(x) % % #endif /* !_MACHINE_ENDIAN_H_ */ Here is a cut down version showing the clang bug: % static inline int % unused(short x) % { % return (x); % } % % int % foo(void) % { % return (1 ? 0 : unused(0x12345678)); % } % w.c:10:25: warning: implicit conversion from 'int' to 'short' changes value from 305419896 to 22136 [-Wconstant-conversion] % return (1 ? 0 : unused(0x12345678)); % ~~~~~~ ^~~~~~~~~~ % 1 warning generated. This shows another bug: the hex constants are obfuscated in the error message by printing them in decimal. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 12:53:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B6002106566C; Fri, 2 Mar 2012 12:53:43 +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 4286E8FC08; Fri, 2 Mar 2012 12:53:42 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q22CrZvM026442; Fri, 2 Mar 2012 14:53:35 +0200 (EET) (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.5/8.14.5) with ESMTP id q22CrZku082603; Fri, 2 Mar 2012 14:53:35 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q22CrYf4082602; Fri, 2 Mar 2012 14:53:34 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 2 Mar 2012 14:53:34 +0200 From: Konstantin Belousov To: Kirk McKusick Message-ID: <20120302125334.GH75778@deviant.kiev.zoral.com.ua> References: <201203011845.q21IjQqt091350@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="smOfPzt+Qjm5bNGJ" Content-Disposition: inline In-Reply-To: <201203011845.q21IjQqt091350@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=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham 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: r232351 - in head/sys: kern sys ufs/ffs ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 12:53:43 -0000 --smOfPzt+Qjm5bNGJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 01, 2012 at 06:45:25PM +0000, Kirk McKusick wrote: > Author: mckusick > Date: Thu Mar 1 18:45:25 2012 > New Revision: 232351 > URL: http://svn.freebsd.org/changeset/base/232351 > Modified: head/sys/sys/buf.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/sys/buf.h Thu Mar 1 18:17:45 2012 (r232350) > +++ head/sys/sys/buf.h Thu Mar 1 18:45:25 2012 (r232351) > @@ -479,10 +479,13 @@ void bwillwrite(void); > int buf_dirty_count_severe(void); > void bremfree(struct buf *); > void bremfreef(struct buf *); /* XXX Force bremfree, only for nfs. */ > -int bread(struct vnode *, daddr_t, int, struct ucred *, struct buf **); > +#define bread(vp, blkno, size, cred, bpp) \ > + breadn_flags(vp, blkno, size, 0, 0, 0, cred, 0, bpp) > +#define breadn(vp, blkno, size, rablkno, rabsize, cnt, cred, bpp) \ > + breadn_flags(vp, blkno, size, rablkno, rabsize, cnt, cred, 0, bpp) > +int breadn_flags(struct vnode *, daddr_t, int, daddr_t *, int *, int, > + struct ucred *, int, struct buf **); > void breada(struct vnode *, daddr_t *, int *, int, struct ucred *); > -int breadn(struct vnode *, daddr_t, int, daddr_t *, int *, int, > - struct ucred *, struct buf **); > void bdwrite(struct buf *); > void bawrite(struct buf *); > void bdirty(struct buf *); This part of the change breaks KBI. I suggest that for merge to stable/9=20 you would leave the bread and breadn as functions. >=20 > Modified: head/sys/ufs/ffs/ffs_extern.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/ufs/ffs/ffs_extern.h Thu Mar 1 18:17:45 2012 (r232350) > +++ head/sys/ufs/ffs/ffs_extern.h Thu Mar 1 18:45:25 2012 (r232351) > @@ -167,6 +167,13 @@ void softdep_freework(struct workhead *) > #define FLUSH_INODES_WAIT 2 > #define FLUSH_BLOCKS 3 > #define FLUSH_BLOCKS_WAIT 4 > +/* > + * Flag to ffs_syncinode() to request flushing of data only, > + * but skip the ffs_update() on the inode itself. Used to avoid > + * deadlock when flushing snapshot inodes while holding snaplk. > + * Avoid bit conflicts with MNT_WAIT values in sys/mount.h > + */ > +#define NO_INO_UPDT 0x10 Would it be useful to add at least a comment to MNT_WAIT section of sys/mount.h to warn about this flag existence ? --smOfPzt+Qjm5bNGJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9Qws4ACgkQC3+MBN1Mb4g8LQCfVeGqEis8+WxrDoFkpTngO0Km TuUAoKZzjuSNskmk5nm1xrgKS0d/6xx0 =U3Yl -----END PGP SIGNATURE----- --smOfPzt+Qjm5bNGJ-- From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 13:05:35 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD3C2106566C; Fri, 2 Mar 2012 13:05:35 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theravensnest.org [109.169.23.128]) by mx1.freebsd.org (Postfix) with ESMTP id 7117D8FC12; Fri, 2 Mar 2012 13:05:35 +0000 (UTC) Received: from [192.168.0.2] (cpc1-cwma8-2-0-cust257.7-3.cable.virginmedia.com [82.20.153.2]) (authenticated bits=0) by theravensnest.org (8.14.4/8.14.4) with ESMTP id q22D5Xra091035 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Fri, 2 Mar 2012 13:05:34 GMT (envelope-from theraven@FreeBSD.org) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <20120302125334.GH75778@deviant.kiev.zoral.com.ua> Date: Fri, 2 Mar 2012 13:05:28 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <0F23DDD1-1CAC-4E72-A3CB-56B81F0C0790@FreeBSD.org> References: <201203011845.q21IjQqt091350@svn.freebsd.org> <20120302125334.GH75778@deviant.kiev.zoral.com.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1257) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Kirk McKusick Subject: Re: svn commit: r232351 - in head/sys: kern sys ufs/ffs ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 13:05:36 -0000 On 2 Mar 2012, at 12:53, Konstantin Belousov wrote: > This part of the change breaks KBI. I suggest that for merge to = stable/9=20 > you would leave the bread and breadn as functions. Can we not do this for the general case? Provide them as inline extern = functions in the header, and implement them elsewhere, so the compiler = will inline them in recompiled code but not break code that isn't? I'm not sure if we have a guide for how to maintain ABI compatibility, = but this should probably be one of the standard things to do. The = recent long discussion about what people want from FreeBSD indicated = that a lot of people downstream wanted a stable ABI with a 10-year = window and ABIs churn on releases was keeping a lot of people on 7.x or = earlier... Of course, the non-inline implementations of the can be conditionally = compiled with COMPAT_9, so that people who don't care about backwards = compatibility don't have to have them in their kernels... David= From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 13:19:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC6AA106564A; Fri, 2 Mar 2012 13:19:56 +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 D8D778FC0A; Fri, 2 Mar 2012 13:19:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22DJuS6031793; Fri, 2 Mar 2012 13:19:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22DJuVo031791; Fri, 2 Mar 2012 13:19:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203021319.q22DJuVo031791@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 2 Mar 2012 13:19: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: r232392 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 13:19:57 -0000 Author: kib Date: Fri Mar 2 13:19:56 2012 New Revision: 232392 URL: http://svn.freebsd.org/changeset/base/232392 Log: Belatedly add dl_iterate_phdr(3) to the list of installed manpages. MFC after: 3 days Modified: head/lib/libc/gen/Makefile.inc Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Fri Mar 2 12:42:59 2012 (r232391) +++ head/lib/libc/gen/Makefile.inc Fri Mar 2 13:19:56 2012 (r232392) @@ -54,7 +54,7 @@ SYM_MAPS+=${.CURDIR}/gen/Symbol.map MAN+= alarm.3 arc4random.3 \ basename.3 check_utility_compat.3 clock.3 \ confstr.3 ctermid.3 daemon.3 devname.3 directory.3 dirname.3 \ - dladdr.3 dlinfo.3 dllockinit.3 dlopen.3 \ + dl_iterate_phdr.3 dladdr.3 dlinfo.3 dllockinit.3 dlopen.3 \ err.3 exec.3 \ feature_present.3 fmtcheck.3 fmtmsg.3 fnmatch.3 fpclassify.3 frexp.3 \ ftok.3 fts.3 ftw.3 \ From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 13:29:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C21941065673 for ; Fri, 2 Mar 2012 13:29:23 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay01.pair.com (relay01.pair.com [209.68.5.15]) by mx1.freebsd.org (Postfix) with SMTP id 375488FC12 for ; Fri, 2 Mar 2012 13:29:23 +0000 (UTC) Received: (qmail 35012 invoked from network); 2 Mar 2012 13:29:21 -0000 Received: from 87.58.144.241 (HELO x2.osted.lan) (87.58.144.241) by relay01.pair.com with SMTP; 2 Mar 2012 13:29:21 -0000 X-pair-Authenticated: 87.58.144.241 Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.4/8.14.4) with ESMTP id q22DTL5Z042788; Fri, 2 Mar 2012 14:29:21 +0100 (CET) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.4/8.14.4/Submit) id q22DTLS5042787; Fri, 2 Mar 2012 14:29:21 +0100 (CET) (envelope-from pho) Date: Fri, 2 Mar 2012 14:29:21 +0100 From: Peter Holm To: John Baldwin Message-ID: <20120302132921.GA40934@x2.osted.lan> References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201203011647.41313.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203011647.41313.jhb@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: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 13:29:23 -0000 On Thu, Mar 01, 2012 at 04:47:41PM -0500, John Baldwin wrote: > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > Author: pho > > Date: Mon Oct 31 15:01:47 2011 > > New Revision: 226967 > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > Log: > > The kern_renameat() looks up the fvp using the DELETE flag, which causes > > the removal of the name cache entry for fvp. > > > > Reported by: Anton Yuzhaninov > > In collaboration with: kib > > MFC after: 1 week > > > > Modified: > > head/sys/ufs/ufs/ufs_vnops.c > > So I ran into this at work recently, and even this fix applied I was still > seeing rename()'s that were seemingly not taking effect. After getting some > extra KTR traces, I figured out that the same purge needs to be applied to the > destination vnode. Specifically, the issue I ran into was that was renaming > 'foo' to 'bar', but lookups for 'bar' were still returning the old file. The > reason was that a lookup after the namei(RENAME) of the destination while > ufs_rename() had its locks dropped was readding the name cache entry for > 'bar', and then a cache_lookup() of 'bar' would return the old vnode as long > as that vnode was valid (e.g. if it had a link in another location, or other > processes had an open file descriptor for it). I'm currently testing the > patch below: > I now have a scenario that fails, but not quite the same way you describe. It looks like this: touch file1 echo xxx > file2 rename(file1, file2) A different process performs stat() on both files in a tight loop. Once in a while I observe that a stat() of file2, after the rename, returns a link count of zero. Size is zero as expected, but the inode number of file2 is unchanged. I've been running the same test with your patch and not observed this problem. This on UFS2 with SU enabled. Regards, - Peter From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 13:41:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C9E8106567A; Fri, 2 Mar 2012 13:41:51 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 1DEB68FC1D; Fri, 2 Mar 2012 13:41:51 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id AFC3F3592F2; Fri, 2 Mar 2012 14:41:49 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 9291228470; Fri, 2 Mar 2012 14:41:49 +0100 (CET) Date: Fri, 2 Mar 2012 14:41:49 +0100 From: Jilles Tjoelker To: Tijl Coosemans Message-ID: <20120302134149.GA6416@stack.nl> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120229160522.W2514@besplex.bde.org> <20120229181608.S2887@besplex.bde.org> <201203012346.20648.tijl@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203012346.20648.tijl@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric , Bruce Evans Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 13:41:51 -0000 On Thu, Mar 01, 2012 at 11:46:20PM +0100, Tijl Coosemans wrote: > On Wednesday 29 February 2012 08:44:54 Bruce Evans wrote: > > On Wed, 29 Feb 2012, Bruce Evans wrote: > >> I cleaned this up a bit according to ideas in my previous mails, and > >> added a comment about the confusing use of __bswap64_const() (now > >> named __bswap64_gen()) in __bswap64_var(): > > A minor problem with only having a macro version for __bswap64() turned > > up: > >> % -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) > >> % - > >> % -#define __bswap16(_x) \ > >> % - (__builtin_constant_p(_x) ? \ > >> % - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) > >> ... > >> % +#define ___bswap16(x) (__uint16_t)((x) << 8 | (x) >> 8) > >> % +#define __bswap16(x) (___bswap16((__uint16_t)(x))) > > When x a non-volatile variable, gcc and clang produce the good code > > "rolw $8,x" for "x = __bswap16(x);" on short x. But when x a a volatile > > variable, gcc and clang produce fairly horrible code, with 2 loads of > > x corresponding to the 2 accesses to x. This is probably required by > > volatile semantics, and is a problem for all unsafe macros, especially > > when their name says that they are safe (oops). When __bswap16 is > > implemented as an inline function for the var case like it used to be, > > it only loads x once and there are no problems with volatile variables. > > Optimizing to "rolw $8,x" might still be possible iff x is not volatile, > > but load-modify-store is probably better anyway. Assuming there is no use having the value in a register, the instruction with a memory operand tends to be slightly faster on modern CPUs and (more importantly) is shorter than the three instructions necessary otherwise. > > So any macro version must use gcc features to be safe. The following > > seems to work: > > #define __bswap16(x) __extension__ ({ __uint16_t __x = x; > > (__uint16_t)(__x << 8 | __x >> 8); }) > > clang now produces "rolw $8,x" when x is volatile. This seems to > > violate volatile semantics. gcc produces load-rolw-store then. Both > > produce "rolw $8,x" when x is not volatile. I don't think volatile means there must be a race condition in a read-modify-write even if there is only one core or only one thread. Whether load-rolw-store or rolw on memory is used, the memory location is read once and written once, as required by volatile semantics. > I'll have a closer look at the patch tomorrow, but the Intel > documentation for the bswap instruction recommends to use xchg for > bswap16. So does the AMD documentation. This seems strange because the rolw $8 is both more flexible (allows memory operands and registers other than %ax/%bx/%cx/%dx) and faster on almost all CPUs (per Agner Fog's instruction tables, plus a penalty for recombining the high and low bytes after the xchg on CPUs that split partial registers). The xchg instruction is two bytes shorter but this is probably not worth it except if you're writing a boot loader or similar. Do take into account that documentation like "Instruction Set Reference" is intended to describe how the instructions work, not how to use them to obtain the very best performance on a particular chip. -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 14:05:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 72E56106564A; Fri, 2 Mar 2012 14:05:50 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6C38FC14; Fri, 2 Mar 2012 14:05:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22E5oSQ033408; Fri, 2 Mar 2012 14:05:50 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22E5oCj033406; Fri, 2 Mar 2012 14:05:50 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201203021405.q22E5oCj033406@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 2 Mar 2012 14:05: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: r232393 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 14:05:50 -0000 Author: ru Date: Fri Mar 2 14:05:50 2012 New Revision: 232393 URL: http://svn.freebsd.org/changeset/base/232393 Log: Removed excessive _seekdir() call in closedir(). This saves one lseek() syscall. Before r5958, seekdir() was called for its side effect of freeing memory allocated by opendir() for rewinddir(), but that revision added _reclaim_telldir() that frees all memory allocated by telldir() calls, making this call redundant. This introduces a slight change. If an application duplicated the descriptor obtained through dirfd(), it can no longer rely on file position to be reset to the start of file after a call to closedir(). It's believed to be safe because neither POSIX, nor any other OS I've tested (NetBSD, Linux, OS X) rewind the file offset pointer on closedir(). Reported by: Igor Sysoev Modified: head/lib/libc/gen/closedir.c Modified: head/lib/libc/gen/closedir.c ============================================================================== --- head/lib/libc/gen/closedir.c Fri Mar 2 13:19:56 2012 (r232392) +++ head/lib/libc/gen/closedir.c Fri Mar 2 14:05:50 2012 (r232393) @@ -48,14 +48,12 @@ __FBSDID("$FreeBSD$"); * close a directory. */ int -closedir(dirp) - DIR *dirp; +closedir(DIR *dirp) { int fd; if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); - _seekdir(dirp, dirp->dd_rewind); /* free seekdir storage */ fd = dirp->dd_fd; dirp->dd_fd = -1; dirp->dd_loc = 0; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 15:57:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E2E761065780 for ; Fri, 2 Mar 2012 15:57:09 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob6.rzone.de (mo-p00-ob6.rzone.de [IPv6:2a01:238:20a:202:53f0::1]) by mx1.freebsd.org (Postfix) with ESMTP id 725A08FC1F for ; Fri, 2 Mar 2012 15:57:09 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/afgnrylsiW+yaTV9ow4J X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (ip-109-45-146-157.web.vodafone.de [109.45.146.157]) by smtp.strato.de (fruni mo43) (RZmta 27.7 DYNA|AUTH) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id Q02c96o22EHJV9 for ; Fri, 2 Mar 2012 16:55:55 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Fri, 02 Mar 2012 16:55:51 +0100 Date: Fri, 2 Mar 2012 16:55:51 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Message-ID: <20120302155551.GB31508@britannica.bec.de> References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <20120229151223.K2273@besplex.bde.org> <201203012347.32984.tijl@freebsd.org> <20120302132403.P929@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120302132403.P929@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 15:57:10 -0000 On Fri, Mar 02, 2012 at 03:11:21PM +1100, Bruce Evans wrote: > >If we could add the returns_twice attribute to setjmp() then the > >compiler makes sure all registers are dead before calling it and > >jmp_buf wouldn't have to be that big. > > I think compilers already do stuff like that automatically. They have > to for setjmp() to work. Since there was no way to declare such > attributes 20 years ago, compilers had to know that setjmp() was > special and make it work when it only has a Standard C declaration > (and some magic in its inmplementation). It is an existing bug in FreeBSD that the *kernel* doesn't have such attribution. Since it is using -ffreestanding, interference is incorrect. LLVM recently moved the attribution logic from the LLVM librarie into the C frontend where it belongs, but this does have the negative side effect that it no longer magically fixes up issues for -ffreestanding. Joerg From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 16:38:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C0C2A1065670; Fri, 2 Mar 2012 16:38:55 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90AD68FC1C; Fri, 2 Mar 2012 16:38:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22GctEp038517; Fri, 2 Mar 2012 16:38:55 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22GctMk038514; Fri, 2 Mar 2012 16:38:55 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201203021638.q22GctMk038514@svn.freebsd.org> From: Sean Bruno Date: Fri, 2 Mar 2012 16:38:55 +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: r232397 - in stable/7/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 16:38:55 -0000 Author: sbruno Date: Fri Mar 2 16:38:54 2012 New Revision: 232397 URL: http://svn.freebsd.org/changeset/base/232397 Log: MFC r232267 via stable/8 MFC r232354 Workaround for PCIe 4GB boundary issue Enforce a boundary of no more than 4GB - transfers crossing a 4GB boundary can lead to data corruption due to PCIe limitations. This change is a less-intrusive workaround that can be quickly merged back to older branches; a cleaner implementation will arrive in HEAD later but may require KPI changes. This change is based on a suggestion by jhb@. Modified: stable/7/sys/amd64/amd64/busdma_machdep.c stable/7/sys/i386/i386/busdma_machdep.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/amd64/amd64/busdma_machdep.c ============================================================================== --- stable/7/sys/amd64/amd64/busdma_machdep.c Fri Mar 2 16:35:18 2012 (r232396) +++ stable/7/sys/amd64/amd64/busdma_machdep.c Fri Mar 2 16:38:54 2012 (r232397) @@ -215,6 +215,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; + /* Always enforce at least a 4GB boundary. */ + if (boundary == 0 || boundary > ((bus_addr_t)1 << 32)) + boundary = (bus_size_t)1 << 32; + /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; Modified: stable/7/sys/i386/i386/busdma_machdep.c ============================================================================== --- stable/7/sys/i386/i386/busdma_machdep.c Fri Mar 2 16:35:18 2012 (r232396) +++ stable/7/sys/i386/i386/busdma_machdep.c Fri Mar 2 16:38:54 2012 (r232397) @@ -220,6 +220,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; +#if defined(PAE) + /* Need at least a 4GB boundary, PAE limitations require 2GB */ + if (boundary == 0 || boundary > ((bus_addr_t)1 << 31)) + boundary = (bus_size_t)1 << 31; +#endif + /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 16:39:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2615F1065692; Fri, 2 Mar 2012 16:39:01 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E45C78FC1B; Fri, 2 Mar 2012 16:39:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22Gd0Ef038557; Fri, 2 Mar 2012 16:39:00 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22Gd0I9038554; Fri, 2 Mar 2012 16:39:00 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201203021639.q22Gd0I9038554@svn.freebsd.org> From: Sean Bruno Date: Fri, 2 Mar 2012 16:39:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232398 - in stable/6/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 16:39:01 -0000 Author: sbruno Date: Fri Mar 2 16:39:00 2012 New Revision: 232398 URL: http://svn.freebsd.org/changeset/base/232398 Log: MFC r232267 via stable/8 MFC r232354 Workaround for PCIe 4GB boundary issue Enforce a boundary of no more than 4GB - transfers crossing a 4GB boundary can lead to data corruption due to PCIe limitations. This change is a less-intrusive workaround that can be quickly merged back to older branches; a cleaner implementation will arrive in HEAD later but may require KPI changes. This change is based on a suggestion by jhb@. Modified: stable/6/sys/amd64/amd64/busdma_machdep.c stable/6/sys/i386/i386/busdma_machdep.c Directory Properties: stable/6/sys/ (props changed) Modified: stable/6/sys/amd64/amd64/busdma_machdep.c ============================================================================== --- stable/6/sys/amd64/amd64/busdma_machdep.c Fri Mar 2 16:38:54 2012 (r232397) +++ stable/6/sys/amd64/amd64/busdma_machdep.c Fri Mar 2 16:39:00 2012 (r232398) @@ -216,6 +216,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; + /* Always enforce at least a 4GB boundary. */ + if (boundary == 0 || boundary > ((bus_addr_t)1 << 32)) + boundary = (bus_size_t)1 << 32; + /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; Modified: stable/6/sys/i386/i386/busdma_machdep.c ============================================================================== --- stable/6/sys/i386/i386/busdma_machdep.c Fri Mar 2 16:38:54 2012 (r232397) +++ stable/6/sys/i386/i386/busdma_machdep.c Fri Mar 2 16:39:00 2012 (r232398) @@ -219,6 +219,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_dma_tag_t newtag; int error = 0; +#if defined(PAE) + /* Need at least a 4GB boundary, PAE limitations require 2GB */ + if (boundary == 0 || boundary > ((bus_addr_t)1 << 31)) + boundary = (bus_size_t)1 << 31; +#endif + /* Basic sanity checking */ if (boundary != 0 && boundary < maxsegsz) maxsegsz = boundary; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 17:33:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34A9F106566C; Fri, 2 Mar 2012 17:33:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 206708FC17; Fri, 2 Mar 2012 17:33:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22HXpAI040362; Fri, 2 Mar 2012 17:33:51 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22HXpBx040360; Fri, 2 Mar 2012 17:33:51 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201203021733.q22HXpBx040360@svn.freebsd.org> From: Alan Cox Date: Fri, 2 Mar 2012 17:33: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: r232399 - 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: Fri, 02 Mar 2012 17:33:52 -0000 Author: alc Date: Fri Mar 2 17:33:51 2012 New Revision: 232399 URL: http://svn.freebsd.org/changeset/base/232399 Log: Eliminate stale incorrect ARGSUSED comments. Submitted by: bde Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Fri Mar 2 16:39:00 2012 (r232398) +++ head/sys/vm/vm_mmap.c Fri Mar 2 17:33:51 2012 (r232399) @@ -139,7 +139,6 @@ struct getpagesize_args { }; #endif -/* ARGSUSED */ int ogetpagesize(td, uap) struct thread *td; @@ -682,7 +681,6 @@ struct madvise_args { /* * MPSAFE */ -/* ARGSUSED */ int sys_madvise(td, uap) struct thread *td; @@ -746,7 +744,6 @@ struct mincore_args { /* * MPSAFE */ -/* ARGSUSED */ int sys_mincore(td, uap) struct thread *td; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 18:18:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 817EA106564A; Fri, 2 Mar 2012 18:18:15 +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 6D10E8FC19; Fri, 2 Mar 2012 18:18:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22IIF80041735; Fri, 2 Mar 2012 18:18:15 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22IIFlv041733; Fri, 2 Mar 2012 18:18:15 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201203021818.q22IIFlv041733@svn.freebsd.org> From: Andreas Tobler Date: Fri, 2 Mar 2012 18: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: r232400 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 18:18:15 -0000 Author: andreast Date: Fri Mar 2 18:18:14 2012 New Revision: 232400 URL: http://svn.freebsd.org/changeset/base/232400 Log: Fix typo. Modified: head/sys/dev/iicbus/ds1775.c Modified: head/sys/dev/iicbus/ds1775.c ============================================================================== --- head/sys/dev/iicbus/ds1775.c Fri Mar 2 17:33:51 2012 (r232399) +++ head/sys/dev/iicbus/ds1775.c Fri Mar 2 18:18:14 2012 (r232400) @@ -87,7 +87,7 @@ static driver_t ds1775_driver = { static devclass_t ds1775_devclass; -DRIVER_MODULE(ds1755, iicbus, ds1775_driver, ds1775_devclass, 0, 0); +DRIVER_MODULE(ds1775, iicbus, ds1775_driver, ds1775_devclass, 0, 0); static int ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data) From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 18:19:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BAC271065678; Fri, 2 Mar 2012 18:19:37 +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 86CCF8FC15; Fri, 2 Mar 2012 18:19:37 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 3B91B46B0A; Fri, 2 Mar 2012 13:19:37 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8159FB948; Fri, 2 Mar 2012 13:19:36 -0500 (EST) From: John Baldwin To: Bruce Evans Date: Fri, 2 Mar 2012 09:52:33 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201202281815.q1SIFSbB082030@svn.freebsd.org> <201203012346.00228.tijl@freebsd.org> <20120302151400.Y1224@besplex.bde.org> In-Reply-To: <20120302151400.Y1224@besplex.bde.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203020952.33378.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 02 Mar 2012 13:19:36 -0500 (EST) Cc: svn-src-head@freebsd.org, Tijl Coosemans , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r232261 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 18:19:37 -0000 On Friday, March 02, 2012 12:10:38 am Bruce Evans wrote: > It's too late to change vm types. The distinction between addresses > and sizes became useful first with file offsets (vm_ooffset_t. BTW, > what is an o offset?) and then for physical offsets. The 'o' stands for 'object', so 'vm_ooffset_t' is a VM object offset (at least that's my interpretation). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 18:19:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8721D1065674; Fri, 2 Mar 2012 18:19: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 47F788FC19; Fri, 2 Mar 2012 18:19:39 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id F0FA946B2E; Fri, 2 Mar 2012 13:19:38 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 571A2B922; Fri, 2 Mar 2012 13:19:38 -0500 (EST) From: John Baldwin To: Peter Holm Date: Fri, 2 Mar 2012 11:53:06 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201203011647.41313.jhb@freebsd.org> <20120302132921.GA40934@x2.osted.lan> In-Reply-To: <20120302132921.GA40934@x2.osted.lan> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203021153.06614.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 02 Mar 2012 13:19:38 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 18:19:39 -0000 On Friday, March 02, 2012 8:29:21 am Peter Holm wrote: > On Thu, Mar 01, 2012 at 04:47:41PM -0500, John Baldwin wrote: > > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > > Author: pho > > > Date: Mon Oct 31 15:01:47 2011 > > > New Revision: 226967 > > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > > > Log: > > > The kern_renameat() looks up the fvp using the DELETE flag, which causes > > > the removal of the name cache entry for fvp. > > > > > > Reported by: Anton Yuzhaninov > > > In collaboration with: kib > > > MFC after: 1 week > > > > > > Modified: > > > head/sys/ufs/ufs/ufs_vnops.c > > > > So I ran into this at work recently, and even this fix applied I was still > > seeing rename()'s that were seemingly not taking effect. After getting some > > extra KTR traces, I figured out that the same purge needs to be applied to the > > destination vnode. Specifically, the issue I ran into was that was renaming > > 'foo' to 'bar', but lookups for 'bar' were still returning the old file. The > > reason was that a lookup after the namei(RENAME) of the destination while > > ufs_rename() had its locks dropped was readding the name cache entry for > > 'bar', and then a cache_lookup() of 'bar' would return the old vnode as long > > as that vnode was valid (e.g. if it had a link in another location, or other > > processes had an open file descriptor for it). I'm currently testing the > > patch below: > > > > I now have a scenario that fails, but not quite the same way you > describe. > > It looks like this: > > touch file1 > echo xxx > file2 > rename(file1, file2) > > A different process performs stat() on both files in a tight loop. > > Once in a while I observe that a stat() of file2, after the rename, > returns a link count of zero. Size is zero as expected, but the inode > number of file2 is unchanged. Hmm, that is surprising. I would not expect inconsistent stat info. I have no explanation for why that would happen. I do not have a simplified test program, just a specific workload at work. In this case it's workflow is more like this: fd = flopen(file1, O_CREAT); fstat(fd); if (st.st_size == 0) { fd2 = open(file1.temp, O_CREAT | O_EXLOCK); fd3 = open(someotherfile); copy_data(fd3, fdf2); close(fd3); rename(file1.temp, file1); close(fd); fd = fd2; } link(file1, uniquedir/file1); close(fd); /* Use uniquedir/file1, and unlink it when done. */ What I observed was that sometimes uniquedir/file1 would end up referencing the empty file created by flopen() after the rename() rather than linking to the file created when file1.temp was created. > I've been running the same test with your patch and not observed this > problem. This on UFS2 with SU enabled. Hmm, I wish I could explain explain your odd result above in terms of this bug, but the results from stat() should always be consistent (VOP_GETATTR() can't switch vnodes mid-stream as it were). BTW, note that in my case where I had multiple processes all doing the same loop, in the edge case, another process always had the file open (and was blocked in flock() in flopen()) when the rename() happened, so that prevented the vnode from going away. This is important as otherwise the use count would drop to zero and marked inactive which removes all references to it from the name cache. In my case the flock() in flopen() and the fact that the "first" process held the flock until after the rename and call to link() made the race more likely to trigger. Hmm, perhaps one way to do this would be: touch file.always (save its i-node) fork worker process that just continually does a 'stat file1' in a loop main process: ln file.always file1 touch file2 rename file2 file1 stat file1 complain if file1 has the saved i-node Hmm, I just whipped up something to do this and it fails early and often on an unpatched kernel, but does not with my patch. #include #include #include #include #include #include #include #include static char *always, *file1, *file2; static ino_t always_ino; static void usage(void) { fprintf(stderr, "Usage: rename_race \n"); exit(1); } static void child(void) { struct stat sb; /* Exit as soon as our parent exits. */ while (getppid() != 1) { stat(file1, &sb); } exit(0); } static void create_file(const char *path) { int fd; fd = open(path, O_CREAT, 0666); if (fd < 0) err(1, "open(%s)", path); close(fd); } int main(int ac, char **av) { struct stat sb, sb2; pid_t pid; if (ac != 2) usage(); if (stat(av[1], &sb) != 0) err(1, "stat(%s)", av[1]); if (!S_ISDIR(sb.st_mode)) errx(1, "%s not a directory", av[1]); asprintf(&always, "%s/file.always", av[1]); asprintf(&file1, "%s/file1", av[1]); asprintf(&file2, "%s/file2", av[1]); create_file(always); if (stat(always, &sb) != 0) err(1, "stat(%s)", always); always_ino = sb.st_ino; pid = fork(); if (pid < 0) err(1, "fork"); if (pid == 0) child(); for (;;) { if (unlink(file1) < 0 && errno != ENOENT) err(1, "unlink(%s)", file1); if (link(always, file1) < 0) err(1, "link(%s, %s)", always, file1); create_file(file2); if (stat(file2, &sb2) < 0) err(1, "stat(%s)", file2); if (rename(file2, file1) < 0) err(1, "rename(%s, %s)", file2, file1); if (stat(file1, &sb) < 0) err(1, "stat(%s)", file1); if (sb.st_ino != sb2.st_ino || sb.st_ino == always_ino) printf("Bad stat: always: %d file1: %d (should be %d)\n", always_ino, sb.st_ino, sb2.st_ino); } return (0); } -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 18:55:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE953106566C; Fri, 2 Mar 2012 18:55:19 +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 D7B0A8FC21; Fri, 2 Mar 2012 18:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22ItJFL042971; Fri, 2 Mar 2012 18:55:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22ItJtT042968; Fri, 2 Mar 2012 18:55:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203021855.q22ItJtT042968@svn.freebsd.org> From: John Baldwin Date: Fri, 2 Mar 2012 18:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232401 - in head/sys: fs/tmpfs ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 18:55:20 -0000 Author: jhb Date: Fri Mar 2 18:55:19 2012 New Revision: 232401 URL: http://svn.freebsd.org/changeset/base/232401 Log: Similar to the fixes in 226967 and 226987, purge any name cache entries associated with the previous vnode (if any) associated with the target of a rename(). Otherwise, a lookup of the target pathname concurrent with a rename() could re-add a name cache entry after the namei(RENAME) lookup in kern_renameat() had purged the target pathname. MFC after: 2 weeks Modified: head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 2 18:18:14 2012 (r232400) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 2 18:55:19 2012 (r232401) @@ -1135,6 +1135,8 @@ tmpfs_rename(struct vop_rename_args *v) tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE); } cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); error = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Fri Mar 2 18:18:14 2012 (r232400) +++ head/sys/ufs/ufs/ufs_vnops.c Fri Mar 2 18:55:19 2012 (r232401) @@ -1534,8 +1534,15 @@ relock: * ufs_lookup_ino() and then VFS_VGET(), another thread might do a * normal lookup of the from name just before the VFS_VGET() call, * causing the cache entry to be re-instantiated. + * + * The same issue also applies to tvp if it exists as + * otherwise we may have a stale name cache entry for the new + * name that references the old i-node if it has other links + * or open file descriptors. */ cache_purge(fvp); + if (tvp) + cache_purge(tvp); unlockout: vput(fdvp); From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 20:29:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1FDE1065672; Fri, 2 Mar 2012 20:29:17 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay003.isp.belgacom.be (mailrelay003.isp.belgacom.be [195.238.6.53]) by mx1.freebsd.org (Postfix) with ESMTP id 423DE8FC13; Fri, 2 Mar 2012 20:29:15 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAL8sUU9bsWcW/2dsb2JhbABDsTyCfIEIgX0BAQVWIxALDgouOR4GiB25Uo9kBIgdiUSWUw Received: from 22.103-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.103.22]) by relay.skynet.be with ESMTP; 02 Mar 2012 21:29:14 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q22KTDCu005297; Fri, 2 Mar 2012 21:29:13 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Bruce Evans Date: Fri, 2 Mar 2012 21:29:00 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120302130435.J929@besplex.bde.org> <20120302223355.Q2543@besplex.bde.org> In-Reply-To: <20120302223355.Q2543@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart26093839.3xFXd3iPZv"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201203022129.10849.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 20:29:17 -0000 --nextPart26093839.3xFXd3iPZv Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Friday 02 March 2012 12:52:41 Bruce Evans wrote: > On Fri, 2 Mar 2012, Bruce Evans wrote: >=20 > > On Thu, 1 Mar 2012, Tijl Coosemans wrote: > > > >> On Wednesday 29 February 2012 08:44:54 Bruce Evans wrote: > >>> ... > >>> So any macro version must use gcc features to be safe. The following > >>> seems to work: > >>>=20 > >>> #define __bswap16(x) __extension__ ({ __uint16_t __x =3D x; > >>> (__uint16_t)(__x << 8 | __x >> 8); }) > >>>=20 > >>> clang now produces "rolw $8,x" when x is volatile. This seems to > >>> violate volatile semantics. gcc produces load-rolw-store then. Both > >>> produce "rolw $8,x" when x is not volatile. > >>=20 > >> I'll have a closer look at the patch tomorrow, but the Intel > >> documentation for the bswap instruction recommends to use xchg for > >> bswap16. > > > > That's what i386 used to do, using an asm (see for example the RELENG_4 > > version), but the asm was replaced by C code and the compiler apparently > > knows better. This might depend on -mtune. I tested with the default, > > ... >=20 > Here is another version. It has now been tested a bit at runtime. > I had to restore almost all of the complications, so the following > reduces to mostly style changes including comments about surprising > details. It has 1 fix for clang (the comitted version doesn't > work for clang). >=20 > % Index: endian.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 > % RCS file: /home/ncvs/src/sys/x86/include/endian.h,v > % retrieving revision 1.1 > % diff -u -2 -r1.1 endian.h > % --- endian.h 28 Feb 2012 19:39:54 -0000 1.1 > % +++ endian.h 2 Mar 2012 10:43:53 -0000 > % @@ -37,8 +37,4 @@ > % #include > %=20 > % -#ifdef __cplusplus > % -extern "C" { > % -#endif > % - > % /* > % * Define the order of 32-bit words in 64-bit words. > % @@ -68,25 +64,17 @@ > % #endif > %=20 > % -#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) > % - > % -#define __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) > % +#define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8) > % +#define __bswap32_gen(x) \ > % + (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16)) > % +#define __bswap64_gen(x) \ > % + (((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32)) > %=20 > % -#define __bswap16(_x) \ > % - (__builtin_constant_p(_x) ? \ > % - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x)) > % - > % -#define __bswap32_const(_x) \ > % - (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16)) > % - > % -#define __bswap32(_x) \ > % - (__builtin_constant_p(_x) ? \ > % - __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x)) > % +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) > %=20 > % -#define __bswap64_const(_x) \ > % - (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32)) > % +/* The following mess is to avoid multiple evaluation of x. */ > %=20 > % -#define __bswap64(_x) \ > % - (__builtin_constant_p(_x) ? \ > % - __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x)) > % +#define __bswap16(x) \ > % + (__builtin_constant_p(x) ? \ > % + __bswap16_gen((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x))) >=20 > For clang, x must be cast in the `var' clause too, since when x is > something like 0x12345678 (having been passed here without conversion > by __bswap32()), clang parses the `var' clause and warns about the > implicit truncation of 0x12345678 to 0x5678 in it. This is a bug > in clang -- when warning about fine details, it is important not to > do it for non-problems. >=20 > %=20 > % static __inline __uint16_t > % @@ -94,7 +82,19 @@ > % { > %=20 > % - return (__bswap16_const(_x)); > % + return (__bswap16_gen(_x)); > % } > %=20 > % +/* > % + * The following messes are old optimizations for gcc. The messes have > % + * been reduced significantly, but I don't know how to implement the > % + * preferred way of defining defaults above and overriding them cleanly > % + * here. Even clang needs help for the 64-bit case, so to keep the > % + * ifdefs sane we use this for the 32-bit case with clang too. > % + */ > % + > % +#define __bswap32(x) \ > % + (__builtin_constant_p(x) ? \ > % + __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) > % + > % static __inline __uint32_t > % __bswap32_var(__uint32_t _x) > % @@ -105,34 +105,37 @@ > % } > %=20 > % +#define __bswap64(x) \ > % + (__builtin_constant_p(x) ? \ > % + __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x)) > % + > % static __inline __uint64_t > % __bswap64_var(__uint64_t _x) > % { > % -#ifdef _LP64 > % + > % +#ifdef _LP64 > % __asm ("bswap %0" : "+r" (_x)); > % return (_x); > % #else > % - return (__bswap64_const(_x)); > % + /* > % + * It is important for the optimizations that the following is not > % + * really generic, but expands to 2 __bswap32_var()'s. > % + */ > % + return (__bswap64_gen(_x)); > % #endif > % } > %=20 > % -#define __htonl(x) __bswap32(x) > % -#define __htons(x) __bswap16(x) > % -#define __ntohl(x) __bswap32(x) > % -#define __ntohs(x) __bswap16(x) > % +#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ > %=20 > % -#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */ > % - > % -/* > % - * No optimizations are available for this compiler. Fall back to > % - * non-optimized functions by defining the constant usually used to pr= event > % - * redefinition. > % - */ > % -#define _BYTEORDER_FUNC_DEFINED > % +/* XXX these are broken, since they evaluate x more than once. */ Maybe make them static inline functions. That won't be very efficient at =2DO0 but it'll be correct and this implementation probably isn't very efficient anyway. Otherwise the patch looks good to me. > % +#define __bswap16(x) (__bswap16_gen((__uint16_t)(x))) > % +#define __bswap32(x) (__bswap32_gen((__uint32_t)(x))) > % +#define __bswap64(x) (__bswap64_gen((__uint64_t)(x))) > %=20 > % #endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ > %=20 > % -#ifdef __cplusplus > % -} > % -#endif > % +#define __htonl(x) __bswap32(x) > % +#define __htons(x) __bswap16(x) > % +#define __ntohl(x) __bswap32(x) > % +#define __ntohs(x) __bswap16(x) > %=20 > % #endif /* !_MACHINE_ENDIAN_H_ */ --nextPart26093839.3xFXd3iPZv Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk9RLZYACgkQfoCS2CCgtium0QD9Fj2tmyw4NZPOavHtHihtQsUV 4LcQFnwfHsHdhZg4L20A/RZYbbqqQtSQlQh91qF6fS0ycfua46zMGI/BN4E0jqUC =uzCf -----END PGP SIGNATURE----- --nextPart26093839.3xFXd3iPZv-- From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 20:34:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7482106564A; Fri, 2 Mar 2012 20:34:15 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C317A8FC08; Fri, 2 Mar 2012 20:34:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22KYFMk046225; Fri, 2 Mar 2012 20:34:15 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22KYFdC046223; Fri, 2 Mar 2012 20:34:15 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201203022034.q22KYFdC046223@svn.freebsd.org> From: Juli Mallett Date: Fri, 2 Mar 2012 20:34: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: r232402 - head/sys/mips/cavium X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 20:34:15 -0000 Author: jmallett Date: Fri Mar 2 20:34:15 2012 New Revision: 232402 URL: http://svn.freebsd.org/changeset/base/232402 Log: Unbreak SMP on stock Octeon systems -- copy the core_mask from bootinfo into sysinfo. This should have been done as part of replacing bootinfo with sysinfo. Modified: head/sys/mips/cavium/octeon_machdep.c Modified: head/sys/mips/cavium/octeon_machdep.c ============================================================================== --- head/sys/mips/cavium/octeon_machdep.c Fri Mar 2 18:55:19 2012 (r232401) +++ head/sys/mips/cavium/octeon_machdep.c Fri Mar 2 20:34:15 2012 (r232402) @@ -575,6 +575,7 @@ octeon_process_app_desc_ver_6(void) octeon_bootinfo->compact_flash_common_base_addr; cvmx_sysinfo_get()->compact_flash_attribute_base_addr = octeon_bootinfo->compact_flash_attribute_base_addr; + cvmx_sysinfo_get()->core_mask = octeon_bootinfo->core_mask; } static void From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 20:38:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D213106566B; Fri, 2 Mar 2012 20:38:05 +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 859D78FC14; Fri, 2 Mar 2012 20:38:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22Kc56Y046383; Fri, 2 Mar 2012 20:38:05 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22Kc5vd046376; Fri, 2 Mar 2012 20:38:05 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203022038.q22Kc5vd046376@svn.freebsd.org> From: John Baldwin Date: Fri, 2 Mar 2012 20:38: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: r232403 - in head/sys: dev/acpica dev/cardbus dev/pci powerpc/ofw 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: Fri, 02 Mar 2012 20:38:05 -0000 Author: jhb Date: Fri Mar 2 20:38:04 2012 New Revision: 232403 URL: http://svn.freebsd.org/changeset/base/232403 Log: - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. The tag enforces a single restriction that all DMA transactions must not cross a 4GB boundary. Note that while this restriction technically only applies to PCI-express, this change applies it to all PCI devices as it is simpler to implement that way and errs on the side of caution. - Add a softc structure for PCI bus devices to hold the bus_dma tag and a new pci_attach_common() routine that performs actions common to the attach phase of all PCI bus drivers. Right now this only consists of a bootverbose printf and the allocate of a bus_dma tag if necessary. - Adjust all PCI bus drivers to allocate a PCI bus softc and to call pci_attach_common() from their attach routines. MFC after: 2 weeks Modified: head/sys/dev/acpica/acpi_pci.c head/sys/dev/cardbus/cardbus.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_private.h head/sys/powerpc/ofw/ofw_pcibus.c head/sys/sparc64/pci/ofw_pcibus.c Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Fri Mar 2 20:34:15 2012 (r232402) +++ head/sys/dev/acpica/acpi_pci.c Fri Mar 2 20:38:04 2012 (r232403) @@ -99,7 +99,8 @@ static device_method_t acpi_pci_methods[ static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, 0, pci_driver); +DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, sizeof(struct pci_softc), + pci_driver); DRIVER_MODULE(acpi_pci, pcib, acpi_pci_driver, pci_devclass, 0, 0); MODULE_DEPEND(acpi_pci, acpi, 1, 1, 1); MODULE_DEPEND(acpi_pci, pci, 1, 1, 1); @@ -276,7 +277,11 @@ acpi_pci_probe(device_t dev) static int acpi_pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -286,9 +291,6 @@ acpi_pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * First, PCI devices are added as in the normal PCI bus driver. Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Fri Mar 2 20:34:15 2012 (r232402) +++ head/sys/dev/cardbus/cardbus.c Fri Mar 2 20:38:04 2012 (r232403) @@ -316,6 +316,7 @@ static device_method_t cardbus_methods[] DEVMETHOD(device_resume, cardbus_resume), /* Bus interface */ + DEVMETHOD(bus_get_dma_tag, bus_generic_get_dma_tag), DEVMETHOD(bus_read_ivar, cardbus_read_ivar), DEVMETHOD(bus_driver_added, cardbus_driver_added), Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Mar 2 20:34:15 2012 (r232402) +++ head/sys/dev/pci/pci.c Fri Mar 2 20:38:04 2012 (r232403) @@ -70,6 +70,19 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" #include "pci_if.h" +/* + * XXX: Due to a limitation of the bus_dma_tag_create() API, we cannot + * specify a 4GB boundary on 32-bit targets. Usually this does not + * matter as it is ok to use a boundary of 0 on these systems. + * However, in the case of PAE, DMA addresses can cross a 4GB + * boundary, so as a workaround use a 2GB boundary. + */ +#ifdef PAE +#define PCI_DMA_BOUNDARY (1u << 31) +#else +#define PCI_DMA_BOUNDARY ((bus_size_t)((uint64_t)1 << 32)) +#endif + #define PCIR_IS_BIOS(cfg, reg) \ (((cfg)->hdrtype == PCIM_HDRTYPE_NORMAL && reg == PCIR_BIOS) || \ ((cfg)->hdrtype == PCIM_HDRTYPE_BRIDGE && reg == PCIR_BIOS_1)) @@ -95,6 +108,7 @@ static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); static char *pci_describe_device(device_t dev); +static bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev); static int pci_modevent(module_t mod, int what, void *arg); static void pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg); @@ -137,6 +151,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_setup_intr, pci_setup_intr), DEVMETHOD(bus_teardown_intr, pci_teardown_intr), + DEVMETHOD(bus_get_dma_tag, pci_get_dma_tag), DEVMETHOD(bus_get_resource_list,pci_get_resource_list), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), @@ -173,7 +188,7 @@ static device_method_t pci_methods[] = { DEVMETHOD_END }; -DEFINE_CLASS_0(pci, pci_driver, pci_methods, 0); +DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc)); static devclass_t pci_devclass; DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0); @@ -3124,10 +3139,41 @@ pci_probe(device_t dev) return (BUS_PROBE_GENERIC); } +int +pci_attach_common(device_t dev) +{ + struct pci_softc *sc; + int busno, domain, error; + + sc = device_get_softc(dev); + domain = pcib_get_domain(dev); + busno = pcib_get_bus(dev); + if (bootverbose) + device_printf(dev, "domain=%d, physical bus=%d\n", + domain, busno); + if (device_get_devclass(device_get_parent(device_get_parent(dev))) != + devclass_find("pci")) { + error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, + PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->sc_dma_tag); + if (error) + device_printf(dev, "Failed to create DMA tag: %d\n", + error); + else + sc->sc_dma_tag_valid = 1; + } + return (0); +} + static int pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -3137,9 +3183,6 @@ pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); pci_add_children(dev, domain, busno, sizeof(struct pci_devinfo)); return (bus_generic_attach(dev)); } @@ -4226,6 +4269,16 @@ pci_get_resource_list (device_t dev, dev return (&dinfo->resources); } +bus_dma_tag_t +pci_get_dma_tag(device_t bus, device_t dev) +{ + struct pci_softc *sc = device_get_softc(bus); + + if (sc->sc_dma_tag_valid) + return (sc->sc_dma_tag); + return (bus_generic_get_dma_tag(bus, dev)); +} + uint32_t pci_read_config_method(device_t dev, device_t child, int reg, int width) { Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Fri Mar 2 20:34:15 2012 (r232402) +++ head/sys/dev/pci/pci_private.h Fri Mar 2 20:38:04 2012 (r232403) @@ -38,6 +38,11 @@ */ DECLARE_CLASS(pci_driver); +struct pci_softc { + bus_dma_tag_t sc_dma_tag; + int sc_dma_tag_valid; +}; + extern int pci_do_power_resume; extern int pci_do_power_suspend; @@ -46,6 +51,7 @@ void pci_add_children(device_t dev, int void pci_add_child(device_t bus, struct pci_devinfo *dinfo); void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask); +int pci_attach_common(device_t dev); void pci_delete_child(device_t dev, device_t child); void pci_driver_added(device_t dev, driver_t *driver); int pci_print_child(device_t dev, device_t child); Modified: head/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 2 20:34:15 2012 (r232402) +++ head/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 2 20:38:04 2012 (r232403) @@ -95,8 +95,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0); MODULE_VERSION(ofw_pcibus, 1); MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1); @@ -116,12 +116,13 @@ static int ofw_pcibus_attach(device_t dev) { u_int busno, domain; + int error; + error = pci_attach_common(dev); + if (error) + return (error); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * Attach those children represented in the device tree. Modified: head/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- head/sys/sparc64/pci/ofw_pcibus.c Fri Mar 2 20:34:15 2012 (r232402) +++ head/sys/sparc64/pci/ofw_pcibus.c Fri Mar 2 20:38:04 2012 (r232403) @@ -100,8 +100,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_pcibus, 1); @@ -230,13 +230,14 @@ ofw_pcibus_attach(device_t dev) phandle_t node, child; uint32_t clock; u_int busno, domain, func, slot; + int error; + error = pci_attach_common(dev); + if (error) + return (error); pcib = device_get_parent(dev); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); node = ofw_bus_get_node(dev); /* From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 20:42:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D237106564A for ; Fri, 2 Mar 2012 20:42:27 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay01.pair.com (relay01.pair.com [209.68.5.15]) by mx1.freebsd.org (Postfix) with SMTP id 601A78FC1A for ; Fri, 2 Mar 2012 20:42:26 +0000 (UTC) Received: (qmail 36847 invoked from network); 2 Mar 2012 20:42:25 -0000 Received: from 87.58.144.241 (HELO x2.osted.lan) (87.58.144.241) by relay01.pair.com with SMTP; 2 Mar 2012 20:42:25 -0000 X-pair-Authenticated: 87.58.144.241 Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.4/8.14.4) with ESMTP id q22KgOgJ051718; Fri, 2 Mar 2012 21:42:24 +0100 (CET) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.4/8.14.4/Submit) id q22KgNB8051717; Fri, 2 Mar 2012 21:42:23 +0100 (CET) (envelope-from pho) Date: Fri, 2 Mar 2012 21:42:23 +0100 From: Peter Holm To: John Baldwin Message-ID: <20120302204223.GA51629@x2.osted.lan> References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201203011647.41313.jhb@freebsd.org> <20120302132921.GA40934@x2.osted.lan> <201203021153.06614.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203021153.06614.jhb@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: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 20:42:27 -0000 On Fri, Mar 02, 2012 at 11:53:06AM -0500, John Baldwin wrote: > On Friday, March 02, 2012 8:29:21 am Peter Holm wrote: > > On Thu, Mar 01, 2012 at 04:47:41PM -0500, John Baldwin wrote: > > > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > > > Author: pho > > > > Date: Mon Oct 31 15:01:47 2011 > > > > New Revision: 226967 > > > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > > > > > Log: > > > > The kern_renameat() looks up the fvp using the DELETE flag, which causes > > > > the removal of the name cache entry for fvp. > > > > > > > > Reported by: Anton Yuzhaninov > > > > In collaboration with: kib > > > > MFC after: 1 week > > > > > > > > Modified: > > > > head/sys/ufs/ufs/ufs_vnops.c > > > > > > So I ran into this at work recently, and even this fix applied I was still > > > seeing rename()'s that were seemingly not taking effect. After getting some > > > extra KTR traces, I figured out that the same purge needs to be applied to the > > > destination vnode. Specifically, the issue I ran into was that was renaming > > > 'foo' to 'bar', but lookups for 'bar' were still returning the old file. The > > > reason was that a lookup after the namei(RENAME) of the destination while > > > ufs_rename() had its locks dropped was readding the name cache entry for > > > 'bar', and then a cache_lookup() of 'bar' would return the old vnode as long > > > as that vnode was valid (e.g. if it had a link in another location, or other > > > processes had an open file descriptor for it). I'm currently testing the > > > patch below: > > > > > > > I now have a scenario that fails, but not quite the same way you > > describe. > > > > It looks like this: > > > > touch file1 > > echo xxx > file2 > > rename(file1, file2) > > > > A different process performs stat() on both files in a tight loop. > > > > Once in a while I observe that a stat() of file2, after the rename, > > returns a link count of zero. Size is zero as expected, but the inode > > number of file2 is unchanged. > > Hmm, that is surprising. I would not expect inconsistent stat info. I > have no explanation for why that would happen. I do not have a simplified > test program, just a specific workload at work. In this case it's workflow > is more like this: > > fd = flopen(file1, O_CREAT); > fstat(fd); > if (st.st_size == 0) { > fd2 = open(file1.temp, O_CREAT | O_EXLOCK); > fd3 = open(someotherfile); > copy_data(fd3, fdf2); > close(fd3); > rename(file1.temp, file1); > close(fd); > fd = fd2; > } > link(file1, uniquedir/file1); > close(fd); > > /* Use uniquedir/file1, and unlink it when done. */ > > What I observed was that sometimes uniquedir/file1 would end up referencing > the empty file created by flopen() after the rename() rather than linking > to the file created when file1.temp was created. > > > I've been running the same test with your patch and not observed this > > problem. This on UFS2 with SU enabled. > > Hmm, I wish I could explain explain your odd result above in terms of this > bug, but the results from stat() should always be consistent (VOP_GETATTR() > can't switch vnodes mid-stream as it were). > > BTW, note that in my case where I had multiple processes all doing the same > loop, in the edge case, another process always had the file open (and was > blocked in flock() in flopen()) when the rename() happened, so that prevented > the vnode from going away. This is important as otherwise the use count would > drop to zero and marked inactive which removes all references to it from the > name cache. In my case the flock() in flopen() and the fact that the "first" > process held the flock until after the rename and call to link() made the > race more likely to trigger. > > Hmm, perhaps one way to do this would be: > > touch file.always (save its i-node) > fork worker process that just continually does a 'stat file1' in a loop > main process: > ln file.always file1 > touch file2 > rename file2 file1 > stat file1 > complain if file1 has the saved i-node > > Hmm, I just whipped up something to do this and it fails early and often on > an unpatched kernel, but does not with my patch. > > #include > #include > #include > #include > #include > #include > #include > #include > > static char *always, *file1, *file2; > static ino_t always_ino; > > static void > usage(void) > { > fprintf(stderr, "Usage: rename_race \n"); > exit(1); > } > > static void > child(void) > { > struct stat sb; > > /* Exit as soon as our parent exits. */ > while (getppid() != 1) { > stat(file1, &sb); > } > exit(0); > } > > static void > create_file(const char *path) > { > int fd; > > fd = open(path, O_CREAT, 0666); > if (fd < 0) > err(1, "open(%s)", path); > close(fd); > } > > int > main(int ac, char **av) > { > struct stat sb, sb2; > pid_t pid; > > if (ac != 2) > usage(); > if (stat(av[1], &sb) != 0) > err(1, "stat(%s)", av[1]); > if (!S_ISDIR(sb.st_mode)) > errx(1, "%s not a directory", av[1]); > > asprintf(&always, "%s/file.always", av[1]); > asprintf(&file1, "%s/file1", av[1]); > asprintf(&file2, "%s/file2", av[1]); > > create_file(always); > if (stat(always, &sb) != 0) > err(1, "stat(%s)", always); > always_ino = sb.st_ino; > > pid = fork(); > if (pid < 0) > err(1, "fork"); > if (pid == 0) > child(); > for (;;) { > if (unlink(file1) < 0 && errno != ENOENT) > err(1, "unlink(%s)", file1); > if (link(always, file1) < 0) > err(1, "link(%s, %s)", always, file1); > create_file(file2); > if (stat(file2, &sb2) < 0) > err(1, "stat(%s)", file2); > if (rename(file2, file1) < 0) > err(1, "rename(%s, %s)", file2, file1); > if (stat(file1, &sb) < 0) > err(1, "stat(%s)", file1); > if (sb.st_ino != sb2.st_ino || > sb.st_ino == always_ino) > printf("Bad stat: always: %d file1: %d (should be %d)\n", > always_ino, sb.st_ino, sb2.st_ino); > } > return (0); > } > Excellent test scenario! For the tmpfs case I do not see any problems using both our scenarios on a pristine HEAD. -- Peter From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:17:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 84983106566B; Fri, 2 Mar 2012 21:17:25 +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 6F56F8FC08; Fri, 2 Mar 2012 21:17:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22LHPP0047626; Fri, 2 Mar 2012 21:17:25 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22LHP87047624; Fri, 2 Mar 2012 21:17:25 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201203022117.q22LHP87047624@svn.freebsd.org> From: Ed Schouten Date: Fri, 2 Mar 2012 21:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232404 - stable/9/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, 02 Mar 2012 21:17:25 -0000 Author: ed Date: Fri Mar 2 21:17:24 2012 New Revision: 232404 URL: http://svn.freebsd.org/changeset/base/232404 Log: MFC r231376: Remove outdated piece of information. devtoname() always returns a pathname to the device. It will never return a #major/minor string. Modified: stable/9/share/man/man9/devtoname.9 Directory Properties: stable/9/share/man/ (props changed) stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/devtoname.9 ============================================================================== --- stable/9/share/man/man9/devtoname.9 Fri Mar 2 20:38:04 2012 (r232403) +++ stable/9/share/man/man9/devtoname.9 Fri Mar 2 21:17:24 2012 (r232404) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 19, 2012 +.Dd February 10, 2012 .Dt DEVTONAME 9 .Os .Sh NAME @@ -41,15 +41,6 @@ The function returns a pointer to the name of the device passed to it. The name is whatever was set to it in .Fn make_dev . -If no name is associated with -.Va dev , -a pointer to a string consisting of a -.Dq # -followed by -.Dq Va major Ns / Ns Va minor -as it applies to -.Va dev -is returned. .Sh HISTORY The .Fn devtoname From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:29:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 48A631065672; Fri, 2 Mar 2012 21:29:58 +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 30D7D8FC13; Fri, 2 Mar 2012 21:29:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22LTwxH048065; Fri, 2 Mar 2012 21:29:58 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22LTvMY048053; Fri, 2 Mar 2012 21:29:57 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201203022129.q22LTvMY048053@svn.freebsd.org> From: Ed Schouten Date: Fri, 2 Mar 2012 21:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232405 - in stable/9/sys: compat/linux dev/iscsi/initiator dev/sound/pcm dev/usb netgraph security/mac_biba security/mac_lomac security/mac_mls 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, 02 Mar 2012 21:29:58 -0000 Author: ed Date: Fri Mar 2 21:29:57 2012 New Revision: 232405 URL: http://svn.freebsd.org/changeset/base/232405 Log: MFC r231378: Remove direct access to si_name. Code should just use the devtoname() function to obtain the name of a character device. Also add const keywords to pieces of code that need it to build properly. Modified: stable/9/sys/compat/linux/linux_stats.c stable/9/sys/compat/linux/linux_util.c stable/9/sys/compat/linux/linux_util.h stable/9/sys/dev/iscsi/initiator/isc_sm.c stable/9/sys/dev/sound/pcm/mixer.c stable/9/sys/dev/usb/usb_dev.c stable/9/sys/netgraph/ng_device.c stable/9/sys/security/mac_biba/mac_biba.c stable/9/sys/security/mac_lomac/mac_lomac.c stable/9/sys/security/mac_mls/mac_mls.c stable/9/sys/vm/swap_pager.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/linux/linux_stats.c ============================================================================== --- stable/9/sys/compat/linux/linux_stats.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/compat/linux/linux_stats.c Fri Mar 2 21:29:57 2012 (r232405) @@ -66,7 +66,7 @@ translate_vnhook_major_minor(struct vnod int major, minor; if (vp->v_type == VCHR && vp->v_rdev != NULL && - linux_driver_get_major_minor(vp->v_rdev->si_name, + linux_driver_get_major_minor(devtoname(vp->v_rdev), &major, &minor) == 0) { sb->st_rdev = (major << 8 | minor); } @@ -149,14 +149,14 @@ translate_fd_major_minor(struct thread * return; vp = fp->f_vnode; if (vp != NULL && vp->v_rdev != NULL && - linux_driver_get_major_minor(vp->v_rdev->si_name, + linux_driver_get_major_minor(devtoname(vp->v_rdev), &major, &minor) == 0) { buf->st_rdev = (major << 8 | minor); } else if (fp->f_type == DTYPE_PTS) { struct tty *tp = fp->f_data; /* Convert the numbers for the slave device. */ - if (linux_driver_get_major_minor(tp->t_dev->si_name, + if (linux_driver_get_major_minor(devtoname(tp->t_dev), &major, &minor) == 0) { buf->st_rdev = (major << 8 | minor); } Modified: stable/9/sys/compat/linux/linux_util.c ============================================================================== --- stable/9/sys/compat/linux/linux_util.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/compat/linux/linux_util.c Fri Mar 2 21:29:57 2012 (r232405) @@ -124,7 +124,7 @@ linux_driver_get_name_dev(device_t dev) } int -linux_driver_get_major_minor(char *node, int *major, int *minor) +linux_driver_get_major_minor(const char *node, int *major, int *minor) { struct device_element *de; Modified: stable/9/sys/compat/linux/linux_util.h ============================================================================== --- stable/9/sys/compat/linux/linux_util.h Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/compat/linux/linux_util.h Fri Mar 2 21:29:57 2012 (r232405) @@ -97,7 +97,7 @@ struct linux_device_handler { int linux_device_register_handler(struct linux_device_handler *h); int linux_device_unregister_handler(struct linux_device_handler *h); char *linux_driver_get_name_dev(device_t dev); -int linux_driver_get_major_minor(char *node, int *major, int *minor); +int linux_driver_get_major_minor(const char *node, int *major, int *minor); char *linux_get_char_devices(void); void linux_free_get_char_devices(char *string); Modified: stable/9/sys/dev/iscsi/initiator/isc_sm.c ============================================================================== --- stable/9/sys/dev/iscsi/initiator/isc_sm.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/dev/iscsi/initiator/isc_sm.c Fri Mar 2 21:29:57 2012 (r232405) @@ -652,13 +652,13 @@ static void isc_add_sysctls(isc_session_t *sp) { debug_called(8); - sdebug(6, "sid=%d %s", sp->sid, sp->dev->si_name); + sdebug(6, "sid=%d %s", sp->sid, devtoname(sp->dev)); sysctl_ctx_init(&sp->clist); sp->oid = SYSCTL_ADD_NODE(&sp->clist, SYSCTL_CHILDREN(sp->isc->oid), OID_AUTO, - sp->dev->si_name+5, // iscsi0 + devtoname(sp->dev) + 5, // iscsi0 CTLFLAG_RD, 0, "initiator"); Modified: stable/9/sys/dev/sound/pcm/mixer.c ============================================================================== --- stable/9/sys/dev/sound/pcm/mixer.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/dev/sound/pcm/mixer.c Fri Mar 2 21:29:57 2012 (r232405) @@ -1463,7 +1463,7 @@ mixer_oss_mixerinfo(struct cdev *i_dev, * * XXX Described by Hannu@4Front, but not found in * soundcard.h. - strlcpy(mi->devnode, d->mixer_dev->si_name, + strlcpy(mi->devnode, devtoname(d->mixer_dev), sizeof(mi->devnode)); mi->legacy_device = i; */ Modified: stable/9/sys/dev/usb/usb_dev.c ============================================================================== --- stable/9/sys/dev/usb/usb_dev.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/dev/usb/usb_dev.c Fri Mar 2 21:29:57 2012 (r232405) @@ -842,7 +842,7 @@ usb_open(struct cdev *dev, int fflags, i struct usb_cdev_privdata *cpd; int err, ep; - DPRINTFN(2, "%s fflags=0x%08x\n", dev->si_name, fflags); + DPRINTFN(2, "%s fflags=0x%08x\n", devtoname(dev), fflags); KASSERT(fflags & (FREAD|FWRITE), ("invalid open flags")); if (((fflags & FREAD) && !(pd->mode & FREAD)) || Modified: stable/9/sys/netgraph/ng_device.c ============================================================================== --- stable/9/sys/netgraph/ng_device.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/netgraph/ng_device.c Fri Mar 2 21:29:57 2012 (r232405) @@ -203,6 +203,7 @@ ng_device_rcvmsg(node_p node, item_p ite const priv_p priv = NG_NODE_PRIVATE(node); struct ng_mesg *msg; struct ng_mesg *resp = NULL; + const char *dn; int error = 0; NGI_GET_MSG(item, msg); @@ -217,8 +218,8 @@ ng_device_rcvmsg(node_p node, item_p ite if (resp == NULL) ERROUT(ENOMEM); - strlcpy((char *)resp->data, priv->ngddev->si_name, - strlen(priv->ngddev->si_name) + 1); + dn = devtoname(priv->ngddev); + strlcpy((char *)resp->data, dn, strlen(dn) + 1); break; default: Modified: stable/9/sys/security/mac_biba/mac_biba.c ============================================================================== --- stable/9/sys/security/mac_biba/mac_biba.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/security/mac_biba/mac_biba.c Fri Mar 2 21:29:57 2012 (r232405) @@ -948,18 +948,20 @@ biba_devfs_create_device(struct ucred *c struct cdev *dev, struct devfs_dirent *de, struct label *delabel) { struct mac_biba *mb; + const char *dn; int biba_type; mb = SLOT(delabel); - if (strcmp(dev->si_name, "null") == 0 || - strcmp(dev->si_name, "zero") == 0 || - strcmp(dev->si_name, "random") == 0 || - strncmp(dev->si_name, "fd/", strlen("fd/")) == 0) + dn = devtoname(dev); + if (strcmp(dn, "null") == 0 || + strcmp(dn, "zero") == 0 || + strcmp(dn, "random") == 0 || + strncmp(dn, "fd/", strlen("fd/")) == 0) biba_type = MAC_BIBA_TYPE_EQUAL; else if (ptys_equal && - (strncmp(dev->si_name, "ttyp", strlen("ttyp")) == 0 || - strncmp(dev->si_name, "pts/", strlen("pts/")) == 0 || - strncmp(dev->si_name, "ptyp", strlen("ptyp")) == 0)) + (strncmp(dn, "ttyp", strlen("ttyp")) == 0 || + strncmp(dn, "pts/", strlen("pts/")) == 0 || + strncmp(dn, "ptyp", strlen("ptyp")) == 0)) biba_type = MAC_BIBA_TYPE_EQUAL; else biba_type = MAC_BIBA_TYPE_HIGH; Modified: stable/9/sys/security/mac_lomac/mac_lomac.c ============================================================================== --- stable/9/sys/security/mac_lomac/mac_lomac.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/security/mac_lomac/mac_lomac.c Fri Mar 2 21:29:57 2012 (r232405) @@ -1032,19 +1032,21 @@ lomac_devfs_create_device(struct ucred * struct cdev *dev, struct devfs_dirent *de, struct label *delabel) { struct mac_lomac *ml; + const char *dn; int lomac_type; ml = SLOT(delabel); - if (strcmp(dev->si_name, "null") == 0 || - strcmp(dev->si_name, "zero") == 0 || - strcmp(dev->si_name, "random") == 0 || - strncmp(dev->si_name, "fd/", strlen("fd/")) == 0 || - strncmp(dev->si_name, "ttyv", strlen("ttyv")) == 0) + dn = devtoname(dev); + if (strcmp(dn, "null") == 0 || + strcmp(dn, "zero") == 0 || + strcmp(dn, "random") == 0 || + strncmp(dn, "fd/", strlen("fd/")) == 0 || + strncmp(dn, "ttyv", strlen("ttyv")) == 0) lomac_type = MAC_LOMAC_TYPE_EQUAL; else if (ptys_equal && - (strncmp(dev->si_name, "ttyp", strlen("ttyp")) == 0 || - strncmp(dev->si_name, "pts/", strlen("pts/")) == 0 || - strncmp(dev->si_name, "ptyp", strlen("ptyp")) == 0)) + (strncmp(dn, "ttyp", strlen("ttyp")) == 0 || + strncmp(dn, "pts/", strlen("pts/")) == 0 || + strncmp(dn, "ptyp", strlen("ptyp")) == 0)) lomac_type = MAC_LOMAC_TYPE_EQUAL; else lomac_type = MAC_LOMAC_TYPE_HIGH; Modified: stable/9/sys/security/mac_mls/mac_mls.c ============================================================================== --- stable/9/sys/security/mac_mls/mac_mls.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/security/mac_mls/mac_mls.c Fri Mar 2 21:29:57 2012 (r232405) @@ -908,21 +908,23 @@ mls_devfs_create_device(struct ucred *cr struct cdev *dev, struct devfs_dirent *de, struct label *delabel) { struct mac_mls *mm; + const char *dn; int mls_type; mm = SLOT(delabel); - if (strcmp(dev->si_name, "null") == 0 || - strcmp(dev->si_name, "zero") == 0 || - strcmp(dev->si_name, "random") == 0 || - strncmp(dev->si_name, "fd/", strlen("fd/")) == 0) + dn = devtoname(dev); + if (strcmp(dn, "null") == 0 || + strcmp(dn, "zero") == 0 || + strcmp(dn, "random") == 0 || + strncmp(dn, "fd/", strlen("fd/")) == 0) mls_type = MAC_MLS_TYPE_EQUAL; - else if (strcmp(dev->si_name, "kmem") == 0 || - strcmp(dev->si_name, "mem") == 0) + else if (strcmp(dn, "kmem") == 0 || + strcmp(dn, "mem") == 0) mls_type = MAC_MLS_TYPE_HIGH; else if (ptys_equal && - (strncmp(dev->si_name, "ttyp", strlen("ttyp")) == 0 || - strncmp(dev->si_name, "pts/", strlen("pts/")) == 0 || - strncmp(dev->si_name, "ptyp", strlen("ptyp")) == 0)) + (strncmp(dn, "ttyp", strlen("ttyp")) == 0 || + strncmp(dn, "pts/", strlen("pts/")) == 0 || + strncmp(dn, "ptyp", strlen("ptyp")) == 0)) mls_type = MAC_MLS_TYPE_EQUAL; else mls_type = MAC_MLS_TYPE_LOW; Modified: stable/9/sys/vm/swap_pager.c ============================================================================== --- stable/9/sys/vm/swap_pager.c Fri Mar 2 21:17:24 2012 (r232404) +++ stable/9/sys/vm/swap_pager.c Fri Mar 2 21:29:57 2012 (r232405) @@ -2320,7 +2320,7 @@ swapoff_all(void) TAILQ_FOREACH_SAFE(sp, &swtailq, sw_list, spt) { mtx_unlock(&sw_dev_mtx); if (vn_isdisk(sp->sw_vp, NULL)) - devname = sp->sw_vp->v_rdev->si_name; + devname = devtoname(sp->sw_vp->v_rdev); else devname = "[file]"; error = swapoff_one(sp, thread0.td_ucred); @@ -2358,7 +2358,7 @@ int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len) { struct swdevt *sp; - char *tmp_devname; + const char *tmp_devname; int error, n; n = 0; @@ -2376,7 +2376,7 @@ swap_dev_info(int name, struct xswdev *x xs->xsw_used = sp->sw_used; if (devname != NULL) { if (vn_isdisk(sp->sw_vp, NULL)) - tmp_devname = sp->sw_vp->v_rdev->si_name; + tmp_devname = devtoname(sp->sw_vp->v_rdev); else tmp_devname = "[file]"; strncpy(devname, tmp_devname, len); From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:31:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CAAC1065680; Fri, 2 Mar 2012 21:31:50 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay006.isp.belgacom.be (mailrelay006.isp.belgacom.be [195.238.6.172]) by mx1.freebsd.org (Postfix) with ESMTP id CF8CA8FC08; Fri, 2 Mar 2012 21:31:48 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAD87UU9bsWcW/2dsb2JhbABDsTyCfIEIgX0BAQQBViMFCwsOCi45HgaIFAm5RooIhVwEiB2gF4FT Received: from 22.103-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.103.22]) by relay.skynet.be with ESMTP; 02 Mar 2012 22:31:46 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q22LVjdm005574; Fri, 2 Mar 2012 22:31:46 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Bruce Evans Date: Fri, 2 Mar 2012 22:31:37 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <201203012347.32984.tijl@freebsd.org> <20120302132403.P929@besplex.bde.org> In-Reply-To: <20120302132403.P929@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart4108460.GOc4c6QogL"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201203022231.43186.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 21:31:50 -0000 --nextPart4108460.GOc4c6QogL Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Friday 02 March 2012 05:11:21 Bruce Evans wrote: > On Thu, 1 Mar 2012, Tijl Coosemans wrote: >> Also, from ISO C: "All accessible objects have values, and all other >> components of the abstract machine [249] have state, as of the time the >> longjmp function was called" >> >> "[249] This includes, but is not limited to, the floating-point status >> flags and the state of open files." >> >> So I think storing mxcsr in jmp_buf is incorrect. >=20 > This is a well known bug in ISO C. ISO C never even tried to support > longjmp() from signal handlers, but we do. Supporting them requires > restoring significant parts of the FP environment. I fixed this for > the i387 control word in FreeBSD about 20 years ago. This was required > even to support float to integer conversions on i386. The situation > with these has changed a bit. It was: > - there is a default rounding mode. C didn't support changing it. It > is normally round-to-nearest. But for float to integer conversions, > it is round-towards-zero. To implement the latter, compilers switch > the mode to the latter mode. In old versions of FreeBSD, and still > with COMPAT4 signal handlers, handling of the FP state in signal > handlers was mostly incorrect. Signal handlers were passed the > current FP state, except for clobbering the exception flags for > SIGFPE's for hardware FP exceptions. Thus it was normal for signal > handlers to see the rounding mode switched to round-towards-zero. > This is not part of the abstract machine. A normal rounding mode > must be restored somehow. C90 didn't support changing the rounding > mode, so it would have been correct for C90 to hard-code the rounding > mode at the time of main() in signal handlers if you knew what that > was (it really should be set in crt or inherited across exec, instead > of being hard-coded in the kernel like it is in FreeBSD). But i387 > supports changing the rounding mode. It is simplest to restore it > to that at the time of the setjmp(). > Now, things are even more complicated: > - signal handlers are normally passed a clean FP state. (Since C > barely supports signal handlers, it doesn't say anything about this). > Now, longjmp() from a signal handler would return this clean state > if no FP state is restored, unless the signal handler does some FP > operations that dirty its clean state. Returning the clean state > has much the same effect in simple cases as restoring the state at > the time of the setjmp(), because nothing except the compiler doing > the float to integer conversions changes the state from its default, > and the longjmp() takes us to a point where the compiler is not doing > these conversions so it is correct for the normal state to be > restored. There is now the minor simplication that i386 with SSE > doesn't need the mode switch for floats, and i386 with SSE2 doesn't > need it for doubles; but i386 still needs it for long doubles. SSE3 also added FISTTP instruction that converts to integer with truncation. > There > is the minor complication that the signal handler may be COMPAT4, > in which case its FP state is not clean and the old method must be > used -- longjmp() can hardly be expected to tell which type the > signal handler is and adjust its behaviour to match. > - C now supports changing the rounding mode. Its requirement that > longjmp() not restore the previous rounding mode may be correct for > some cases, but it is broken for longjmp() out of signal handlers: > - suppose the signal handler gets a clean state, as in FreeBSD. Then > any longjmp() out of a signal handler that doesn't restore the > rounding mode (or any other part of the FP env) resets to the clean > state (which should be the same as the default state); this state > may differ from the state at the time of the setjmp() and also from > the state at the time of the signal. This is broken. Perhaps the > - suppose the signal handler doesn't get a clean state. Who knows > what it is? Standards don't specify this. Even if the signal > handler understands everything, then it will have a hard time > cleaning up the state so that it is right at the time of the > longjmp(). Note that it is not just SIGFPE handlers for hardware > FP exceptions that would need to understand everything about FP > to do the right thing. _All_ signal handlers would need this, > since for example a harmless SIGINT handler might be interrupting > a FP operation that changes the FP env in ways outside of the > abstract machine. >=20 > Next, there are the FP exception flags. C90 doesn't support these, and > I didn't worry about these 20 years ago. I just put the i386 FP control > word in jmp_buf, and used fninit to clean out everything else in the > FP env. Now, C99 supports these. These should not be changed by > longjmp(). However, for the case of longjmp() from a signal handler, > if nothing is restored, then all of them will be be cleared by the > longjmp() in the usual case where the signal handler doesn't dirty > its clean state. Worse, if the signal handler dirties it state and > doesn't do this intentionally to prepare for the longjmp(), then the > main part of the program gets its exception flags replaced by the > signal handler. Again, it is very difficult for signal handlers to > understand FP well enough to do the right thing. SIGFPE ones have to > understand a little more here. They have to understand that the kernel > doesn't understand this stuff, so it has destroyed the exception flags > in the saved state after only making a lossy copy of them (in the > signal code). Destruction of the exception flags allows the case of > returning from a signal handler to sort of work (the SIGFPE doesn't > repeat). This problem only occurs if signals for FP exceptions are > unmasked. Otherwise, SIGFPE never occurs for FP exceptions, but only > for integer exceptions like division by 0. >=20 > The amd64 _setjmp.S and setjmp.S (but not its sigsetjmp.S) save mxcsr > in setjmp but only restores the non-flags from it in longjmp; it loses > the fninit (except in sigsetjmp.S): >=20 > % setjmp: > % fnstcw 64(%rcx) /* 8; fpu cw */ > % stmxcsr 68(%rcx) /* and mxcsr */ > % longjmp: > % /* Restore the mxcsr, but leave exception flags intact. */ > % stmxcsr -4(%rsp) > % movl 68(%rdx),%eax > % andl $0xffffffc0,%eax > % movl -4(%rsp),%edi > % andl $0x3f,%edi > % xorl %eax,%edi > % movl %edi,-4(%rsp) > % ldmxcsr -4(%rsp) > % ... > % // lost fninit here > % fldcw 64(%rdx) >=20 > For longjmp() from signal handlers, leaving the exception flags intact > is worse than useless, since these are only the signal handler's > exception flags (it would be better to clear them). >=20 > On i386, the bugs are similar, except the mxcsr is not touched: > - fninit has been removed from _setjmp.S and setjmp.S > - sigsetjmp.S has not been touched (so it is missing mxcsr handling, > but still does fninit). >=20 > Removing the fninits is very large breakage in the i386 case. amd64 > doesn't support COMPAT4 signal handlers. Thus its signal handlers > start with a clean state and fninit in them only cleans up any dirt > made by the signal handler, and there is rarely even minor dirt. > But for i386 with a COMPAT4 signal handler, when a signal interrupts > an FP operation, the i387 FP stack always has something on it. > This needs to be cleaned before or by longmp() if longjmp() is used > to quit the signal handler. Without COMPAT4 signal handlers, the > only obvious bug is that leaving the i387 exception flags intact is > worse than useless, the same as for then the sr part of mxcsr. >=20 > Other things in the FP env are less portable so they are less used so > they cause fewer problems. Standards don't support many other things, > so the implementation can be correct for them even if the standard > requires brokenness for other parts of the env. i387 precision control > is an example. Thanks, that was quite informative. C11 does say something about the =46P env and signals now though: ``When the processing of the abstract machine is interrupted by receipt of a signal, the values of objects that are neither lock-free atomic objects nor of type volatile sig_atomic_t are unspecified, as is the state of the floating-point environment. The value of any object modified by the handler that is neither a lock-free atomic object nor of type volatile sig_atomic_t becomes indeterminate when the handler exits, as does the state of the floating-point environment if it is modified by the handler and not restored to its original state.'' This means a signal handler must not rely on the state of the FP env. It may install its own FP env if needed (e.g. FE_DFL_ENV), but then it must restore the original before returning. This allows for the rounding mode to be silently modified for integer conversions for instance. If longjmp is not supposed to change the FP env then, when called from a signal handler, either the signal handler must install a proper FP env before calling longjmp or a proper FP env must be installed after the target setjmp call. Otherwise the FP env is unspecified. --nextPart4108460.GOc4c6QogL Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF0EABEIAAYFAk9RPD8ACgkQfoCS2CCgtisf9AD6AwgLOyAdGJXp+BuruSn2PgXn n2mW1jTiRinSLXryIlgA+IotQDuOIJlWuzaf+nfFTc6KWGuEagdZrhSjCMaDLJE= =Soep -----END PGP SIGNATURE----- --nextPart4108460.GOc4c6QogL-- From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:36:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4CCF1065679; Fri, 2 Mar 2012 21:36:24 +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 9FE948FC16; Fri, 2 Mar 2012 21:36:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22LaOZH048361; Fri, 2 Mar 2012 21:36:24 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22LaOPJ048359; Fri, 2 Mar 2012 21:36:24 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201203022136.q22LaOPJ048359@svn.freebsd.org> From: Ed Schouten Date: Fri, 2 Mar 2012 21:36:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232406 - stable/9/usr.sbin/vipw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 21:36:24 -0000 Author: ed Date: Fri Mar 2 21:36:24 2012 New Revision: 232406 URL: http://svn.freebsd.org/changeset/base/232406 Log: MFC r231383, r231385 and r231648: Detect file modification properly by using tv_nsec. POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond precision to detect file modification. Modified: stable/9/usr.sbin/vipw/vipw.8 Directory Properties: stable/9/usr.sbin/vipw/ (props changed) Modified: stable/9/usr.sbin/vipw/vipw.8 ============================================================================== --- stable/9/usr.sbin/vipw/vipw.8 Fri Mar 2 21:29:57 2012 (r232405) +++ stable/9/usr.sbin/vipw/vipw.8 Fri Mar 2 21:36:24 2012 (r232406) @@ -28,7 +28,7 @@ .\" @(#)vipw.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 1993 +.Dd February 14, 2012 .Dt VIPW 8 .Os .Sh NAME @@ -112,8 +112,11 @@ utility appeared in .Bx 4.0 . .Sh BUGS The mechanism for checking for password file modifications requires that +the modification time of the password file changes. +This means that in a default configuration where file system timestamps +are not calculated with sub-second precision, .Ev EDITOR -run for at least one second. +has to run for at least one second. Non-interactive editor scripts should invoke .Xr sleep 1 or equivalent to ensure this happens. From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:38:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 838641065672; Fri, 2 Mar 2012 21:38:27 +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 6F6648FC15; Fri, 2 Mar 2012 21:38:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22LcRxR048505; Fri, 2 Mar 2012 21:38:27 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22LcRZ2048502; Fri, 2 Mar 2012 21:38:27 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201203022138.q22LcRZ2048502@svn.freebsd.org> From: Ed Schouten Date: Fri, 2 Mar 2012 21:38:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232408 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 21:38:27 -0000 Author: ed Date: Fri Mar 2 21:38:27 2012 New Revision: 232408 URL: http://svn.freebsd.org/changeset/base/232408 Log: MFC r231514: Set read buffer size to multiple of sizeof(struct futx). If the utmpx database gets updated while an application is reading it, there is a chance the reading application processes partially overwritten entries. To solve this, make sure we always read a multiple of sizeof(struct futx) at a time. Modified: stable/9/lib/libc/gen/getutxent.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/getutxent.c ============================================================================== --- stable/9/lib/libc/gen/getutxent.c Fri Mar 2 21:38:06 2012 (r232407) +++ stable/9/lib/libc/gen/getutxent.c Fri Mar 2 21:38:27 2012 (r232408) @@ -70,13 +70,18 @@ setutxdb(int db, const char *file) if (uf == NULL) return (-1); - /* Safety check: never use broken files. */ - if (db != UTXDB_LOG && _fstat(fileno(uf), &sb) != -1 && - sb.st_size % sizeof(struct futx) != 0) { - fclose(uf); - uf = NULL; - errno = EFTYPE; - return (-1); + if (db != UTXDB_LOG) { + /* Safety check: never use broken files. */ + if (_fstat(fileno(uf), &sb) != -1 && + sb.st_size % sizeof(struct futx) != 0) { + fclose(uf); + uf = NULL; + errno = EFTYPE; + return (-1); + } + /* Prevent reading of partial records. */ + (void)setvbuf(uf, NULL, _IOFBF, + rounddown(BUFSIZ, sizeof(struct futx))); } udb = db; From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:44:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 052551065670; Fri, 2 Mar 2012 21:44:40 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E48658FC16; Fri, 2 Mar 2012 21:44:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22LidaS048731; Fri, 2 Mar 2012 21:44:39 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22LiddI048729; Fri, 2 Mar 2012 21:44:39 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201203022144.q22LiddI048729@svn.freebsd.org> From: Juli Mallett Date: Fri, 2 Mar 2012 21:44:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232409 - head/sys/mips/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, 02 Mar 2012 21:44:40 -0000 Author: jmallett Date: Fri Mar 2 21:44:39 2012 New Revision: 232409 URL: http://svn.freebsd.org/changeset/base/232409 Log: If an Atheros device is attached to an Octeon, it's going to be by PCI. Modified: head/sys/mips/conf/OCTEON1 Modified: head/sys/mips/conf/OCTEON1 ============================================================================== --- head/sys/mips/conf/OCTEON1 Fri Mar 2 21:38:27 2012 (r232408) +++ head/sys/mips/conf/OCTEON1 Fri Mar 2 21:44:39 2012 (r232409) @@ -237,6 +237,7 @@ device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros NIC's +device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:45:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48FC51065670; Fri, 2 Mar 2012 21:45:54 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id CF4CD8FC12; Fri, 2 Mar 2012 21:45:53 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q22LjquI073502; Fri, 2 Mar 2012 22:45:52 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q22LjqCv073501; Fri, 2 Mar 2012 22:45:52 +0100 (CET) (envelope-from marius) Date: Fri, 2 Mar 2012 22:45:52 +0100 From: Marius Strobl To: John Baldwin Message-ID: <20120302214551.GB1635@alchemy.franken.de> References: <201203022038.q22Kc5vd046376@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203022038.q22Kc5vd046376@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: r232403 - in head/sys: dev/acpica dev/cardbus dev/pci powerpc/ofw 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: Fri, 02 Mar 2012 21:45:54 -0000 On Fri, Mar 02, 2012 at 08:38:05PM +0000, John Baldwin wrote: > Author: jhb > Date: Fri Mar 2 20:38:04 2012 > New Revision: 232403 > URL: http://svn.freebsd.org/changeset/base/232403 > > Log: > - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. > The tag enforces a single restriction that all DMA transactions must not > cross a 4GB boundary. Note that while this restriction technically only > applies to PCI-express, this change applies it to all PCI devices as it > is simpler to implement that way and errs on the side of caution. Hrm, wouldn't it have been more appropriate to implement this in the Host-PCI bridges instead? Probably for anything but x86 this would allow to easily distinguish at least between PCI and PCI-Express capable bus hierarchies and would move the PAE workaround to the MD bits to where it belongs. Marius From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:46:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71CE41065678; Fri, 2 Mar 2012 21:46:32 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 446378FC1A; Fri, 2 Mar 2012 21:46:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22LkWsJ048834; Fri, 2 Mar 2012 21:46:32 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22LkWU8048831; Fri, 2 Mar 2012 21:46:32 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201203022146.q22LkWU8048831@svn.freebsd.org> From: Juli Mallett Date: Fri, 2 Mar 2012 21:46: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: r232410 - in head/sys/mips: cavium 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: Fri, 02 Mar 2012 21:46:32 -0000 Author: jmallett Date: Fri Mar 2 21:46:31 2012 New Revision: 232410 URL: http://svn.freebsd.org/changeset/base/232410 Log: When creating a handle for a subregion, be sure to actually math out the new handle address, where we're using handles as raw addresses. This fixes devices with subregions on Octeon PCI specifically, and likely also on MIPS more generally, where there isn't another bus_space in use that was doing the math already. Modified: head/sys/mips/cavium/octopci_bus_space.c head/sys/mips/mips/bus_space_generic.c Modified: head/sys/mips/cavium/octopci_bus_space.c ============================================================================== --- head/sys/mips/cavium/octopci_bus_space.c Fri Mar 2 21:44:39 2012 (r232409) +++ head/sys/mips/cavium/octopci_bus_space.c Fri Mar 2 21:46:31 2012 (r232410) @@ -230,13 +230,12 @@ octopci_bs_unmap(void *t __unused, bus_s } int -octopci_bs_subregion(void *t __unused, bus_space_handle_t handle __unused, - bus_size_t offset __unused, bus_size_t size __unused, - bus_space_handle_t *nhandle __unused) +octopci_bs_subregion(void *t __unused, bus_space_handle_t handle, + bus_size_t offset, bus_size_t size __unused, + bus_space_handle_t *bshp) { - printf("SUBREGION?!?!?!\n"); - /* Do nothing */ + *bshp = handle + offset; return (0); } Modified: head/sys/mips/mips/bus_space_generic.c ============================================================================== --- head/sys/mips/mips/bus_space_generic.c Fri Mar 2 21:44:39 2012 (r232409) +++ head/sys/mips/mips/bus_space_generic.c Fri Mar 2 21:46:31 2012 (r232410) @@ -245,13 +245,12 @@ generic_bs_unmap(void *t __unused, bus_s } int -generic_bs_subregion(void *t __unused, bus_space_handle_t handle __unused, - bus_size_t offset __unused, bus_size_t size __unused, - bus_space_handle_t *nhandle __unused) +generic_bs_subregion(void *t __unused, bus_space_handle_t handle, + bus_size_t offset, bus_size_t size __unused, + bus_space_handle_t *bshp) { - printf("SUBREGION?!?!?!\n"); - /* Do nothing */ + *bshp = handle + offset; return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 21:56:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A5B1E1065670; Fri, 2 Mar 2012 21:56:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 1E2BC8FC19; Fri, 2 Mar 2012 21:56:32 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q22LuTMq020555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 3 Mar 2012 08:56:30 +1100 Date: Sat, 3 Mar 2012 08:56:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201203022129.10849.tijl@freebsd.org> Message-ID: <20120303084934.L888@besplex.bde.org> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120302130435.J929@besplex.bde.org> <20120302223355.Q2543@besplex.bde.org> <201203022129.10849.tijl@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, Dimitry Andric , Bruce Evans Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/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: Fri, 02 Mar 2012 21:56:33 -0000 On Fri, 2 Mar 2012, Tijl Coosemans wrote: > On Friday 02 March 2012 12:52:41 Bruce Evans wrote: >> ... >> Here is another version. It has now been tested a bit at runtime. >> I had to restore almost all of the complications, so the following >> reduces to mostly style changes including comments about surprising >> details. It has 1 fix for clang (the comitted version doesn't >> work for clang). >> ... >> % -#define _BYTEORDER_FUNC_DEFINED >> % +/* XXX these are broken, since they evaluate x more than once. */ > > Maybe make them static inline functions. That won't be very efficient at > -O0 but it'll be correct and this implementation probably isn't very > efficient anyway. Otherwise the patch looks good to me. > >> % +#define __bswap16(x) (__bswap16_gen((__uint16_t)(x))) >> % +#define __bswap32(x) (__bswap32_gen((__uint32_t)(x))) >> % +#define __bswap64(x) (__bswap64_gen((__uint64_t)(x))) They are already static inline for the gcc `var' case, and that would work for any compiler if the asms in them were ifdefed. The problem is the lack of __builtin_const_p() for non-gcc. This is only needed for the `const' case, since the static inlines don't work in static initializers. OTOH, the only thing that stops the generic expressions working in the `var' case is their side effects. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 22:00:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33D4F106567B; Fri, 2 Mar 2012 22:00:41 +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 1FAD78FC22; Fri, 2 Mar 2012 22:00:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22M0e5V049329; Fri, 2 Mar 2012 22:00:40 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22M0eR9049327; Fri, 2 Mar 2012 22:00:40 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201203022200.q22M0eR9049327@svn.freebsd.org> From: "Kenneth D. Merry" Date: Fri, 2 Mar 2012 22:00: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: r232411 - head/sys/dev/mpt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 22:00:41 -0000 Author: ken Date: Fri Mar 2 22:00:40 2012 New Revision: 232411 URL: http://svn.freebsd.org/changeset/base/232411 Log: Fix a problem that was causing the mpt(4) driver to attach to MegaRAID cards that should be handled by the mfi(4) driver. The root of the problem is that the mpt(4) driver was masking off the bottom bit of the PCI device ID when deciding which cards to attach to. It appears that a number of the mpt(4) Fibre Channel cards had a LAN variant whose PCI device ID was just one bit off from the FC card's device ID. The FC cards were even and the LAN cards were odd. The problem was that this pattern wasn't carried over on the SAS and parallel SCSI mpt(4) cards. Luckily the SAS and parallel SCSI PCI device IDs were either even numbers, or they would get masked to a supported adjacent PCI device ID, and everything worked well. Now LSI is using some of the odd-numbered PCI device IDs between the 3Gb SAS device IDs for their new MegaRAID cards. This is causing the mpt(4) driver to attach to the RAID cards instead of the mfi(4) driver. The solution is to stop masking off the bottom bit of the device ID, and explicitly list the PCI device IDs of all supported cards. This change should be a no-op for mpt(4) hardware. The only intended functional change is that for the 929X, the is_fc variable gets set. It wasn't being set previously, but needs to be because the 929X is a Fibre Channel card. Reported by: Kashyap Desai MFC After: 3 days Modified: head/sys/dev/mpt/mpt_pci.c Modified: head/sys/dev/mpt/mpt_pci.c ============================================================================== --- head/sys/dev/mpt/mpt_pci.c Fri Mar 2 21:46:31 2012 (r232410) +++ head/sys/dev/mpt/mpt_pci.c Fri Mar 2 22:00:40 2012 (r232411) @@ -129,18 +129,34 @@ __FBSDID("$FreeBSD$"); #define PCI_PRODUCT_LSI_FC919 0x0624 #endif +#ifndef PCI_PRODUCT_LSI_FC919_LAN +#define PCI_PRODUCT_LSI_FC919_LAN 0x0625 +#endif + #ifndef PCI_PRODUCT_LSI_FC929 #define PCI_PRODUCT_LSI_FC929 0x0622 #endif +#ifndef PCI_PRODUCT_LSI_FC929_LAN +#define PCI_PRODUCT_LSI_FC929_LAN 0x0623 +#endif + #ifndef PCI_PRODUCT_LSI_FC929X #define PCI_PRODUCT_LSI_FC929X 0x0626 #endif +#ifndef PCI_PRODUCT_LSI_FC929X_LAN +#define PCI_PRODUCT_LSI_FC929X_LAN 0x0627 +#endif + #ifndef PCI_PRODUCT_LSI_FC919X #define PCI_PRODUCT_LSI_FC919X 0x0628 #endif +#ifndef PCI_PRODUCT_LSI_FC919X_LAN +#define PCI_PRODUCT_LSI_FC919X_LAN 0x0629 +#endif + #ifndef PCI_PRODUCT_LSI_FC7X04X #define PCI_PRODUCT_LSI_FC7X04X 0x0640 #endif @@ -153,6 +169,10 @@ __FBSDID("$FreeBSD$"); #define PCI_PRODUCT_LSI_1030 0x0030 #endif +#ifndef PCI_PRODUCT_LSI_1030ZC +#define PCI_PRODUCT_LSI_1030ZC 0x0031 +#endif + #ifndef PCI_PRODUCT_LSI_SAS1064 #define PCI_PRODUCT_LSI_SAS1064 0x0050 #endif @@ -177,6 +197,10 @@ __FBSDID("$FreeBSD$"); #define PCI_PRODUCT_LSI_SAS1068 0x0054 #endif +#ifndef PCI_PRODUCT_LSI_SAS1068A +#define PCI_PRODUCT_LSI_SAS1068A 0x0055 +#endif + #ifndef PCI_PRODUCT_LSI_SAS1068E #define PCI_PRODUCT_LSI_SAS1068E 0x0058 #endif @@ -232,7 +256,7 @@ mpt_pci_probe(device_t dev) return (ENXIO); } - switch ((pci_get_device(dev) & ~1)) { + switch (pci_get_device(dev)) { case PCI_PRODUCT_LSI_FC909: desc = "LSILogic FC909 FC Adapter"; break; @@ -242,15 +266,27 @@ mpt_pci_probe(device_t dev) case PCI_PRODUCT_LSI_FC919: desc = "LSILogic FC919 FC Adapter"; break; + case PCI_PRODUCT_LSI_FC919_LAN: + desc = "LSILogic FC919 LAN Adapter"; + break; case PCI_PRODUCT_LSI_FC929: desc = "Dual LSILogic FC929 FC Adapter"; break; + case PCI_PRODUCT_LSI_FC929_LAN: + desc = "Dual LSILogic FC929 LAN Adapter"; + break; case PCI_PRODUCT_LSI_FC919X: desc = "LSILogic FC919 FC PCI-X Adapter"; break; + case PCI_PRODUCT_LSI_FC919X_LAN: + desc = "LSILogic FC919 LAN PCI-X Adapter"; + break; case PCI_PRODUCT_LSI_FC929X: desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter"; break; + case PCI_PRODUCT_LSI_FC929X_LAN: + desc = "Dual LSILogic FC929X LAN PCI-X Adapter"; + break; case PCI_PRODUCT_LSI_FC646: desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter"; break; @@ -258,6 +294,7 @@ mpt_pci_probe(device_t dev) desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-X Adapter"; break; case PCI_PRODUCT_LSI_1030: + case PCI_PRODUCT_LSI_1030ZC: desc = "LSILogic 1030 Ultra4 Adapter"; break; case PCI_PRODUCT_LSI_SAS1064: @@ -266,6 +303,7 @@ mpt_pci_probe(device_t dev) case PCI_PRODUCT_LSI_SAS1066: case PCI_PRODUCT_LSI_SAS1066E: case PCI_PRODUCT_LSI_SAS1068: + case PCI_PRODUCT_LSI_SAS1068A: case PCI_PRODUCT_LSI_SAS1068E: case PCI_PRODUCT_LSI_SAS1078: case PCI_PRODUCT_LSI_SAS1078DE: @@ -428,12 +466,17 @@ mpt_pci_attach(device_t dev) return (ENOMEM); } memset(mpt, 0, sizeof(struct mpt_softc)); - switch ((pci_get_device(dev) & ~1)) { + switch (pci_get_device(dev)) { case PCI_PRODUCT_LSI_FC909: case PCI_PRODUCT_LSI_FC909A: case PCI_PRODUCT_LSI_FC919: + case PCI_PRODUCT_LSI_FC919_LAN: case PCI_PRODUCT_LSI_FC929: + case PCI_PRODUCT_LSI_FC929_LAN: + case PCI_PRODUCT_LSI_FC929X: + case PCI_PRODUCT_LSI_FC929X_LAN: case PCI_PRODUCT_LSI_FC919X: + case PCI_PRODUCT_LSI_FC919X_LAN: case PCI_PRODUCT_LSI_FC646: case PCI_PRODUCT_LSI_FC7X04X: mpt->is_fc = 1; @@ -448,6 +491,7 @@ mpt_pci_attach(device_t dev) case PCI_PRODUCT_LSI_SAS1066: case PCI_PRODUCT_LSI_SAS1066E: case PCI_PRODUCT_LSI_SAS1068: + case PCI_PRODUCT_LSI_SAS1068A: case PCI_PRODUCT_LSI_SAS1068E: mpt->is_sas = 1; break; @@ -499,11 +543,17 @@ mpt_pci_attach(device_t dev) * Is this part a dual? * If so, link with our partner (around yet) */ - if ((pci_get_device(dev) & ~1) == PCI_PRODUCT_LSI_FC929 || - (pci_get_device(dev) & ~1) == PCI_PRODUCT_LSI_FC646 || - (pci_get_device(dev) & ~1) == PCI_PRODUCT_LSI_FC7X04X || - (pci_get_device(dev) & ~1) == PCI_PRODUCT_LSI_1030) { + switch (pci_get_device(dev)) { + case PCI_PRODUCT_LSI_FC929: + case PCI_PRODUCT_LSI_FC929_LAN: + case PCI_PRODUCT_LSI_FC646: + case PCI_PRODUCT_LSI_FC7X04X: + case PCI_PRODUCT_LSI_1030: + case PCI_PRODUCT_LSI_1030ZC: mpt_link_peer(mpt); + break; + default: + break; } /* From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 22:21:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 21A03106566B; Fri, 2 Mar 2012 22:21:55 +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 B58878FC1F; Fri, 2 Mar 2012 22:21:54 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 53F6F46B43; Fri, 2 Mar 2012 17:21:54 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D2FBAB91E; Fri, 2 Mar 2012 17:21:53 -0500 (EST) From: John Baldwin To: Peter Holm Date: Fri, 2 Mar 2012 17:16:43 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201203021153.06614.jhb@freebsd.org> <20120302204223.GA51629@x2.osted.lan> In-Reply-To: <20120302204223.GA51629@x2.osted.lan> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203021716.43954.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 02 Mar 2012 17:21:53 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Mar 2012 22:21:55 -0000 On Friday, March 02, 2012 3:42:23 pm Peter Holm wrote: > On Fri, Mar 02, 2012 at 11:53:06AM -0500, John Baldwin wrote: > > On Friday, March 02, 2012 8:29:21 am Peter Holm wrote: > > > On Thu, Mar 01, 2012 at 04:47:41PM -0500, John Baldwin wrote: > > > > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > > > > Author: pho > > > > > Date: Mon Oct 31 15:01:47 2011 > > > > > New Revision: 226967 > > > > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > > > > > > > Log: > > > > > The kern_renameat() looks up the fvp using the DELETE flag, which causes > > > > > the removal of the name cache entry for fvp. > > > > > > > > > > Reported by: Anton Yuzhaninov > > > > > In collaboration with: kib > > > > > MFC after: 1 week > > > > > > > > > > Modified: > > > > > head/sys/ufs/ufs/ufs_vnops.c > > > > > > > > So I ran into this at work recently, and even this fix applied I was still > > > > seeing rename()'s that were seemingly not taking effect. After getting some > > > > extra KTR traces, I figured out that the same purge needs to be applied to the > > > > destination vnode. Specifically, the issue I ran into was that was renaming > > > > 'foo' to 'bar', but lookups for 'bar' were still returning the old file. The > > > > reason was that a lookup after the namei(RENAME) of the destination while > > > > ufs_rename() had its locks dropped was readding the name cache entry for > > > > 'bar', and then a cache_lookup() of 'bar' would return the old vnode as long > > > > as that vnode was valid (e.g. if it had a link in another location, or other > > > > processes had an open file descriptor for it). I'm currently testing the > > > > patch below: > > > > > > > > > > I now have a scenario that fails, but not quite the same way you > > > describe. > > > > > > It looks like this: > > > > > > touch file1 > > > echo xxx > file2 > > > rename(file1, file2) > > > > > > A different process performs stat() on both files in a tight loop. > > > > > > Once in a while I observe that a stat() of file2, after the rename, > > > returns a link count of zero. Size is zero as expected, but the inode > > > number of file2 is unchanged. > > > > Hmm, that is surprising. I would not expect inconsistent stat info. I > > have no explanation for why that would happen. I do not have a simplified > > test program, just a specific workload at work. In this case it's workflow > > is more like this: > > > > fd = flopen(file1, O_CREAT); > > fstat(fd); > > if (st.st_size == 0) { > > fd2 = open(file1.temp, O_CREAT | O_EXLOCK); > > fd3 = open(someotherfile); > > copy_data(fd3, fdf2); > > close(fd3); > > rename(file1.temp, file1); > > close(fd); > > fd = fd2; > > } > > link(file1, uniquedir/file1); > > close(fd); > > > > /* Use uniquedir/file1, and unlink it when done. */ > > > > What I observed was that sometimes uniquedir/file1 would end up referencing > > the empty file created by flopen() after the rename() rather than linking > > to the file created when file1.temp was created. > > > > > I've been running the same test with your patch and not observed this > > > problem. This on UFS2 with SU enabled. > > > > Hmm, I wish I could explain explain your odd result above in terms of this > > bug, but the results from stat() should always be consistent (VOP_GETATTR() > > can't switch vnodes mid-stream as it were). > > > > BTW, note that in my case where I had multiple processes all doing the same > > loop, in the edge case, another process always had the file open (and was > > blocked in flock() in flopen()) when the rename() happened, so that prevented > > the vnode from going away. This is important as otherwise the use count would > > drop to zero and marked inactive which removes all references to it from the > > name cache. In my case the flock() in flopen() and the fact that the "first" > > process held the flock until after the rename and call to link() made the > > race more likely to trigger. > > > > Hmm, perhaps one way to do this would be: > > > > touch file.always (save its i-node) > > fork worker process that just continually does a 'stat file1' in a loop > > main process: > > ln file.always file1 > > touch file2 > > rename file2 file1 > > stat file1 > > complain if file1 has the saved i-node > > > > Hmm, I just whipped up something to do this and it fails early and often on > > an unpatched kernel, but does not with my patch. > > > > #include > > #include > > #include > > #include > > #include > > #include > > #include > > #include > > > > static char *always, *file1, *file2; > > static ino_t always_ino; > > > > static void > > usage(void) > > { > > fprintf(stderr, "Usage: rename_race \n"); > > exit(1); > > } > > > > static void > > child(void) > > { > > struct stat sb; > > > > /* Exit as soon as our parent exits. */ > > while (getppid() != 1) { > > stat(file1, &sb); > > } > > exit(0); > > } > > > > static void > > create_file(const char *path) > > { > > int fd; > > > > fd = open(path, O_CREAT, 0666); > > if (fd < 0) > > err(1, "open(%s)", path); > > close(fd); > > } > > > > int > > main(int ac, char **av) > > { > > struct stat sb, sb2; > > pid_t pid; > > > > if (ac != 2) > > usage(); > > if (stat(av[1], &sb) != 0) > > err(1, "stat(%s)", av[1]); > > if (!S_ISDIR(sb.st_mode)) > > errx(1, "%s not a directory", av[1]); > > > > asprintf(&always, "%s/file.always", av[1]); > > asprintf(&file1, "%s/file1", av[1]); > > asprintf(&file2, "%s/file2", av[1]); > > > > create_file(always); > > if (stat(always, &sb) != 0) > > err(1, "stat(%s)", always); > > always_ino = sb.st_ino; > > > > pid = fork(); > > if (pid < 0) > > err(1, "fork"); > > if (pid == 0) > > child(); > > for (;;) { > > if (unlink(file1) < 0 && errno != ENOENT) > > err(1, "unlink(%s)", file1); > > if (link(always, file1) < 0) > > err(1, "link(%s, %s)", always, file1); > > create_file(file2); > > if (stat(file2, &sb2) < 0) > > err(1, "stat(%s)", file2); > > if (rename(file2, file1) < 0) > > err(1, "rename(%s, %s)", file2, file1); > > if (stat(file1, &sb) < 0) > > err(1, "stat(%s)", file1); > > if (sb.st_ino != sb2.st_ino || > > sb.st_ino == always_ino) > > printf("Bad stat: always: %d file1: %d (should be %d)\n", > > always_ino, sb.st_ino, sb2.st_ino); > > } > > return (0); > > } > > > > Excellent test scenario! > > For the tmpfs case I do not see any problems using both our > scenarios on a pristine HEAD. Ah, that may be. I have only observed this on UFS. If tmpfs does not have the stuff to drop locks and do a restart then it may not be subject to the 'tvp' race. I do wonder if all filesystems are subject to the 'fvp' race though given that kern_renameat() doesn't keep 'fvp' locked while it does the namei() lookup of the target (or am I just wrong)? For example, I wonder if NFS is subject to the same problem. Hmm, a quick test of NFS shows no problems. Does tmpfs support LOOKUP_SHARED btw? If not, then that might explain it not being as vulnerable. Ah, it doesn't, so that might explain it. (Also, I committed this patch to HEAD already, so you might need to revert it for testing tmpfs.) -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 22:21:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86271106568C; Fri, 2 Mar 2012 22:21:55 +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 57E368FC08; Fri, 2 Mar 2012 22:21:55 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 0A1A846B46; Fri, 2 Mar 2012 17:21:55 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7F06DB922; Fri, 2 Mar 2012 17:21:54 -0500 (EST) From: John Baldwin To: Marius Strobl Date: Fri, 2 Mar 2012 17:18:37 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201203022038.q22Kc5vd046376@svn.freebsd.org> <20120302214551.GB1635@alchemy.franken.de> In-Reply-To: <20120302214551.GB1635@alchemy.franken.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203021718.38092.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 02 Mar 2012 17:21:54 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232403 - in head/sys: dev/acpica dev/cardbus dev/pci powerpc/ofw 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: Fri, 02 Mar 2012 22:21:55 -0000 On Friday, March 02, 2012 4:45:52 pm Marius Strobl wrote: > On Fri, Mar 02, 2012 at 08:38:05PM +0000, John Baldwin wrote: > > Author: jhb > > Date: Fri Mar 2 20:38:04 2012 > > New Revision: 232403 > > URL: http://svn.freebsd.org/changeset/base/232403 > > > > Log: > > - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. > > The tag enforces a single restriction that all DMA transactions must not > > cross a 4GB boundary. Note that while this restriction technically only > > applies to PCI-express, this change applies it to all PCI devices as it > > is simpler to implement that way and errs on the side of caution. > > Hrm, wouldn't it have been more appropriate to implement this in the > Host-PCI bridges instead? Probably for anything but x86 this would > allow to easily distinguish at least between PCI and PCI-Express capable > bus hierarchies and would move the PAE workaround to the MD bits to > where it belongs. The PAE workaround is dying as I've already fixed HEAD to make boundary arguments use a bus_addr_t. However, I committed it in this fashion so it can be MFC'd since I can't merge the boundary KBI change. The reason I did not do this in the Host-PCI bridge drivers is that we would have to do this in umpteen different drivers, and all for a change that is mandated by the PCI spec and not specific to the various specs the Host-PCI bridge drivers all cater to (OFW, ACPI, MPTable, various and sundry embedded platforms, etc.). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 22:38:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BEF0106564A; Fri, 2 Mar 2012 22:38:09 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id CB2798FC0C; Fri, 2 Mar 2012 22:38:08 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q22Mc7hE074311; Fri, 2 Mar 2012 23:38:07 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q22Mc7w5074310; Fri, 2 Mar 2012 23:38:07 +0100 (CET) (envelope-from marius) Date: Fri, 2 Mar 2012 23:38:07 +0100 From: Marius Strobl To: John Baldwin Message-ID: <20120302223807.GI55090@alchemy.franken.de> References: <201203022038.q22Kc5vd046376@svn.freebsd.org> <20120302214551.GB1635@alchemy.franken.de> <201203021718.38092.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201203021718.38092.jhb@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: r232403 - in head/sys: dev/acpica dev/cardbus dev/pci powerpc/ofw 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: Fri, 02 Mar 2012 22:38:09 -0000 On Fri, Mar 02, 2012 at 05:18:37PM -0500, John Baldwin wrote: > On Friday, March 02, 2012 4:45:52 pm Marius Strobl wrote: > > On Fri, Mar 02, 2012 at 08:38:05PM +0000, John Baldwin wrote: > > > Author: jhb > > > Date: Fri Mar 2 20:38:04 2012 > > > New Revision: 232403 > > > URL: http://svn.freebsd.org/changeset/base/232403 > > > > > > Log: > > > - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. > > > The tag enforces a single restriction that all DMA transactions must not > > > cross a 4GB boundary. Note that while this restriction technically only > > > applies to PCI-express, this change applies it to all PCI devices as it > > > is simpler to implement that way and errs on the side of caution. > > > > Hrm, wouldn't it have been more appropriate to implement this in the > > Host-PCI bridges instead? Probably for anything but x86 this would > > allow to easily distinguish at least between PCI and PCI-Express capable > > bus hierarchies and would move the PAE workaround to the MD bits to > > where it belongs. > > The PAE workaround is dying as I've already fixed HEAD to make boundary arguments > use a bus_addr_t. However, I committed it in this fashion so it can be MFC'd > since I can't merge the boundary KBI change. > > The reason I did not do this in the Host-PCI bridge drivers is that we would have > to do this in umpteen different drivers, and all for a change that is mandated by > the PCI spec and not specific to the various specs the Host-PCI bridge drivers > all cater to (OFW, ACPI, MPTable, various and sundry embedded platforms, etc.). > Well, on !x86 we don't have generic Host-PCI bridge drivers based on what you call specs here, but rather specific drivers for individual Host-PCI, Host-PCI-X and Host-PCI-Express chips. Whether the PCI* buses beneath these are enumerated using FDT, OFW etc. doesn't really matter in this context. Marius From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 23:54:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4CD1106564A; Fri, 2 Mar 2012 23:54:11 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2E968FC0C; Fri, 2 Mar 2012 23:54:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22NsBvH053183; Fri, 2 Mar 2012 23:54:11 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22NsBib053179; Fri, 2 Mar 2012 23:54:11 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201203022354.q22NsBib053179@svn.freebsd.org> From: Josh Paetzel Date: Fri, 2 Mar 2012 23:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232415 - stable/9/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: Fri, 02 Mar 2012 23:54:11 -0000 Author: jpaetzel Date: Fri Mar 2 23:54:11 2012 New Revision: 232415 URL: http://svn.freebsd.org/changeset/base/232415 Log: MFC r227368 Welcome the initial patches for OSX bootcamp support!!! This should let you select the ada0p3 hybrid MBR/GPT partition, and do an installation to it. Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh stable/9/usr.sbin/pc-sysinstall/backend/parseconfig.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Fri Mar 2 22:24:15 2012 (r232414) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Fri Mar 2 23:54:11 2012 (r232415) @@ -179,7 +179,9 @@ setup_gpart_partitions() else PARTLETTER="a" CURPART="1" - rc_halt "gpart create -s BSD ${_wSlice}" + if [ "${_pType}" = "mbr" ] ; then + rc_halt "gpart create -s BSD ${_wSlice}" + fi fi while read line @@ -255,6 +257,9 @@ setup_gpart_partitions() if [ "${CURPART}" = "1" -a "$_pType" = "mbr" ] ; then export FOUNDROOT="0" fi + if [ "${CURPART}" = "1" -a "$_pType" = "gptslice" ] ; then + export FOUNDROOT="0" + fi fi check_for_mount "${MNT}" "/boot" @@ -266,6 +271,9 @@ setup_gpart_partitions() if [ "${CURPART}" != "1" -a "${_pType}" = "mbr" ] ; then exit_err "/boot partition must be first partition" fi + if [ "${CURPART}" != "1" -a "${_pType}" = "gptslice" ] ; then + exit_err "/boot partition must be first partition" + fi if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ] ; then exit_err "/boot partition must be formatted with UFS" @@ -287,7 +295,7 @@ setup_gpart_partitions() # Check if using zfs mirror echo ${XTRAOPTS} | grep -q "mirror" 2>/dev/null if [ $? -eq 0 -a "$FS" = "ZFS" ] ; then - if [ "${_pType}" = "gpt" ] ; then + if [ "${_pType}" = "gpt" -o "${_pType}" = "gptslice" ] ; then XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_pDisk}p${CURPART}") else XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${_wSlice}") @@ -305,11 +313,17 @@ setup_gpart_partitions() if [ "${_pType}" = "gpt" ] ; then if [ "$CURPART" = "2" ] ; then # If this is GPT, make sure first partition is aligned to 4k + sleep 2 rc_halt "gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}" else + sleep 2 rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}" fi + elif [ "${_pType}" = "gptslice" ]; then + sleep 2 + rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${_wSlice}" else + sleep 2 rc_halt "gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}" fi @@ -338,7 +352,7 @@ setup_gpart_partitions() echo "${ENCPASS}" >${PARTDIR}-enc/${_dFile}p${CURPART}-encpass fi else - # MBR Partition + # MBR Partition or GPT slice _dFile="`echo $_wSlice | sed 's|/|-|g'`" echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE}" >${PARTDIR}/${_dFile}${PARTLETTER} # Clear out any headers @@ -422,7 +436,7 @@ populate_disk_label() if [ "$type" = "mbr" ] ; then wrkslice="${diskid}s${slicenum}" fi - if [ "$type" = "gpt" ] ; then + if [ "$type" = "gpt" -o "$type" = "gptslice" ] ; then wrkslice="${diskid}p${slicenum}" fi @@ -459,6 +473,9 @@ setup_disk_label() if [ "$type" = "gpt" -a ! -e "${disk}p${pnum}" ] ; then exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!" fi + if [ "$type" = "gptslice" -a ! -e "${disk}p${pnum}" ] ; then + exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!" + fi done # Setup some files which we'll be referring to Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Fri Mar 2 22:24:15 2012 (r232414) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Fri Mar 2 23:54:11 2012 (r232415) @@ -496,6 +496,13 @@ setup_disk_slice() run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" ;; + p1|p2|p3|p4|p5|p6|p7|p8|p9|p10|p11|p12|p13|p14|p15|p16|p17|p18|p19|p20) + tmpSLICE="${DISK}${PTYPE}" + # Get the number of the gpt partition we are working on + s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`" + run_gpart_gpt_part "${DISK}" "${BMANAGER}" "${s}" + ;; + free) tmpSLICE="${DISK}s${LASTSLICE}" run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" @@ -704,6 +711,58 @@ run_gpart_full() fi }; +# Function which runs gpart on a specified gpt partition +run_gpart_gpt_part() +{ + DISK=$1 + + # Set the slice we will use later + slice="${1}p${3}" + + # Set our sysctl so we can overwrite any geom using drives + sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT} + + # Get the number of the slice we are working on + slicenum="$3" + + # Stop any journaling + stop_gjournal "${slice}" + + # Make sure we have disabled swap on this drive + if [ -e "${slice}b" ] + then + swapoff ${slice}b >/dev/null 2>/dev/null + swapoff ${slice}b.eli >/dev/null 2>/dev/null + fi + + # Modify partition type + echo_log "Running gpart modify on ${DISK}" + rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}" + sleep 2 + + # Clean up old partition + echo_log "Cleaning up $slice" + rc_halt "dd if=/dev/zero of=${DISK}p${slicenum} count=1024" + + sleep 4 + + # Init the MBR partition + rc_halt "gpart create -s BSD ${DISK}p${slicenum}" + + # Set the slice to the format we'll be using for gpart later + slice=`echo "${1}:${3}:gptslice" | sed 's|/|-|g'` + + # Lets save our slice, so we know what to look for in the config file later on + if [ -z "$WORKINGSLICES" ] + then + WORKINGSLICES="${slice}" + export WORKINGSLICES + else + WORKINGSLICES="${WORKINGSLICES} ${slice}" + export WORKINGSLICES + fi +}; + # Function which runs gpart on a specified s1-4 slice run_gpart_slice() { Modified: stable/9/usr.sbin/pc-sysinstall/backend/parseconfig.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/parseconfig.sh Fri Mar 2 22:24:15 2012 (r232414) +++ stable/9/usr.sbin/pc-sysinstall/backend/parseconfig.sh Fri Mar 2 23:54:11 2012 (r232415) @@ -70,7 +70,6 @@ check_value installMode "fresh upgrade e check_value installType "PCBSD FreeBSD" check_value installMedium "dvd usb ftp rsync image local" check_value packageType "uzip tar rsync split" -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 From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 00:11:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7DAFA106564A; Sat, 3 Mar 2012 00:11:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CF708FC0A; Sat, 3 Mar 2012 00:11:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q230BloL053792; Sat, 3 Mar 2012 00:11:47 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q230Blc9053789; Sat, 3 Mar 2012 00:11:47 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203030011.q230Blc9053789@svn.freebsd.org> From: Jung-uk Kim Date: Sat, 3 Mar 2012 00:11: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: r232416 - in head/sys: amd64/conf i386/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: Sat, 03 Mar 2012 00:11:47 -0000 Author: jkim Date: Sat Mar 3 00:11:46 2012 New Revision: 232416 URL: http://svn.freebsd.org/changeset/base/232416 Log: Add VESA option to GENERIC for amd64 and i386. MFC after: 1 month Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Mar 2 23:54:11 2012 (r232415) +++ head/sys/amd64/conf/GENERIC Sat Mar 3 00:11:46 2012 (r232416) @@ -168,6 +168,7 @@ device psm # PS/2 mouse device kbdmux # keyboard multiplexer device vga # VGA video card driver +options VESA # add support for VESA BIOS Extensions device splash # Splash screen and screen saver support Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Fri Mar 2 23:54:11 2012 (r232415) +++ head/sys/i386/conf/GENERIC Sat Mar 3 00:11:46 2012 (r232416) @@ -173,6 +173,7 @@ device psm # PS/2 mouse device kbdmux # keyboard multiplexer device vga # VGA video card driver +options VESA # add support for VESA BIOS Extensions device splash # Splash screen and screen saver support From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 00:36:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E651106566B; Sat, 3 Mar 2012 00:36:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D5B18FC08; Sat, 3 Mar 2012 00:36:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q230aVv6054687; Sat, 3 Mar 2012 00:36:31 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q230aVAC054685; Sat, 3 Mar 2012 00:36:31 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203030036.q230aVAC054685@svn.freebsd.org> From: Jung-uk Kim Date: Sat, 3 Mar 2012 00:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232417 - stable/9/sys/boot/i386/libi386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 00:36:31 -0000 Author: jkim Date: Sat Mar 3 00:36:30 2012 New Revision: 232417 URL: http://svn.freebsd.org/changeset/base/232417 Log: MFC: r232309 Fix a long standing bug. The caller expects a non-zero value for success. Luckily keyboard probing was turned off by default from the first revision. Modified: stable/9/sys/boot/i386/libi386/vidconsole.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/i386/libi386/vidconsole.c ============================================================================== --- stable/9/sys/boot/i386/libi386/vidconsole.c Sat Mar 3 00:11:46 2012 (r232416) +++ stable/9/sys/boot/i386/libi386/vidconsole.c Sat Mar 3 00:36:30 2012 (r232417) @@ -623,10 +623,10 @@ probe_keyboard(void) #endif if (i == KBD_ECHO) { /* got the right answer */ - return (0); + return (1); } } - return (1); + return (0); } #endif /* KEYBOARD_PROBE */ From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 00:37:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 899301065670; Sat, 3 Mar 2012 00:37:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 785898FC0C; Sat, 3 Mar 2012 00:37:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q230b4Pk054739; Sat, 3 Mar 2012 00:37:04 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q230b4Su054737; Sat, 3 Mar 2012 00:37:04 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203030037.q230b4Su054737@svn.freebsd.org> From: Jung-uk Kim Date: Sat, 3 Mar 2012 00:37:04 +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: r232418 - stable/7/sys/boot/i386/libi386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 00:37:06 -0000 Author: jkim Date: Sat Mar 3 00:37:03 2012 New Revision: 232418 URL: http://svn.freebsd.org/changeset/base/232418 Log: MFC: r232309 Fix a long standing bug. The caller expects a non-zero value for success. Luckily keyboard probing was turned off by default from the first revision. Modified: stable/7/sys/boot/i386/libi386/vidconsole.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/boot/i386/libi386/vidconsole.c ============================================================================== --- stable/7/sys/boot/i386/libi386/vidconsole.c Sat Mar 3 00:36:30 2012 (r232417) +++ stable/7/sys/boot/i386/libi386/vidconsole.c Sat Mar 3 00:37:03 2012 (r232418) @@ -623,10 +623,10 @@ probe_keyboard(void) #endif if (i == KBD_ECHO) { /* got the right answer */ - return (0); + return (1); } } - return (1); + return (0); } #endif /* KEYBOARD_PROBE */ From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 01:02:27 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08F65106566B; Sat, 3 Mar 2012 01:02:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au [211.29.132.196]) by mx1.freebsd.org (Postfix) with ESMTP id 8467A8FC16; Sat, 3 Mar 2012 01:02:26 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q2312NBp025858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 3 Mar 2012 12:02:24 +1100 Date: Sat, 3 Mar 2012 12:02:23 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201203022231.43186.tijl@freebsd.org> Message-ID: <20120303110551.Q1494@besplex.bde.org> References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <201203012347.32984.tijl@freebsd.org> <20120302132403.P929@besplex.bde.org> <201203022231.43186.tijl@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, Bruce Evans Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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, 03 Mar 2012 01:02:27 -0000 On Fri, 2 Mar 2012, Tijl Coosemans wrote: > On Friday 02 March 2012 05:11:21 Bruce Evans wrote: [... Lots about complications for longjmp() from a signal handler] > Thanks, that was quite informative. C11 does say something about the > FP env and signals now though: > > ``When the processing of the abstract machine is interrupted by receipt > of a signal, the values of objects that are neither lock-free atomic > objects nor of type volatile sig_atomic_t are unspecified, as is the > state of the floating-point environment. The value of any object > modified by the handler that is neither a lock-free atomic object nor > of type volatile sig_atomic_t becomes indeterminate when the handler > exits, as does the state of the floating-point environment if it is > modified by the handler and not restored to its original state.'' Interesting. This is almost exactly the same as my justification for not caring about old signal handlers getting a dirty FP state. Since signal handlers can't do anything with static objects except write to volatile sig_atomic_t ones, they can't do anything useful with FP. But old standards seem to allow them to do silly things like calculate pi to a billion decimal places and store the result encoded in an array of about 1 billion sig_atomic_t's, or better yet, calculate 2.0 + 2.0 and store the result in a smaller array of sig_atomic_t's. Oops, the above doesn't clearly say of the unspecified state is for the signal handler, or after the signal handler returns, or both. The second sentence it only clearly says that certain objects and state become indeterminate after bad behaviour by signal handlers. But we want longjmp()s from signal handlers to be usually not bad behaviour. The above at least allows them to work right. Maybe longjmp() can determine if it is invoked in a signal handler and do the right thing then. longjmp()s for machines that are too complicated for me have to do sophisticated stack unwinding. This might require even more sophisticated unwinding for signal handlers. This reminds me that POSIX (?) weasels out of some of the complications by only requiring a single level of nested signal handlers to work. > This means a signal handler must not rely on the state of the FP env. > It may install its own FP env if needed (e.g. FE_DFL_ENV), but then it > must restore the original before returning. This allows for the > rounding mode to be silently modified for integer conversions for > instance. Well, I think the kernel can't trust the signal handler to do that. It also can't trust the compiler. The compiler can reasonably use FP for anything it wants if this is (the compiler thinks) transparent to the abstract machine, but the compiler can't know when the code is for a signal handler without complicated directives. Then on x86, integer operations may use the same SSE registers (although perhaps not mxcsr) as FP uses, and again the compiler can't reasonably know when not to do this. So the kernel must restore at least the shared registers, and for SSE this means restoring using f*rstor which handles the whole state at no extra cost. So the interesting points for signal handlers move to: - should signal handlers have to initialize their own state if they want to use FP explicitly? I think they should. - should signal handlers have to initialize their own state if they want to use FP or shared registers implicitly (because the compiler wants to)? No. The kernel must handle this transparently, much like it does now, and I think this makes the previous case work transparently too. The kernel tries to do this lazily, but it doesn't do this very well (it copies the state several times in sendsig() and sigreturn()). - when the signal handler wants to modify the interrupted state, how does it do this? There is minimal support for this. The easiest way to modify it is to modify the current state and then longjmp() instead of returning. - how can signal handlers and debuggers even see the interrupted state? gdb has less clue about this than it did 20 years ago. Users can probably use debuggers to follow various pointers to the saved state if they know more about this than signal handlers and debuggers. > If longjmp is not supposed to change the FP env then, when called from > a signal handler, either the signal handler must install a proper FP > env before calling longjmp or a proper FP env must be installed after > the target setjmp call. Otherwise the FP env is unspecified. Better handle the usual case right like it used to be, without the signal handler having to do anything, by always saving a minimal environment in setjmp(), but now only restoring it for longjmp() in signal handlers. The minimal environment doesn't include any normal register on at least amd64 and i386 (except for i387 it includes the stack and the tags -- these must be empty on return from any function call). Again there is a problem with transparent use of FP or SSE by the compiler. An average SIGINT handler that doesn't want to do any explicit FP and just wants to longjmp() back to the main loop can't be expected to understand this stuff better than standards, kernels and compilers and have the complications neccessary to fix up the FP state after the compiler has transparently (it thinks) used FP or SSE. Bruce From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 01:06:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 71CA8106566C; Sat, 3 Mar 2012 01:06:55 +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 5F33F8FC08; Sat, 3 Mar 2012 01:06:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2316tQ7055754; Sat, 3 Mar 2012 01:06:55 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2316t1h055748; Sat, 3 Mar 2012 01:06:55 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201203030106.q2316t1h055748@svn.freebsd.org> From: Rick Macklem Date: Sat, 3 Mar 2012 01:06: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: r232420 - in head/sys: fs/nfsclient kern nfsclient 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, 03 Mar 2012 01:06:55 -0000 Author: rmacklem Date: Sat Mar 3 01:06:54 2012 New Revision: 232420 URL: http://svn.freebsd.org/changeset/base/232420 Log: Post r230394, the Lookup RPC counts for both NFS clients increased significantly. Upon investigation this was caused by name cache misses for lookups of "..". For name cache entries for non-".." directories, the cache entry serves double duty. It maps both the named directory plus ".." for the parent of the directory. As such, two ctime values (one for each of the directory and its parent) need to be saved in the name cache entry. This patch adds an entry for ctime of the parent directory to the name cache. It also adds an additional uma zone for large entries with this time value, in order to minimize memory wastage. As well, it fixes a couple of cases where the mtime of the parent directory was being saved instead of ctime for positive name cache entries. With this patch, Lookup RPC counts return to values similar to pre-r230394 kernels. Reported by: bde Discussed with: kib Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/kern/vfs_cache.c head/sys/nfsclient/nfs_vnops.c head/sys/sys/vnode.h Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Sat Mar 3 01:00:18 2012 (r232419) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sat Mar 3 01:06:54 2012 (r232420) @@ -2951,10 +2951,12 @@ nfsrpc_readdirplus(vnode_t vp, struct ui nfsattrbit_t attrbits, dattrbits; size_t tresid; u_int32_t *tl2 = NULL, fakefileno = 0xffffffff, rderr; + struct timespec dctime; KASSERT(uiop->uio_iovcnt == 1 && (uio_uio_resid(uiop) & (DIRBLKSIZ - 1)) == 0, ("nfs readdirplusrpc bad uio")); + timespecclear(&dctime); *attrflagp = 0; if (eofp != NULL) *eofp = 0; @@ -2997,6 +2999,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui #endif if (error) return (error); + dctime = nfsva.na_ctime; dotfileid = nfsva.na_fileid; NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -3134,6 +3137,8 @@ nfsrpc_readdirplus(vnode_t vp, struct ui error = nd->nd_repstat; goto nfsmout; } + if ((nd->nd_flag & ND_NFSV3) != 0 && *attrflagp != 0) + dctime = nap->na_ctime; NFSM_DISSECT(tl, u_int32_t *, 3 * NFSX_UNSIGNED); NFSLOCKNODE(dnp); dnp->n_cookieverf.nfsuquad[0] = *tl++; @@ -3316,10 +3321,14 @@ nfsrpc_readdirplus(vnode_t vp, struct ui vtonfs_dtype(np->n_vattr.na_type); ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); - if (cnp->cn_namelen <= NCHNAMLEN) { + if (cnp->cn_namelen <= NCHNAMLEN && + (newvp->v_type != VDIR || + dctime.tv_sec != 0)) { cache_enter_time(ndp->ni_dvp, ndp->ni_vp, cnp, - &nfsva.na_ctime); + &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : + &dctime); } if (unlocknewvp) vput(newvp); Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Sat Mar 3 01:00:18 2012 (r232419) +++ head/sys/fs/nfsclient/nfs_clvnops.c Sat Mar 3 01:06:54 2012 (r232420) @@ -1172,7 +1172,7 @@ nfs_lookup(struct vop_lookup_args *ap) &dnfsva.na_mtime, ==)) { mtx_unlock(&np->n_mtx); cache_enter_time(dvp, NULL, cnp, - &dnfsva.na_mtime); + &dnfsva.na_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -1271,9 +1271,10 @@ nfs_lookup(struct vop_lookup_args *ap) if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && attrflag) { - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : &dnfsva.na_ctime); *vpp = newvp; return (0); } @@ -1591,7 +1592,8 @@ again: } if (!error) { if ((cnp->cn_flags & MAKEENTRY) && attrflag) - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime); + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + NULL); *ap->a_vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -1966,8 +1968,8 @@ nfs_link(struct vop_link_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY) && dattrflag) { - cache_enter_time(tdvp, vp, cnp, &dnfsva.na_mtime); + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); } if (error && NFS_ISV4(vp)) error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, @@ -2033,21 +2035,21 @@ nfs_symlink(struct vop_symlink_args *ap) if (dattrflag != 0) { mtx_unlock(&dnp->n_mtx); (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1); - /* - * If negative lookup caching is enabled, I might as well - * add an entry for this node. Not necessary for correctness, - * but if negative caching is enabled, then the system - * must care about lookup caching hit rate, so... - */ - if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) { - cache_enter_time(dvp, newvp, cnp, &dnfsva.na_mtime); - } } else { dnp->n_attrstamp = 0; mtx_unlock(&dnp->n_mtx); KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp); } + /* + * If negative lookup caching is enabled, I might as well + * add an entry for this node. Not necessary for correctness, + * but if negative caching is enabled, then the system + * must care about lookup caching hit rate, so... + */ + if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, NULL); + } return (error); } @@ -2118,9 +2120,10 @@ nfs_mkdir(struct vop_mkdir_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY) && dattrflag) { - cache_enter_time(dvp, newvp, cnp, &dnfsva.na_mtime); - } + (cnp->cn_flags & MAKEENTRY) && + attrflag != 0 && dattrflag != 0) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + &dnfsva.na_ctime); *ap->a_vpp = newvp; } return (error); Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Mar 3 01:00:18 2012 (r232419) +++ head/sys/kern/vfs_cache.c Sat Mar 3 01:06:54 2012 (r232420) @@ -105,6 +105,10 @@ struct namecache { /* * struct namecache_ts repeats struct namecache layout up to the * nc_nlen member. + * struct namecache_ts is used in place of struct namecache when time(s) need + * to be stored. The nc_dotdottime field is used when a cache entry is mapping + * both a non-dotdot directory name plus dotdot for the directory's + * parent. */ struct namecache_ts { LIST_ENTRY(namecache) nc_hash; /* hash chain */ @@ -115,6 +119,7 @@ struct namecache_ts { u_char nc_flag; /* flag bits */ u_char nc_nlen; /* length of name */ struct timespec nc_time; /* timespec provided by fs */ + struct timespec nc_dotdottime; /* dotdot timespec provided by fs */ int nc_ticks; /* ticks value when entry was added */ char nc_name[0]; /* segment name + nul */ }; @@ -125,6 +130,7 @@ struct namecache_ts { #define NCF_WHITE 0x01 #define NCF_ISDOTDOT 0x02 #define NCF_TS 0x04 +#define NCF_DTS 0x08 /* * Name caching works as follows: @@ -190,6 +196,7 @@ RW_SYSINIT(vfscache, &cache_lock, "Name static uma_zone_t cache_zone_small; static uma_zone_t cache_zone_small_ts; static uma_zone_t cache_zone_large; +static uma_zone_t cache_zone_large_ts; #define CACHE_PATH_CUTOFF 35 @@ -197,8 +204,12 @@ static struct namecache * cache_alloc(int len, int ts) { - if (len > CACHE_PATH_CUTOFF) - return (uma_zalloc(cache_zone_large, M_WAITOK)); + if (len > CACHE_PATH_CUTOFF) { + if (ts) + return (uma_zalloc(cache_zone_large_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_large, M_WAITOK)); + } if (ts) return (uma_zalloc(cache_zone_small_ts, M_WAITOK)); else @@ -218,7 +229,9 @@ cache_free(struct namecache *ncp) uma_zfree(cache_zone_small_ts, ncp); else uma_zfree(cache_zone_small, ncp); - } else + } else if (ts) + uma_zfree(cache_zone_large_ts, ncp); + else uma_zfree(cache_zone_large, ncp); } @@ -521,6 +534,10 @@ retry_wlocked: SDT_PROBE(vfs, namecache, lookup, hit, dvp, "..", *vpp, 0, 0); cache_out_ts(ncp, tsp, ticksp); + if ((ncp->nc_flag & (NCF_ISDOTDOT | NCF_DTS)) == + NCF_DTS && tsp != NULL) + *tsp = ((struct namecache_ts *)ncp)-> + nc_dotdottime; goto success; } } @@ -686,11 +703,12 @@ unlock: * Add an entry to the cache. */ void -cache_enter_time(dvp, vp, cnp, tsp) +cache_enter_time(dvp, vp, cnp, tsp, dtsp) struct vnode *dvp; struct vnode *vp; struct componentname *cnp; struct timespec *tsp; + struct timespec *dtsp; { struct namecache *ncp, *n2; struct namecache_ts *n3; @@ -769,6 +787,10 @@ cache_enter_time(dvp, vp, cnp, tsp) n3->nc_time = *tsp; n3->nc_ticks = ticks; n3->nc_flag |= NCF_TS; + if (dtsp != NULL) { + n3->nc_dotdottime = *dtsp; + n3->nc_flag |= NCF_DTS; + } } len = ncp->nc_nlen = cnp->cn_namelen; hash = fnv_32_buf(cnp->cn_nameptr, len, FNV1_32_INIT); @@ -794,6 +816,12 @@ cache_enter_time(dvp, vp, cnp, tsp) ((struct namecache_ts *)ncp)->nc_time; n3->nc_ticks = ((struct namecache_ts *)ncp)->nc_ticks; + if (dtsp != NULL) { + n3->nc_dotdottime = + ((struct namecache_ts *)ncp)-> + nc_dotdottime; + n3->nc_flag |= NCF_DTS; + } } CACHE_WUNLOCK(); cache_free(ncp); @@ -823,6 +851,11 @@ cache_enter_time(dvp, vp, cnp, tsp) ncp->nc_flag |= NCF_WHITE; } else if (vp->v_type == VDIR) { if (flag != NCF_ISDOTDOT) { + /* + * For this case, the cache entry maps both the + * directory name in it and the name ".." for the + * directory's parent. + */ if ((n2 = vp->v_cache_dd) != NULL && (n2->nc_flag & NCF_ISDOTDOT) != 0) cache_zap(n2); @@ -886,6 +919,9 @@ nchinit(void *dummy __unused) sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); cache_zone_large = uma_zcreate("L VFS Cache", + sizeof(struct namecache) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large_ts = uma_zcreate("LTS VFS Cache", sizeof(struct namecache_ts) + NAME_MAX + 1, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); @@ -1382,7 +1418,7 @@ void cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) { - cache_enter_time(dvp, vp, cnp, NULL); + cache_enter_time(dvp, vp, cnp, NULL, NULL); } /* Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Sat Mar 3 01:00:18 2012 (r232419) +++ head/sys/nfsclient/nfs_vnops.c Sat Mar 3 01:06:54 2012 (r232420) @@ -912,7 +912,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *dvp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; struct mount *mp = dvp->v_mount; - struct vattr vattr; + struct vattr dvattr, vattr; struct timespec nctime; int flags = cnp->cn_flags; struct vnode *newvp; @@ -1129,7 +1129,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (v3) { nfsm_postop_attr_va(newvp, attrflag, &vattr); - nfsm_postop_attr(dvp, dattrflag); + nfsm_postop_attr_va(dvp, dattrflag, &dvattr); } else { nfsm_loadattr(newvp, &vattr); attrflag = 1; @@ -1137,9 +1137,10 @@ nfs_lookup(struct vop_lookup_args *ap) if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && attrflag) { - cache_enter_time(dvp, newvp, cnp, &vattr.va_ctime); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : &dvattr.va_ctime); *vpp = newvp; m_freem(mrep); nfsmout: @@ -1181,7 +1182,7 @@ nfsmout: &vattr.va_mtime, ==)) { mtx_unlock(&np->n_mtx); cache_enter_time(dvp, NULL, cnp, - &vattr.va_mtime); + &vattr.va_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -2463,11 +2464,11 @@ nfs_readdirplusrpc(struct vnode *vp, str nfsuint64 cookie; struct nfsmount *nmp = VFSTONFS(vp->v_mount); struct nfsnode *dnp = VTONFS(vp), *np; - struct vattr vattr; + struct vattr vattr, dvattr; nfsfh_t *fhp; u_quad_t fileno; int error = 0, tlen, more_dirs = 1, blksiz = 0, doit, bigenough = 1, i; - int attrflag, fhsize; + int attrflag, dattrflag, fhsize; #ifndef nolint dp = NULL; @@ -2513,7 +2514,7 @@ nfs_readdirplusrpc(struct vnode *vp, str *tl++ = txdr_unsigned(nmp->nm_readdirsize); *tl = txdr_unsigned(nmp->nm_rsize); nfsm_request(vp, NFSPROC_READDIRPLUS, uiop->uio_td, cred); - nfsm_postop_attr(vp, attrflag); + nfsm_postop_attr_va(vp, dattrflag, &dvattr); if (error) { m_freem(mrep); goto nfsmout; @@ -2649,8 +2650,11 @@ nfs_readdirplusrpc(struct vnode *vp, str md = mdsav2; dp->d_type = IFTODT(VTTOIF(vattr.va_type)); ndp->ni_vp = newvp; - cache_enter_time(ndp->ni_dvp, ndp->ni_vp, cnp, - &vattr.va_ctime); + if (newvp->v_type != VDIR || dattrflag != 0) + cache_enter_time(ndp->ni_dvp, ndp->ni_vp, + cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : + &dvattr.va_ctime); } } else { /* Just skip over the file handle */ Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sat Mar 3 01:00:18 2012 (r232419) +++ head/sys/sys/vnode.h Sat Mar 3 01:06:54 2012 (r232420) @@ -583,9 +583,10 @@ struct vnode; /* cache_* may belong in namei.h. */ #define cache_enter(dvp, vp, cnp) \ - cache_enter_time(dvp, vp, cnp, NULL) + cache_enter_time(dvp, vp, cnp, NULL, NULL) void cache_enter_time(struct vnode *dvp, struct vnode *vp, - struct componentname *cnp, struct timespec *tsp); + struct componentname *cnp, struct timespec *tsp, + struct timespec *dtsp); int cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct timespec *tsp, int *ticksp); void cache_purge(struct vnode *vp); From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 01:48:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 85FE3106566C; Sat, 3 Mar 2012 01:48:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id F42248FC0A; Sat, 3 Mar 2012 01:48:15 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q231mDNp009161 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 3 Mar 2012 12:48:14 +1100 Date: Sat, 3 Mar 2012 12:48:13 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jung-uk Kim In-Reply-To: <201203030011.q230Blc9053789@svn.freebsd.org> Message-ID: <20120303121225.O1691@besplex.bde.org> References: <201203030011.q230Blc9053789@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: r232416 - in head/sys: amd64/conf i386/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: Sat, 03 Mar 2012 01:48:16 -0000 On Sat, 3 Mar 2012, Jung-uk Kim wrote: > Log: > Add VESA option to GENERIC for amd64 and i386. > > MFC after: 1 month Any chance of adding it without style bugs? > Modified: head/sys/amd64/conf/GENERIC > ============================================================================== > --- head/sys/amd64/conf/GENERIC Fri Mar 2 23:54:11 2012 (r232415) > +++ head/sys/amd64/conf/GENERIC Sat Mar 3 00:11:46 2012 (r232416) > @@ -168,6 +168,7 @@ device psm # PS/2 mouse > device kbdmux # keyboard multiplexer > > device vga # VGA video card driver > +options VESA # add support for VESA BIOS Extensions > > device splash # Splash screen and screen saver support 1. "options" lines are normally formatted with a space and a tab after "options", so that you can add comment them out without messing up the indentation of their comments. This line is formatted with 2 tabs. 2. "options" lines are normally formatted with comments starting in column 40 (5 tab positions). This line is formatted with its comment starting in column 32. 3. Comments in "options" lines are normally capitalized. This one is not. 4. "options" lines are normally sorted together. This one is sorted near its device. There is something to be said for sorting options near their devices, but formatting for "device" lines is sloppier and interacts badly with normal formatting for "options" lines. 1a. "device" lines are normally formatted with 2 tab after "options". This allows commenting them out with "#" without messing up the indentation of their comments, but "# " messes it up. 2a. "device" lines are normally formatted with comments starting in column 32 (4 tab positions). 3a. Comments in "device" lines are normally capitalized too, but now the first word in the comment is more usually an proper name or an acronym, and it isn't so clear that the capitalization is not just to spell these normally. The new line has extensive capitalization for proper names and acronyms in "VESA BIOS Extensions", but noe for "Add". 4a. Sorting is more random for "device" lines than for "options" lines. There is fairly random sorting for just the 4 devices visible in this diff. Dependencies for devices are more complicated and are barely hinted at by the grouping and ordering of the device lines. Anything except alphabetical sorting becomes unreadable in long lists. Bruce From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:13:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DBD541065670; Sat, 3 Mar 2012 02:13:53 +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 CA4078FC08; Sat, 3 Mar 2012 02:13:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232DrcE058090; Sat, 3 Mar 2012 02:13:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232Dr4m058088; Sat, 3 Mar 2012 02:13:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203030213.q232Dr4m058088@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Mar 2012 02:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232427 - stable/9/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 02:13:54 -0000 Author: nwhitehorn Date: Sat Mar 3 02:13:53 2012 New Revision: 232427 URL: http://svn.freebsd.org/changeset/base/232427 Log: MFC r230482-230484,r230997: Per popular demand, if installing from a graphics terminal, show the installer log in real time on VTY 3, and spawn a shell on VTY 4. PR: bin/161048 Modified: stable/9/release/rc.local Directory Properties: stable/9/release/ (props changed) Modified: stable/9/release/rc.local ============================================================================== --- stable/9/release/rc.local Sat Mar 3 01:33:10 2012 (r232426) +++ stable/9/release/rc.local Sat Mar 3 02:13:53 2012 (r232427) @@ -12,12 +12,21 @@ MACHINE=`uname -m` kbdcontrol -d >/dev/null 2>&1 if [ $? -eq 0 ]; then - # Syscons: use xterm + # Syscons: use xterm, start interesting things on other VTYs if [ ${MACHINE} = "pc98" ]; then TERM=cons25w else TERM=xterm fi + + if [ -z "$EXTERNAL_VTY_STARTED" ]; then + # Init will clean these processes up if/when the system + # goes multiuser + touch /tmp/bsdinstall_log + tail -f /tmp/bsdinstall_log > /dev/ttyv2 & + /usr/libexec/getty autologin ttyv3 & + EXTERNAL_VTY_STARTED=1 + fi else # Serial or other console echo From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:14:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DE9A31065670; Sat, 3 Mar 2012 02:14:59 +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 B34BE8FC08; Sat, 3 Mar 2012 02:14:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232Ex55058174; Sat, 3 Mar 2012 02:14:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232Ex5V058172; Sat, 3 Mar 2012 02:14:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203030214.q232Ex5V058172@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Mar 2012 02:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232428 - stable/9/sys/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, 03 Mar 2012 02:15:00 -0000 Author: nwhitehorn Date: Sat Mar 3 02:14:59 2012 New Revision: 232428 URL: http://svn.freebsd.org/changeset/base/232428 Log: MFC r231046: Inherit from PCI bridge driver instead of manually specifying all of its methods. Obtained from: sparc64 Modified: stable/9/sys/powerpc/ofw/ofw_pcib_pci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/ofw/ofw_pcib_pci.c ============================================================================== --- stable/9/sys/powerpc/ofw/ofw_pcib_pci.c Sat Mar 3 02:13:53 2012 (r232427) +++ stable/9/sys/powerpc/ofw/ofw_pcib_pci.c Sat Mar 3 02:14:59 2012 (r232428) @@ -56,31 +56,10 @@ static int ofw_pcib_pci_route_interrupt( static device_method_t ofw_pcib_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ofw_pcib_pci_probe), - DEVMETHOD(device_attach, ofw_pcib_pci_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_read_ivar, pcib_read_ivar), - DEVMETHOD(bus_write_ivar, pcib_write_ivar), - DEVMETHOD(bus_alloc_resource, pcib_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(device_attach, ofw_pcib_pci_attach), /* pcib interface */ - DEVMETHOD(pcib_maxslots, pcib_maxslots), - DEVMETHOD(pcib_read_config, pcib_read_config), - DEVMETHOD(pcib_write_config, pcib_write_config), DEVMETHOD(pcib_route_interrupt, ofw_pcib_pci_route_interrupt), - DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi), - DEVMETHOD(pcib_release_msi, pcib_release_msi), - DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix), - DEVMETHOD(pcib_release_msix, pcib_release_msix), - DEVMETHOD(pcib_map_msi, pcib_map_msi), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_pci_get_node), @@ -101,8 +80,8 @@ struct ofw_pcib_softc { struct ofw_bus_iinfo ops_iinfo; }; -DEFINE_CLASS_0(pcib, ofw_pcib_pci_driver, ofw_pcib_pci_methods, - sizeof(struct ofw_pcib_softc)); +DEFINE_CLASS_1(pcib, ofw_pcib_pci_driver, ofw_pcib_pci_methods, + sizeof(struct ofw_pcib_softc), pcib_driver); DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0); static int From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:15:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2610C1065674; Sat, 3 Mar 2012 02:15:53 +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 145778FC13; Sat, 3 Mar 2012 02:15:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232FqEi058261; Sat, 3 Mar 2012 02:15:52 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232FqUo058258; Sat, 3 Mar 2012 02:15:52 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203030215.q232FqUo058258@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Mar 2012 02:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232429 - in stable/9/sys/powerpc: ofw ps3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 02:15:53 -0000 Author: nwhitehorn Date: Sat Mar 3 02:15:52 2012 New Revision: 232429 URL: http://svn.freebsd.org/changeset/base/232429 Log: MFC r230992: Avoid warnings about duplicate modules. Modified: stable/9/sys/powerpc/ofw/ofw_syscons.c stable/9/sys/powerpc/ps3/ps3_syscons.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/ofw/ofw_syscons.c ============================================================================== --- stable/9/sys/powerpc/ofw/ofw_syscons.c Sat Mar 3 02:14:59 2012 (r232428) +++ stable/9/sys/powerpc/ofw/ofw_syscons.c Sat Mar 3 02:15:52 2012 (r232429) @@ -984,7 +984,7 @@ static driver_t ofwfb_sc_driver = { static devclass_t sc_devclass; -DRIVER_MODULE(sc, nexus, ofwfb_sc_driver, sc_devclass, 0, 0); +DRIVER_MODULE(ofwfb, nexus, ofwfb_sc_driver, sc_devclass, 0, 0); /* * Define a stub keyboard driver in case one hasn't been Modified: stable/9/sys/powerpc/ps3/ps3_syscons.c ============================================================================== --- stable/9/sys/powerpc/ps3/ps3_syscons.c Sat Mar 3 02:14:59 2012 (r232428) +++ stable/9/sys/powerpc/ps3/ps3_syscons.c Sat Mar 3 02:15:52 2012 (r232429) @@ -749,7 +749,7 @@ static driver_t ps3fb_sc_driver = { static devclass_t sc_devclass; -DRIVER_MODULE(sc, nexus, ps3fb_sc_driver, sc_devclass, 0, 0); +DRIVER_MODULE(ps3fb, nexus, ps3fb_sc_driver, sc_devclass, 0, 0); /* * Define a stub keyboard driver in case one hasn't been From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:16:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4E90106566B; Sat, 3 Mar 2012 02:16:45 +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 A307D8FC14; Sat, 3 Mar 2012 02:16:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232GjYO058345; Sat, 3 Mar 2012 02:16:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232GjC7058343; Sat, 3 Mar 2012 02:16:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203030216.q232GjC7058343@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Mar 2012 02:16:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232430 - stable/9/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, 03 Mar 2012 02:16:45 -0000 Author: nwhitehorn Date: Sat Mar 3 02:16:45 2012 New Revision: 232430 URL: http://svn.freebsd.org/changeset/base/232430 Log: MFC r231770: Improve error handling in smusat(4). Modified: stable/9/sys/powerpc/powermac/smusat.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/powermac/smusat.c ============================================================================== --- stable/9/sys/powerpc/powermac/smusat.c Sat Mar 3 02:15:52 2012 (r232429) +++ stable/9/sys/powerpc/powermac/smusat.c Sat Mar 3 02:16:45 2012 (r232430) @@ -202,33 +202,46 @@ static int smusat_updatecache(device_t dev) { uint8_t reg = 0x3f; + uint8_t value[16]; struct smusat_softc *sc = device_get_softc(dev); + int error; struct iic_msg msgs[2] = { {0, IIC_M_WR | IIC_M_NOSTOP, 1, ®}, - {0, IIC_M_RD, 16, sc->sc_cache}, + {0, IIC_M_RD, 16, value}, }; msgs[0].slave = msgs[1].slave = iicbus_get_addr(dev); - sc->sc_last_update = time_uptime; + error = iicbus_transfer(dev, msgs, 2); + if (error) + return (error); - return (iicbus_transfer(dev, msgs, 2)); + sc->sc_last_update = time_uptime; + memcpy(sc->sc_cache, value, sizeof(value)); + return (0); } static int smusat_sensor_read(struct smu_sensor *sens) { - int value; + int value, error; device_t dev; struct smusat_softc *sc; dev = sens->dev; sc = device_get_softc(dev); + error = 0; if (time_uptime - sc->sc_last_update > 1) - smusat_updatecache(dev); + error = smusat_updatecache(dev); + if (error) + return (-error); value = (sc->sc_cache[sens->reg*2] << 8) + sc->sc_cache[sens->reg*2 + 1]; + if (value == 0xffff) { + sc->sc_last_update = 0; /* Result was bad, don't cache */ + return (-EINVAL); + } switch (sens->type) { case SMU_TEMP_SENSOR: From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:19:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD70D106566C; Sat, 3 Mar 2012 02:19:33 +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 B9F618FC12; Sat, 3 Mar 2012 02:19:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232JXD5058496; Sat, 3 Mar 2012 02:19:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232JXcN058488; Sat, 3 Mar 2012 02:19:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203030219.q232JXcN058488@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Mar 2012 02:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232431 - in stable/9/sys/powerpc: aim include powerpc ps3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 02:19:33 -0000 Author: nwhitehorn Date: Sat Mar 3 02:19:33 2012 New Revision: 232431 URL: http://svn.freebsd.org/changeset/base/232431 Log: MFC r230123,230139: Rework SLB trap handling so that double-faults into an SLB trap handler are possible, and double faults within an SLB trap handler are not. The result is that it possible to take an SLB fault at any time, on any address, for any reason, at any point in the kernel. This lets us do two important things. First, it removes the (soft) 16 GB RAM ceiling on PPC64 as well as any architectural limitations on KVA space. Second, it lets the kernel tolerate poorly designed hypervisors that have a tendency to fail to restore the SLB properly after a hypervisor context switch. Now that we can tolerate LPAR context switches on the PS3 hypervisor, going to hypervisor-idle on both threads will not hang the kernel. Modified: stable/9/sys/powerpc/aim/machdep.c stable/9/sys/powerpc/aim/slb.c stable/9/sys/powerpc/aim/trap.c stable/9/sys/powerpc/aim/trap_subr64.S stable/9/sys/powerpc/include/pcpu.h stable/9/sys/powerpc/powerpc/genassym.c stable/9/sys/powerpc/ps3/platform_ps3.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/aim/machdep.c ============================================================================== --- stable/9/sys/powerpc/aim/machdep.c Sat Mar 3 02:16:45 2012 (r232430) +++ stable/9/sys/powerpc/aim/machdep.c Sat Mar 3 02:19:33 2012 (r232431) @@ -238,6 +238,7 @@ extern void *trapcode64; extern void *rstcode, *rstsize; #endif extern void *trapcode, *trapsize; +extern void *slbtrap, *slbtrapsize; extern void *alitrap, *alisize; extern void *dsitrap, *dsisize; extern void *decrint, *decrsize; @@ -485,8 +486,8 @@ powerpc_init(vm_offset_t startkernel, vm bcopy(&dsitrap, (void *)(EXC_DSI + trap_offset), (size_t)&dsisize); bcopy(generictrap, (void *)EXC_ISI, (size_t)&trapsize); #ifdef __powerpc64__ - bcopy(generictrap, (void *)EXC_DSE, (size_t)&trapsize); - bcopy(generictrap, (void *)EXC_ISE, (size_t)&trapsize); + bcopy(&slbtrap, (void *)EXC_DSE, (size_t)&slbtrapsize); + bcopy(&slbtrap, (void *)EXC_ISE, (size_t)&slbtrapsize); #endif bcopy(generictrap, (void *)EXC_EXI, (size_t)&trapsize); bcopy(generictrap, (void *)EXC_FPU, (size_t)&trapsize); Modified: stable/9/sys/powerpc/aim/slb.c ============================================================================== --- stable/9/sys/powerpc/aim/slb.c Sat Mar 3 02:16:45 2012 (r232430) +++ stable/9/sys/powerpc/aim/slb.c Sat Mar 3 02:19:33 2012 (r232431) @@ -410,15 +410,11 @@ slb_alloc_tree(void) /* Lock entries mapping kernel text and stacks */ -#define SLB_SPILLABLE(slbe) \ - (((slbe & SLBE_ESID_MASK) < VM_MIN_KERNEL_ADDRESS && \ - (slbe & SLBE_ESID_MASK) > 16*SEGMENT_LENGTH) || \ - (slbe & SLBE_ESID_MASK) > VM_MAX_KERNEL_ADDRESS) void slb_insert_kernel(uint64_t slbe, uint64_t slbv) { struct slb *slbcache; - int i, j; + int i; /* We don't want to be preempted while modifying the kernel map */ critical_enter(); @@ -438,15 +434,9 @@ slb_insert_kernel(uint64_t slbe, uint64_ slbcache[USER_SLB_SLOT].slbe = 1; } - for (i = mftb() % n_slbs, j = 0; j < n_slbs; j++, i = (i+1) % n_slbs) { - if (i == USER_SLB_SLOT) - continue; - - if (SLB_SPILLABLE(slbcache[i].slbe)) - break; - } - - KASSERT(j < n_slbs, ("All kernel SLB slots locked!")); + i = mftb() % n_slbs; + if (i == USER_SLB_SLOT) + i = (i+1) % n_slbs; fillkernslb: KASSERT(i != USER_SLB_SLOT, Modified: stable/9/sys/powerpc/aim/trap.c ============================================================================== --- stable/9/sys/powerpc/aim/trap.c Sat Mar 3 02:16:45 2012 (r232430) +++ stable/9/sys/powerpc/aim/trap.c Sat Mar 3 02:19:33 2012 (r232431) @@ -88,7 +88,9 @@ static int handle_onfault(struct trapfra static void syscall(struct trapframe *frame); #ifdef __powerpc64__ -static int handle_slb_spill(pmap_t pm, vm_offset_t addr); + void handle_kernel_slb_spill(int, register_t, register_t); +static int handle_user_slb_spill(pmap_t pm, vm_offset_t addr); +extern int n_slbs; #endif int setfault(faultbuf); /* defined in locore.S */ @@ -191,7 +193,7 @@ trap(struct trapframe *frame) #ifdef __powerpc64__ case EXC_ISE: case EXC_DSE: - if (handle_slb_spill(&p->p_vmspace->vm_pmap, + if (handle_user_slb_spill(&p->p_vmspace->vm_pmap, (type == EXC_ISE) ? frame->srr0 : frame->cpu.aim.dar) != 0) sig = SIGSEGV; @@ -259,27 +261,20 @@ trap(struct trapframe *frame) KASSERT(cold || td->td_ucred != NULL, ("kernel trap doesn't have ucred")); switch (type) { - case EXC_DSI: - if (trap_pfault(frame, 0) == 0) - return; - break; #ifdef __powerpc64__ case EXC_DSE: if ((frame->cpu.aim.dar & SEGMENT_MASK) == USER_ADDR) { __asm __volatile ("slbmte %0, %1" :: - "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), - "r"(USER_SLB_SLBE)); + "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), + "r"(USER_SLB_SLBE)); return; } - - /* FALLTHROUGH */ - case EXC_ISE: - if (handle_slb_spill(kernel_pmap, - (type == EXC_ISE) ? frame->srr0 : - frame->cpu.aim.dar) != 0) - panic("Fault handling kernel SLB miss"); - return; + break; #endif + case EXC_DSI: + if (trap_pfault(frame, 0) == 0) + return; + break; case EXC_MCHK: if (handle_onfault(frame)) return; @@ -326,8 +321,7 @@ printtrap(u_int vector, struct trapframe printf("%s %s trap:\n", isfatal ? "fatal" : "handled", user ? "user" : "kernel"); printf("\n"); - printf(" exception = 0x%x (%s)\n", vector >> 8, - trapname(vector)); + printf(" exception = 0x%x (%s)\n", vector, trapname(vector)); switch (vector) { case EXC_DSE: case EXC_DSI: @@ -486,8 +480,54 @@ syscall(struct trapframe *frame) } #ifdef __powerpc64__ +/* Handle kernel SLB faults -- runs in real mode, all seat belts off */ +void +handle_kernel_slb_spill(int type, register_t dar, register_t srr0) +{ + struct slb *slbcache; + uint64_t slbe, slbv; + uint64_t esid, addr; + int i; + + addr = (type == EXC_ISE) ? srr0 : dar; + slbcache = PCPU_GET(slb); + esid = (uintptr_t)addr >> ADDR_SR_SHFT; + slbe = (esid << SLBE_ESID_SHIFT) | SLBE_VALID; + + /* See if the hardware flushed this somehow (can happen in LPARs) */ + for (i = 0; i < n_slbs; i++) + if (slbcache[i].slbe == (slbe | (uint64_t)i)) + return; + + /* Not in the map, needs to actually be added */ + slbv = kernel_va_to_slbv(addr); + if (slbcache[USER_SLB_SLOT].slbe == 0) { + for (i = 0; i < n_slbs; i++) { + if (i == USER_SLB_SLOT) + continue; + if (!(slbcache[i].slbe & SLBE_VALID)) + goto fillkernslb; + } + + if (i == n_slbs) + slbcache[USER_SLB_SLOT].slbe = 1; + } + + /* Sacrifice a random SLB entry that is not the user entry */ + i = mftb() % n_slbs; + if (i == USER_SLB_SLOT) + i = (i+1) % n_slbs; + +fillkernslb: + /* Write new entry */ + slbcache[i].slbv = slbv; + slbcache[i].slbe = slbe | (uint64_t)i; + + /* Trap handler will restore from cache on exit */ +} + static int -handle_slb_spill(pmap_t pm, vm_offset_t addr) +handle_user_slb_spill(pmap_t pm, vm_offset_t addr) { struct slb *user_entry; uint64_t esid; @@ -495,12 +535,6 @@ handle_slb_spill(pmap_t pm, vm_offset_t esid = (uintptr_t)addr >> ADDR_SR_SHFT; - if (pm == kernel_pmap) { - slb_insert_kernel((esid << SLBE_ESID_SHIFT) | SLBE_VALID, - kernel_va_to_slbv(addr)); - return (0); - } - PMAP_LOCK(pm); user_entry = user_va_to_slb_entry(pm, addr); Modified: stable/9/sys/powerpc/aim/trap_subr64.S ============================================================================== --- stable/9/sys/powerpc/aim/trap_subr64.S Sat Mar 3 02:16:45 2012 (r232430) +++ stable/9/sys/powerpc/aim/trap_subr64.S Sat Mar 3 02:19:33 2012 (r232431) @@ -112,6 +112,9 @@ restore_kernsrs: * r31 scratch * r1 kernel stack * SRR0/1 as at start of trap + * + * NOTE: SPRG1 is never used while the MMU is on, making it safe to reuse + * in any real-mode fault handler, including those handling double faults. */ #define FRAME_SETUP(savearea) \ /* Have to enable translation to allow access of kernel stack: */ \ @@ -120,11 +123,11 @@ restore_kernsrs: std %r30,(savearea+CPUSAVE_SRR0)(%r31); /* save SRR0 */ \ mfsrr1 %r30; \ std %r30,(savearea+CPUSAVE_SRR1)(%r31); /* save SRR1 */ \ + mfsprg1 %r31; /* get saved SP (clears SPRG1) */ \ mfmsr %r30; \ ori %r30,%r30,(PSL_DR|PSL_IR|PSL_RI)@l; /* relocation on */ \ mtmsr %r30; /* stack can now be accessed */ \ isync; \ - mfsprg1 %r31; /* get saved SP */ \ stdu %r31,-(FRAMELEN+288)(%r1); /* save it in the callframe */ \ std %r0, FRAME_0+48(%r1); /* save r0 in the trapframe */ \ std %r31,FRAME_1+48(%r1); /* save SP " " */ \ @@ -201,7 +204,7 @@ restore_kernsrs: mtctr %r4; \ mtxer %r5; \ mtlr %r6; \ - mtsprg1 %r7; /* save cr */ \ + mtsprg2 %r7; /* save cr */ \ ld %r31,FRAME_31+48(%r1); /* restore r0-31 */ \ ld %r30,FRAME_30+48(%r1); \ ld %r29,FRAME_29+48(%r1); \ @@ -235,16 +238,15 @@ restore_kernsrs: ld %r0, FRAME_0+48(%r1); \ ld %r1, FRAME_1+48(%r1); \ /* Can't touch %r1 from here on */ \ - mtsprg2 %r2; /* save r2 & r3 */ \ - mtsprg3 %r3; \ + mtsprg3 %r3; /* save r3 */ \ /* Disable translation, machine check and recoverability: */ \ - mfmsr %r2; \ - andi. %r2,%r2,~(PSL_DR|PSL_IR|PSL_ME|PSL_RI)@l; \ - mtmsr %r2; \ + mfmsr %r3; \ + andi. %r3,%r3,~(PSL_DR|PSL_IR|PSL_ME|PSL_RI)@l; \ + mtmsr %r3; \ isync; \ /* Decide whether we return to user mode: */ \ - GET_CPUINFO(%r2); \ - ld %r3,(savearea+CPUSAVE_SRR1)(%r2); \ + GET_CPUINFO(%r3); \ + ld %r3,(savearea+CPUSAVE_SRR1)(%r3); \ mtcr %r3; \ bf 17,1f; /* branch if PSL_PR is false */ \ /* Restore user SRs */ \ @@ -262,15 +264,15 @@ restore_kernsrs: ld %r29,(savearea+CPUSAVE_R29)(%r3); \ ld %r28,(savearea+CPUSAVE_R28)(%r3); \ ld %r27,(savearea+CPUSAVE_R27)(%r3); \ -1: mfsprg1 %r2; /* restore cr */ \ - mtcr %r2; \ - GET_CPUINFO(%r2); \ - ld %r3,(savearea+CPUSAVE_SRR0)(%r2); /* restore srr0 */ \ +1: mfsprg2 %r3; /* restore cr */ \ + mtcr %r3; \ + GET_CPUINFO(%r3); \ + ld %r3,(savearea+CPUSAVE_SRR0)(%r3); /* restore srr0 */ \ mtsrr0 %r3; \ - ld %r3,(savearea+CPUSAVE_SRR1)(%r2); /* restore srr1 */ \ + GET_CPUINFO(%r3); \ + ld %r3,(savearea+CPUSAVE_SRR1)(%r3); /* restore srr1 */ \ mtsrr1 %r3; \ - mfsprg2 %r2; /* restore r2 & r3 */ \ - mfsprg3 %r3 + mfsprg3 %r3 /* restore r3 */ #ifdef SMP /* @@ -329,6 +331,151 @@ CNAME(trapcode): CNAME(trapsize) = .-CNAME(trapcode) /* + * For SLB misses: do special things for the kernel + * + * Note: SPRG1 is always safe to overwrite any time the MMU is on, which is + * the only time this can be called. + */ + .globl CNAME(slbtrap),CNAME(slbtrapsize) +CNAME(slbtrap): + mtsprg1 %r1 /* save SP */ + GET_CPUINFO(%r1) + std %r2,(PC_SLBSAVE+16)(%r1) + mfcr %r2 /* save CR */ + std %r2,(PC_SLBSAVE+104)(%r1) + mfsrr1 %r2 /* test kernel mode */ + mtcr %r2 + bf 17,1f /* branch if PSL_PR is false */ + /* User mode */ + ld %r2,(PC_SLBSAVE+104)(%r1) /* Restore CR */ + mtcr %r2 + ld %r2,(PC_SLBSAVE+16)(%r1) /* Restore R2 */ + mflr %r1 /* Save the old LR in r1 */ + mtsprg2 %r1 /* And then in SPRG2 */ + li %r1, 0x80 /* How to get the vector from LR */ + bla generictrap /* LR & SPRG3 is exception # */ +1: mflr %r2 /* Save the old LR in r2 */ + bla kern_slbtrap +CNAME(slbtrapsize) = .-CNAME(slbtrap) + +kern_slbtrap: + std %r2,(PC_SLBSAVE+136)(%r1) /* old LR */ + std %r3,(PC_SLBSAVE+24)(%r1) /* save R3 */ + + /* Check if this needs to be handled as a regular trap (userseg miss) */ + mflr %r2 + andi. %r2,%r2,0xff80 + cmpwi %r2,0x380 + bne 1f + mfdar %r2 + b 2f +1: mfsrr0 %r2 +2: /* r2 now contains the fault address */ + lis %r3,SEGMENT_MASK@highesta + ori %r3,%r3,SEGMENT_MASK@highera + sldi %r3,%r3,32 + oris %r3,%r3,SEGMENT_MASK@ha + ori %r3,%r3,SEGMENT_MASK@l + and %r2,%r2,%r3 /* R2 = segment base address */ + lis %r3,USER_ADDR@highesta + ori %r3,%r3,USER_ADDR@highera + sldi %r3,%r3,32 + oris %r3,%r3,USER_ADDR@ha + ori %r3,%r3,USER_ADDR@l + cmpd %r2,%r3 /* Compare fault base to USER_ADDR */ + bne 3f + + /* User seg miss, handle as a regular trap */ + ld %r2,(PC_SLBSAVE+104)(%r1) /* Restore CR */ + mtcr %r2 + ld %r2,(PC_SLBSAVE+16)(%r1) /* Restore R2,R3 */ + ld %r3,(PC_SLBSAVE+24)(%r1) + ld %r1,(PC_SLBSAVE+136)(%r1) /* Save the old LR in r1 */ + mtsprg2 %r1 /* And then in SPRG2 */ + li %r1, 0x80 /* How to get the vector from LR */ + b generictrap /* Retain old LR using b */ + +3: /* Real kernel SLB miss */ + std %r0,(PC_SLBSAVE+0)(%r1) /* free all volatile regs */ + mfsprg1 %r2 /* Old R1 */ + std %r2,(PC_SLBSAVE+8)(%r1) + /* R2,R3 already saved */ + std %r4,(PC_SLBSAVE+32)(%r1) + std %r5,(PC_SLBSAVE+40)(%r1) + std %r6,(PC_SLBSAVE+48)(%r1) + std %r7,(PC_SLBSAVE+56)(%r1) + std %r8,(PC_SLBSAVE+64)(%r1) + std %r9,(PC_SLBSAVE+72)(%r1) + std %r10,(PC_SLBSAVE+80)(%r1) + std %r11,(PC_SLBSAVE+88)(%r1) + std %r12,(PC_SLBSAVE+96)(%r1) + /* CR already saved */ + mfxer %r2 /* save XER */ + std %r2,(PC_SLBSAVE+112)(%r1) + mflr %r2 /* save LR (SP already saved) */ + std %r2,(PC_SLBSAVE+120)(%r1) + mfctr %r2 /* save CTR */ + std %r2,(PC_SLBSAVE+128)(%r1) + + /* Call handler */ + addi %r1,%r1,PC_SLBSTACK-48+1024 + li %r2,~15 + and %r1,%r1,%r2 + lis %r3,tocbase@ha + ld %r2,tocbase@l(%r3) + mflr %r3 + andi. %r3,%r3,0xff80 + mfdar %r4 + mfsrr0 %r5 + bl handle_kernel_slb_spill + nop + + /* Save r28-31, restore r4-r12 */ + GET_CPUINFO(%r1) + ld %r4,(PC_SLBSAVE+32)(%r1) + ld %r5,(PC_SLBSAVE+40)(%r1) + ld %r6,(PC_SLBSAVE+48)(%r1) + ld %r7,(PC_SLBSAVE+56)(%r1) + ld %r8,(PC_SLBSAVE+64)(%r1) + ld %r9,(PC_SLBSAVE+72)(%r1) + ld %r10,(PC_SLBSAVE+80)(%r1) + ld %r11,(PC_SLBSAVE+88)(%r1) + ld %r12,(PC_SLBSAVE+96)(%r1) + std %r28,(PC_SLBSAVE+64)(%r1) + std %r29,(PC_SLBSAVE+72)(%r1) + std %r30,(PC_SLBSAVE+80)(%r1) + std %r31,(PC_SLBSAVE+88)(%r1) + + /* Restore kernel mapping */ + bl restore_kernsrs + + /* Restore remaining registers */ + ld %r28,(PC_SLBSAVE+64)(%r1) + ld %r29,(PC_SLBSAVE+72)(%r1) + ld %r30,(PC_SLBSAVE+80)(%r1) + ld %r31,(PC_SLBSAVE+88)(%r1) + + ld %r2,(PC_SLBSAVE+104)(%r1) + mtcr %r2 + ld %r2,(PC_SLBSAVE+112)(%r1) + mtxer %r2 + ld %r2,(PC_SLBSAVE+120)(%r1) + mtlr %r2 + ld %r2,(PC_SLBSAVE+128)(%r1) + mtctr %r2 + ld %r2,(PC_SLBSAVE+136)(%r1) + mtlr %r2 + + /* Restore r0-r3 */ + ld %r0,(PC_SLBSAVE+0)(%r1) + ld %r2,(PC_SLBSAVE+16)(%r1) + ld %r3,(PC_SLBSAVE+24)(%r1) + mfsprg1 %r1 + + /* Back to whatever we were doing */ + rfid + +/* * For ALI: has to save DSISR and DAR */ .globl CNAME(alitrap),CNAME(alisize) Modified: stable/9/sys/powerpc/include/pcpu.h ============================================================================== --- stable/9/sys/powerpc/include/pcpu.h Sat Mar 3 02:16:45 2012 (r232430) +++ stable/9/sys/powerpc/include/pcpu.h Sat Mar 3 02:19:33 2012 (r232431) @@ -55,7 +55,9 @@ struct pmap; #define PCPU_MD_AIM64_FIELDS \ struct slb pc_slb[64]; \ - struct slb **pc_userslb; + struct slb **pc_userslb; \ + register_t pc_slbsave[18]; \ + uint8_t pc_slbstack[1024]; #ifdef __powerpc64__ #define PCPU_MD_AIM_FIELDS PCPU_MD_AIM64_FIELDS Modified: stable/9/sys/powerpc/powerpc/genassym.c ============================================================================== --- stable/9/sys/powerpc/powerpc/genassym.c Sat Mar 3 02:16:45 2012 (r232430) +++ stable/9/sys/powerpc/powerpc/genassym.c Sat Mar 3 02:19:33 2012 (r232431) @@ -107,8 +107,11 @@ ASSYM(USER_ADDR, USER_ADDR); #ifdef __powerpc64__ ASSYM(PC_KERNSLB, offsetof(struct pcpu, pc_slb)); ASSYM(PC_USERSLB, offsetof(struct pcpu, pc_userslb)); +ASSYM(PC_SLBSAVE, offsetof(struct pcpu, pc_slbsave)); +ASSYM(PC_SLBSTACK, offsetof(struct pcpu, pc_slbstack)); ASSYM(USER_SLB_SLOT, USER_SLB_SLOT); ASSYM(USER_SLB_SLBE, USER_SLB_SLBE); +ASSYM(SEGMENT_MASK, SEGMENT_MASK); #else ASSYM(PM_SR, offsetof(struct pmap, pm_sr)); ASSYM(USER_SR, USER_SR); Modified: stable/9/sys/powerpc/ps3/platform_ps3.c ============================================================================== --- stable/9/sys/powerpc/ps3/platform_ps3.c Sat Mar 3 02:16:45 2012 (r232430) +++ stable/9/sys/powerpc/ps3/platform_ps3.c Sat Mar 3 02:19:33 2012 (r232431) @@ -247,16 +247,6 @@ ps3_real_maxaddr(platform_t plat) static void ps3_cpu_idle(void) { - static volatile int pausing = 0; - - /* - * XXX: It appears that the PS3 can livelock if both threads - * call lv1_pause(0) simultaneously. - */ - if (!atomic_cmpset_int(&pausing, 0, 1)) - return; - lv1_pause(0); - pausing = 0; } From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:20:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 17FA1106564A; Sat, 3 Mar 2012 02:20:47 +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 E0D458FC0A; Sat, 3 Mar 2012 02:20:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232KkU5058594; Sat, 3 Mar 2012 02:20:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232KkMr058591; Sat, 3 Mar 2012 02:20:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203030220.q232KkMr058591@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Mar 2012 02:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232432 - stable/9/sys/boot/powerpc/boot1.chrp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 02:20:47 -0000 Author: nwhitehorn Date: Sat Mar 3 02:20:46 2012 New Revision: 232432 URL: http://svn.freebsd.org/changeset/base/232432 Log: MFC r231810: Make sure to synchronize icache for the newly loaded loader. Not an issue on most systems, when the relevant icache lines are not full. Modified: stable/9/sys/boot/powerpc/boot1.chrp/Makefile stable/9/sys/boot/powerpc/boot1.chrp/boot1.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) Modified: stable/9/sys/boot/powerpc/boot1.chrp/Makefile ============================================================================== --- stable/9/sys/boot/powerpc/boot1.chrp/Makefile Sat Mar 3 02:19:33 2012 (r232431) +++ stable/9/sys/boot/powerpc/boot1.chrp/Makefile Sat Mar 3 02:20:46 2012 (r232432) @@ -8,17 +8,18 @@ BINDIR?= /boot INSTALLFLAGS= -b FILES= boot1.hfs -SRCS= boot1.c ashldi3.c +SRCS= boot1.c ashldi3.c syncicache.c INTERNALPROG= NO_MAN= CFLAGS= -ffreestanding -msoft-float -Os \ - -I${.CURDIR}/../../common -I${.CURDIR}/../../../ + -I${.CURDIR}/../../common -I${.CURDIR}/../../../ \ + -D_STANDALONE LDFLAGS=-nostdlib -static -N .include "${.CURDIR}/../Makefile.inc" -.PATH: ${.CURDIR}/../../../libkern ${.CURDIR} +.PATH: ${.CURDIR}/../../../libkern ${.CURDIR}/../../../../lib/libc/powerpc/gen ${.CURDIR} # The following inserts out objects into a template HFS # created by generate-hfs.sh Modified: stable/9/sys/boot/powerpc/boot1.chrp/boot1.c ============================================================================== --- stable/9/sys/boot/powerpc/boot1.chrp/boot1.c Sat Mar 3 02:19:33 2012 (r232431) +++ stable/9/sys/boot/powerpc/boot1.chrp/boot1.c Sat Mar 3 02:20:46 2012 (r232432) @@ -77,6 +77,8 @@ static int __sputc(char c, void *arg); static char *__uitoa(char *buf, u_int val, int base); static char *__ultoa(char *buf, u_long val, int base); +void __syncicache(void *, int); + /* * Open Firmware interface functions */ @@ -523,6 +525,7 @@ load(const char *fname) } if (ph.p_filesz != ph.p_memsz) bzero(p + ph.p_filesz, ph.p_memsz - ph.p_filesz); + __syncicache(p, ph.p_memsz); } ofw_close(bootdev); (*(void (*)(void *, int, ofwfp_t, char *, int))eh.e_entry)(NULL, 0, From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:23:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D43D106564A; Sat, 3 Mar 2012 02:23:10 +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 E5AE58FC18; Sat, 3 Mar 2012 02:23:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232N9vA058740; Sat, 3 Mar 2012 02:23:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232N9kX058737; Sat, 3 Mar 2012 02:23:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203030223.q232N9kX058737@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 3 Mar 2012 02:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232433 - in stable/9/usr.sbin/bsdinstall: distextract distfetch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 02:23:10 -0000 Author: nwhitehorn Date: Sat Mar 3 02:23:09 2012 New Revision: 232433 URL: http://svn.freebsd.org/changeset/base/232433 Log: MFC r232200: Fix segfault if distfetch and distextract binaries are run standalone without the DISTRIBUTIONS environment variable set. PR: bin/165492 Submitted by: Fernando Apesteguia Modified: stable/9/usr.sbin/bsdinstall/distextract/distextract.c stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c Directory Properties: stable/9/usr.sbin/bsdinstall/ (props changed) Modified: stable/9/usr.sbin/bsdinstall/distextract/distextract.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/distextract/distextract.c Sat Mar 3 02:20:46 2012 (r232432) +++ stable/9/usr.sbin/bsdinstall/distextract/distextract.c Sat Mar 3 02:23:09 2012 (r232433) @@ -38,9 +38,16 @@ static int extract_files(int nfiles, con int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; const char **dists; int i, retval, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; Modified: stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c Sat Mar 3 02:20:46 2012 (r232432) +++ stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c Sat Mar 3 02:23:09 2012 (r232433) @@ -37,9 +37,16 @@ static int fetch_files(int nfiles, char int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; char **urls; int i, nfetched, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 02:35:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 872A41065672; Sat, 3 Mar 2012 02:35:46 +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 75D958FC16; Sat, 3 Mar 2012 02:35:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q232ZkJd059188; Sat, 3 Mar 2012 02:35:46 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q232Zka8059186; Sat, 3 Mar 2012 02:35:46 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201203030235.q232Zka8059186@svn.freebsd.org> From: Xin LI Date: Sat, 3 Mar 2012 02:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232434 - stable/9/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 02:35:46 -0000 Author: delphij Date: Sat Mar 3 02:35:45 2012 New Revision: 232434 URL: http://svn.freebsd.org/changeset/base/232434 Log: MFC r231888: Put the signal trap output to standard error instead of standard output. Without this change, pressing ^T could result in rc.d script putting junk strings like: Script running in configuration files when redirecting standard output to these files. Modified: stable/9/etc/rc.subr Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/rc.subr ============================================================================== --- stable/9/etc/rc.subr Sat Mar 3 02:23:09 2012 (r232433) +++ stable/9/etc/rc.subr Sat Mar 3 02:35:45 2012 (r232434) @@ -1027,9 +1027,9 @@ run_rc_script() if [ -n "$rc_fast_and_loose" ]; then set $_arg; . $_file else - ( trap "echo Script $_file interrupted; kill -QUIT $$" 3 - trap "echo Script $_file interrupted; exit 1" 2 - trap "echo Script $_file running" 29 + ( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3 + trap "echo Script $_file interrupted >&2 ; exit 1" 2 + trap "echo Script $_file running >&2" 29 set $_arg; . $_file ) fi fi From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 05:04:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0F79F106564A; Sat, 3 Mar 2012 05:04:48 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2E398FC0C; Sat, 3 Mar 2012 05:04:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2354lG5064328; Sat, 3 Mar 2012 05:04:47 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2354lNf064326; Sat, 3 Mar 2012 05:04:47 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030504.q2354lNf064326@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 05:04: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: r232435 - head/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 05:04:48 -0000 Author: kensmith Date: Sat Mar 3 05:04:47 2012 New Revision: 232435 URL: http://svn.freebsd.org/changeset/base/232435 Log: Add entry for packages-8.3-release directory. Modified: head/usr.sbin/pkg_install/add/main.c Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Sat Mar 3 02:35:45 2012 (r232434) +++ head/usr.sbin/pkg_install/add/main.c Sat Mar 3 05:04:47 2012 (r232435) @@ -87,6 +87,7 @@ struct { { 800000, 800499, "/packages-8.0-release" }, { 801000, 801499, "/packages-8.1-release" }, { 802000, 802499, "/packages-8.2-release" }, + { 803000, 803499, "/packages-8.3-release" }, { 900000, 900499, "/packages-9.0-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 05:14:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3030106566C; Sat, 3 Mar 2012 05:14:37 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E15D48FC14; Sat, 3 Mar 2012 05:14:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q235Ebfk064665; Sat, 3 Mar 2012 05:14:37 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q235Ebr2064663; Sat, 3 Mar 2012 05:14:37 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030514.q235Ebr2064663@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 05:14:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232436 - stable/9/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 05:14:38 -0000 Author: kensmith Date: Sat Mar 3 05:14:37 2012 New Revision: 232436 URL: http://svn.freebsd.org/changeset/base/232436 Log: Merge r232435: > Add entry for packages-8.3-release directory. Insta-merge because this is part of the prep work for branching releng/8.3 as part of doing 8.3-RC1. Modified: stable/9/usr.sbin/pkg_install/add/main.c Directory Properties: stable/9/usr.sbin/pkg_install/add/ (props changed) Modified: stable/9/usr.sbin/pkg_install/add/main.c ============================================================================== --- stable/9/usr.sbin/pkg_install/add/main.c Sat Mar 3 05:04:47 2012 (r232435) +++ stable/9/usr.sbin/pkg_install/add/main.c Sat Mar 3 05:14:37 2012 (r232436) @@ -87,6 +87,7 @@ struct { { 800000, 800499, "/packages-8.0-release" }, { 801000, 801499, "/packages-8.1-release" }, { 802000, 802499, "/packages-8.2-release" }, + { 803000, 803499, "/packages-8.3-release" }, { 900000, 900499, "/packages-9.0-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 05:46:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 34BF61065670; Sat, 3 Mar 2012 05:46:25 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 231938FC0A; Sat, 3 Mar 2012 05:46:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q235kO38065800; Sat, 3 Mar 2012 05:46:24 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q235kOXe065798; Sat, 3 Mar 2012 05:46:24 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030546.q235kOXe065798@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 05:46: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: r232437 - stable/8/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 05:46:25 -0000 Author: kensmith Date: Sat Mar 3 05:46:24 2012 New Revision: 232437 URL: http://svn.freebsd.org/changeset/base/232437 Log: Merge r229304,r229748,r229751,r232436 Catch up to head and stable/9 for what combination of __FreeBSD_version values map to package directories. Approved by: re (implicit) Modified: stable/8/usr.sbin/pkg_install/add/main.c Directory Properties: stable/8/usr.sbin/pkg_install/add/ (props changed) Modified: stable/8/usr.sbin/pkg_install/add/main.c ============================================================================== --- stable/8/usr.sbin/pkg_install/add/main.c Sat Mar 3 05:14:37 2012 (r232436) +++ stable/8/usr.sbin/pkg_install/add/main.c Sat Mar 3 05:46:24 2012 (r232437) @@ -87,6 +87,8 @@ struct { { 800000, 800499, "/packages-8.0-release" }, { 801000, 801499, "/packages-8.1-release" }, { 802000, 802499, "/packages-8.2-release" }, + { 803000, 803499, "/packages-8.3-release" }, + { 900000, 900499, "/packages-9.0-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 502128, "/packages-5-current" }, @@ -94,7 +96,8 @@ struct { { 600100, 699000, "/packages-6-stable" }, { 700100, 799000, "/packages-7-stable" }, { 800500, 899000, "/packages-8-stable" }, - { 900000, 999000, "/packages-9-current" }, + { 900500, 999000, "/packages-9-stable" }, + { 1000000, 1099000, "/packages-10-current" }, { 0, 9999999, "/packages-current" }, { 0, 0, NULL } }; From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 06:01:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3AD6B1065672; Sat, 3 Mar 2012 06:01:39 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 82D0C8FC08; Sat, 3 Mar 2012 06:01:38 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwAACmzUU+DaFvO/2dsb2JhbABDhTKdMJJigX0BAQQBI1YFFg4GBAICDRkCWQaIFAULpyKRc4EvjgqBFgSIUIxukxM X-IronPort-AV: E=Sophos;i="4.73,524,1325480400"; d="scan'208";a="158854064" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 03 Mar 2012 01:01:32 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 4E575B414D; Sat, 3 Mar 2012 01:01:32 -0500 (EST) Date: Sat, 3 Mar 2012 01:01:32 -0500 (EST) From: Rick Macklem To: John Baldwin Message-ID: <1978600220.298005.1330754492306.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <201203021153.06614.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Linux)/6.0.10_GA_2692) Cc: svn-src-head@freebsd.org, Peter Holm , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 06:01:39 -0000 John Baldwin wrote: > On Friday, March 02, 2012 8:29:21 am Peter Holm wrote: > > On Thu, Mar 01, 2012 at 04:47:41PM -0500, John Baldwin wrote: > > > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > > > Author: pho > > > > Date: Mon Oct 31 15:01:47 2011 > > > > New Revision: 226967 > > > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > > > > > Log: > > > > The kern_renameat() looks up the fvp using the DELETE flag, > > > > which causes > > > > the removal of the name cache entry for fvp. > > > > > > > > Reported by: Anton Yuzhaninov > > > > In collaboration with: kib > > > > MFC after: 1 week > > > > > > > > Modified: > > > > head/sys/ufs/ufs/ufs_vnops.c > > > > > > So I ran into this at work recently, and even this fix applied I > > > was still > > > seeing rename()'s that were seemingly not taking effect. After > > > getting some > > > extra KTR traces, I figured out that the same purge needs to be > > > applied to the > > > destination vnode. Specifically, the issue I ran into was that was > > > renaming > > > 'foo' to 'bar', but lookups for 'bar' were still returning the old > > > file. The > > > reason was that a lookup after the namei(RENAME) of the > > > destination while > > > ufs_rename() had its locks dropped was readding the name cache > > > entry for > > > 'bar', and then a cache_lookup() of 'bar' would return the old > > > vnode as long > > > as that vnode was valid (e.g. if it had a link in another > > > location, or other > > > processes had an open file descriptor for it). I'm currently > > > testing the > > > patch below: > > > > > > > I now have a scenario that fails, but not quite the same way you > > describe. > > > > It looks like this: > > > > touch file1 > > echo xxx > file2 > > rename(file1, file2) > > > > A different process performs stat() on both files in a tight loop. > > > > Once in a while I observe that a stat() of file2, after the rename, > > returns a link count of zero. Size is zero as expected, but the > > inode > > number of file2 is unchanged. > Peter, were you doing a stat() using the file name, or an fstat()? (Using stat() with afile name might explain it, maybe??) > Hmm, that is surprising. I would not expect inconsistent stat info. I > have no explanation for why that would happen. I do not have a > simplified > test program, just a specific workload at work. In this case it's > workflow > is more like this: > > fd = flopen(file1, O_CREAT); > fstat(fd); > if (st.st_size == 0) { > fd2 = open(file1.temp, O_CREAT | O_EXLOCK); > fd3 = open(someotherfile); > copy_data(fd3, fdf2); > close(fd3); > rename(file1.temp, file1); > close(fd); > fd = fd2; > } > link(file1, uniquedir/file1); > close(fd); > > /* Use uniquedir/file1, and unlink it when done. */ > > What I observed was that sometimes uniquedir/file1 would end up > referencing > the empty file created by flopen() after the rename() rather than > linking > to the file created when file1.temp was created. > > > I've been running the same test with your patch and not observed > > this > > problem. This on UFS2 with SU enabled. > > Hmm, I wish I could explain explain your odd result above in terms of > this > bug, but the results from stat() should always be consistent > (VOP_GETATTR() > can't switch vnodes mid-stream as it were). > > BTW, note that in my case where I had multiple processes all doing the > same > loop, in the edge case, another process always had the file open (and > was > blocked in flock() in flopen()) when the rename() happened, so that > prevented > the vnode from going away. This is important as otherwise the use > count would > drop to zero and marked inactive which removes all references to it > from the > name cache. In my case the flock() in flopen() and the fact that the > "first" > process held the flock until after the rename and call to link() made > the > race more likely to trigger. > > Hmm, perhaps one way to do this would be: > > touch file.always (save its i-node) > fork worker process that just continually does a 'stat file1' in a > loop > main process: > ln file.always file1 > touch file2 > rename file2 file1 > stat file1 > complain if file1 has the saved i-node > > Hmm, I just whipped up something to do this and it fails early and > often on > an unpatched kernel, but does not with my patch. > > #include > #include > #include > #include > #include > #include > #include > #include > > static char *always, *file1, *file2; > static ino_t always_ino; > > static void > usage(void) > { > fprintf(stderr, "Usage: rename_race \n"); > exit(1); > } > > static void > child(void) > { > struct stat sb; > > /* Exit as soon as our parent exits. */ > while (getppid() != 1) { > stat(file1, &sb); > } > exit(0); > } > > static void > create_file(const char *path) > { > int fd; > > fd = open(path, O_CREAT, 0666); > if (fd < 0) > err(1, "open(%s)", path); > close(fd); > } > > int > main(int ac, char **av) > { > struct stat sb, sb2; > pid_t pid; > > if (ac != 2) > usage(); > if (stat(av[1], &sb) != 0) > err(1, "stat(%s)", av[1]); > if (!S_ISDIR(sb.st_mode)) > errx(1, "%s not a directory", av[1]); > > asprintf(&always, "%s/file.always", av[1]); > asprintf(&file1, "%s/file1", av[1]); > asprintf(&file2, "%s/file2", av[1]); > > create_file(always); > if (stat(always, &sb) != 0) > err(1, "stat(%s)", always); > always_ino = sb.st_ino; > > pid = fork(); > if (pid < 0) > err(1, "fork"); > if (pid == 0) > child(); > for (;;) { > if (unlink(file1) < 0 && errno != ENOENT) > err(1, "unlink(%s)", file1); > if (link(always, file1) < 0) > err(1, "link(%s, %s)", always, file1); > create_file(file2); > if (stat(file2, &sb2) < 0) > err(1, "stat(%s)", file2); > if (rename(file2, file1) < 0) > err(1, "rename(%s, %s)", file2, file1); > if (stat(file1, &sb) < 0) > err(1, "stat(%s)", file1); > if (sb.st_ino != sb2.st_ino || > sb.st_ino == always_ino) > printf("Bad stat: always: %d file1: %d (should be %d)\n", > always_ino, sb.st_ino, sb2.st_ino); > } > return (0); > } > > -- > John Baldwin From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 06:09:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DEB2C106564A for ; Sat, 3 Mar 2012 06:09:02 +0000 (UTC) (envelope-from josh@tcbug.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id A91AC8FC08 for ; Sat, 3 Mar 2012 06:09:02 +0000 (UTC) Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 1A16020E7D for ; Sat, 3 Mar 2012 00:31:34 -0500 (EST) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute3.internal (MEProxy); Sat, 03 Mar 2012 00:31:34 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=references:in-reply-to:mime-version :content-transfer-encoding:content-type:message-id:cc:from :subject:date:to; s=smtpout; bh=62MvXBFE0QxtZthzEFlEtcpfMa0=; b= Kty2T/O3METyiWxxJMdDS8Bke6ULfMgUWDEyhEAlHb7DhzSfSkE8tvNRdKy4l2Qc TuFeFZjGukOFaF7nkIJ59ksxipAyXO+s69Z33SWwvTzxVoe2k0mhxLKv6ppPj4BK Zi/HErxd0Ut7aZEDfSfRLppZ4EvY+GR6dr/+fQCoQF0= X-Sasl-enc: pPAHEh1qyRGTBzHEp+ZjYgDdu5Y+qAzWC+ZYnAxscHQJ 1330752693 Received: from [10.10.1.128] (unknown [216.139.7.151]) by mail.messagingengine.com (Postfix) with ESMTPSA id 9C0FB4825A5; Sat, 3 Mar 2012 00:31:33 -0500 (EST) References: <201105310922.p4V9MqYY016057@svn.freebsd.org> <4E550320.2030204@FreeBSD.org> In-Reply-To: <4E550320.2030204@FreeBSD.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Message-Id: <5BFD85CA-0C81-45E1-8587-7B4F4E19D254@tcbug.org> X-Mailer: iPhone Mail (9A405) From: Josh Paetzel Date: Fri, 2 Mar 2012 21:31:30 -0800 To: Alexander Motin Cc: Goran Lowkrantz , "svn-src-all@freebsd.org" Subject: Re: svn commit: r222520 - head/sys/cam/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 06:09:02 -0000 On Aug 24, 2011, at 6:56 AM, Alexander Motin wrote: > Goran Lowkrantz wrote: >> --On May 31, 2011 9:22:52 +0000 Alexander Motin wrote: >>> Author: mav >>> Date: Tue May 31 09:22:52 2011 >>> New Revision: 222520 >>> URL: http://svn.freebsd.org/changeset/base/222520 >>> >>> Log: >>> Add quirks to hint 4K physical sector (Advanced Format) for ATA disks >>> not reporting it properly (none? of known disks now). >>> >>> Hitachi and WDC AF disks seem could be identified more or less >>> formally. >>> For Seagate and Samsung enumerate some found models/series. >>> For other disks it can be forced with kern.cam.ada.X.quirks=1 tunable. >> >> Should this work with SAS/SATA cards like LSI 2008 (mps) too? > > No. In that case controller or driver emulate SCSI disk devices. At this > moment "da" driver has no idea about physical sector size. I've paused > my work on full physical sector support due to lack of respective > hardware, but porting only these quirks should not be difficult. > What hardware do you need? > -- > Alexander Motin > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 06:15:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50A501065670; Sat, 3 Mar 2012 06:15:14 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F3768FC16; Sat, 3 Mar 2012 06:15:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q236FDuH066761; Sat, 3 Mar 2012 06:15:13 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q236FDdV066760; Sat, 3 Mar 2012 06:15:13 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030615.q236FDdV066760@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 06:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232438 - releng/8.3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 06:15:14 -0000 Author: kensmith Date: Sat Mar 3 06:15:13 2012 New Revision: 232438 URL: http://svn.freebsd.org/changeset/base/232438 Log: Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle. Approved by: re (implicit) Added: - copied from r232437, stable/8/ Directory Properties: releng/8.3/ (props changed) From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 06:18:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 799F71065677; Sat, 3 Mar 2012 06:18:19 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68BDF8FC26; Sat, 3 Mar 2012 06:18:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q236IJX9066897; Sat, 3 Mar 2012 06:18:19 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q236IJjD066895; Sat, 3 Mar 2012 06:18:19 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030618.q236IJjD066895@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 06:18:19 +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: r232439 - stable/8/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, 03 Mar 2012 06:18:19 -0000 Author: kensmith Date: Sat Mar 3 06:18:18 2012 New Revision: 232439 URL: http://svn.freebsd.org/changeset/base/232439 Log: Bump __FreeBSD_version to 803500 now that releng/8.3 has been branched. Approved by: re (implicit) Modified: stable/8/sys/sys/param.h Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Sat Mar 3 06:15:13 2012 (r232438) +++ stable/8/sys/sys/param.h Sat Mar 3 06:18:18 2012 (r232439) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802517 /* Master, propagated to newvers */ +#define __FreeBSD_version 803500 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 06:23:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7278B106566C; Sat, 3 Mar 2012 06:23:27 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6221F8FC0C; Sat, 3 Mar 2012 06:23:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q236NRmX067109; Sat, 3 Mar 2012 06:23:27 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q236NRfj067107; Sat, 3 Mar 2012 06:23:27 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030623.q236NRfj067107@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 06:23:27 +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: r232440 - 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: Sat, 03 Mar 2012 06:23:27 -0000 Author: kensmith Date: Sat Mar 3 06:23:26 2012 New Revision: 232440 URL: http://svn.freebsd.org/changeset/base/232440 Log: Add releng/8.3 as requiring re@ approval. Approved by: re (implicit) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Sat Mar 3 06:18:18 2012 (r232439) +++ svnadmin/conf/approvers Sat Mar 3 06:23:26 2012 (r232440) @@ -21,6 +21,7 @@ ^stable/8/ re #^stable/7/ re ^releng/9.0/ (security-officer|so) +^releng/8.3/ re ^releng/8.[0-2]/ (security-officer|so) ^releng/7.[0-4]/ (security-officer|so) ^releng/6.[0-4]/ (security-officer|so) From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 06:35:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 808A2106566B for ; Sat, 3 Mar 2012 06:35:09 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id F3DDF8FC0A for ; Sat, 3 Mar 2012 06:35:08 +0000 (UTC) Received: by bkcjc3 with SMTP id jc3so2766825bkc.13 for ; Fri, 02 Mar 2012 22:35:08 -0800 (PST) Received-SPF: pass (google.com: domain of mavbsd@gmail.com designates 10.204.145.145 as permitted sender) client-ip=10.204.145.145; Authentication-Results: mr.google.com; spf=pass (google.com: domain of mavbsd@gmail.com designates 10.204.145.145 as permitted sender) smtp.mail=mavbsd@gmail.com; dkim=pass header.i=mavbsd@gmail.com Received: from mr.google.com ([10.204.145.145]) by 10.204.145.145 with SMTP id d17mr6854473bkv.77.1330756508085 (num_hops = 1); Fri, 02 Mar 2012 22:35:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=z8KKClxF9U0rexME8ep7aZa8M+wlLr1KtPVgVd00alE=; b=00FtD51h8PE6Be9FXgpusx952pthoMdAlntkEu18fuNnchG/6ULVbh4zSOqVmsDEB+ BXQltBX+Ei/h3QRZaxie4EvqbrGMdn+ApF510i/VYIA/zNerAub3+Vm3ZYFechWMJ8+N b4RwDmCHahAsu6CvyMW0C+iA78ebjX6sDjpmE3IqnSaOFmSTnbsDBT+moEkG80OjbxvE 38m9zaifu03gfzCtdsQn0hL0VWYftL6J6FNe4Hits2svxx/JbnBSTvCq14DZFw3IO+vB nTBdThAYFVsKSm4DozokTZfCT8aHzdyrCVsYfuuvU/uhyMwMGAsylrQmSZMgtQORAxvY Y/Hg== Received: by 10.204.145.145 with SMTP id d17mr5458963bkv.77.1330754780788; Fri, 02 Mar 2012 22:06:20 -0800 (PST) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id t17sm13109058bke.6.2012.03.02.22.06.19 (version=SSLv3 cipher=OTHER); Fri, 02 Mar 2012 22:06:19 -0800 (PST) Sender: Alexander Motin Message-ID: <4F51B4D9.50801@FreeBSD.org> Date: Sat, 03 Mar 2012 08:06:17 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120226 Thunderbird/10.0.2 MIME-Version: 1.0 To: Josh Paetzel References: <201105310922.p4V9MqYY016057@svn.freebsd.org> <4E550320.2030204@FreeBSD.org> <5BFD85CA-0C81-45E1-8587-7B4F4E19D254@tcbug.org> In-Reply-To: <5BFD85CA-0C81-45E1-8587-7B4F4E19D254@tcbug.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Goran Lowkrantz , "svn-src-all@freebsd.org" Subject: Re: svn commit: r222520 - head/sys/cam/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 06:35:09 -0000 On 03/03/12 07:31, Josh Paetzel wrote: > On Aug 24, 2011, at 6:56 AM, Alexander Motin wrote: > >> Goran Lowkrantz wrote: >>> --On May 31, 2011 9:22:52 +0000 Alexander Motin wrote: >>>> Author: mav >>>> Date: Tue May 31 09:22:52 2011 >>>> New Revision: 222520 >>>> URL: http://svn.freebsd.org/changeset/base/222520 >>>> >>>> Log: >>>> Add quirks to hint 4K physical sector (Advanced Format) for ATA disks >>>> not reporting it properly (none? of known disks now). >>>> >>>> Hitachi and WDC AF disks seem could be identified more or less >>>> formally. >>>> For Seagate and Samsung enumerate some found models/series. >>>> For other disks it can be forced with kern.cam.ada.X.quirks=1 tunable. >>> >>> Should this work with SAS/SATA cards like LSI 2008 (mps) too? >> >> No. In that case controller or driver emulate SCSI disk devices. At this >> moment "da" driver has no idea about physical sector size. I've paused >> my work on full physical sector support due to lack of respective >> hardware, but porting only these quirks should not be difficult. >> > > What hardware do you need? I've already implemented physical sector size support for "da" at the r228820 and r228846, but mostly theoretically. Disks reporting physical sector sizes are still very rare (even SATA) and I don't have any of them. But as soon as SCSI UNMAP support flag uses same VPD page as physical sector size, I was able to test it at least in part of sending right SCSI commands. It works at least with latest mps(4) IT firmware SATL and SATA SSDs. Test with disk really reporting physical sector size would be interesting. I have recent info that some WD SATA disks started to reporting physical sector size. Unluckily other disks with same model and firmware version still don't. So I can't really say what hardware exactly do I need until it is tested. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 07:02:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89A391065670; Sat, 3 Mar 2012 07:02:44 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 797458FC12; Sat, 3 Mar 2012 07:02:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2372iVg068516; Sat, 3 Mar 2012 07:02:44 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2372iDo068514; Sat, 3 Mar 2012 07:02:44 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030702.q2372iDo068514@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 07:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232443 - releng/8.3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 07:02:44 -0000 Author: kensmith Date: Sat Mar 3 07:02:43 2012 New Revision: 232443 URL: http://svn.freebsd.org/changeset/base/232443 Log: Update to have "make update" pull from RELENG_8_3. Approved by: re (implicit) Modified: releng/8.3/Makefile.inc1 Modified: releng/8.3/Makefile.inc1 ============================================================================== --- releng/8.3/Makefile.inc1 Sat Mar 3 06:38:43 2012 (r232442) +++ releng/8.3/Makefile.inc1 Sat Mar 3 07:02:43 2012 (r232443) @@ -93,7 +93,7 @@ CLEANDIR= cleandir .endif CVS?= cvs -CVSFLAGS?= -r RELENG_8 -P -d -I! +CVSFLAGS?= -r RELENG_8_3 -P -d -I! SVN?= svn SVNFLAGS?= -r HEAD SUP?= /usr/bin/csup From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 07:04:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A00B11065670; Sat, 3 Mar 2012 07:04:45 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FC598FC0C; Sat, 3 Mar 2012 07:04:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2374jOH068610; Sat, 3 Mar 2012 07:04:45 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2374jTC068608; Sat, 3 Mar 2012 07:04:45 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030704.q2374jTC068608@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 07:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232444 - releng/8.3/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 07:04:45 -0000 Author: kensmith Date: Sat Mar 3 07:04:45 2012 New Revision: 232444 URL: http://svn.freebsd.org/changeset/base/232444 Log: Update RELEASETAG and SVNBRANCH. Approved by: re (implicit) Modified: releng/8.3/release/Makefile Modified: releng/8.3/release/Makefile ============================================================================== --- releng/8.3/release/Makefile Sat Mar 3 07:02:43 2012 (r232443) +++ releng/8.3/release/Makefile Sat Mar 3 07:04:45 2012 (r232444) @@ -33,7 +33,7 @@ BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release # If this is a -stable snapshot, then set -#RELEASETAG=RELENG_8 +#RELEASETAG=RELENG_8_3 # # To test a release with a source tree containing patches and # other work. This tree will get copied instead of getting the @@ -72,7 +72,7 @@ BUILDNAME?=${BASE}-${DATE}-SNAP # # Subversion branch to build for src. If this is not set then it is # automatically computed from RELEASETAG. -#SVNBRANCH=stable/8 +#SVNBRANCH=releng/8.3 # # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we # are building an official release. Otherwise, we are building for From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 07:06:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B41FC106566C; Sat, 3 Mar 2012 07:06:05 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3CB48FC19; Sat, 3 Mar 2012 07:06:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23765qD068690; Sat, 3 Mar 2012 07:06:05 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23765Fu068688; Sat, 3 Mar 2012 07:06:05 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030706.q23765Fu068688@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 07:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232445 - releng/8.3/share/examples/cvsup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 07:06:05 -0000 Author: kensmith Date: Sat Mar 3 07:06:05 2012 New Revision: 232445 URL: http://svn.freebsd.org/changeset/base/232445 Log: Update the CVS branch tag. Approved by: re (implicit) Modified: releng/8.3/share/examples/cvsup/standard-supfile Modified: releng/8.3/share/examples/cvsup/standard-supfile ============================================================================== --- releng/8.3/share/examples/cvsup/standard-supfile Sat Mar 3 07:04:45 2012 (r232444) +++ releng/8.3/share/examples/cvsup/standard-supfile Sat Mar 3 07:06:05 2012 (r232445) @@ -49,7 +49,7 @@ *default host=CHANGE_THIS.FreeBSD.org *default base=/var/db *default prefix=/usr -*default release=cvs tag=RELENG_8 +*default release=cvs tag=RELENG_8_3 *default delete use-rel-suffix # If you seem to be limited by CPU rather than network or disk bandwidth, try From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 07:09:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C84E5106566C; Sat, 3 Mar 2012 07:09:05 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B80508FC0A; Sat, 3 Mar 2012 07:09:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23795vS068812; Sat, 3 Mar 2012 07:09:05 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23795iD068810; Sat, 3 Mar 2012 07:09:05 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030709.q23795iD068810@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 07:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232446 - releng/8.3/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, 03 Mar 2012 07:09:05 -0000 Author: kensmith Date: Sat Mar 3 07:09:05 2012 New Revision: 232446 URL: http://svn.freebsd.org/changeset/base/232446 Log: Update __FreeBSD_version to 803000 to reflect releng/8.3 has been branched. Approved by: re (implicit) Modified: releng/8.3/sys/sys/param.h Modified: releng/8.3/sys/sys/param.h ============================================================================== --- releng/8.3/sys/sys/param.h Sat Mar 3 07:06:05 2012 (r232445) +++ releng/8.3/sys/sys/param.h Sat Mar 3 07:09:05 2012 (r232446) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802517 /* Master, propagated to newvers */ +#define __FreeBSD_version 803000 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 07:10:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86C641065688; Sat, 3 Mar 2012 07:10:39 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 768BB8FC17; Sat, 3 Mar 2012 07:10:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q237AdYm068904; Sat, 3 Mar 2012 07:10:39 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q237AdhB068902; Sat, 3 Mar 2012 07:10:39 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203030710.q237AdhB068902@svn.freebsd.org> From: Ken Smith Date: Sat, 3 Mar 2012 07:10:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232447 - releng/8.3/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: Sat, 03 Mar 2012 07:10:39 -0000 Author: kensmith Date: Sat Mar 3 07:10:38 2012 New Revision: 232447 URL: http://svn.freebsd.org/changeset/base/232447 Log: We should be ready for 8.3-RC1. Approved by: re (implicit) Modified: releng/8.3/sys/conf/newvers.sh Modified: releng/8.3/sys/conf/newvers.sh ============================================================================== --- releng/8.3/sys/conf/newvers.sh Sat Mar 3 07:09:05 2012 (r232446) +++ releng/8.3/sys/conf/newvers.sh Sat Mar 3 07:10:38 2012 (r232447) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.3" -BRANCH="PRERELEASE" +BRANCH="RC1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 08:11:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ABD46106566C; Sat, 3 Mar 2012 08:11:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81BA48FC0A; Sat, 3 Mar 2012 08:11:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q238B44D070812; Sat, 3 Mar 2012 08:11:04 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q238B42p070810; Sat, 3 Mar 2012 08:11:04 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201203030811.q238B42p070810@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 3 Mar 2012 08:11: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: r232448 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 08:11:04 -0000 Author: hselasky Date: Sat Mar 3 08:11:04 2012 New Revision: 232448 URL: http://svn.freebsd.org/changeset/base/232448 Log: Make sure that the USB system suspend event is executed synchronously and not asynchronously. This fixes problems related to USB system suspend and resume. It is assumed that we are always allowed to sleep from the device_suspend() method. MFC after: 1 week Submitted by: jkim Modified: head/sys/dev/usb/controller/usb_controller.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Sat Mar 3 07:10:38 2012 (r232447) +++ head/sys/dev/usb/controller/usb_controller.c Sat Mar 3 08:11:04 2012 (r232448) @@ -89,10 +89,15 @@ TUNABLE_INT("hw.usb.no_boot_wait", &usb_ SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0, "No USB device enumerate waiting at boot."); +static int usb_no_suspend_wait = 0; +TUNABLE_INT("hw.usb.no_suspend_wait", &usb_no_suspend_wait); +SYSCTL_INT(_hw_usb, OID_AUTO, no_suspend_wait, CTLFLAG_RW|CTLFLAG_TUN, + &usb_no_suspend_wait, 0, "No USB device waiting at system suspend."); + static int usb_no_shutdown_wait = 0; TUNABLE_INT("hw.usb.no_shutdown_wait", &usb_no_shutdown_wait); -SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RW|CTLFLAG_TUN, &usb_no_shutdown_wait, 0, - "No USB device waiting at system shutdown."); +SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RW|CTLFLAG_TUN, + &usb_no_shutdown_wait, 0, "No USB device waiting at system shutdown."); static devclass_t usb_devclass; @@ -240,6 +245,11 @@ usb_suspend(device_t dev) USB_BUS_LOCK(bus); usb_proc_msignal(&bus->explore_proc, &bus->suspend_msg[0], &bus->suspend_msg[1]); + if (usb_no_suspend_wait == 0) { + /* wait for suspend callback to be executed */ + usb_proc_mwait(&bus->explore_proc, + &bus->suspend_msg[0], &bus->suspend_msg[1]); + } USB_BUS_UNLOCK(bus); return (0); @@ -407,6 +417,15 @@ usb_bus_suspend(struct usb_proc_msg *pm) USB_BUS_UNLOCK(bus); + /* + * We use the shutdown event here because the suspend and + * resume events are reserved for the USB port suspend and + * resume. The USB system suspend is implemented like full + * shutdown and all connected USB devices will be disconnected + * subsequently. At resume all USB devices will be + * re-connected again. + */ + bus_generic_shutdown(bus->bdev); usbd_enum_lock(udev); From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 08:19:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4C13C106567F; Sat, 3 Mar 2012 08:19:19 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 398928FC20; Sat, 3 Mar 2012 08:19:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q238JJ44071181; Sat, 3 Mar 2012 08:19:19 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q238JIh1071157; Sat, 3 Mar 2012 08:19:18 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201203030819.q238JIh1071157@svn.freebsd.org> From: Juli Mallett Date: Sat, 3 Mar 2012 08:19: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: r232449 - in head/sys: compat/freebsd32 conf kern mips/include mips/mips net 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, 03 Mar 2012 08:19:19 -0000 Author: jmallett Date: Sat Mar 3 08:19:18 2012 New Revision: 232449 URL: http://svn.freebsd.org/changeset/base/232449 Log: o) Add COMPAT_FREEBSD32 support for MIPS kernels using the n64 ABI with userlands using the o32 ABI. This mostly follows nwhitehorn's lead in implementing COMPAT_FREEBSD32 on powerpc64. o) Add a new type to the freebsd32 compat layer, time32_t, which is time_t in the 32-bit ABI being used. Since the MIPS port is relatively-new, even the 32-bit ABIs use a 64-bit time_t. o) Because time{spec,val}32 has the same size and layout as time{spec,val} on MIPS with 32-bit compatibility, then, disable some code which assumes otherwise wrongly when built for MIPS. A more general macro to check in this case would seem like a good idea eventually. If someone adds support for using n32 userland with n64 kernels on MIPS, then they will have to add a variety of flags related to each piece of the ABI that can vary. That's probably the right time to generalize further. o) Add MIPS to the list of architectures which use PAD64_REQUIRED in the freebsd32 compat code. Probably this should be generalized at some point. Reviewed by: gonzo Added: head/sys/mips/mips/freebsd32_machdep.c (contents, props changed) Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/compat/freebsd32/syscalls.master head/sys/conf/files.mips head/sys/conf/options.mips head/sys/kern/kern_tc.c head/sys/mips/include/elf.h head/sys/mips/include/md_var.h head/sys/mips/include/param.h head/sys/mips/include/proc.h head/sys/mips/include/reg.h head/sys/mips/include/sigframe.h head/sys/mips/include/ucontext.h head/sys/mips/include/vmparam.h head/sys/mips/mips/genassym.c head/sys/mips/mips/swtch.S head/sys/mips/mips/trap.c head/sys/mips/mips/vm_machdep.c head/sys/net/bpf.c head/sys/sys/sysctl.h Modified: head/sys/compat/freebsd32/freebsd32.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/freebsd32.h Sat Mar 3 08:19:18 2012 (r232449) @@ -42,8 +42,17 @@ #define PTROUT_CP(src,dst,fld) \ do { (dst).fld = PTROUT((src).fld); } while (0) +/* + * Being a newer port, 32-bit FreeBSD/MIPS uses 64-bit time_t. + */ +#ifdef __mips__ +typedef int64_t time32_t; +#else +typedef int32_t time32_t; +#endif + struct timeval32 { - int32_t tv_sec; + time32_t tv_sec; int32_t tv_usec; }; #define TV_CP(src,dst,fld) do { \ @@ -52,7 +61,7 @@ struct timeval32 { } while (0) struct timespec32 { - int32_t tv_sec; + time32_t tv_sec; int32_t tv_nsec; }; #define TS_CP(src,dst,fld) do { \ Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sat Mar 3 08:19:18 2012 (r232449) @@ -104,16 +104,22 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef __mips__ CTASSERT(sizeof(struct timeval32) == 8); CTASSERT(sizeof(struct timespec32) == 8); CTASSERT(sizeof(struct itimerval32) == 16); +#endif CTASSERT(sizeof(struct statfs32) == 256); +#ifndef __mips__ CTASSERT(sizeof(struct rusage32) == 72); +#endif CTASSERT(sizeof(struct sigaltstack32) == 12); CTASSERT(sizeof(struct kevent32) == 20); CTASSERT(sizeof(struct iovec32) == 8); CTASSERT(sizeof(struct msghdr32) == 28); +#ifndef __mips__ CTASSERT(sizeof(struct stat32) == 96); +#endif CTASSERT(sizeof(struct sigaction32) == 24); static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count); Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/freebsd32_proto.h Sat Mar 3 08:19:18 2012 (r232449) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -33,7 +33,7 @@ struct thread; #define PADR_(t) 0 #endif -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif struct freebsd32_wait4_args { @@ -589,7 +589,7 @@ struct freebsd32_posix_fadvise_args { char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; }; -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); @@ -703,7 +703,7 @@ int freebsd32_posix_fadvise(struct threa #ifdef COMPAT_43 -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif struct ofreebsd32_lseek_args { @@ -789,7 +789,7 @@ int ofreebsd32_getdirentries(struct thre #ifdef COMPAT_FREEBSD4 -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif struct freebsd4_freebsd32_getfsstat_args { @@ -846,7 +846,7 @@ int freebsd4_freebsd32_sigreturn(struct #ifdef COMPAT_FREEBSD6 -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif struct freebsd6_freebsd32_pread_args { @@ -912,7 +912,7 @@ int freebsd6_freebsd32_ftruncate(struct #ifdef COMPAT_FREEBSD7 -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif struct freebsd7_freebsd32_semctl_args { Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Sat Mar 3 08:19:18 2012 (r232449) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart */ #define FREEBSD32_SYS_syscall 0 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Mar 3 08:19:18 2012 (r232449) @@ -3,11 +3,11 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart */ const char *freebsd32_syscallnames[] = { -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif "syscall", /* 0 = syscall */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Sat Mar 3 08:19:18 2012 (r232449) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart */ #include "opt_compat.h" @@ -44,7 +44,7 @@ /* The casts are bogus but will do for now. */ struct sysent freebsd32_sysent[] = { -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 0 = syscall */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Sat Mar 3 08:19:18 2012 (r232449) @@ -11,7 +11,7 @@ systrace_args(int sysnum, void *params, { int64_t *iarg = (int64_t *) uarg; switch (sysnum) { -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif /* nosys */ @@ -3077,7 +3077,7 @@ systrace_entry_setargdesc(int sysnum, in { const char *p = NULL; switch (sysnum) { -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif /* nosys */ @@ -8192,7 +8192,7 @@ systrace_return_setargdesc(int sysnum, i { const char *p = NULL; switch (sysnum) { -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif /* nosys */ Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/compat/freebsd32/syscalls.master Sat Mar 3 08:19:18 2012 (r232449) @@ -52,7 +52,7 @@ #include #include -#if !defined(PAD64_REQUIRED) && defined(__powerpc__) +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/conf/files.mips Sat Mar 3 08:19:18 2012 (r232449) @@ -90,6 +90,13 @@ libkern/umoddi3.c optional isa_mips32 #libkern/mips/strcmp.S standard #libkern/mips/strncmp.S standard +compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32 +compat/freebsd32/freebsd32_misc.c optional compat_freebsd32 +compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32 +compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32 +kern/imgact_elf32.c optional compat_freebsd32 +mips/mips/freebsd32_machdep.c optional compat_freebsd32 + kern/kern_clocksource.c standard kern/link_elf_obj.c standard Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/conf/options.mips Sat Mar 3 08:19:18 2012 (r232449) @@ -38,6 +38,7 @@ CPU_CNMIPS opt_global.h CPU_RMI opt_global.h CPU_NLM opt_global.h +# XXX These are bogus and should be replaced by proper ABI or ISA checks. ISA_MIPS1 opt_cputype.h ISA_MIPS3 opt_cputype.h ISA_MIPS32 opt_cputype.h @@ -45,6 +46,8 @@ ISA_MIPS32v2 opt_cputype.h ISA_MIPS64 opt_cputype.h ISA_MIPS64v2 opt_cputype.h +COMPAT_FREEBSD32 opt_compat.h + YAMON opt_global.h CFE opt_global.h CFE_CONSOLE opt_global.h Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/kern/kern_tc.c Sat Mar 3 08:19:18 2012 (r232449) @@ -123,6 +123,7 @@ static void cpu_tick_calibrate(int); static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { +#ifndef __mips__ #ifdef SCTL_MASK32 int tv[2]; @@ -132,6 +133,7 @@ sysctl_kern_boottime(SYSCTL_HANDLER_ARGS return SYSCTL_OUT(req, tv, sizeof(tv)); } else #endif +#endif return SYSCTL_OUT(req, &boottime, sizeof(boottime)); } Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/elf.h Sat Mar 3 08:19:18 2012 (r232449) @@ -52,6 +52,9 @@ #include #define ELF_ARCH EM_MIPS +#if __ELF_WORD_SIZE == 32 +#define ELF_ARCH32 EM_MIPS +#endif #define ELF_MACHINE_OK(x) ((x) == EM_MIPS || (x) == EM_MIPS_RS4_BE) /* Architecture dependent Segment types - p_type */ Modified: head/sys/mips/include/md_var.h ============================================================================== --- head/sys/mips/include/md_var.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/md_var.h Sat Mar 3 08:19:18 2012 (r232449) @@ -41,7 +41,11 @@ */ extern long Maxmem; extern char sigcode[]; -extern int szsigcode, szosigcode; +extern int szsigcode; +#if defined(__mips_n32) || defined(__mips_n64) +extern char sigcode32[]; +extern int szsigcode32; +#endif extern uint32_t *vm_page_dump; extern int vm_page_dump_size; Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/param.h Sat Mar 3 08:19:18 2012 (r232449) @@ -60,6 +60,9 @@ #if _BYTE_ORDER == _BIG_ENDIAN #ifdef __mips_n64 #define MACHINE_ARCH "mips64eb" +#ifndef MACHINE_ARCH32 +#define MACHINE_ARCH32 "mipseb" +#endif #elif defined(__mips_n32) #define MACHINE_ARCH "mipsn32eb" #else @@ -68,6 +71,9 @@ #else #ifdef __mips_n64 #define MACHINE_ARCH "mips64el" +#ifndef MACHINE_ARCH32 +#define MACHINE_ARCH32 "mipsel" +#endif #elif defined(__mips_n32) #define MACHINE_ARCH "mipsn32el" #else Modified: head/sys/mips/include/proc.h ============================================================================== --- head/sys/mips/include/proc.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/proc.h Sat Mar 3 08:19:18 2012 (r232449) @@ -96,6 +96,7 @@ struct syscall_args { #ifdef __mips_n64 #define KINFO_PROC_SIZE 1088 +#define KINFO_PROC32_SIZE 816 #else #define KINFO_PROC_SIZE 816 #endif Modified: head/sys/mips/include/reg.h ============================================================================== --- head/sys/mips/include/reg.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/reg.h Sat Mar 3 08:19:18 2012 (r232449) @@ -42,6 +42,10 @@ #ifndef _MACHINE_REG_H_ #define _MACHINE_REG_H_ +#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE) +#include "opt_compat.h" +#endif + /* * Location of the users' stored registers relative to ZERO. * must be visible to assembly code. @@ -66,6 +70,21 @@ struct dbreg { unsigned long junk; }; +#ifdef COMPAT_FREEBSD32 +/* Must match struct trapframe */ +struct reg32 { + uint32_t r_regs[NUMSAVEREGS]; +}; + +struct fpreg32 { + int32_t r_regs[NUMFPREGS]; +}; + +struct dbreg32 { + uint32_t junk; +}; +#endif + #ifdef _KERNEL int fill_fpregs(struct thread *, struct fpreg *); int fill_regs(struct thread *, struct reg *); @@ -75,4 +94,16 @@ int fill_dbregs(struct thread *, struct int set_dbregs(struct thread *, struct dbreg *); #endif +#ifdef COMPAT_FREEBSD32 +struct image_params; + +int fill_regs32(struct thread *, struct reg32 *); +int set_regs32(struct thread *, struct reg32 *); +int fill_fpregs32(struct thread *, struct fpreg32 *); +int set_fpregs32(struct thread *, struct fpreg32 *); + +#define fill_dbregs32(td, reg) 0 +#define set_dbregs32(td, reg) 0 +#endif + #endif /* !_MACHINE_REG_H_ */ Modified: head/sys/mips/include/sigframe.h ============================================================================== --- head/sys/mips/include/sigframe.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/sigframe.h Sat Mar 3 08:19:18 2012 (r232449) @@ -32,6 +32,10 @@ #ifndef _MACHINE_SIGFRAME_H_ #define _MACHINE_SIGFRAME_H_ +#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE) +#include "opt_compat.h" +#endif + /* * WARNING: code in locore.s assumes the layout shown for sf_signum * thru sf_addr so... don't alter them! @@ -46,4 +50,18 @@ struct sigframe { unsigned long __spare__[2]; }; +#if (defined(__mips_n32) || defined(__mips_n64)) && defined(COMPAT_FREEBSD32) +#include + +struct sigframe32 { + int32_t sf_signum; + int32_t sf_siginfo; /* code or pointer to sf_si */ + int32_t sf_ucontext; /* points to sf_uc */ + int32_t sf_addr; /* undocumented 4th arg */ + ucontext32_t sf_uc; /* = *sf_ucontext */ + struct siginfo32 sf_si; /* = *sf_siginfo (SA_SIGINFO case) */ + uint32_t __spare__[2]; +}; +#endif + #endif /* !_MACHINE_SIGFRAME_H_ */ Modified: head/sys/mips/include/ucontext.h ============================================================================== --- head/sys/mips/include/ucontext.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/ucontext.h Sat Mar 3 08:19:18 2012 (r232449) @@ -39,6 +39,10 @@ #ifndef _LOCORE +#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE) +#include "opt_compat.h" +#endif + typedef struct __mcontext { /* * These fields must match the corresponding fields in struct @@ -56,6 +60,32 @@ typedef struct __mcontext { void *mc_tls; /* pointer to TLS area */ int __spare__[8]; /* XXX reserved */ } mcontext_t; + +#if (defined(__mips_n32) || defined(__mips_n64)) && defined(COMPAT_FREEBSD32) +#include + +typedef struct __mcontext32 { + int mc_onstack; + int32_t mc_pc; + int32_t mc_regs[32]; + int32_t sr; + int32_t mullo, mulhi; + int mc_fpused; + int32_t mc_fpregs[33]; + int32_t mc_fpc_eir; + void *mc_tls; + int __spare__[8]; +} mcontext32_t; + +typedef struct __ucontext32 { + sigset_t uc_sigmask; + mcontext32_t uc_mcontext; + uint32_t uc_link; + struct sigaltstack32 uc_stack; + uint32_t uc_flags; + uint32_t __spare__[4]; +} ucontext32_t; +#endif #endif #ifndef SZREG Modified: head/sys/mips/include/vmparam.h ============================================================================== --- head/sys/mips/include/vmparam.h Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/include/vmparam.h Sat Mar 3 08:19:18 2012 (r232449) @@ -96,7 +96,10 @@ * offset is calculated. */ #define USRSTACK (VM_MAXUSER_ADDRESS - PAGE_SIZE) - +#ifdef __mips_n64 +#define FREEBSD32_USRSTACK (((vm_offset_t)0x80000000) - PAGE_SIZE) +#endif + /* * Only one memory domain. */ Added: head/sys/mips/mips/freebsd32_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mips/freebsd32_machdep.c Sat Mar 3 08:19:18 2012 (r232449) @@ -0,0 +1,496 @@ +/*- + * Copyright (c) 2012 Juli Mallett + * 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$ + */ + +/* + * Based on nwhitehorn's COMPAT_FREEBSD32 support code for PowerPC64. + */ + +#include "opt_compat.h" +#include "opt_cputype.h" + +#define __ELF_WORD_SIZE 32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +static void freebsd32_exec_setregs(struct thread *, struct image_params *, u_long); +static int get_mcontext32(struct thread *, mcontext32_t *, int); +static int set_mcontext32(struct thread *, const mcontext32_t *); +static void freebsd32_sendsig(sig_t, ksiginfo_t *, sigset_t *); + +extern const char *freebsd32_syscallnames[]; + +struct sysentvec elf32_freebsd_sysvec = { + .sv_size = SYS_MAXSYSCALL, + .sv_table = freebsd32_sysent, + .sv_mask = 0, + .sv_sigsize = 0, + .sv_sigtbl = NULL, + .sv_errsize = 0, + .sv_errtbl = NULL, + .sv_transtrap = NULL, + .sv_fixup = __elfN(freebsd_fixup), + .sv_sendsig = freebsd32_sendsig, + .sv_sigcode = sigcode32, + .sv_szsigcode = &szsigcode32, + .sv_prepsyscall = NULL, + .sv_name = "FreeBSD ELF32", + .sv_coredump = __elfN(coredump), + .sv_imgact_try = NULL, + .sv_minsigstksz = MINSIGSTKSZ, + .sv_pagesize = PAGE_SIZE, + .sv_minuser = VM_MIN_ADDRESS, + .sv_maxuser = ((vm_offset_t)0x80000000), + .sv_usrstack = FREEBSD32_USRSTACK, + .sv_psstrings = FREEBSD32_PS_STRINGS, + .sv_stackprot = VM_PROT_ALL, + .sv_copyout_strings = freebsd32_copyout_strings, + .sv_setregs = freebsd32_exec_setregs, + .sv_fixlimit = NULL, + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_ILP32, + .sv_set_syscall_retval = cpu_set_syscall_retval, + .sv_fetch_syscall_args = cpu_fetch_syscall_args, + .sv_syscallnames = freebsd32_syscallnames, + .sv_schedtail = NULL, +}; +INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); + +static Elf32_Brandinfo freebsd_brand_info = { + .brand = ELFOSABI_FREEBSD, + .machine = EM_MIPS, + .compat_3_brand = "FreeBSD", + .emul_path = NULL, + .interp_path = "/libexec/ld-elf.so.1", + .sysvec = &elf32_freebsd_sysvec, + .interp_newpath = "/libexec/ld-elf32.so.1", + .flags = 0 +}; + +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, + (sysinit_cfunc_t) elf32_insert_brand_entry, + &freebsd_brand_info); + +static void +freebsd32_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +{ + exec_setregs(td, imgp, stack); + + /* + * See comment in exec_setregs about running 32-bit binaries with 64-bit + * registers. + */ + td->td_frame->sp -= 65536; + + /* + * Clear extended address space bit for userland. + */ + td->td_frame->sr &= ~MIPS_SR_UX; +} + +int +set_regs32(struct thread *td, struct reg32 *regs) +{ + struct reg r; + unsigned i; + + for (i = 0; i < NUMSAVEREGS; i++) + r.r_regs[i] = regs->r_regs[i]; + + return (set_regs(td, &r)); +} + +int +fill_regs32(struct thread *td, struct reg32 *regs) +{ + struct reg r; + unsigned i; + int error; + + error = fill_regs(td, &r); + if (error != 0) + return (error); + + for (i = 0; i < NUMSAVEREGS; i++) + regs->r_regs[i] = r.r_regs[i]; + + return (0); +} + +int +set_fpregs32(struct thread *td, struct fpreg32 *fpregs) +{ + struct fpreg fp; + unsigned i; + + for (i = 0; i < NUMFPREGS; i++) + fp.r_regs[i] = fpregs->r_regs[i]; + + return (set_fpregs(td, &fp)); +} + +int +fill_fpregs32(struct thread *td, struct fpreg32 *fpregs) +{ + struct fpreg fp; + unsigned i; + int error; + + error = fill_fpregs(td, &fp); + if (error != 0) + return (error); + + for (i = 0; i < NUMFPREGS; i++) + fpregs->r_regs[i] = fp.r_regs[i]; + + return (0); +} + +static int +get_mcontext32(struct thread *td, mcontext32_t *mcp, int flags) +{ + mcontext_t mcp64; + unsigned i; + int error; + + error = get_mcontext(td, &mcp64, flags); + if (error != 0) + return (error); + + mcp->mc_onstack = mcp64.mc_onstack; + mcp->mc_pc = mcp64.mc_pc; + for (i = 0; i < 32; i++) + mcp->mc_regs[i] = mcp64.mc_regs[i]; + mcp->sr = mcp64.sr; + mcp->mullo = mcp64.mullo; + mcp->mulhi = mcp64.mulhi; + mcp->mc_fpused = mcp64.mc_fpused; + for (i = 0; i < 33; i++) + mcp->mc_fpregs[i] = mcp64.mc_fpregs[i]; + mcp->mc_fpc_eir = mcp64.mc_fpc_eir; + mcp->mc_tls = mcp64.mc_tls; + + return (0); +} + +static int +set_mcontext32(struct thread *td, const mcontext32_t *mcp) +{ + mcontext_t mcp64; + unsigned i; + + mcp64.mc_onstack = mcp->mc_onstack; + mcp64.mc_pc = mcp->mc_pc; + for (i = 0; i < 32; i++) + mcp64.mc_regs[i] = mcp->mc_regs[i]; + mcp64.sr = mcp->sr; + mcp64.mullo = mcp->mullo; + mcp64.mulhi = mcp->mulhi; + mcp64.mc_fpused = mcp->mc_fpused; + for (i = 0; i < 33; i++) + mcp64.mc_fpregs[i] = mcp->mc_fpregs[i]; + mcp64.mc_fpc_eir = mcp->mc_fpc_eir; + mcp64.mc_tls = mcp->mc_tls; + + return (set_mcontext(td, &mcp64)); +} + +int +freebsd32_sigreturn(struct thread *td, struct freebsd32_sigreturn_args *uap) +{ + ucontext32_t uc; + int error; + + CTR2(KTR_SIG, "sigreturn: td=%p ucp=%p", td, uap->sigcntxp); + + if (copyin(uap->sigcntxp, &uc, sizeof(uc)) != 0) { + CTR1(KTR_SIG, "sigreturn: efault td=%p", td); + return (EFAULT); + } + + error = set_mcontext32(td, &uc.uc_mcontext); + if (error != 0) + return (error); + + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); + +#if 0 + CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", + td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); +#endif + + return (EJUSTRETURN); +} + +/* + * The first two fields of a ucontext_t are the signal mask and the machine + * context. The next field is uc_link; we want to avoid destroying the link + * when copying out contexts. + */ +#define UC32_COPY_SIZE offsetof(ucontext32_t, uc_link) + +int +freebsd32_getcontext(struct thread *td, struct freebsd32_getcontext_args *uap) +{ + ucontext32_t uc; + int ret; + + if (uap->ucp == NULL) + ret = EINVAL; + else { + get_mcontext32(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); + PROC_LOCK(td->td_proc); + uc.uc_sigmask = td->td_sigmask; + PROC_UNLOCK(td->td_proc); + ret = copyout(&uc, uap->ucp, UC32_COPY_SIZE); + } + return (ret); +} + +int +freebsd32_setcontext(struct thread *td, struct freebsd32_setcontext_args *uap) +{ + ucontext32_t uc; + int ret; + + if (uap->ucp == NULL) + ret = EINVAL; + else { + ret = copyin(uap->ucp, &uc, UC32_COPY_SIZE); + if (ret == 0) { + ret = set_mcontext32(td, &uc.uc_mcontext); + if (ret == 0) { + kern_sigprocmask(td, SIG_SETMASK, + &uc.uc_sigmask, NULL, 0); + } + } + } + return (ret == 0 ? EJUSTRETURN : ret); +} + +int +freebsd32_swapcontext(struct thread *td, struct freebsd32_swapcontext_args *uap) +{ + ucontext32_t uc; + int ret; + + if (uap->oucp == NULL || uap->ucp == NULL) + ret = EINVAL; + else { + get_mcontext32(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); + PROC_LOCK(td->td_proc); + uc.uc_sigmask = td->td_sigmask; + PROC_UNLOCK(td->td_proc); + ret = copyout(&uc, uap->oucp, UC32_COPY_SIZE); + if (ret == 0) { + ret = copyin(uap->ucp, &uc, UC32_COPY_SIZE); + if (ret == 0) { + ret = set_mcontext32(td, &uc.uc_mcontext); + if (ret == 0) { + kern_sigprocmask(td, SIG_SETMASK, + &uc.uc_sigmask, NULL, 0); + } + } + } + } + return (ret == 0 ? EJUSTRETURN : ret); +} + +#define UCONTEXT_MAGIC 0xACEDBADE + +/* + * Send an interrupt to process. + * + * Stack is set up to allow sigcode stored + * at top to call routine, followed by kcall + * to sigreturn routine below. After sigreturn + * resets the signal mask, the stack, and the + * frame pointer, it returns to the user + * specified pc, psl. + */ +static void +freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) +{ + struct proc *p; + struct thread *td; + struct fpreg32 fpregs; + struct reg32 regs; + struct sigacts *psp; + struct sigframe32 sf, *sfp; + int sig; + int oonstack; + unsigned i; + + td = curthread; + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + sig = ksi->ksi_signo; + psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); + + fill_regs32(td, ®s); + oonstack = sigonstack(td->td_frame->sp); + + /* save user context */ + bzero(&sf, sizeof sf); + sf.sf_uc.uc_sigmask = *mask; + sf.sf_uc.uc_stack.ss_sp = (int32_t)(intptr_t)td->td_sigstk.ss_sp; + sf.sf_uc.uc_stack.ss_size = td->td_sigstk.ss_size; + sf.sf_uc.uc_stack.ss_flags = td->td_sigstk.ss_flags; + sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; + sf.sf_uc.uc_mcontext.mc_pc = regs.r_regs[PC]; + sf.sf_uc.uc_mcontext.mullo = regs.r_regs[MULLO]; + sf.sf_uc.uc_mcontext.mulhi = regs.r_regs[MULHI]; + sf.sf_uc.uc_mcontext.mc_regs[0] = UCONTEXT_MAGIC; /* magic number */ + for (i = 1; i < 32; i++) + sf.sf_uc.uc_mcontext.mc_regs[i] = regs.r_regs[i]; + sf.sf_uc.uc_mcontext.mc_fpused = td->td_md.md_flags & MDTD_FPUSED; + if (sf.sf_uc.uc_mcontext.mc_fpused) { + /* if FPU has current state, save it first */ + if (td == PCPU_GET(fpcurthread)) + MipsSaveCurFPState(td); + fill_fpregs32(td, &fpregs); + for (i = 0; i < 33; i++) + sf.sf_uc.uc_mcontext.mc_fpregs[i] = fpregs.r_regs[i]; + } + + /* Allocate and validate space for the signal handler context. */ + if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && + SIGISMEMBER(psp->ps_sigonstack, sig)) { + sfp = (struct sigframe32 *)((vm_offset_t)(td->td_sigstk.ss_sp + + td->td_sigstk.ss_size - sizeof(struct sigframe32)) + & ~(sizeof(__int64_t) - 1)); + } else + sfp = (struct sigframe32 *)((vm_offset_t)(td->td_frame->sp - + sizeof(struct sigframe32)) & ~(sizeof(__int64_t) - 1)); + + /* Translate the signal if appropriate */ + if (p->p_sysent->sv_sigtbl) { + if (sig <= p->p_sysent->sv_sigsize) + sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; + } + + /* Build the argument list for the signal handler. */ + td->td_frame->a0 = sig; + td->td_frame->a2 = (register_t)(intptr_t)&sfp->sf_uc; + if (SIGISMEMBER(psp->ps_siginfo, sig)) { + /* Signal handler installed with SA_SIGINFO. */ + td->td_frame->a1 = (register_t)(intptr_t)&sfp->sf_si; + /* sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; */ + + /* fill siginfo structure */ + sf.sf_si.si_signo = sig; + sf.sf_si.si_code = ksi->ksi_code; + sf.sf_si.si_addr = td->td_frame->badvaddr; + } else { + /* Old FreeBSD-style arguments. */ + td->td_frame->a1 = ksi->ksi_code; + td->td_frame->a3 = td->td_frame->badvaddr; + /* sf.sf_ahu.sf_handler = catcher; */ + } + + mtx_unlock(&psp->ps_mtx); + PROC_UNLOCK(p); + + /* + * Copy the sigframe out to the user's stack. + */ + if (copyout(&sf, sfp, sizeof(struct sigframe32)) != 0) { + /* + * Something is wrong with the stack pointer. + * ...Kill the process. + */ + PROC_LOCK(p); + sigexit(td, SIGILL); + } + + td->td_frame->pc = (register_t)(intptr_t)catcher; + td->td_frame->t9 = (register_t)(intptr_t)catcher; + td->td_frame->sp = (register_t)(intptr_t)sfp; + /* + * Signal trampoline code is at base of user stack. + */ + td->td_frame->ra = (register_t)(intptr_t)FREEBSD32_PS_STRINGS - *(p->p_sysent->sv_szsigcode); + PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); +} + +int +freebsd32_sysarch(struct thread *td, struct freebsd32_sysarch_args *uap) +{ + int error; + int32_t tlsbase; + + switch (uap->op) { + case MIPS_SET_TLS: + td->td_md.md_tls = (void *)(intptr_t)uap->parms; + return (0); + case MIPS_GET_TLS: + tlsbase = (int32_t)(intptr_t)td->td_md.md_tls; + error = copyout(&tlsbase, uap->parms, sizeof(tlsbase)); + return (error); + default: + break; + } + return (EINVAL); +} + +void +elf32_dump_thread(struct thread *td __unused, void *dst __unused, + size_t *off __unused) +{ +} Modified: head/sys/mips/mips/genassym.c ============================================================================== --- head/sys/mips/mips/genassym.c Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/mips/genassym.c Sat Mar 3 08:19:18 2012 (r232449) @@ -92,6 +92,9 @@ ASSYM(PC_CURPMAP, offsetof(struct pcpu, ASSYM(VM_MAX_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS); ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); +#ifdef COMPAT_FREEBSD32 +ASSYM(SIGF32_UC, offsetof(struct sigframe32, sf_uc)); +#endif ASSYM(SIGFPE, SIGFPE); ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Sat Mar 3 08:11:04 2012 (r232448) +++ head/sys/mips/mips/swtch.S Sat Mar 3 08:19:18 2012 (r232449) @@ -55,6 +55,7 @@ * assembly language support routines. */ +#include "opt_compat.h" #include "opt_cputype.h" #include #include @@ -636,3 +637,21 @@ _C_LABEL(esigcode): szsigcode: .long esigcode-sigcode .text + +#if (defined(__mips_n32) || defined(__mips_n64)) && defined(COMPAT_FREEBSD32) + .globl _C_LABEL(sigcode32) +_C_LABEL(sigcode32): + addu a0, sp, SIGF32_UC # address of ucontext + li v0, SYS_sigreturn +# sigreturn (ucp) + syscall + break 0 # just in case sigreturn fails + .globl _C_LABEL(esigcode32) +_C_LABEL(esigcode32): + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 09:18:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CA14106564A; Sat, 3 Mar 2012 09:18:40 +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 C94068FC0C; Sat, 3 Mar 2012 09:18:38 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q239ERce011710; Sat, 3 Mar 2012 11:14:27 +0200 (EET) (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.5/8.14.5) with ESMTP id q239ERDs098905; Sat, 3 Mar 2012 11:14:27 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q239EQGV098904; Sat, 3 Mar 2012 11:14:26 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Mar 2012 11:14:26 +0200 From: Konstantin Belousov To: Bruce Evans Message-ID: <20120303091426.GS75778@deviant.kiev.zoral.com.ua> References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <201203012347.32984.tijl@freebsd.org> <20120302132403.P929@besplex.bde.org> <201203022231.43186.tijl@freebsd.org> <20120303110551.Q1494@besplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8DtChEGCcMdSgkU2" Content-Disposition: inline In-Reply-To: <20120303110551.Q1494@besplex.bde.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 Cc: svn-src-head@freebsd.org, Tijl Coosemans , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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, 03 Mar 2012 09:18:40 -0000 --8DtChEGCcMdSgkU2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 03, 2012 at 12:02:23PM +1100, Bruce Evans wrote: > On Fri, 2 Mar 2012, Tijl Coosemans wrote: >=20 > >On Friday 02 March 2012 05:11:21 Bruce Evans wrote: > [... Lots about complications for longjmp() from a signal handler] >=20 > >Thanks, that was quite informative. C11 does say something about the > >FP env and signals now though: > > > >``When the processing of the abstract machine is interrupted by receipt > >of a signal, the values of objects that are neither lock-free atomic > >objects nor of type volatile sig_atomic_t are unspecified, as is the > >state of the floating-point environment. The value of any object > >modified by the handler that is neither a lock-free atomic object nor > >of type volatile sig_atomic_t becomes indeterminate when the handler > >exits, as does the state of the floating-point environment if it is > >modified by the handler and not restored to its original state.'' >=20 > Interesting. This is almost exactly the same as my justification for > not caring about old signal handlers getting a dirty FP state. Since > signal handlers can't do anything with static objects except write > to volatile sig_atomic_t ones, they can't do anything useful with FP. > But old standards seem to allow them to do silly things like calculate > pi to a billion decimal places and store the result encoded in an > array of about 1 billion sig_atomic_t's, or better yet, calculate > 2.0 + 2.0 and store the result in a smaller array of sig_atomic_t's. >=20 > Oops, the above doesn't clearly say of the unspecified state is for > the signal handler, or after the signal handler returns, or both. The > second sentence it only clearly says that certain objects and state > become indeterminate after bad behaviour by signal handlers. But we > want longjmp()s from signal handlers to be usually not bad behaviour. > The above at least allows them to work right. Maybe longjmp() can > determine if it is invoked in a signal handler and do the right thing > then. longjmp()s for machines that are too complicated for me have > to do sophisticated stack unwinding. This might require even more > sophisticated unwinding for signal handlers. This reminds me that > POSIX (?) weasels out of some of the complications by only requiring > a single level of nested signal handlers to work. >=20 > >This means a signal handler must not rely on the state of the FP env. > >It may install its own FP env if needed (e.g. FE_DFL_ENV), but then it > >must restore the original before returning. This allows for the > >rounding mode to be silently modified for integer conversions for > >instance. >=20 > Well, I think the kernel can't trust the signal handler to do that. It > also can't trust the compiler. The compiler can reasonably use FP for > anything it wants if this is (the compiler thinks) transparent to the > abstract machine, but the compiler can't know when the code is for a > signal handler without complicated directives. Then on x86, integer > operations may use the same SSE registers (although perhaps not mxcsr) > as FP uses, and again the compiler can't reasonably know when not to > do this. So the kernel must restore at least the shared registers, > and for SSE this means restoring using f*rstor which handles the whole > state at no extra cost. >=20 > So the interesting points for signal handlers move to: > - should signal handlers have to initialize their own state if they want > to use FP explicitly? I think they should. Might be, they should if talking about abstract C implementation, but any useful Unix (U*x, probably) implementation gives much more guarantees there. > - should signal handlers have to initialize their own state if they want > to use FP or shared registers implicitly (because the compiler wants to= )? > No. The kernel must handle this transparently, much like it does now, > and I think this makes the previous case work transparently too. The > kernel tries to do this lazily, but it doesn't do this very well (it > copies the state several times in sendsig() and sigreturn()). > - when the signal handler wants to modify the interrupted state, how does > it do this? There is minimal support for this. The easiest way to > modify it is to modify the current state and then longjmp() instead of > returning. I disagree. The most correct way is to modify ucontext_t supplied to the handler, and then return normally. There may be state grown in next generations of architecture which signal handler author is not aware. Also, on some architectures some parts of the ucontext/sigcontext can only be restored by kernel. This is true even for x86. > - how can signal handlers and debuggers even see the interrupted state? > gdb has less clue about this than it did 20 years ago. Users can > probably use debuggers to follow various pointers to the saved state > if they know more about this than signal handlers and debuggers. Signal handlers should examine ucontext_t. ptrace(2) interface on FreeBSD allows to fully examine and modify the thread CPU state. gdb indeed was not upgraded to be aware of recent FreeBSD features (and not very recent features, too). >=20 > >If longjmp is not supposed to change the FP env then, when called from > >a signal handler, either the signal handler must install a proper FP > >env before calling longjmp or a proper FP env must be installed after > >the target setjmp call. Otherwise the FP env is unspecified. >=20 > Better handle the usual case right like it used to be, without the > signal handler having to do anything, by always saving a minimal > environment in setjmp(), but now only restoring it for longjmp() in > signal handlers. The minimal environment doesn't include any normal > register on at least amd64 and i386 (except for i387 it includes the > stack and the tags -- these must be empty on return from any function > call). >=20 > Again there is a problem with transparent use of FP or SSE by the > compiler. An average SIGINT handler that doesn't want to do any > explicit FP and just wants to longjmp() back to the main loop can't > be expected to understand this stuff better than standards, kernels > and compilers and have the complications neccessary to fix up the FP > state after the compiler has transparently (it thinks) used FP or SSE. longjmp() from a signal handler has very high chance of providing wrong CPU state for anything except basic integer registers. --8DtChEGCcMdSgkU2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9R4PIACgkQC3+MBN1Mb4j0sQCgyUwcWmHxjoSCXcZZm4f8Z/nf pUAAoKYaNrCQmSv38bBzHDq0wwI/LGvi =T4an -----END PGP SIGNATURE----- --8DtChEGCcMdSgkU2-- From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 09:19:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A537106568A; Sat, 3 Mar 2012 09:19:20 +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 78D378FC16; Sat, 3 Mar 2012 09:19:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q239JK5P073074; Sat, 3 Mar 2012 09:19:20 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q239JKUe073072; Sat, 3 Mar 2012 09:19:20 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201203030919.q239JKUe073072@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 3 Mar 2012 09:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232450 - head/lib/libcam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 09:19:20 -0000 Author: jh Date: Sat Mar 3 09:19:20 2012 New Revision: 232450 URL: http://svn.freebsd.org/changeset/base/232450 Log: Use snprintf(3) constantly when generating CAM error messages. PR: bin/57088 Submitted by: Rui Lopes, arundel MFC after: 2 weeks Modified: head/lib/libcam/camlib.c Modified: head/lib/libcam/camlib.c ============================================================================== --- head/lib/libcam/camlib.c Sat Mar 3 08:19:18 2012 (r232449) +++ head/lib/libcam/camlib.c Sat Mar 3 09:19:20 2012 (r232450) @@ -121,7 +121,8 @@ cam_get_device(const char *path, char *d if (path == NULL) { - sprintf(cam_errbuf, "%s: device pathname was NULL", func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: device pathname was NULL", func_name); return(-1); } @@ -143,7 +144,8 @@ cam_get_device(const char *path, char *d } if (*tmpstr == '\0') { - sprintf(cam_errbuf, "%s: no text after slash", func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: no text after slash", func_name); free(newpath); return(-1); } @@ -170,9 +172,9 @@ cam_get_device(const char *path, char *d * If we only have 1, we don't have a valid device name. */ if (strlen(tmpstr) < 2) { - sprintf(cam_errbuf, - "%s: must have both device name and unit number", - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: must have both device name and unit number", + func_name); free(newpath); return(-1); } @@ -182,9 +184,9 @@ cam_get_device(const char *path, char *d * has probably given us all numbers. Point out the error. */ if (isdigit(*tmpstr)) { - sprintf(cam_errbuf, - "%s: device name cannot begin with a number", - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: device name cannot begin with a number", + func_name); free(newpath); return(-1); } @@ -195,8 +197,8 @@ cam_get_device(const char *path, char *d * or he gave us a device name/number format we don't recognize. */ if (!isdigit(tmpstr[strlen(tmpstr) - 1])) { - sprintf(cam_errbuf, "%s: unable to find device unit number", - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: unable to find device unit number", func_name); free(newpath); return(-1); } @@ -324,8 +326,9 @@ cam_open_btl(path_id_t path_id, target_i PERIPH_MATCH_LUN | PERIPH_MATCH_NAME; if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { - sprintf(cam_errbuf, "%s: CAMIOCOMMAND ioctl failed\n" - "%s: %s", func_name, func_name, strerror(errno)); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: CAMIOCOMMAND ioctl failed\n" + "%s: %s", func_name, func_name, strerror(errno)); goto btl_bailout; } @@ -335,23 +338,26 @@ cam_open_btl(path_id_t path_id, target_i if ((ccb.ccb_h.status != CAM_REQ_CMP) || ((ccb.cdm.status != CAM_DEV_MATCH_LAST) && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) { - sprintf(cam_errbuf, "%s: CAM error %#x, CDM error %d " - "returned from XPT_DEV_MATCH ccb", func_name, - ccb.ccb_h.status, ccb.cdm.status); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: CAM error %#x, CDM error %d " + "returned from XPT_DEV_MATCH ccb", func_name, + ccb.ccb_h.status, ccb.cdm.status); goto btl_bailout; } if (ccb.cdm.status == CAM_DEV_MATCH_MORE) { - sprintf(cam_errbuf, "%s: CDM reported more than one" - " passthrough device at %d:%d:%d!!\n", - func_name, path_id, target_id, target_lun); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: CDM reported more than one" + " passthrough device at %d:%d:%d!!\n", + func_name, path_id, target_id, target_lun); goto btl_bailout; } if (ccb.cdm.num_matches == 0) { - sprintf(cam_errbuf, "%s: no passthrough device found at" - " %d:%d:%d", func_name, path_id, target_id, - target_lun); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: no passthrough device found at" + " %d:%d:%d", func_name, path_id, target_id, + target_lun); goto btl_bailout; } @@ -372,8 +378,9 @@ cam_open_btl(path_id_t path_id, target_i break; /* NOTREACHED */ } default: - sprintf(cam_errbuf, "%s: asked for a peripheral match, but" - " got a bus or device match", func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: asked for a peripheral match, but" + " got a bus or device match", func_name); goto btl_bailout; break; /* NOTREACHED */ } @@ -446,7 +453,7 @@ cam_lookup_pass(const char *dev_name, in "your kernel\n%s: or %s%d doesn't exist", func_name, func_name, dev_name, unit); } - snprintf(cam_errbuf, sizeof(cam_errbuf), + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, "%s: CAMGETPASSTHRU ioctl failed\n" "%s: %s%s", func_name, func_name, strerror(errno), (errno == ENOENT) ? tmpstr : ""); @@ -464,8 +471,9 @@ cam_lookup_pass(const char *dev_name, in * the device the user gave us. */ if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { - sprintf(cam_errbuf, "%s: device %s%d does not exist!", - func_name, dev_name, unit); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: device %s%d does not exist!", + func_name, dev_name, unit); return(NULL); } @@ -495,9 +503,10 @@ cam_real_open_device(const char *path, i if (device == NULL) { if ((device = (struct cam_device *)malloc( sizeof(struct cam_device))) == NULL) { - sprintf(cam_errbuf, "%s: device structure malloc" - " failed\n%s: %s", func_name, func_name, - strerror(errno)); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: device structure malloc" + " failed\n%s: %s", func_name, func_name, + strerror(errno)); return(NULL); } device->fd = -1; @@ -553,8 +562,9 @@ cam_real_open_device(const char *path, i * because we just opened it above. The only way this * ioctl can fail is if the ccb size is wrong. */ - sprintf(cam_errbuf, "%s: CAMGETPASSTHRU ioctl failed\n" - "%s: %s", func_name, func_name, strerror(errno)); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: CAMGETPASSTHRU ioctl failed\n" + "%s: %s", func_name, func_name, strerror(errno)); goto crod_bailout; } @@ -565,8 +575,8 @@ cam_real_open_device(const char *path, i * the device the user gave us. */ if (ccb.cgdl.status == CAM_GDEVLIST_ERROR) { - sprintf(cam_errbuf, "%s: passthrough device does not exist!", - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: passthrough device does not exist!", func_name); goto crod_bailout; } @@ -579,8 +589,9 @@ cam_real_open_device(const char *path, i ccb.ccb_h.func_code = XPT_PATH_INQ; if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { - sprintf(cam_errbuf, "%s: Path Inquiry CCB failed\n" - "%s: %s", func_name, func_name, strerror(errno)); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: Path Inquiry CCB failed\n" + "%s: %s", func_name, func_name, strerror(errno)); goto crod_bailout; } strlcpy(device->sim_name, ccb.cpi.dev_name, sizeof(device->sim_name)); @@ -593,8 +604,9 @@ cam_real_open_device(const char *path, i */ ccb.ccb_h.func_code = XPT_GDEV_TYPE; if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { - sprintf(cam_errbuf, "%s: Get Device Type CCB failed\n" - "%s: %s", func_name, func_name, strerror(errno)); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: Get Device Type CCB failed\n" + "%s: %s", func_name, func_name, strerror(errno)); goto crod_bailout; } device->pd_type = SID_TYPE(&ccb.cgd.inq_data); @@ -616,8 +628,9 @@ cam_real_open_device(const char *path, i ccb.cts.type = CTS_TYPE_CURRENT_SETTINGS; if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { - sprintf(cam_errbuf, "%s: Get Transfer Settings CCB failed\n" - "%s: %s", func_name, func_name, strerror(errno)); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: Get Transfer Settings CCB failed\n" + "%s: %s", func_name, func_name, strerror(errno)); goto crod_bailout; } if (ccb.cts.protocol == XPORT_SPI) { @@ -696,7 +709,8 @@ cam_device_dup(struct cam_device *device struct cam_device *newdev; if (device == NULL) { - sprintf(cam_errbuf, "%s: device is NULL", func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: device is NULL", func_name); return(NULL); } @@ -721,14 +735,14 @@ cam_device_copy(struct cam_device *src, char *func_name = "cam_device_copy"; if (src == NULL) { - sprintf(cam_errbuf, "%s: source device struct was NULL", - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: source device struct was NULL", func_name); return; } if (dst == NULL) { - sprintf(cam_errbuf, "%s: destination device struct was NULL", - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, + "%s: destination device struct was NULL", func_name); return; } From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 10:11:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DDCF106564A; Sat, 3 Mar 2012 10:11:19 +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 1CD7B8FC0C; Sat, 3 Mar 2012 10:11:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23ABJiI074776; Sat, 3 Mar 2012 10:11:19 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23ABInC074774; Sat, 3 Mar 2012 10:11:19 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203031011.q23ABInC074774@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 3 Mar 2012 10:11:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232451 - stable/9/sys/i386/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 10:11:19 -0000 Author: kib Date: Sat Mar 3 10:11:18 2012 New Revision: 232451 URL: http://svn.freebsd.org/changeset/base/232451 Log: MFC r232143: Do not write to the user address directly, use suword(). Modified: stable/9/sys/i386/linux/linux_sysvec.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/9/sys/i386/linux/linux_sysvec.c Sat Mar 3 09:19:20 2012 (r232450) +++ stable/9/sys/i386/linux/linux_sysvec.c Sat Mar 3 10:11:18 2012 (r232451) @@ -227,11 +227,11 @@ linux_fixup(register_t **stack_base, str argv = *stack_base; envp = *stack_base + (imgp->args->argc + 1); (*stack_base)--; - **stack_base = (intptr_t)(void *)envp; + suword(*stack_base, (intptr_t)(void *)envp); (*stack_base)--; - **stack_base = (intptr_t)(void *)argv; + suword(*stack_base, (intptr_t)(void *)argv); (*stack_base)--; - **stack_base = imgp->args->argc; + suword(*stack_base, imgp->args->argc); return (0); } @@ -286,7 +286,7 @@ elf_linux_fixup(register_t **stack_base, imgp->auxargs = NULL; (*stack_base)--; - **stack_base = (register_t)imgp->args->argc; + suword(*stack_base, (register_t)imgp->args->argc); return (0); } From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 10:22:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F089C106566C; Sat, 3 Mar 2012 10:22:49 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E00238FC16; Sat, 3 Mar 2012 10:22:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23AMnd6075184; Sat, 3 Mar 2012 10:22:49 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23AMnlK075182; Sat, 3 Mar 2012 10:22:49 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201203031022.q23AMnlK075182@svn.freebsd.org> From: Juli Mallett Date: Sat, 3 Mar 2012 10:22: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: r232452 - 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: Sat, 03 Mar 2012 10:22:50 -0000 Author: jmallett Date: Sat Mar 3 10:22:49 2012 New Revision: 232452 URL: http://svn.freebsd.org/changeset/base/232452 Log: Unbreak n64 build without COMPAT_FREEBSD32 by fixing mismatched preprocessor conditionals. Modified: head/sys/mips/mips/trap.c Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Sat Mar 3 10:11:18 2012 (r232451) +++ head/sys/mips/mips/trap.c Sat Mar 3 10:22:49 2012 (r232452) @@ -351,7 +351,7 @@ cpu_fetch_syscall_args(struct thread *td sa->args[6] = locr0->t6; sa->args[7] = locr0->t7; nsaved += 4; -#if defined (__mips_n32) || defined(__mips_n64) +#ifdef COMPAT_FREEBSD32 } #endif #endif From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 11:50:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E517A106564A; Sat, 3 Mar 2012 11:50:48 +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 D48CB8FC15; Sat, 3 Mar 2012 11:50:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23Bom3C080409; Sat, 3 Mar 2012 11:50:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23BomB7080407; Sat, 3 Mar 2012 11:50:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203031150.q23BomB7080407@svn.freebsd.org> From: Alexander Motin Date: Sat, 3 Mar 2012 11:50: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: r232454 - 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, 03 Mar 2012 11:50:49 -0000 Author: mav Date: Sat Mar 3 11:50:48 2012 New Revision: 232454 URL: http://svn.freebsd.org/changeset/base/232454 Log: Fix bug of r232207, when cpu_search() could prefer CPU group with best load, but with no CPU matching given limitations. It caused kernel panics in some cases when thread was bound to specific CPUs with cpuset(1). Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sat Mar 3 11:11:56 2012 (r232453) +++ head/sys/kern/sched_ule.c Sat Mar 3 11:50:48 2012 (r232454) @@ -662,16 +662,18 @@ cpu_search(const struct cpu_group *cg, s /* We have info about child item. Compare it. */ if (match & CPU_SEARCH_LOWEST) { - if ((load < lload) || - (load == lload && lgroup.cs_load < low->cs_load)) { + if (lgroup.cs_load != INT_MAX && + (load < lload || + (load == lload && lgroup.cs_load < low->cs_load))) { lload = load; low->cs_cpu = lgroup.cs_cpu; low->cs_load = lgroup.cs_load; } } if (match & CPU_SEARCH_HIGHEST) - if ((load > hload) || - (load == hload && hgroup.cs_load > high->cs_load)) { + if (hgroup.cs_load != -1 && + (load > hload || + (load == hload && hgroup.cs_load > high->cs_load))) { hload = load; high->cs_cpu = hgroup.cs_cpu; high->cs_load = hgroup.cs_load; @@ -1230,6 +1232,7 @@ sched_pickcpu(struct thread *td, int fla /* Search globally for the less loaded CPU. */ if (cpu == -1) cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu); + KASSERT(cpu != -1, ("sched_pickcpu: Failed to find a cpu.")); /* * Compare the lowest loaded cpu to current cpu. */ @@ -1242,7 +1245,6 @@ sched_pickcpu(struct thread *td, int fla SCHED_STAT_INC(pickcpu_lowest); if (cpu != ts->ts_cpu) SCHED_STAT_INC(pickcpu_migration); - KASSERT(cpu != -1, ("sched_pickcpu: Failed to find a cpu.")); return (cpu); } #endif From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 11:53:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 698F91065672; Sat, 3 Mar 2012 11:53:36 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 053908FC14; Sat, 3 Mar 2012 11:53:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23BrZ0h080534; Sat, 3 Mar 2012 11:53:35 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23BrZuv080532; Sat, 3 Mar 2012 11:53:35 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201203031153.q23BrZuv080532@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 3 Mar 2012 11:53: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: r232455 - 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, 03 Mar 2012 11:53:36 -0000 Author: trociny Date: Sat Mar 3 11:53:35 2012 New Revision: 232455 URL: http://svn.freebsd.org/changeset/base/232455 Log: Make kern.proc.umask sysctl readonly. Requested by: src MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sat Mar 3 11:50:48 2012 (r232454) +++ head/sys/kern/kern_proc.c Sat Mar 3 11:53:35 2012 (r232455) @@ -2473,8 +2473,7 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL } /* - * This sysctl allows a process to retrieve or/and set umask of - * another process. + * This sysctl allows a process to retrieve umask of another process. */ static int sysctl_kern_proc_umask(SYSCTL_HANDLER_ARGS) @@ -2488,9 +2487,6 @@ sysctl_kern_proc_umask(SYSCTL_HANDLER_AR if (namelen != 1) return (EINVAL); - if (req->newptr != NULL && req->newlen != sizeof(fd_cmask)) - return (EINVAL); - error = pget((pid_t)name[0], PGET_WANTREAD, &p); if (error != 0) return (error); @@ -2498,20 +2494,8 @@ sysctl_kern_proc_umask(SYSCTL_HANDLER_AR FILEDESC_SLOCK(p->p_fd); fd_cmask = p->p_fd->fd_cmask; FILEDESC_SUNLOCK(p->p_fd); - error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask)); - if (error != 0) - goto errout; - - if (req->newptr != NULL) { - error = SYSCTL_IN(req, &fd_cmask, sizeof(fd_cmask)); - if (error == 0) { - FILEDESC_XLOCK(p->p_fd); - p->p_fd->fd_cmask = fd_cmask & ALLPERMS; - FILEDESC_XUNLOCK(p->p_fd); - } - } -errout: PRELE(p); + error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask)); return (error); } @@ -2617,6 +2601,5 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC CTLFLAG_MPSAFE, sysctl_kern_proc_ps_strings, "Process ps_strings location"); -static SYSCTL_NODE(_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RW | - CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_umask, - "Process umask"); +static SYSCTL_NODE(_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RD | + CTLFLAG_MPSAFE, sysctl_kern_proc_umask, "Process umask"); From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 14:00:10 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E03A2106564A; Sat, 3 Mar 2012 14:00:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 283758FC0C; Sat, 3 Mar 2012 14:00:08 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q23DxxMh003421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 4 Mar 2012 01:00:00 +1100 Date: Sun, 4 Mar 2012 00:59:59 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov In-Reply-To: <20120303091426.GS75778@deviant.kiev.zoral.com.ua> Message-ID: <20120303221614.G5236@besplex.bde.org> References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <201203012347.32984.tijl@freebsd.org> <20120302132403.P929@besplex.bde.org> <201203022231.43186.tijl@freebsd.org> <20120303110551.Q1494@besplex.bde.org> <20120303091426.GS75778@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, Tijl Coosemans , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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, 03 Mar 2012 14:00:10 -0000 On Sat, 3 Mar 2012, Konstantin Belousov wrote: > On Sat, Mar 03, 2012 at 12:02:23PM +1100, Bruce Evans wrote: >> On Fri, 2 Mar 2012, Tijl Coosemans wrote: >> >> So the interesting points for signal handlers move to: >> - should signal handlers have to initialize their own state if they want >> to use FP explicitly? I think they should. > Might be, they should if talking about abstract C implementation, > but any useful Unix (U*x, probably) implementation gives much more > guarantees there. They don't document it of course. >> - should signal handlers have to initialize their own state if they want >> to use FP or shared registers implicitly (because the compiler wants to)? >> No. The kernel must handle this transparently, much like it does now, >> and I think this makes the previous case work transparently too. The >> kernel tries to do this lazily, but it doesn't do this very well (it >> copies the state several times in sendsig() and sigreturn()). >> - when the signal handler wants to modify the interrupted state, how does >> it do this? There is minimal support for this. The easiest way to >> modify it is to modify the current state and then longjmp() instead of >> returning. > I disagree. The most correct way is to modify ucontext_t supplied to the > handler, and then return normally. There may be state grown in next > generations of architecture which signal handler author is not aware. > Also, on some architectures some parts of the ucontext/sigcontext > can only be restored by kernel. This is true even for x86. So you want an average SIGINT handler that doesn't want to do any FP, to understand the complications of FP better than longjmp() does, so as to do what longjmp() doesn't know how to do, for future arches. It is true that some parts of contexts can only be restored by the kernel. Even the signal mask requires sigreturn(2) for restoral without races. FreeBSD's [sig]longjmp() doesn't know how to do this, and neither does an average user of [sig]longjmp(). Returning from signal handlers works better because it uses sigreturn() automatically. However, it is difficult to _modify_ delicate FP or other state that you don't understand in a signal handler so that sigreturn() restores what you want. It is easiest to prepare the state before calling setjmp() and have longjmp() simply restore it. The normal preparation is to do nothing -- the program knows nothing of FP, and is happily running with a usable FP state. setjmp() simply saves this state, and longjmp() should restore it (except for exception flags). Note that it doesn't work to require the program to fix up the state after setjmp() returns 1, since the program knows nothing of FP so it won't know how to fix up the state then any more that it knows how to fix up the state before longjmp(), although the fixup is much easier. Apart from no program knowing that it should be done, something like the following would work: for _every_ call to setjmp: /* Save FP env, because some setjmp()s are too broken to do it. */ fegetenv(&env); if (setjmp(jb) != 0) { /* Restore FP env, since some longjmp()s are too broken... */ * * But first, if we are actually an FP program that wants * to use fenv, then try to recover the current exception * flags. Most longjmp()s from signal handlers lose these, * but* this is harder to fix so we just hope that we don't * have to. */ fegetexceptflags(&ex, FE_ALL_EXCEPT) fesetenv(&env); fesetexceptflags(&ex, FE_ALL_EXCEPT) /* * XXX what about raising any exceptions that we just * unmasked? * * In a signal handler (before longjmp() the code to * not lose the exception flags (assuming that the signal * handler is passed a clean state) would be something like: * - use fenv to mask all exceptions * - read the exception flags from uncontext_t. The MI * API fegetexceptflags() is usually unavailable for this * - store the exception flags into the hardware. Since * the MI API fesetexceptflags() is not available either * this seems easier than converting the harware * representation that is probably in ucontext_t into an * fexcept_t. We masked all exceptions so that new ones * don't bite us. * - we can now use longjmp(), provided longjmp() doesn't * change any FP state and the caller of setjmp() has * the above complications to replace the rest of the * signal handler's unknown FP state with a good one, * including unmasking any exceptions that we masked. */ } The above complications belong in setjmp() and longjmp(), not in every program. setjmp() and longjmp() can do them much more efficiently. For example, on and64 it is not necessary to save the full FP environment (which is a very slow operation). >> - how can signal handlers and debuggers even see the interrupted state? >> gdb has less clue about this than it did 20 years ago. Users can >> probably use debuggers to follow various pointers to the saved state >> if they know more about this than signal handlers and debuggers. > Signal handlers should examine ucontext_t. > > ptrace(2) interface on FreeBSD allows to fully examine and modify the > thread CPU state. gdb indeed was not upgraded to be aware of recent > FreeBSD features (and not very recent features, too). Yes, it is difficult. I didn't even mention portability before. For standard C, there is no ucontext_t. For POSIX, ucontext_t is essentially opaque. You can save and restore it but you can't modify it without doing unportable things. But FP changes require doing very unportable OS- and CPU- dependent things. Depending on longjmp() to work right is of course very OS-dependent, but longjmp() can very easily handle some CPU- dependent things provided it has non-broken semantics. >>> If longjmp is not supposed to change the FP env then, when called from >>> a signal handler, either the signal handler must install a proper FP >>> env before calling longjmp or a proper FP env must be installed after >>> the target setjmp call. Otherwise the FP env is unspecified. >> >> Better handle the usual case right like it used to be, without the >> signal handler having to do anything, by always saving a minimal >> environment in setjmp(), but now only restoring it for longjmp() in >> signal handlers. The minimal environment doesn't include any normal >> register on at least amd64 and i386 (except for i387 it includes the >> stack and the tags -- these must be empty on return from any function >> call). >> >> Again there is a problem with transparent use of FP or SSE by the >> compiler. An average SIGINT handler that doesn't want to do any >> explicit FP and just wants to longjmp() back to the main loop can't >> be expected to understand this stuff better than standards, kernels >> and compilers and have the complications neccessary to fix up the FP >> state after the compiler has transparently (it thinks) used FP or SSE. > > longjmp() from a signal handler has very high chance of providing > wrong CPU state for anything except basic integer registers. Only if longjmp() it is broken. A slightly different way to look at this is that without fenv support. restoring the entire FP state (or all of it that matters) to that the setjmp() works perfectly, because conforming programs just can't see any fenv state. FP exception flags correspond to the overflow flag in integer arithmetic, and average programs know nothing of either. Support for fenv must not be allowed to break this. Here is my old program for testing that some of this works on i386. It has rotted a bit (last edit 25 Oct 1994). It assumes that the divison by 0 exception and the invalid operand exception are unmasked, as in FreeBSD-[1-~2]. % #undef TEST_CW_PRESERVED_ACROSS_SIGFPE % #define TEST_LONGJMP_RESTORES_FP % % #define _POSIX_SOURCE 1 % % #include % #include % #include % % static sigjmp_buf sjb; % % static void catch(int sig) % { % write(1, "1", 1); % siglongjmp(sjb, 1); % } % % int main(void) % { % struct sigaction action; % % action.sa_handler = catch; % sigemptyset(&action.sa_mask); % action.sa_flags = 0; % #ifdef TEST_CW_PRESERVED_ACROSS_SIGFPE % sigaction(SIGFPE, &action, (struct sigaction *) NULL); % #endif % #ifdef TEST_LONGJMP_RESTORES_FP % sigaction(SIGINT, &action, (struct sigaction *) NULL); % #endif % % while (1) % { % if (sigsetjmp(sjb, 1)) % write(1, "2", 1); % else % { % #ifdef TEST_CW_PRESERVED_ACROSS_SIGFPE % __asm("fldz; fld1; fdiv %st(1),%st; fwait"); % write(1, "?", 1); % #endif % #ifdef TEST_LONGJMP_RESTORES_FP % while (1) % __asm("fld1; fstp %st"); % #endif % } % } % } When TEST_LONGJMP_RESTORES_FP is defined, this tests that the FP stack doesn't become corrupted by SIGINTs (the corrupt stack should give a SIGFPE which is not caught, else "12" should be printed after every SIGINT. When TEST_CW_PRESERVED_ACROSS_SIGFPE is defined, this tests that the the divison by 0 exception is unmasked and remains unmasked after longjmp() from a signal handler for the SIGFPE. Now it also needs to check that the exception bit for division by zero is not lost by any of - handling an unmasked SIGFPE or a SIGINT, with and without longjmp()ing from the handler - looping without handling any signal The exception bit is lost in most cases. Similarly for SSE and mxcsr. Similarly for other arches. Division by 0 is fairly easy to arrange without using asm, but the above uses asm so that it can control the amount of FP used, and its placement. The asms probably now need to be volatile to prevent them moving. Or just compile with -O0. I have a much larger test that unmasked FP exceptions (mainly for division by 0) work correctly with i486 and later with exception 16 and as well as possible for i386/i387 with IRQ13. -current still passes the former, but this is due to a bug in the test. The test assumes that the exception flags are clobbered by SIGFPE handling,s so that when the SIGFPE handler returns normally, the SIGFPE doesn't repeat. i387 FP exceptions aren't quite normal faults since the signal trap is delayed until the next non-control FP instruction after the one that caused the exception, especially with IRQ13, but they behave similarly unless the exception flags are clobberred (the fault repeats on the next non-control FP instruction). SSE FP exceptions are normal faults (the fault repeats on the instruction that causes it, and the exception flags have no effect on this, and FreeBSD's SIGFPE handler doesn't clobber them anyway). FP exceptions are rarely unmasked now, so the buggy behaviour is mostly moot now even for i387. Anyway, no one should expect to continue after a SIGFPE handler returns normally without fixing up the problem completely. That's much more harmful than longjmp()ing from the handler (on i387, the stack is certain to be corrupt, and the exception flags are clobbered to hide some problems). longjmp()ing from SIGFPE handlers needs to work as well as longjmp() from SIGINT handlers to provide a reasonably easy way out of them. Bruce From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 14:13:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6C3F41065672; Sat, 3 Mar 2012 14:13:05 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay020.isp.belgacom.be (mailrelay020.isp.belgacom.be [195.238.6.95]) by mx1.freebsd.org (Postfix) with ESMTP id 37D468FC0C; Sat, 3 Mar 2012 14:13:03 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjUFAIomUk9bsWcW/2dsb2JhbABCsVCCeoEIgX0BAQQBViMQCw4KLjkeBogVCbc3kF0EpVCCZA Received: from 22.103-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.103.22]) by relay.skynet.be with ESMTP; 03 Mar 2012 15:12:55 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q23ECsgJ002334; Sat, 3 Mar 2012 15:12:54 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: Konstantin Belousov Date: Sat, 3 Mar 2012 15:12:46 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <20120303110551.Q1494@besplex.bde.org> <20120303091426.GS75778@deviant.kiev.zoral.com.ua> In-Reply-To: <20120303091426.GS75778@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2479442.GBbydegazq"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201203031512.52057.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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, 03 Mar 2012 14:13:05 -0000 --nextPart2479442.GBbydegazq Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable On Saturday 03 March 2012 10:14:26 Konstantin Belousov wrote: > On Sat, Mar 03, 2012 at 12:02:23PM +1100, Bruce Evans wrote: >> On Fri, 2 Mar 2012, Tijl Coosemans wrote: >>=20 >>> On Friday 02 March 2012 05:11:21 Bruce Evans wrote: >> [... Lots about complications for longjmp() from a signal handler] >>=20 >>> Thanks, that was quite informative. C11 does say something about the >>> FP env and signals now though: >>> >>> ``When the processing of the abstract machine is interrupted by receipt >>> of a signal, the values of objects that are neither lock-free atomic >>> objects nor of type volatile sig_atomic_t are unspecified, as is the >>> state of the floating-point environment. The value of any object >>> modified by the handler that is neither a lock-free atomic object nor >>> of type volatile sig_atomic_t becomes indeterminate when the handler >>> exits, as does the state of the floating-point environment if it is >>> modified by the handler and not restored to its original state.'' >>=20 >> Interesting. This is almost exactly the same as my justification for >> not caring about old signal handlers getting a dirty FP state. Since >> signal handlers can't do anything with static objects except write >> to volatile sig_atomic_t ones, they can't do anything useful with FP. >> But old standards seem to allow them to do silly things like calculate >> pi to a billion decimal places and store the result encoded in an >> array of about 1 billion sig_atomic_t's, or better yet, calculate >> 2.0 + 2.0 and store the result in a smaller array of sig_atomic_t's. >>=20 >> Oops, the above doesn't clearly say of the unspecified state is for >> the signal handler, or after the signal handler returns, or both. The >> second sentence it only clearly says that certain objects and state >> become indeterminate after bad behaviour by signal handlers. But we >> want longjmp()s from signal handlers to be usually not bad behaviour. >> The above at least allows them to work right. Maybe longjmp() can >> determine if it is invoked in a signal handler and do the right thing >> then. longjmp()s for machines that are too complicated for me have >> to do sophisticated stack unwinding. This might require even more >> sophisticated unwinding for signal handlers. This reminds me that >> POSIX (?) weasels out of some of the complications by only requiring >> a single level of nested signal handlers to work. >>=20 >>> This means a signal handler must not rely on the state of the FP env. >>> It may install its own FP env if needed (e.g. FE_DFL_ENV), but then it >>> must restore the original before returning. This allows for the >>> rounding mode to be silently modified for integer conversions for >>> instance. >>=20 >> Well, I think the kernel can't trust the signal handler to do that. It >> also can't trust the compiler. The compiler can reasonably use FP for >> anything it wants if this is (the compiler thinks) transparent to the >> abstract machine, but the compiler can't know when the code is for a >> signal handler without complicated directives. Then on x86, integer >> operations may use the same SSE registers (although perhaps not mxcsr) >> as FP uses, and again the compiler can't reasonably know when not to >> do this. So the kernel must restore at least the shared registers, >> and for SSE this means restoring using f*rstor which handles the whole >> state at no extra cost. >>=20 >> So the interesting points for signal handlers move to: >> - should signal handlers have to initialize their own state if they want >> to use FP explicitly? I think they should. > Might be, they should if talking about abstract C implementation, > but any useful Unix (U*x, probably) implementation gives much more > guarantees there. Yes, being unspecified allows for the kernel to handle the saving and restoring and to install a default FP env for the handler. The compiler can also assume a default environment (unless FENV_ACCESS pragma is on) so it's probably necessary for the kernel to do so. >>> If longjmp is not supposed to change the FP env then, when called from >>> a signal handler, either the signal handler must install a proper FP >>> env before calling longjmp or a proper FP env must be installed after >>> the target setjmp call. Otherwise the FP env is unspecified. >>=20 >> Better handle the usual case right like it used to be, without the >> signal handler having to do anything, by always saving a minimal >> environment in setjmp(), but now only restoring it for longjmp() in >> signal handlers. The minimal environment doesn't include any normal >> register on at least amd64 and i386 (except for i387 it includes the >> stack and the tags -- these must be empty on return from any function >> call). >>=20 >> Again there is a problem with transparent use of FP or SSE by the >> compiler. An average SIGINT handler that doesn't want to do any >> explicit FP and just wants to longjmp() back to the main loop can't >> be expected to understand this stuff better than standards, kernels >> and compilers and have the complications neccessary to fix up the FP >> state after the compiler has transparently (it thinks) used FP or SSE. >=20 > longjmp() from a signal handler has very high chance of providing > wrong CPU state for anything except basic integer registers. And the signal might have interrupted a function that isn't reentrant, so you can still only call async-signal-safe functions after the longjmp. It doesn't really leave the signal handler context. --nextPart2479442.GBbydegazq Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk9SJuMACgkQfoCS2CCgtivTsQD/V6fAtBiEJvXWDYWCDBQNmxIL eMjiHhQZlKZ7vxCcgsoA+gIAyKbKg+aNWTgHjl9AJ+vsU3np2SLYnVX3Yi+ckkk6 =dC4W -----END PGP SIGNATURE----- --nextPart2479442.GBbydegazq-- From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 14:23:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A8C3106564A; Sat, 3 Mar 2012 14:23:55 +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 039508FC0C; Sat, 3 Mar 2012 14:23:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23ENt2x085833; Sat, 3 Mar 2012 14:23:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23ENsSE085830; Sat, 3 Mar 2012 14:23:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203031423.q23ENsSE085830@svn.freebsd.org> From: John Baldwin Date: Sat, 3 Mar 2012 14:23: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: r232463 - 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: Sat, 03 Mar 2012 14:23:55 -0000 Author: jhb Date: Sat Mar 3 14:23:54 2012 New Revision: 232463 URL: http://svn.freebsd.org/changeset/base/232463 Log: Expand and reorganize the pci(9) manpage a bit: - Document the following routines: pci_alloc_msi(), pci_alloc_msix(), pci_find_cap(), pci_get_max_read_req(), pci_get_vpd_ident(), pci_get_vpd_readonly(), pci_msi_count(), pci_msix_count(), pci_pending_msix(), pci_release_msi(), pci_remap_msix(), and pci_set_max_read_req(). - Group the functions into five sub-sections: raw configuration access, locating devices, device information, device configuration, and message signaled interrupts. - Discourage use of pci_disable_io() and pci_enable_io() in device drivers. The PCI bus driver handles this automatically as resources are activated. MFC after: 2 weeks Modified: head/share/man/man9/Makefile head/share/man/man9/pci.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat Mar 3 14:02:34 2012 (r232462) +++ head/share/man/man9/Makefile Sat Mar 3 14:23:54 2012 (r232463) @@ -971,18 +971,30 @@ MLINKS+=namei.9 NDFREE.9 \ MLINKS+=pbuf.9 getpbuf.9 \ pbuf.9 relpbuf.9 \ pbuf.9 trypbuf.9 -MLINKS+=pci.9 pci_disable_busmaster.9 \ +MLINKS+=pci.9 pci_alloc_msi.9 \ + pci.9 pci_alloc_msix.9 \ + pci.9 pci_disable_busmaster.9 \ pci.9 pci_disable_io.9 \ pci.9 pci_enable_busmaster.9 \ pci.9 pci_enable_io.9 \ pci.9 pci_find_bsf.9 \ + pci.9 pci_find_cap.9 \ pci.9 pci_find_dbsf.9 \ pci.9 pci_find_device.9 \ + pci.9 pci_get_max_read_req.9 \ pci.9 pci_get_powerstate.9 \ + pci.9 pci_get_vpd_ident.9 \ + pci.9 pci_get_vpd_readonly.9 \ + pci.9 pci_msi_count.9 \ + pci.9 pci_msix_count.9 \ + pci.9 pci_pending_msix.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_release_msi.9 \ + pci.9 pci_remap_msix.9 \ pci.9 pci_restore_state.9 \ pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ + pci.9 pci_set_max_read_req.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ pfil.9 pfil_hook_get.9 \ Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Sat Mar 3 14:02:34 2012 (r232462) +++ head/share/man/man9/pci.9 Sat Mar 3 14:23:54 2012 (r232463) @@ -30,25 +30,40 @@ .Os .Sh NAME .Nm pci , +.Nm pci_alloc_msi , +.Nm pci_alloc_msix , .Nm pci_disable_busmaster , .Nm pci_disable_io , .Nm pci_enable_busmaster , .Nm pci_enable_io , .Nm pci_find_bsf , +.Nm pci_find_cap , .Nm pci_find_dbsf , .Nm pci_find_device , +.Nm pci_get_max_read_req , .Nm pci_get_powerstate , +.Nm pci_get_vpd_ident , +.Nm pci_get_vpd_readonly , +.Nm pci_msi_count , +.Nm pci_msix_count , +.Nm pci_pending_msix , .Nm pci_read_config , +.Nm pci_release_msi , +.Nm pci_remap_msix , .Nm pci_restore_state , .Nm pci_save_state , +.Nm pci_set_max_read_req , .Nm pci_set_powerstate , .Nm pci_write_config .Nd PCI bus interface .Sh SYNOPSIS .In sys/bus.h -.In dev/pci/pcivar.h .In dev/pci/pcireg.h -.In machine/pci_cfgreg.h +.In dev/pci/pcivar.h +.Ft int +.Fn pci_alloc_msi "device_t dev" "int *count" +.Ft int +.Fn pci_alloc_msix "device_t dev" "int *count" .Ft int .Fn pci_disable_busmaster "device_t dev" .Ft int @@ -59,19 +74,39 @@ .Fn pci_enable_io "device_t dev" "int space" .Ft device_t .Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" +.Ft int +.Fn pci_find_cap "device_t dev" "int capability" "int *capreg" .Ft device_t .Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t .Fn pci_find_device "uint16_t vendor" "uint16_t device" .Ft int +.Fn pci_get_max_read_req "device_t dev" +.Ft int .Fn pci_get_powerstate "device_t dev" +.Ft int +.Fn pci_get_vpd_ident "device_t dev" "const char **identptr" +.Ft int +.Fn pci_get_vpd_readonly "device_t dev" "const char *kw" "const char **vptr" +.Ft int +.Fn pci_msi_count "device_t dev" +.Ft int +.Fn pci_msix_count "device_t dev" +.Ft int +.Fn pci_pending_msix "device_t dev" "u_int index" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft int +.Fn pci_release_msi "device_t dev" +.Ft int +.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors" .Ft void .Fn pci_restore_state "device_t dev" .Ft void .Fn pci_save_state "device_t dev" .Ft int +.Fn pci_set_max_read_req "device_t dev" "int size" +.Ft int .Fn pci_set_powerstate "device_t dev" "int state" .Ft void .Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" @@ -79,7 +114,14 @@ The .Nm set of functions are used for managing PCI devices. -.Pp +The functions are split into several groups: +raw configuration access, +locating devices, +device information, +device configuration, +and +message signaled interrupts. +.Ss Raw Configuration Access The .Fn pci_read_config function is used to read data from the PCI configuration @@ -104,6 +146,126 @@ with .Fa width specifying the size of the access. .Pp +.Em NOTE : +Device drivers should only use these functions for functionality that +is not available via another +.Fn pci +function. +.Ss Locating Devices +The +.Fn pci_find_bsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +Note that in case the system has multiple PCI domains, +the +.Fn pci_find_bsf +function only searches the first one. +Actually, it is equivalent to: +.Bd -literal -offset indent +pci_find_dbsf(0, bus, slot, func); +.Ed +.Pp +The +.Fn pci_find_dbsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa domain , +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +.Pp +The +.Fn pci_find_device +function looks up the +.Vt device_t +of a PCI device, given its +.Fa vendor +and +.Fa device +IDs. +Note that there can be multiple matches for this search; this function +only returns the first matching device. +.Ss Device Information +The +.Fn pci_find_cap +function is used to locate the first instance of a PCI capability +register set for the device +.Fa dev . +The capability to locate is specified by ID via +.Fa capability . +Constant macros of the form +.Dv PCIY_xxx +for standard capability IDs are defined in +.In dev/pci/pcireg.h . +If the capability is found, then +.Fa *capreg +is set the offset in configuration space of the capability register set, +and +.Fn pci_find_cap +returns zero. +If the capability is not found or the device does not support capabilities, +.Fn pci_find_cap +returns an error. +.Pp +The +.Fn pci_get_vpd_ident +function is used to fetch a device's Vital Product Data +.Pq VPD +identifier string. +If the device +.Fa dev +supports VPD and provides an identifier string, +then +.Fa *identptr +is set to point at a read-only, null-terminated copy of the identifier +string, +and +.Fn pci_get_vpd_ident +returns zero. +If the device does not support VPD or does not provide an identifier +string, +then +.Fn pci_get_vpd_ident +returns an error. +.Pp +The +.Fn pci_get_vpd_readonly +function is used to fetch the value of a single VPD read-only keyword +for the device +.Fa dev . +The keyword to fetch is identified by the two character string +.Fa kw . +If the device supports VPD and provides a read-only value for the +requested keyword, +then +.Fa *vptr +is set to point at a read-only, null-terminated copy of the value, +and +.Fn pci_get_vpd_readonly +returns zero. +If the device does not support VPD or does not provide the requested +keyword, +then +.Fn pci_get_vpd_readonly +returns an error. +.Ss Device Configuration The .Fn pci_enable_busmaster function enables PCI bus mastering for the device @@ -138,10 +300,41 @@ argument specifies which resource is aff or .Dv SYS_RES_IOPORT as appropriate. +Device drivers should generally not use these routines directly. +The PCI bus will enable decoding automatically when a +.Dv SYS_RES_MEMORY +or +.Dv SYS_RES_IOPORT +resource is activated via +.Xr bus_alloc_resource 9 +or +.Xr bus_activate_resource 9 . .Pp -.Em NOTE : -These functions should be used in preference to manually manipulating -the configuration space. +The +.Fn pci_get_max_read_req +function returns the current maximum read request size in bytes for a +PCI-express device. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_get_max_read_req +returns zero. +.Pp +The +.Fn pci_set_max_read_req +sets the PCI-express maximum read request size for +.Fa dev . +The requested +.Fa size +may be adjusted, +and +.Fn pci_set_max_read_req +returns the actual size set in bytes. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_set_max_read_req +returns zero. .Pp The .Fn pci_get_powerstate @@ -210,57 +403,216 @@ is invoked, then the device will be transitioned to .Dv PCI_POWERSTATE_D0 before any config registers are restored. -.Pp -The -.Fn pci_find_bsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa bus , -.Fa slot , +.Ss Message Signaled Interrupts +Message Signaled Interrupts +.Pq MSI and -.Fa func . +Enhanced Message Signaled Interrupts +.Pq MSI-X +are PCI capabilities that provide an alternate method for PCI +devices to signal interrupts. +The legacy INTx interrupt is available to PCI devices as a +.Dv SYS_RES_IRQ +resource with a resource ID of zero. +MSI and MSI-X interrupts are available to PCI devices as one or more +.Dv SYS_RES_IRQ +resources with resource IDs greater than zero. +A driver must ask the PCI bus to allocate MSI or MSI-X interrupts +using +.Fn pci_alloc_msi +or +.Fn pci_alloc_msix +before it can use MSI or MSI-X +.Dv SYS_RES_IRQ +resources. +A driver is not allowed to use the legacy INTx +.Dv SYS_RES_IRQ +resource if MSI or MSI-X interrupts have been allocated, +and attempts to allocate MSI or MSI-X interrupts will fail if the +driver is currently using the legacy INTx +.Dv SYS_RES_IRQ +resource. +A driver is only allowed to use either MSI or MSI-X, +but not both. +.Pp +The +.Fn pci_count_msi +function returns the maximum number of MSI messages supported by the +device +.Fa dev. +If the device does not support MSI, +then +.Fn pci_count_msi +returns zero. +.Pp +The +.Fn pci_alloc_msi +function attempts to allocate +.Fa *count +MSI messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. -Note that in case the system has multiple PCI domains, -the -.Fn pci_find_bsf -function only searches the first one. -Actually, it is equivalent to: -.Bd -literal -offset indent -pci_find_dbsf(0, bus, slot, func); -.Ed +.Fn pci_alloc_msi +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msi +returns zero. +The +.Dv SYS_RES_IRQ +resources for the allocated messages will be available at consecutive +resource IDs beginning with one. +If +.Fn pci_alloc_msi +is not able to allocate any messages, +it returns an error. +Note that MSI only supports message counts that are powers of two; +requests to allocate a non-power of two count of messages will fail. +.Pp +The +.Fn pci_release_msi +function is used to release any allocated MSI or MSI-X messages back +to the system. +If any MSI or MSI-X +.Dv SYS_RES_IRQ +resources are allocated by the driver or have a configured interrupt +handler, +this function will fail with +.Er EBUSY . +The +.Fn pci_release_msi +function returns zero on success and an error on failure. +.Pp +.The +.Fn pci_count_msix +function returns the maximum number of MSI-X messages supported by the +device +.Fa dev . +If the device does not support MSI-X, +then +.Fn pci_count_msix +returns zero. .Pp The -.Fn pci_find_dbsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa domain , -.Fa bus , -.Fa slot , -and -.Fa func . +.Fn pci_alloc_msix +function attempts to allocate +.Fa *count +MSI-X messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. +.Fn pci_alloc_msix +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI-X messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msix +returns zero. +For MSI-X messages, +the resource ID for each +.Dv SYS_RES_IRQ resource identifies the index in the MSI-X table of the +corresponding message. +A resource ID of one maps to the first index of the MSI-X table; +a resource ID two identifies the second index in the table, etc. +The +.Fn pci_alloc_msix +function assigns the +.Fa *count +messages allocated to the first +.Fa *count +table indicies. +If +.Fn pci_alloc_msix +is not able to allocate any messages, +it returns an error. +Unlike MSI, +MSI-X does not require message counts that are powers of two. .Pp The -.Fn pci_find_device -function looks up the -.Vt device_t -of a PCI device, given its -.Fa vendor -and -.Fa device -IDs. -Note that there can be multiple matches for this search; this function -only returns the first matching device. +.Fn pci_pending_msix +function examines the +.Fa dev +device's Pending Bit Array +.Pq PBA +to determine the pending status of the MSI-X message at table index +.Fa index . +If the indicated message is pending, +this function returns a non-zero value; +otherwise, +it returns zero. +Passing an invalid +.Fa index +to this function will result in undefined behavior. +.Pp +As mentioned in the description of +.Fn pci_alloc_msix , +MSI-X messages are initially assigned to the first N table entries. +A driver may use a different distribution of available messages to +table entries via the +.Fn pci_remap_msix +function. +Note that this function must be called after a succesful call to +.Fn pci_alloc_msix +but before any of the +.Dv SYS_RES_IRQ +resources are allocated. +The +.Fn pci_remap_msix +function returns zero on success, +or an error on failure. +.Pp +The +.Fa vectors +array should contain +.Fa count +message vectors. +The array maps directly to the MSI-X table in that the first entry in +the array specifies the message used for the first entry in the MSI-X +table, +the second entry in the array corresponds to the second entry in the +MSI-X table, +etc. +The vector value in each array index can either be zero to indicate +that no message should be assigned to the corresponding MSI-X table entry, +or it can be a number from one to N +.Po +where N is the count returned from the previous call to +.Fn pci_alloc_msix +.Pc +to indicate which of the allocated messages should be assigned to the +corresponding MSI-X table entry. +.Pp +If +.Fn pci_remap_msix +succeeds, +each MSI-X table entry with a non-zero vector will have an associated +.Dv SYS_RES_IRQ +resource whose resource ID corresponds to the table index as described +above for +.Fn pci_alloc_msix . +MSI-X table entries that with a vector of zero will not have an +associated +.Dv SYS_RES_IRQ resource. +Additionally, +if any of the original messages allocated by +.Fn pci_alloc_msix +are not used in the new distribution of messages in the MSI-X table, +they will be released automatically. +Note that if a driver wishes to use fewer messages than were allocated by +.Fn pci_alloc_msix , +the driver must use a single, contiguous range of messages beginning +with one in the new distribution. +The +.Fn pci_remap_msix +function will fail if this condition is not met. .Sh IMPLEMENTATION NOTES The .Vt pci_addr_t @@ -293,7 +645,9 @@ space on the target architecture. .Re .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@FreeBSD.org . +.An Bruce M Simpson Aq bms@FreeBSD.org +and +.An John Baldwin Aq jhb@FreeBSD.org . .Sh BUGS The kernel PCI code has a number of references to .Dq "slot numbers" . From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 14:24:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 627881065670; Sat, 3 Mar 2012 14:24:40 +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 4DCCF8FC18; Sat, 3 Mar 2012 14:24:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23EOek0085895; Sat, 3 Mar 2012 14:24:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23EOegu085893; Sat, 3 Mar 2012 14:24:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203031424.q23EOegu085893@svn.freebsd.org> From: John Baldwin Date: Sat, 3 Mar 2012 14:24: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: r232464 - 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: Sat, 03 Mar 2012 14:24:40 -0000 Author: jhb Date: Sat Mar 3 14:24:39 2012 New Revision: 232464 URL: http://svn.freebsd.org/changeset/base/232464 Log: Fix a typo. Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Sat Mar 3 14:23:54 2012 (r232463) +++ head/sys/dev/pci/pci.c Sat Mar 3 14:24:39 2012 (r232464) @@ -1474,7 +1474,7 @@ pci_alloc_msix_method(device_t dev, devi * 3. Call the three vectors allocated by pci_alloc_msix() A, B, and * C. After the call to pci_alloc_msix(), the device will be setup to * have an MSI-X table of ABC--- (where - means no vector assigned). - * If the driver ten passes a vector array of { 1, 0, 1, 2, 0, 2 }, + * If the driver then passes a vector array of { 1, 0, 1, 2, 0, 2 }, * then the MSI-X table will look like A-AB-B, and the 'C' vector will * be freed back to the system. This device will also have valid * SYS_RES_IRQ rids of 1, 3, 4, and 6. From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 14:25:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5AC15106566C; Sat, 3 Mar 2012 14:25:37 +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 4665B8FC0A; Sat, 3 Mar 2012 14:25:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23EPbvx085963; Sat, 3 Mar 2012 14:25:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23EPbFS085961; Sat, 3 Mar 2012 14:25:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203031425.q23EPbFS085961@svn.freebsd.org> From: John Baldwin Date: Sat, 3 Mar 2012 14:25: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: r232465 - 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: Sat, 03 Mar 2012 14:25:37 -0000 Author: jhb Date: Sat Mar 3 14:25:36 2012 New Revision: 232465 URL: http://svn.freebsd.org/changeset/base/232465 Log: Update the pci_get_vpd_readonly() wrapper to use 'vptr' instead of 'identptr' for its last parameter to match the default implementation as well as the method definition in pci_if.m. Modified: head/sys/dev/pci/pcivar.h Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Sat Mar 3 14:24:39 2012 (r232464) +++ head/sys/dev/pci/pcivar.h Sat Mar 3 14:25:36 2012 (r232465) @@ -350,9 +350,9 @@ pci_get_vpd_ident(device_t dev, const ch } static __inline int -pci_get_vpd_readonly(device_t dev, const char *kw, const char **identptr) +pci_get_vpd_readonly(device_t dev, const char *kw, const char **vptr) { - return(PCI_GET_VPD_READONLY(device_get_parent(dev), dev, kw, identptr)); + return(PCI_GET_VPD_READONLY(device_get_parent(dev), dev, kw, vptr)); } /* From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 15:38:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87B9E10656D7; Sat, 3 Mar 2012 15:38:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73EEB8FC18; Sat, 3 Mar 2012 15:38:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23Fc2ij088412; Sat, 3 Mar 2012 15:38:02 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23Fc27K088410; Sat, 3 Mar 2012 15:38:02 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203031538.q23Fc27K088410@svn.freebsd.org> From: Eitan Adler Date: Sat, 3 Mar 2012 15:38: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: r232466 - head/bin/df X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 15:38:02 -0000 Author: eadler Date: Sat Mar 3 15:38:01 2012 New Revision: 232466 URL: http://svn.freebsd.org/changeset/base/232466 Log: Direct users to swapinfo and pstat from df PR: bin/165321 Submitted by: jhs Approved by: bcr MFC after: 3 days Modified: head/bin/df/df.1 Modified: head/bin/df/df.1 ============================================================================== --- head/bin/df/df.1 Sat Mar 3 14:25:36 2012 (r232465) +++ head/bin/df/df.1 Sat Mar 3 15:38:01 2012 (r232466) @@ -158,7 +158,9 @@ is set, the block counts will be display .El .Sh SEE ALSO .Xr lsvfs 1 , +.Xr pstat 1 , .Xr quota 1 , +.Xr swapinfo 1 , .Xr fstatfs 2 , .Xr getfsstat 2 , .Xr statfs 2 , From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 15:43:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BE403106576A; Sat, 3 Mar 2012 15:43:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail30.syd.optusnet.com.au (mail30.syd.optusnet.com.au [211.29.133.193]) by mx1.freebsd.org (Postfix) with ESMTP id 533F48FC16; Sat, 3 Mar 2012 15:43:39 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail30.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q23FhVSg025250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 4 Mar 2012 02:43:32 +1100 Date: Sun, 4 Mar 2012 02:43:31 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201203031512.52057.tijl@freebsd.org> Message-ID: <20120304021957.O5936@besplex.bde.org> References: <201202282217.q1SMHrIk094780@svn.freebsd.org> <20120303110551.Q1494@besplex.bde.org> <20120303091426.GS75778@deviant.kiev.zoral.com.ua> <201203031512.52057.tijl@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r232275 - in head/sys: amd64/include i386/include pc98/include x86/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, 03 Mar 2012 15:43:40 -0000 On Sat, 3 Mar 2012, Tijl Coosemans wrote: > On Saturday 03 March 2012 10:14:26 Konstantin Belousov wrote: >> longjmp() from a signal handler has very high chance of providing >> wrong CPU state for anything except basic integer registers. Not really, and return from a SIGFPE handler has a chance of 100% of providing undefined behaviour in both theory and practice. (The undefined behaviour includes working because the signal handler fixed the problem, but that is too hard for most cases.) > And the signal might have interrupted a function that isn't reentrant, > so you can still only call async-signal-safe functions after the > longjmp. It doesn't really leave the signal handler context. It is the responsibility of the application not to allow the non-reentrant case if it wants to handle signals by longjmp()ing from signal handlers. This is not very hard to arrange, with some useful results, by keeping the scopes of jmp_bufs small. E.g., around a read(2) loop, where the read() might hang and you plan to let it be killed by a SIGINT, or around some long FP calculation using local variables, where you fear that the calculation might divide by 0 or something, and you want to trap the exception and abort as soon as it happens, and don't want to check for division by 0 throught the calculation or at the end. Some cases with globals are safe too. E.g., if you are initializing a data struct but will discard it all if there there is a signal. The read() loop into global storage is a special case (read into local storage for an example with full reentrancy). Bruce From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 16:13:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04D4F106566C; Sat, 3 Mar 2012 16:13:21 +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 E4B048FC0C; Sat, 3 Mar 2012 16:13:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23GDKZ1089771; Sat, 3 Mar 2012 16:13:20 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23GDKv4089769; Sat, 3 Mar 2012 16:13:20 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201203031613.q23GDKv4089769@svn.freebsd.org> From: Rick Macklem Date: Sat, 3 Mar 2012 16:13: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: r232467 - 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: Sat, 03 Mar 2012 16:13:21 -0000 Author: rmacklem Date: Sat Mar 3 16:13:20 2012 New Revision: 232467 URL: http://svn.freebsd.org/changeset/base/232467 Log: The name caching changes of r230394 exposed an intermittent bug in the new NFS server for NFSv4, where it would report ENOENT when the file actually existed on the server. This turned out to be caused by not initializing ni_topdir before calling lookup() and there was a rare case where the value on the stack location assigned to ni_topdir happened to be a pointer to a ".." entry, such that "dp == ndp->ni_topdir" succeeded in lookup(). This patch initializes ni_topdir to fix the problem. MFC after: 5 days Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Sat Mar 3 15:38:01 2012 (r232466) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sat Mar 3 16:13:20 2012 (r232467) @@ -395,6 +395,7 @@ nfsvno_namei(struct nfsrv_descript *nd, cnp->cn_thread = p; ndp->ni_startdir = dp; ndp->ni_rootdir = rootvnode; + ndp->ni_topdir = NULL; if (!lockleaf) cnp->cn_flags |= LOCKLEAF; From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 16:38:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31F4A106566C for ; Sat, 3 Mar 2012 16:38:56 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay00.pair.com (relay00.pair.com [209.68.5.9]) by mx1.freebsd.org (Postfix) with SMTP id D814C8FC18 for ; Sat, 3 Mar 2012 16:38:55 +0000 (UTC) Received: (qmail 39388 invoked from network); 3 Mar 2012 16:38:48 -0000 Received: from 87.58.144.241 (HELO x2.osted.lan) (87.58.144.241) by relay00.pair.com with SMTP; 3 Mar 2012 16:38:48 -0000 X-pair-Authenticated: 87.58.144.241 Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.4/8.14.4) with ESMTP id q23Gcihs076119; Sat, 3 Mar 2012 17:38:44 +0100 (CET) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.4/8.14.4/Submit) id q23Gci1I076118; Sat, 3 Mar 2012 17:38:44 +0100 (CET) (envelope-from pho) Date: Sat, 3 Mar 2012 17:38:43 +0100 From: Peter Holm To: Rick Macklem Message-ID: <20120303163843.GA72020@x2.osted.lan> References: <201203021153.06614.jhb@freebsd.org> <1978600220.298005.1330754492306.JavaMail.root@erie.cs.uoguelph.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1978600220.298005.1330754492306.JavaMail.root@erie.cs.uoguelph.ca> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 16:38:56 -0000 On Sat, Mar 03, 2012 at 01:01:32AM -0500, Rick Macklem wrote: > John Baldwin wrote: > > On Friday, March 02, 2012 8:29:21 am Peter Holm wrote: > > > On Thu, Mar 01, 2012 at 04:47:41PM -0500, John Baldwin wrote: > > > > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > > > > Author: pho > > > > > Date: Mon Oct 31 15:01:47 2011 > > > > > New Revision: 226967 > > > > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > > > > > > > Log: > > > > > The kern_renameat() looks up the fvp using the DELETE flag, > > > > > which causes > > > > > the removal of the name cache entry for fvp. > > > > > > > > > > Reported by: Anton Yuzhaninov > > > > > In collaboration with: kib > > > > > MFC after: 1 week > > > > > > > > > > Modified: > > > > > head/sys/ufs/ufs/ufs_vnops.c > > > > > > > > So I ran into this at work recently, and even this fix applied I > > > > was still > > > > seeing rename()'s that were seemingly not taking effect. After > > > > getting some > > > > extra KTR traces, I figured out that the same purge needs to be > > > > applied to the > > > > destination vnode. Specifically, the issue I ran into was that was > > > > renaming > > > > 'foo' to 'bar', but lookups for 'bar' were still returning the old > > > > file. The > > > > reason was that a lookup after the namei(RENAME) of the > > > > destination while > > > > ufs_rename() had its locks dropped was readding the name cache > > > > entry for > > > > 'bar', and then a cache_lookup() of 'bar' would return the old > > > > vnode as long > > > > as that vnode was valid (e.g. if it had a link in another > > > > location, or other > > > > processes had an open file descriptor for it). I'm currently > > > > testing the > > > > patch below: > > > > > > > > > > I now have a scenario that fails, but not quite the same way you > > > describe. > > > > > > It looks like this: > > > > > > touch file1 > > > echo xxx > file2 > > > rename(file1, file2) > > > > > > A different process performs stat() on both files in a tight loop. > > > > > > Once in a while I observe that a stat() of file2, after the rename, > > > returns a link count of zero. Size is zero as expected, but the > > > inode > > > number of file2 is unchanged. > > > Peter, were you doing a stat() using the file name, or an fstat()? > (Using stat() with afile name might explain it, maybe??) > Yes. Switching to open()/fstat() of the "from" file in the loop, makes the cache problem go away. - Peter From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 17:52:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E551106566B; Sat, 3 Mar 2012 17:52:20 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 014478FC08; Sat, 3 Mar 2012 17:52:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23HqJHt093267; Sat, 3 Mar 2012 17:52:19 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23HqJZn093265; Sat, 3 Mar 2012 17:52:19 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203031752.q23HqJZn093265@svn.freebsd.org> From: Eitan Adler Date: Sat, 3 Mar 2012 17:52: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: r232469 - head/bin/df X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 17:52:20 -0000 Author: eadler Date: Sat Mar 3 17:52:19 2012 New Revision: 232469 URL: http://svn.freebsd.org/changeset/base/232469 Log: Bump date to today (since I modified it) PR: bin/165321 Approved by: gjb MFC after: 3 days Modified: head/bin/df/df.1 Modified: head/bin/df/df.1 ============================================================================== --- head/bin/df/df.1 Sat Mar 3 17:03:26 2012 (r232468) +++ head/bin/df/df.1 Sat Mar 3 17:52:19 2012 (r232469) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd October 18, 2011 +.Dd March 3, 2012 .Dt DF 1 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 18:03:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03F40106566B; Sat, 3 Mar 2012 18:03:51 +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 CA2138FC0A; Sat, 3 Mar 2012 18:03:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23I3oNY093655; Sat, 3 Mar 2012 18:03:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23I3owm093652; Sat, 3 Mar 2012 18:03:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203031803.q23I3owm093652@svn.freebsd.org> From: John Baldwin Date: Sat, 3 Mar 2012 18:03: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: r232470 - in head/sys/dev: oce virtio/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: Sat, 03 Mar 2012 18:03:51 -0000 Author: jhb Date: Sat Mar 3 18:03:50 2012 New Revision: 232470 URL: http://svn.freebsd.org/changeset/base/232470 Log: Use pci_find_cap() instead of pci_find_extcap() to locate PCI find capabilities as the latter API is deprecated for this purpose. MFC after: 2 weeks Modified: head/sys/dev/oce/oce_hw.c head/sys/dev/virtio/pci/virtio_pci.c Modified: head/sys/dev/oce/oce_hw.c ============================================================================== --- head/sys/dev/oce/oce_hw.c Sat Mar 3 17:52:19 2012 (r232469) +++ head/sys/dev/oce/oce_hw.c Sat Mar 3 18:03:50 2012 (r232470) @@ -203,12 +203,12 @@ void oce_get_pci_capabilities(POCE_SOFTC { uint32_t val; - if (pci_find_extcap(sc->dev, PCIY_PCIX, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_PCIX, &val) == 0) { if (val != 0) sc->flags |= OCE_FLAGS_PCIX; } - if (pci_find_extcap(sc->dev, PCIY_EXPRESS, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_EXPRESS, &val) == 0) { if (val != 0) { uint16_t link_status = pci_read_config(sc->dev, val + 0x12, 2); @@ -219,12 +219,12 @@ void oce_get_pci_capabilities(POCE_SOFTC } } - if (pci_find_extcap(sc->dev, PCIY_MSI, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_MSI, &val) == 0) { if (val != 0) sc->flags |= OCE_FLAGS_MSI_CAPABLE; } - if (pci_find_extcap(sc->dev, PCIY_MSIX, &val) == 0) { + if (pci_find_cap(sc->dev, PCIY_MSIX, &val) == 0) { if (val != 0) { val = pci_msix_count(sc->dev); sc->flags |= OCE_FLAGS_MSIX_CAPABLE; Modified: head/sys/dev/virtio/pci/virtio_pci.c ============================================================================== --- head/sys/dev/virtio/pci/virtio_pci.c Sat Mar 3 17:52:19 2012 (r232469) +++ head/sys/dev/virtio/pci/virtio_pci.c Sat Mar 3 18:03:50 2012 (r232470) @@ -251,10 +251,10 @@ vtpci_attach(device_t dev) return (ENXIO); } - if (pci_find_extcap(dev, PCIY_MSI, NULL) != 0) + if (pci_find_cap(dev, PCIY_MSI, NULL) != 0) sc->vtpci_flags |= VIRTIO_PCI_FLAG_NO_MSI; - if (pci_find_extcap(dev, PCIY_MSIX, NULL) == 0) { + if (pci_find_cap(dev, PCIY_MSIX, NULL) == 0) { rid = PCIR_BAR(1); sc->vtpci_msix_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 18:07:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D3E71106566B; Sat, 3 Mar 2012 18:07:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF6C48FC08; Sat, 3 Mar 2012 18:07:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23I7rE4093808; Sat, 3 Mar 2012 18:07:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23I7rMP093806; Sat, 3 Mar 2012 18:07:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203031807.q23I7rMP093806@svn.freebsd.org> From: Eitan Adler Date: Sat, 3 Mar 2012 18:07: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: r232471 - head/usr.bin/indent X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 18:07:53 -0000 Author: eadler Date: Sat Mar 3 18:07:53 2012 New Revision: 232471 URL: http://svn.freebsd.org/changeset/base/232471 Log: Document the [n]eei and [n]bacc options PR: docs/165009 Submitted by: Jeremy Huddleston Approved by: bcr MFC after: 1 week Modified: head/usr.bin/indent/indent.1 Modified: head/usr.bin/indent/indent.1 ============================================================================== --- head/usr.bin/indent/indent.1 Sat Mar 3 18:03:50 2012 (r232470) +++ head/usr.bin/indent/indent.1 Sat Mar 3 18:07:53 2012 (r232471) @@ -34,7 +34,7 @@ .\" @(#)indent.1 8.1 (Berkeley) 7/1/93 .\" $FreeBSD$ .\" -.Dd June 29, 2004 +.Dd March 3, 2012 .Dt INDENT 1 .Os .Sh NAME @@ -43,9 +43,12 @@ .Sh SYNOPSIS .Nm .Op Ar input-file Op Ar output-file +.Op Fl bacc | Fl nbacc .Op Fl bad | Fl nbad .Op Fl bap | Fl nbap .Bk -words +.Op Fl ei | Fl ei +.Op Fl eei | Fl eei .Op Fl bbb | Fl nbbb .Ek .Op Fl \&bc | Fl nbc @@ -126,6 +129,15 @@ checks to make sure that it is different The options listed below control the formatting style imposed by .Nm . .Bl -tag -width Op +.It Fl bacc , nbacc +If +.Fl bacc +is specified, a blank line is forced around every conditional +compilation block. +For example, in front of every #ifdef and after every #endif. +Other blank lines surrounding such blocks will be swallowed. +Default: +.Fl nbacc . .It Fl bad , nbad If .Fl bad @@ -267,6 +279,16 @@ will have the same indentation as the pr statement. The default is .Fl ei . +.It Fl eei , neei +Enables (disables) extra indentation on continuation lines of +the expression part of +.Ic if +and +.Ic while +statements. +These continuation lines will be indented one extra level. +The default is +.Fl neei . .It Fl fbs , nfbs Enables (disables) splitting the function declaration and opening brace across two lines. From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 18:08:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C2149106566C; Sat, 3 Mar 2012 18:08:57 +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 AC2C88FC08; Sat, 3 Mar 2012 18:08:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23I8vws093894; Sat, 3 Mar 2012 18:08:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23I8vPV093886; Sat, 3 Mar 2012 18:08:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203031808.q23I8vPV093886@svn.freebsd.org> From: John Baldwin Date: Sat, 3 Mar 2012 18:08: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: r232472 - in head/sys/dev: pci siba X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 18:08:57 -0000 Author: jhb Date: Sat Mar 3 18:08:57 2012 New Revision: 232472 URL: http://svn.freebsd.org/changeset/base/232472 Log: Expand the set of APIs available for locating PCI capabilities: - pci_find_extcap() is repurposed to be used for fetching PCI-express extended capabilities (PCIZ_* constants in ). - pci_find_htcap() can be used to locate a specific HyperTransport capability (PCIM_HTCAP_* constants in ). - Cache the starting location of the PCI-express capability for PCI-express devices in PCI device ivars. Modified: head/sys/dev/pci/hostb_pci.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_if.m head/sys/dev/pci/pci_private.h head/sys/dev/pci/pcivar.h head/sys/dev/pci/vga_pci.c head/sys/dev/siba/siba_bwn.c Modified: head/sys/dev/pci/hostb_pci.c ============================================================================== --- head/sys/dev/pci/hostb_pci.c Sat Mar 3 18:07:53 2012 (r232471) +++ head/sys/dev/pci/hostb_pci.c Sat Mar 3 18:08:57 2012 (r232472) @@ -197,6 +197,14 @@ pci_hostb_assign_interrupt(device_t dev, } static int +pci_hostb_find_cap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_cap(dev, capability, capreg)); +} + +static int pci_hostb_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -204,6 +212,14 @@ pci_hostb_find_extcap(device_t dev, devi return (pci_find_extcap(dev, capability, capreg)); } +static int +pci_hostb_find_htcap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_htcap(dev, capability, capreg)); +} + static device_method_t pci_hostb_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pci_hostb_probe), @@ -233,7 +249,9 @@ static device_method_t pci_hostb_methods DEVMETHOD(pci_get_powerstate, pci_hostb_get_powerstate), DEVMETHOD(pci_set_powerstate, pci_hostb_set_powerstate), DEVMETHOD(pci_assign_interrupt, pci_hostb_assign_interrupt), + DEVMETHOD(pci_find_cap, pci_hostb_find_cap), DEVMETHOD(pci_find_extcap, pci_hostb_find_extcap), + DEVMETHOD(pci_find_htcap, pci_hostb_find_htcap), { 0, 0 } }; Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Sat Mar 3 18:07:53 2012 (r232471) +++ head/sys/dev/pci/pci.c Sat Mar 3 18:08:57 2012 (r232472) @@ -177,7 +177,9 @@ static device_method_t pci_methods[] = { DEVMETHOD(pci_get_powerstate, pci_get_powerstate_method), DEVMETHOD(pci_set_powerstate, pci_set_powerstate_method), DEVMETHOD(pci_assign_interrupt, pci_assign_interrupt_method), + DEVMETHOD(pci_find_cap, pci_find_cap_method), DEVMETHOD(pci_find_extcap, pci_find_extcap_method), + DEVMETHOD(pci_find_htcap, pci_find_htcap_method), DEVMETHOD(pci_alloc_msi, pci_alloc_msi_method), DEVMETHOD(pci_alloc_msix, pci_alloc_msix_method), DEVMETHOD(pci_remap_msix, pci_remap_msix_method), @@ -737,6 +739,9 @@ pci_read_cap(device_t pcib, pcicfgregs * * at least one PCI-express device. */ pcie_chipset = 1; + cfg->pcie.pcie_location = ptr; + val = REG(ptr + PCIR_EXPRESS_FLAGS, 2); + cfg->pcie.pcie_type = val & PCIM_EXP_FLAGS_TYPE; break; default: break; @@ -1154,12 +1159,55 @@ pci_get_vpd_readonly_method(device_t dev } /* - * Find the requested extended capability and return the offset in - * configuration space via the pointer provided. The function returns - * 0 on success and error code otherwise. + * Find the requested HyperTransport capability and return the offset + * in configuration space via the pointer provided. The function + * returns 0 on success and an error code otherwise. */ int -pci_find_extcap_method(device_t dev, device_t child, int capability, +pci_find_htcap_method(device_t dev, device_t child, int capability, int *capreg) +{ + int ptr, error; + uint16_t val; + + error = pci_find_cap(child, PCIY_HT, &ptr); + if (error) + return (error); + + /* + * Traverse the capabilities list checking each HT capability + * to see if it matches the requested HT capability. + */ + while (ptr != 0) { + val = pci_read_config(child, ptr + PCIR_HT_COMMAND, 2); + if (capability == PCIM_HTCAP_SLAVE || + capability == PCIM_HTCAP_HOST) + val &= 0xe000; + else + val &= PCIM_HTCMD_CAP_MASK; + if (val == capability) { + if (capreg != NULL) + *capreg = ptr; + return (0); + } + + /* Skip to the next HT capability. */ + while (ptr != 0) { + ptr = pci_read_config(child, ptr + PCICAP_NEXTPTR, 1); + if (pci_read_config(child, ptr + PCICAP_ID, 1) == + PCIY_HT) + break; + } + } + return (ENOENT); +} + +/* + * Find the requested capability and return the offset in + * configuration space via the pointer provided. The function returns + * 0 on success and an error code otherwise. + */ +int +pci_find_cap_method(device_t dev, device_t child, int capability, int *capreg) { struct pci_devinfo *dinfo = device_get_ivars(child); @@ -1207,6 +1255,43 @@ pci_find_extcap_method(device_t dev, dev } /* + * Find the requested extended capability and return the offset in + * configuration space via the pointer provided. The function returns + * 0 on success and an error code otherwise. + */ +int +pci_find_extcap_method(device_t dev, device_t child, int capability, + int *capreg) +{ + struct pci_devinfo *dinfo = device_get_ivars(child); + pcicfgregs *cfg = &dinfo->cfg; + uint32_t ecap; + uint16_t ptr; + + /* Only supported for PCI-express devices. */ + if (cfg->pcie.pcie_location == 0) + return (ENXIO); + + ptr = PCIR_EXTCAP; + ecap = pci_read_config(child, ptr, 4); + if (ecap == 0xffffffff || ecap == 0) + return (ENOENT); + for (;;) { + if (PCI_EXTCAP_ID(ecap) == capability) { + if (capreg != NULL) + *capreg = ptr; + return (0); + } + ptr = PCI_EXTCAP_NEXTPTR(ecap); + if (ptr == 0) + break; + ecap = pci_read_config(child, ptr, 4); + } + + return (ENOENT); +} + +/* * Support for MSI-X message interrupts. */ void @@ -1696,10 +1781,12 @@ pci_ht_map_msi(device_t dev, uint64_t ad int pci_get_max_read_req(device_t dev) { + struct pci_devinfo *dinfo = device_get_ivars(dev); int cap; uint16_t val; - if (pci_find_cap(dev, PCIY_EXPRESS, &cap) != 0) + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) return (0); val = pci_read_config(dev, cap + PCIR_EXPRESS_DEVICE_CTL, 2); val &= PCIM_EXP_CTL_MAX_READ_REQUEST; @@ -1710,10 +1797,12 @@ pci_get_max_read_req(device_t dev) int pci_set_max_read_req(device_t dev, int size) { + struct pci_devinfo *dinfo = device_get_ivars(dev); int cap; uint16_t val; - if (pci_find_cap(dev, PCIY_EXPRESS, &cap) != 0) + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) return (0); if (size < 128) size = 128; Modified: head/sys/dev/pci/pci_if.m ============================================================================== --- head/sys/dev/pci/pci_if.m Sat Mar 3 18:07:53 2012 (r232471) +++ head/sys/dev/pci/pci_if.m Sat Mar 3 18:08:57 2012 (r232472) @@ -105,6 +105,13 @@ METHOD int assign_interrupt { device_t child; }; +METHOD int find_cap { + device_t dev; + device_t child; + int capability; + int *capreg; +}; + METHOD int find_extcap { device_t dev; device_t child; @@ -112,6 +119,13 @@ METHOD int find_extcap { int *capreg; }; +METHOD int find_htcap { + device_t dev; + device_t child; + int capability; + int *capreg; +}; + METHOD int alloc_msi { device_t dev; device_t child; Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Sat Mar 3 18:07:53 2012 (r232471) +++ head/sys/dev/pci/pci_private.h Sat Mar 3 18:08:57 2012 (r232472) @@ -80,8 +80,12 @@ int pci_enable_busmaster_method(device_ int pci_disable_busmaster_method(device_t dev, device_t child); int pci_enable_io_method(device_t dev, device_t child, int space); int pci_disable_io_method(device_t dev, device_t child, int space); +int pci_find_cap_method(device_t dev, device_t child, + int capability, int *capreg); int pci_find_extcap_method(device_t dev, device_t child, int capability, int *capreg); +int pci_find_htcap_method(device_t dev, device_t child, + int capability, int *capreg); int pci_alloc_msi_method(device_t dev, device_t child, int *count); int pci_alloc_msix_method(device_t dev, device_t child, int *count); int pci_remap_msix_method(device_t dev, device_t child, Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Sat Mar 3 18:07:53 2012 (r232471) +++ head/sys/dev/pci/pcivar.h Sat Mar 3 18:08:57 2012 (r232472) @@ -123,6 +123,12 @@ struct pcicfg_ht { uint64_t ht_msiaddr; /* MSI mapping base address */ }; +/* Interesting values for PCI-express */ +struct pcicfg_pcie { + uint8_t pcie_location; /* Offset of PCI-e capability registers. */ + uint8_t pcie_type; /* Device type. */ +}; + /* config header information common to all header types */ typedef struct pcicfg { struct device *dev; /* device which owns this */ @@ -164,6 +170,7 @@ typedef struct pcicfg { struct pcicfg_msi msi; /* PCI MSI */ struct pcicfg_msix msix; /* PCI MSI-X */ struct pcicfg_ht ht; /* HyperTransport */ + struct pcicfg_pcie pcie; /* PCI Express */ } pcicfgregs; /* additional type 1 device config header information (PCI to PCI bridge) */ @@ -409,7 +416,7 @@ pci_get_powerstate(device_t dev) static __inline int pci_find_cap(device_t dev, int capability, int *capreg) { - return (PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg)); + return (PCI_FIND_CAP(device_get_parent(dev), dev, capability, capreg)); } static __inline int @@ -419,6 +426,12 @@ pci_find_extcap(device_t dev, int capabi } static __inline int +pci_find_htcap(device_t dev, int capability, int *capreg) +{ + return (PCI_FIND_HTCAP(device_get_parent(dev), dev, capability, capreg)); +} + +static __inline int pci_alloc_msi(device_t dev, int *count) { return (PCI_ALLOC_MSI(device_get_parent(dev), dev, count)); Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Sat Mar 3 18:07:53 2012 (r232471) +++ head/sys/dev/pci/vga_pci.c Sat Mar 3 18:08:57 2012 (r232472) @@ -314,6 +314,14 @@ vga_pci_assign_interrupt(device_t dev, d } static int +vga_pci_find_cap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_cap(dev, capability, capreg)); +} + +static int vga_pci_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -322,6 +330,14 @@ vga_pci_find_extcap(device_t dev, device } static int +vga_pci_find_htcap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_htcap(dev, capability, capreg)); +} + +static int vga_pci_alloc_msi(device_t dev, device_t child, int *count) { struct vga_pci_softc *sc; @@ -422,7 +438,9 @@ static device_method_t vga_pci_methods[] DEVMETHOD(pci_get_powerstate, vga_pci_get_powerstate), DEVMETHOD(pci_set_powerstate, vga_pci_set_powerstate), DEVMETHOD(pci_assign_interrupt, vga_pci_assign_interrupt), + DEVMETHOD(pci_find_cap, vga_pci_find_cap), DEVMETHOD(pci_find_extcap, vga_pci_find_extcap), + DEVMETHOD(pci_find_htcap, vga_pci_find_htcap), DEVMETHOD(pci_alloc_msi, vga_pci_alloc_msi), DEVMETHOD(pci_alloc_msix, vga_pci_alloc_msix), DEVMETHOD(pci_remap_msix, vga_pci_remap_msix), Modified: head/sys/dev/siba/siba_bwn.c ============================================================================== --- head/sys/dev/siba/siba_bwn.c Sat Mar 3 18:07:53 2012 (r232471) +++ head/sys/dev/siba/siba_bwn.c Sat Mar 3 18:08:57 2012 (r232472) @@ -279,6 +279,14 @@ siba_bwn_teardown_intr(device_t dev, dev } static int +siba_bwn_find_cap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_cap(dev, capability, capreg)); +} + +static int siba_bwn_find_extcap(device_t dev, device_t child, int capability, int *capreg) { @@ -287,6 +295,14 @@ siba_bwn_find_extcap(device_t dev, devic } static int +siba_bwn_find_htcap(device_t dev, device_t child, int capability, + int *capreg) +{ + + return (pci_find_htcap(dev, capability, capreg)); +} + +static int siba_bwn_alloc_msi(device_t dev, device_t child, int *count) { struct siba_bwn_softc *ssc; @@ -405,7 +421,9 @@ static device_method_t siba_bwn_methods[ DEVMETHOD(bus_teardown_intr, siba_bwn_teardown_intr), /* PCI interface */ + DEVMETHOD(pci_find_cap, siba_bwn_find_cap), DEVMETHOD(pci_find_extcap, siba_bwn_find_extcap), + DEVMETHOD(pci_find_htcap, siba_bwn_find_htcap), DEVMETHOD(pci_alloc_msi, siba_bwn_alloc_msi), DEVMETHOD(pci_release_msi, siba_bwn_release_msi), DEVMETHOD(pci_msi_count, siba_bwn_msi_count), From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 18:58:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B8A3106564A; Sat, 3 Mar 2012 18:58:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5623C8FC0A; Sat, 3 Mar 2012 18:58:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23IwGtG096053; Sat, 3 Mar 2012 18:58:16 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23IwGvG096048; Sat, 3 Mar 2012 18:58:16 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203031858.q23IwGvG096048@svn.freebsd.org> From: Dimitry Andric Date: Sat, 3 Mar 2012 18: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: r232473 - in head: share/mk 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: Sat, 03 Mar 2012 18:58:16 -0000 Author: dim Date: Sat Mar 3 18:58:15 2012 New Revision: 232473 URL: http://svn.freebsd.org/changeset/base/232473 Log: After r232322, it turned out many people (and some ports) are building kernel modules using their old installed /usr/share/mk/bsd.*.mk files, instead of the updated ones in their source tree. This leads to errors like: "sys/conf/kmod.mk", line 111: Malformed conditional (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") Obviously, these errors will go away after a "make installworld", or alternatively, by using "make buildenv" before attempting to manually build modules. However, since it is apparently an expected use case to build using old .mk files, change the way we test for clang, so it also works when the MK_CLANG_IS_CC macro doesn't exist. Note the conditional expressions are becoming rather unreadable now, but I will attempt to fix that on a followup commit. MFC after: 2 weeks Modified: head/share/mk/bsd.sys.mk head/sys/conf/kern.mk head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Sat Mar 3 18:08:57 2012 (r232472) +++ head/share/mk/bsd.sys.mk Sat Mar 3 18:58:15 2012 (r232473) @@ -28,7 +28,7 @@ CFLAGS += -std=${CSTD} . if defined(WARNS) . if ${WARNS} >= 1 CWARNFLAGS += -Wsystem-headers -. if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang)) +. if !defined(NO_WERROR) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WERROR.clang)) CWARNFLAGS += -Werror . endif . endif @@ -42,7 +42,7 @@ CWARNFLAGS += -W -Wno-unused-parameter - . if ${WARNS} >= 4 CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\ -Wshadow -Wunused-parameter -. if !defined(NO_WCAST_ALIGN) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WCAST_ALIGN.clang)) +. if !defined(NO_WCAST_ALIGN) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WCAST_ALIGN.clang)) CWARNFLAGS += -Wcast-align . endif . endif @@ -59,7 +59,7 @@ CWARNFLAGS += -Wno-uninitialized CWARNFLAGS += -Wno-pointer-sign # Clang has more warnings enabled by default, and when using -Wall, so if WARNS # is set to low values, these have to be disabled explicitly. -. if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" +. if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no") . if ${WARNS} <= 3 CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value\ -Wno-parentheses-equality -Wno-unused-function\ @@ -84,12 +84,12 @@ WFORMAT = 1 . if ${WFORMAT} > 0 #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS += -Wformat=2 -Wno-format-extra-args -. if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang)) +. if !defined(NO_WERROR) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WERROR.clang)) CWARNFLAGS += -Werror . endif . endif . endif -. if defined(NO_WFORMAT) || ((${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && defined(NO_WFORMAT.clang)) +. if defined(NO_WFORMAT) || ((${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no")) && defined(NO_WFORMAT.clang)) CWARNFLAGS += -Wno-format . endif .endif @@ -98,7 +98,7 @@ CWARNFLAGS += -Wno-format CWARNFLAGS += -Wno-unknown-pragmas .endif -.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" +.if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no") CLANG_NO_IAS = -no-integrated-as CLANG_OPT_SMALL = -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \ -mllvm -enable-load-pre=false Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Sat Mar 3 18:08:57 2012 (r232472) +++ head/sys/conf/kern.mk Sat Mar 3 18:58:15 2012 (r232473) @@ -15,7 +15,7 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # Disable a few warnings for clang, since there are several places in the # kernel where fixing them is more trouble than it is worth, or where there is # a false positive. -.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" +.if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no") NO_WCONSTANT_CONVERSION= -Wno-constant-conversion NO_WARRAY_BOUNDS= -Wno-array-bounds NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative @@ -50,7 +50,7 @@ CWARNEXTRA?= -Wno-error-tautological-com # -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 # .if ${MACHINE_CPUARCH} == "i386" -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" +.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse .else CFLAGS+= -mno-aes -mno-avx @@ -98,7 +98,7 @@ INLINE_LIMIT?= 15000 # (-mfpmath= is not supported) # .if ${MACHINE_CPUARCH} == "amd64" -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" +.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") CFLAGS+= -mno-sse .else CFLAGS+= -mno-aes -mno-avx Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Sat Mar 3 18:08:57 2012 (r232472) +++ head/sys/conf/kern.pre.mk Sat Mar 3 18:58:15 2012 (r232473) @@ -34,7 +34,7 @@ _MINUS_O= -O2 .endif .endif .if ${MACHINE_CPUARCH} == "amd64" -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" +.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") COPTFLAGS?=-O2 -frename-registers -pipe .else COPTFLAGS?=-O2 -pipe @@ -84,7 +84,7 @@ INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS} CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" +.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} .if ${MACHINE_CPUARCH} != "mips" CFLAGS+= --param inline-unit-growth=100 Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Sat Mar 3 18:08:57 2012 (r232472) +++ head/sys/conf/kmod.mk Sat Mar 3 18:58:15 2012 (r232473) @@ -108,7 +108,7 @@ CFLAGS+= -I. -I@ # for example. CFLAGS+= -I@/contrib/altq -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" +.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") CFLAGS+= -finline-limit=${INLINE_LIMIT} CFLAGS+= --param inline-unit-growth=100 CFLAGS+= --param large-function-growth=1000 From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 20:03:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 71C341065672; Sat, 3 Mar 2012 20:03:12 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id DD16414FBE2; Sat, 3 Mar 2012 20:03:04 +0000 (UTC) Message-ID: <4F5278F8.2020109@FreeBSD.org> Date: Sat, 03 Mar 2012 12:03:04 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120224 Thunderbird/10.0.2 MIME-Version: 1.0 To: Dimitry Andric References: <201203031858.q23IwGvG096048@svn.freebsd.org> In-Reply-To: <201203031858.q23IwGvG096048@svn.freebsd.org> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 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: r232473 - in head: share/mk 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: Sat, 03 Mar 2012 20:03:12 -0000 On 03/03/2012 10:58, Dimitry Andric wrote: > However, since it is apparently an expected use case to build using old > .mk files, Expected how? It shouldn't happen if you're building in /usr/src. Wouldn't it be better to track down the real bug? -- This .signature sanitized for your protection From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 20:05:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 509AD1065670; Sat, 3 Mar 2012 20:05:49 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id E51278FC14; Sat, 3 Mar 2012 20:05:48 +0000 (UTC) Received: by obbwc7 with SMTP id wc7so4360909obb.13 for ; Sat, 03 Mar 2012 12:05:48 -0800 (PST) Received-SPF: pass (google.com: domain of minimarmot@gmail.com designates 10.60.4.71 as permitted sender) client-ip=10.60.4.71; Authentication-Results: mr.google.com; spf=pass (google.com: domain of minimarmot@gmail.com designates 10.60.4.71 as permitted sender) smtp.mail=minimarmot@gmail.com; dkim=pass header.i=minimarmot@gmail.com Received: from mr.google.com ([10.60.4.71]) by 10.60.4.71 with SMTP id i7mr5639012oei.39.1330805148429 (num_hops = 1); Sat, 03 Mar 2012 12:05:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=QuH9cGHfUliQ8sktco16u23gsCYBk2h8dL1pHUhKJ4s=; b=rYUjehY50+BJpLSUVEuiLbi/U1fuUZ49ZQhgeDLqbWyDHDO/AN06qD7CZIW221IpbG h+dqb/ZmI1+2UhSgnnkQh1muhEWzVP1wKH9+nMzJAcznl7D6TRSQr0dEsZ07aqMYa/SY 8B0cTXUe/XQR5owmzXev0b5SOMX35ooUJJW0PA/GwlWiK7f4fl0pHEAHOdnE7vwQNvtw RIZJiuWXEPY0lCI2664a0EdGgsfWaCAF2ITZaTohNCFbIKQBbz+lIMVzMYiSCvPv/dtn XOK1PPuEcJoKburRUuyVIXilR92/CULePMN+WHT0Dp74bcmItOKdS9bNMYEr49IzSkby zvOQ== MIME-Version: 1.0 Received: by 10.60.4.71 with SMTP id i7mr4913943oei.39.1330805148365; Sat, 03 Mar 2012 12:05:48 -0800 (PST) Received: by 10.182.79.6 with HTTP; Sat, 3 Mar 2012 12:05:48 -0800 (PST) In-Reply-To: <4F5278F8.2020109@FreeBSD.org> References: <201203031858.q23IwGvG096048@svn.freebsd.org> <4F5278F8.2020109@FreeBSD.org> Date: Sat, 3 Mar 2012 15:05:48 -0500 Message-ID: From: Ben Kaduk To: Doug Barton 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, Dimitry Andric Subject: Re: svn commit: r232473 - in head: share/mk 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: Sat, 03 Mar 2012 20:05:49 -0000 On Sat, Mar 3, 2012 at 3:03 PM, Doug Barton wrote: > On 03/03/2012 10:58, Dimitry Andric wrote: >> However, since it is apparently an expected use case to build using old >> =A0 .mk files, > > Expected how? It shouldn't happen if you're building in /usr/src. > Wouldn't it be better to track down the real bug? I, for one, am frequently building in /usr/ports. I have not checked, but I could very easily see that pulling the system .mk files from the installed locations and not the source tree. -Ben From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 20:12:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 09616106564A; Sat, 3 Mar 2012 20:12:04 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id A5CF41534F6; Sat, 3 Mar 2012 20:12:03 +0000 (UTC) Message-ID: <4F527B13.4030607@FreeBSD.org> Date: Sat, 03 Mar 2012 12:12:03 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120224 Thunderbird/10.0.2 MIME-Version: 1.0 To: Ben Kaduk References: <201203031858.q23IwGvG096048@svn.freebsd.org> <4F5278F8.2020109@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 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, Dimitry Andric Subject: Re: svn commit: r232473 - in head: share/mk 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: Sat, 03 Mar 2012 20:12:04 -0000 On 03/03/2012 12:05, Ben Kaduk wrote: > On Sat, Mar 3, 2012 at 3:03 PM, Doug Barton wrote: >> On 03/03/2012 10:58, Dimitry Andric wrote: >>> However, since it is apparently an expected use case to build using old >>> .mk files, >> >> Expected how? It shouldn't happen if you're building in /usr/src. >> Wouldn't it be better to track down the real bug? > > I, for one, am frequently building in /usr/ports. I have not checked, > but I could very easily see that pulling the system .mk files from the > installed locations and not the source tree. Building ports where the sources and the installed kernel differ is not a supported configuration. The fact that it happens to work most of the time is a bonus. This is a very dangerous precedent to set. -- This .signature sanitized for your protection From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 20:33:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B83E7106564A; Sat, 3 Mar 2012 20:33:40 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 613028FC0A; Sat, 3 Mar 2012 20:33:40 +0000 (UTC) Received: by iahk25 with SMTP id k25so5081651iah.13 for ; Sat, 03 Mar 2012 12:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=DM2ST+pQmLSmkf2F/rLVjsCgb2AoNYoXirZgyg34Uo8=; b=CkKinnoMBCg5YXV2j0NU5a8kgCKBFI5X4KHJLG6vDjSNWTePUTDOJoSg2RLWuVT0an /EZSPXuwjY6jrAL2zoUKg+/sb+5TlkkMmBNr6Lg5MXduGYCVsbrfOBjXf/fXVDLSqoTG 1xvythcRC/kyaeSrqsOVF7r/PPmvQuE6P+dkxgccm9TCxKGU+0FeD/A/rq4YeA8m3Yqy yXtAUh9+t9BJueqPabb1ns+54uTR2r41azm9dZMDS4covbpwpOfRYq0Hk9xwMdvaIUdH F/wXppX29nGNo3Jw9jgynib3EfpFD4N5wxCgeJGba86jcsZ5G2GPvJObSSOE5enVY+qf krQg== Received: by 10.50.178.38 with SMTP id cv6mr2088808igc.1.1330805239674; Sat, 03 Mar 2012 12:07:19 -0800 (PST) MIME-Version: 1.0 Sender: utisoft@gmail.com Received: by 10.231.53.67 with HTTP; Sat, 3 Mar 2012 12:06:49 -0800 (PST) In-Reply-To: <4F5278F8.2020109@FreeBSD.org> References: <201203031858.q23IwGvG096048@svn.freebsd.org> <4F5278F8.2020109@FreeBSD.org> From: Chris Rees Date: Sat, 3 Mar 2012 20:06:49 +0000 X-Google-Sender-Auth: rh8njjQBOvtvc73AujqvIUy06jo Message-ID: To: Doug Barton 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, Dimitry Andric Subject: Re: svn commit: r232473 - in head: share/mk 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: Sat, 03 Mar 2012 20:33:40 -0000 On 3 March 2012 20:03, Doug Barton wrote: > On 03/03/2012 10:58, Dimitry Andric wrote: >> However, since it is apparently an expected use case to build using old >> =A0 .mk files, > > Expected how? It shouldn't happen if you're building in /usr/src. > Wouldn't it be better to track down the real bug? What? /usr/share/mk is used for everything-- no matter what tree you're in= . If you're going down that road, might as well use ${PORTSDIR}/Mk for the ports tree too.... Chris From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 21:37:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A43E1065675; Sat, 3 Mar 2012 21:37:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 101568FC1B; Sat, 3 Mar 2012 21:37:37 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:d0fa:b5e9:395b:990e] (unknown [IPv6:2001:7b8:3a7:0:d0fa:b5e9:395b:990e]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 515F65C37; Sat, 3 Mar 2012 22:37:36 +0100 (CET) Message-ID: <4F528F24.5040909@FreeBSD.org> Date: Sat, 03 Mar 2012 22:37:40 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120216 Thunderbird/11.0 MIME-Version: 1.0 To: Doug Barton References: <201203031858.q23IwGvG096048@svn.freebsd.org> <4F5278F8.2020109@FreeBSD.org> In-Reply-To: <4F5278F8.2020109@FreeBSD.org> X-Enigmail-Version: 1.4a1pre 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: r232473 - in head: share/mk 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: Sat, 03 Mar 2012 21:37:37 -0000 On 2012-03-03 21:03, Doug Barton wrote: > On 03/03/2012 10:58, Dimitry Andric wrote: >> However, since it is apparently an expected use case to build using old >> .mk files, > > Expected how? It shouldn't happen if you're building in /usr/src. No, but it apparently happens if you build kernel modules separately, or via ports. Or if you build kernel modules for head from older branches. > Wouldn't it be better to track down the real bug? Obviously that would be better, but I received several private messages from people that were annoyed that I "broke" their kernel module builds, and expected me to fix it. There was also at least one such posting on freebsd-current@, where somebody's nvidia-driver port fell over due to my change. I did think about adding a fatal error message to each of the kern.mk files that includes bsd.own.mk, but you can't really do a full sanity check until you add some sort of version number to the bsd.*.mk files. From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 21:39:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9C191065672; Sat, 3 Mar 2012 21:39:12 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4DE98FC1D; Sat, 3 Mar 2012 21:39:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23LdCax001085; Sat, 3 Mar 2012 21:39:12 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23LdCoI001083; Sat, 3 Mar 2012 21:39:12 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201203032139.q23LdCoI001083@svn.freebsd.org> From: Juli Mallett Date: Sat, 3 Mar 2012 21:39: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: r232475 - head/sys/compat/freebsd32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Mar 2012 21:39:13 -0000 Author: jmallett Date: Sat Mar 3 21:39:12 2012 New Revision: 232475 URL: http://svn.freebsd.org/changeset/base/232475 Log: On MIPS, _ALIGN always aligns to 8 bytes, even for 32-bit binaries. This might not be ideal, but is the ABI we've shipped so far. Fix macros which reflect the results of _ALIGN on 32-bit MIPS to use the right alignment. This fixes sendmsg under COMPAT_FREEBSD32 on n64 MIPS kernels. Modified: head/sys/compat/freebsd32/freebsd32_misc.c Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sat Mar 3 19:03:26 2012 (r232474) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sat Mar 3 21:39:12 2012 (r232475) @@ -952,7 +952,11 @@ freebsd32_copyoutmsghdr(struct msghdr *m return (error); } +#ifndef __mips__ #define FREEBSD32_ALIGNBYTES (sizeof(int) - 1) +#else +#define FREEBSD32_ALIGNBYTES (sizeof(long) - 1) +#endif #define FREEBSD32_ALIGN(p) \ (((u_long)(p) + FREEBSD32_ALIGNBYTES) & ~FREEBSD32_ALIGNBYTES) #define FREEBSD32_CMSG_SPACE(l) \ From owner-svn-src-all@FreeBSD.ORG Sat Mar 3 23:49:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93510106566B; Sat, 3 Mar 2012 23:49:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D8BB8FC25; Sat, 3 Mar 2012 23:49:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q23Nnrca005360; Sat, 3 Mar 2012 23:49:53 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q23NnrIb005355; Sat, 3 Mar 2012 23:49:53 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203032349.q23NnrIb005355@svn.freebsd.org> From: Dimitry Andric Date: Sat, 3 Mar 2012 23:49: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: r232476 - in head: share/mk 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: Sat, 03 Mar 2012 23:49:53 -0000 Author: dim Date: Sat Mar 3 23:49:53 2012 New Revision: 232476 URL: http://svn.freebsd.org/changeset/base/232476 Log: Revert r232473. I have been convinced by Doug Barton and Bjoern Zeeb that it is better to error out when people attempt to build using the wrong bsd.*.mk files, than to silently ignore the problem. This means, that after this commit, if you want to build kernel modules by hand (or via a port) from a head source tree, you *must* make sure the files in /usr/share/mk are in sync with that tree. If that isn't possible, for example when you are running on an older FreeBSD branch, you can: - Run "make buildenv" from your head source tree, to have the correct environment setup. (It's advisable to have run "make buildworld", or at a minimum "make toolchain" first.) - Alternatively, set MAKESYSPATH to the share/mk directory under your head source tree. If your build tools are too old, other problems may still occur. - Alternatively, use "make -m" and specify the share/mk directory under your head source tree. Again, build tools that are too old may still result in trouble. MFC after: 2 weeks Modified: head/share/mk/bsd.sys.mk head/sys/conf/kern.mk head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Sat Mar 3 21:39:12 2012 (r232475) +++ head/share/mk/bsd.sys.mk Sat Mar 3 23:49:53 2012 (r232476) @@ -28,7 +28,7 @@ CFLAGS += -std=${CSTD} . if defined(WARNS) . if ${WARNS} >= 1 CWARNFLAGS += -Wsystem-headers -. if !defined(NO_WERROR) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WERROR.clang)) +. if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang)) CWARNFLAGS += -Werror . endif . endif @@ -42,7 +42,7 @@ CWARNFLAGS += -W -Wno-unused-parameter - . if ${WARNS} >= 4 CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\ -Wshadow -Wunused-parameter -. if !defined(NO_WCAST_ALIGN) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WCAST_ALIGN.clang)) +. if !defined(NO_WCAST_ALIGN) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WCAST_ALIGN.clang)) CWARNFLAGS += -Wcast-align . endif . endif @@ -59,7 +59,7 @@ CWARNFLAGS += -Wno-uninitialized CWARNFLAGS += -Wno-pointer-sign # Clang has more warnings enabled by default, and when using -Wall, so if WARNS # is set to low values, these have to be disabled explicitly. -. if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no") +. if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" . if ${WARNS} <= 3 CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value\ -Wno-parentheses-equality -Wno-unused-function\ @@ -84,12 +84,12 @@ WFORMAT = 1 . if ${WFORMAT} > 0 #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS += -Wformat=2 -Wno-format-extra-args -. if !defined(NO_WERROR) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WERROR.clang)) +. if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang)) CWARNFLAGS += -Werror . endif . endif . endif -. if defined(NO_WFORMAT) || ((${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no")) && defined(NO_WFORMAT.clang)) +. if defined(NO_WFORMAT) || ((${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && defined(NO_WFORMAT.clang)) CWARNFLAGS += -Wno-format . endif .endif @@ -98,7 +98,7 @@ CWARNFLAGS += -Wno-format CWARNFLAGS += -Wno-unknown-pragmas .endif -.if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no") +.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" CLANG_NO_IAS = -no-integrated-as CLANG_OPT_SMALL = -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \ -mllvm -enable-load-pre=false Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Sat Mar 3 21:39:12 2012 (r232475) +++ head/sys/conf/kern.mk Sat Mar 3 23:49:53 2012 (r232476) @@ -15,7 +15,7 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # Disable a few warnings for clang, since there are several places in the # kernel where fixing them is more trouble than it is worth, or where there is # a false positive. -.if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no") +.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" NO_WCONSTANT_CONVERSION= -Wno-constant-conversion NO_WARRAY_BOUNDS= -Wno-array-bounds NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative @@ -50,7 +50,7 @@ CWARNEXTRA?= -Wno-error-tautological-com # -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 # .if ${MACHINE_CPUARCH} == "i386" -.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") +.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse .else CFLAGS+= -mno-aes -mno-avx @@ -98,7 +98,7 @@ INLINE_LIMIT?= 15000 # (-mfpmath= is not supported) # .if ${MACHINE_CPUARCH} == "amd64" -.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") +.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" CFLAGS+= -mno-sse .else CFLAGS+= -mno-aes -mno-avx Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Sat Mar 3 21:39:12 2012 (r232475) +++ head/sys/conf/kern.pre.mk Sat Mar 3 23:49:53 2012 (r232476) @@ -34,7 +34,7 @@ _MINUS_O= -O2 .endif .endif .if ${MACHINE_CPUARCH} == "amd64" -.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") +.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" COPTFLAGS?=-O2 -frename-registers -pipe .else COPTFLAGS?=-O2 -pipe @@ -84,7 +84,7 @@ INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS} CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") +.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} .if ${MACHINE_CPUARCH} != "mips" CFLAGS+= --param inline-unit-growth=100 Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Sat Mar 3 21:39:12 2012 (r232475) +++ head/sys/conf/kmod.mk Sat Mar 3 23:49:53 2012 (r232476) @@ -108,7 +108,7 @@ CFLAGS+= -I. -I@ # for example. CFLAGS+= -I@/contrib/altq -.if ${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no") +.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" CFLAGS+= -finline-limit=${INLINE_LIMIT} CFLAGS+= --param inline-unit-growth=100 CFLAGS+= --param large-function-growth=1000