From owner-svn-src-stable-9@FreeBSD.ORG Sun Apr 28 00:56:54 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9081695D for ; Sun, 28 Apr 2013 00:56:54 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-ve0-x22b.google.com (mail-ve0-x22b.google.com [IPv6:2607:f8b0:400c:c01::22b]) by mx1.freebsd.org (Postfix) with ESMTP id 50BF8112B for ; Sun, 28 Apr 2013 00:56:54 +0000 (UTC) Received: by mail-ve0-f171.google.com with SMTP id oy12so939316veb.30 for ; Sat, 27 Apr 2013 17:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=KIkNG3DUWlF1GdSG332L3ITUH7jLZFTRyumInk9lhEY=; b=Y8XZP4Tm8PrlcIEpcjK8iLAs65ssKBAOklvTkaCzspGocYZsnY+g3TpFvaZ6xDoJHg A3uEHRjRsRENoDHhLk1FhTvk9p2X4oUrFMGnKpTF2o17fWl7S1XQfCdgE5vX9T40rqSP jQ9GZBtmsYTRGFRs4YQ9VGF2PXLEB0tq6xjTg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=KIkNG3DUWlF1GdSG332L3ITUH7jLZFTRyumInk9lhEY=; b=YhfSByw5626uh7raBSlu47LsQPtvHqPFbZJiBICJmWWLWJHGUWkvckdgb0zlU5OIwn kw7o6CTXEBLhqGEH47dRyd+x5ShZ8/c8/M4xBRz+Ch3M5SINg9qu6o+x+qg+e9XvW+gn 60+kRDhc8u2VCtPIvBAE5f0PEMxZpm+KhiSqvutRh8wTC0heNg+5I0VtBzMZJyiJLWPX gNxc+cLGhiykHQIhRbEgTtVS0yUsJO5UDNTQLLqbXtQIwJ1AZg8Y+q7yInCuhbOtLwzp p5M8GYicbp+lbQNT5AWLUi8xZsMizwpMShwBGqhqZr3lEWJOQ/iDUy4CVN+qa+TwVabK FJuQ== MIME-Version: 1.0 X-Received: by 10.58.173.36 with SMTP id bh4mr17292109vec.9.1367110613222; Sat, 27 Apr 2013 17:56:53 -0700 (PDT) Received: by 10.220.215.70 with HTTP; Sat, 27 Apr 2013 17:56:53 -0700 (PDT) In-Reply-To: <517AC0BB.4040207@FreeBSD.org> References: <201304180944.r3I9i05t093967@svn.freebsd.org> <517AC0BB.4040207@FreeBSD.org> Date: Sat, 27 Apr 2013 17:56:53 -0700 Message-ID: Subject: Re: svn commit: r249611 - in stable/9/sys/cam: ata scsi From: Peter Wemm To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQluoJvsLCJtxacM4lb5dtOxpTe4dQWC94cyiQHGodLyrd4DnzDzrr0rERi08PLEOCDc6j15 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Apr 2013 00:56:54 -0000 On Fri, Apr 26, 2013 at 11:00 AM, Alexander Motin wrote: > On 26.04.2013 19:47, Peter Wemm wrote: >> >> On Thu, Apr 18, 2013 at 2:44 AM, Alexander Motin wrote: >>> >>> Author: mav >>> Date: Thu Apr 18 09:44:00 2013 >>> New Revision: 249611 >>> URL: http://svnweb.freebsd.org/changeset/base/249611 [..] >> This breaks a number of machines in the freebsd.org cluster. I have >> to back out both of these changes to get them to reboot. > > > I've made a search though the base system and found only two drivers > affected by this change: mpt and hptmv. I've patched both at head r249849 > and going to merge fix to stable/9 tomorrow unless objected. Have you tried > that patch instead of reverting? I'm testing this on ns1.freebsd.org and ns2.freebsd.org as we speak. If the cluster goes dark, that's why :) -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV From owner-svn-src-stable-9@FreeBSD.ORG Sun Apr 28 07:48:53 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D3E2EB3A; Sun, 28 Apr 2013 07:48:53 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C520C1C4D; Sun, 28 Apr 2013 07:48:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3S7mrEA088962; Sun, 28 Apr 2013 07:48:53 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3S7mr3f088961; Sun, 28 Apr 2013 07:48:53 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201304280748.r3S7mr3f088961@svn.freebsd.org> From: Martin Matuska Date: Sun, 28 Apr 2013 07:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250016 - stable/9/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Apr 2013 07:48:53 -0000 Author: mm Date: Sun Apr 28 07:48:53 2013 New Revision: 250016 URL: http://svnweb.freebsd.org/changeset/base/250016 Log: MFC r249883: Respect the enoent_ok flag if reporting error for holding an non-existing snapshot. Related illumos ZFS issue: 3699 zfs hold or release of a non-existent snapshot does not output error Reported by: Steven Hartland Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Apr 28 07:00:36 2013 (r250015) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Apr 28 07:48:53 2013 (r250016) @@ -4207,10 +4207,13 @@ zfs_hold(zfs_handle_t *zhp, const char * if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) { fnvlist_free(ha.nvl); ret = ENOENT; - (void) snprintf(errbuf, sizeof (errbuf), - dgettext(TEXT_DOMAIN, "cannot hold snapshot '%s@%s'"), - zhp->zfs_name, snapname); - (void) zfs_standard_error(hdl, ret, errbuf); + if (!enoent_ok) { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot hold snapshot '%s@%s'"), + zhp->zfs_name, snapname); + (void) zfs_standard_error(hdl, ret, errbuf); + } return (ret); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 01:29:28 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4CFC9DDA for ; Mon, 29 Apr 2013 01:29:28 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx1.freebsd.org (Postfix) with ESMTP id DFBF11E3C for ; Mon, 29 Apr 2013 01:29:27 +0000 (UTC) Received: by mail-vc0-f180.google.com with SMTP id m17so4999945vca.25 for ; Sun, 28 Apr 2013 18:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=QhpKI9EI3Xtqy3fAEd4KiUyWcwflazCJ7kdAzDBDXLE=; b=MS8NqpayjPYH71Z9wwqCOZPJlLFxTCao2c5/50QibUy+Levr2tL3TVohfZrf4x9hUH ftE3jqrPFYznp72o5+8ySRSzTOFdOqAg333R1LLFDul0znI686VXaL0ulkwN7ysLFmXd kldkgCl5LOxuYYjGaac9Wz6SXdIyUhQ8bjjTM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=QhpKI9EI3Xtqy3fAEd4KiUyWcwflazCJ7kdAzDBDXLE=; b=HB2giYI85XTqxijtmiWn8cx5bwqbVgHCBz/pnCw24lOildhvsBrFhF8Mv1p/+iTMdV NomaZbtgD4fBBB8MC1PFsGYmTc6hxji8HLZAEZUnmclAkFQ7CrczCAKIfZO8Uhu179u6 wvayMXp1223mc3hX9v4xzJ9NjqougGIcRrAaBQYmJD5IaqoTpF2WqVIj71dCYE2RI4EE /FEJO0FrCGnsd+Egzq+sX5XM/KZiKj2MkYdhT7MhPPWGqZ0u0zXyrLT4MMApxkI6e55F /0hq4z8kRv6B+1G/G3DkWJ7gyl02fOPhrDAYu+vh6jt/g3jd/QJVKzIfmwod4MHsEJSt yybw== MIME-Version: 1.0 X-Received: by 10.220.169.78 with SMTP id x14mr17435796vcy.41.1367198961184; Sun, 28 Apr 2013 18:29:21 -0700 (PDT) Received: by 10.220.215.70 with HTTP; Sun, 28 Apr 2013 18:29:21 -0700 (PDT) In-Reply-To: References: <201304180944.r3I9i05t093967@svn.freebsd.org> <517AC0BB.4040207@FreeBSD.org> Date: Sun, 28 Apr 2013 18:29:21 -0700 Message-ID: Subject: Re: svn commit: r249611 - in stable/9/sys/cam: ata scsi From: Peter Wemm To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkH3jY++X/wCaVImVw9XdVTSKlXb5JItUZlRdlQBPQbdGlYHPDtdwsBXIZzQkehm4n0rPl9 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 01:29:28 -0000 On Sat, Apr 27, 2013 at 5:56 PM, Peter Wemm wrote: > On Fri, Apr 26, 2013 at 11:00 AM, Alexander Motin wrote: >> On 26.04.2013 19:47, Peter Wemm wrote: >>> >>> On Thu, Apr 18, 2013 at 2:44 AM, Alexander Motin wrote: >>>> >>>> Author: mav >>>> Date: Thu Apr 18 09:44:00 2013 >>>> New Revision: 249611 >>>> URL: http://svnweb.freebsd.org/changeset/base/249611 > [..] >>> This breaks a number of machines in the freebsd.org cluster. I have >>> to back out both of these changes to get them to reboot. >> >> >> I've made a search though the base system and found only two drivers >> affected by this change: mpt and hptmv. I've patched both at head r249849 >> and going to merge fix to stable/9 tomorrow unless objected. Have you tried >> that patch instead of reverting? > > I'm testing this on ns1.freebsd.org and ns2.freebsd.org as we speak. > If the cluster goes dark, that's why :) The machines have survived multiple reboots with > r249849. I do wonder if perhaps "post_sync" isn't the ideal name. Perhaps add a "quiesce_hardware" eventhandler chain and make it clear that this is the hook for what things like mpt were doing. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 04:38:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1EC6CEB8; Mon, 29 Apr 2013 04:38:44 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0DE051283; Mon, 29 Apr 2013 04:38:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3T4cilP029962; Mon, 29 Apr 2013 04:38:44 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3T4chWt029958; Mon, 29 Apr 2013 04:38:43 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201304290438.r3T4chWt029958@svn.freebsd.org> From: Hiren Panchasara Date: Mon, 29 Apr 2013 04:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250038 - stable/9/sys/dev/hwpmc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 04:38:44 -0000 Author: hiren Date: Mon Apr 29 04:38:43 2013 New Revision: 250038 URL: http://svnweb.freebsd.org/changeset/base/250038 Log: MFC: r249069 Trailing whitespace cleanup along with 80 column enforcemnt. MFC: r249428 Cosmetic change: Fix a comment reference for Ivy Bridge *Xeon* MFC: r249460 Improve/correct a comment. We now support a lot more cpu types. Approved by: sbruno (mentor) Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c stable/9/sys/dev/hwpmc/hwpmc_intel.c stable/9/sys/dev/hwpmc/hwpmc_uncore.c stable/9/sys/dev/hwpmc/pmc_events.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_core.c Sun Apr 28 22:52:43 2013 (r250037) +++ stable/9/sys/dev/hwpmc/hwpmc_core.c Mon Apr 29 04:38:43 2013 (r250038) @@ -25,7 +25,7 @@ */ /* - * Intel Core, Core 2 and Atom PMCs. + * Intel Core PMCs. */ #include @@ -560,7 +560,7 @@ struct iap_event_descr { #define IAP_F_SB (1 << 6) /* CPU: Sandy Bridge */ #define IAP_F_IB (1 << 7) /* CPU: Ivy Bridge */ #define IAP_F_SBX (1 << 8) /* CPU: Sandy Bridge Xeon */ -#define IAP_F_IBX (1 << 9) /* CPU: Ivy Bridge */ +#define IAP_F_IBX (1 << 9) /* CPU: Ivy Bridge Xeon */ #define IAP_F_HW (1 << 10) /* CPU: Haswell */ #define IAP_F_FM (1 << 11) /* Fixed mask */ @@ -604,7 +604,7 @@ static struct iap_event_descr iap_events IAPDESCR(03H_00H, 0x03, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(03H_01H, 0x03, 0x01, IAP_F_FM | IAP_F_I7O | IAP_F_SB | IAP_F_SBX), - IAPDESCR(03H_02H, 0x03, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | + IAPDESCR(03H_02H, 0x03, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(03H_04H, 0x03, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7O), IAPDESCR(03H_08H, 0x03, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_SB | @@ -622,8 +622,8 @@ static struct iap_event_descr iap_events IAPDESCR(05H_00H, 0x05, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(05H_01H, 0x05, 0x01, IAP_F_FM | IAP_F_I7O | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), - IAPDESCR(05H_02H, 0x05, 0x02, IAP_F_FM | IAP_F_I7O | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAPDESCR(05H_02H, 0x05, 0x02, IAP_F_FM | IAP_F_I7O | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(05H_03H, 0x05, 0x03, IAP_F_FM | IAP_F_I7O), IAPDESCR(06H_00H, 0x06, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CC2 | @@ -635,7 +635,7 @@ static struct iap_event_descr iap_events IAPDESCR(06H_0FH, 0x06, 0x0F, IAP_F_FM | IAP_F_I7O), IAPDESCR(07H_00H, 0x07, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CC2), - IAPDESCR(07H_01H, 0x07, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | + IAPDESCR(07H_01H, 0x07, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(07H_02H, 0x07, 0x02, IAP_F_FM | IAP_F_ALLCPUSCORE2), @@ -683,8 +683,8 @@ static struct iap_event_descr iap_events IAPDESCR(0DH_03H, 0x0D, 0x03, IAP_F_FM | IAP_F_SB | IAP_F_SBX | IAP_F_HW), IAPDESCR(0DH_40H, 0x0D, 0x40, IAP_F_FM | IAP_F_SB | IAP_F_SBX), - IAPDESCR(0EH_01H, 0x0E, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAPDESCR(0EH_01H, 0x0E, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(0EH_02H, 0x0E, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(0EH_10H, 0x0E, 0x10, IAP_F_FM | IAP_F_IB | IAP_F_IBX | IAP_F_HW), IAPDESCR(0EH_20H, 0x0E, 0x20, IAP_F_FM | IAP_F_IB | IAP_F_IBX | IAP_F_HW), @@ -698,7 +698,7 @@ static struct iap_event_descr iap_events IAPDESCR(0FH_80H, 0x0F, 0x80, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(10H_00H, 0x10, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), - IAPDESCR(10H_01H, 0x10, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7 | + IAPDESCR(10H_01H, 0x10, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_SBX), IAPDESCR(10H_02H, 0x10, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(10H_04H, 0x10, 0x04, IAP_F_FM | IAP_F_I7 | IAP_F_WM), @@ -737,7 +737,7 @@ static struct iap_event_descr iap_events IAPDESCR(13H_81H, 0x13, 0x81, IAP_F_FM | IAP_F_CA), IAPDESCR(14H_00H, 0x14, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CC2), - IAPDESCR(14H_01H, 0x14, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7 | + IAPDESCR(14H_01H, 0x14, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(14H_02H, 0x14, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM), @@ -764,37 +764,37 @@ static struct iap_event_descr iap_events IAPDESCR(23H, 0x23, IAP_M_CORE, IAP_F_ALLCPUSCORE2), IAPDESCR(24H, 0x24, IAP_M_CORE | IAP_M_PREFETCH, IAP_F_ALLCPUSCORE2), - IAPDESCR(24H_01H, 0x24, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_01H, 0x24, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(24H_02H, 0x24, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM), - IAPDESCR(24H_03H, 0x24, 0x03, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), - IAPDESCR(24H_04H, 0x24, 0x04, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), - IAPDESCR(24H_08H, 0x24, 0x08, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), - IAPDESCR(24H_0CH, 0x24, 0x0C, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), - IAPDESCR(24H_10H, 0x24, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), - IAPDESCR(24H_20H, 0x24, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_03H, 0x24, 0x03, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_04H, 0x24, 0x04, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_08H, 0x24, 0x08, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_0CH, 0x24, 0x0C, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_10H, 0x24, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_20H, 0x24, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(24H_21H, 0x24, 0x21, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_22H, 0x24, 0x22, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_24H, 0x24, 0x24, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_27H, 0x24, 0x27, IAP_F_FM | IAP_F_HW), - IAPDESCR(24H_30H, 0x24, 0x30, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX | IAP_F_HW), - IAPDESCR(24H_40H, 0x24, 0x40, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_30H, 0x24, 0x30, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAPDESCR(24H_40H, 0x24, 0x40, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(24H_41H, 0x24, 0x41, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_42H, 0x24, 0x42, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_44H, 0x24, 0x44, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_50H, 0x24, 0x50, IAP_F_FM | IAP_F_HW), - IAPDESCR(24H_80H, 0x24, 0x80, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), - IAPDESCR(24H_C0H, 0x24, 0xC0, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_80H, 0x24, 0x80, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(24H_C0H, 0x24, 0xC0, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(24H_E1H, 0x24, 0xE1, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_E2H, 0x24, 0xE2, IAP_F_FM | IAP_F_HW), IAPDESCR(24H_E4H, 0x24, 0xE4, IAP_F_FM | IAP_F_HW), @@ -820,16 +820,16 @@ static struct iap_event_descr iap_events IAPDESCR(26H_FFH, 0x26, 0xFF, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(27H, 0x27, IAP_M_CORE | IAP_M_PREFETCH, IAP_F_ALLCPUSCORE2), - IAPDESCR(27H_01H, 0x27, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAPDESCR(27H_01H, 0x27, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(27H_02H, 0x27, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(27H_04H, 0x27, 0x04, IAP_F_FM | IAP_F_I7O | IAP_F_SB | IAP_F_SBX), - IAPDESCR(27H_08H, 0x27, 0x08, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAPDESCR(27H_08H, 0x27, 0x08, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(27H_0EH, 0x27, 0x0E, IAP_F_FM | IAP_F_I7 | IAP_F_WM), - IAPDESCR(27H_0FH, 0x27, 0x0F, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAPDESCR(27H_0FH, 0x27, 0x0F, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(27H_10H, 0x27, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(27H_20H, 0x27, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(27H_40H, 0x27, 0x40, IAP_F_FM | IAP_F_I7 | IAP_F_WM), @@ -839,15 +839,15 @@ static struct iap_event_descr iap_events IAPDESCR(27H_F0H, 0x27, 0xF0, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(28H, 0x28, IAP_M_CORE | IAP_M_MESI, IAP_F_ALLCPUSCORE2), - IAPDESCR(28H_01H, 0x28, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_IB | IAP_F_SBX | - IAP_F_IBX), - IAPDESCR(28H_02H, 0x28, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SBX), - IAPDESCR(28H_04H, 0x28, 0x04, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | + IAPDESCR(28H_01H, 0x28, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_IB | IAP_F_SBX | IAP_F_IBX), - IAPDESCR(28H_08H, 0x28, 0x08, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | + IAPDESCR(28H_02H, 0x28, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SBX), + IAPDESCR(28H_04H, 0x28, 0x04, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(28H_08H, 0x28, 0x08, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | + IAP_F_IB | IAP_F_SBX | IAP_F_IBX), + IAPDESCR(28H_0FH, 0x28, 0x0F, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_IB | IAP_F_SBX | IAP_F_IBX), - IAPDESCR(28H_0FH, 0x28, 0x0F, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_IB | IAP_F_SBX | - IAP_F_IBX), IAPDESCR(29H, 0x29, IAP_M_CORE | IAP_M_MESI, IAP_F_CC), IAPDESCR(29H, 0x29, IAP_M_CORE | IAP_M_MESI | IAP_M_PREFETCH, @@ -875,9 +875,11 @@ static struct iap_event_descr iap_events IAPDESCR(3BH_C0H, 0x3B, 0xC0, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(3CH_00H, 0x3C, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | + IAP_F_HW), IAPDESCR(3CH_01H, 0x3C, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | + IAP_F_HW), IAPDESCR(3CH_02H, 0x3C, 0x02, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(3DH_01H, 0x3D, 0x01, IAP_F_FM | IAP_F_I7O), @@ -924,14 +926,16 @@ static struct iap_event_descr iap_events IAPDESCR(49H_00H, 0x49, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(49H_01H, 0x49, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | + IAP_F_HW), IAPDESCR(49H_02H, 0x49, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | + IAP_F_HW), IAPDESCR(49H_04H, 0x49, 0x04, IAP_F_FM | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(49H_0EH, 0x49, 0x0E, IAP_F_FM | IAP_F_HW), IAPDESCR(49H_10H, 0x49, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM | - IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_HW), IAPDESCR(49H_40H, 0x49, 0x40, IAP_F_FM | IAP_F_I7O | IAP_F_HW), IAPDESCR(49H_60H, 0x49, 0x60, IAP_F_FM | IAP_F_HW), @@ -994,7 +998,7 @@ static struct iap_event_descr iap_events IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(5CH_02H, 0x5C, 0x02, IAP_F_FM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), - + IAPDESCR(5EH_01H, 0x5E, 0x01, IAP_F_FM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), @@ -1079,7 +1083,7 @@ static struct iap_event_descr iap_events IAPDESCR(79H_18H, 0x79, 0x18, IAP_F_FM | IAP_F_IB | IAP_F_IBX | IAP_F_HW), IAPDESCR(79H_24H, 0x79, 0x24, IAP_F_FM | IAP_F_IB | IAP_F_IBX | IAP_F_HW), IAPDESCR(79H_3CH, 0x79, 0x3C, IAP_F_FM | IAP_F_IB | IAP_F_IBX | IAP_F_HW), - + IAPDESCR(7AH, 0x7A, IAP_M_AGENT, IAP_F_CA | IAP_F_CC2), IAPDESCR(7BH, 0x7B, IAP_M_AGENT, IAP_F_CA | IAP_F_CC2), @@ -1198,7 +1202,7 @@ static struct iap_event_descr iap_events IAPDESCR(94H_00H, 0x94, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(9CH_01H, 0x9C, 0x01, IAP_F_FM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX | IAP_F_HW), + IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(97H_00H, 0x97, 0x00, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(98H_00H, 0x98, 0x00, IAP_F_FM | IAP_F_CA | IAP_F_CC2), @@ -1224,7 +1228,7 @@ static struct iap_event_descr iap_events IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(A1H_80H, 0xA1, 0x80, IAP_F_FM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), - + IAPDESCR(A2H_00H, 0xA2, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(A2H_01H, 0xA2, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), @@ -1501,7 +1505,7 @@ static struct iap_event_descr iap_events IAPDESCR(CDH_01H, 0xCD, 0x01, IAP_F_FM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(CDH_02H, 0xCD, 0x02, IAP_F_FM | IAP_F_SB | IAP_F_IB | - IAP_F_SBX | IAP_F_IBX), + IAP_F_SBX | IAP_F_IBX), IAPDESCR(CEH_00H, 0xCE, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(CFH_00H, 0xCF, 0x00, IAP_F_FM | IAP_F_CA | IAP_F_CC2), @@ -1519,7 +1523,7 @@ static struct iap_event_descr iap_events IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(D0H_80H, 0xD0, 0X80, IAP_F_FM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), - + IAPDESCR(D1H_01H, 0xD1, 0x01, IAP_F_FM | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(D1H_02H, 0xD1, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM | @@ -1809,7 +1813,7 @@ iap_event_westmere_ok_on_counter(enum pm case PMC_EV_IAP_EVENT_60H_01H: case PMC_EV_IAP_EVENT_60H_02H: case PMC_EV_IAP_EVENT_60H_04H: - case PMC_EV_IAP_EVENT_60H_08H: + case PMC_EV_IAP_EVENT_60H_08H: case PMC_EV_IAP_EVENT_B3H_01H: case PMC_EV_IAP_EVENT_B3H_02H: case PMC_EV_IAP_EVENT_B3H_04H: @@ -1937,12 +1941,12 @@ iap_allocate_pmc(int cpu, int ri, struct * A small number of events are not supported in all the * processors based on a given microarchitecture. */ - if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); - if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) - return (EINVAL); + if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) + return (EINVAL); } - + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) @@ -1996,10 +2000,10 @@ iap_allocate_pmc(int cpu, int ri, struct case PMC_CPU_INTEL_IVYBRIDGE_XEON: cpuflag = IAP_F_IBX; break; - case PMC_CPU_INTEL_SANDYBRIDGE: + case PMC_CPU_INTEL_SANDYBRIDGE: cpuflag = IAP_F_SB; break; - case PMC_CPU_INTEL_SANDYBRIDGE_XEON: + case PMC_CPU_INTEL_SANDYBRIDGE_XEON: cpuflag = IAP_F_SBX; break; case PMC_CPU_INTEL_WESTMERE: @@ -2459,7 +2463,7 @@ core_intr(int cpu, struct trapframe *tf) if (error) continue; - wrmsr(IAP_EVSEL0 + ri, msr | (pm->pm_md.pm_iap.pm_iap_evsel | + wrmsr(IAP_EVSEL0 + ri, msr | (pm->pm_md.pm_iap.pm_iap_evsel | IAP_EN)); } @@ -2539,8 +2543,8 @@ core2_intr(int cpu, struct trapframe *tf /* Reload sampling count. */ wrmsr(IAF_CTR0 + n, v); - PMCDBG(MDP,INT, 1, "iaf-intr cpu=%d error=%d v=%jx(%jx)", cpu, error, - (uintmax_t) v, (uintmax_t) rdpmc(IAF_RI_TO_MSR(n))); + PMCDBG(MDP,INT, 1, "iaf-intr cpu=%d error=%d v=%jx(%jx)", cpu, + error, (uintmax_t) v, (uintmax_t) rdpmc(IAF_RI_TO_MSR(n))); } /* Modified: stable/9/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_intel.c Sun Apr 28 22:52:43 2013 (r250037) +++ stable/9/sys/dev/hwpmc/hwpmc_intel.c Mon Apr 29 04:38:43 2013 (r250038) @@ -68,7 +68,7 @@ intel_switch_out(struct pmc_cpu *pc, str (uintmax_t) rcr4()); /* always turn off the RDPMC instruction */ - load_cr4(rcr4() & ~CR4_PCE); + load_cr4(rcr4() & ~CR4_PCE); return 0; } @@ -131,8 +131,14 @@ pmc_intel_initialize(void) nclasses = 3; break; case 0x1A: - case 0x1E: /* Per Intel document 253669-032 9/2009, pages A-2 and A-57 */ - case 0x1F: /* Per Intel document 253669-032 9/2009, pages A-2 and A-57 */ + case 0x1E: /* + * Per Intel document 253669-032 9/2009, + * pages A-2 and A-57 + */ + case 0x1F: /* + * Per Intel document 253669-032 9/2009, + * pages A-2 and A-57 + */ case 0x2E: cputype = PMC_CPU_INTEL_COREI7; nclasses = 5; @@ -180,7 +186,7 @@ pmc_intel_initialize(void) /* Allocate base class and initialize machine dependent struct */ pmc_mdep = pmc_mdep_alloc(nclasses); - pmc_mdep->pmd_cputype = cputype; + pmc_mdep->pmd_cputype = cputype; pmc_mdep->pmd_switch_in = intel_switch_in; pmc_mdep->pmd_switch_out = intel_switch_out; Modified: stable/9/sys/dev/hwpmc/hwpmc_uncore.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_uncore.c Sun Apr 28 22:52:43 2013 (r250037) +++ stable/9/sys/dev/hwpmc/hwpmc_uncore.c Mon Apr 29 04:38:43 2013 (r250038) @@ -754,13 +754,13 @@ static struct ucp_event_descr ucp_events UCPDESCR(66H_04H, 0x66, 0x04, UCP_F_FM | UCP_F_I7 | UCP_F_WM), UCPDESCR(67H_01H, 0x67, 0x01, UCP_F_FM | UCP_F_WM), - + UCPDESCR(80H_01H, 0x80, 0x01, UCP_F_FM | UCP_F_WM | UCP_F_SB | UCP_F_HW), UCPDESCR(80H_02H, 0x80, 0x02, UCP_F_FM | UCP_F_WM), UCPDESCR(80H_04H, 0x80, 0x04, UCP_F_FM | UCP_F_WM), UCPDESCR(80H_08H, 0x80, 0x08, UCP_F_FM | UCP_F_WM), - + UCPDESCR(81H_01H, 0x81, 0x01, UCP_F_FM | UCP_F_WM | UCP_F_SB | UCP_F_HW), UCPDESCR(81H_02H, 0x81, 0x02, UCP_F_FM | UCP_F_WM), @@ -770,13 +770,13 @@ static struct ucp_event_descr ucp_events UCPDESCR(81H_80H, 0x81, 0x80, UCP_F_FM | UCP_F_SB | UCP_F_HW), UCPDESCR(82H_01H, 0x82, 0x01, UCP_F_FM | UCP_F_WM), - + UCPDESCR(83H_01H, 0x83, 0x01, UCP_F_FM | UCP_F_WM | UCP_F_SB | UCP_F_HW), UCPDESCR(83H_02H, 0x83, 0x02, UCP_F_FM | UCP_F_WM), UCPDESCR(83H_04H, 0x83, 0x04, UCP_F_FM | UCP_F_WM), UCPDESCR(83H_08H, 0x83, 0x08, UCP_F_FM | UCP_F_WM), - + UCPDESCR(84H_01H, 0x84, 0x01, UCP_F_FM | UCP_F_WM | UCP_F_SB | UCP_F_HW), UCPDESCR(84H_02H, 0x84, 0x02, UCP_F_FM | UCP_F_WM), @@ -808,20 +808,20 @@ static int ucp_event_sb_hw_ok_on_counter(enum pmc_event pe, int ri) { uint32_t mask; - + switch (pe) { - /* + /* * Events valid only on counter 0. */ case PMC_EV_UCP_EVENT_80H_01H: case PMC_EV_UCP_EVENT_83H_01H: mask = (1 << 0); break; - + default: mask = ~0; /* Any row index is ok. */ } - + return (mask & (1 << ri)); } @@ -855,7 +855,7 @@ ucp_allocate_pmc(int cpu, int ri, struct default: break; } - + /* * Look for an event descriptor with matching CPU and event id @@ -1045,9 +1045,9 @@ ucp_start_pmc(int cpu, int ri) evsel = pm->pm_md.pm_ucp.pm_ucp_evsel; - PMCDBG(MDP,STA,2, - "ucp-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x", - cpu, ri, SELECTSEL(uncore_cputype) + ri, evsel); + PMCDBG(MDP,STA,2, + "ucp-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x", + cpu, ri, SELECTSEL(uncore_cputype) + ri, evsel); /* Event specific configuration. */ switch (pm->pm_event) { @@ -1067,12 +1067,12 @@ ucp_start_pmc(int cpu, int ri) case PMC_EV_UCP_EVENT_0CH_08H_S: wrmsr(MSR_GQ_SNOOP_MESF,0x4); break; - default: + default: break; } wrmsr(SELECTSEL(uncore_cputype) + ri, evsel); - + do { cc->pc_resync = 0; cc->pc_globalctrl |= (1ULL << ri); Modified: stable/9/sys/dev/hwpmc/pmc_events.h ============================================================================== --- stable/9/sys/dev/hwpmc/pmc_events.h Sun Apr 28 22:52:43 2013 (r250037) +++ stable/9/sys/dev/hwpmc/pmc_events.h Mon Apr 29 04:38:43 2013 (r250038) @@ -29,7 +29,7 @@ #ifndef _DEV_HWPMC_PMC_EVENTS_H_ #define _DEV_HWPMC_PMC_EVENTS_H_ -/* +/* * Note: Documentation on adding events can be found both in * the source tree at src/share/doc/papers/hwpmc/hwpmc.ms * as well as on-line at: @@ -889,11 +889,11 @@ __PMC_EV(IAP, EVENT_A2H_10H) \ __PMC_EV(IAP, EVENT_A2H_20H) \ __PMC_EV(IAP, EVENT_A2H_40H) \ __PMC_EV(IAP, EVENT_A2H_80H) \ -__PMC_EV(IAP, EVENT_A3H_01H) \ -__PMC_EV(IAP, EVENT_A3H_02H) \ -__PMC_EV(IAP, EVENT_A3H_04H) \ -__PMC_EV(IAP, EVENT_A3H_05H) \ -__PMC_EV(IAP, EVENT_A3H_08H) \ +__PMC_EV(IAP, EVENT_A3H_01H) \ +__PMC_EV(IAP, EVENT_A3H_02H) \ +__PMC_EV(IAP, EVENT_A3H_04H) \ +__PMC_EV(IAP, EVENT_A3H_05H) \ +__PMC_EV(IAP, EVENT_A3H_08H) \ __PMC_EV(IAP, EVENT_A6H_01H) \ __PMC_EV(IAP, EVENT_A7H_01H) \ __PMC_EV(IAP, EVENT_A8H_01H) \ @@ -1195,7 +1195,7 @@ __PMC_EV_ALIAS("BR_INST_RETIRED.MISPRED" __PMC_EV_ALIAS("BR_INST_RETIRED.MISPRED_NOT_TAKEN", \ IAP_EVENT_C4H_02H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.MISPRED_TAKEN", IAP_EVENT_C4H_08H) \ -__PMC_EV_ALIAS("BR_INST_RETIRED.PRED_NOT_TAKEN",IAP_EVENT_C4H_01H) \ +__PMC_EV_ALIAS("BR_INST_RETIRED.PRED_NOT_TAKEN", IAP_EVENT_C4H_01H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.PRED_TAKEN", IAP_EVENT_C4H_04H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.TAKEN", IAP_EVENT_C4H_0CH) \ __PMC_EV_ALIAS("BR_MISSP_EXEC", IAP_EVENT_89H_00H) \ @@ -1416,139 +1416,139 @@ __PMC_EV_ALIAS("X87_OPS_RETIRED.FXCH", /* * Aliases for Core PMC events. */ -#define __PMC_EV_ALIAS_CORE() \ -__PMC_EV_ALIAS_INTEL_ARCHITECTURAL() \ -__PMC_EV_ALIAS("BAClears", IAP_EVENT_E6H_00H) \ -__PMC_EV_ALIAS("BTB_Misses", IAP_EVENT_E2H_00H) \ -__PMC_EV_ALIAS("Br_BAC_Missp_Exec", IAP_EVENT_8AH_00H) \ -__PMC_EV_ALIAS("Br_Bogus", IAP_EVENT_E4H_00H) \ -__PMC_EV_ALIAS("Br_Call_Exec", IAP_EVENT_92H_00H) \ -__PMC_EV_ALIAS("Br_Call_Missp_Exec", IAP_EVENT_93H_00H) \ -__PMC_EV_ALIAS("Br_Cnd_Exec", IAP_EVENT_8BH_00H) \ -__PMC_EV_ALIAS("Br_Cnd_Missp_Exec", IAP_EVENT_8CH_00H) \ -__PMC_EV_ALIAS("Br_Ind_Call_Exec", IAP_EVENT_94H_00H) \ -__PMC_EV_ALIAS("Br_Ind_Exec", IAP_EVENT_8DH_00H) \ -__PMC_EV_ALIAS("Br_Ind_Missp_Exec", IAP_EVENT_8EH_00H) \ -__PMC_EV_ALIAS("Br_Inst_Exec", IAP_EVENT_88H_00H) \ -__PMC_EV_ALIAS("Br_Instr_Decoded", IAP_EVENT_E0H_00H) \ -__PMC_EV_ALIAS("Br_Instr_Ret", IAP_EVENT_C4H_00H) \ -__PMC_EV_ALIAS("Br_MisPred_Ret", IAP_EVENT_C5H_00H) \ -__PMC_EV_ALIAS("Br_MisPred_Taken_Ret", IAP_EVENT_CAH_00H) \ -__PMC_EV_ALIAS("Br_Missp_Exec", IAP_EVENT_89H_00H) \ -__PMC_EV_ALIAS("Br_Ret_BAC_Missp_Exec", IAP_EVENT_91H_00H) \ -__PMC_EV_ALIAS("Br_Ret_Exec", IAP_EVENT_8FH_00H) \ -__PMC_EV_ALIAS("Br_Ret_Missp_Exec", IAP_EVENT_90H_00H) \ -__PMC_EV_ALIAS("Br_Taken_Ret", IAP_EVENT_C9H_00H) \ -__PMC_EV_ALIAS("Bus_BNR_Clocks", IAP_EVENT_61H_00H) \ -__PMC_EV_ALIAS("Bus_DRDY_Clocks", IAP_EVENT_62H_00H) \ -__PMC_EV_ALIAS("Bus_Data_Rcv", IAP_EVENT_64H_40H) \ -__PMC_EV_ALIAS("Bus_Locks_Clocks", IAP_EVENT_63H) \ -__PMC_EV_ALIAS("Bus_Not_In_Use", IAP_EVENT_7DH) \ -__PMC_EV_ALIAS("Bus_Req_Outstanding", IAP_EVENT_60H) \ -__PMC_EV_ALIAS("Bus_Snoop_Stall", IAP_EVENT_7EH_00H) \ -__PMC_EV_ALIAS("Bus_Snoops", IAP_EVENT_77H) \ -__PMC_EV_ALIAS("Bus_Trans_Any", IAP_EVENT_70H) \ -__PMC_EV_ALIAS("Bus_Trans_Brd", IAP_EVENT_65H) \ -__PMC_EV_ALIAS("Bus_Trans_Burst", IAP_EVENT_6EH) \ -__PMC_EV_ALIAS("Bus_Trans_Def", IAP_EVENT_6DH) \ -__PMC_EV_ALIAS("Bus_Trans_IO", IAP_EVENT_6CH) \ -__PMC_EV_ALIAS("Bus_Trans_Ifetch", IAP_EVENT_68H) \ -__PMC_EV_ALIAS("Bus_Trans_Inval", IAP_EVENT_69H) \ -__PMC_EV_ALIAS("Bus_Trans_Mem", IAP_EVENT_6FH) \ -__PMC_EV_ALIAS("Bus_Trans_P", IAP_EVENT_6BH) \ -__PMC_EV_ALIAS("Bus_Trans_Pwr", IAP_EVENT_6AH) \ -__PMC_EV_ALIAS("Bus_Trans_RFO", IAP_EVENT_66H) \ -__PMC_EV_ALIAS("Bus_Trans_WB", IAP_EVENT_67H) \ -__PMC_EV_ALIAS("Cycles_Div_Busy", IAP_EVENT_14H_00H) \ -__PMC_EV_ALIAS("Cycles_Int_Masked", IAP_EVENT_C6H_00H) \ -__PMC_EV_ALIAS("Cycles_Int_Pending_Masked", IAP_EVENT_C7H_00H) \ -__PMC_EV_ALIAS("DCU_Snoop_To_Share", IAP_EVENT_78H) \ -__PMC_EV_ALIAS("DCache_Cache_LD", IAP_EVENT_40H) \ -__PMC_EV_ALIAS("DCache_Cache_Lock", IAP_EVENT_42H) \ -__PMC_EV_ALIAS("DCache_Cache_ST", IAP_EVENT_41H) \ -__PMC_EV_ALIAS("DCache_M_Evict", IAP_EVENT_47H_00H) \ -__PMC_EV_ALIAS("DCache_M_Repl", IAP_EVENT_46H_00H) \ -__PMC_EV_ALIAS("DCache_Pend_Miss", IAP_EVENT_48H_00H) \ -__PMC_EV_ALIAS("DCache_Repl", IAP_EVENT_45H_0FH) \ -__PMC_EV_ALIAS("Data_Mem_Cache_Ref", IAP_EVENT_44H_02H) \ -__PMC_EV_ALIAS("Data_Mem_Ref", IAP_EVENT_43H_01H) \ -__PMC_EV_ALIAS("Dbus_Busy", IAP_EVENT_22H) \ -__PMC_EV_ALIAS("Dbus_Busy_Rd", IAP_EVENT_23H) \ -__PMC_EV_ALIAS("Div", IAP_EVENT_13H_00H) \ -__PMC_EV_ALIAS("Dtlb_Miss", IAP_EVENT_49H_00H) \ -__PMC_EV_ALIAS("ESP_Uops", IAP_EVENT_D7H_00H) \ -__PMC_EV_ALIAS("EST_Trans", IAP_EVENT_3AH) \ -__PMC_EV_ALIAS("FP_Assist", IAP_EVENT_11H_00H) \ -__PMC_EV_ALIAS("FP_Comp_Instr_Ret", IAP_EVENT_C1H_00H) \ -__PMC_EV_ALIAS("FP_Comps_Op_Exe", IAP_EVENT_10H_00H) \ -__PMC_EV_ALIAS("FP_MMX_Trans", IAP_EVENT_CCH_01H) \ -__PMC_EV_ALIAS("Fused_Ld_Uops_Ret", IAP_EVENT_DAH_01H) \ -__PMC_EV_ALIAS("Fused_St_Uops_Ret", IAP_EVENT_DAH_02H) \ -__PMC_EV_ALIAS("Fused_Uops_Ret", IAP_EVENT_DAH_00H) \ -__PMC_EV_ALIAS("HW_Int_Rx", IAP_EVENT_C8H_00H) \ -__PMC_EV_ALIAS("ICache_Misses", IAP_EVENT_81H_00H) \ -__PMC_EV_ALIAS("ICache_Reads", IAP_EVENT_80H_00H) \ -__PMC_EV_ALIAS("IFU_Mem_Stall", IAP_EVENT_86H_00H) \ -__PMC_EV_ALIAS("ILD_Stall", IAP_EVENT_87H_00H) \ -__PMC_EV_ALIAS("ITLB_Misses", IAP_EVENT_85H_00H) \ -__PMC_EV_ALIAS("Instr_Decoded", IAP_EVENT_D0H_00H) \ -__PMC_EV_ALIAS("Instr_Ret", IAP_EVENT_C0H_00H) \ -__PMC_EV_ALIAS("L1_Pref_Req", IAP_EVENT_4FH_00H) \ -__PMC_EV_ALIAS("L2_ADS", IAP_EVENT_21H) \ -__PMC_EV_ALIAS("L2_IFetch", IAP_EVENT_28H) \ -__PMC_EV_ALIAS("L2_LD", IAP_EVENT_29H) \ -__PMC_EV_ALIAS("L2_Lines_In", IAP_EVENT_24H) \ -__PMC_EV_ALIAS("L2_Lines_Out", IAP_EVENT_26H) \ -__PMC_EV_ALIAS("L2_M_Lines_In", IAP_EVENT_25H) \ -__PMC_EV_ALIAS("L2_M_Lines_Out", IAP_EVENT_27H) \ -__PMC_EV_ALIAS("L2_No_Request_Cycles", IAP_EVENT_32H) \ -__PMC_EV_ALIAS("L2_Reject_Cycles", IAP_EVENT_30H) \ -__PMC_EV_ALIAS("L2_Rqsts", IAP_EVENT_2EH) \ -__PMC_EV_ALIAS("L2_ST", IAP_EVENT_2AH) \ -__PMC_EV_ALIAS("LD_Blocks", IAP_EVENT_03H_00H) \ -__PMC_EV_ALIAS("LLC_Misses", IAP_EVENT_2EH_41H) \ -__PMC_EV_ALIAS("LLC_Reference", IAP_EVENT_2EH_4FH) \ -__PMC_EV_ALIAS("MMX_Assist", IAP_EVENT_CDH_00H) \ -__PMC_EV_ALIAS("MMX_FP_Trans", IAP_EVENT_CCH_00H) \ -__PMC_EV_ALIAS("MMX_Instr_Exec", IAP_EVENT_B0H_00H) \ -__PMC_EV_ALIAS("MMX_Instr_Ret", IAP_EVENT_CEH_00H) \ -__PMC_EV_ALIAS("Misalign_Mem_Ref", IAP_EVENT_05H_00H) \ -__PMC_EV_ALIAS("Mul", IAP_EVENT_12H_00H) \ -__PMC_EV_ALIAS("NonHlt_Ref_Cycles", IAP_EVENT_3CH_01H) \ -__PMC_EV_ALIAS("Pref_Rqsts_Dn", IAP_EVENT_F8H_00H) \ -__PMC_EV_ALIAS("Pref_Rqsts_Up", IAP_EVENT_F0H_00H) \ -__PMC_EV_ALIAS("Resource_Stall", IAP_EVENT_A2H_00H) \ -__PMC_EV_ALIAS("SD_Drains", IAP_EVENT_04H_00H) \ -__PMC_EV_ALIAS("SIMD_FP_DP_P_Comp_Ret", IAP_EVENT_D9H_02H) \ -__PMC_EV_ALIAS("SIMD_FP_DP_P_Ret", IAP_EVENT_D8H_02H) \ -__PMC_EV_ALIAS("SIMD_FP_DP_S_Comp_Ret", IAP_EVENT_D9H_03H) \ -__PMC_EV_ALIAS("SIMD_FP_DP_S_Ret", IAP_EVENT_D8H_03H) \ -__PMC_EV_ALIAS("SIMD_FP_SP_P_Comp_Ret", IAP_EVENT_D9H_00H) \ -__PMC_EV_ALIAS("SIMD_FP_SP_Ret", IAP_EVENT_D8H_00H) \ -__PMC_EV_ALIAS("SIMD_FP_SP_S_Comp_Ret", IAP_EVENT_D9H_01H) \ -__PMC_EV_ALIAS("SIMD_FP_SP_S_Ret", IAP_EVENT_D8H_01H) \ -__PMC_EV_ALIAS("SIMD_Int_128_Ret", IAP_EVENT_D8H_04H) \ -__PMC_EV_ALIAS("SIMD_Int_Pari_Exec", IAP_EVENT_B3H_20H) \ -__PMC_EV_ALIAS("SIMD_Int_Pck_Exec", IAP_EVENT_B3H_04H) \ -__PMC_EV_ALIAS("SIMD_Int_Plog_Exec", IAP_EVENT_B3H_10H) \ -__PMC_EV_ALIAS("SIMD_Int_Pmul_Exec", IAP_EVENT_B3H_01H) \ -__PMC_EV_ALIAS("SIMD_Int_Psft_Exec", IAP_EVENT_B3H_02H) \ -__PMC_EV_ALIAS("SIMD_Int_Sat_Exec", IAP_EVENT_B1H_00H) \ -__PMC_EV_ALIAS("SIMD_Int_Upck_Exec", IAP_EVENT_B3H_08H) \ -__PMC_EV_ALIAS("SMC_Detected", IAP_EVENT_C3H_00H) \ -__PMC_EV_ALIAS("SSE_NTStores_Miss", IAP_EVENT_4BH_03H) \ -__PMC_EV_ALIAS("SSE_NTStores_Ret", IAP_EVENT_07H_03H) \ -__PMC_EV_ALIAS("SSE_PrefNta_Miss", IAP_EVENT_4BH_00H) \ -__PMC_EV_ALIAS("SSE_PrefNta_Ret", IAP_EVENT_07H_00H) \ -__PMC_EV_ALIAS("SSE_PrefT1_Miss", IAP_EVENT_4BH_01H) \ -__PMC_EV_ALIAS("SSE_PrefT1_Ret", IAP_EVENT_07H_01H) \ -__PMC_EV_ALIAS("SSE_PrefT2_Miss", IAP_EVENT_4BH_02H) \ -__PMC_EV_ALIAS("SSE_PrefT2_Ret", IAP_EVENT_07H_02H) \ -__PMC_EV_ALIAS("Seg_Reg_Loads", IAP_EVENT_06H_00H) \ -__PMC_EV_ALIAS("Serial_Execution_Cycles", IAP_EVENT_3CH_02H) \ -__PMC_EV_ALIAS("Thermal_Trip", IAP_EVENT_3BH_C0H) \ -__PMC_EV_ALIAS("Unfusion", IAP_EVENT_DBH_00H) \ -__PMC_EV_ALIAS("Unhalted_Core_Cycles", IAP_EVENT_3CH_00H) \ +#define __PMC_EV_ALIAS_CORE() \ +__PMC_EV_ALIAS_INTEL_ARCHITECTURAL() \ +__PMC_EV_ALIAS("BAClears", IAP_EVENT_E6H_00H) \ +__PMC_EV_ALIAS("BTB_Misses", IAP_EVENT_E2H_00H) \ +__PMC_EV_ALIAS("Br_BAC_Missp_Exec", IAP_EVENT_8AH_00H) \ +__PMC_EV_ALIAS("Br_Bogus", IAP_EVENT_E4H_00H) \ +__PMC_EV_ALIAS("Br_Call_Exec", IAP_EVENT_92H_00H) \ +__PMC_EV_ALIAS("Br_Call_Missp_Exec", IAP_EVENT_93H_00H) \ +__PMC_EV_ALIAS("Br_Cnd_Exec", IAP_EVENT_8BH_00H) \ +__PMC_EV_ALIAS("Br_Cnd_Missp_Exec", IAP_EVENT_8CH_00H) \ +__PMC_EV_ALIAS("Br_Ind_Call_Exec", IAP_EVENT_94H_00H) \ +__PMC_EV_ALIAS("Br_Ind_Exec", IAP_EVENT_8DH_00H) \ +__PMC_EV_ALIAS("Br_Ind_Missp_Exec", IAP_EVENT_8EH_00H) \ +__PMC_EV_ALIAS("Br_Inst_Exec", IAP_EVENT_88H_00H) \ +__PMC_EV_ALIAS("Br_Instr_Decoded", IAP_EVENT_E0H_00H) \ +__PMC_EV_ALIAS("Br_Instr_Ret", IAP_EVENT_C4H_00H) \ +__PMC_EV_ALIAS("Br_MisPred_Ret", IAP_EVENT_C5H_00H) \ +__PMC_EV_ALIAS("Br_MisPred_Taken_Ret", IAP_EVENT_CAH_00H) \ +__PMC_EV_ALIAS("Br_Missp_Exec", IAP_EVENT_89H_00H) \ +__PMC_EV_ALIAS("Br_Ret_BAC_Missp_Exec", IAP_EVENT_91H_00H) \ +__PMC_EV_ALIAS("Br_Ret_Exec", IAP_EVENT_8FH_00H) \ +__PMC_EV_ALIAS("Br_Ret_Missp_Exec", IAP_EVENT_90H_00H) \ +__PMC_EV_ALIAS("Br_Taken_Ret", IAP_EVENT_C9H_00H) \ +__PMC_EV_ALIAS("Bus_BNR_Clocks", IAP_EVENT_61H_00H) \ +__PMC_EV_ALIAS("Bus_DRDY_Clocks", IAP_EVENT_62H_00H) \ +__PMC_EV_ALIAS("Bus_Data_Rcv", IAP_EVENT_64H_40H) \ +__PMC_EV_ALIAS("Bus_Locks_Clocks", IAP_EVENT_63H) \ +__PMC_EV_ALIAS("Bus_Not_In_Use", IAP_EVENT_7DH) \ +__PMC_EV_ALIAS("Bus_Req_Outstanding", IAP_EVENT_60H) \ +__PMC_EV_ALIAS("Bus_Snoop_Stall", IAP_EVENT_7EH_00H) \ +__PMC_EV_ALIAS("Bus_Snoops", IAP_EVENT_77H) \ +__PMC_EV_ALIAS("Bus_Trans_Any", IAP_EVENT_70H) \ +__PMC_EV_ALIAS("Bus_Trans_Brd", IAP_EVENT_65H) \ +__PMC_EV_ALIAS("Bus_Trans_Burst", IAP_EVENT_6EH) \ +__PMC_EV_ALIAS("Bus_Trans_Def", IAP_EVENT_6DH) \ +__PMC_EV_ALIAS("Bus_Trans_IO", IAP_EVENT_6CH) \ +__PMC_EV_ALIAS("Bus_Trans_Ifetch", IAP_EVENT_68H) \ +__PMC_EV_ALIAS("Bus_Trans_Inval", IAP_EVENT_69H) \ +__PMC_EV_ALIAS("Bus_Trans_Mem", IAP_EVENT_6FH) \ +__PMC_EV_ALIAS("Bus_Trans_P", IAP_EVENT_6BH) \ +__PMC_EV_ALIAS("Bus_Trans_Pwr", IAP_EVENT_6AH) \ +__PMC_EV_ALIAS("Bus_Trans_RFO", IAP_EVENT_66H) \ +__PMC_EV_ALIAS("Bus_Trans_WB", IAP_EVENT_67H) \ +__PMC_EV_ALIAS("Cycles_Div_Busy", IAP_EVENT_14H_00H) \ +__PMC_EV_ALIAS("Cycles_Int_Masked", IAP_EVENT_C6H_00H) \ +__PMC_EV_ALIAS("Cycles_Int_Pending_Masked", IAP_EVENT_C7H_00H) \ +__PMC_EV_ALIAS("DCU_Snoop_To_Share", IAP_EVENT_78H) \ +__PMC_EV_ALIAS("DCache_Cache_LD", IAP_EVENT_40H) \ +__PMC_EV_ALIAS("DCache_Cache_Lock", IAP_EVENT_42H) \ +__PMC_EV_ALIAS("DCache_Cache_ST", IAP_EVENT_41H) \ +__PMC_EV_ALIAS("DCache_M_Evict", IAP_EVENT_47H_00H) \ +__PMC_EV_ALIAS("DCache_M_Repl", IAP_EVENT_46H_00H) \ +__PMC_EV_ALIAS("DCache_Pend_Miss", IAP_EVENT_48H_00H) \ +__PMC_EV_ALIAS("DCache_Repl", IAP_EVENT_45H_0FH) \ +__PMC_EV_ALIAS("Data_Mem_Cache_Ref", IAP_EVENT_44H_02H) \ +__PMC_EV_ALIAS("Data_Mem_Ref", IAP_EVENT_43H_01H) \ +__PMC_EV_ALIAS("Dbus_Busy", IAP_EVENT_22H) \ +__PMC_EV_ALIAS("Dbus_Busy_Rd", IAP_EVENT_23H) \ +__PMC_EV_ALIAS("Div", IAP_EVENT_13H_00H) \ +__PMC_EV_ALIAS("Dtlb_Miss", IAP_EVENT_49H_00H) \ +__PMC_EV_ALIAS("ESP_Uops", IAP_EVENT_D7H_00H) \ +__PMC_EV_ALIAS("EST_Trans", IAP_EVENT_3AH) \ +__PMC_EV_ALIAS("FP_Assist", IAP_EVENT_11H_00H) \ +__PMC_EV_ALIAS("FP_Comp_Instr_Ret", IAP_EVENT_C1H_00H) \ +__PMC_EV_ALIAS("FP_Comps_Op_Exe", IAP_EVENT_10H_00H) \ +__PMC_EV_ALIAS("FP_MMX_Trans", IAP_EVENT_CCH_01H) \ +__PMC_EV_ALIAS("Fused_Ld_Uops_Ret", IAP_EVENT_DAH_01H) \ +__PMC_EV_ALIAS("Fused_St_Uops_Ret", IAP_EVENT_DAH_02H) \ +__PMC_EV_ALIAS("Fused_Uops_Ret", IAP_EVENT_DAH_00H) \ +__PMC_EV_ALIAS("HW_Int_Rx", IAP_EVENT_C8H_00H) \ +__PMC_EV_ALIAS("ICache_Misses", IAP_EVENT_81H_00H) \ +__PMC_EV_ALIAS("ICache_Reads", IAP_EVENT_80H_00H) \ +__PMC_EV_ALIAS("IFU_Mem_Stall", IAP_EVENT_86H_00H) \ +__PMC_EV_ALIAS("ILD_Stall", IAP_EVENT_87H_00H) \ +__PMC_EV_ALIAS("ITLB_Misses", IAP_EVENT_85H_00H) \ +__PMC_EV_ALIAS("Instr_Decoded", IAP_EVENT_D0H_00H) \ +__PMC_EV_ALIAS("Instr_Ret", IAP_EVENT_C0H_00H) \ +__PMC_EV_ALIAS("L1_Pref_Req", IAP_EVENT_4FH_00H) \ +__PMC_EV_ALIAS("L2_ADS", IAP_EVENT_21H) \ +__PMC_EV_ALIAS("L2_IFetch", IAP_EVENT_28H) \ +__PMC_EV_ALIAS("L2_LD", IAP_EVENT_29H) \ +__PMC_EV_ALIAS("L2_Lines_In", IAP_EVENT_24H) \ +__PMC_EV_ALIAS("L2_Lines_Out", IAP_EVENT_26H) \ +__PMC_EV_ALIAS("L2_M_Lines_In", IAP_EVENT_25H) \ +__PMC_EV_ALIAS("L2_M_Lines_Out", IAP_EVENT_27H) \ +__PMC_EV_ALIAS("L2_No_Request_Cycles", IAP_EVENT_32H) \ +__PMC_EV_ALIAS("L2_Reject_Cycles", IAP_EVENT_30H) \ +__PMC_EV_ALIAS("L2_Rqsts", IAP_EVENT_2EH) \ +__PMC_EV_ALIAS("L2_ST", IAP_EVENT_2AH) \ +__PMC_EV_ALIAS("LD_Blocks", IAP_EVENT_03H_00H) \ +__PMC_EV_ALIAS("LLC_Misses", IAP_EVENT_2EH_41H) \ +__PMC_EV_ALIAS("LLC_Reference", IAP_EVENT_2EH_4FH) \ +__PMC_EV_ALIAS("MMX_Assist", IAP_EVENT_CDH_00H) \ +__PMC_EV_ALIAS("MMX_FP_Trans", IAP_EVENT_CCH_00H) \ +__PMC_EV_ALIAS("MMX_Instr_Exec", IAP_EVENT_B0H_00H) \ +__PMC_EV_ALIAS("MMX_Instr_Ret", IAP_EVENT_CEH_00H) \ +__PMC_EV_ALIAS("Misalign_Mem_Ref", IAP_EVENT_05H_00H) \ +__PMC_EV_ALIAS("Mul", IAP_EVENT_12H_00H) \ +__PMC_EV_ALIAS("NonHlt_Ref_Cycles", IAP_EVENT_3CH_01H) \ +__PMC_EV_ALIAS("Pref_Rqsts_Dn", IAP_EVENT_F8H_00H) \ +__PMC_EV_ALIAS("Pref_Rqsts_Up", IAP_EVENT_F0H_00H) \ +__PMC_EV_ALIAS("Resource_Stall", IAP_EVENT_A2H_00H) \ +__PMC_EV_ALIAS("SD_Drains", IAP_EVENT_04H_00H) \ +__PMC_EV_ALIAS("SIMD_FP_DP_P_Comp_Ret", IAP_EVENT_D9H_02H) \ +__PMC_EV_ALIAS("SIMD_FP_DP_P_Ret", IAP_EVENT_D8H_02H) \ +__PMC_EV_ALIAS("SIMD_FP_DP_S_Comp_Ret", IAP_EVENT_D9H_03H) \ +__PMC_EV_ALIAS("SIMD_FP_DP_S_Ret", IAP_EVENT_D8H_03H) \ +__PMC_EV_ALIAS("SIMD_FP_SP_P_Comp_Ret", IAP_EVENT_D9H_00H) \ +__PMC_EV_ALIAS("SIMD_FP_SP_Ret", IAP_EVENT_D8H_00H) \ +__PMC_EV_ALIAS("SIMD_FP_SP_S_Comp_Ret", IAP_EVENT_D9H_01H) \ +__PMC_EV_ALIAS("SIMD_FP_SP_S_Ret", IAP_EVENT_D8H_01H) \ +__PMC_EV_ALIAS("SIMD_Int_128_Ret", IAP_EVENT_D8H_04H) \ +__PMC_EV_ALIAS("SIMD_Int_Pari_Exec", IAP_EVENT_B3H_20H) \ +__PMC_EV_ALIAS("SIMD_Int_Pck_Exec", IAP_EVENT_B3H_04H) \ +__PMC_EV_ALIAS("SIMD_Int_Plog_Exec", IAP_EVENT_B3H_10H) \ +__PMC_EV_ALIAS("SIMD_Int_Pmul_Exec", IAP_EVENT_B3H_01H) \ +__PMC_EV_ALIAS("SIMD_Int_Psft_Exec", IAP_EVENT_B3H_02H) \ +__PMC_EV_ALIAS("SIMD_Int_Sat_Exec", IAP_EVENT_B1H_00H) \ +__PMC_EV_ALIAS("SIMD_Int_Upck_Exec", IAP_EVENT_B3H_08H) \ +__PMC_EV_ALIAS("SMC_Detected", IAP_EVENT_C3H_00H) \ +__PMC_EV_ALIAS("SSE_NTStores_Miss", IAP_EVENT_4BH_03H) \ +__PMC_EV_ALIAS("SSE_NTStores_Ret", IAP_EVENT_07H_03H) \ +__PMC_EV_ALIAS("SSE_PrefNta_Miss", IAP_EVENT_4BH_00H) \ +__PMC_EV_ALIAS("SSE_PrefNta_Ret", IAP_EVENT_07H_00H) \ +__PMC_EV_ALIAS("SSE_PrefT1_Miss", IAP_EVENT_4BH_01H) \ +__PMC_EV_ALIAS("SSE_PrefT1_Ret", IAP_EVENT_07H_01H) \ +__PMC_EV_ALIAS("SSE_PrefT2_Miss", IAP_EVENT_4BH_02H) \ +__PMC_EV_ALIAS("SSE_PrefT2_Ret", IAP_EVENT_07H_02H) \ +__PMC_EV_ALIAS("Seg_Reg_Loads", IAP_EVENT_06H_00H) \ +__PMC_EV_ALIAS("Serial_Execution_Cycles", IAP_EVENT_3CH_02H) \ +__PMC_EV_ALIAS("Thermal_Trip", IAP_EVENT_3BH_C0H) \ +__PMC_EV_ALIAS("Unfusion", IAP_EVENT_DBH_00H) \ +__PMC_EV_ALIAS("Unhalted_Core_Cycles", IAP_EVENT_3CH_00H) \ __PMC_EV_ALIAS("Uops_Ret", IAP_EVENT_C2H_00H) /* @@ -1880,7 +1880,7 @@ __PMC_EV_ALIAS("SEGMENT_REG_LOADS", IAP_ */ #define __PMC_EV_ALIAS_COREI7() \ __PMC_EV_ALIAS_INTEL_ARCHITECTURAL() \ -__PMC_EV_ALIAS("SB_DRAIN.ANY", IAP_EVENT_04H_07H) \ +__PMC_EV_ALIAS("SB_DRAIN.ANY", IAP_EVENT_04H_07H) \ __PMC_EV_ALIAS("STORE_BLOCKS.AT_RET", IAP_EVENT_06H_04H) \ __PMC_EV_ALIAS("STORE_BLOCKS.L1D_BLOCK", IAP_EVENT_06H_08H) \ __PMC_EV_ALIAS("PARTIAL_ADDRESS_ALIAS", IAP_EVENT_07H_01H) \ @@ -1889,11 +1889,11 @@ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_CO __PMC_EV_ALIAS("DTLB_LOAD_MISSES.STLB_HIT", IAP_EVENT_08H_10H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.PDE_MISS", IAP_EVENT_08H_20H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED", \ - IAP_EVENT_08H_80H) \ + IAP_EVENT_08H_80H) \ __PMC_EV_ALIAS("MEM_INST_RETIRED.LOADS", IAP_EVENT_0BH_01H) \ __PMC_EV_ALIAS("MEM_INST_RETIRED.STORES", IAP_EVENT_0BH_02H) \ __PMC_EV_ALIAS("MEM_INST_RETIRED.LATENCY_ABOVE_THRESHOLD", \ - IAP_EVENT_0BH_10H) \ + IAP_EVENT_0BH_10H) \ __PMC_EV_ALIAS("MEM_STORE_RETIRED.DTLB_MISS", IAP_EVENT_0CH_01H) \ __PMC_EV_ALIAS("UOPS_ISSUED.ANY", IAP_EVENT_0EH_01H) \ __PMC_EV_ALIAS("UOPS_ISSUED.STALLED_CYCLES", IAP_EVENT_0EH_01H) \ @@ -2192,7 +2192,7 @@ __PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE2_INT __PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_FP_PACKED", IAP_EVENT_10H_10H) \ __PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_FP_SCALAR", IAP_EVENT_10H_20H) \ __PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_SINGLE_PRECISION", \ - IAP_EVENT_10H_40H) \ + IAP_EVENT_10H_40H) \ __PMC_EV_ALIAS("FP_COMP_OPS_EXE.SSE_DOUBLE_PRECISION", \ IAP_EVENT_10H_80H) \ __PMC_EV_ALIAS("SIMD_INT_128.PACKED_MPY", IAP_EVENT_12H_01H) \ @@ -2371,11 +2371,11 @@ __PMC_EV_ALIAS("UOPS_RETIRED.MACRO_FUSED __PMC_EV_ALIAS("MACHINE_CLEARS.CYCLES", IAP_EVENT_C3H_01H) \ __PMC_EV_ALIAS("MACHINE_CLEARS.MEM_ORDER", IAP_EVENT_C3H_02H) \ __PMC_EV_ALIAS("MACHINE_CLEARS.SMC", IAP_EVENT_C3H_04H) \ -__PMC_EV_ALIAS("BR_INST_RETIRED.ANY_P", IAP_EVENT_C4H_00H) \ +__PMC_EV_ALIAS("BR_INST_RETIRED.ANY_P", IAP_EVENT_C4H_00H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.CONDITIONAL", IAP_EVENT_C4H_01H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.NEAR_CALL", IAP_EVENT_C4H_02H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.ALL_BRANCHES", IAP_EVENT_C4H_04H) \ -__PMC_EV_ALIAS("BR_MISP_RETIRED.ANY_P", IAP_EVENT_C5H_00H) \ +__PMC_EV_ALIAS("BR_MISP_RETIRED.ANY_P", IAP_EVENT_C5H_00H) \ __PMC_EV_ALIAS("BR_MISP_RETIRED.CONDITIONAL", IAP_EVENT_C5H_01H) \ __PMC_EV_ALIAS("BR_MISP_RETIRED.NEAR_CALL", IAP_EVENT_C5H_02H) \ __PMC_EV_ALIAS("BR_MISP_RETIRED.ALL_BRANCHES", IAP_EVENT_C5H_04H) \ @@ -2449,299 +2449,330 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE /* * Aliases for Haswell core PMC events */ -#define __PMC_EV_ALIAS_HASWELL() \ -__PMC_EV_ALIAS("LD_BLOCKS.STORE_FORWARD", IAP_EVENT_03H_02H) \ -__PMC_EV_ALIAS("MISALIGN_MEM_REF.LOADS", IAP_EVENT_05H_01H) \ -__PMC_EV_ALIAS("MISALIGN_MEM_REF.STORES", IAP_EVENT_05H_02H) \ +#define __PMC_EV_ALIAS_HASWELL() \ +__PMC_EV_ALIAS("LD_BLOCKS.STORE_FORWARD", IAP_EVENT_03H_02H) \ +__PMC_EV_ALIAS("MISALIGN_MEM_REF.LOADS", IAP_EVENT_05H_01H) \ +__PMC_EV_ALIAS("MISALIGN_MEM_REF.STORES", IAP_EVENT_05H_02H) \ __PMC_EV_ALIAS("LD_BLOCKS_PARTIAL.ADDRESS_ALIAS", IAP_EVENT_07H_01H) \ -__PMC_EV_ALIAS("DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK", IAP_EVENT_08H_01H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK", IAP_EVENT_08H_01H)\ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_COMPLETED_4K", IAP_EVENT_08H_02H) \ -__PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_COMPLETED_2M_4K", IAP_EVENT_08H_02H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_COMPLETED_2M_4K", \ + IAP_EVENT_08H_02H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_COMPLETED", IAP_EVENT_08H_0EH) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_DURATION", IAP_EVENT_08H_10H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.STLB_HIT_4K", IAP_EVENT_08H_20H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.STLB_HIT_2M", IAP_EVENT_08H_40H) \ -__PMC_EV_ALIAS("DTLB_LOAD_MISSES.STLB_HIT", IAP_EVENT_08H_60H) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.STLB_HIT", IAP_EVENT_08H_60H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.PDE_CACHE_MISS", IAP_EVENT_08H_80H) \ -__PMC_EV_ALIAS("INT_MISC.RECOVERY_CYCLES", IAP_EVENT_0DH_03H) \ -__PMC_EV_ALIAS("UOPS_ISSUED.ANY", IAP_EVENT_0EH_01H) \ -__PMC_EV_ALIAS("UOPS_ISSUED.FLAGS_MERGE", IAP_EVENT_0EH_10H) \ -__PMC_EV_ALIAS("UOPS_ISSUED.SLOW_LEA", IAP_EVENT_0EH_20H) \ -__PMC_EV_ALIAS("UOPS_ISSUED.SiNGLE_MUL", IAP_EVENT_0EH_40H) \ +__PMC_EV_ALIAS("INT_MISC.RECOVERY_CYCLES", IAP_EVENT_0DH_03H) \ +__PMC_EV_ALIAS("UOPS_ISSUED.ANY", IAP_EVENT_0EH_01H) \ +__PMC_EV_ALIAS("UOPS_ISSUED.FLAGS_MERGE", IAP_EVENT_0EH_10H) \ +__PMC_EV_ALIAS("UOPS_ISSUED.SLOW_LEA", IAP_EVENT_0EH_20H) \ +__PMC_EV_ALIAS("UOPS_ISSUED.SiNGLE_MUL", IAP_EVENT_0EH_40H) \ __PMC_EV_ALIAS("L2_RQSTS.DEMAND_DATA_RD_MISS", IAP_EVENT_24H_21H) \ __PMC_EV_ALIAS("L2_RQSTS.DEMAND_DATA_RD_HIT", IAP_EVENT_24H_41H) \ __PMC_EV_ALIAS("L2_RQSTS.ALL_DEMAND_DATA_RD", IAP_EVENT_24H_E1H) \ -__PMC_EV_ALIAS("L2_RQSTS.RFO_HIT", IAP_EVENT_24H_42H) \ -__PMC_EV_ALIAS("L2_RQSTS.RFO_MISS", IAP_EVENT_24H_22H) \ -__PMC_EV_ALIAS("L2_RQSTS.ALL_RFO", IAP_EVENT_24H_E2H) \ -__PMC_EV_ALIAS("L2_RQSTS.CODE_RD_HIT", IAP_EVENT_24H_44H) \ -__PMC_EV_ALIAS("L2_RQSTS.CODE_RD_MISS", IAP_EVENT_24H_24H) \ -__PMC_EV_ALIAS("L2_RQSTS.ALL_DEMAND_MISS", IAP_EVENT_24H_27H) \ +__PMC_EV_ALIAS("L2_RQSTS.RFO_HIT", IAP_EVENT_24H_42H) \ +__PMC_EV_ALIAS("L2_RQSTS.RFO_MISS", IAP_EVENT_24H_22H) \ +__PMC_EV_ALIAS("L2_RQSTS.ALL_RFO", IAP_EVENT_24H_E2H) \ +__PMC_EV_ALIAS("L2_RQSTS.CODE_RD_HIT", IAP_EVENT_24H_44H) \ +__PMC_EV_ALIAS("L2_RQSTS.CODE_RD_MISS", IAP_EVENT_24H_24H) \ +__PMC_EV_ALIAS("L2_RQSTS.ALL_DEMAND_MISS", IAP_EVENT_24H_27H) \ __PMC_EV_ALIAS("L2_RQSTS.ALL_DEMAND_REFERENCES", IAP_EVENT_24H_E7H) \ -__PMC_EV_ALIAS("L2_RQSTS.ALL_CODE_RD", IAP_EVENT_24H_E4H) \ -__PMC_EV_ALIAS("L2_RQSTS.L2_PF_HIT", IAP_EVENT_24H_50H) \ -__PMC_EV_ALIAS("L2_RQSTS.L2_PF_MISS", IAP_EVENT_24H_30H) \ -__PMC_EV_ALIAS("L2_RQSTS.ALL_PF", IAP_EVENT_24H_F8H) \ -__PMC_EV_ALIAS("L2_RQSTS.MISS", IAP_EVENT_24H_3FH) \ -__PMC_EV_ALIAS("L2_RQSTS.REFERENCES", IAP_EVENT_24H_FFH) \ -__PMC_EV_ALIAS("L2_DEMAND_RQSTS.WB_HIT", IAP_EVENT_27H_50H) \ +__PMC_EV_ALIAS("L2_RQSTS.ALL_CODE_RD", IAP_EVENT_24H_E4H) \ +__PMC_EV_ALIAS("L2_RQSTS.L2_PF_HIT", IAP_EVENT_24H_50H) \ +__PMC_EV_ALIAS("L2_RQSTS.L2_PF_MISS", IAP_EVENT_24H_30H) \ +__PMC_EV_ALIAS("L2_RQSTS.ALL_PF", IAP_EVENT_24H_F8H) \ +__PMC_EV_ALIAS("L2_RQSTS.MISS", IAP_EVENT_24H_3FH) \ +__PMC_EV_ALIAS("L2_RQSTS.REFERENCES", IAP_EVENT_24H_FFH) \ +__PMC_EV_ALIAS("L2_DEMAND_RQSTS.WB_HIT", IAP_EVENT_27H_50H) \ __PMC_EV_ALIAS("LONGEST_LAT_CACHE.REFERENCE", IAP_EVENT_2EH_4FH) \ -__PMC_EV_ALIAS("LONGEST_LAT_CACHE.MISS", IAP_EVENT_2EH_41H) \ -__PMC_EV_ALIAS("CPU_CLK_UNHALTED.THREAD_P", IAP_EVENT_3CH_00H) \ +__PMC_EV_ALIAS("LONGEST_LAT_CACHE.MISS", IAP_EVENT_2EH_41H) \ +__PMC_EV_ALIAS("CPU_CLK_UNHALTED.THREAD_P", IAP_EVENT_3CH_00H) \ __PMC_EV_ALIAS("CPU_CLK_THREAD_UNHALTED.REF_XCLK", IAP_EVENT_3CH_01H) \ -__PMC_EV_ALIAS("L1D_PEND_MISS.PENDING", IAP_EVENT_48H_01H) \ -__PMC_EV_ALIAS("DTLB_STORE_MISSES.MISS_CAUSES_A_WALK", IAP_EVENT_49H_01H) \ -__PMC_EV_ALIAS("DTLB_STORE_MISSES.WALK_COMPLETED_4K", IAP_EVENT_49H_02H) \ -__PMC_EV_ALIAS("DTLB_STORE_MISSES.WALK_COMPLETED_2M_4M", IAP_EVENT_49H_04H) \ +__PMC_EV_ALIAS("L1D_PEND_MISS.PENDING", IAP_EVENT_48H_01H) \ +__PMC_EV_ALIAS("DTLB_STORE_MISSES.MISS_CAUSES_A_WALK", \ + IAP_EVENT_49H_01H) \ +__PMC_EV_ALIAS("DTLB_STORE_MISSES.WALK_COMPLETED_4K", \ + IAP_EVENT_49H_02H) \ +__PMC_EV_ALIAS("DTLB_STORE_MISSES.WALK_COMPLETED_2M_4M", \ + IAP_EVENT_49H_04H) \ __PMC_EV_ALIAS("DTLB_STORE_MISSES.WALK_COMPLETED", IAP_EVENT_49H_0EH) \ __PMC_EV_ALIAS("DTLB_STORE_MISSES.WALK_DURATION", IAP_EVENT_49H_10H) \ __PMC_EV_ALIAS("DTLB_STORE_MISSES.STLB_HIT_4K", IAP_EVENT_49H_20H) \ __PMC_EV_ALIAS("DTLB_STORE_MISSES.STLB_HIT_2M", IAP_EVENT_49H_40H) \ -__PMC_EV_ALIAS("DTLB_STORE_MISSES.STLB_HIT", IAP_EVENT_49H_60H) \ +__PMC_EV_ALIAS("DTLB_STORE_MISSES.STLB_HIT", IAP_EVENT_49H_60H) \ __PMC_EV_ALIAS("DTLB_STORE_MISSES.PDE_CACHE_MISS", IAP_EVENT_49H_80H) \ -__PMC_EV_ALIAS("LOAD_HIT_PRE.SW_PF", IAP_EVENT_4CH_01H) \ -__PMC_EV_ALIAS("LOAD_HIT_PRE.HW_PF", IAP_EVENT_4CH_02H) \ -__PMC_EV_ALIAS("L1D.REPLACEMENT", IAP_EVENT_51H_01H) \ -__PMC_EV_ALIAS("MOVE_ELIMINATION.INT_NOT_ELIMINATED", IAP_EVENT_58H_04H) \ -__PMC_EV_ALIAS("MOVE_ELIMINATION.SMID_NOT_ELIMINATED", IAP_EVENT_58H_08H) \ +__PMC_EV_ALIAS("LOAD_HIT_PRE.SW_PF", IAP_EVENT_4CH_01H) \ +__PMC_EV_ALIAS("LOAD_HIT_PRE.HW_PF", IAP_EVENT_4CH_02H) \ +__PMC_EV_ALIAS("L1D.REPLACEMENT", IAP_EVENT_51H_01H) \ +__PMC_EV_ALIAS("MOVE_ELIMINATION.INT_NOT_ELIMINATED", \ + IAP_EVENT_58H_04H) \ +__PMC_EV_ALIAS("MOVE_ELIMINATION.SMID_NOT_ELIMINATED", \ + IAP_EVENT_58H_08H) \ __PMC_EV_ALIAS("MOVE_ELIMINATION.INT_ELIMINATED", IAP_EVENT_58H_01H) \ __PMC_EV_ALIAS("MOVE_ELIMINATION.SMID_ELIMINATED", IAP_EVENT_58H_02H) \ -__PMC_EV_ALIAS("CPL_CYCLES.RING0", IAP_EVENT_5CH_02H) \ -__PMC_EV_ALIAS("CPL_CYCLES.RING123", IAP_EVENT_5CH_01H) \ -__PMC_EV_ALIAS("RS_EVENTS.EMPTY_CYCLES", IAP_EVENT_5EH_01H) \ -__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD", IAP_EVENT_60H_01H) \ -__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CORE_RD", IAP_EVENT_60H_02H) \ -__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO", IAP_EVENT_60H_04H) \ -__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD", IAP_EVENT_60H_08H) \ -__PMC_EV_ALIAS("LOCK_CYCLES.SPLIT_LOCK_UC_LOCK_DURATION", IAP_EVENT_63H_01H) \ +__PMC_EV_ALIAS("CPL_CYCLES.RING0", IAP_EVENT_5CH_02H) \ +__PMC_EV_ALIAS("CPL_CYCLES.RING123", IAP_EVENT_5CH_01H) \ +__PMC_EV_ALIAS("RS_EVENTS.EMPTY_CYCLES", IAP_EVENT_5EH_01H) \ +__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD", \ + IAP_EVENT_60H_01H) \ +__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CORE_RD", \ + IAP_EVENT_60H_02H) \ +__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO", \ + IAP_EVENT_60H_04H) \ +__PMC_EV_ALIAS("OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD", \ + IAP_EVENT_60H_08H) \ +__PMC_EV_ALIAS("LOCK_CYCLES.SPLIT_LOCK_UC_LOCK_DURATION", \ + IAP_EVENT_63H_01H) \ __PMC_EV_ALIAS("LOCK_CYCLES.CACHE_LOCK_DURATION", IAP_EVENT_63H_02H) \ -__PMC_EV_ALIAS("IDQ.EMPTY", IAP_EVENT_79H_02H) \ -__PMC_EV_ALIAS("IDQ.MITE_UOPS", IAP_EVENT_79H_04H) \ -__PMC_EV_ALIAS("IDQ.DSB_UOPS", IAP_EVENT_79H_08H) \ -__PMC_EV_ALIAS("IDQ.MS_DSB_UOPS", IAP_EVENT_79H_10H) \ -__PMC_EV_ALIAS("IDQ.MS_MITE_UOPS", IAP_EVENT_79H_20H) \ -__PMC_EV_ALIAS("IDQ.MS_UOPS", IAP_EVENT_79H_30H) \ +__PMC_EV_ALIAS("IDQ.EMPTY", IAP_EVENT_79H_02H) \ +__PMC_EV_ALIAS("IDQ.MITE_UOPS", IAP_EVENT_79H_04H) \ +__PMC_EV_ALIAS("IDQ.DSB_UOPS", IAP_EVENT_79H_08H) \ +__PMC_EV_ALIAS("IDQ.MS_DSB_UOPS", IAP_EVENT_79H_10H) \ +__PMC_EV_ALIAS("IDQ.MS_MITE_UOPS", IAP_EVENT_79H_20H) \ +__PMC_EV_ALIAS("IDQ.MS_UOPS", IAP_EVENT_79H_30H) \ __PMC_EV_ALIAS("IDQ.ALL_DSB_CYCLES_ANY_UOPS", IAP_EVENT_79H_18H) \ -__PMC_EV_ALIAS("IDQ.ALL_DSB_CYCLES_4_UOPS", IAP_EVENT_79H_18H) \ +__PMC_EV_ALIAS("IDQ.ALL_DSB_CYCLES_4_UOPS", IAP_EVENT_79H_18H) \ __PMC_EV_ALIAS("IDQ.ALL_MITE_CYCLES_ANY_UOPS", IAP_EVENT_79H_24H) \ -__PMC_EV_ALIAS("IDQ.ALL_MITE_CYCLES_4_UOPS", IAP_EVENT_79H_24H) \ -__PMC_EV_ALIAS("IDQ.MITE_ALL_UOPS", IAP_EVENT_79H_3CH) \ -__PMC_EV_ALIAS("ICACHE.MISSES", IAP_EVENT_80H_02H) \ +__PMC_EV_ALIAS("IDQ.ALL_MITE_CYCLES_4_UOPS", IAP_EVENT_79H_24H) \ +__PMC_EV_ALIAS("IDQ.MITE_ALL_UOPS", IAP_EVENT_79H_3CH) \ +__PMC_EV_ALIAS("ICACHE.MISSES", IAP_EVENT_80H_02H) \ __PMC_EV_ALIAS("ITLB_MISSES.MISS_CAUSES_A_WALK", IAP_EVENT_85H_01H) \ __PMC_EV_ALIAS("ITLB_MISSES.WALK_COMPLETED_4K", IAP_EVENT_85H_02H) \ __PMC_EV_ALIAS("TLB_MISSES.WALK_COMPLETED_2M_4M", IAP_EVENT_85H_04H) \ -__PMC_EV_ALIAS("ITLB_MISSES.WALK_COMPLETED", IAP_EVENT_85H_0EH) \ -__PMC_EV_ALIAS("ITLB_MISSES.WALK_DURATION", IAP_EVENT_85H_10H) \ -__PMC_EV_ALIAS("ITLB_MISSES.STLB_HIT_4K", IAP_EVENT_85H_20H) \ -__PMC_EV_ALIAS("ITLB_MISSES.STLB_HIT_2M", IAP_EVENT_85H_40H) \ -__PMC_EV_ALIAS("ITLB_MISSES.STLB_HIT", IAP_EVENT_85H_60H) \ -__PMC_EV_ALIAS("ILD_STALL.LCP", IAP_EVENT_87H_01H) \ -__PMC_EV_ALIAS("ILD_STALL.IQ_FULL", IAP_EVENT_87H_04H) \ -__PMC_EV_ALIAS("BR_INST_EXEC.COND", IAP_EVENT_88H_01H) \ -__PMC_EV_ALIAS("BR_INST_EXEC.DIRECT_JMP", IAP_EVENT_88H_02H) \ -__PMC_EV_ALIAS("BR_INST_EXEC.INDIRECT_JMP_NON_CALL_RET", IAP_EVENT_88H_04H) \ -__PMC_EV_ALIAS("BR_INST_EXEC.RETURN_NEAR", IAP_EVENT_88H_08H) \ +__PMC_EV_ALIAS("ITLB_MISSES.WALK_COMPLETED", IAP_EVENT_85H_0EH) \ +__PMC_EV_ALIAS("ITLB_MISSES.WALK_DURATION", IAP_EVENT_85H_10H) \ +__PMC_EV_ALIAS("ITLB_MISSES.STLB_HIT_4K", IAP_EVENT_85H_20H) \ +__PMC_EV_ALIAS("ITLB_MISSES.STLB_HIT_2M", IAP_EVENT_85H_40H) \ +__PMC_EV_ALIAS("ITLB_MISSES.STLB_HIT", IAP_EVENT_85H_60H) \ +__PMC_EV_ALIAS("ILD_STALL.LCP", IAP_EVENT_87H_01H) \ +__PMC_EV_ALIAS("ILD_STALL.IQ_FULL", IAP_EVENT_87H_04H) \ +__PMC_EV_ALIAS("BR_INST_EXEC.COND", IAP_EVENT_88H_01H) \ +__PMC_EV_ALIAS("BR_INST_EXEC.DIRECT_JMP", IAP_EVENT_88H_02H) \ +__PMC_EV_ALIAS("BR_INST_EXEC.INDIRECT_JMP_NON_CALL_RET", \ + IAP_EVENT_88H_04H) \ +__PMC_EV_ALIAS("BR_INST_EXEC.RETURN_NEAR", IAP_EVENT_88H_08H) \ __PMC_EV_ALIAS("BR_INST_EXEC.DIRECT_NEAR_CALL", IAP_EVENT_88H_10H) \ __PMC_EV_ALIAS("BR_INST_EXEC.INDIRECT_NEAR_CALL", IAP_EVENT_88H_20H) \ -__PMC_EV_ALIAS("BR_INST_EXEC.NONTAKEN", IAP_EVENT_88H_40H) \ -__PMC_EV_ALIAS("BR_INST_EXEC.TAKEN", IAP_EVENT_88H_80H) \ -__PMC_EV_ALIAS("BR_INST_EXEC.ALL_BRANCHES", IAP_EVENT_88H_FFH) \ -__PMC_EV_ALIAS("BR_MISP_EXEC.COND", IAP_EVENT_89H_01H) \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 05:38:03 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3D254FAA; Mon, 29 Apr 2013 05:38:03 +0000 (UTC) (envelope-from mavbsd@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 4DE33171E; Mon, 29 Apr 2013 05:38:01 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id e49so1309356eek.27 for ; Sun, 28 Apr 2013 22:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=oJqvGfyAEwYas6OfWleVoN/fVXQ5kfiFeeF4nEadXO0=; b=KdyU/6aB9y+1anPLwmq1nPaaseF7eQZjk16UMel6c2+5rG34BHrZxLKWcVyivj5YF0 6uyc9xxqBC3fXvT8tv5wYHZJvMFqTQvij3cQdeUvsFAIQJQIyQpjNHh5r2s1TKiCnyu+ 2j+bLdVcqOZYNUMj+EOqOZgf8wwl8x0ULuPE/QHuDgIwrAtiTta/xDxeNNOF+bfRHyrD PrAoDGSCD5igGJGUeIf2+K3Crr3+6OVm9mAQSJPQzbpff5tshqrypXvuFQcQDePnSYXX yjX60i2sylq75ZfwokMsb2yye/AR0MGuMKikEDmtqbSlpPkk9/IrvuNg8NSCpdrOLHd0 q2jQ== X-Received: by 10.15.24.68 with SMTP id i44mr30721284eeu.19.1367213875572; Sun, 28 Apr 2013 22:37:55 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (mavhome.mavhome.dp.ua. [213.227.240.37]) by mx.google.com with ESMTPSA id ch6sm30701753eeb.17.2013.04.28.22.37.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 28 Apr 2013 22:37:54 -0700 (PDT) Sender: Alexander Motin Message-ID: <517E072F.2030006@FreeBSD.org> Date: Mon, 29 Apr 2013 08:37:51 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130413 Thunderbird/17.0.5 MIME-Version: 1.0 To: Peter Wemm Subject: Re: svn commit: r249611 - in stable/9/sys/cam: ata scsi References: <201304180944.r3I9i05t093967@svn.freebsd.org> <517AC0BB.4040207@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 05:38:03 -0000 On 29.04.2013 04:29, Peter Wemm wrote: > On Sat, Apr 27, 2013 at 5:56 PM, Peter Wemm wrote: >> On Fri, Apr 26, 2013 at 11:00 AM, Alexander Motin wrote: >>> On 26.04.2013 19:47, Peter Wemm wrote: >>>> >>>> On Thu, Apr 18, 2013 at 2:44 AM, Alexander Motin wrote: >>>>> >>>>> Author: mav >>>>> Date: Thu Apr 18 09:44:00 2013 >>>>> New Revision: 249611 >>>>> URL: http://svnweb.freebsd.org/changeset/base/249611 >> [..] >>>> This breaks a number of machines in the freebsd.org cluster. I have >>>> to back out both of these changes to get them to reboot. >>> >>> >>> I've made a search though the base system and found only two drivers >>> affected by this change: mpt and hptmv. I've patched both at head r249849 >>> and going to merge fix to stable/9 tomorrow unless objected. Have you tried >>> that patch instead of reverting? >> >> I'm testing this on ns1.freebsd.org and ns2.freebsd.org as we speak. >> If the cluster goes dark, that's why :) > > The machines have survived multiple reboots with > r249849. Thank you. > I do wonder if perhaps "post_sync" isn't the ideal name. Perhaps add > a "quiesce_hardware" eventhandler chain and make it clear that this is > the hook for what things like mpt were doing. It is only one specific case, but I am not sure that mpt is doing the right thing. According to the commit log, interrupts are disabled to prevent new incoming target commands. But may be it could/should be blocked in some other way. What worries me more is that I've just rediscovered that post_sync handlers are called even in case of panic, when no FS sync happens at all. Is it wise to touch random subsystems is state when nothing can be trusted? I've recalled that earlier I've even added checks to CAM ATA disk driver to not recurse lock in case of panic, but that IMO is a dirty hack. -- Alexander Motin From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 06:54:02 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F084ACAE; Mon, 29 Apr 2013 06:54:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D2EFC1A94; Mon, 29 Apr 2013 06:54:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3T6s1jP077596; Mon, 29 Apr 2013 06:54:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3T6s1gT077595; Mon, 29 Apr 2013 06:54:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201304290654.r3T6s1gT077595@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 29 Apr 2013 06:54:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250040 - stable/9/libexec/rtld-elf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 06:54:02 -0000 Author: kib Date: Mon Apr 29 06:54:01 2013 New Revision: 250040 URL: http://svnweb.freebsd.org/changeset/base/250040 Log: MFC r249525: Rewrite origin_subst_one() to get rid of the wrong limit on the length of the resulting string. Modified: stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Mon Apr 29 06:11:19 2013 (r250039) +++ stable/9/libexec/rtld-elf/rtld.c Mon Apr 29 06:54:01 2013 (r250040) @@ -145,9 +145,8 @@ static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *); static void unref_dag(Obj_Entry *); static void ref_dag(Obj_Entry *); -static int origin_subst_one(char **, const char *, const char *, - const char *, char *); -static char *origin_subst(const char *, const char *); +static char *origin_subst_one(char *, const char *, const char *, bool); +static char *origin_subst(char *, const char *); static void preinit_main(void); static int rtld_verify_versions(const Objlist *); static int rtld_verify_object_versions(Obj_Entry *); @@ -748,79 +747,80 @@ basename(const char *name) static struct utsname uts; -static int -origin_subst_one(char **res, const char *real, const char *kw, const char *subst, - char *may_free) +static char * +origin_subst_one(char *real, const char *kw, const char *subst, + bool may_free) { - const char *p, *p1; - char *res1; - int subst_len; - int kw_len; - - res1 = *res = NULL; - p = real; - subst_len = kw_len = 0; - for (;;) { - p1 = strstr(p, kw); - if (p1 != NULL) { - if (subst_len == 0) { - subst_len = strlen(subst); - kw_len = strlen(kw); - } - if (*res == NULL) { - *res = xmalloc(PATH_MAX); - res1 = *res; - } - if ((res1 - *res) + subst_len + (p1 - p) >= PATH_MAX) { - _rtld_error("Substitution of %s in %s cannot be performed", - kw, real); - if (may_free != NULL) - free(may_free); - free(res); - return (false); - } - memcpy(res1, p, p1 - p); - res1 += p1 - p; - memcpy(res1, subst, subst_len); - res1 += subst_len; - p = p1 + kw_len; - } else { - if (*res == NULL) { - if (may_free != NULL) - *res = may_free; - else - *res = xstrdup(real); - return (true); - } - *res1 = '\0'; - if (may_free != NULL) - free(may_free); - if (strlcat(res1, p, PATH_MAX - (res1 - *res)) >= PATH_MAX) { - free(res); - return (false); - } - return (true); - } - } + char *p, *p1, *res, *resp; + int subst_len, kw_len, subst_count, old_len, new_len; + + kw_len = strlen(kw); + + /* + * First, count the number of the keyword occurences, to + * preallocate the final string. + */ + for (p = real, subst_count = 0;; p = p1 + kw_len, subst_count++) { + p1 = strstr(p, kw); + if (p1 == NULL) + break; + } + + /* + * If the keyword is not found, just return. + */ + if (subst_count == 0) + return (may_free ? real : xstrdup(real)); + + /* + * There is indeed something to substitute. Calculate the + * length of the resulting string, and allocate it. + */ + subst_len = strlen(subst); + old_len = strlen(real); + new_len = old_len + (subst_len - kw_len) * subst_count; + res = xmalloc(new_len + 1); + + /* + * Now, execute the substitution loop. + */ + for (p = real, resp = res;;) { + p1 = strstr(p, kw); + if (p1 != NULL) { + /* Copy the prefix before keyword. */ + memcpy(resp, p, p1 - p); + resp += p1 - p; + /* Keyword replacement. */ + memcpy(resp, subst, subst_len); + resp += subst_len; + p = p1 + kw_len; + } else + break; + } + + /* Copy to the end of string and finish. */ + strcat(resp, p); + if (may_free) + free(real); + return (res); } static char * -origin_subst(const char *real, const char *origin_path) +origin_subst(char *real, const char *origin_path) { - char *res1, *res2, *res3, *res4; + char *res1, *res2, *res3, *res4; - if (uts.sysname[0] == '\0') { - if (uname(&uts) != 0) { - _rtld_error("utsname failed: %d", errno); - return (NULL); + if (uts.sysname[0] == '\0') { + if (uname(&uts) != 0) { + _rtld_error("utsname failed: %d", errno); + return (NULL); + } } - } - if (!origin_subst_one(&res1, real, "$ORIGIN", origin_path, NULL) || - !origin_subst_one(&res2, res1, "$OSNAME", uts.sysname, res1) || - !origin_subst_one(&res3, res2, "$OSREL", uts.release, res2) || - !origin_subst_one(&res4, res3, "$PLATFORM", uts.machine, res3)) - return (NULL); - return (res4); + res1 = origin_subst_one(real, "$ORIGIN", origin_path, false); + res2 = origin_subst_one(res1, "$OSNAME", uts.sysname, true); + res3 = origin_subst_one(res2, "$OSREL", uts.release, true); + res4 = origin_subst_one(res3, "$PLATFORM", uts.machine, true); + return (res4); } static void @@ -1438,10 +1438,12 @@ find_library(const char *xname, const Ob xname); return NULL; } - if (objgiven && refobj->z_origin) - return origin_subst(xname, refobj->origin_path); - else - return xstrdup(xname); + if (objgiven && refobj->z_origin) { + return (origin_subst(__DECONST(char *, xname), + refobj->origin_path)); + } else { + return (xstrdup(xname)); + } } if (libmap_disable || !objgiven || From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 10:20:46 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 97039CF3; Mon, 29 Apr 2013 10:20:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 89F15167C; Mon, 29 Apr 2013 10:20:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TAKkuv053904; Mon, 29 Apr 2013 10:20:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TAKkLA053903; Mon, 29 Apr 2013 10:20:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201304291020.r3TAKkLA053903@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 29 Apr 2013 10: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 Subject: svn commit: r250043 - stable/9/sys/boot/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 10:20:46 -0000 Author: ae Date: Mon Apr 29 10:20:46 2013 New Revision: 250043 URL: http://svnweb.freebsd.org/changeset/base/250043 Log: MFC r249719: Since we didn't break the loop, we should set i to -1 to start from the beginning. Submitted by: Steven Hartland Modified: stable/9/sys/boot/common/module.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/common/module.c ============================================================================== --- stable/9/sys/boot/common/module.c Mon Apr 29 08:21:32 2013 (r250042) +++ stable/9/sys/boot/common/module.c Mon Apr 29 10:20:46 2013 (r250043) @@ -289,7 +289,8 @@ file_load(char *filename, vm_offset_t de break; } else if (last_file_format == i && i != 0) { /* Restart from the beginning */ - last_file_format = i = 0; + i = -1; + last_file_format = 0; fp = NULL; continue; } From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 10:52:48 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CCC14A2D; Mon, 29 Apr 2013 10:52:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BDD3C17E1; Mon, 29 Apr 2013 10:52:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TAqme5065071; Mon, 29 Apr 2013 10:52:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TAqjmL065045; Mon, 29 Apr 2013 10:52:45 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201304291052.r3TAqjmL065045@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 29 Apr 2013 10:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250044 - in stable/9: sys/net sys/netinet sys/netinet6 sys/netipsec usr.bin/netstat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 10:52:48 -0000 Author: ae Date: Mon Apr 29 10:52:45 2013 New Revision: 250044 URL: http://svnweb.freebsd.org/changeset/base/250044 Log: MFC r249294: Use IP6STAT_INC/IP6STAT_DEC macros to update ip6 stats. MFC r249528,249546: Add accounting to the source address selection algorithm for cases, when it fails to select an address, also add several another counters to the statistics. MFC r249543,249552: Replace hardcoded numbers. MFC r249544: Use IP6S_M2MMAX macro. MFC r249545: Replace hardcoded numbers. Also use interface-local scope name instead of node-local. Modified: stable/9/sys/net/if_bridge.c stable/9/sys/netinet/ip6.h stable/9/sys/netinet6/dest6.c stable/9/sys/netinet6/frag6.c stable/9/sys/netinet6/in6_gif.c stable/9/sys/netinet6/in6_src.c stable/9/sys/netinet6/ip6_forward.c stable/9/sys/netinet6/ip6_input.c stable/9/sys/netinet6/ip6_ipsec.c stable/9/sys/netinet6/ip6_mroute.c stable/9/sys/netinet6/ip6_output.c stable/9/sys/netinet6/ip6_var.h stable/9/sys/netinet6/raw_ip6.c stable/9/sys/netinet6/route6.c stable/9/sys/netipsec/ipsec_input.c stable/9/sys/netipsec/ipsec_output.c stable/9/usr.bin/netstat/inet6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) stable/9/usr.bin/netstat/ (props changed) Modified: stable/9/sys/net/if_bridge.c ============================================================================== --- stable/9/sys/net/if_bridge.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/net/if_bridge.c Mon Apr 29 10:52:45 2013 (r250044) @@ -3397,14 +3397,14 @@ bridge_ip6_checkbasic(struct mbuf **mp) if ((m = m_copyup(m, sizeof(struct ip6_hdr), (max_linkhdr + 3) & ~3)) == NULL) { /* XXXJRT new stat, please */ - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); in6_ifstat_inc(inifp, ifs6_in_hdrerr); goto bad; } } else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) { struct ifnet *inifp = m->m_pkthdr.rcvif; if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); in6_ifstat_inc(inifp, ifs6_in_hdrerr); goto bad; } @@ -3413,7 +3413,7 @@ bridge_ip6_checkbasic(struct mbuf **mp) ip6 = mtod(m, struct ip6_hdr *); if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { - V_ip6stat.ip6s_badvers++; + IP6STAT_INC(ip6s_badvers); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); goto bad; } Modified: stable/9/sys/netinet/ip6.h ============================================================================== --- stable/9/sys/netinet/ip6.h Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet/ip6.h Mon Apr 29 10:52:45 2013 (r250044) @@ -275,24 +275,24 @@ do { \ if (((m)->m_flags & M_LOOP) && \ ((m)->m_len < (off) + (hlen)) && \ (((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \ - V_ip6stat.ip6s_exthdrtoolong++; \ + IP6STAT_INC(ip6s_exthdrtoolong); \ return ret; \ } else if ((m)->m_flags & M_EXT) { \ if ((m)->m_len < (off) + (hlen)) { \ - V_ip6stat.ip6s_exthdrtoolong++; \ + IP6STAT_INC(ip6s_exthdrtoolong); \ m_freem(m); \ return ret; \ } \ } else { \ if ((m)->m_len < (off) + (hlen)) { \ - V_ip6stat.ip6s_exthdrtoolong++; \ + IP6STAT_INC(ip6s_exthdrtoolong); \ m_freem(m); \ return ret; \ } \ } \ } else { \ if ((m)->m_len < (off) + (hlen)) { \ - V_ip6stat.ip6s_tooshort++; \ + IP6STAT_INC(ip6s_tooshort); \ in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \ m_freem(m); \ return ret; \ Modified: stable/9/sys/netinet6/dest6.c ============================================================================== --- stable/9/sys/netinet6/dest6.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/dest6.c Mon Apr 29 10:52:45 2013 (r250044) @@ -93,7 +93,7 @@ dest6_input(struct mbuf **mp, int *offp, for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) { if (*opt != IP6OPT_PAD1 && (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) { - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); goto bad; } Modified: stable/9/sys/netinet6/frag6.c ============================================================================== --- stable/9/sys/netinet6/frag6.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/frag6.c Mon Apr 29 10:52:45 2013 (r250044) @@ -215,7 +215,7 @@ frag6_input(struct mbuf **mp, int *offp, return IPPROTO_DONE; } - V_ip6stat.ip6s_fragments++; + IP6STAT_INC(ip6s_fragments); in6_ifstat_inc(dstifp, ifs6_reass_reqd); /* offset now points to data portion */ @@ -228,7 +228,7 @@ frag6_input(struct mbuf **mp, int *offp, */ if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) { /* XXX-BZ we want dedicated counters for this. */ - V_ip6stat.ip6s_reassembled++; + IP6STAT_INC(ip6s_reassembled); in6_ifstat_inc(dstifp, ifs6_reass_ok); *offp = offset; return (ip6f->ip6f_nxt); @@ -603,7 +603,7 @@ insert: m->m_pkthdr.len = plen; } - V_ip6stat.ip6s_reassembled++; + IP6STAT_INC(ip6s_reassembled); in6_ifstat_inc(dstifp, ifs6_reass_ok); /* @@ -619,7 +619,7 @@ insert: dropfrag: IP6Q_UNLOCK(); in6_ifstat_inc(dstifp, ifs6_reass_fail); - V_ip6stat.ip6s_fragdropped++; + IP6STAT_INC(ip6s_fragdropped); m_freem(m); return IPPROTO_DONE; } @@ -743,7 +743,7 @@ frag6_slowtimo(void) --q6->ip6q_ttl; q6 = q6->ip6q_next; if (q6->ip6q_prev->ip6q_ttl == 0) { - V_ip6stat.ip6s_fragtimeout++; + IP6STAT_INC(ip6s_fragtimeout); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ frag6_freef(q6->ip6q_prev); } @@ -755,7 +755,7 @@ frag6_slowtimo(void) */ while (V_frag6_nfragpackets > (u_int)V_ip6_maxfragpackets && V_ip6q.ip6q_prev) { - V_ip6stat.ip6s_fragoverflow++; + IP6STAT_INC(ip6s_fragoverflow); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ frag6_freef(V_ip6q.ip6q_prev); } @@ -781,7 +781,7 @@ frag6_drain(void) VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); while (V_ip6q.ip6q_next != &V_ip6q) { - V_ip6stat.ip6s_fragdropped++; + IP6STAT_INC(ip6s_fragdropped); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ frag6_freef(V_ip6q.ip6q_next); } Modified: stable/9/sys/netinet6/in6_gif.c ============================================================================== --- stable/9/sys/netinet6/in6_gif.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/in6_gif.c Mon Apr 29 10:52:45 2013 (r250044) @@ -301,14 +301,14 @@ in6_gif_input(struct mbuf **mp, int *off sc = (struct gif_softc *)encap_getarg(m); if (sc == NULL) { m_freem(m); - V_ip6stat.ip6s_nogif++; + IP6STAT_INC(ip6s_nogif); return IPPROTO_DONE; } gifp = GIF2IFP(sc); if (gifp == NULL || (gifp->if_flags & IFF_UP) == 0) { m_freem(m); - V_ip6stat.ip6s_nogif++; + IP6STAT_INC(ip6s_nogif); return IPPROTO_DONE; } @@ -363,7 +363,7 @@ in6_gif_input(struct mbuf **mp, int *off break; default: - V_ip6stat.ip6s_nogif++; + IP6STAT_INC(ip6s_nogif); m_freem(m); return IPPROTO_DONE; } Modified: stable/9/sys/netinet6/in6_src.c ============================================================================== --- stable/9/sys/netinet6/in6_src.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/in6_src.c Mon Apr 29 10:52:45 2013 (r250044) @@ -151,9 +151,8 @@ static struct in6_addrpolicy *match_addr * an entry to the caller for later use. */ #define REPLACE(r) do {\ - if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ - sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - V_ip6stat.ip6s_sources_rule[(r)]++; \ + IP6STAT_INC(ip6s_sources_rule[(r)]); \ + rule = (r); \ /* { \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ @@ -161,9 +160,6 @@ static struct in6_addrpolicy *match_addr goto replace; \ } while(0) #define NEXT(r) do {\ - if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ - sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - V_ip6stat.ip6s_sources_rule[(r)]++; \ /* { \ char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \ printf("in6_selectsrc: keep %s against %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \ @@ -171,9 +167,8 @@ static struct in6_addrpolicy *match_addr goto next; /* XXX: we can't use 'continue' here */ \ } while(0) #define BREAK(r) do { \ - if ((r) < sizeof(V_ip6stat.ip6s_sources_rule) / \ - sizeof(V_ip6stat.ip6s_sources_rule[0])) /* check for safety */ \ - V_ip6stat.ip6s_sources_rule[(r)]++; \ + IP6STAT_INC(ip6s_sources_rule[(r)]); \ + rule = (r); \ goto out; /* XXX: we can't use 'break' here */ \ } while(0) @@ -190,7 +185,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL; u_int32_t odstzone; int prefer_tempaddr; - int error; + int error, rule; struct ip6_moptions *mopts; KASSERT(srcp != NULL, ("%s: srcp is NULL", __func__)); @@ -306,6 +301,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if (error) return (error); + rule = 0; IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int new_scope = -1, new_matchlen = -1; @@ -487,6 +483,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if ((ia = ia_best) == NULL) { IN6_IFADDR_RUNLOCK(); + IP6STAT_INC(ip6s_sources_none); return (EADDRNOTAVAIL); } @@ -503,6 +500,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if (cred != NULL && prison_local_ip6(cred, &tmp, (inp != NULL && (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0) { IN6_IFADDR_RUNLOCK(); + IP6STAT_INC(ip6s_sources_none); return (EADDRNOTAVAIL); } @@ -510,6 +508,16 @@ in6_selectsrc(struct sockaddr_in6 *dstso *ifpp = ifp; bcopy(&tmp, srcp, sizeof(*srcp)); + if (ia->ia_ifp == ifp) + IP6STAT_INC(ip6s_sources_sameif[best_scope]); + else + IP6STAT_INC(ip6s_sources_otherif[best_scope]); + if (dst_scope == best_scope) + IP6STAT_INC(ip6s_sources_samescope[best_scope]); + else + IP6STAT_INC(ip6s_sources_otherscope[best_scope]); + if (IFA6_IS_DEPRECATED(ia)) + IP6STAT_INC(ip6s_sources_deprecated[best_scope]); IN6_IFADDR_RUNLOCK(); return (0); } @@ -733,7 +741,7 @@ selectroute(struct sockaddr_in6 *dstsock error = EHOSTUNREACH; } if (error == EHOSTUNREACH) - V_ip6stat.ip6s_noroute++; + IP6STAT_INC(ip6s_noroute); if (retifp != NULL) { *retifp = ifp; Modified: stable/9/sys/netinet6/ip6_forward.c ============================================================================== --- stable/9/sys/netinet6/ip6_forward.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/ip6_forward.c Mon Apr 29 10:52:45 2013 (r250044) @@ -135,7 +135,7 @@ ip6_forward(struct mbuf *m, int srcrt) if ((m->m_flags & (M_BCAST|M_MCAST)) != 0 || IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); /* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */ if (V_ip6_log_time + V_ip6_log_interval < time_second) { V_ip6_log_time = time_second; @@ -183,7 +183,7 @@ ip6_forward(struct mbuf *m, int srcrt) IP_FORWARDING, &error); if (sp == NULL) { V_ipsec6stat.out_inval++; - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); if (mcopy) { #if 0 /* XXX: what icmp ? */ @@ -204,7 +204,7 @@ ip6_forward(struct mbuf *m, int srcrt) * This packet is just discarded. */ V_ipsec6stat.out_polvio++; - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); KEY_FREESP(&sp); if (mcopy) { #if 0 @@ -226,7 +226,7 @@ ip6_forward(struct mbuf *m, int srcrt) if (sp->req == NULL) { /* XXX should be panic ? */ printf("ip6_forward: No IPsec request specified.\n"); - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); KEY_FREESP(&sp); if (mcopy) { #if 0 @@ -310,7 +310,7 @@ ip6_forward(struct mbuf *m, int srcrt) /* don't show these error codes to the user */ break; } - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); if (mcopy) { #if 0 /* XXX: what icmp ? */ @@ -362,7 +362,7 @@ again2: if (rin6.ro_rt != NULL) RT_UNLOCK(rin6.ro_rt); else { - V_ip6stat.ip6s_noroute++; + IP6STAT_INC(ip6s_noroute); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute); if (mcopy) { icmp6_error(mcopy, ICMP6_DST_UNREACH, @@ -387,13 +387,13 @@ skip_routing: src_in6 = ip6->ip6_src; if (in6_setscope(&src_in6, rt->rt_ifp, &outzone)) { /* XXX: this should not happen */ - V_ip6stat.ip6s_cantforward++; - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_cantforward); + IP6STAT_INC(ip6s_badscope); goto bad; } if (in6_setscope(&src_in6, m->m_pkthdr.rcvif, &inzone)) { - V_ip6stat.ip6s_cantforward++; - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_cantforward); + IP6STAT_INC(ip6s_badscope); goto bad; } if (inzone != outzone @@ -401,8 +401,8 @@ skip_routing: && !ipsecrt #endif ) { - V_ip6stat.ip6s_cantforward++; - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_cantforward); + IP6STAT_INC(ip6s_badscope); in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard); if (V_ip6_log_time + V_ip6_log_interval < time_second) { @@ -432,8 +432,8 @@ skip_routing: if (in6_setscope(&dst_in6, m->m_pkthdr.rcvif, &inzone) != 0 || in6_setscope(&dst_in6, rt->rt_ifp, &outzone) != 0 || inzone != outzone) { - V_ip6stat.ip6s_cantforward++; - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_cantforward); + IP6STAT_INC(ip6s_badscope); goto bad; } @@ -623,12 +623,12 @@ pass: error = nd6_output(rt->rt_ifp, origifp, m, dst, rt); if (error) { in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard); - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); } else { - V_ip6stat.ip6s_forward++; + IP6STAT_INC(ip6s_forward); in6_ifstat_inc(rt->rt_ifp, ifs6_out_forward); if (type) - V_ip6stat.ip6s_redirectsent++; + IP6STAT_INC(ip6s_redirectsent); else { if (mcopy) goto freecopy; Modified: stable/9/sys/netinet6/ip6_input.c ============================================================================== --- stable/9/sys/netinet6/ip6_input.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/ip6_input.c Mon Apr 29 10:52:45 2013 (r250044) @@ -357,7 +357,7 @@ ip6_input_hbh(struct mbuf *m, uint32_t * * contained, ip6_hopopts_input() must set a valid * (non-zero) payload length to the variable plen. */ - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); icmp6_error(m, ICMP6_PARAM_PROB, @@ -372,7 +372,7 @@ ip6_input_hbh(struct mbuf *m, uint32_t * IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); if (hbh == NULL) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); goto out; } #endif @@ -455,21 +455,20 @@ ip6_input(struct mbuf *m) */ if (m->m_flags & M_EXT) { if (m->m_next) - V_ip6stat.ip6s_mext2m++; + IP6STAT_INC(ip6s_mext2m); else - V_ip6stat.ip6s_mext1++; + IP6STAT_INC(ip6s_mext1); } else { -#define M2MMAX (sizeof(V_ip6stat.ip6s_m2m)/sizeof(V_ip6stat.ip6s_m2m[0])) if (m->m_next) { if (m->m_flags & M_LOOP) { - V_ip6stat.ip6s_m2m[V_loif->if_index]++; - } else if (m->m_pkthdr.rcvif->if_index < M2MMAX) - V_ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; + IP6STAT_INC(ip6s_m2m[V_loif->if_index]); + } else if (m->m_pkthdr.rcvif->if_index < IP6S_M2MMAX) + IP6STAT_INC( + ip6s_m2m[m->m_pkthdr.rcvif->if_index]); else - V_ip6stat.ip6s_m2m[0]++; + IP6STAT_INC(ip6s_m2m[0]); } else - V_ip6stat.ip6s_m1++; -#undef M2MMAX + IP6STAT_INC(ip6s_m1); } /* drop the packet if IPv6 operation is disabled on the IF */ @@ -479,7 +478,7 @@ ip6_input(struct mbuf *m) } in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); - V_ip6stat.ip6s_total++; + IP6STAT_INC(ip6s_total); #ifndef PULLDOWN_TEST /* @@ -517,7 +516,7 @@ ip6_input(struct mbuf *m) struct ifnet *inifp; inifp = m->m_pkthdr.rcvif; if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); in6_ifstat_inc(inifp, ifs6_in_hdrerr); return; } @@ -526,12 +525,12 @@ ip6_input(struct mbuf *m) ip6 = mtod(m, struct ip6_hdr *); if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { - V_ip6stat.ip6s_badvers++; + IP6STAT_INC(ip6s_badvers); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); goto bad; } - V_ip6stat.ip6s_nxthist[ip6->ip6_nxt]++; + IP6STAT_INC(ip6s_nxthist[ip6->ip6_nxt]); /* * Check against address spoofing/corruption. @@ -541,7 +540,7 @@ ip6_input(struct mbuf *m) /* * XXX: "badscope" is not very suitable for a multicast source. */ - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -553,7 +552,7 @@ ip6_input(struct mbuf *m) * because ip6_mloopback() passes the "actual" interface * as the outgoing/incoming interface. */ - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -578,7 +577,7 @@ ip6_input(struct mbuf *m) */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -592,7 +591,7 @@ ip6_input(struct mbuf *m) */ if (IN6_IS_ADDR_V4COMPAT(&ip6->ip6_src) || IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -655,12 +654,12 @@ passin: * is not loopback. */ if (in6_clearscope(&ip6->ip6_src) || in6_clearscope(&ip6->ip6_dst)) { - V_ip6stat.ip6s_badscope++; /* XXX */ + IP6STAT_INC(ip6s_badscope); /* XXX */ goto bad; } if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) || in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) { - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); goto bad; } @@ -864,7 +863,7 @@ passin: * and we're not a router. */ if (!V_ip6_forwarding) { - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } @@ -918,7 +917,7 @@ passin: * Drop packet if shorter than we expect. */ if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); goto bad; } @@ -970,7 +969,7 @@ passin: */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } @@ -978,13 +977,13 @@ passin: /* * Tell launch routine the next header */ - V_ip6stat.ip6s_delivered++; + IP6STAT_INC(ip6s_delivered); in6_ifstat_inc(deliverifp, ifs6_in_deliver); nest = 0; while (nxt != IPPROTO_DONE) { if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) { - V_ip6stat.ip6s_toomanyhdr++; + IP6STAT_INC(ip6s_toomanyhdr); goto bad; } @@ -993,7 +992,7 @@ passin: * more sanity checks in header chain processing. */ if (m->m_pkthdr.len < off) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); goto bad; } @@ -1087,14 +1086,14 @@ ip6_hopopts_input(u_int32_t *plenp, u_in IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), sizeof(struct ip6_hbh)); if (hbh == NULL) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); return -1; } hbhlen = (hbh->ip6h_len + 1) << 3; IP6_EXTHDR_GET(hbh, struct ip6_hbh *, m, sizeof(struct ip6_hdr), hbhlen); if (hbh == NULL) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); return -1; } #endif @@ -1139,7 +1138,7 @@ ip6_process_hopopts(struct mbuf *m, u_in break; case IP6OPT_PADN: if (hbhlen < IP6OPT_MINLEN) { - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); goto bad; } optlen = *(opt + 1) + 2; @@ -1147,7 +1146,7 @@ ip6_process_hopopts(struct mbuf *m, u_in case IP6OPT_ROUTER_ALERT: /* XXX may need check for alignment */ if (hbhlen < IP6OPT_RTALERT_LEN) { - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); goto bad; } if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2) { @@ -1164,7 +1163,7 @@ ip6_process_hopopts(struct mbuf *m, u_in case IP6OPT_JUMBO: /* XXX may need check for alignment */ if (hbhlen < IP6OPT_JUMBO_LEN) { - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); goto bad; } if (*(opt + 1) != IP6OPT_JUMBO_LEN - 2) { @@ -1182,7 +1181,7 @@ ip6_process_hopopts(struct mbuf *m, u_in */ ip6 = mtod(m, struct ip6_hdr *); if (ip6->ip6_plen) { - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, erroff + opt - opthead); @@ -1206,7 +1205,7 @@ ip6_process_hopopts(struct mbuf *m, u_in * there's no explicit mention in specification. */ if (*plenp != 0) { - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, erroff + opt + 2 - opthead); @@ -1218,7 +1217,7 @@ ip6_process_hopopts(struct mbuf *m, u_in * jumbo payload length must be larger than 65535. */ if (jumboplen <= IPV6_MAXPACKET) { - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, erroff + opt + 2 - opthead); @@ -1229,7 +1228,7 @@ ip6_process_hopopts(struct mbuf *m, u_in break; default: /* unknown option */ if (hbhlen < IP6OPT_MINLEN) { - V_ip6stat.ip6s_toosmall++; + IP6STAT_INC(ip6s_toosmall); goto bad; } optlen = ip6_unknown_opt(opt, m, @@ -1266,11 +1265,11 @@ ip6_unknown_opt(u_int8_t *optp, struct m m_freem(m); return (-1); case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */ - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off); return (-1); case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */ - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); ip6 = mtod(m, struct ip6_hdr *); if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || (m->m_flags & (M_BCAST|M_MCAST))) @@ -1449,14 +1448,14 @@ ip6_savecontrol(struct inpcb *in6p, stru ext = ip6_pullexthdr(m, sizeof(struct ip6_hdr), ip6->ip6_nxt); if (ext == NULL) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); return; } hbh = mtod(ext, struct ip6_hbh *); hbhlen = (hbh->ip6h_len + 1) << 3; if (hbhlen != ext->m_len) { m_freem(ext); - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); return; } #endif @@ -1523,7 +1522,7 @@ ip6_savecontrol(struct inpcb *in6p, stru #else ext = ip6_pullexthdr(m, off, nxt); if (ext == NULL) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); return; } ip6e = mtod(ext, struct ip6_ext *); @@ -1533,7 +1532,7 @@ ip6_savecontrol(struct inpcb *in6p, stru elen = (ip6e->ip6e_len + 1) << 3; if (elen != ext->m_len) { m_freem(ext); - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); return; } #endif Modified: stable/9/sys/netinet6/ip6_ipsec.c ============================================================================== --- stable/9/sys/netinet6/ip6_ipsec.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/ip6_ipsec.c Mon Apr 29 10:52:45 2013 (r250044) @@ -152,7 +152,7 @@ ip6_ipsec_fwd(struct mbuf *m) KEY_FREESP(&sp); splx(s); if (error) { - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); return 1; } #endif /* IPSEC */ Modified: stable/9/sys/netinet6/ip6_mroute.c ============================================================================== --- stable/9/sys/netinet6/ip6_mroute.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/ip6_mroute.c Mon Apr 29 10:52:45 2013 (r250044) @@ -1100,7 +1100,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru * (although such packets must normally set 1 to the hop limit field). */ if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { - V_ip6stat.ip6s_cantforward++; + IP6STAT_INC(ip6s_cantforward); if (V_ip6_log_time + V_ip6_log_interval < time_second) { V_ip6_log_time = time_second; log(LOG_DEBUG, @@ -1535,7 +1535,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *if dst0 = ip6->ip6_dst; if ((error = in6_setscope(&src0, ifp, &iszone)) != 0 || (error = in6_setscope(&dst0, ifp, &idzone)) != 0) { - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); return (error); } for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++) { @@ -1555,7 +1555,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *if &odzone) || iszone != oszone || idzone != odzone) { - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); continue; } } Modified: stable/9/sys/netinet6/ip6_output.c ============================================================================== --- stable/9/sys/netinet6/ip6_output.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/ip6_output.c Mon Apr 29 10:52:45 2013 (r250044) @@ -498,16 +498,16 @@ skip_ipsec2:; if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) && (flags & IPV6_UNSPECSRC) == 0) { error = EOPNOTSUPP; - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); goto bad; } if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) { error = EOPNOTSUPP; - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); goto bad; } - V_ip6stat.ip6s_localout++; + IP6STAT_INC(ip6s_localout); /* * Route packet. @@ -713,7 +713,7 @@ again: goto routefound; badscope: - V_ip6stat.ip6s_badscope++; + IP6STAT_INC(ip6s_badscope); in6_ifstat_inc(origifp, ifs6_out_discard); if (error == 0) error = EHOSTUNREACH; /* XXX */ @@ -742,7 +742,7 @@ again: * Confirm that the outgoing interface supports multicast. */ if (!(ifp->if_flags & IFF_MULTICAST)) { - V_ip6stat.ip6s_noroute++; + IP6STAT_INC(ip6s_noroute); in6_ifstat_inc(ifp, ifs6_out_discard); error = ENETUNREACH; goto bad; @@ -1075,7 +1075,7 @@ passout: if (qslots <= 0 || ((u_int)qslots * (mtu - hlen) < tlen /* - hlen */)) { error = ENOBUFS; - V_ip6stat.ip6s_odropped++; + IP6STAT_INC(ip6s_odropped); goto bad; } @@ -1125,7 +1125,7 @@ passout: MGETHDR(m, M_DONTWAIT, MT_HEADER); if (!m) { error = ENOBUFS; - V_ip6stat.ip6s_odropped++; + IP6STAT_INC(ip6s_odropped); goto sendorfree; } m->m_pkthdr.rcvif = NULL; @@ -1138,7 +1138,7 @@ passout: m->m_len = sizeof(*mhip6); error = ip6_insertfraghdr(m0, m, hlen, &ip6f); if (error) { - V_ip6stat.ip6s_odropped++; + IP6STAT_INC(ip6s_odropped); goto sendorfree; } ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7)); @@ -1150,7 +1150,7 @@ passout: sizeof(*ip6f) - sizeof(struct ip6_hdr))); if ((m_frgpart = m_copy(m0, off, len)) == 0) { error = ENOBUFS; - V_ip6stat.ip6s_odropped++; + IP6STAT_INC(ip6s_odropped); goto sendorfree; } m_cat(m, m_frgpart); @@ -1159,7 +1159,7 @@ passout: ip6f->ip6f_reserved = 0; ip6f->ip6f_ident = id; ip6f->ip6f_nxt = nextproto; - V_ip6stat.ip6s_ofragments++; + IP6STAT_INC(ip6s_ofragments); in6_ifstat_inc(ifp, ifs6_out_fragcreat); } @@ -1188,7 +1188,7 @@ sendorfree: } if (error == 0) - V_ip6stat.ip6s_fragmented++; + IP6STAT_INC(ip6s_fragmented); done: if (ro == &ip6route) Modified: stable/9/sys/netinet6/ip6_var.h ============================================================================== --- stable/9/sys/netinet6/ip6_var.h Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/ip6_var.h Mon Apr 29 10:52:45 2013 (r250044) @@ -204,9 +204,11 @@ struct ip6stat { u_quad_t ip6s_rawout; /* total raw ip packets generated */ u_quad_t ip6s_badscope; /* scope error */ u_quad_t ip6s_notmember; /* don't join this multicast group */ - u_quad_t ip6s_nxthist[256]; /* next header history */ +#define IP6S_HDRCNT 256 /* headers count */ + u_quad_t ip6s_nxthist[IP6S_HDRCNT]; /* next header history */ u_quad_t ip6s_m1; /* one mbuf */ - u_quad_t ip6s_m2m[32]; /* two or more mbuf */ +#define IP6S_M2MMAX 32 + u_quad_t ip6s_m2m[IP6S_M2MMAX]; /* two or more mbuf */ u_quad_t ip6s_mext1; /* one ext mbuf */ u_quad_t ip6s_mext2m; /* two or more ext mbuf */ u_quad_t ip6s_exthdrtoolong; /* ext hdr are not contiguous */ @@ -218,27 +220,29 @@ struct ip6stat { * algorithm: * XXX: hardcoded 16 = # of ip6 multicast scope types + 1 */ +#define IP6S_RULESMAX 16 +#define IP6S_SCOPECNT 16 /* number of times that address selection fails */ u_quad_t ip6s_sources_none; /* number of times that an address on the outgoing I/F is chosen */ - u_quad_t ip6s_sources_sameif[16]; + u_quad_t ip6s_sources_sameif[IP6S_SCOPECNT]; /* number of times that an address on a non-outgoing I/F is chosen */ - u_quad_t ip6s_sources_otherif[16]; + u_quad_t ip6s_sources_otherif[IP6S_SCOPECNT]; /* * number of times that an address that has the same scope * from the destination is chosen. */ - u_quad_t ip6s_sources_samescope[16]; + u_quad_t ip6s_sources_samescope[IP6S_SCOPECNT]; /* * number of times that an address that has a different scope * from the destination is chosen. */ - u_quad_t ip6s_sources_otherscope[16]; + u_quad_t ip6s_sources_otherscope[IP6S_SCOPECNT]; /* number of times that a deprecated address is chosen */ - u_quad_t ip6s_sources_deprecated[16]; + u_quad_t ip6s_sources_deprecated[IP6S_SCOPECNT]; /* number of times that each rule of source selection is applied. */ - u_quad_t ip6s_sources_rule[16]; + u_quad_t ip6s_sources_rule[IP6S_RULESMAX]; }; #ifdef _KERNEL Modified: stable/9/sys/netinet6/raw_ip6.c ============================================================================== --- stable/9/sys/netinet6/raw_ip6.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/raw_ip6.c Mon Apr 29 10:52:45 2013 (r250044) @@ -296,7 +296,7 @@ rip6_input(struct mbuf **mp, int *offp, if ((last != NULL) && ipsec6_in_reject(m, last)) { m_freem(m); V_ipsec6stat.in_polvio++; - V_ip6stat.ip6s_delivered--; + IP6STAT_DEC(ip6s_delivered); /* Do not inject data into pcb. */ INP_RUNLOCK(last); } else @@ -328,7 +328,7 @@ rip6_input(struct mbuf **mp, int *offp, ICMP6_PARAMPROB_NEXTHEADER, prvnxtp - mtod(m, char *)); } - V_ip6stat.ip6s_delivered--; + IP6STAT_DEC(ip6s_delivered); } return (IPPROTO_DONE); } Modified: stable/9/sys/netinet6/route6.c ============================================================================== --- stable/9/sys/netinet6/route6.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netinet6/route6.c Mon Apr 29 10:52:45 2013 (r250044) @@ -69,7 +69,7 @@ route6_input(struct mbuf **mp, int *offp if (ip6a) { /* XXX reject home-address option before rthdr */ if (ip6a->ip6a_flags & IP6A_SWAP) { - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); m_freem(m); return IPPROTO_DONE; } @@ -84,7 +84,7 @@ route6_input(struct mbuf **mp, int *offp ip6 = mtod(m, struct ip6_hdr *); IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); if (rh == NULL) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); return IPPROTO_DONE; } #endif @@ -100,7 +100,7 @@ route6_input(struct mbuf **mp, int *offp rhlen = (rh->ip6r_len + 1) << 3; break; /* Final dst. Just ignore the header. */ } - V_ip6stat.ip6s_badoptions++; + IP6STAT_INC(ip6s_badoptions); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, (caddr_t)&rh->ip6r_type - (caddr_t)ip6); return (IPPROTO_DONE); Modified: stable/9/sys/netipsec/ipsec_input.c ============================================================================== --- stable/9/sys/netipsec/ipsec_input.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netipsec/ipsec_input.c Mon Apr 29 10:52:45 2013 (r250044) @@ -768,7 +768,7 @@ ipsec6_common_input_cb(struct mbuf *m, s nxt = nxt8; while (nxt != IPPROTO_DONE) { if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) { - V_ip6stat.ip6s_toomanyhdr++; + IP6STAT_INC(ip6s_toomanyhdr); error = EINVAL; goto bad; } @@ -778,7 +778,7 @@ ipsec6_common_input_cb(struct mbuf *m, s * more sanity checks in header chain processing. */ if (m->m_pkthdr.len < skip) { - V_ip6stat.ip6s_tooshort++; + IP6STAT_INC(ip6s_tooshort); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); error = EINVAL; goto bad; Modified: stable/9/sys/netipsec/ipsec_output.c ============================================================================== --- stable/9/sys/netipsec/ipsec_output.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/sys/netipsec/ipsec_output.c Mon Apr 29 10:52:45 2013 (r250044) @@ -869,7 +869,7 @@ ipsec6_output_tunnel(struct ipsec_output rtalloc_ign_fib(state->ro, 0UL, M_GETFIB(m)); } if (state->ro->ro_rt == NULL) { - V_ip6stat.ip6s_noroute++; + IP6STAT_INC(ip6s_noroute); V_ipsec6stat.ips_out_noroute++; error = EHOSTUNREACH; goto bad; Modified: stable/9/usr.bin/netstat/inet6.c ============================================================================== --- stable/9/usr.bin/netstat/inet6.c Mon Apr 29 10:20:46 2013 (r250043) +++ stable/9/usr.bin/netstat/inet6.c Mon Apr 29 10:52:45 2013 (r250044) @@ -408,7 +408,7 @@ ip6_stats(u_long off, const char *name, p(ip6s_cantfrag, "\t%ju datagram%s that can't be fragmented\n"); p(ip6s_badscope, "\t%ju packet%s that violated scope rules\n"); p(ip6s_notmember, "\t%ju multicast packet%s which we don't join\n"); - for (first = 1, i = 0; i < 256; i++) + for (first = 1, i = 0; i < IP6S_HDRCNT; i++) if (ip6stat.ip6s_nxthist[i] != 0) { if (first) { printf("\tInput histogram:\n"); @@ -419,7 +419,7 @@ ip6_stats(u_long off, const char *name, } printf("\tMbuf statistics:\n"); printf("\t\t%ju one mbuf\n", (uintmax_t)ip6stat.ip6s_m1); - for (first = 1, i = 0; i < 32; i++) { + for (first = 1, i = 0; i < IP6S_M2MMAX; i++) { char ifbuf[IFNAMSIZ]; if (ip6stat.ip6s_m2m[i] != 0) { if (first) { @@ -445,7 +445,7 @@ ip6_stats(u_long off, const char *name, #define PRINT_SCOPESTAT(s,i) do {\ switch(i) { /* XXX hardcoding in each case */\ case 1:\ - p(s, "\t\t%ju node-local%s\n");\ + p(s, "\t\t%ju interface-local%s\n");\ break;\ case 2:\ p(s,"\t\t%ju link-local%s\n");\ @@ -464,7 +464,7 @@ ip6_stats(u_long off, const char *name, p(ip6s_sources_none, "\t%ju failure%s of source address selection\n"); - for (first = 1, i = 0; i < 16; i++) { + for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_sameif[i]) { if (first) { printf("\tsource addresses on an outgoing I/F\n"); @@ -473,7 +473,7 @@ ip6_stats(u_long off, const char *name, PRINT_SCOPESTAT(ip6s_sources_sameif[i], i); } } - for (first = 1, i = 0; i < 16; i++) { + for (first = 1, i = 0; i < IP6S_SCOPECNT; i++) { if (ip6stat.ip6s_sources_otherif[i]) { if (first) { printf("\tsource addresses on a non-outgoing I/F\n"); @@ -482,7 +482,7 @@ ip6_stats(u_long off, const char *name, PRINT_SCOPESTAT(ip6s_sources_otherif[i], i); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 11:35:53 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4369A745; Mon, 29 Apr 2013 11:35:53 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3453A1DD1; Mon, 29 Apr 2013 11:35:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TBZrcd080275; Mon, 29 Apr 2013 11:35:53 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TBZr5A080274; Mon, 29 Apr 2013 11:35:53 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201304291135.r3TBZr5A080274@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 29 Apr 2013 11:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250045 - stable/9/tools/tools/umastat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 11:35:53 -0000 Author: pluknet Date: Mon Apr 29 11:35:52 2013 New Revision: 250045 URL: http://svnweb.freebsd.org/changeset/base/250045 Log: Fix build. - pass a format string to printf - catch up with constifying uz_name Modified: stable/9/tools/tools/umastat/umastat.c Directory Properties: stable/9/tools/tools/umastat/ (props changed) Modified: stable/9/tools/tools/umastat/umastat.c ============================================================================== --- stable/9/tools/tools/umastat/umastat.c Mon Apr 29 10:52:45 2013 (r250044) +++ stable/9/tools/tools/umastat/umastat.c Mon Apr 29 11:35:52 2013 (r250045) @@ -79,7 +79,7 @@ kread(kvm_t *kvm, void *kvm_pointer, voi } static int -kread_string(kvm_t *kvm, void *kvm_pointer, char *buffer, int buflen) +kread_string(kvm_t *kvm, const void *kvm_pointer, char *buffer, int buflen) { ssize_t ret; int i; @@ -151,7 +151,7 @@ uma_print_keg_flags(struct uma_keg *ukp, if (ukp->uk_flags & flaginfo[i].fi_flag) { if (count++ > 0) printf(" | "); - printf(flaginfo[i].fi_name); + printf("%s", flaginfo[i].fi_name); } } From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 20:15:58 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5F572D58; Mon, 29 Apr 2013 20:15:55 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DBD581D4C; Mon, 29 Apr 2013 20:15:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TKFtHK065828; Mon, 29 Apr 2013 20:15:55 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TKFtgK065827; Mon, 29 Apr 2013 20:15:55 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201304292015.r3TKFtgK065827@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 29 Apr 2013 20:15:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250060 - stable/9/sys/fs/nfsserver X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 20:15:58 -0000 Author: des Date: Mon Apr 29 20:15:55 2013 New Revision: 250060 URL: http://svnweb.freebsd.org/changeset/base/250060 Log: Fix a bug that allows NFS clients to issue READDIR on files. PR: kern/178016 Security: CVE-2013-3266 Security: FreeBSD-SA-13:05.nfsserver Approved by: so Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdport.c Mon Apr 29 20:15:47 2013 (r250059) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.c Mon Apr 29 20:15:55 2013 (r250060) @@ -1575,6 +1575,8 @@ nfsrvd_readdir(struct nfsrv_descript *nd nd->nd_repstat = NFSERR_BAD_COOKIE; #endif } + if (!nd->nd_repstat && vp->v_type != VDIR) + nd->nd_repstat = NFSERR_NOTDIR; if (nd->nd_repstat == 0 && cnt == 0) { if (nd->nd_flag & ND_NFSV2) /* NFSv2 does not have NFSERR_TOOSMALL */ From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 20:30:30 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E8B69468; Mon, 29 Apr 2013 20:30:30 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DAE8C1DD7; Mon, 29 Apr 2013 20:30:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TKUUU6070321; Mon, 29 Apr 2013 20:30:30 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TKUUbh070319; Mon, 29 Apr 2013 20:30:30 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201304292030.r3TKUUbh070319@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 29 Apr 2013 20:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250063 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 20:30:31 -0000 Author: pluknet Date: Mon Apr 29 20:30:29 2013 New Revision: 250063 URL: http://svnweb.freebsd.org/changeset/base/250063 Log: MFC r248253: Add missed `_load' to the `if_foo_load="YES"' line. PR: docs/176915 Submitted by: Dmitry Afanasiev Modified: stable/9/share/man/man4/cas.4 stable/9/share/man/man4/sge.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/cas.4 ============================================================================== --- stable/9/share/man/man4/cas.4 Mon Apr 29 20:16:25 2013 (r250062) +++ stable/9/share/man/man4/cas.4 Mon Apr 29 20:30:29 2013 (r250063) @@ -44,7 +44,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -if_cas="YES" +if_cas_load="YES" .Ed .Sh DESCRIPTION The Modified: stable/9/share/man/man4/sge.4 ============================================================================== --- stable/9/share/man/man4/sge.4 Mon Apr 29 20:16:25 2013 (r250062) +++ stable/9/share/man/man4/sge.4 Mon Apr 29 20:30:29 2013 (r250063) @@ -43,7 +43,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -if_sge="YES" +if_sge_load="YES" .Ed .Sh DESCRIPTION The From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 21:04:37 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BE418E68; Mon, 29 Apr 2013 21:04:37 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AFDAA11CC; Mon, 29 Apr 2013 21:04:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TL4boY085352; Mon, 29 Apr 2013 21:04:37 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TL4bu6085351; Mon, 29 Apr 2013 21:04:37 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201304292104.r3TL4bu6085351@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 29 Apr 2013 21:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250066 - stable/9/usr.sbin/config X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 21:04:37 -0000 Author: jkim Date: Mon Apr 29 21:04:37 2013 New Revision: 250066 URL: http://svnweb.freebsd.org/changeset/base/250066 Log: MFC: r248777 Loosen restrictions for quoted strings. Now we can use more complex strings and "escaped" quote characters. Modified: stable/9/usr.sbin/config/main.c Directory Properties: stable/9/usr.sbin/config/ (props changed) Modified: stable/9/usr.sbin/config/main.c ============================================================================== --- stable/9/usr.sbin/config/main.c Mon Apr 29 20:32:09 2013 (r250065) +++ stable/9/usr.sbin/config/main.c Mon Apr 29 21:04:37 2013 (r250066) @@ -350,16 +350,24 @@ begin: if (ch == '"' || ch == '\'') { int quote = ch; + escaped_nl = 0; while ((ch = getc(fp)) != EOF) { - if (ch == quote) + if (ch == quote && !escaped_nl) break; - if (ch == '\n') { + if (ch == '\n' && !escaped_nl) { *cp = 0; printf("config: missing quote reading `%s'\n", line); exit(2); } + if (ch == '\\' && !escaped_nl) { + escaped_nl = 1; + continue; + } + if (ch != quote && escaped_nl) + *cp++ = '\\'; *cp++ = ch; + escaped_nl = 0; } } else { *cp++ = ch; From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 21:11:03 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0250560A; Mon, 29 Apr 2013 21:11:02 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 066F8129B; Mon, 29 Apr 2013 21:11:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TLB1n6090638; Mon, 29 Apr 2013 21:11:01 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TLB1Gt090637; Mon, 29 Apr 2013 21:11:01 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201304292111.r3TLB1Gt090637@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 29 Apr 2013 21:11:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250070 - stable/9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 21:11:03 -0000 Author: des Date: Mon Apr 29 21:11:01 2013 New Revision: 250070 URL: http://svnweb.freebsd.org/changeset/base/250070 Log: Fix a bug that allows NFS clients to issue READDIR on files. (files missing from previous commit) PR: kern/178016 Security: CVE-2013-3266 Security: FreeBSD-SA-13:05.nfsserver Approved by: so Modified: stable/9/UPDATING Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Mon Apr 29 21:10:53 2013 (r250069) +++ stable/9/UPDATING Mon Apr 29 21:11:01 2013 (r250070) @@ -11,6 +11,9 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20130429: + Fix a bug that allows NFS clients to issue READDIR on files. + 20130315: The install(1) option -M has changed meaning and now takes an argument that is a file or path to append logs to. In the From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 21:11:22 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4ECFD898; Mon, 29 Apr 2013 21:11:22 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41AE912AD; Mon, 29 Apr 2013 21:11:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TLBMOV090782; Mon, 29 Apr 2013 21:11:22 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TLBMh7090781; Mon, 29 Apr 2013 21:11:22 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201304292111.r3TLBMh7090781@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 29 Apr 2013 21:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250072 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 21:11:22 -0000 Author: pluknet Date: Mon Apr 29 21:11:21 2013 New Revision: 250072 URL: http://svnweb.freebsd.org/changeset/base/250072 Log: MFC r246826: Add support of passing SCM_BINTIME ancillary data object for PF_LOCAL sockets. PR: kern/175883 Submitted by: Andrey Simonenko Modified: stable/9/sys/kern/uipc_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/uipc_usrreq.c ============================================================================== --- stable/9/sys/kern/uipc_usrreq.c Mon Apr 29 21:11:05 2013 (r250071) +++ stable/9/sys/kern/uipc_usrreq.c Mon Apr 29 21:11:21 2013 (r250072) @@ -1815,6 +1815,7 @@ unp_internalize(struct mbuf **controlp, struct mbuf *control = *controlp; struct proc *p = td->td_proc; struct filedesc *fdescp = p->p_fd; + struct bintime *bt; struct cmsghdr *cm = mtod(control, struct cmsghdr *); struct cmsgcred *cmcred; struct file **rp; @@ -1923,6 +1924,18 @@ unp_internalize(struct mbuf **controlp, microtime(tv); break; + case SCM_BINTIME: + *controlp = sbcreatecontrol(NULL, sizeof(*bt), + SCM_BINTIME, SOL_SOCKET); + if (*controlp == NULL) { + error = ENOBUFS; + goto out; + } + bt = (struct bintime *) + CMSG_DATA(mtod(*controlp, struct cmsghdr *)); + bintime(bt); + break; + default: error = EINVAL; goto out; From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 21:30:05 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8F96758E; Mon, 29 Apr 2013 21:30:05 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 80DA8144E; Mon, 29 Apr 2013 21:30:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TLU5Ar096297; Mon, 29 Apr 2013 21:30:05 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TLU5GL096293; Mon, 29 Apr 2013 21:30:05 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201304292130.r3TLU5GL096293@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 29 Apr 2013 21:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250076 - stable/9/tools/regression/sockets/unix_cmsg X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 21:30:05 -0000 Author: pluknet Date: Mon Apr 29 21:30:04 2013 New Revision: 250076 URL: http://svnweb.freebsd.org/changeset/base/250076 Log: MFC r243314: Zero the whole struct not just the size of a pointer. MFC r246670: Major update for unix_cmsg. PR: bin/131567 Submitted by: Andrey Simonenko Modified: stable/9/tools/regression/sockets/unix_cmsg/README stable/9/tools/regression/sockets/unix_cmsg/unix_cmsg.c stable/9/tools/regression/sockets/unix_cmsg/unix_cmsg.t Directory Properties: stable/9/tools/regression/sockets/ (props changed) Modified: stable/9/tools/regression/sockets/unix_cmsg/README ============================================================================== --- stable/9/tools/regression/sockets/unix_cmsg/README Mon Apr 29 21:12:25 2013 (r250075) +++ stable/9/tools/regression/sockets/unix_cmsg/README Mon Apr 29 21:30:04 2013 (r250076) @@ -1,127 +1,160 @@ $FreeBSD$ About unix_cmsg -================ +=============== -This program is a collection of regression tests for ancillary (control) -data for PF_LOCAL sockets (local domain or Unix domain sockets). There -are tests for stream and datagram sockets. - -Usually each test does following steps: create Server, fork Client, -Client sends something to Server, Server verifies if everything -is correct in received message. Sometimes Client sends several -messages to Server. +This program is a collection of regression tests for ancillary data +(control information) for PF_LOCAL sockets (local domain or Unix domain +sockets). There are tests for stream and datagram sockets. + +Usually each test does following steps: creates Server, forks Client, +Client sends something to Server, Server verifies whether everything is +correct in received message(s). It is better to change the owner of unix_cmsg to some safe user -(eg. nobody:nogroup) and set SUID and SGID bits, else some tests -can give correct results for wrong implementation. +(eg. nobody:nogroup) and set SUID and SGID bits, else some tests that +check credentials can give correct results for wrong implementation. + +It is better to run this program by a user that belongs to more +than 16 groups. Available options ================= --d Output debugging information, values of different fields of - received messages, etc. Will produce many lines of information. - --h Output help message and exit. - --t - Run tests only for the given socket type: "stream" or "dgram". - With this option it is possible to run only particular test, - not all of them. - --z Do not send real control data if possible. Struct cmsghdr{} - should be followed by real control data. It is not clear if - a sender should give control data in all cases (this is not - documented and an arbitrary application can choose anything). - - At least for PF_LOCAL sockets' control messages with types - SCM_CREDS and SCM_TIMESTAMP the kernel does not need any - control data. This option allow to not send real control data - for SCM_CREDS and SCM_TIMESTAMP control messages. +usage: unix_cmsg [-dh] [-n num] [-s size] [-t type] [-z value] [testno] -Description of tests -==================== + Options are: + -d Output debugging information + -h Output the help message and exit + -n num Number of messages to send + -s size Specify size of data for IPC + -t type Specify socket type (stream, dgram) for tests + -z value Do not send data in a message (bit 0x1), do not send + data array associated with a cmsghdr structure (bit 0x2) + testno Run one test by its number (require the -t option) + +Description +=========== + +If Client sends something to Server, then it sends 5 messages by default. +Number of messages can be changed in the -n command line option. Number +of messages will be given as N in the following descriptions. + +If Client sends something to Server, then it sends some data (few bytes) +in each message by default. The size of this data can be changed by the -s +command line option. The "-s 0" command line option means, that Client will +send zero bytes represented by { NULL, 0 } value of struct iovec{}, referenced +by the msg_iov field from struct msghdr{}. The "-z 1" or "-z 3" command line +option means, that Client will send zero bytes represented by the NULL value +in the msg_iov field from struct msghdr{}. + +If Client sends some ancillary data object, then this ancillary data object +always has associated data array by default. The "-z 2" or "-z 3" option +means, that Client will not send associated data array if possible. For SOCK_STREAM sockets: ----------------------- 1: Sending, receiving cmsgcred - Client connects to Server and sends two messages with data and - control message with SCM_CREDS type to Server. Server should - receive two messages, in both messages there should be data and - control message with SCM_CREDS type followed by struct cmsgcred{} - and this structure should contain correct information. - - 2: Receiving sockcred (listening socket has LOCAL_CREDS) - - Server creates listen socket and set socket option LOCAL_CREDS - for it. Client connects to Server and sends two messages with data - to Server. Server should receive two messages, in first message - there should be data and control message with SCM_CREDS type followed - by struct sockcred{} and this structure should contain correct - information, in second message there should be data and no control - message. - - 3: Receiving sockcred (accepted socket has LOCAL_CREDS) - - Client connects to Server and sends two messages with data. Server - accepts connection and set socket option LOCAL_CREDS for just accepted - socket (here synchronization is used, to allow Client to see just set - flag on Server's socket before sending messages to Server). Server - should receive two messages, in first message there should be data and - control message with SOCK_CRED type followed by struct sockcred{} and - this structure should contain correct information, in second message - there should be data and no control message. + Client connects to Server and sends N messages with SCM_CREDS ancillary + data object. Server should receive N messages, each message should + have SCM_CREDS ancillary data object followed by struct cmsgcred{}. + + 2: Receiving sockcred (listening socket) + + Server creates a listening stream socket and sets the LOCAL_CREDS + socket option for it. Client connects to Server two times, each time + it sends N messages. Server accepts two connections and receives N + messages from each connection. The first message from each connection + should have SCM_CREDS ancillary data object followed by struct sockcred{}, + next messages from the same connection should not have ancillary data. + + 3: Receiving sockcred (accepted socket) + + Client connects to Server. Server accepts connection and sets the + LOCAL_CREDS socket option for just accepted socket. Client sends N + messages to Server. Server should receive N messages, the first + message should have SCM_CREDS ancillary data object followed by + struct sockcred{}, next messages should not have ancillary data. 4: Sending cmsgcred, receiving sockcred - Server creates listen socket and set socket option LOCAL_CREDS - for it. Client connects to Server and sends one message with data - and control message with SCM_CREDS type to Server. Server should - receive one message with data and control message with SCM_CREDS type - followed by struct sockcred{} and this structure should contain - correct information. - - 5: Sending, receiving timestamp - - Client connects to Server and sends message with data and control - message with SCM_TIMESTAMP type to Server. Server should receive - message with data and control message with SCM_TIMESTAMP type - followed by struct timeval{}. + Server creates a listening stream socket and sets the LOCAL_CREDS + socket option for it. Client connects to Server and sends N messages + with SCM_CREDS ancillary data object. Server should receive N messages, + the first message should have SCM_CREDS ancillary data object followed + by struct sockcred{}, each of next messages should have SCM_CREDS + ancillary data object followed by struct cmsgcred{}. + + 5: Sending, receiving timeval + + Client connects to Server and sends message with SCM_TIMESTAMP ancillary + data object. Server should receive one message with SCM_TIMESTAMP + ancillary data object followed by struct timeval{}. + + 6: Sending, receiving bintime + + Client connects to Server and sends message with SCM_BINTIME ancillary + data object. Server should receive one message with SCM_BINTIME + ancillary data object followed by struct bintime{}. + + 7: Checking cmsghdr.cmsg_len + + Client connects to Server and tries to send several messages with + SCM_CREDS ancillary data object that has wrong cmsg_len field in its + struct cmsghdr{}. All these attempts should fail, since cmsg_len + in all requests is less than CMSG_LEN(0). + + 8: Check LOCAL_PEERCRED socket option + + This test does not use ancillary data, but can be implemented here. + Client connects to Server. Both Client and Server verify that + credentials of the peer are correct using LOCAL_PEERCRED socket option. For SOCK_DGRAM sockets: ---------------------- 1: Sending, receiving cmsgcred - Client sends to Server two messages with data and control message - with SCM_CREDS type to Server. Server should receive two messages, - in both messages there should be data and control message with - SCM_CREDS type followed by struct cmsgcred{} and this structure - should contain correct information. + Client connects to Server and sends N messages with SCM_CREDS ancillary + data object. Server should receive N messages, each message should + have SCM_CREDS ancillary data object followed by struct cmsgcred{}. 2: Receiving sockcred - Server creates datagram socket and set socket option LOCAL_CREDS - for it. Client sends two messages with data to Server. Server should - receive two messages, in both messages there should be data and control - message with SCM_CREDS type followed by struct sockcred{} and this - structure should contain correct information. + Server creates datagram socket and sets the LOCAL_CREDS socket option + for it. Client sends N messages to Server. Server should receive N + messages, each message should have SCM_CREDS ancillary data object + followed by struct sockcred{}. 3: Sending cmsgcred, receiving sockcred - - Server creates datagram socket and set socket option LOCAL_CREDS - for it. Client sends one message with data and control message with - SOCK_CREDS type to Server. Server should receive one message with - data and control message with SCM_CREDS type followed by struct - sockcred{} and this structure should contain correct information. - - 4: Sending, receiving timestamp - - Client sends message with data and control message with SCM_TIMESTAMP - type to Server. Server should receive message with data and control - message with SCM_TIMESTAMP type followed by struct timeval{}. + + Server creates datagram socket and sets the LOCAL_CREDS socket option + for it. Client sends N messages with SCM_CREDS ancillary data object + to Server. Server should receive N messages, the first message should + have SCM_CREDS ancillary data object followed by struct sockcred{}, + each of next messages should have SCM_CREDS ancillary data object + followed by struct cmsgcred{}. + + 4: Sending, receiving timeval + + Client sends one message with SCM_TIMESTAMP ancillary data object + to Server. Server should receive one message with SCM_TIMESTAMP + ancillary data object followed by struct timeval{}. + + 5: Sending, receiving bintime + + Client sends one message with SCM_BINTIME ancillary data object + to Server. Server should receive one message with SCM_BINTIME + ancillary data object followed by struct bintime{}. + + 6: Checking cmsghdr.cmsg_len + + Client tries to send Server several messages with SCM_CREDS ancillary + data object that has wrong cmsg_len field in its struct cmsghdr{}. + All these attempts should fail, since cmsg_len in all requests is less + than CMSG_LEN(0). - Andrey Simonenko -simon@comsys.ntu-kpi.kiev.ua +andreysimonenko@users.sourceforge.net Modified: stable/9/tools/regression/sockets/unix_cmsg/unix_cmsg.c ============================================================================== --- stable/9/tools/regression/sockets/unix_cmsg/unix_cmsg.c Mon Apr 29 21:12:25 2013 (r250075) +++ stable/9/tools/regression/sockets/unix_cmsg/unix_cmsg.c Mon Apr 29 21:30:04 2013 (r250076) @@ -27,48 +27,46 @@ #include __FBSDID("$FreeBSD$"); -#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 /* * There are tables with tests descriptions and pointers to test * functions. Each t_*() function returns 0 if its test passed, - * -1 if its test failed (something wrong was found in local domain - * control messages), -2 if some system error occurred. If test - * function returns -2, then a program exits. + * -1 if its test failed, -2 if some system error occurred. + * If a test function returns -2, then a program exits. * - * Each test function completely control what to do (eg. fork or - * do not fork a client process). If a test function forks a client - * process, then it waits for its termination. If a return code of a - * client process is not equal to zero, or if a client process was - * terminated by a signal, then test function returns -2. + * If a test function forks a client process, then it waits for its + * termination. If a return code of a client process is not equal + * to zero, or if a client process was terminated by a signal, then + * a test function returns -1 or -2 depending on exit status of + * a client process. * - * Each test function and complete program are not optimized - * a lot to allow easy to modify tests. - * - * Each function which can block, is run under TIMEOUT, if timeout - * occurs, then test function returns -2 or a client process exits - * with nonzero return code. + * Each function which can block, is run under TIMEOUT. If timeout + * occurs, then a test function returns -2 or a client process exits + * with a non-zero return code. */ #ifndef LISTENQ @@ -76,207 +74,290 @@ __FBSDID("$FreeBSD$"); #endif #ifndef TIMEOUT -# define TIMEOUT 60 +# define TIMEOUT 2 #endif -#define EXTRA_CMSG_SPACE 512 /* Memory for not expected control data. */ - -static int t_cmsgcred(void), t_sockcred_stream1(void); -static int t_sockcred_stream2(void), t_cmsgcred_sockcred(void); -static int t_sockcred_dgram(void), t_timestamp(void); +static int t_cmsgcred(void); +static int t_sockcred_1(void); +static int t_sockcred_2(void); +static int t_cmsgcred_sockcred(void); +static int t_timeval(void); +static int t_bintime(void); +static int t_cmsg_len(void); +static int t_peercred(void); struct test_func { - int (*func)(void); /* Pointer to function. */ - const char *desc; /* Test description. */ -}; - -static struct test_func test_stream_tbl[] = { - { NULL, " 0: All tests" }, - { t_cmsgcred, " 1: Sending, receiving cmsgcred" }, - { t_sockcred_stream1, " 2: Receiving sockcred (listening socket has LOCAL_CREDS)" }, - { t_sockcred_stream2, " 3: Receiving sockcred (accepted socket has LOCAL_CREDS)" }, - { t_cmsgcred_sockcred, " 4: Sending cmsgcred, receiving sockcred" }, - { t_timestamp, " 5: Sending, receiving timestamp" }, - { NULL, NULL } + int (*func)(void); + const char *desc; }; -static struct test_func test_dgram_tbl[] = { - { NULL, " 0: All tests" }, - { t_cmsgcred, " 1: Sending, receiving cmsgcred" }, - { t_sockcred_dgram, " 2: Receiving sockcred" }, - { t_cmsgcred_sockcred, " 3: Sending cmsgcred, receiving sockcred" }, - { t_timestamp, " 4: Sending, receiving timestamp" }, - { NULL, NULL } +static const struct test_func test_stream_tbl[] = { + { + .func = NULL, + .desc = "All tests" + }, + { + .func = t_cmsgcred, + .desc = "Sending, receiving cmsgcred" + }, + { + .func = t_sockcred_1, + .desc = "Receiving sockcred (listening socket)" + }, + { + .func = t_sockcred_2, + .desc = "Receiving sockcred (accepted socket)" + }, + { + .func = t_cmsgcred_sockcred, + .desc = "Sending cmsgcred, receiving sockcred" + }, + { + .func = t_timeval, + .desc = "Sending, receiving timeval" + }, + { + .func = t_bintime, + .desc = "Sending, receiving bintime" + }, + { + .func = t_cmsg_len, + .desc = "Check cmsghdr.cmsg_len" + }, + { + .func = t_peercred, + .desc = "Check LOCAL_PEERCRED socket option" + } }; -#define TEST_STREAM_NO_MAX (sizeof(test_stream_tbl) / sizeof(struct test_func) - 2) -#define TEST_DGRAM_NO_MAX (sizeof(test_dgram_tbl) / sizeof(struct test_func) - 2) - -static const char *myname = "SERVER"; /* "SERVER" or "CLIENT" */ - -static int debug = 0; /* 1, if -d. */ -static int no_control_data = 0; /* 1, if -z. */ - -static u_int nfailed = 0; /* Number of failed tests. */ +#define TEST_STREAM_TBL_SIZE \ + (sizeof(test_stream_tbl) / sizeof(test_stream_tbl[0])) -static int sock_type; /* SOCK_STREAM or SOCK_DGRAM */ -static const char *sock_type_str; /* "SOCK_STREAM" or "SOCK_DGRAN" */ - -static char tempdir[] = "/tmp/unix_cmsg.XXXXXXX"; -static char serv_sock_path[PATH_MAX]; - -static char ipc_message[] = "hello"; - -#define IPC_MESSAGE_SIZE (sizeof(ipc_message)) - -static struct sockaddr_un servaddr; /* Server address. */ - -static sigjmp_buf env_alrm; +static const struct test_func test_dgram_tbl[] = { + { + .func = NULL, + .desc = "All tests" + }, + { + .func = t_cmsgcred, + .desc = "Sending, receiving cmsgcred" + }, + { + .func = t_sockcred_2, + .desc = "Receiving sockcred" + }, + { + .func = t_cmsgcred_sockcred, + .desc = "Sending cmsgcred, receiving sockcred" + }, + { + .func = t_timeval, + .desc = "Sending, receiving timeval" + }, + { + .func = t_bintime, + .desc = "Sending, receiving bintime" + }, + { + .func = t_cmsg_len, + .desc = "Check cmsghdr.cmsg_len" + } +}; -static uid_t my_uid; -static uid_t my_euid; -static gid_t my_gid; -static gid_t my_egid; +#define TEST_DGRAM_TBL_SIZE \ + (sizeof(test_dgram_tbl) / sizeof(test_dgram_tbl[0])) -/* - * my_gids[0] is EGID, next items are supplementary GIDs, - * my_ngids determines valid items in my_gids array. - */ -static gid_t my_gids[NGROUPS_MAX]; -static int my_ngids; +static bool debug = false; +static bool server_flag = true; +static bool send_data_flag = true; +static bool send_array_flag = true; +static bool failed_flag = false; + +static int sock_type; +static const char *sock_type_str; + +static const char *proc_name; + +static char work_dir[] = _PATH_TMP "unix_cmsg.XXXXXXX"; +static int serv_sock_fd; +static struct sockaddr_un serv_addr_sun; + +static struct { + char *buf_send; + char *buf_recv; + size_t buf_size; + u_int msg_num; +} ipc_msg; + +#define IPC_MSG_NUM_DEF 5 +#define IPC_MSG_NUM_MAX 10 +#define IPC_MSG_SIZE_DEF 7 +#define IPC_MSG_SIZE_MAX 128 + +static struct { + uid_t uid; + uid_t euid; + gid_t gid; + gid_t egid; + gid_t *gid_arr; + int gid_num; +} proc_cred; + +static pid_t client_pid; + +#define SYNC_SERVER 0 +#define SYNC_CLIENT 1 +#define SYNC_RECV 0 +#define SYNC_SEND 1 -static pid_t client_pid; /* PID of forked client. */ +static int sync_fd[2][2]; -#define dbgmsg(x) do { \ - if (debug) \ - logmsgx x ; \ -} while (/* CONSTCOND */0) +#define LOGMSG_SIZE 128 static void logmsg(const char *, ...) __printflike(1, 2); static void logmsgx(const char *, ...) __printflike(1, 2); +static void dbgmsg(const char *, ...) __printflike(1, 2); static void output(const char *, ...) __printflike(1, 2); -extern char *__progname; /* The name of program. */ - -/* - * Output the help message (-h switch). - */ static void -usage(int quick) +usage(bool verbose) { - const struct test_func *test_func; + u_int i; - fprintf(stderr, "Usage: %s [-dhz] [-t ] [testno]\n", - __progname); - if (quick) + printf("usage: %s [-dh] [-n num] [-s size] [-t type] " + "[-z value] [testno]\n", getprogname()); + if (!verbose) return; - fprintf(stderr, "\n Options are:\n\ - -d\t\t\tOutput debugging information\n\ - -h\t\t\tOutput this help message and exit\n\ - -t \t\tRun test only for the given socket type:\n\ -\t\t\tstream or dgram\n\ - -z\t\t\tDo not send real control data if possible\n\n"); - fprintf(stderr, " Available tests for stream sockets:\n"); - for (test_func = test_stream_tbl; test_func->desc != NULL; ++test_func) - fprintf(stderr, " %s\n", test_func->desc); - fprintf(stderr, "\n Available tests for datagram sockets:\n"); - for (test_func = test_dgram_tbl; test_func->desc != NULL; ++test_func) - fprintf(stderr, " %s\n", test_func->desc); + printf("\n Options are:\n\ + -d Output debugging information\n\ + -h Output the help message and exit\n\ + -n num Number of messages to send\n\ + -s size Specify size of data for IPC\n\ + -t type Specify socket type (stream, dgram) for tests\n\ + -z value Do not send data in a message (bit 0x1), do not send\n\ + data array associated with a cmsghdr structure (bit 0x2)\n\ + testno Run one test by its number (require the -t option)\n\n"); + printf(" Available tests for stream sockets:\n"); + for (i = 0; i < TEST_STREAM_TBL_SIZE; ++i) + printf(" %u: %s\n", i, test_stream_tbl[i].desc); + printf("\n Available tests for datagram sockets:\n"); + for (i = 0; i < TEST_DGRAM_TBL_SIZE; ++i) + printf(" %u: %s\n", i, test_dgram_tbl[i].desc); } -/* - * printf-like function for outputting to STDOUT_FILENO. - */ static void output(const char *format, ...) { - char buf[128]; + char buf[LOGMSG_SIZE]; va_list ap; va_start(ap, format); if (vsnprintf(buf, sizeof(buf), format, ap) < 0) - err(EX_SOFTWARE, "output: vsnprintf failed"); + err(EXIT_FAILURE, "output: vsnprintf failed"); write(STDOUT_FILENO, buf, strlen(buf)); va_end(ap); } -/* - * printf-like function for logging, also outputs message for errno. - */ static void logmsg(const char *format, ...) { - char buf[128]; + char buf[LOGMSG_SIZE]; va_list ap; int errno_save; - errno_save = errno; /* Save errno. */ - + errno_save = errno; va_start(ap, format); if (vsnprintf(buf, sizeof(buf), format, ap) < 0) - err(EX_SOFTWARE, "logmsg: vsnprintf failed"); + err(EXIT_FAILURE, "logmsg: vsnprintf failed"); if (errno_save == 0) - output("%s: %s\n", myname, buf); + output("%s: %s\n", proc_name, buf); else - output("%s: %s: %s\n", myname, buf, strerror(errno_save)); + output("%s: %s: %s\n", proc_name, buf, strerror(errno_save)); va_end(ap); + errno = errno_save; +} + +static void +vlogmsgx(const char *format, va_list ap) +{ + char buf[LOGMSG_SIZE]; + + if (vsnprintf(buf, sizeof(buf), format, ap) < 0) + err(EXIT_FAILURE, "logmsgx: vsnprintf failed"); + output("%s: %s\n", proc_name, buf); - errno = errno_save; /* Restore errno. */ } -/* - * printf-like function for logging, do not output message for errno. - */ static void logmsgx(const char *format, ...) { - char buf[128]; va_list ap; va_start(ap, format); - if (vsnprintf(buf, sizeof(buf), format, ap) < 0) - err(EX_SOFTWARE, "logmsgx: vsnprintf failed"); - output("%s: %s\n", myname, buf); + vlogmsgx(format, ap); va_end(ap); } -/* - * Run tests from testno1 to testno2. - */ +static void +dbgmsg(const char *format, ...) +{ + va_list ap; + + if (debug) { + va_start(ap, format); + vlogmsgx(format, ap); + va_end(ap); + } +} + static int -run_tests(u_int testno1, u_int testno2) +run_tests(int type, u_int testno1) { - const struct test_func *test_func; - u_int i, nfailed1; + const struct test_func *tf; + u_int i, testno2, failed_num; - output("Running tests for %s sockets:\n", sock_type_str); - test_func = (sock_type == SOCK_STREAM ? - test_stream_tbl : test_dgram_tbl) + testno1; + sock_type = type; + if (type == SOCK_STREAM) { + sock_type_str = "SOCK_STREAM"; + tf = test_stream_tbl; + i = TEST_STREAM_TBL_SIZE - 1; + } else { + sock_type_str = "SOCK_DGRAM"; + tf = test_dgram_tbl; + i = TEST_DGRAM_TBL_SIZE - 1; + } + if (testno1 == 0) { + testno1 = 1; + testno2 = i; + } else + testno2 = testno1; - nfailed1 = 0; - for (i = testno1; i <= testno2; ++test_func, ++i) { - output(" %s\n", test_func->desc); - switch (test_func->func()) { + output("Running tests for %s sockets:\n", sock_type_str); + failed_num = 0; + for (i = testno1, tf += testno1; i <= testno2; ++tf, ++i) { + output(" %u: %s\n", i, tf->desc); + switch (tf->func()) { case -1: - ++nfailed1; + ++failed_num; break; case -2: - logmsgx("some system error occurred, exiting"); + logmsgx("some system error or timeout occurred"); return (-1); } } - nfailed += nfailed1; + if (failed_num != 0) + failed_flag = true; if (testno1 != testno2) { - if (nfailed1 == 0) - output("-- all tests were passed!\n"); + if (failed_num == 0) + output("-- all tests passed!\n"); else - output("-- %u test%s failed!\n", nfailed1, - nfailed1 == 1 ? "" : "s"); + output("-- %u test%s failed!\n", + failed_num, failed_num == 1 ? "" : "s"); } else { - if (nfailed == 0) - output("-- test was passed!\n"); + if (failed_num == 0) + output("-- test passed!\n"); else output("-- test failed!\n"); } @@ -284,183 +365,322 @@ run_tests(u_int testno1, u_int testno2) return (0); } -/* ARGSUSED */ -static void -sig_alrm(int signo __unused) +static int +init(void) +{ + struct sigaction sigact; + size_t idx; + int rv; + + proc_name = "SERVER"; + + sigact.sa_handler = SIG_IGN; + sigact.sa_flags = 0; + sigemptyset(&sigact.sa_mask); + if (sigaction(SIGPIPE, &sigact, (struct sigaction *)NULL) < 0) { + logmsg("init: sigaction"); + return (-1); + } + + if (ipc_msg.buf_size == 0) + ipc_msg.buf_send = ipc_msg.buf_recv = NULL; + else { + ipc_msg.buf_send = malloc(ipc_msg.buf_size); + ipc_msg.buf_recv = malloc(ipc_msg.buf_size); + if (ipc_msg.buf_send == NULL || ipc_msg.buf_recv == NULL) { + logmsg("init: malloc"); + return (-1); + } + for (idx = 0; idx < ipc_msg.buf_size; ++idx) + ipc_msg.buf_send[idx] = (char)idx; + } + + proc_cred.uid = getuid(); + proc_cred.euid = geteuid(); + proc_cred.gid = getgid(); + proc_cred.egid = getegid(); + proc_cred.gid_num = getgroups(0, (gid_t *)NULL); + if (proc_cred.gid_num < 0) { + logmsg("init: getgroups"); + return (-1); + } + proc_cred.gid_arr = malloc(proc_cred.gid_num * + sizeof(*proc_cred.gid_arr)); + if (proc_cred.gid_arr == NULL) { + logmsg("init: malloc"); + return (-1); + } + if (getgroups(proc_cred.gid_num, proc_cred.gid_arr) < 0) { + logmsg("init: getgroups"); + return (-1); + } + + memset(&serv_addr_sun, 0, sizeof(serv_addr_sun)); + rv = snprintf(serv_addr_sun.sun_path, sizeof(serv_addr_sun.sun_path), + "%s/%s", work_dir, proc_name); + if (rv < 0) { + logmsg("init: snprintf"); + return (-1); + } + if ((size_t)rv >= sizeof(serv_addr_sun.sun_path)) { + logmsgx("init: not enough space for socket pathname"); + return (-1); + } + serv_addr_sun.sun_family = PF_LOCAL; + serv_addr_sun.sun_len = SUN_LEN(&serv_addr_sun); + + return (0); +} + +static int +client_fork(void) { - siglongjmp(env_alrm, 1); + int fd1, fd2; + + if (pipe(sync_fd[SYNC_SERVER]) < 0 || + pipe(sync_fd[SYNC_CLIENT]) < 0) { + logmsg("client_fork: pipe"); + return (-1); + } + client_pid = fork(); + if (client_pid == (pid_t)-1) { + logmsg("client_fork: fork"); + return (-1); + } + if (client_pid == 0) { + proc_name = "CLIENT"; + server_flag = false; + fd1 = sync_fd[SYNC_SERVER][SYNC_RECV]; + fd2 = sync_fd[SYNC_CLIENT][SYNC_SEND]; + } else { + fd1 = sync_fd[SYNC_SERVER][SYNC_SEND]; + fd2 = sync_fd[SYNC_CLIENT][SYNC_RECV]; + } + if (close(fd1) < 0 || close(fd2) < 0) { + logmsg("client_fork: close"); + return (-1); + } + return (client_pid != 0); } -/* - * Initialize signals handlers. - */ static void -sig_init(void) +client_exit(int rv) +{ + if (close(sync_fd[SYNC_SERVER][SYNC_SEND]) < 0 || + close(sync_fd[SYNC_CLIENT][SYNC_RECV]) < 0) { + logmsg("client_exit: close"); + rv = -1; + } + rv = rv == 0 ? EXIT_SUCCESS : -rv; + dbgmsg("exit: code %d", rv); + _exit(rv); +} + +static int +client_wait(void) { - struct sigaction sa; + int status; + pid_t pid; - sa.sa_handler = SIG_IGN; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGPIPE, &sa, (struct sigaction *)NULL) < 0) - err(EX_OSERR, "sigaction(SIGPIPE)"); - - sa.sa_handler = sig_alrm; - if (sigaction(SIGALRM, &sa, (struct sigaction *)NULL) < 0) - err(EX_OSERR, "sigaction(SIGALRM)"); + dbgmsg("waiting for client"); + + if (close(sync_fd[SYNC_SERVER][SYNC_RECV]) < 0 || + close(sync_fd[SYNC_CLIENT][SYNC_SEND]) < 0) { + logmsg("client_wait: close"); + return (-1); + } + + pid = waitpid(client_pid, &status, 0); + if (pid == (pid_t)-1) { + logmsg("client_wait: waitpid"); + return (-1); + } + + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) != EXIT_SUCCESS) { + logmsgx("client exit status is %d", + WEXITSTATUS(status)); + return (-WEXITSTATUS(status)); + } + } else { + if (WIFSIGNALED(status)) + logmsgx("abnormal termination of client, signal %d%s", + WTERMSIG(status), WCOREDUMP(status) ? + " (core file generated)" : ""); + else + logmsgx("termination of client, unknown status"); + return (-1); + } + + return (0); } int main(int argc, char *argv[]) { const char *errstr; - int opt, dgramflag, streamflag; - u_int testno1, testno2; - - dgramflag = streamflag = 0; - while ((opt = getopt(argc, argv, "dht:z")) != -1) + u_int testno, zvalue; + int opt, rv; + bool dgram_flag, stream_flag; + + ipc_msg.buf_size = IPC_MSG_SIZE_DEF; + ipc_msg.msg_num = IPC_MSG_NUM_DEF; + dgram_flag = stream_flag = false; + while ((opt = getopt(argc, argv, "dhn:s:t:z:")) != -1) switch (opt) { case 'd': - debug = 1; + debug = true; break; case 'h': - usage(0); - return (EX_OK); + usage(true); + return (EXIT_SUCCESS); + case 'n': + ipc_msg.msg_num = strtonum(optarg, 1, + IPC_MSG_NUM_MAX, &errstr); + if (errstr != NULL) + errx(EXIT_FAILURE, "option -n: number is %s", + errstr); + break; + case 's': + ipc_msg.buf_size = strtonum(optarg, 0, + IPC_MSG_SIZE_MAX, &errstr); + if (errstr != NULL) + errx(EXIT_FAILURE, "option -s: number is %s", + errstr); + break; case 't': if (strcmp(optarg, "stream") == 0) - streamflag = 1; + stream_flag = true; else if (strcmp(optarg, "dgram") == 0) - dgramflag = 1; + dgram_flag = true; else - errx(EX_USAGE, "wrong socket type in -t option"); + errx(EXIT_FAILURE, "option -t: " + "wrong socket type"); break; case 'z': - no_control_data = 1; + zvalue = strtonum(optarg, 0, 3, &errstr); + if (errstr != NULL) + errx(EXIT_FAILURE, "option -z: number is %s", + errstr); + if (zvalue & 0x1) + send_data_flag = false; + if (zvalue & 0x2) + send_array_flag = false; break; - case '?': default: - usage(1); - return (EX_USAGE); + usage(false); + return (EXIT_FAILURE); } if (optind < argc) { if (optind + 1 != argc) - errx(EX_USAGE, "too many arguments"); - testno1 = strtonum(argv[optind], 0, UINT_MAX, &errstr); + errx(EXIT_FAILURE, "too many arguments"); + testno = strtonum(argv[optind], 0, UINT_MAX, &errstr); if (errstr != NULL) - errx(EX_USAGE, "wrong test number: %s", errstr); + errx(EXIT_FAILURE, "test number is %s", errstr); + if (stream_flag && testno >= TEST_STREAM_TBL_SIZE) + errx(EXIT_FAILURE, "given test %u for stream " + "sockets does not exist", testno); + if (dgram_flag && testno >= TEST_DGRAM_TBL_SIZE) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 29 21:49:24 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 030D6C9D; Mon, 29 Apr 2013 21:49:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E7065154A; Mon, 29 Apr 2013 21:49:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3TLnNhS004361; Mon, 29 Apr 2013 21:49:23 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3TLnNLJ004355; Mon, 29 Apr 2013 21:49:23 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201304292149.r3TLnNLJ004355@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 29 Apr 2013 21:49:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250078 - in stable/9: share/man/man4 sys/dev/atkbdc sys/sys usr.sbin/moused X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Apr 2013 21:49:24 -0000 Author: jkim Date: Mon Apr 29 21:49:22 2013 New Revision: 250078 URL: http://svnweb.freebsd.org/changeset/base/250078 Log: MFC: r248478 Add preliminary support for IBM/Lenovo TrackPoint. Modified: stable/9/share/man/man4/psm.4 stable/9/sys/dev/atkbdc/psm.c stable/9/sys/sys/mouse.h stable/9/usr.sbin/moused/moused.c Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/sys/ (props changed) stable/9/usr.sbin/moused/ (props changed) Modified: stable/9/share/man/man4/psm.4 ============================================================================== --- stable/9/share/man/man4/psm.4 Mon Apr 29 21:33:36 2013 (r250077) +++ stable/9/share/man/man4/psm.4 Mon Apr 29 21:49:22 2013 (r250078) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2012 +.Dd March 18, 2013 .Dt PSM 4 .Os .Sh NAME @@ -339,6 +339,12 @@ at boot-time. This will enable .Nm to handle packets from guest devices (sticks) and extra buttons. +Similarly, extended support for IBM/Lenovo TrackPoint can be enabled +by setting +.Va hw.psm.trackpoint_support +to +.Em 1 +at boot-time. .Pp Tap and drag gestures can be disabled by setting .Va hw.psm.tap_enabled @@ -832,8 +838,8 @@ In contrast, some pad products, e.g.\& s and Interlink VersaPad, treat the tapping action as fourth button events. .Pp -It is reported that ALPS GlidePoint, Synaptics Touchpad, and -Interlink VersaPad require +It is reported that ALPS GlidePoint, Synaptics Touchpad, IBM/Lenovo +TrackPoint, and Interlink VersaPad require .Em INITAFTERSUSPEND flag in order to recover from suspended state. This flag is automatically set when one of these devices is detected by the Modified: stable/9/sys/dev/atkbdc/psm.c ============================================================================== --- stable/9/sys/dev/atkbdc/psm.c Mon Apr 29 21:33:36 2013 (r250077) +++ stable/9/sys/dev/atkbdc/psm.c Mon Apr 29 21:49:22 2013 (r250078) @@ -260,6 +260,38 @@ typedef struct synapticsaction { int in_vscroll; } synapticsaction_t; +enum { + TRACKPOINT_SYSCTL_SENSITIVITY, + TRACKPOINT_SYSCTL_NEGATIVE_INERTIA, + TRACKPOINT_SYSCTL_UPPER_PLATEAU, + TRACKPOINT_SYSCTL_BACKUP_RANGE, + TRACKPOINT_SYSCTL_DRAG_HYSTERESIS, + TRACKPOINT_SYSCTL_MINIMUM_DRAG, + TRACKPOINT_SYSCTL_UP_THRESHOLD, + TRACKPOINT_SYSCTL_THRESHOLD, + TRACKPOINT_SYSCTL_JENKS_CURVATURE, + TRACKPOINT_SYSCTL_Z_TIME, + TRACKPOINT_SYSCTL_PRESS_TO_SELECT, + TRACKPOINT_SYSCTL_SKIP_BACKUPS +}; + +typedef struct trackpointinfo { + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; + int sensitivity; + int inertia; + int uplateau; + int reach; + int draghys; + int mindrag; + int upthresh; + int threshold; + int jenks; + int ztime; + int pts; + int skipback; +} trackpointinfo_t; + /* driver control block */ struct psm_softc { /* Driver status information */ int unit; @@ -274,6 +306,8 @@ struct psm_softc { /* Driver status inf synapticshw_t synhw; /* Synaptics hardware information */ synapticsinfo_t syninfo; /* Synaptics configuration */ synapticsaction_t synaction; /* Synaptics action context */ + int tphw; /* TrackPoint hardware information */ + trackpointinfo_t tpinfo; /* TrackPoint configuration */ mousemode_t mode; /* operation mode */ mousemode_t dflt_mode; /* default operation mode */ mousestatus_t status; /* accumulated mouse movement */ @@ -344,6 +378,9 @@ TUNABLE_INT("hw.psm.tap_enabled", &tap_e static int synaptics_support = 0; TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support); +static int trackpoint_support = 0; +TUNABLE_INT("hw.psm.trackpoint_support", &trackpoint_support); + static int verbose = PSM_DEBUG; TUNABLE_INT("debug.psm.loglevel", &verbose); @@ -432,6 +469,7 @@ static probefunc_t enable_4dmouse; static probefunc_t enable_4dplus; static probefunc_t enable_mmanplus; static probefunc_t enable_synaptics; +static probefunc_t enable_trackpoint; static probefunc_t enable_versapad; static struct { @@ -466,6 +504,8 @@ static struct { 0x80, MOUSE_PS2_PACKETSIZE, enable_kmouse }, { MOUSE_MODEL_VERSAPAD, /* Interlink electronics VersaPad */ 0xe8, MOUSE_PS2VERSA_PACKETSIZE, enable_versapad }, + { MOUSE_MODEL_TRACKPOINT, /* IBM/Lenovo TrackPoint */ + 0xc0, MOUSE_PS2_PACKETSIZE, enable_trackpoint }, { MOUSE_MODEL_GENERIC, 0xc0, MOUSE_PS2_PACKETSIZE, NULL }, }; @@ -708,6 +748,7 @@ model_name(int model) { MOUSE_MODEL_4DPLUS, "4D+ Mouse" }, { MOUSE_MODEL_SYNAPTICS, "Synaptics Touchpad" }, { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" }, + { MOUSE_MODEL_TRACKPOINT, "IBM/Lenovo TrackPoint" }, { MOUSE_MODEL_UNKNOWN, "Unknown" }, }; int i; @@ -1452,7 +1493,7 @@ psmattach(device_t dev) sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; default: - if (sc->synhw.infoMajor >= 4) + if (sc->synhw.infoMajor >= 4 || sc->tphw > 0) sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; } @@ -3440,6 +3481,7 @@ psmsoftintr(void *arg) goto next; break; + case MOUSE_MODEL_TRACKPOINT: case MOUSE_MODEL_GENERIC: default: break; @@ -4472,6 +4514,233 @@ enable_synaptics(KBDC kbdc, struct psm_s return (TRUE); } +/* IBM/Lenovo TrackPoint */ +static int +trackpoint_command(KBDC kbdc, int cmd, int loc, int val) +{ + const int seq[] = { 0xe2, cmd, loc, val }; + int i; + + for (i = 0; i < nitems(seq); i++) + if (send_aux_command(kbdc, seq[i]) != PSM_ACK) + return (EIO); + return (0); +} + +#define PSM_TPINFO(x) offsetof(struct psm_softc, tpinfo.x) +#define TPMASK 0 +#define TPLOC 1 +#define TPINFO 2 + +static int +trackpoint_sysctl(SYSCTL_HANDLER_ARGS) +{ + static const int data[][3] = { + { 0x00, 0x4a, PSM_TPINFO(sensitivity) }, + { 0x00, 0x4d, PSM_TPINFO(inertia) }, + { 0x00, 0x60, PSM_TPINFO(uplateau) }, + { 0x00, 0x57, PSM_TPINFO(reach) }, + { 0x00, 0x58, PSM_TPINFO(draghys) }, + { 0x00, 0x59, PSM_TPINFO(mindrag) }, + { 0x00, 0x5a, PSM_TPINFO(upthresh) }, + { 0x00, 0x5c, PSM_TPINFO(threshold) }, + { 0x00, 0x5d, PSM_TPINFO(jenks) }, + { 0x00, 0x5e, PSM_TPINFO(ztime) }, + { 0x01, 0x2c, PSM_TPINFO(pts) }, + { 0x08, 0x2d, PSM_TPINFO(skipback) } + }; + struct psm_softc *sc; + int error, newval, *oldvalp; + const int *tp; + + if (arg1 == NULL || arg2 < 0 || arg2 >= nitems(data)) + return (EINVAL); + sc = arg1; + tp = data[arg2]; + oldvalp = (int *)((intptr_t)sc + tp[TPINFO]); + newval = *oldvalp; + error = sysctl_handle_int(oidp, &newval, 0, req); + if (error != 0) + return (error); + if (newval == *oldvalp) + return (0); + if (newval < 0 || newval > (tp[TPMASK] == 0 ? 255 : 1)) + return (EINVAL); + error = trackpoint_command(sc->kbdc, tp[TPMASK] == 0 ? 0x81 : 0x47, + tp[TPLOC], tp[TPMASK] == 0 ? newval : tp[TPMASK]); + if (error != 0) + return (error); + *oldvalp = newval; + + return (0); +} + +static void +trackpoint_sysctl_create_tree(struct psm_softc *sc) +{ + + if (sc->tpinfo.sysctl_tree != NULL) + return; + + /* Attach extra trackpoint sysctl nodes under hw.psm.trackpoint */ + sysctl_ctx_init(&sc->tpinfo.sysctl_ctx); + sc->tpinfo.sysctl_tree = SYSCTL_ADD_NODE(&sc->tpinfo.sysctl_ctx, + SYSCTL_STATIC_CHILDREN(_hw_psm), OID_AUTO, "trackpoint", CTLFLAG_RD, + 0, "IBM/Lenovo TrackPoint"); + + /* hw.psm.trackpoint.sensitivity */ + sc->tpinfo.sensitivity = 0x64; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "sensitivity", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_SENSITIVITY, + trackpoint_sysctl, "I", + "Sensitivity"); + + /* hw.psm.trackpoint.negative_inertia */ + sc->tpinfo.inertia = 0x06; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "negative_inertia", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_NEGATIVE_INERTIA, + trackpoint_sysctl, "I", + "Negative inertia factor"); + + /* hw.psm.trackpoint.upper_plateau */ + sc->tpinfo.uplateau = 0x61; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "upper_plateau", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_UPPER_PLATEAU, + trackpoint_sysctl, "I", + "Transfer function upper plateau speed"); + + /* hw.psm.trackpoint.backup_range */ + sc->tpinfo.reach = 0x0a; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "backup_range", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_BACKUP_RANGE, + trackpoint_sysctl, "I", + "Backup range"); + + /* hw.psm.trackpoint.drag_hysteresis */ + sc->tpinfo.draghys = 0xff; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "drag_hysteresis", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_DRAG_HYSTERESIS, + trackpoint_sysctl, "I", + "Drag hysteresis"); + + /* hw.psm.trackpoint.minimum_drag */ + sc->tpinfo.mindrag = 0x14; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "minimum_drag", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_MINIMUM_DRAG, + trackpoint_sysctl, "I", + "Minimum drag"); + + /* hw.psm.trackpoint.up_threshold */ + sc->tpinfo.upthresh = 0xff; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "up_threshold", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_UP_THRESHOLD, + trackpoint_sysctl, "I", + "Up threshold for release"); + + /* hw.psm.trackpoint.threshold */ + sc->tpinfo.threshold = 0x08; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "threshold", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_THRESHOLD, + trackpoint_sysctl, "I", + "Threshold"); + + /* hw.psm.trackpoint.jenks_curvature */ + sc->tpinfo.jenks = 0x87; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "jenks_curvature", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_JENKS_CURVATURE, + trackpoint_sysctl, "I", + "Jenks curvature"); + + /* hw.psm.trackpoint.z_time */ + sc->tpinfo.ztime = 0x26; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "z_time", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_Z_TIME, + trackpoint_sysctl, "I", + "Z time constant"); + + /* hw.psm.trackpoint.press_to_select */ + sc->tpinfo.pts = 0x00; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "press_to_select", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_PRESS_TO_SELECT, + trackpoint_sysctl, "I", + "Press to Select"); + + /* hw.psm.trackpoint.skip_backups */ + sc->tpinfo.skipback = 0x00; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "skip_backups", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_SKIP_BACKUPS, + trackpoint_sysctl, "I", + "Skip backups from drags"); +} + +static int +enable_trackpoint(KBDC kbdc, struct psm_softc *sc) +{ + int id; + + kbdc = sc->kbdc; + + if (send_aux_command(kbdc, 0xe1) != PSM_ACK || + read_aux_data(kbdc) != 0x01) + return (FALSE); + id = read_aux_data(kbdc); + if (id < 0x01) + return (FALSE); + if (sc != NULL) + sc->tphw = id; + if (!trackpoint_support) + return (FALSE); + + if (sc != NULL) { + /* Create sysctl tree. */ + trackpoint_sysctl_create_tree(sc); + + trackpoint_command(kbdc, 0x81, 0x4a, sc->tpinfo.sensitivity); + trackpoint_command(kbdc, 0x81, 0x4d, sc->tpinfo.inertia); + trackpoint_command(kbdc, 0x81, 0x60, sc->tpinfo.uplateau); + trackpoint_command(kbdc, 0x81, 0x57, sc->tpinfo.reach); + trackpoint_command(kbdc, 0x81, 0x58, sc->tpinfo.draghys); + trackpoint_command(kbdc, 0x81, 0x59, sc->tpinfo.mindrag); + trackpoint_command(kbdc, 0x81, 0x5a, sc->tpinfo.upthresh); + trackpoint_command(kbdc, 0x81, 0x5c, sc->tpinfo.threshold); + trackpoint_command(kbdc, 0x81, 0x5d, sc->tpinfo.jenks); + trackpoint_command(kbdc, 0x81, 0x5e, sc->tpinfo.ztime); + if (sc->tpinfo.pts == 0x01) + trackpoint_command(kbdc, 0x47, 0x2c, 0x01); + if (sc->tpinfo.skipback == 0x01) + trackpoint_command(kbdc, 0x47, 0x2d, 0x08); + + sc->hw.hwid = id; + sc->hw.buttons = 3; + } + + return (TRUE); +} + /* Interlink electronics VersaPad */ static int enable_versapad(KBDC kbdc, struct psm_softc *sc) Modified: stable/9/sys/sys/mouse.h ============================================================================== --- stable/9/sys/sys/mouse.h Mon Apr 29 21:33:36 2013 (r250077) +++ stable/9/sys/sys/mouse.h Mon Apr 29 21:49:22 2013 (r250078) @@ -141,6 +141,7 @@ typedef struct synapticshw { #define MOUSE_MODEL_4D 11 #define MOUSE_MODEL_4DPLUS 12 #define MOUSE_MODEL_SYNAPTICS 13 +#define MOUSE_MODEL_TRACKPOINT 14 typedef struct mousemode { int protocol; /* MOUSE_PROTO_XXX */ Modified: stable/9/usr.sbin/moused/moused.c ============================================================================== --- stable/9/usr.sbin/moused/moused.c Mon Apr 29 21:33:36 2013 (r250077) +++ stable/9/usr.sbin/moused/moused.c Mon Apr 29 21:49:22 2013 (r250078) @@ -245,6 +245,7 @@ static symtab_t rmodels[] = { { "4D Mouse", MOUSE_MODEL_4D, 0 }, { "4D+ Mouse", MOUSE_MODEL_4DPLUS, 0 }, { "Synaptics Touchpad", MOUSE_MODEL_SYNAPTICS, 0 }, + { "TrackPoint", MOUSE_MODEL_TRACKPOINT, 0 }, { "generic", MOUSE_MODEL_GENERIC, 0 }, { NULL, MOUSE_MODEL_UNKNOWN, 0 }, }; From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 30 00:49:25 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AA43096D; Tue, 30 Apr 2013 00:49:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9D1091092; Tue, 30 Apr 2013 00:49:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3U0nPPu069742; Tue, 30 Apr 2013 00:49:25 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3U0nPvL069741; Tue, 30 Apr 2013 00:49:25 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201304300049.r3U0nPvL069741@svn.freebsd.org> From: Eitan Adler Date: Tue, 30 Apr 2013 00:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250084 - stable/9/bin/mkdir X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 00:49:25 -0000 Author: eadler Date: Tue Apr 30 00:49:25 2013 New Revision: 250084 URL: http://svnweb.freebsd.org/changeset/base/250084 Log: MFC r249996: Add missing static qualifiers Modified: stable/9/bin/mkdir/mkdir.c Directory Properties: stable/9/bin/mkdir/ (props changed) Modified: stable/9/bin/mkdir/mkdir.c ============================================================================== --- stable/9/bin/mkdir/mkdir.c Tue Apr 30 00:36:16 2013 (r250083) +++ stable/9/bin/mkdir/mkdir.c Tue Apr 30 00:49:25 2013 (r250084) @@ -135,7 +135,7 @@ main(int argc, char *argv[]) * Returns 1 if a directory has been created, * 2 if it already existed, and 0 on failure. */ -int +static int build(char *path, mode_t omode) { struct stat sb; @@ -208,7 +208,7 @@ build(char *path, mode_t omode) return (retval); } -void +static void usage(void) { From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 30 06:41:42 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 99788A11; Tue, 30 Apr 2013 06:41:42 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8B0A81E74; Tue, 30 Apr 2013 06:41:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3U6fgvP096648; Tue, 30 Apr 2013 06:41:42 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3U6fgH5096647; Tue, 30 Apr 2013 06:41:42 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201304300641.r3U6fgH5096647@svn.freebsd.org> From: Kirk McKusick Date: Tue, 30 Apr 2013 06:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250094 - stable/9/sbin/tunefs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 06:41:42 -0000 Author: mckusick Date: Tue Apr 30 06:41:42 2013 New Revision: 250094 URL: http://svnweb.freebsd.org/changeset/base/250094 Log: MFC of 249789: Fix error check. Submitted by: Andrey Chernov (ache@) Modified: stable/9/sbin/tunefs/tunefs.c Directory Properties: stable/9/sbin/tunefs/ (props changed) Modified: stable/9/sbin/tunefs/tunefs.c ============================================================================== --- stable/9/sbin/tunefs/tunefs.c Tue Apr 30 06:30:21 2013 (r250093) +++ stable/9/sbin/tunefs/tunefs.c Tue Apr 30 06:41:42 2013 (r250094) @@ -172,7 +172,7 @@ main(int argc, char *argv[]) found_arg = 1; name = "space to hold for metadata blocks"; kvalue = atoi(optarg); - if (mvalue < 0) + if (kvalue < 0) errx(10, "bad %s (%s)", name, optarg); kflag = 1; break; From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 30 10:05:49 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1E56B50C; Tue, 30 Apr 2013 10:05:49 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 000481745; Tue, 30 Apr 2013 10:05:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3UA5ml4069229; Tue, 30 Apr 2013 10:05:48 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3UA5mbA069223; Tue, 30 Apr 2013 10:05:48 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201304301005.r3UA5mbA069223@svn.freebsd.org> From: Martin Matuska Date: Tue, 30 Apr 2013 10:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250098 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 10:05:49 -0000 Author: mm Date: Tue Apr 30 10:05:47 2013 New Revision: 250098 URL: http://svnweb.freebsd.org/changeset/base/250098 Log: MFC r249858: Merge vendor bugfix for a possible deadlock related to async destroy and improve write performance by introducing a new lock protecting tx_open_txg. Illumos ZFS issues: 3642 dsl_scan_active() should not issue I/O to determine if async destroying is active 3643 txg_delay should not hold the tc_lock Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Tue Apr 30 08:33:38 2013 (r250097) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Tue Apr 30 10:05:47 2013 (r250098) @@ -753,12 +753,16 @@ dsl_destroy_head_sync_impl(dsl_dataset_t zil_destroy_sync(dmu_objset_zil(os), tx); if (!spa_feature_is_active(dp->dp_spa, async_destroy)) { + dsl_scan_t *scn = dp->dp_scan; + spa_feature_incr(dp->dp_spa, async_destroy, tx); dp->dp_bptree_obj = bptree_alloc(mos, tx); VERIFY0(zap_add(mos, DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_BPTREE_OBJ, sizeof (uint64_t), 1, &dp->dp_bptree_obj, tx)); + ASSERT(!scn->scn_async_destroying); + scn->scn_async_destroying = B_TRUE; } used = ds->ds_dir->dd_phys->dd_used_bytes; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Apr 30 08:33:38 2013 (r250097) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Apr 30 10:05:47 2013 (r250098) @@ -125,6 +125,15 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t t scn = dp->dp_scan = kmem_zalloc(sizeof (dsl_scan_t), KM_SLEEP); scn->scn_dp = dp; + /* + * It's possible that we're resuming a scan after a reboot so + * make sure that the scan_async_destroying flag is initialized + * appropriately. + */ + ASSERT(!scn->scn_async_destroying); + scn->scn_async_destroying = spa_feature_is_active(dp->dp_spa, + &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY]); + err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, "scrub_func", sizeof (uint64_t), 1, &f); if (err == 0) { @@ -1374,13 +1383,10 @@ dsl_scan_active(dsl_scan_t *scn) if (spa_shutting_down(spa)) return (B_FALSE); - if (scn->scn_phys.scn_state == DSS_SCANNING) + if (scn->scn_phys.scn_state == DSS_SCANNING || + scn->scn_async_destroying) return (B_TRUE); - if (spa_feature_is_active(spa, - &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { - return (B_TRUE); - } if (spa_version(scn->scn_dp->dp_spa) >= SPA_VERSION_DEADLISTS) { (void) bpobj_space(&scn->scn_dp->dp_free_bpobj, &used, &comp, &uncomp); @@ -1436,6 +1442,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t * if (err == 0 && spa_feature_is_active(spa, &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { + ASSERT(scn->scn_async_destroying); scn->scn_is_bptree = B_TRUE; scn->scn_zio_root = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED); @@ -1456,6 +1463,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t * VERIFY0(bptree_free(dp->dp_meta_objset, dp->dp_bptree_obj, tx)); dp->dp_bptree_obj = 0; + scn->scn_async_destroying = B_FALSE; } } if (scn->scn_visited_this_txg) { Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h Tue Apr 30 08:33:38 2013 (r250097) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h Tue Apr 30 10:05:47 2013 (r250098) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _SYS_DSL_SCAN_H @@ -82,6 +82,7 @@ typedef struct dsl_scan { /* for freeing blocks */ boolean_t scn_is_bptree; + boolean_t scn_async_destroying; /* for debugging / information */ uint64_t scn_visited_this_txg; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h Tue Apr 30 08:33:38 2013 (r250097) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h Tue Apr 30 10:05:47 2013 (r250098) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + #ifndef _SYS_TXG_IMPL_H #define _SYS_TXG_IMPL_H @@ -33,14 +37,55 @@ extern "C" { #endif +/* + * The tx_cpu structure is a per-cpu structure that is used to track + * the number of active transaction holds (tc_count). As transactions + * are assigned into a transaction group the appropriate tc_count is + * incremented to indicate that there are pending changes that have yet + * to quiesce. Consumers evenutally call txg_rele_to_sync() to decrement + * the tc_count. A transaction group is not considered quiesced until all + * tx_cpu structures have reached a tc_count of zero. + * + * This structure is a per-cpu structure by design. Updates to this structure + * are frequent and concurrent. Having a single structure would result in + * heavy lock contention so a per-cpu design was implemented. With the fanned + * out mutex design, consumers only need to lock the mutex associated with + * thread's cpu. + * + * The tx_cpu contains two locks, the tc_lock and tc_open_lock. + * The tc_lock is used to protect all members of the tx_cpu structure with + * the exception of the tc_open_lock. This lock should only be held for a + * short period of time, typically when updating the value of tc_count. + * + * The tc_open_lock protects the tx_open_txg member of the tx_state structure. + * This lock is used to ensure that transactions are only assigned into + * the current open transaction group. In order to move the current open + * transaction group to the quiesce phase, the txg_quiesce thread must + * grab all tc_open_locks, increment the tx_open_txg, and drop the locks. + * The tc_open_lock is held until the transaction is assigned into the + * transaction group. Typically, this is a short operation but if throttling + * is occuring it may be held for longer periods of time. + */ struct tx_cpu { - kmutex_t tc_lock; + kmutex_t tc_open_lock; /* protects tx_open_txg */ + kmutex_t tc_lock; /* protects the rest of this struct */ kcondvar_t tc_cv[TXG_SIZE]; uint64_t tc_count[TXG_SIZE]; list_t tc_callbacks[TXG_SIZE]; /* commit cb list */ - char tc_pad[16]; + char tc_pad[8]; /* pad to fill 3 cache lines */ }; +/* + * The tx_state structure maintains the state information about the different + * stages of the pool's transcation groups. A per pool tx_state structure + * is used to track this information. The tx_state structure also points to + * an array of tx_cpu structures (described above). Although the tx_sync_lock + * is used to protect the members of this structure, it is not used to + * protect the tx_open_txg. Instead a special lock in the tx_cpu structure + * is used. Readers of tx_open_txg must grab the per-cpu tc_open_lock. + * Any thread wishing to update tx_open_txg must grab the tc_open_lock on + * every cpu (see txg_quiesce()). + */ typedef struct tx_state { tx_cpu_t *tx_cpu; /* protects right to enter txg */ kmutex_t tx_sync_lock; /* protects tx_state_t */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Apr 30 08:33:38 2013 (r250097) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Apr 30 10:05:47 2013 (r250098) @@ -132,6 +132,8 @@ txg_init(dsl_pool_t *dp, uint64_t txg) int i; mutex_init(&tx->tx_cpu[c].tc_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&tx->tx_cpu[c].tc_open_lock, NULL, MUTEX_DEFAULT, + NULL); for (i = 0; i < TXG_SIZE; i++) { cv_init(&tx->tx_cpu[c].tc_cv[i], NULL, CV_DEFAULT, NULL); @@ -174,6 +176,7 @@ txg_fini(dsl_pool_t *dp) for (c = 0; c < max_ncpus; c++) { int i; + mutex_destroy(&tx->tx_cpu[c].tc_open_lock); mutex_destroy(&tx->tx_cpu[c].tc_lock); for (i = 0; i < TXG_SIZE; i++) { cv_destroy(&tx->tx_cpu[c].tc_cv[i]); @@ -297,10 +300,12 @@ txg_hold_open(dsl_pool_t *dp, txg_handle tx_cpu_t *tc = &tx->tx_cpu[CPU_SEQID]; uint64_t txg; - mutex_enter(&tc->tc_lock); - + mutex_enter(&tc->tc_open_lock); txg = tx->tx_open_txg; + + mutex_enter(&tc->tc_lock); tc->tc_count[txg & TXG_MASK]++; + mutex_exit(&tc->tc_lock); th->th_cpu = tc; th->th_txg = txg; @@ -313,7 +318,8 @@ txg_rele_to_quiesce(txg_handle_t *th) { tx_cpu_t *tc = th->th_cpu; - mutex_exit(&tc->tc_lock); + ASSERT(!MUTEX_HELD(&tc->tc_lock)); + mutex_exit(&tc->tc_open_lock); } void @@ -350,10 +356,10 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg int c; /* - * Grab all tx_cpu locks so nobody else can get into this txg. + * Grab all tc_open_locks so nobody else can get into this txg. */ for (c = 0; c < max_ncpus; c++) - mutex_enter(&tx->tx_cpu[c].tc_lock); + mutex_enter(&tx->tx_cpu[c].tc_open_lock); ASSERT(txg == tx->tx_open_txg); tx->tx_open_txg++; @@ -363,7 +369,7 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg * enter the next transaction group. */ for (c = 0; c < max_ncpus; c++) - mutex_exit(&tx->tx_cpu[c].tc_lock); + mutex_exit(&tx->tx_cpu[c].tc_open_lock); /* * Quiesce the transaction group by waiting for everyone to txg_exit(). From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 30 18:06:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2E56EF9; Tue, 30 Apr 2013 18:06:44 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 03E161173; Tue, 30 Apr 2013 18:06:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3UI6hPL040799; Tue, 30 Apr 2013 18:06:43 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3UI6hNY040798; Tue, 30 Apr 2013 18:06:43 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201304301806.r3UI6hNY040798@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 30 Apr 2013 18:06:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250111 - stable/9/sys/rpc/rpcsec_gss X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 18:06:44 -0000 Author: gnn Date: Tue Apr 30 18:06:43 2013 New Revision: 250111 URL: http://svnweb.freebsd.org/changeset/base/250111 Log: Improve error handling when unwrapping received data. Submitted by: Rick Macklem Modified: stable/9/sys/rpc/rpcsec_gss/rpcsec_gss_prot.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/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/dev/puc/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) stable/9/sys/net/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c ============================================================================== --- stable/9/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c Tue Apr 30 16:59:25 2013 (r250110) +++ stable/9/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c Tue Apr 30 18:06:43 2013 (r250111) @@ -208,6 +208,8 @@ m_trim(struct mbuf *m, int len) struct mbuf *n; int off; + if (m == NULL) + return; n = m_getptr(m, len, &off); if (n) { n->m_len = off; @@ -251,10 +253,19 @@ xdr_rpc_gss_unwrap_data(struct mbuf **re * Extract the MIC and make it contiguous. */ cklen = get_uint32(&results); + if (!results) { + m_freem(message); + return (FALSE); + } KASSERT(cklen <= MHLEN, ("unexpected large GSS-API checksum")); mic = results; - if (cklen > mic->m_len) + if (cklen > mic->m_len) { mic = m_pullup(mic, cklen); + if (!mic) { + m_freem(message); + return (FALSE); + } + } if (cklen != RNDUP(cklen)) m_trim(mic, cklen); @@ -272,6 +283,8 @@ xdr_rpc_gss_unwrap_data(struct mbuf **re } else if (svc == rpc_gss_svc_privacy) { /* Decode databody_priv. */ len = get_uint32(&results); + if (!results) + return (FALSE); /* Decrypt databody. */ message = results; @@ -294,6 +307,8 @@ xdr_rpc_gss_unwrap_data(struct mbuf **re /* Decode rpc_gss_data_t (sequence number + arguments). */ seq_num = get_uint32(&message); + if (!message) + return (FALSE); /* Verify sequence number. */ if (seq_num != seq) { From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 30 20:15:54 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2C06A16F; Tue, 30 Apr 2013 20:15:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0CA6C1625; Tue, 30 Apr 2013 20:15:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3UKFrNP086554; Tue, 30 Apr 2013 20:15:53 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3UKFrqa086551; Tue, 30 Apr 2013 20:15:53 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201304302015.r3UKFrqa086551@svn.freebsd.org> From: Brooks Davis Date: Tue, 30 Apr 2013 20:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250118 - in stable/9: . usr.sbin/mergemaster X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 20:15:54 -0000 Author: brooks Date: Tue Apr 30 20:15:53 2013 New Revision: 250118 URL: http://svnweb.freebsd.org/changeset/base/250118 Log: MFC r249906: Use the system MAKEOBJDIRPREFIX when running make targets in mergemaster. This allows bootstrap verions of tools to be used. Add a note to UPDATING about this change. This commit is a partial backout of r248531 in that it removes an accidentally committed change to mergemaster. Discussed with: jhb Sponsored by: DARPA, AFRL Modified: stable/9/UPDATING (contents, props changed) stable/9/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/9/usr.sbin/mergemaster/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Tue Apr 30 19:57:21 2013 (r250117) +++ stable/9/UPDATING Tue Apr 30 20:15:53 2013 (r250118) @@ -11,6 +11,16 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20130430: + The mergemaster command now uses the default MAKEOBJDIRPREFIX + rather than creating it's own in the temporary directory in + order allow access to bootstrapped versions of tools such as + install and mtree. When upgrading from version of FreeBSD where + the install command does not support -l, you will need to + install a new mergemaster command if mergemaster -p is required. + This can be accomplished with the command (cd src/usr.sbin/mergemaster + && make install). + 20130429: Fix a bug that allows NFS clients to issue READDIR on files. @@ -1535,7 +1545,7 @@ COMMON ITEMS: step. It never hurts to do it all the time. You may need to install a new mergemaster (cd src/usr.sbin/mergemaster && make install) after the buildworld before this step if you last updated - from current before 20020224 or from -stable before 20020408. + from [78]-stable or 9-stable before 20130430. [6] This only deletes old files and directories. Old libraries can be deleted by "make delete-old-libs", but you have to make Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/9/usr.sbin/mergemaster/mergemaster.sh Tue Apr 30 19:57:21 2013 (r250117) +++ stable/9/usr.sbin/mergemaster/mergemaster.sh Tue Apr 30 20:15:53 2013 (r250118) @@ -629,16 +629,10 @@ case "${RERUN}" in ${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs >/dev/null ;; esac - if [ -d `${MM_MAKE} -V .OBJDIR` ]; then - od=`${MM_MAKE} -V MAKEOBJDIRPREFIX` - else - od=${TEMPROOT}/usr/obj - fi - echo $od 1>&2 ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs >/dev/null && - MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc >/dev/null && - MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc >/dev/null && - MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution >/dev/null;} || + ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc >/dev/null && + ${MM_MAKE} everything SUBDIR_OVERRIDE=etc >/dev/null && + ${MM_MAKE} DESTDIR=${TEMPROOT} distribution >/dev/null;} || { echo ''; echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; echo " the temproot environment"; From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 30 22:13:57 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AD5D5DCF; Tue, 30 Apr 2013 22:13:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9DA791C1A; Tue, 30 Apr 2013 22:13:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3UMDvtM028936; Tue, 30 Apr 2013 22:13:57 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3UMDuoZ028919; Tue, 30 Apr 2013 22:13:56 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201304302213.r3UMDuoZ028919@svn.freebsd.org> From: Brooks Davis Date: Tue, 30 Apr 2013 22:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250121 - in stable/9: . etc share/mk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 22:13:57 -0000 Author: brooks Date: Tue Apr 30 22:13:55 2013 New Revision: 250121 URL: http://svnweb.freebsd.org/changeset/base/250121 Log: MFC r245752,246913,247162,250119 Replace all known uses of ln in the build process with appropriate install -l invocations via new INSTALL_LINK and INSTALL_SYMLINK variables. Sponsored by: DARPA, AFRL Modified: stable/9/UPDATING (contents, props changed) stable/9/etc/Makefile stable/9/share/mk/bsd.incs.mk stable/9/share/mk/bsd.info.mk stable/9/share/mk/bsd.lib.mk stable/9/share/mk/bsd.links.mk stable/9/share/mk/bsd.man.mk stable/9/share/mk/bsd.own.mk Directory Properties: stable/9/etc/ (props changed) stable/9/share/mk/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/UPDATING Tue Apr 30 22:13:55 2013 (r250121) @@ -21,6 +21,13 @@ Items affecting the ports and packages s This can be accomplished with the command (cd src/usr.sbin/mergemaster && make install). + Due to the use of the new -l option to install(1) during build + and install, you must take care not to directly set the INSTALL + make variable in your /etc/make.conf, /etc/src.conf, or on the + command line. If you with to use the -C flag for all installs + you may be able to add INSTALL+=-C to /etc/make.conf or + /etc/src.conf. + 20130429: Fix a bug that allows NFS clients to issue READDIR on files. Modified: stable/9/etc/Makefile ============================================================================== --- stable/9/etc/Makefile Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/etc/Makefile Tue Apr 30 22:13:55 2013 (r250121) @@ -321,26 +321,29 @@ distrib-dirs: -f $$m -p $$d; \ ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ done; true - ln -sfh usr/src/sys ${DESTDIR}/sys + ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys cd ${DESTDIR}/usr/share/man; \ for mandir in man*; do \ - ln -sfh ../$$mandir ${DESTDIR}/usr/share/man/en.ISO8859-1/; \ - ln -sfh ../$$mandir ${DESTDIR}/usr/share/man/en.UTF-8/; \ + ${INSTALL_SYMLINK} ../$$mandir \ + ${DESTDIR}/usr/share/man/en.ISO8859-1/; \ + ${INSTALL_SYMLINK} ../$$mandir \ + ${DESTDIR}/usr/share/man/en.UTF-8/; \ done cd ${DESTDIR}/usr/share/openssl/man; \ for mandir in man*; do \ - ln -sfh ../$$mandir \ + ${INSTALL_SYMLINK} ../$$mandir \ ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1/; \ done set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \ while [ $$# -gt 0 ] ; do \ - ln -sfh "$$2" "${DESTDIR}/usr/share/man/$$1"; \ - ln -sfh "$$2" "${DESTDIR}/usr/share/openssl/man/$$1"; \ + ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \ + ${INSTALL_SYMLINK} "$$2" \ + "${DESTDIR}/usr/share/openssl/man/$$1"; \ shift; shift; \ done set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \ while [ $$# -gt 0 ] ; do \ - ln -sfh "$$2" "${DESTDIR}/usr/share/nls/$$1"; \ + ${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \ shift; shift; \ done Modified: stable/9/share/mk/bsd.incs.mk ============================================================================== --- stable/9/share/mk/bsd.incs.mk Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/share/mk/bsd.incs.mk Tue Apr 30 22:13:55 2013 (r250121) @@ -73,7 +73,7 @@ installincludes: t=${DESTDIR}$$1; \ shift; \ ${ECHO} $$t -\> $$l; \ - ln -fs $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ done; true .endif .endif # !target(installincludes) Modified: stable/9/share/mk/bsd.info.mk ============================================================================== --- stable/9/share/mk/bsd.info.mk Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/share/mk/bsd.info.mk Tue Apr 30 22:13:55 2013 (r250121) @@ -113,7 +113,7 @@ DVIPS2ASCII?= dvips2ascii .info.html: ${INFO2HTML} ${.IMPSRC} - ln -f ${.TARGET:R}.info.Top.html ${.TARGET} + ${INSTALL_LINK} ${.TARGET:R}.info.Top.html ${.TARGET} .PATH: ${.CURDIR} ${SRCDIR} Modified: stable/9/share/mk/bsd.lib.mk ============================================================================== --- stable/9/share/mk/bsd.lib.mk Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/share/mk/bsd.lib.mk Tue Apr 30 22:13:55 2013 (r250121) @@ -180,7 +180,7 @@ ${SHLIB_NAME}: ${SOBJS} @${ECHO} building shared library ${SHLIB_NAME} @rm -f ${.TARGET} ${SHLIB_LINK} .if defined(SHLIB_LINK) - @ln -fs ${.TARGET} ${SHLIB_LINK} + @${INSTALL_SYMLINK} ${SHLIB_NAME} ${SHLIB_LINK} .endif .if !defined(NM) @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ @@ -291,9 +291,9 @@ _libinstall: ${_INSTALLFLAGS} lib${LIB}.ld ${DESTDIR}${LIBDIR}/${SHLIB_LINK} .else .if ${SHLIBDIR} == ${LIBDIR} - ln -fs ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK} + ${INSTALL_SYMLINK} ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK} .else - ln -fs ${_SHLIBDIRPREFIX}${SHLIBDIR}/${SHLIB_NAME} \ + ${INSTALL_SYMLINK} ${_SHLIBDIRPREFIX}${SHLIBDIR}/${SHLIB_NAME} \ ${DESTDIR}${LIBDIR}/${SHLIB_LINK} .if exists(${DESTDIR}${LIBDIR}/${SHLIB_NAME}) -chflags noschg ${DESTDIR}${LIBDIR}/${SHLIB_NAME} Modified: stable/9/share/mk/bsd.links.mk ============================================================================== --- stable/9/share/mk/bsd.links.mk Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/share/mk/bsd.links.mk Tue Apr 30 22:13:55 2013 (r250121) @@ -15,7 +15,7 @@ _installlinks: t=${DESTDIR}$$1; \ shift; \ ${ECHO} $$t -\> $$l; \ - ln -f $$l $$t; \ + ${INSTALL_LINK} $$l $$t; \ done; true .endif .if defined(SYMLINKS) && !empty(SYMLINKS) @@ -26,6 +26,6 @@ _installlinks: t=${DESTDIR}$$1; \ shift; \ ${ECHO} $$t -\> $$l; \ - ln -fs $$l $$t; \ + ${INSTALL_SYMLINK} $$l $$t; \ done; true .endif Modified: stable/9/share/mk/bsd.man.mk ============================================================================== --- stable/9/share/mk/bsd.man.mk Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/share/mk/bsd.man.mk Tue Apr 30 22:13:55 2013 (r250121) @@ -216,7 +216,7 @@ _maninstall: ${MAN} t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \ ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \ rm -f $${t} $${t}${MCOMPRESS_EXT}; \ - ln $${l}${ZEXT} $${t}${ZEXT}; \ + ${INSTALL_LINK} $${l}${ZEXT} $${t}${ZEXT}; \ done .if defined(MANBUILDCAT) && !empty(MANBUILDCAT) @set ${MLINKS:C/\.([^.]*)$/.\1 \1/}; \ @@ -231,7 +231,7 @@ _maninstall: ${MAN} t=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \ ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \ rm -f $${t} $${t}${MCOMPRESS_EXT}; \ - ln $${l}${ZEXT} $${t}${ZEXT}; \ + ${INSTALL_LINK} $${l}${ZEXT} $${t}${ZEXT}; \ done .endif .endif Modified: stable/9/share/mk/bsd.own.mk ============================================================================== --- stable/9/share/mk/bsd.own.mk Tue Apr 30 21:36:52 2013 (r250120) +++ stable/9/share/mk/bsd.own.mk Tue Apr 30 22:13:55 2013 (r250121) @@ -181,6 +181,15 @@ NLSMODE?= ${NOBINMODE} INCLUDEDIR?= /usr/include +# +# install(1) parameters. +# +HRDLINK?= -l h +SYMLINK?= -l s + +INSTALL_LINK?= ${INSTALL} ${HRDLINK} +INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK} + # Common variables .if !defined(DEBUG_FLAGS) STRIP?= -s From owner-svn-src-stable-9@FreeBSD.ORG Wed May 1 08:53:40 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D2362D1B; Wed, 1 May 2013 08:53:40 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C4B141260; Wed, 1 May 2013 08:53:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r418reDg055440; Wed, 1 May 2013 08:53:40 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r418rejw055438; Wed, 1 May 2013 08:53:40 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201305010853.r418rejw055438@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 1 May 2013 08:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250140 - stable/9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 May 2013 08:53:40 -0000 Author: lstewart Date: Wed May 1 08:53:40 2013 New Revision: 250140 URL: http://svnweb.freebsd.org/changeset/base/250140 Log: MFC r245783: Simplify and fix a bug in cc_ack_received()'s "are we congestion window limited" logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and could therefore potentially corrupt the result (although under normal operation, neither variable should legitmately exceed 32 bits). [1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html Submitted by: jhb Modified: stable/9/sys/netinet/tcp_input.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_input.c ============================================================================== --- stable/9/sys/netinet/tcp_input.c Wed May 1 07:13:36 2013 (r250139) +++ stable/9/sys/netinet/tcp_input.c Wed May 1 08:53:40 2013 (r250140) @@ -269,7 +269,7 @@ cc_ack_received(struct tcpcb *tp, struct INP_WLOCK_ASSERT(tp->t_inpcb); tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th); - if (tp->snd_cwnd == min(tp->snd_cwnd, tp->snd_wnd)) + if (tp->snd_cwnd <= tp->snd_wnd) tp->ccv->flags |= CCF_CWND_LIMITED; else tp->ccv->flags &= ~CCF_CWND_LIMITED; From owner-svn-src-stable-9@FreeBSD.ORG Wed May 1 09:20:14 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 23895550; Wed, 1 May 2013 09:20:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 15A2A1380; Wed, 1 May 2013 09:20:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r419KD8L064309; Wed, 1 May 2013 09:20:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r419KD32064308; Wed, 1 May 2013 09:20:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201305010920.r419KD32064308@svn.freebsd.org> From: Alexander Motin Date: Wed, 1 May 2013 09: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 Subject: svn commit: r250142 - stable/9/sys/dev/usb/storage X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 May 2013 09:20:14 -0000 Author: mav Date: Wed May 1 09:20:13 2013 New Revision: 250142 URL: http://svnweb.freebsd.org/changeset/base/250142 Log: MFC r245328: Freeze device queue before returning errors to CAM. This is required for proper error recovery, including keeping original request order. Modified: stable/9/sys/dev/usb/storage/umass.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/storage/umass.c ============================================================================== --- stable/9/sys/dev/usb/storage/umass.c Wed May 1 08:57:45 2013 (r250141) +++ stable/9/sys/dev/usb/storage/umass.c Wed May 1 09:20:13 2013 (r250142) @@ -2251,8 +2251,11 @@ umass_cam_action(struct cam_sim *sim, un /*ascq*/ 0x00, /*extra args*/ SSD_ELEM_NONE); ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; - ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR | - CAM_AUTOSNS_VALID; + ccb->ccb_h.status = + CAM_SCSI_STATUS_ERROR | + CAM_AUTOSNS_VALID | + CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); xpt_done(ccb); goto done; } @@ -2512,7 +2515,8 @@ umass_cam_cb(struct umass_softc *sc, uni * recovered. We return an error to CAM and let CAM * retry the command if necessary. */ - ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_freeze_devq(ccb->ccb_h.path, 1); + ccb->ccb_h.status = CAM_REQ_CMP_ERR | CAM_DEV_QFRZN; xpt_done(ccb); break; } @@ -2575,8 +2579,9 @@ umass_cam_sense_cb(struct umass_softc *s * usual. */ + xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID; + | CAM_AUTOSNS_VALID | CAM_DEV_QFRZN; ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; #if 0 @@ -2587,17 +2592,18 @@ umass_cam_sense_cb(struct umass_softc *s /* the rest of the command was filled in at attach */ - if (umass_std_transform(sc, ccb, + if ((sc->sc_transform)(sc, &sc->cam_scsi_test_unit_ready.opcode, - sizeof(sc->cam_scsi_test_unit_ready))) { + sizeof(sc->cam_scsi_test_unit_ready)) == 1) { umass_command_start(sc, DIR_NONE, NULL, 0, ccb->ccb_h.timeout, &umass_cam_quirk_cb, ccb); + break; } - break; } else { + xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID; + | CAM_AUTOSNS_VALID | CAM_DEV_QFRZN; ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; } xpt_done(ccb); @@ -2606,15 +2612,16 @@ umass_cam_sense_cb(struct umass_softc *s default: DPRINTF(sc, UDMASS_SCSI, "Autosense failed, " "status %d\n", status); - ccb->ccb_h.status = CAM_AUTOSENSE_FAIL; + xpt_freeze_devq(ccb->ccb_h.path, 1); + ccb->ccb_h.status = CAM_AUTOSENSE_FAIL | CAM_DEV_QFRZN; xpt_done(ccb); } } /* * This completion code just handles the fact that we sent a test-unit-ready - * after having previously failed a READ CAPACITY with CHECK_COND. Even - * though this command succeeded, we have to tell CAM to retry. + * after having previously failed a READ CAPACITY with CHECK_COND. The CCB + * status for CAM is already set earlier. */ static void umass_cam_quirk_cb(struct umass_softc *sc, union ccb *ccb, uint32_t residue, @@ -2623,9 +2630,6 @@ umass_cam_quirk_cb(struct umass_softc *s DPRINTF(sc, UDMASS_SCSI, "Test unit ready " "returned status %d\n", status); - ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID; - ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; xpt_done(ccb); } @@ -2914,7 +2918,8 @@ umass_std_transform(struct umass_softc * xpt_done(ccb); return (0); } else if (retval == 0) { - ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_freeze_devq(ccb->ccb_h.path, 1); + ccb->ccb_h.status = CAM_REQ_INVALID | CAM_DEV_QFRZN; xpt_done(ccb); return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Wed May 1 11:10:16 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6E070935; Wed, 1 May 2013 11:10:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4548417A9; Wed, 1 May 2013 11:10:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r41BAGhv002759; Wed, 1 May 2013 11:10:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r41BAFXT002756; Wed, 1 May 2013 11:10:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201305011110.r41BAFXT002756@svn.freebsd.org> From: Alexander Motin Date: Wed, 1 May 2013 11:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250144 - in stable/9/sys: cam/scsi dev/usb/storage X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 May 2013 11:10:16 -0000 Author: mav Date: Wed May 1 11:10:15 2013 New Revision: 250144 URL: http://svnweb.freebsd.org/changeset/base/250144 Log: MFC r245647 (by kan): Do not pretend to have autosense data when no such data is available. Make umass return an error code if SCSI sense retrieval request has failed. Make sure scsi_error_action honors SF_NO_RETRY and SF_NO_RECOVERY in all cases, even if it cannot parse sense bytes. Modified: stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/dev/usb/storage/umass.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Wed May 1 09:56:09 2013 (r250143) +++ stable/9/sys/cam/scsi/scsi_all.c Wed May 1 11:10:15 2013 (r250144) @@ -3071,16 +3071,15 @@ scsi_error_action(struct ccb_scsiio *csi SSQ_PRINT_SENSE; } } - if ((action & SS_MASK) >= SS_START && - (sense_flags & SF_NO_RECOVERY)) { - action &= ~SS_MASK; - action |= SS_FAIL; - } else if ((action & SS_MASK) == SS_RETRY && - (sense_flags & SF_NO_RETRY)) { - action &= ~SS_MASK; - action |= SS_FAIL; - } - + } + if ((action & SS_MASK) >= SS_START && + (sense_flags & SF_NO_RECOVERY)) { + action &= ~SS_MASK; + action |= SS_FAIL; + } else if ((action & SS_MASK) == SS_RETRY && + (sense_flags & SF_NO_RETRY)) { + action &= ~SS_MASK; + action |= SS_FAIL; } if ((sense_flags & SF_PRINT_ALWAYS) != 0) action |= SSQ_PRINT_SENSE; Modified: stable/9/sys/dev/usb/storage/umass.c ============================================================================== --- stable/9/sys/dev/usb/storage/umass.c Wed May 1 09:56:09 2013 (r250143) +++ stable/9/sys/dev/usb/storage/umass.c Wed May 1 11:10:15 2013 (r250144) @@ -2602,9 +2602,13 @@ umass_cam_sense_cb(struct umass_softc *s } } else { xpt_freeze_devq(ccb->ccb_h.path, 1); - ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID | CAM_DEV_QFRZN; - ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + if (key >= 0) { + ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR + | CAM_AUTOSNS_VALID | CAM_DEV_QFRZN; + ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + } else + ccb->ccb_h.status = CAM_AUTOSENSE_FAIL + | CAM_DEV_QFRZN; } xpt_done(ccb); break; From owner-svn-src-stable-9@FreeBSD.ORG Wed May 1 18:06:54 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B5AE1F36; Wed, 1 May 2013 18:06:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8BF951D1F; Wed, 1 May 2013 18:06:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r41I6soM049912; Wed, 1 May 2013 18:06:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r41I6sGs049910; Wed, 1 May 2013 18:06:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201305011806.r41I6sGs049910@svn.freebsd.org> From: Dimitry Andric Date: Wed, 1 May 2013 18:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250151 - in stable: 6/sys/boot/i386/btx/btx 6/sys/boot/pc98/btx/btx 7/sys/boot/i386/btx/btx 7/sys/boot/pc98/btx/btx 8/sys/boot/i386/btx/btx 8/sys/boot/pc98/btx/btx 9/sys/boot/i386/btx/... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 May 2013 18:06:54 -0000 Author: dim Date: Wed May 1 18:06:53 2013 New Revision: 250151 URL: http://svnweb.freebsd.org/changeset/base/250151 Log: MFC r249846: When rebooting (exiting) from the BTX loader, make sure to restore the GDT from the correct segment, otherwise a triple fault would be caused. In some virtual environments (VMware, VirtualBox, etc) this could lead to a unhandled error or hang in the guest emulation software. Thanks to avg and jhb for a few hints in the right direction. Noticed by: Jeremy Chadwick (and many others) Modified: stable/9/sys/boot/i386/btx/btx/btx.S stable/9/sys/boot/pc98/btx/btx/btx.S Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Changes in other areas also in this revision: Modified: stable/6/sys/boot/i386/btx/btx/btx.S stable/6/sys/boot/pc98/btx/btx/btx.S stable/7/sys/boot/i386/btx/btx/btx.S stable/7/sys/boot/pc98/btx/btx/btx.S stable/8/sys/boot/i386/btx/btx/btx.S stable/8/sys/boot/pc98/btx/btx/btx.S Directory Properties: stable/6/sys/ (props changed) stable/7/sys/ (props changed) stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/9/sys/boot/i386/btx/btx/btx.S ============================================================================== --- stable/9/sys/boot/i386/btx/btx/btx.S Wed May 1 17:59:41 2013 (r250150) +++ stable/9/sys/boot/i386/btx/btx/btx.S Wed May 1 18:06:53 2013 (r250151) @@ -248,7 +248,7 @@ exit: cli # Disable interrupts /* * Restore the GDT in case we caught a kernel trap. */ - lgdt gdtdesc # Set GDT + lgdt %cs:gdtdesc # Set GDT /* * To 16 bits. */ Modified: stable/9/sys/boot/pc98/btx/btx/btx.S ============================================================================== --- stable/9/sys/boot/pc98/btx/btx/btx.S Wed May 1 17:59:41 2013 (r250150) +++ stable/9/sys/boot/pc98/btx/btx/btx.S Wed May 1 18:06:53 2013 (r250151) @@ -248,7 +248,7 @@ exit: cli # Disable interrupts /* * Restore the GDT in case we caught a kernel trap. */ - lgdt gdtdesc # Set GDT + lgdt %cs:gdtdesc # Set GDT /* * To 16 bits. */ From owner-svn-src-stable-9@FreeBSD.ORG Thu May 2 04:22:05 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 78FC7403; Thu, 2 May 2013 04:22:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6B711132C; Thu, 2 May 2013 04:22:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r424M4kI069018; Thu, 2 May 2013 04:22:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r424M4XR069017; Thu, 2 May 2013 04:22:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201305020422.r424M4XR069017@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 2 May 2013 04:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250170 - stable/9/libexec/rtld-elf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 04:22:05 -0000 Author: kib Date: Thu May 2 04:22:04 2013 New Revision: 250170 URL: http://svnweb.freebsd.org/changeset/base/250170 Log: MFC r250075: Properly terminate the result string for intermediate results. Modified: stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Thu May 2 01:39:32 2013 (r250169) +++ stable/9/libexec/rtld-elf/rtld.c Thu May 2 04:22:04 2013 (r250170) @@ -784,7 +784,7 @@ origin_subst_one(char *real, const char /* * Now, execute the substitution loop. */ - for (p = real, resp = res;;) { + for (p = real, resp = res, *resp = '\0';;) { p1 = strstr(p, kw); if (p1 != NULL) { /* Copy the prefix before keyword. */ @@ -793,6 +793,7 @@ origin_subst_one(char *real, const char /* Keyword replacement. */ memcpy(resp, subst, subst_len); resp += subst_len; + *resp = '\0'; p = p1 + kw_len; } else break; From owner-svn-src-stable-9@FreeBSD.ORG Thu May 2 05:00:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6316FBC2 for ; Thu, 2 May 2013 05:00:44 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [IPv6:2a00:1450:4010:c03::22a]) by mx1.freebsd.org (Postfix) with ESMTP id DEF12146B for ; Thu, 2 May 2013 05:00:43 +0000 (UTC) Received: by mail-la0-f42.google.com with SMTP id fq13so159711lab.15 for ; Wed, 01 May 2013 22:00:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=j/PnHtxLVn4XeHrl5IGaOL4aYU6/eSTS0U0+YmQAYSU=; b=e5BHbH9/7mmG1lK+pzjWwgb1MO5CY+iRWPqoBtwnOqcVkPfZOYsSJHAXe/NuvBkvcD D+TkOpZ+Sj30+0Pa946p2qeLZa9/PgFlx0eoVLj8Tge+Yp9uuHwyCMECKjDEscidfP7N uroJLRRtkeVtCMTe9+lXFSGht+gMHarHAt4YQl1H1+aAqlypstUWqOLroB27V9VYZ8Qh MhGFJ9n4um3e7Hd/FBZIQdi3QODPNWRbgmtWv6IB17Disk6EhLv/hNZkYVhjVKA1SxDb EMmsCLn/T+pk7BBE8+NCEBkUfO61yuF/rPzd5IGKReYKYINwhZvpxKxLaW2Y5ECxlrMl 1sEA== X-Received: by 10.112.146.6 with SMTP id sy6mr2047289lbb.105.1367470842789; Wed, 01 May 2013 22:00:42 -0700 (PDT) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPSA id x9sm2127434lbi.15.2013.05.01.22.00.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 May 2013 22:00:42 -0700 (PDT) Message-ID: <5181F2E6.2020603@freebsd.org> Date: Thu, 02 May 2013 09:00:22 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Brooks Davis Subject: Re: svn commit: r250121 - in stable/9: . etc share/mk References: <201304302213.r3UMDuoZ028919@svn.freebsd.org> In-Reply-To: <201304302213.r3UMDuoZ028919@svn.freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQm11Md3NeuAe/6SOV86zyycCrK4OqndXU/MoO4/CoAIMM2DFiSROpSghsDwjpJkLGv+L/AX Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 05:00:44 -0000 On 01.05.2013 2:13, Brooks Davis wrote: > + Due to the use of the new -l option to install(1) during build > + and install, you must take care not to directly set the INSTALL > + make variable in your /etc/make.conf, /etc/src.conf, or on the > + command line. If you with to use the -C flag for all installs > + you may be able to add INSTALL+=-C to /etc/make.conf or > + /etc/src.conf. You need to update /usr/src/share/examples/etc/make.conf too, there is # Compare before install #INSTALL=install -C -- bitcoin:13fGiNutKNHcVSsgtGQ7bQ5kgUKgEQHn7N From owner-svn-src-stable-9@FreeBSD.ORG Thu May 2 05:09:51 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 073D0D77 for ; Thu, 2 May 2013 05:09:51 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com [IPv6:2a00:1450:4010:c03::22b]) by mx1.freebsd.org (Postfix) with ESMTP id 82E02149F for ; Thu, 2 May 2013 05:09:50 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id ea20so164808lab.16 for ; Wed, 01 May 2013 22:09:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=l7V91misio2G/+5tHTtEm8fuRFbsraFa9d3D/2eE8Qw=; b=Wc3c2xv6VjFsho5uMMco0d9X58UVdCgB8SHtA7DVymItz2sLRZcrzJ3P0wd7N7aDTE gY1bs556Y+GRno3jGhYtkhBW4EoN7uuAH5on2xsvQZ7sM24xIH96YhPb2OaWcbWMMo1q vMF5WXB5ch5R42aL88EXTAsdTQ9I1MS/L3ozNmxAWeITTbq9M6NG3dVFQ0/zFz6qBwS7 BGKWfQKRKIWc0cNmDjJX28rz45yhdZTFLmYGTRXb+Ta99W5dhBIqo3V5hjmq9k9n0S1A 80Vc+IKAquocOV6c3o8vKjPsvoDip2DwgjQd8TSxwaU+OCWsb4ng+gl1N7XOhEKS0sFy VN9g== X-Received: by 10.152.5.106 with SMTP id r10mr1897035lar.18.1367471389362; Wed, 01 May 2013 22:09:49 -0700 (PDT) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPSA id t20sm2161583lbi.5.2013.05.01.22.09.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 May 2013 22:09:48 -0700 (PDT) Message-ID: <5181F509.2010003@freebsd.org> Date: Thu, 02 May 2013 09:09:29 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Brooks Davis Subject: Re: svn commit: r250121 - in stable/9: . etc share/mk References: <201304302213.r3UMDuoZ028919@svn.freebsd.org> In-Reply-To: <201304302213.r3UMDuoZ028919@svn.freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmWC6X51gURtfQQznuzjxkqKu5DGQsKYozARHzZAekwdi6Si/cxvcXsup2sPYxZmeGolN9I Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 05:09:51 -0000 On 01.05.2013 2:13, Brooks Davis wrote: > +# > +# install(1) parameters. > +# > +HRDLINK?= -l h > +SYMLINK?= -l s It is error, there must be no space or "-" sign. -- bitcoin:13fGiNutKNHcVSsgtGQ7bQ5kgUKgEQHn7N From owner-svn-src-stable-9@FreeBSD.ORG Thu May 2 05:12:29 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E0A92EF3 for ; Thu, 2 May 2013 05:12:29 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-x230.google.com (mail-la0-x230.google.com [IPv6:2a00:1450:4010:c03::230]) by mx1.freebsd.org (Postfix) with ESMTP id 67BF714AE for ; Thu, 2 May 2013 05:12:29 +0000 (UTC) Received: by mail-la0-f48.google.com with SMTP id eg20so165374lab.35 for ; Wed, 01 May 2013 22:12:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=2g7gmf2bIWFFVInoLbLDrQkjP9dW1Wtb1CwjKEpg5bA=; b=flLkIUIR63jv2luijYITkNxPBtZoLCtFdoyhG7yA2jukER8SoBf8AccEO1nHhM0lhB 6J7gSR/kJxRsaAPyojwZmxYysh17qYr30HcrBFO8v5I79adZSoYARe5xAsnz0RbE/Qq0 qblWz9jCx7aDlVkNXM57AIC48XsJHsnzRbGR24W7v76nv52gX0xgy1wIAmmewO6fCfG9 lnWzatzl7qFUFT3jopFtr4tyk9smj1pj3Fx6UhP+L7ygLkYVzOBHn1fhKTlTxqIeltNN ntC4SrhP7dLEALSnETtpVLS/SBy7CNO4elrOn9JHEbKwyzf0lNDmRspA8dltx3se6SzP BrUg== X-Received: by 10.112.129.2 with SMTP id ns2mr2082517lbb.53.1367471548346; Wed, 01 May 2013 22:12:28 -0700 (PDT) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPSA id r9sm2171083lbr.3.2013.05.01.22.12.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 May 2013 22:12:27 -0700 (PDT) Message-ID: <5181F5A8.1070503@freebsd.org> Date: Thu, 02 May 2013 09:12:08 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Brooks Davis Subject: Re: svn commit: r250121 - in stable/9: . etc share/mk References: <201304302213.r3UMDuoZ028919@svn.freebsd.org> <5181F509.2010003@freebsd.org> In-Reply-To: <5181F509.2010003@freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmxXf8JQ3kYfEwyXt3eHqsDkx7ISBkZUu8E1uW6BMGBMiMGvM6Jav8OzGD0IM3eSQivfnXo Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 05:12:29 -0000 On 02.05.2013 9:09, Andrey Chernov wrote: > On 01.05.2013 2:13, Brooks Davis wrote: >> +# >> +# install(1) parameters. >> +# >> +HRDLINK?= -l h >> +SYMLINK?= -l s > > It is error, there must be no space or "-" sign. Sorry my mistake. All right. -- bitcoin:13fGiNutKNHcVSsgtGQ7bQ5kgUKgEQHn7N From owner-svn-src-stable-9@FreeBSD.ORG Thu May 2 13:34:41 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0C0046C7; Thu, 2 May 2013 13:34:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F22B21CAA; Thu, 2 May 2013 13:34:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r42DYeTP063040; Thu, 2 May 2013 13:34:40 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r42DYeZX063038; Thu, 2 May 2013 13:34:40 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201305021334.r42DYeZX063038@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 May 2013 13:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250178 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 13:34:41 -0000 Author: rmacklem Date: Thu May 2 13:34:40 2013 New Revision: 250178 URL: http://svnweb.freebsd.org/changeset/base/250178 Log: MFC: r249548 Allow the vnode to be unlocked for the weird case of LK_EXCLOTHER. LK_EXCLOTHER is only used to acquire a usecount on a vnode during NFSv4 recovery from an expired lease. Modified: stable/9/sys/kern/vfs_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Thu May 2 12:52:49 2013 (r250177) +++ stable/9/sys/kern/vfs_subr.c Thu May 2 13:34:40 2013 (r250178) @@ -4182,7 +4182,7 @@ vop_lock_post(void *ap, int rc) struct vop_lock1_args *a = ap; ASSERT_VI_UNLOCKED(a->a_vp, "VOP_LOCK"); - if (rc == 0) + if (rc == 0 && (a->a_flags & LK_EXCLOTHER) == 0) ASSERT_VOP_LOCKED(a->a_vp, "VOP_LOCK"); #endif } From owner-svn-src-stable-9@FreeBSD.ORG Thu May 2 15:05:32 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A39D52D7 for ; Thu, 2 May 2013 15:05:32 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 710EE11D9 for ; Thu, 2 May 2013 15:05:32 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r42F5Wwh036958 for ; Thu, 2 May 2013 15:05:32 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r42F5Wmf036948 for svn-src-stable-9@freebsd.org; Thu, 2 May 2013 15:05:32 GMT (envelope-from bdrewery) Received: (qmail 84190 invoked from network); 2 May 2013 10:05:30 -0500 Received: from unknown (HELO ?173.160.118.90?) (freebsd@shatow.net@173.160.118.90) by sweb.xzibition.com with ESMTPA; 2 May 2013 10:05:30 -0500 Message-ID: <518280BA.1000607@FreeBSD.org> Date: Thu, 02 May 2013 10:05:30 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Andrey Chernov Subject: Re: svn commit: r250121 - in stable/9: . etc share/mk References: <201304302213.r3UMDuoZ028919@svn.freebsd.org> <5181F2E6.2020603@freebsd.org> In-Reply-To: <5181F2E6.2020603@freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2WDQNVDBPGEIGMKLMJRIH" Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Brooks Davis , src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 15:05:32 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2WDQNVDBPGEIGMKLMJRIH Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 5/2/2013 12:00 AM, Andrey Chernov wrote: > On 01.05.2013 2:13, Brooks Davis wrote: >> + Due to the use of the new -l option to install(1) during build >> + and install, you must take care not to directly set the INSTALL >> + make variable in your /etc/make.conf, /etc/src.conf, or on the >> + command line. If you with to use the -C flag for all installs >> + you may be able to add INSTALL+=3D-C to /etc/make.conf or >> + /etc/src.conf. >=20 > You need to update /usr/src/share/examples/etc/make.conf too, there is > # Compare before install > #INSTALL=3Dinstall -C >=20 I've done so in HEAD r249952, I just need to MFC it now. --=20 Regards, Bryan Drewery ------enig2WDQNVDBPGEIGMKLMJRIH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRgoC+AAoJEG54KsA8mwz51YMP/jqNR/G1w8lA4vDTXoYws16t 5scyiqXMUDno3JjrK+l25/BjCvnVUyyb/7Rot7DhFWIIqAGgOSsvedsM9IquxQuE ypHQwHJGDtOeXqsK2V4sxmsclZHaQ2WYVx9RWlRLCiLQGrP9Ruth2FkWETyjyZDd D/zJB+CqrAYKUTl5f/VpAYevVK/r0Wo+5iSzMq0MYViiCHrQ/Smz8qZs9iTwiHAn DZ0LJ0LHZ30jQZHicGWDKZDqzhb1Z4h36GnxDxuFEe8gx8G0DZAK9jTbq7QAxTio n63QiGz5UKcgQr7ViCjt/OkezYn9AhZ3Aa2/cOFISafrfGFEQ8xG+mbk4g79DMq3 IEM7hy0Fy7a2eR35EZjayZu+DAg1s+TmYK/zKJDcAX8y7MKqdp4v+iv0Un+wJLNY EkRuy1yko0cdUBCrWRHbHFrCO2a30b2/fXHG9PNJTpnj0MzuxJxREreuFgdjaGYI ddywIYdDv/TgkLqpd9jfGHxU4ORTVin06PxsaQL+D27mGcetWJyoDXTfoy1X4wVQ UxpDAUbfSzbTGMYAyO67HueCDQmlTYiVve4SEHKRfj1ndmOnHlsTSVEFVsmnjv8+ 6v7QYWzndfvUgrbWrfbzhfiLCqfZabkd4D52pZUmbp7Tuzwk67oyEM4pxu8P9fbY hN4ZcKIBIepnXXN5NLsF =1oAl -----END PGP SIGNATURE----- ------enig2WDQNVDBPGEIGMKLMJRIH-- From owner-svn-src-stable-9@FreeBSD.ORG Thu May 2 21:49:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5471B425; Thu, 2 May 2013 21:49:44 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 450FF1710; Thu, 2 May 2013 21:49:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r42Lnhi3041348; Thu, 2 May 2013 21:49:43 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r42LnhrK041347; Thu, 2 May 2013 21:49:43 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201305022149.r42LnhrK041347@svn.freebsd.org> From: Bryan Drewery Date: Thu, 2 May 2013 21:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250195 - stable/9/etc/rc.d X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 21:49:44 -0000 Author: bdrewery (ports committer) Date: Thu May 2 21:49:43 2013 New Revision: 250195 URL: http://svnweb.freebsd.org/changeset/base/250195 Log: MFC r249489,249555 Run configtest before restarting so that the system is not left without a running sshd. Also call configtest before reload to ensure working config. Modified: stable/9/etc/rc.d/sshd Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/rc.d/sshd ============================================================================== --- stable/9/etc/rc.d/sshd Thu May 2 21:09:47 2013 (r250194) +++ stable/9/etc/rc.d/sshd Thu May 2 21:49:43 2013 (r250195) @@ -14,6 +14,8 @@ rcvar="sshd_enable" command="/usr/sbin/${name}" keygen_cmd="sshd_keygen" start_precmd="sshd_precmd" +reload_precmd="sshd_configtest" +restart_precmd="sshd_configtest" configtest_cmd="sshd_configtest" pidfile="/var/run/${name}.pid" extra_commands="configtest keygen reload" From owner-svn-src-stable-9@FreeBSD.ORG Fri May 3 14:59:36 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3CAC32DD; Fri, 3 May 2013 14:59:36 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C335162E; Fri, 3 May 2013 14:59:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r43Exa0a004750; Fri, 3 May 2013 14:59:36 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r43ExWeK004724; Fri, 3 May 2013 14:59:32 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201305031459.r43ExWeK004724@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 3 May 2013 14:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250213 - stable/9/lib/libc/locale X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2013 14:59:36 -0000 Author: pluknet Date: Fri May 3 14:59:32 2013 New Revision: 250213 URL: http://svnweb.freebsd.org/changeset/base/250213 Log: MFC r233473,233512,233518,233992,233994,238808,238920,250209-250211. libc/locale: sync mdoc changes with head. r233473: mdoc: document title should be all caps. r233512: mdoc: remove empty lines. r233518: mdoc: remove unknown macro. r233992: mdoc: fix column names, indentation, column separation within each row, and quotation. Also make sure we have the same amount of columns in each row as the number of columns we specify in the head arguments. r233994: mdoc: fix function type. r238808: Start manpage with Dd macro and also remove a trailing whitespace while here. r238920: Remove trailing whitespace. r250209: querylocale(3): remove the STANDARDS section. r250210,r250211: Remove an extra comma, add a missing period. Modified: stable/9/lib/libc/locale/duplocale.3 stable/9/lib/libc/locale/freelocale.3 stable/9/lib/libc/locale/isalnum.3 stable/9/lib/libc/locale/isalpha.3 stable/9/lib/libc/locale/iscntrl.3 stable/9/lib/libc/locale/isdigit.3 stable/9/lib/libc/locale/isgraph.3 stable/9/lib/libc/locale/islower.3 stable/9/lib/libc/locale/isprint.3 stable/9/lib/libc/locale/ispunct.3 stable/9/lib/libc/locale/isspace.3 stable/9/lib/libc/locale/isupper.3 stable/9/lib/libc/locale/iswalnum_l.3 stable/9/lib/libc/locale/isxdigit.3 stable/9/lib/libc/locale/newlocale.3 stable/9/lib/libc/locale/querylocale.3 stable/9/lib/libc/locale/uselocale.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/locale/duplocale.3 ============================================================================== --- stable/9/lib/libc/locale/duplocale.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/duplocale.3 Fri May 3 14:59:32 2013 (r250213) @@ -56,7 +56,6 @@ associated with the current thread by .Xr uselocale 3 . These calls are therefore only thread safe on threads with a unique per-thread locale. -.Pt The locale returned by this call must be freed with .Xr freelocale 3 . .Sh BUGS @@ -76,5 +75,5 @@ for compatibility with Darwin. .Xr uselocale 3 , .Xr xlocale 3 .Sh STANDARDS -This function, conforms to -.St -p1003.1-2008 +This function conforms to +.St -p1003.1-2008 . Modified: stable/9/lib/libc/locale/freelocale.3 ============================================================================== --- stable/9/lib/libc/locale/freelocale.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/freelocale.3 Fri May 3 14:59:32 2013 (r250213) @@ -57,5 +57,5 @@ Returns 0 on success or -1 on error. .Xr uselocale 3 , .Xr xlocale 3 .Sh STANDARDS -This function, conforms to +This function conforms to .St -p1003.1-2008 . Modified: stable/9/lib/libc/locale/isalnum.3 ============================================================================== --- stable/9/lib/libc/locale/isalnum.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isalnum.3 Fri May 3 14:59:32 2013 (r250213) @@ -62,19 +62,19 @@ or the value of In the ASCII character set, this includes the following characters (with their numeric values shown in octal): .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3'' \t064\ ``4''" -.It "\&065\ ``5'' \t066\ ``6'' \t067\ ``7'' \t070\ ``8'' \t071\ ``9''" -.It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''" -.It "\&106\ ``F'' \t107\ ``G'' \t110\ ``H'' \t111\ ``I'' \t112\ ``J''" -.It "\&113\ ``K'' \t114\ ``L'' \t115\ ``M'' \t116\ ``N'' \t117\ ``O''" -.It "\&120\ ``P'' \t121\ ``Q'' \t122\ ``R'' \t123\ ``S'' \t124\ ``T''" -.It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''" -.It "\&132\ ``Z'' \t141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d''" -.It "\&145\ ``e'' \t146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i''" -.It "\&152\ ``j'' \t153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n''" -.It "\&157\ ``o'' \t160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s''" -.It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" -.It "\&171\ ``y'' \t172\ ``z''" +.It "\&060\ ``0''" Ta "061\ ``1''" Ta "062\ ``2''" Ta "063\ ``3''" Ta "064\ ``4''" +.It "\&065\ ``5''" Ta "066\ ``6''" Ta "067\ ``7''" Ta "070\ ``8''" Ta "071\ ``9''" +.It "\&101\ ``A''" Ta "102\ ``B''" Ta "103\ ``C''" Ta "104\ ``D''" Ta "105\ ``E''" +.It "\&106\ ``F''" Ta "107\ ``G''" Ta "110\ ``H''" Ta "111\ ``I''" Ta "112\ ``J''" +.It "\&113\ ``K''" Ta "114\ ``L''" Ta "115\ ``M''" Ta "116\ ``N''" Ta "117\ ``O''" +.It "\&120\ ``P''" Ta "121\ ``Q''" Ta "122\ ``R''" Ta "123\ ``S''" Ta "124\ ``T''" +.It "\&125\ ``U''" Ta "126\ ``V''" Ta "127\ ``W''" Ta "130\ ``X''" Ta "131\ ``Y''" +.It "\&132\ ``Z''" Ta "141\ ``a''" Ta "142\ ``b''" Ta "143\ ``c''" Ta "144\ ``d''" +.It "\&145\ ``e''" Ta "146\ ``f''" Ta "147\ ``g''" Ta "150\ ``h''" Ta "151\ ``i''" +.It "\&152\ ``j''" Ta "153\ ``k''" Ta "154\ ``l''" Ta "155\ ``m''" Ta "156\ ``n''" +.It "\&157\ ``o''" Ta "160\ ``p''" Ta "161\ ``q''" Ta "162\ ``r''" Ta "163\ ``s''" +.It "\&164\ ``t''" Ta "165\ ``u''" Ta "166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" +.It "\&171\ ``y''" Ta "172\ ``z''" Ta \& Ta \& Ta \& .El .Pp The Modified: stable/9/lib/libc/locale/isalpha.3 ============================================================================== --- stable/9/lib/libc/locale/isalpha.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isalpha.3 Fri May 3 14:59:32 2013 (r250213) @@ -62,18 +62,19 @@ or the value of In the ASCII character set, this includes the following characters (with their numeric values shown in octal): .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''" -.It "\&106\ ``F'' \t107\ ``G'' \t110\ ``H'' \t111\ ``I'' \t112\ ``J''" -.It "\&113\ ``K'' \t114\ ``L'' \t115\ ``M'' \t116\ ``N'' \t117\ ``O''" -.It "\&120\ ``P'' \t121\ ``Q'' \t122\ ``R'' \t123\ ``S'' \t124\ ``T''" -.It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''" -.It "\&132\ ``Z'' \t141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d''" -.It "\&145\ ``e'' \t146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i''" -.It "\&152\ ``j'' \t153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n''" -.It "\&157\ ``o'' \t160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s''" -.It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" -.It "\&171\ ``y'' \t172\ ``z''" +.It "\&101\ ``A''" Ta "102\ ``B''" Ta "103\ ``C''" Ta "104\ ``D''" Ta "105\ ``E''" +.It "\&106\ ``F''" Ta "107\ ``G''" Ta "110\ ``H''" Ta "111\ ``I''" Ta "112\ ``J''" +.It "\&113\ ``K''" Ta "114\ ``L''" Ta "115\ ``M''" Ta "116\ ``N''" Ta "117\ ``O''" +.It "\&120\ ``P''" Ta "121\ ``Q''" Ta "122\ ``R''" Ta "123\ ``S''" Ta "124\ ``T''" +.It "\&125\ ``U''" Ta "126\ ``V''" Ta "127\ ``W''" Ta "130\ ``X''" Ta "131\ ``Y''" +.It "\&132\ ``Z''" Ta "141\ ``a''" Ta "142\ ``b''" Ta "143\ ``c''" Ta "144\ ``d''" +.It "\&145\ ``e''" Ta "146\ ``f''" Ta "147\ ``g''" Ta "150\ ``h''" Ta "151\ ``i''" +.It "\&152\ ``j''" Ta "153\ ``k''" Ta "154\ ``l''" Ta "155\ ``m''" Ta "156\ ``n''" +.It "\&157\ ``o''" Ta "160\ ``p''" Ta "161\ ``q''" Ta "162\ ``r''" Ta "163\ ``s''" +.It "\&164\ ``t''" Ta "165\ ``u''" Ta "166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" +.It "\&171\ ``y''" Ta "172\ ``z''" Ta \& Ta \& Ta \& .El +.Pp The .Fn isalpha_l function takes an explicit locale argument, whereas the @@ -110,4 +111,3 @@ The .Fn isalpha_l function conforms to .St -p1003.1-2008 . - Modified: stable/9/lib/libc/locale/iscntrl.3 ============================================================================== --- stable/9/lib/libc/locale/iscntrl.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/iscntrl.3 Fri May 3 14:59:32 2013 (r250213) @@ -59,13 +59,13 @@ In the ASCII character set, this include (with their numeric values shown in octal): .Pp .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&000\ NUL \t001\ SOH \t002\ STX \t003\ ETX \t004\ EOT" -.It "\&005\ ENQ \t006\ ACK \t007\ BEL \t010\ BS \t011\ HT" -.It "\&012\ NL \t013\ VT \t014\ NP \t015\ CR \t016\ SO" -.It "\&017\ SI \t020\ DLE \t021\ DC1 \t022\ DC2 \t023\ DC3" -.It "\&024\ DC4 \t025\ NAK \t026\ SYN \t027\ ETB \t030\ CAN" -.It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" -.It "\&036\ RS \t037\ US \t177\ DEL" +.It "\&000\ NUL" Ta "001\ SOH" Ta "002\ STX" Ta "003\ ETX" Ta "004\ EOT" +.It "\&005\ ENQ" Ta "006\ ACK" Ta "007\ BEL" Ta "010\ BS" Ta "011\ HT" +.It "\&012\ NL" Ta "013\ VT" Ta "014\ NP" Ta "015\ CR" Ta "016\ SO" +.It "\&017\ SI" Ta "020\ DLE" Ta "021\ DC1" Ta "022\ DC2" Ta "023\ DC3" +.It "\&024\ DC4" Ta "025\ NAK" Ta "026\ SYN" Ta "027\ ETB" Ta "030\ CAN" +.It "\&031\ EM" Ta "032\ SUB" Ta "033\ ESC" Ta "034\ FS" Ta "035\ GS" +.It "\&036\ RS" Ta "037\ US" Ta "177\ DEL" Ta \& Ta \& .El .Pp The Modified: stable/9/lib/libc/locale/isdigit.3 ============================================================================== --- stable/9/lib/libc/locale/isdigit.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isdigit.3 Fri May 3 14:59:32 2013 (r250213) @@ -57,8 +57,8 @@ function tests for a decimal digit chara Regardless of locale, this includes the following characters only: .Pp .Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______ -.It "\&``0''\t``1''\t``2''\t``3''\t``4''" -.It "\&``5''\t``6''\t``7''\t``8''\t``9''" +.It "\&``0''" Ta "``1''" Ta "``2''" Ta "``3''" Ta "``4''" +.It "\&``5''" Ta "``6''" Ta "``7''" Ta "``8''" Ta "``9''" .El .Pp The Modified: stable/9/lib/libc/locale/isgraph.3 ============================================================================== --- stable/9/lib/libc/locale/isgraph.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isgraph.3 Fri May 3 14:59:32 2013 (r250213) @@ -62,25 +62,25 @@ In the ASCII character set, this include (with their numeric values shown in octal): .Pp .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''" -.It "\&046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)'' \t052\ ``*''" -.It "\&053\ ``+'' \t054\ ``,'' \t055\ ``-'' \t056\ ``.'' \t057\ ``/''" -.It "\&060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3'' \t064\ ``4''" -.It "\&065\ ``5'' \t066\ ``6'' \t067\ ``7'' \t070\ ``8'' \t071\ ``9''" -.It "\&072\ ``:'' \t073\ ``;'' \t074\ ``<'' \t075\ ``='' \t076\ ``>''" -.It "\&077\ ``?'' \t100\ ``@'' \t101\ ``A'' \t102\ ``B'' \t103\ ``C''" -.It "\&104\ ``D'' \t105\ ``E'' \t106\ ``F'' \t107\ ``G'' \t110\ ``H''" -.It "\&111\ ``I'' \t112\ ``J'' \t113\ ``K'' \t114\ ``L'' \t115\ ``M''" -.It "\&116\ ``N'' \t117\ ``O'' \t120\ ``P'' \t121\ ``Q'' \t122\ ``R''" -.It "\&123\ ``S'' \t124\ ``T'' \t125\ ``U'' \t126\ ``V'' \t127\ ``W''" -.It "\&130\ ``X'' \t131\ ``Y'' \t132\ ``Z'' \t133\ ``['' \t134\ ``\e\|''" -.It "\&135\ ``]'' \t136\ ``^'' \t137\ ``_'' \t140\ ```'' \t141\ ``a''" -.It "\&142\ ``b'' \t143\ ``c'' \t144\ ``d'' \t145\ ``e'' \t146\ ``f''" -.It "\&147\ ``g'' \t150\ ``h'' \t151\ ``i'' \t152\ ``j'' \t153\ ``k''" -.It "\&154\ ``l'' \t155\ ``m'' \t156\ ``n'' \t157\ ``o'' \t160\ ``p''" -.It "\&161\ ``q'' \t162\ ``r'' \t163\ ``s'' \t164\ ``t'' \t165\ ``u''" -.It "\&166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y'' \t172\ ``z''" -.It "\&173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''" +.It "\&041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''" Ta "045\ ``%''" +.It "\&046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''" Ta "052\ ``*''" +.It "\&053\ ``+''" Ta "054\ ``,''" Ta "055\ ``-''" Ta "056\ ``.''" Ta "057\ ``/''" +.It "\&060\ ``0''" Ta "061\ ``1''" Ta "062\ ``2''" Ta "063\ ``3''" Ta "064\ ``4''" +.It "\&065\ ``5''" Ta "066\ ``6''" Ta "067\ ``7''" Ta "070\ ``8''" Ta "071\ ``9''" +.It "\&072\ ``:''" Ta "073\ ``;''" Ta "074\ ``<''" Ta "075\ ``=''" Ta "076\ ``>''" +.It "\&077\ ``?''" Ta "100\ ``@''" Ta "101\ ``A''" Ta "102\ ``B''" Ta "103\ ``C''" +.It "\&104\ ``D''" Ta "105\ ``E''" Ta "106\ ``F''" Ta "107\ ``G''" Ta "110\ ``H''" +.It "\&111\ ``I''" Ta "112\ ``J''" Ta "113\ ``K''" Ta "114\ ``L''" Ta "115\ ``M''" +.It "\&116\ ``N''" Ta "117\ ``O''" Ta "120\ ``P''" Ta "121\ ``Q''" Ta "122\ ``R''" +.It "\&123\ ``S''" Ta "124\ ``T''" Ta "125\ ``U''" Ta "126\ ``V''" Ta "127\ ``W''" +.It "\&130\ ``X''" Ta "131\ ``Y''" Ta "132\ ``Z''" Ta "133\ ``[''" Ta "134\ ``\e\|''" +.It "\&135\ ``]''" Ta "136\ ``^''" Ta "137\ ``_''" Ta "140\ ```''" Ta "141\ ``a''" +.It "\&142\ ``b''" Ta "143\ ``c''" Ta "144\ ``d''" Ta "145\ ``e''" Ta "146\ ``f''" +.It "\&147\ ``g''" Ta "150\ ``h''" Ta "151\ ``i''" Ta "152\ ``j''" Ta "153\ ``k''" +.It "\&154\ ``l''" Ta "155\ ``m''" Ta "156\ ``n''" Ta "157\ ``o''" Ta "160\ ``p''" +.It "\&161\ ``q''" Ta "162\ ``r''" Ta "163\ ``s''" Ta "164\ ``t''" Ta "165\ ``u''" +.It "\&166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" Ta "171\ ``y''" Ta "172\ ``z''" +.It "\&173\ ``{''" Ta "174\ ``|''" Ta "175\ ``}''" Ta "176\ ``~''" Ta \& .El .Pp The Modified: stable/9/lib/libc/locale/islower.3 ============================================================================== --- stable/9/lib/libc/locale/islower.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/islower.3 Fri May 3 14:59:32 2013 (r250213) @@ -59,18 +59,18 @@ In the ASCII character set, this include (with their numeric values shown in octal): .Pp .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d'' \t145\ ``e''" -.It "\&146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i'' \t152\ ``j''" -.It "\&153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n'' \t157\ ``o''" -.It "\&160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s'' \t164\ ``t''" -.It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''" -.It "\&172\ ``z''" +.It "\&141\ ``a''" Ta "142\ ``b''" Ta "143\ ``c''" Ta "144\ ``d''" Ta "145\ ``e''" +.It "\&146\ ``f''" Ta "147\ ``g''" Ta "150\ ``h''" Ta "151\ ``i''" Ta "152\ ``j''" +.It "\&153\ ``k''" Ta "154\ ``l''" Ta "155\ ``m''" Ta "156\ ``n''" Ta "157\ ``o''" +.It "\&160\ ``p''" Ta "161\ ``q''" Ta "162\ ``r''" Ta "163\ ``s''" Ta "164\ ``t''" +.It "\&165\ ``u''" Ta "166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" Ta "171\ ``y''" +.It "\&172\ ``z''" Ta \& Ta \& Ta \& Ta \& .El The .Fn islower_l function takes an explicit locale argument, whereas the .Fn islower -function uses the current global or per-thread locale. +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn islower Modified: stable/9/lib/libc/locale/isprint.3 ============================================================================== --- stable/9/lib/libc/locale/isprint.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isprint.3 Fri May 3 14:59:32 2013 (r250213) @@ -58,25 +58,25 @@ In the ASCII character set, this include (with their numeric values shown in octal): .Pp .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&040\ sp \t041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$''" -.It "\&045\ ``%'' \t046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)''" -.It "\&052\ ``*'' \t053\ ``+'' \t054\ ``,'' \t055\ ``-'' \t056\ ``.''" -.It "\&057\ ``/'' \t060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3''" -.It "\&064\ ``4'' \t065\ ``5'' \t066\ ``6'' \t067\ ``7'' \t070\ ``8''" -.It "\&071\ ``9'' \t072\ ``:'' \t073\ ``;'' \t074\ ``<'' \t075\ ``=''" -.It "\&076\ ``>'' \t077\ ``?'' \t100\ ``@'' \t101\ ``A'' \t102\ ``B''" -.It "\&103\ ``C'' \t104\ ``D'' \t105\ ``E'' \t106\ ``F'' \t107\ ``G''" -.It "\&110\ ``H'' \t111\ ``I'' \t112\ ``J'' \t113\ ``K'' \t114\ ``L''" -.It "\&115\ ``M'' \t116\ ``N'' \t117\ ``O'' \t120\ ``P'' \t121\ ``Q''" -.It "\&122\ ``R'' \t123\ ``S'' \t124\ ``T'' \t125\ ``U'' \t126\ ``V''" -.It "\&127\ ``W'' \t130\ ``X'' \t131\ ``Y'' \t132\ ``Z'' \t133\ ``[''" -.It "\&134\ ``\e\|'' \t135\ ``]'' \t136\ ``^'' \t137\ ``_'' \t140\ ```''" -.It "\&141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d'' \t145\ ``e''" -.It "\&146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i'' \t152\ ``j''" -.It "\&153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n'' \t157\ ``o''" -.It "\&160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s'' \t164\ ``t''" -.It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''" -.It "\&172\ ``z'' \t173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''" +.It "\&040\ sp" Ta "041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''" +.It "\&045\ ``%''" Ta "046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''" +.It "\&052\ ``*''" Ta "053\ ``+''" Ta "054\ ``,''" Ta "055\ ``-''" Ta "056\ ``.''" +.It "\&057\ ``/''" Ta "060\ ``0''" Ta "061\ ``1''" Ta "062\ ``2''" Ta "063\ ``3''" +.It "\&064\ ``4''" Ta "065\ ``5''" Ta "066\ ``6''" Ta "067\ ``7''" Ta "070\ ``8''" +.It "\&071\ ``9''" Ta "072\ ``:''" Ta "073\ ``;''" Ta "074\ ``<''" Ta "075\ ``=''" +.It "\&076\ ``>''" Ta "077\ ``?''" Ta "100\ ``@''" Ta "101\ ``A''" Ta "102\ ``B''" +.It "\&103\ ``C''" Ta "104\ ``D''" Ta "105\ ``E''" Ta "106\ ``F''" Ta "107\ ``G''" +.It "\&110\ ``H''" Ta "111\ ``I''" Ta "112\ ``J''" Ta "113\ ``K''" Ta "114\ ``L''" +.It "\&115\ ``M''" Ta "116\ ``N''" Ta "117\ ``O''" Ta "120\ ``P''" Ta "121\ ``Q''" +.It "\&122\ ``R''" Ta "123\ ``S''" Ta "124\ ``T''" Ta "125\ ``U''" Ta "126\ ``V''" +.It "\&127\ ``W''" Ta "130\ ``X''" Ta "131\ ``Y''" Ta "132\ ``Z''" Ta "133\ ``[''" +.It "\&134\ ``\e\|''" Ta "135\ ``]''" Ta "136\ ``^''" Ta "137\ ``_''" Ta "140\ ```''" +.It "\&141\ ``a''" Ta "142\ ``b''" Ta "143\ ``c''" Ta "144\ ``d''" Ta "145\ ``e''" +.It "\&146\ ``f''" Ta "147\ ``g''" Ta "150\ ``h''" Ta "151\ ``i''" Ta "152\ ``j''" +.It "\&153\ ``k''" Ta "154\ ``l''" Ta "155\ ``m''" Ta "156\ ``n''" Ta "157\ ``o''" +.It "\&160\ ``p''" Ta "161\ ``q''" Ta "162\ ``r''" Ta "163\ ``s''" Ta "164\ ``t''" +.It "\&165\ ``u''" Ta "166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" Ta "171\ ``y''" +.It "\&172\ ``z''" Ta "173\ ``{''" Ta "174\ ``|''" Ta "175\ ``}''" Ta "176\ ``~''" .El .Sh RETURN VALUES The Modified: stable/9/lib/libc/locale/ispunct.3 ============================================================================== --- stable/9/lib/libc/locale/ispunct.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/ispunct.3 Fri May 3 14:59:32 2013 (r250213) @@ -64,13 +64,13 @@ In the ASCII character set, this include (with their numeric values shown in octal): .Pp .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''" -.It "\&046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)'' \t052\ ``*''" -.It "\&053\ ``+'' \t054\ ``,'' \t055\ ``-'' \t056\ ``.'' \t057\ ``/''" -.It "\&072\ ``:'' \t073\ ``;'' \t074\ ``<'' \t075\ ``='' \t076\ ``>''" -.It "\&077\ ``?'' \t100\ ``@'' \t133\ ``['' \t134\ ``\e\|'' \t135\ ``]''" -.It "\&136\ ``^'' \t137\ ``_'' \t140\ ```'' \t173\ ``{'' \t174\ ``|''" -.It "\&175\ ``}'' \t176\ ``~''" +.It "\&041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''" Ta "045\ ``%''" +.It "\&046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''" Ta "052\ ``*''" +.It "\&053\ ``+''" Ta "054\ ``,''" Ta "055\ ``-''" Ta "056\ ``.''" Ta "057\ ``/''" +.It "\&072\ ``:''" Ta "073\ ``;''" Ta "074\ ``<''" Ta "075\ ``=''" Ta "076\ ``>''" +.It "\&077\ ``?''" Ta "100\ ``@''" Ta "133\ ``[''" Ta "134\ ``\e\|''" Ta "135\ ``]''" +.It "\&136\ ``^''" Ta "137\ ``_''" Ta "140\ ```''" Ta "173\ ``{''" Ta "174\ ``|''" +.It "\&175\ ``}''" Ta "176\ ``~''" Ta \& Ta \& Ta \& .El .Pp The Modified: stable/9/lib/libc/locale/isspace.3 ============================================================================== --- stable/9/lib/libc/locale/isspace.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isspace.3 Fri May 3 14:59:32 2013 (r250213) @@ -53,7 +53,7 @@ function tests for white-space character For any locale, this includes the following standard characters: .Pp .Bl -column \&`\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ -.It "\&``\et''\t``\en''\t``\ev''\t``\ef''\t``\er''\t`` ''" +.It "\&``\et''" Ta "``\en''" Ta "``\ev''" Ta "``\ef''" Ta "``\er''" Ta "`` ''" .El .Pp In the "C" locale, Modified: stable/9/lib/libc/locale/isupper.3 ============================================================================== --- stable/9/lib/libc/locale/isupper.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isupper.3 Fri May 3 14:59:32 2013 (r250213) @@ -57,12 +57,12 @@ In the ASCII character set, this include (with their numeric values shown in octal): .Pp .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ -.It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''" -.It "\&106\ ``F'' \t107\ ``G'' \t110\ ``H'' \t111\ ``I'' \t112\ ``J''" -.It "\&113\ ``K'' \t114\ ``L'' \t115\ ``M'' \t116\ ``N'' \t117\ ``O''" -.It "\&120\ ``P'' \t121\ ``Q'' \t122\ ``R'' \t123\ ``S'' \t124\ ``T''" -.It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''" -.It "\&132\ ``Z''" +.It "\&101\ ``A''" Ta "102\ ``B''" Ta "103\ ``C''" Ta "104\ ``D''" Ta "105\ ``E''" +.It "\&106\ ``F''" Ta "107\ ``G''" Ta "110\ ``H''" Ta "111\ ``I''" Ta "112\ ``J''" +.It "\&113\ ``K''" Ta "114\ ``L''" Ta "115\ ``M''" Ta "116\ ``N''" Ta "117\ ``O''" +.It "\&120\ ``P''" Ta "121\ ``Q''" Ta "122\ ``R''" Ta "123\ ``S''" Ta "124\ ``T''" +.It "\&125\ ``U''" Ta "126\ ``V''" Ta "127\ ``W''" Ta "130\ ``X''" Ta "131\ ``Y''" +.It "\&132\ ``Z''" Ta \& Ta \& Ta \& Ta \& .El .Sh RETURN VALUES The Modified: stable/9/lib/libc/locale/iswalnum_l.3 ============================================================================== --- stable/9/lib/libc/locale/iswalnum_l.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/iswalnum_l.3 Fri May 3 14:59:32 2013 (r250213) @@ -24,8 +24,8 @@ .\" .\" $FreeBSD$ .\" -.Dt ISWALNUM_L 3 .Dd July 25, 2012 +.Dt ISWALNUM_L 3 .Os .Sh NAME .Nm iswalnum_l , @@ -161,7 +161,7 @@ except for .Fn iswphonogram_l , .Fn iswrune_l , .Fn iswspecial_l -and +and .Fn nextwctype_l which are .Fx Modified: stable/9/lib/libc/locale/isxdigit.3 ============================================================================== --- stable/9/lib/libc/locale/isxdigit.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/isxdigit.3 Fri May 3 14:59:32 2013 (r250213) @@ -53,11 +53,11 @@ function tests for any hexadecimal-digit Regardless of locale, this includes the following characters only: .Pp .Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______ -.It "\&``0''\t``1''\t``2''\t``3''\t``4''" -.It "\&``5''\t``6''\t``7''\t``8''\t``9''" -.It "\&``A''\t``B''\t``C''\t``D''\t``E''" -.It "\&``F''\t``a''\t``b''\t``c''\t``d''" -.It "\&``e''\t``f''" +.It "\&``0''" Ta "``1''" Ta "``2''" Ta "``3''" Ta "``4''" +.It "\&``5''" Ta "``6''" Ta "``7''" Ta "``8''" Ta "``9''" +.It "\&``A''" Ta "``B''" Ta "``C''" Ta "``D''" Ta "``E''" +.It "\&``F''" Ta "``a''" Ta "``b''" Ta "``c''" Ta "``d''" +.It "\&``e''" Ta "``f''" Ta \& Ta \& Ta \& .El .Pp The Modified: stable/9/lib/libc/locale/newlocale.3 ============================================================================== --- stable/9/lib/libc/locale/newlocale.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/newlocale.3 Fri May 3 14:59:32 2013 (r250213) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .Dd September 17 2011 -.Dt newlocale 3 +.Dt NEWLOCALE 3 .Os .Sh NAME .Nm newlocale @@ -36,7 +36,7 @@ .Lb libc .Sh SYNOPSIS .In xlocale -.Ft +.Ft locale_t .Fn newlocale "int mask" "const char * locale" "locale_t base" .Sh DESCRIPTION Creates a new locale, inheriting some properties from an existing locale. @@ -48,7 +48,6 @@ name specified in the parameter. Any other components will be inherited from .Fa base . -.Pt The .Fa mask is either @@ -93,7 +92,6 @@ Set a locale for formatting dates and ti .Xr strftime 3 function. .El - This function uses the same rules for loading locale components as .Xr setlocale 3 . .Sh RETURN VALUES @@ -110,5 +108,5 @@ You must free the returned locale with .Xr uselocale 3 , .Xr xlocale 3 .Sh STANDARDS -This function, conforms to -.St -p1003.1-2008 +This function conforms to +.St -p1003.1-2008 . Modified: stable/9/lib/libc/locale/querylocale.3 ============================================================================== --- stable/9/lib/libc/locale/querylocale.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/querylocale.3 Fri May 3 14:59:32 2013 (r250213) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17 2011 +.Dd May 3, 2013 .Dt QUERYLOCALE 3 .Os .Sh NAME @@ -52,6 +52,3 @@ If more than one bit in the mask is set, .Xr newlocale 3 , .Xr uselocale 3 , .Xr xlocale 3 -.Sh STANDARDS -This function, conforms to -.St -p1003.1-2008 Modified: stable/9/lib/libc/locale/uselocale.3 ============================================================================== --- stable/9/lib/libc/locale/uselocale.3 Fri May 3 13:33:36 2013 (r250212) +++ stable/9/lib/libc/locale/uselocale.3 Fri May 3 14:59:32 2013 (r250213) @@ -57,4 +57,4 @@ or LC_GLOBAL_LOCALE if this thread has n .Xr xlocale 3 .Sh STANDARDS This function conforms to -.St -p1003.1-2008 +.St -p1003.1-2008 . From owner-svn-src-stable-9@FreeBSD.ORG Fri May 3 15:52:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 983CEE1; Fri, 3 May 2013 15:52:44 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 702851B71; Fri, 3 May 2013 15:52:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r43FqiuA024583; Fri, 3 May 2013 15:52:44 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r43FqiPN024580; Fri, 3 May 2013 15:52:44 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201305031552.r43FqiPN024580@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 3 May 2013 15:52:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250215 - stable/9/lib/libc/locale X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2013 15:52:44 -0000 Author: pluknet Date: Fri May 3 15:52:43 2013 New Revision: 250215 URL: http://svnweb.freebsd.org/changeset/base/250215 Log: MFC r228269,228921: - libc: Eliminate 13 relative relocations in wctype(). - libc: Eliminate some relative relocations in setlocale(). Modified: stable/9/lib/libc/locale/setlocale.c stable/9/lib/libc/locale/wctype.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/locale/setlocale.c ============================================================================== --- stable/9/lib/libc/locale/setlocale.c Fri May 3 15:28:31 2013 (r250214) +++ stable/9/lib/libc/locale/setlocale.c Fri May 3 15:52:43 2013 (r250215) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); /* * Category names for getenv() */ -static char *categories[_LC_LAST] = { +static const char categories[_LC_LAST][12] = { "LC_ALL", "LC_COLLATE", "LC_CTYPE", Modified: stable/9/lib/libc/locale/wctype.c ============================================================================== --- stable/9/lib/libc/locale/wctype.c Fri May 3 15:28:31 2013 (r250214) +++ stable/9/lib/libc/locale/wctype.c Fri May 3 15:52:43 2013 (r250215) @@ -57,35 +57,54 @@ iswctype_l(wint_t wc, wctype_t charclass wctype_t wctype_l(const char *property, locale_t locale) { - static const struct { - const char *name; - wctype_t mask; - } props[] = { - { "alnum", _CTYPE_A|_CTYPE_D }, - { "alpha", _CTYPE_A }, - { "blank", _CTYPE_B }, - { "cntrl", _CTYPE_C }, - { "digit", _CTYPE_D }, - { "graph", _CTYPE_G }, - { "lower", _CTYPE_L }, - { "print", _CTYPE_R }, - { "punct", _CTYPE_P }, - { "space", _CTYPE_S }, - { "upper", _CTYPE_U }, - { "xdigit", _CTYPE_X }, - { "ideogram", _CTYPE_I }, /* BSD extension */ - { "special", _CTYPE_T }, /* BSD extension */ - { "phonogram", _CTYPE_Q }, /* BSD extension */ - { "rune", 0xFFFFFF00L }, /* BSD extension */ - { NULL, 0UL }, /* Default */ + const char *propnames = + "alnum\0" + "alpha\0" + "blank\0" + "cntrl\0" + "digit\0" + "graph\0" + "lower\0" + "print\0" + "punct\0" + "space\0" + "upper\0" + "xdigit\0" + "ideogram\0" /* BSD extension */ + "special\0" /* BSD extension */ + "phonogram\0" /* BSD extension */ + "rune\0"; /* BSD extension */ + static const wctype_t propmasks[] = { + _CTYPE_A|_CTYPE_D, + _CTYPE_A, + _CTYPE_B, + _CTYPE_C, + _CTYPE_D, + _CTYPE_G, + _CTYPE_L, + _CTYPE_R, + _CTYPE_P, + _CTYPE_S, + _CTYPE_U, + _CTYPE_X, + _CTYPE_I, + _CTYPE_T, + _CTYPE_Q, + 0xFFFFFF00L }; - int i; + size_t len1, len2; + const char *p; + const wctype_t *q; - i = 0; - while (props[i].name != NULL && strcmp(props[i].name, property) != 0) - i++; + len1 = strlen(property); + q = propmasks; + for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { + if (len1 == len2 && memcmp(property, p, len1) == 0) + return (*q); + q++; + } - return (props[i].mask); + return (0UL); } wctype_t wctype(const char *property) From owner-svn-src-stable-9@FreeBSD.ORG Fri May 3 15:54:13 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DBAD7273; Fri, 3 May 2013 15:54:13 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CDA871B8F; Fri, 3 May 2013 15:54:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r43FsDNk024899; Fri, 3 May 2013 15:54:13 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r43FsDQK024898; Fri, 3 May 2013 15:54:13 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201305031554.r43FsDQK024898@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 3 May 2013 15:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250216 - stable/9/lib/libc/locale X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2013 15:54:13 -0000 Author: pluknet Date: Fri May 3 15:54:13 2013 New Revision: 250216 URL: http://svnweb.freebsd.org/changeset/base/250216 Log: MFC r244091: Improve style(9) compliance of function declarations. Modified: stable/9/lib/libc/locale/setrunelocale.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/locale/setrunelocale.c ============================================================================== --- stable/9/lib/libc/locale/setrunelocale.c Fri May 3 15:52:43 2013 (r250215) +++ stable/9/lib/libc/locale/setrunelocale.c Fri May 3 15:54:13 2013 (r250216) @@ -73,9 +73,11 @@ static int __setrunelocale(struct xloca #define __collate_chain_pri_table (table->__collate_chain_pri_table) -static void destruct_ctype(void *v) +static void +destruct_ctype(void *v) { struct xlocale_ctype *l = v; + if (strcmp(l->runes->__encoding, "EUC") == 0) free(l->runes->__variable); if (&_DefaultRuneLocale != l->runes) @@ -83,13 +85,17 @@ static void destruct_ctype(void *v) free(l); } -const _RuneLocale *__getCurrentRuneLocale(void) +const _RuneLocale * +__getCurrentRuneLocale(void) { + return XLOCALE_CTYPE(__get_locale())->runes; } -static void free_runes(_RuneLocale *rl) +static void +free_runes(_RuneLocale *rl) { + /* FIXME: The "EUC" check here is a hideous abstraction violation. */ if ((rl != &_DefaultRuneLocale) && (rl)) { if (strcmp(rl->__encoding, "EUC") == 0) { @@ -191,7 +197,8 @@ __wrap_setrunelocale(const char *locale) #ifndef __NO_TLS void -__set_thread_rune_locale(locale_t loc) { +__set_thread_rune_locale(locale_t loc) +{ if (loc == NULL) { _ThreadRuneLocale = &_DefaultRuneLocale; @@ -205,6 +212,7 @@ void * __ctype_load(const char *locale, locale_t unused) { struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1); + l->header.header.destructor = destruct_ctype; if (__setrunelocale(l, locale)) { From owner-svn-src-stable-9@FreeBSD.ORG Fri May 3 16:41:01 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 024CD6DE for ; Fri, 3 May 2013 16:41:01 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com [IPv6:2a00:1450:4010:c03::22b]) by mx1.freebsd.org (Postfix) with ESMTP id 7EAC31F9D for ; Fri, 3 May 2013 16:41:00 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id ea20so1695787lab.30 for ; Fri, 03 May 2013 09:40:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=uQq6lalcNh3vFPNzKVi/f16f58rnqlKOhinny5bXaEI=; b=K76pDBzH5uHhWW9luOFmaIu7C+cyWVpmBHJfsurCQOyPzatJnYY5iZcfVuqH/c/aCC ioXuH6Wbb/aWB2187ehKc9rmRnvLbG93mWeWomD/hZ+Wecs6Oog7mvd4TjgV73IIDlP3 RkcASPAxPTb0/akQTvd6AL2IYqgOjGjuQZeEXcJOUzms2P75V2fzxA7rJXgL+KLyNiev gh4V2C0YB3nt537f5YI1tJtiF9BhfDG7Pggx+L4POM94S+oGP2+A39lC3hAlYKRCEgMO NJZdZ0y74+cNYCBafCENJqW8MPnI0lwJwHVHVjbZMECLDA0Jao2EBzudgmaDPx3rMYPf 6d9w== X-Received: by 10.152.87.116 with SMTP id w20mr4511976laz.0.1367599259311; Fri, 03 May 2013 09:40:59 -0700 (PDT) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPSA id sl5sm4436768lbb.10.2013.05.03.09.40.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 09:40:58 -0700 (PDT) Message-ID: <5183E899.4000503@freebsd.org> Date: Fri, 03 May 2013 20:40:57 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Sergey Kandaurov Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale References: <201305031552.r43FqiPN024580@svn.freebsd.org> In-Reply-To: <201305031552.r43FqiPN024580@svn.freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmT4wy4bc3gAP2nM+oBOTiuF+36N5Mu/h6DxZjkbd5Dk2DgQ+QmJ5jsfhzquvfB+xPkRjr2 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2013 16:41:01 -0000 I don't think this change is optimal (cause slowdown) since you add unneeded strlen() in the loop for known-sized elements plus one strlen() for tested property, and wctype_l() itself can be called very often, so we definitely don't need slowdown here. Since most of elements have equal sizes, your len1 == len2 condition gains almost nothing for valid calls. On 03.05.2013 19:52, Sergey Kandaurov wrote: > Modified: stable/9/lib/libc/locale/wctype.c > ============================================================================== > --- stable/9/lib/libc/locale/wctype.c Fri May 3 15:28:31 2013 (r250214) > +++ stable/9/lib/libc/locale/wctype.c Fri May 3 15:52:43 2013 (r250215) > @@ -57,35 +57,54 @@ iswctype_l(wint_t wc, wctype_t charclass > wctype_t > wctype_l(const char *property, locale_t locale) > { > - static const struct { > - const char *name; > - wctype_t mask; > - } props[] = { > - { "alnum", _CTYPE_A|_CTYPE_D }, > - { "alpha", _CTYPE_A }, > - { "blank", _CTYPE_B }, > - { "cntrl", _CTYPE_C }, > - { "digit", _CTYPE_D }, > - { "graph", _CTYPE_G }, > - { "lower", _CTYPE_L }, > - { "print", _CTYPE_R }, > - { "punct", _CTYPE_P }, > - { "space", _CTYPE_S }, > - { "upper", _CTYPE_U }, > - { "xdigit", _CTYPE_X }, > - { "ideogram", _CTYPE_I }, /* BSD extension */ > - { "special", _CTYPE_T }, /* BSD extension */ > - { "phonogram", _CTYPE_Q }, /* BSD extension */ > - { "rune", 0xFFFFFF00L }, /* BSD extension */ > - { NULL, 0UL }, /* Default */ > + const char *propnames = > + "alnum\0" > + "alpha\0" > + "blank\0" > + "cntrl\0" > + "digit\0" > + "graph\0" > + "lower\0" > + "print\0" > + "punct\0" > + "space\0" > + "upper\0" > + "xdigit\0" > + "ideogram\0" /* BSD extension */ > + "special\0" /* BSD extension */ > + "phonogram\0" /* BSD extension */ > + "rune\0"; /* BSD extension */ > + static const wctype_t propmasks[] = { > + _CTYPE_A|_CTYPE_D, > + _CTYPE_A, > + _CTYPE_B, > + _CTYPE_C, > + _CTYPE_D, > + _CTYPE_G, > + _CTYPE_L, > + _CTYPE_R, > + _CTYPE_P, > + _CTYPE_S, > + _CTYPE_U, > + _CTYPE_X, > + _CTYPE_I, > + _CTYPE_T, > + _CTYPE_Q, > + 0xFFFFFF00L > }; > - int i; > + size_t len1, len2; > + const char *p; > + const wctype_t *q; > > - i = 0; > - while (props[i].name != NULL && strcmp(props[i].name, property) != 0) > - i++; > + len1 = strlen(property); > + q = propmasks; > + for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { > + if (len1 == len2 && memcmp(property, p, len1) == 0) > + return (*q); > + q++; > + } > > - return (props[i].mask); > + return (0UL); > } > > wctype_t wctype(const char *property) > -- http://ache.vniz.net/ bitcoin:13fGiNutKNHcVSsgtGQ7bQ5kgUKgEQHn7N From owner-svn-src-stable-9@FreeBSD.ORG Fri May 3 17:49:07 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C9A7C4A4; Fri, 3 May 2013 17:49:07 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) by mx1.freebsd.org (Postfix) with ESMTP id BDC0F15EE; Fri, 3 May 2013 17:49:06 +0000 (UTC) Received: by mail-wi0-f174.google.com with SMTP id m6so862174wiv.13 for ; Fri, 03 May 2013 10:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=4upWFZKPCuvR9X1CDRCNQhw1mSSeii7hf+7Pgz3qfmw=; b=j4qbzSfiKlE/O962C5JXI4C4yS1ApQGd+bjnZu1P6XYDKiYv4jR822f7MMxr6fuceg l5D5k/E5pENZ/XISbZ7mYbOECtQZ2m2YsydSs0pyW0uQrl+XgQ4rnRrI2SEIgSzycbp2 brDAgZPYoFGXE8WA8S+PJWfyhUeOdcPa74AqtwySkwm0672yOwaoC4y0x64Jguo0h1DU elZM9B/mCkIsUX07IRcezl7mVHtKaAQYaGfn2/AvG+Gds0T5Sn2tt7nzOw6BkguS9Rke E4+OB5pJhV+afurm+ecplH3KGgZJR5K2WotJtkDcfq7D+EgIZOeJIxkYJ/X/eqkdQ6Pb u9uA== MIME-Version: 1.0 X-Received: by 10.180.90.203 with SMTP id by11mr14724705wib.10.1367603345899; Fri, 03 May 2013 10:49:05 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.194.29.199 with HTTP; Fri, 3 May 2013 10:49:05 -0700 (PDT) In-Reply-To: <5183E899.4000503@freebsd.org> References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> Date: Fri, 3 May 2013 21:49:05 +0400 X-Google-Sender-Auth: RjNJkhVqVBILRMLpNHU2wzLB9Hg Message-ID: Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale From: Sergey Kandaurov To: Andrey Chernov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2013 17:49:07 -0000 On 3 May 2013 20:40, Andrey Chernov wrote: > I don't think this change is optimal (cause slowdown) since you add > unneeded strlen() in the loop for known-sized elements plus one strlen() > for tested property, and wctype_l() itself can be called very often, so > we definitely don't need slowdown here. > Since most of elements have equal sizes, your len1 == len2 condition > gains almost nothing for valid calls. Thanks, you are correct. With this change I got 2-6 times slowdown depending on the specified wctype. I will look at how it can be optimized. > > On 03.05.2013 19:52, Sergey Kandaurov wrote: >> Modified: stable/9/lib/libc/locale/wctype.c >> ============================================================================== >> --- stable/9/lib/libc/locale/wctype.c Fri May 3 15:28:31 2013 (r250214) >> +++ stable/9/lib/libc/locale/wctype.c Fri May 3 15:52:43 2013 (r250215) >> @@ -57,35 +57,54 @@ iswctype_l(wint_t wc, wctype_t charclass >> wctype_t >> wctype_l(const char *property, locale_t locale) >> { >> - static const struct { >> - const char *name; >> - wctype_t mask; >> - } props[] = { >> - { "alnum", _CTYPE_A|_CTYPE_D }, >> - { "alpha", _CTYPE_A }, >> - { "blank", _CTYPE_B }, >> - { "cntrl", _CTYPE_C }, >> - { "digit", _CTYPE_D }, >> - { "graph", _CTYPE_G }, >> - { "lower", _CTYPE_L }, >> - { "print", _CTYPE_R }, >> - { "punct", _CTYPE_P }, >> - { "space", _CTYPE_S }, >> - { "upper", _CTYPE_U }, >> - { "xdigit", _CTYPE_X }, >> - { "ideogram", _CTYPE_I }, /* BSD extension */ >> - { "special", _CTYPE_T }, /* BSD extension */ >> - { "phonogram", _CTYPE_Q }, /* BSD extension */ >> - { "rune", 0xFFFFFF00L }, /* BSD extension */ >> - { NULL, 0UL }, /* Default */ >> + const char *propnames = >> + "alnum\0" >> + "alpha\0" >> + "blank\0" >> + "cntrl\0" >> + "digit\0" >> + "graph\0" >> + "lower\0" >> + "print\0" >> + "punct\0" >> + "space\0" >> + "upper\0" >> + "xdigit\0" >> + "ideogram\0" /* BSD extension */ >> + "special\0" /* BSD extension */ >> + "phonogram\0" /* BSD extension */ >> + "rune\0"; /* BSD extension */ >> + static const wctype_t propmasks[] = { >> + _CTYPE_A|_CTYPE_D, >> + _CTYPE_A, >> + _CTYPE_B, >> + _CTYPE_C, >> + _CTYPE_D, >> + _CTYPE_G, >> + _CTYPE_L, >> + _CTYPE_R, >> + _CTYPE_P, >> + _CTYPE_S, >> + _CTYPE_U, >> + _CTYPE_X, >> + _CTYPE_I, >> + _CTYPE_T, >> + _CTYPE_Q, >> + 0xFFFFFF00L >> }; >> - int i; >> + size_t len1, len2; >> + const char *p; >> + const wctype_t *q; >> >> - i = 0; >> - while (props[i].name != NULL && strcmp(props[i].name, property) != 0) >> - i++; >> + len1 = strlen(property); >> + q = propmasks; >> + for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { >> + if (len1 == len2 && memcmp(property, p, len1) == 0) >> + return (*q); >> + q++; >> + } >> >> - return (props[i].mask); >> + return (0UL); >> } >> >> wctype_t wctype(const char *property) >> > > -- > http://ache.vniz.net/ > bitcoin:13fGiNutKNHcVSsgtGQ7bQ5kgUKgEQHn7N -- wbr, pluknet From owner-svn-src-stable-9@FreeBSD.ORG Fri May 3 19:55:42 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D1F60A05; Fri, 3 May 2013 19:55:42 +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 793F1109A; Fri, 3 May 2013 19:55: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 A8F093592E6; Fri, 3 May 2013 21:55:40 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 844EA28493; Fri, 3 May 2013 21:55:40 +0200 (CEST) Date: Fri, 3 May 2013 21:55:40 +0200 From: Jilles Tjoelker To: Sergey Kandaurov Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale Message-ID: <20130503195540.GA52657@stack.nl> References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov , svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2013 19:55:42 -0000 On Fri, May 03, 2013 at 09:49:05PM +0400, Sergey Kandaurov wrote: > On 3 May 2013 20:40, Andrey Chernov wrote: > > I don't think this change is optimal (cause slowdown) since you add > > unneeded strlen() in the loop for known-sized elements plus one strlen() > > for tested property, and wctype_l() itself can be called very often, so > > we definitely don't need slowdown here. > > Since most of elements have equal sizes, your len1 == len2 condition > > gains almost nothing for valid calls. > Thanks, you are correct. With this change I got 2-6 times slowdown depending > on the specified wctype. I will look at how it can be optimized. As the original author of this change, I mainly considered programs that do not use wctype(), which gain a reduced memory footprint and rtld load. For programs that do use it, I expect fewer cache misses because there is less pointer chasing. It is certainly right that sh(1) will call wctype() fairly often if a pattern contains a [[:ctype:]] after a *. If the slowness is because of the strlen() calls, the propnames can be constructed like "\5alnum\5alpha"... The slowness could also be because strcmp() is implemented less badly than memcmp(). With the current code, memcmp() can be changed to strcmp(). Some sort of perfect hashing can also be an option, although it makes it harder to add new properties or adds a build dependency on gperf(1) that we would like to get rid of. Sorry, I have not run my own benchmarks yet. > > On 03.05.2013 19:52, Sergey Kandaurov wrote: > >> Modified: stable/9/lib/libc/locale/wctype.c > >> ============================================================================== > >> --- stable/9/lib/libc/locale/wctype.c Fri May 3 15:28:31 2013 (r250214) > >> +++ stable/9/lib/libc/locale/wctype.c Fri May 3 15:52:43 2013 (r250215) > >> @@ -57,35 +57,54 @@ iswctype_l(wint_t wc, wctype_t charclass > >> wctype_t > >> wctype_l(const char *property, locale_t locale) > >> { > >> - static const struct { > >> - const char *name; > >> - wctype_t mask; > >> - } props[] = { > >> - { "alnum", _CTYPE_A|_CTYPE_D }, > >> - { "alpha", _CTYPE_A }, > >> - { "blank", _CTYPE_B }, > >> - { "cntrl", _CTYPE_C }, > >> - { "digit", _CTYPE_D }, > >> - { "graph", _CTYPE_G }, > >> - { "lower", _CTYPE_L }, > >> - { "print", _CTYPE_R }, > >> - { "punct", _CTYPE_P }, > >> - { "space", _CTYPE_S }, > >> - { "upper", _CTYPE_U }, > >> - { "xdigit", _CTYPE_X }, > >> - { "ideogram", _CTYPE_I }, /* BSD extension */ > >> - { "special", _CTYPE_T }, /* BSD extension */ > >> - { "phonogram", _CTYPE_Q }, /* BSD extension */ > >> - { "rune", 0xFFFFFF00L }, /* BSD extension */ > >> - { NULL, 0UL }, /* Default */ > >> + const char *propnames = > >> + "alnum\0" > >> + "alpha\0" > >> + "blank\0" > >> + "cntrl\0" > >> + "digit\0" > >> + "graph\0" > >> + "lower\0" > >> + "print\0" > >> + "punct\0" > >> + "space\0" > >> + "upper\0" > >> + "xdigit\0" > >> + "ideogram\0" /* BSD extension */ > >> + "special\0" /* BSD extension */ > >> + "phonogram\0" /* BSD extension */ > >> + "rune\0"; /* BSD extension */ > >> + static const wctype_t propmasks[] = { > >> + _CTYPE_A|_CTYPE_D, > >> + _CTYPE_A, > >> + _CTYPE_B, > >> + _CTYPE_C, > >> + _CTYPE_D, > >> + _CTYPE_G, > >> + _CTYPE_L, > >> + _CTYPE_R, > >> + _CTYPE_P, > >> + _CTYPE_S, > >> + _CTYPE_U, > >> + _CTYPE_X, > >> + _CTYPE_I, > >> + _CTYPE_T, > >> + _CTYPE_Q, > >> + 0xFFFFFF00L > >> }; > >> - int i; > >> + size_t len1, len2; > >> + const char *p; > >> + const wctype_t *q; > >> > >> - i = 0; > >> - while (props[i].name != NULL && strcmp(props[i].name, property) != 0) > >> - i++; > >> + len1 = strlen(property); > >> + q = propmasks; > >> + for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { > >> + if (len1 == len2 && memcmp(property, p, len1) == 0) > >> + return (*q); > >> + q++; > >> + } > >> > >> - return (props[i].mask); > >> + return (0UL); > >> } > >> > >> wctype_t wctype(const char *property) -- Jilles Tjoelker From owner-svn-src-stable-9@FreeBSD.ORG Fri May 3 20:48:40 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 859B4ED0; Fri, 3 May 2013 20:48:40 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) by mx1.freebsd.org (Postfix) with ESMTP id 7926F136D; Fri, 3 May 2013 20:48:39 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id hq12so1121157wib.5 for ; Fri, 03 May 2013 13:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=3XogMX/q2KUQF44N3E9Auwt27FvBpe6T6vwz4sRgrQE=; b=cwZsTPiDBjG3eydxRKrBU/W/vzhs9DFINMGL0gUIgOX47Xi9ccjOro5y13pjI2I5ZW sgX0NuORjvppOCX3WJd3V8C8obTVVkubiyHFilZ/rE9FVAB0XBs0dzB/ZhsY3hdQjbLz x2M55f7crLJ1G4fdxROL2IZgibezYXL/DkFXFWlTgeUDr34cIc93QNAHOcnUkXXA4l+I LE58lt8lbF2boex/FxgM3hXesJOnquaPAq5u25BsEOtultdW8yikxVbEDdIKm2gCHkqV L3wFBRUD5yWlzKnBXr4tJdG5bhZ3ygjtOzH3VvyawNjt+W+HhW5qFFMf+A4XnTbJMhhN IS8Q== MIME-Version: 1.0 X-Received: by 10.194.92.231 with SMTP id cp7mr16030959wjb.3.1367614118676; Fri, 03 May 2013 13:48:38 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.194.29.199 with HTTP; Fri, 3 May 2013 13:48:38 -0700 (PDT) In-Reply-To: <20130503195540.GA52657@stack.nl> References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> <20130503195540.GA52657@stack.nl> Date: Sat, 4 May 2013 00:48:38 +0400 X-Google-Sender-Auth: StXQvw9ial6WGk3GnWKPyi32r_A Message-ID: Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale From: Sergey Kandaurov To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov , svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2013 20:48:40 -0000 On 3 May 2013 23:55, Jilles Tjoelker wrote: > On Fri, May 03, 2013 at 09:49:05PM +0400, Sergey Kandaurov wrote: >> On 3 May 2013 20:40, Andrey Chernov wrote: >> > I don't think this change is optimal (cause slowdown) since you add >> > unneeded strlen() in the loop for known-sized elements plus one strlen() >> > for tested property, and wctype_l() itself can be called very often, so >> > we definitely don't need slowdown here. >> > Since most of elements have equal sizes, your len1 == len2 condition >> > gains almost nothing for valid calls. > >> Thanks, you are correct. With this change I got 2-6 times slowdown depending >> on the specified wctype. I will look at how it can be optimized. > > As the original author of this change, I mainly considered programs that > do not use wctype(), which gain a reduced memory footprint and rtld > load. For programs that do use it, I expect fewer cache misses because > there is less pointer chasing. > > It is certainly right that sh(1) will call wctype() fairly often if a > pattern contains a [[:ctype:]] after a *. > > If the slowness is because of the strlen() calls, the propnames can be > constructed like "\5alnum\5alpha"... > > The slowness could also be because strcmp() is implemented less badly > than memcmp(). With the current code, memcmp() can be changed to > strcmp(). > > Some sort of perfect hashing can also be an option, although it makes it > harder to add new properties or adds a build dependency on gperf(1) that > we would like to get rid of. > > Sorry, I have not run my own benchmarks yet. I hacked a bit on wctype. Speaking about speed, it shows about 1-3.5x improvement over the previous fast version (before r250215). Time spend for 2097152 wctype() calls for each of wctype property current previous mine alnum 0.090554676 0.035821210 0.033270579 alpha 0.172074310 0.052461036 0.044916572 blank 0.261109989 0.055735281 0.036682745 cntrl 0.357318986 0.069249831 0.038292782 digit 0.436381530 0.094194364 0.039249005 graph 0.540954812 0.085580099 0.043331460 lower 0.618306476 0.095665215 0.044070399 print 0.707443135 0.132559305 0.048216097 punct 0.788922052 0.142809109 0.062871432 space 0.888263108 0.150516644 0.054086142 upper 0.966903461 0.173593592 0.054027834 xdigit 0.406611275 0.201614227 0.060695939 ideogram 0.439763499 0.239640723 0.068566486 special 0.523128094 0.249156298 0.099278051 phonogram 0.564975870 0.260972651 0.135751471 rune 0.637392247 0.235195497 0.064093971 Index: locale/wctype.c =================================================================== --- locale/wctype.c (revision 250217) +++ locale/wctype.c (working copy) @@ -74,6 +74,9 @@ "special\0" /* BSD extension */ "phonogram\0" /* BSD extension */ "rune\0"; /* BSD extension */ + static const size_t propnamlen[] = { + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 8, 7, 9, 4, 0 + }; static const wctype_t propmasks[] = { _CTYPE_A|_CTYPE_D, _CTYPE_A, @@ -92,16 +95,17 @@ _CTYPE_Q, 0xFFFFFF00L }; - size_t len1, len2; + const size_t *len2; const char *p; const wctype_t *q; - len1 = strlen(property); q = propmasks; - for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { - if (len1 == len2 && memcmp(property, p, len1) == 0) + len2 = propnamlen; + for (p = propnames; *len2 != 0; ) { + if (property[0] == p[0] && strcmp(property, p) == 0) return (*q); - q++; + p += *len2 + 1; + q++; len2++; } return (0UL); -- wbr, pluknet From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 00:31:42 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2DB28C1E; Sat, 4 May 2013 00:31:42 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 20BCC1D01; Sat, 4 May 2013 00:31:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r440VfQS012178; Sat, 4 May 2013 00:31:41 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r440VfBT012177; Sat, 4 May 2013 00:31:41 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201305040031.r440VfBT012177@svn.freebsd.org> From: Colin Percival Date: Sat, 4 May 2013 00:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250228 - stable/9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 00:31:42 -0000 Author: cperciva Date: Sat May 4 00:31:41 2013 New Revision: 250228 URL: http://svnweb.freebsd.org/changeset/base/250228 Log: MFC r250000: Move IPPROTO_IPV6 from #ifdef __BSD_VISIBLE to #if __POSIX_VISIBLE >= 201112 since POSIX 2001 states that it shall be defined. Modified: stable/9/sys/netinet/in.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/in.h ============================================================================== --- stable/9/sys/netinet/in.h Fri May 3 23:51:32 2013 (r250227) +++ stable/9/sys/netinet/in.h Sat May 4 00:31:41 2013 (r250228) @@ -123,6 +123,7 @@ __END_DECLS #endif /* !_KERNEL && __BSD_VISIBLE */ #if __POSIX_VISIBLE >= 200112 +#define IPPROTO_IPV6 41 /* IP6 header */ #define IPPROTO_RAW 255 /* raw IP packet */ #define INET_ADDRSTRLEN 16 #endif @@ -174,7 +175,6 @@ __END_DECLS #define IPPROTO_CMTP 38 /* Control Message Transport */ #define IPPROTO_TPXX 39 /* TP++ Transport */ #define IPPROTO_IL 40 /* IL transport protocol */ -#define IPPROTO_IPV6 41 /* IP6 header */ #define IPPROTO_SDRP 42 /* Source Demand Routing */ #define IPPROTO_ROUTING 43 /* IP6 routing header */ #define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 11:21:42 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2F7E9F42 for ; Sat, 4 May 2013 11:21:42 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx1.freebsd.org (Postfix) with ESMTP id A833710E9 for ; Sat, 4 May 2013 11:21:41 +0000 (UTC) Received: by mail-lb0-f177.google.com with SMTP id 13so2232820lba.36 for ; Sat, 04 May 2013 04:21:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=pYULphCAcd6pRso0V99G46/2hddjxaHWEuBnXGlMWbc=; b=B4CL+4L9m5hVRJSd7qve/isoBIGLEZJMz5Ua0KYaRsdGke9U+vFjjA6ki+E0EzPPFK LjGbiuJ18RJsCZK9SekUCTvpwId/dt16xH29FEdSU3OYfHxjf99FbIVdsB4HwKA6BK1u sW7Avb8hSdXC5gieVGRlyOnrQYMeDbm9FbFuwkPqxvJQHdCt+W7gkgObQBH3HpKRzG+O stF1EC0umZk3KU7RhNZ2gw1sFZI9gCnryv6soO0yTjh16YD2AWBmvKn2YY6GORQfkaAQ MfxtCE0kDmqtcEzTMetExUqObNjEe+gA8u8qjinpunPFsqdJv2+JmHLQJ7vfu/7OKPfl dQvA== X-Received: by 10.112.171.7 with SMTP id aq7mr5619790lbc.130.1367666052680; Sat, 04 May 2013 04:14:12 -0700 (PDT) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPSA id r9sm5494184lbr.3.2013.05.04.04.14.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 May 2013 04:14:12 -0700 (PDT) Message-ID: <5184ED7E.3040703@freebsd.org> Date: Sat, 04 May 2013 15:14:06 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Sergey Kandaurov Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> <20130503195540.GA52657@stack.nl> In-Reply-To: OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkGS1OVarjPAAUNK3iSo9CkvuXFfngF5tImSftSDIjkv2gm8kfo5exiOllWve9Ol+CiGNA5 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, Jilles Tjoelker X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 11:21:42 -0000 On 04.05.2013 0:48, Sergey Kandaurov wrote: > On 3 May 2013 23:55, Jilles Tjoelker wrote: >> Some sort of perfect hashing can also be an option, although it makes it >> harder to add new properties or adds a build dependency on gperf(1) that >> we would like to get rid of. > I hacked a bit on wctype. Speaking about speed, it shows about 1-3.5x > improvement over the previous fast version (before r250215). > > Time spend for 2097152 wctype() calls for each of wctype property > current previous mine > alnum 0.090554676 0.035821210 0.033270579 > alpha 0.172074310 0.052461036 0.044916572 > blank 0.261109989 0.055735281 0.036682745 > cntrl 0.357318986 0.069249831 0.038292782 > digit 0.436381530 0.094194364 0.039249005 > graph 0.540954812 0.085580099 0.043331460 > lower 0.618306476 0.095665215 0.044070399 > print 0.707443135 0.132559305 0.048216097 > punct 0.788922052 0.142809109 0.062871432 > space 0.888263108 0.150516644 0.054086142 > upper 0.966903461 0.173593592 0.054027834 > xdigit 0.406611275 0.201614227 0.060695939 > ideogram 0.439763499 0.239640723 0.068566486 > special 0.523128094 0.249156298 0.099278051 > phonogram 0.564975870 0.260972651 0.135751471 > rune 0.637392247 0.235195497 0.064093971 > > Index: locale/wctype.c > =================================================================== > --- locale/wctype.c (revision 250217) > +++ locale/wctype.c (working copy) > @@ -74,6 +74,9 @@ > "special\0" /* BSD extension */ > "phonogram\0" /* BSD extension */ > "rune\0"; /* BSD extension */ > + static const size_t propnamlen[] = { > + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 8, 7, 9, 4, 0 > + }; > static const wctype_t propmasks[] = { > _CTYPE_A|_CTYPE_D, > _CTYPE_A, > @@ -92,16 +95,17 @@ > _CTYPE_Q, > 0xFFFFFF00L > }; > - size_t len1, len2; > + const size_t *len2; > const char *p; > const wctype_t *q; > > - len1 = strlen(property); > q = propmasks; > - for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { > - if (len1 == len2 && memcmp(property, p, len1) == 0) > + len2 = propnamlen; > + for (p = propnames; *len2 != 0; ) { > + if (property[0] == p[0] && strcmp(property, p) == 0) > return (*q); > - q++; > + p += *len2 + 1; > + q++; len2++; > } > > return (0UL); > This version looks better. IMHO adding full hashing here will be overkill, but much simpler trick still exist yet unused for speedup: sorting properties by character codes and break the loop as early as strcmp() returns bigger value. BTW, I don't run tests and look in asm code for sure, but it seems property[0] == p[0] is unneeded because almost every compiler tries to inline strcmp(). -- http://ache.vniz.net/ bitcoin:13fGiNutKNHcVSsgtGQ7bQ5kgUKgEQHn7N From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 11:49:02 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ABEA23A6; Sat, 4 May 2013 11:49:02 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9E37215A9; Sat, 4 May 2013 11:49:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r44Bn2IQ047460; Sat, 4 May 2013 11:49:02 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r44Bn2ma047459; Sat, 4 May 2013 11:49:02 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201305041149.r44Bn2ma047459@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 4 May 2013 11:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250232 - stable/9/usr.sbin/syslogd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 11:49:02 -0000 Author: jilles Date: Sat May 4 11:49:02 2013 New Revision: 250232 URL: http://svnweb.freebsd.org/changeset/base/250232 Log: MFC r249983: syslogd: Use closefrom() instead of getdtablesize()/close() loop. When syslogd forks a process for '|' destinations, it closes all file descriptors greater than 2. Use closefrom() for this instead of a getdtablesize()/close() loop because it is both faster and avoids leaving file descriptors open because the limit was lowered after they were opened. Modified: stable/9/usr.sbin/syslogd/syslogd.c Directory Properties: stable/9/usr.sbin/syslogd/ (props changed) Modified: stable/9/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/9/usr.sbin/syslogd/syslogd.c Sat May 4 11:45:48 2013 (r250231) +++ stable/9/usr.sbin/syslogd/syslogd.c Sat May 4 11:49:02 2013 (r250232) @@ -2476,7 +2476,7 @@ validate(struct sockaddr *sa, const char static int p_open(const char *prog, pid_t *rpid) { - int pfd[2], nulldesc, i; + int pfd[2], nulldesc; pid_t pid; sigset_t omask, mask; char *argv[4]; /* sh -c cmd NULL */ @@ -2526,8 +2526,7 @@ p_open(const char *prog, pid_t *rpid) dup2(pfd[0], STDIN_FILENO); dup2(nulldesc, STDOUT_FILENO); dup2(nulldesc, STDERR_FILENO); - for (i = getdtablesize(); i > 2; i--) - (void)close(i); + closefrom(3); (void)execvp(_PATH_BSHELL, argv); _exit(255); From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 12:03:17 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3E833E55; Sat, 4 May 2013 12:03:17 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wg0-x22d.google.com (mail-wg0-x22d.google.com [IPv6:2a00:1450:400c:c00::22d]) by mx1.freebsd.org (Postfix) with ESMTP id 2D98F16AD; Sat, 4 May 2013 12:03:16 +0000 (UTC) Received: by mail-wg0-f45.google.com with SMTP id l18so2403330wgh.24 for ; Sat, 04 May 2013 05:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=8+V196CJephydOu44Eavc6IR53NuHKC+pExxJdQDqOc=; b=vl+TxozZC1VyQmQBsyBrdxljDJr+vnpw5tlYgOWkS6KSQwmod6YAtJaK2LAj63SPT6 giHN+ed0xTHX+WvUjPxqB4skx+oaGQZtvvjbwS06NT8ucQ0TaISSRvSz2tYsOjiNu9A4 9nBVfMzC8kBJ6ZRTUh5I4faqAH6NzyJQLM9ybsq1i97LksljR/fRSW4ENcbcYwdLO9Ci PeBHfBs8HIdbB5AmvbcAZ12UGlVyYO1E+ubcngJKjHOTQiQgrWF7fmHkkxJi1Y4md7lC UZ1H1HuE/vx/FyOtXFVt0v+Nn+cwZytYFe1ex89/mJRvADPZLlJv8Fs6tkuuvfCquKs0 NAqw== MIME-Version: 1.0 X-Received: by 10.180.82.74 with SMTP id g10mr1866689wiy.10.1367668995367; Sat, 04 May 2013 05:03:15 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.194.29.199 with HTTP; Sat, 4 May 2013 05:03:15 -0700 (PDT) In-Reply-To: <5184ED7E.3040703@freebsd.org> References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> <20130503195540.GA52657@stack.nl> <5184ED7E.3040703@freebsd.org> Date: Sat, 4 May 2013 16:03:15 +0400 X-Google-Sender-Auth: VbTiFWBd0feDaoWc7YirzTPfzJU Message-ID: Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale From: Sergey Kandaurov To: Andrey Chernov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, Jilles Tjoelker X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 12:03:17 -0000 On 4 May 2013 15:14, Andrey Chernov wrote: > On 04.05.2013 0:48, Sergey Kandaurov wrote: >> On 3 May 2013 23:55, Jilles Tjoelker wrote: >>> Some sort of perfect hashing can also be an option, although it makes it >>> harder to add new properties or adds a build dependency on gperf(1) that >>> we would like to get rid of. >> I hacked a bit on wctype. Speaking about speed, it shows about 1-3.5x >> improvement over the previous fast version (before r250215). >> >> Time spend for 2097152 wctype() calls for each of wctype property >> current previous mine >> alnum 0.090554676 0.035821210 0.033270579 >> alpha 0.172074310 0.052461036 0.044916572 >> blank 0.261109989 0.055735281 0.036682745 >> cntrl 0.357318986 0.069249831 0.038292782 >> digit 0.436381530 0.094194364 0.039249005 >> graph 0.540954812 0.085580099 0.043331460 >> lower 0.618306476 0.095665215 0.044070399 >> print 0.707443135 0.132559305 0.048216097 >> punct 0.788922052 0.142809109 0.062871432 >> space 0.888263108 0.150516644 0.054086142 >> upper 0.966903461 0.173593592 0.054027834 >> xdigit 0.406611275 0.201614227 0.060695939 >> ideogram 0.439763499 0.239640723 0.068566486 >> special 0.523128094 0.249156298 0.099278051 >> phonogram 0.564975870 0.260972651 0.135751471 >> rune 0.637392247 0.235195497 0.064093971 >> >> Index: locale/wctype.c >> =================================================================== >> --- locale/wctype.c (revision 250217) >> +++ locale/wctype.c (working copy) >> @@ -74,6 +74,9 @@ >> "special\0" /* BSD extension */ >> "phonogram\0" /* BSD extension */ >> "rune\0"; /* BSD extension */ >> + static const size_t propnamlen[] = { >> + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 8, 7, 9, 4, 0 >> + }; >> static const wctype_t propmasks[] = { >> _CTYPE_A|_CTYPE_D, >> _CTYPE_A, >> @@ -92,16 +95,17 @@ >> _CTYPE_Q, >> 0xFFFFFF00L >> }; >> - size_t len1, len2; >> + const size_t *len2; >> const char *p; >> const wctype_t *q; >> >> - len1 = strlen(property); >> q = propmasks; >> - for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { >> - if (len1 == len2 && memcmp(property, p, len1) == 0) >> + len2 = propnamlen; >> + for (p = propnames; *len2 != 0; ) { >> + if (property[0] == p[0] && strcmp(property, p) == 0) >> return (*q); >> - q++; >> + p += *len2 + 1; >> + q++; len2++; >> } >> >> return (0UL); >> [...] > > BTW, I don't run tests and look in asm code for sure, but it seems > property[0] == p[0] is unneeded because almost every compiler tries to > inline strcmp(). Doesn't seem so (in-lining), see below. Apparently property[0] == p[0] is cheaper than strcmp() for negative checks. Removing this condition brings perf. numbers back to the "previous" column. Looking into asm: # property[0] == p[0] 4d: 44 3a 75 00 cmp 0x0(%rbp),%r14b 51: 75 dd jne 30 # strcmp() 53: 48 89 ee mov %rbp,%rsi 56: 4c 89 ff mov %r15,%rdi 59: e8 00 00 00 00 callq 5e 5e: 85 c0 test %eax,%eax 60: 75 ce jne 30 -- wbr, pluknet From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 14:21:33 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 304AE980 for ; Sat, 4 May 2013 14:21:33 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com [IPv6:2a00:1450:4010:c03::22b]) by mx1.freebsd.org (Postfix) with ESMTP id A8BBE1D09 for ; Sat, 4 May 2013 14:21:32 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id ea20so2237644lab.2 for ; Sat, 04 May 2013 07:21:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=glWyhahccLBnIUAeHYrGWWWWdhCsru1MrxFbQzPizGg=; b=aOhlFVA5TgS20AyIptrtS0/OTLir/ar+SIID+1xOMaPFFWrOshnz0d+XA61gIClNVt 0sLqej0B7HUXvGGHp8G8e1rq8aKI1q7Faj4l69JZGAvTXsWzixJYcfuAN4TdmBkykgvx FzTgXZntI7WypJDjBe4R4+b39FJXatmX7/udl4QzprqnjhPNJWby4T1ie7KsFQE6i+vu znJWYWBAhS4QSDRpfPJGJChIzY1SLuBWnum96fO5Iajxf1Q0supsIgglbKKPsrdW3nyf 5k7qwhxlzkq1w4aAhUmi8ISGWlxNQRV9Ldap0PIBUGaCJJR0NOadMtiUX9n/U+BVxvQO s7ug== X-Received: by 10.112.160.66 with SMTP id xi2mr5632608lbb.97.1367677291555; Sat, 04 May 2013 07:21:31 -0700 (PDT) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPSA id s1sm5929074lag.2.2013.05.04.07.21.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 May 2013 07:21:31 -0700 (PDT) Message-ID: <51851969.6020802@freebsd.org> Date: Sat, 04 May 2013 18:21:29 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Sergey Kandaurov Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> <20130503195540.GA52657@stack.nl> <5184ED7E.3040703@freebsd.org> In-Reply-To: OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnWLwSVUzT08aYlZOiP+ie8NKDhkuBslUIBDR5d5EkGy1SxQAJZquajK4Hp8UyWx+BMbDWt Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, Jilles Tjoelker X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 14:21:33 -0000 On 04.05.2013 16:03, Sergey Kandaurov wrote: >> BTW, I don't run tests and look in asm code for sure, but it seems >> property[0] == p[0] is unneeded because almost every compiler tries to >> inline strcmp(). > > Doesn't seem so (in-lining), see below. Yes, system's GNU cc don't inline strcmp() but inlines memcmp(): repz cmpsb I don't have clang nearby right now to test what it does. -- http://ache.vniz.net/ bitcoin:13fGiNutKNHcVSsgtGQ7bQ5kgUKgEQHn7N From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 15:43:10 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5AAE8C49; Sat, 4 May 2013 15:43:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4CF1112C; Sat, 4 May 2013 15:43:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r44FhApG031619; Sat, 4 May 2013 15:43:10 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r44Fh9iI031615; Sat, 4 May 2013 15:43:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201305041543.r44Fh9iI031615@svn.freebsd.org> From: Dimitry Andric Date: Sat, 4 May 2013 15:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250241 - stable/9/contrib/libcxxrt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 15:43:10 -0000 Author: dim Date: Sat May 4 15:43:09 2013 New Revision: 250241 URL: http://svnweb.freebsd.org/changeset/base/250241 Log: MFC r245304 (by theraven): Merge new version of libcxxrt. This brings in three fixes: - Don't treat pointers to members as pointers in catch blocks (they're usually fat pointers). - Correctly catch foreign exceptions in catchalls. - Ensure that a happens-before relationship is established when setting terminate handlers in one thread and calling them in another. MFC r245327 (by theraven): Fix libcxxrt / libc++ build with the clang in head. Pointy hat to: theraven MFC r245745 (by theraven): Import new fix from libcxxrt. This fixes the case where you attempt to rethrow an exception when you haven't caught one. This is largely a cosmetic fix, as (unless you have a very unusual terminate handler installed) it will print a nice error and then abort, rather than just aborting. MFC r246462 (by theraven): Fix a copy-and-paste error in libcxxrt. MFC r249993: Merge libcxxrt c812a07cd2f95c1403baf0bbe0366e7618d1d6d3: * Don't call the _fast version of the TLS accessor in terminate() or unexpected(). 1) TLS may not have been set up yet. 2) When we're in one of these functions, Really Bad Stuff has happened and potentially saving a few cycles really isn't important. * Merge in fixes from FreeBSD trunk to make atomics work with recent clang. Added: stable/9/contrib/libcxxrt/atomic.h - copied, changed from r245304, head/contrib/libcxxrt/atomic.h Modified: stable/9/contrib/libcxxrt/exception.cc stable/9/contrib/libcxxrt/memory.cc stable/9/contrib/libcxxrt/typeinfo.h Directory Properties: stable/9/contrib/libcxxrt/ (props changed) Copied and modified: stable/9/contrib/libcxxrt/atomic.h (from r245304, head/contrib/libcxxrt/atomic.h) ============================================================================== --- head/contrib/libcxxrt/atomic.h Fri Jan 11 15:05:55 2013 (r245304, copy source) +++ stable/9/contrib/libcxxrt/atomic.h Sat May 4 15:43:09 2013 (r250241) @@ -9,9 +9,9 @@ * Swap macro that enforces a happens-before relationship with a corresponding * ATOMIC_LOAD. */ -#if __has_feature(cxx_atomic) +#if __has_builtin(__c11_atomic_exchange) #define ATOMIC_SWAP(addr, val)\ - __atomic_exchange(addr, val, __ATOMIC_ACQ_REL) + __c11_atomic_exchange((_Atomic(__typeof__(val))*)addr, val, __ATOMIC_ACQ_REL) #elif __has_builtin(__sync_swap) #define ATOMIC_SWAP(addr, val)\ __sync_swap(addr, val) @@ -20,9 +20,9 @@ __sync_lock_test_and_set(addr, val) #endif -#if __has_feature(cxx_atomic) +#if __has_builtin(__c11_atomic_load) #define ATOMIC_LOAD(addr)\ - __atomic_load(addr, __ATOMIC_ACQUIRE) + __c11_atomic_load((_Atomic(__typeof__(*addr))*)addr, __ATOMIC_ACQUIRE) #else #define ATOMIC_LOAD(addr)\ (__sync_synchronize(), *addr) Modified: stable/9/contrib/libcxxrt/exception.cc ============================================================================== --- stable/9/contrib/libcxxrt/exception.cc Sat May 4 15:42:55 2013 (r250240) +++ stable/9/contrib/libcxxrt/exception.cc Sat May 4 15:43:09 2013 (r250241) @@ -32,6 +32,7 @@ #include #include "typeinfo.h" #include "dwarf_eh.h" +#include "atomic.h" #include "cxxabi.h" #pragma weak pthread_key_create @@ -155,6 +156,17 @@ struct __cxa_thread_info */ _Unwind_Exception *currentCleanup; /** + * Our state with respect to foreign exceptions. Usually none, set to + * caught if we have just caught an exception and rethrown if we are + * rethrowing it. + */ + enum + { + none, + caught, + rethrown + } foreign_exception_state; + /** * The public part of this structure, accessible from outside of this * module. */ @@ -308,7 +320,16 @@ static void thread_cleanup(void* thread_ __cxa_thread_info *info = (__cxa_thread_info*)thread_info; if (info->globals.caughtExceptions) { - free_exception_list(info->globals.caughtExceptions); + // If this is a foreign exception, ask it to clean itself up. + if (info->foreign_exception_state != __cxa_thread_info::none) + { + _Unwind_Exception *e = (_Unwind_Exception*)info->globals.caughtExceptions; + e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e); + } + else + { + free_exception_list(info->globals.caughtExceptions); + } } free(thread_info); } @@ -780,7 +801,8 @@ extern "C" void __cxa_decrement_exceptio */ extern "C" void __cxa_rethrow() { - __cxa_eh_globals *globals = __cxa_get_globals(); + __cxa_thread_info *ti = thread_info(); + __cxa_eh_globals *globals = &ti->globals; // Note: We don't remove this from the caught list here, because // __cxa_end_catch will be called when we unwind out of the try block. We // could probably make this faster by providing an alternative rethrow @@ -795,6 +817,15 @@ extern "C" void __cxa_rethrow() std::terminate(); } + if (ti->foreign_exception_state != __cxa_thread_info::none) + { + ti->foreign_exception_state = __cxa_thread_info::rethrown; + _Unwind_Exception *e = (_Unwind_Exception*)ex; + _Unwind_Reason_Code err = _Unwind_Resume_or_Rethrow(e); + report_failure(err, ex); + return; + } + assert(ex->handlerCount > 0 && "Rethrowing uncaught exception!"); // ex->handlerCount will be decremented in __cxa_end_catch in enclosing @@ -848,9 +879,9 @@ static bool check_type_signature(__cxa_e void *&adjustedPtr) { void *exception_ptr = (void*)(ex+1); - const std::type_info *ex_type = ex->exceptionType; + const std::type_info *ex_type = ex ? ex->exceptionType : 0; - bool is_ptr = ex_type->__is_pointer_p(); + bool is_ptr = ex ? ex_type->__is_pointer_p() : false; if (is_ptr) { exception_ptr = *(void**)exception_ptr; @@ -911,8 +942,8 @@ static handler_type check_action_record( action_record = displacement ? action_record_offset_base + displacement : 0; // We only check handler types for C++ exceptions - foreign exceptions - // are only allowed for cleanup. - if (filter > 0 && 0 != ex) + // are only allowed for cleanups and catchalls. + if (filter > 0) { std::type_info *handler_type = get_type_info_entry(context, lsda, filter); if (check_type_signature(ex, handler_type, adjustedPtr)) @@ -1133,8 +1164,10 @@ extern "C" void *__cxa_begin_catch(void extern "C" void *__cxa_begin_catch(void *e) #endif { - // Decrement the uncaught exceptions count - __cxa_eh_globals *globals = __cxa_get_globals(); + // We can't call the fast version here, because if the first exception that + // we see is a foreign exception then we won't have called it yet. + __cxa_thread_info *ti = thread_info(); + __cxa_eh_globals *globals = &ti->globals; globals->uncaughtExceptions--; _Unwind_Exception *exceptionObject = (_Unwind_Exception*)e; @@ -1177,9 +1210,22 @@ extern "C" void *__cxa_begin_catch(void { ex->handlerCount++; } + ti->foreign_exception_state = __cxa_thread_info::none; return ex->adjustedPtr; } + else + { + // If this is a foreign exception, then we need to be able to + // store it. We can't chain foreign exceptions, so we give up + // if there are already some outstanding ones. + if (globals->caughtExceptions != 0) + { + std::terminate(); + } + globals->caughtExceptions = (__cxa_exception*)exceptionObject; + ti->foreign_exception_state = __cxa_thread_info::caught; + } // exceptionObject is the pointer to the _Unwind_Exception within the // __cxa_exception. The throw object is after this return ((char*)exceptionObject + sizeof(_Unwind_Exception)); @@ -1195,10 +1241,23 @@ extern "C" void __cxa_end_catch() { // We can call the fast version here because the slow version is called in // __cxa_throw(), which must have been called before we end a catch block - __cxa_eh_globals *globals = __cxa_get_globals_fast(); + __cxa_thread_info *ti = thread_info_fast(); + __cxa_eh_globals *globals = &ti->globals; __cxa_exception *ex = globals->caughtExceptions; assert(0 != ex && "Ending catch when no exception is on the stack!"); + + if (ti->foreign_exception_state != __cxa_thread_info::none) + { + globals->caughtExceptions = 0; + if (ti->foreign_exception_state != __cxa_thread_info::rethrown) + { + _Unwind_Exception *e = (_Unwind_Exception*)ti->globals.caughtExceptions; + e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e); + } + ti->foreign_exception_state = __cxa_thread_info::none; + return; + } bool deleteException = true; @@ -1328,7 +1387,7 @@ namespace std { if (thread_local_handlers) { return pathscale::set_unexpected(f); } - return __sync_lock_test_and_set(&unexpectedHandler, f); + return ATOMIC_SWAP(&unexpectedHandler, f); } /** * Sets the function that is called to terminate the program. @@ -1336,7 +1395,8 @@ namespace std terminate_handler set_terminate(terminate_handler f) throw() { if (thread_local_handlers) { return pathscale::set_terminate(f); } - return __sync_lock_test_and_set(&terminateHandler, f); + + return ATOMIC_SWAP(&terminateHandler, f); } /** * Terminates the program, calling a custom terminate implementation if @@ -1344,7 +1404,7 @@ namespace std */ void terminate() { - static __cxa_thread_info *info = thread_info_fast(); + static __cxa_thread_info *info = thread_info(); if (0 != info && 0 != info->terminateHandler) { info->terminateHandler(); @@ -1361,7 +1421,7 @@ namespace std */ void unexpected() { - static __cxa_thread_info *info = thread_info_fast(); + static __cxa_thread_info *info = thread_info(); if (0 != info && 0 != info->unexpectedHandler) { info->unexpectedHandler(); @@ -1390,7 +1450,7 @@ namespace std { return info->unexpectedHandler; } - return unexpectedHandler; + return ATOMIC_LOAD(&unexpectedHandler); } /** * Returns the current terminate handler. @@ -1402,7 +1462,7 @@ namespace std { return info->terminateHandler; } - return terminateHandler; + return ATOMIC_LOAD(&terminateHandler); } } #ifdef __arm__ Modified: stable/9/contrib/libcxxrt/memory.cc ============================================================================== --- stable/9/contrib/libcxxrt/memory.cc Sat May 4 15:42:55 2013 (r250240) +++ stable/9/contrib/libcxxrt/memory.cc Sat May 4 15:43:09 2013 (r250241) @@ -36,14 +36,8 @@ #include #include #include "stdexcept.h" +#include "atomic.h" -#ifndef __has_builtin -#define __has_builtin(x) 0 -#endif - -#if !__has_builtin(__sync_swap) -#define __sync_swap __sync_lock_test_and_set -#endif namespace std { @@ -67,7 +61,12 @@ namespace std __attribute__((weak)) new_handler set_new_handler(new_handler handler) { - return __sync_swap(&new_handl, handler); + return ATOMIC_SWAP(&new_handl, handler); + } + __attribute__((weak)) + new_handler get_new_handler(void) + { + return ATOMIC_LOAD(&new_handl); } } @@ -75,12 +74,17 @@ namespace std __attribute__((weak)) void* operator new(size_t size) { + if (0 == size) + { + size = 1; + } void * mem = malloc(size); while (0 == mem) { - if (0 != new_handl) + new_handler h = std::get_new_handler(); + if (0 != h) { - new_handl(); + h(); } else { @@ -95,14 +99,19 @@ void* operator new(size_t size) __attribute__((weak)) void* operator new(size_t size, const std::nothrow_t &) throw() { + if (0 == size) + { + size = 1; + } void *mem = malloc(size); while (0 == mem) { - if (0 != new_handl) + new_handler h = std::get_new_handler(); + if (0 != h) { try { - new_handl(); + h(); } catch (...) { Modified: stable/9/contrib/libcxxrt/typeinfo.h ============================================================================== --- stable/9/contrib/libcxxrt/typeinfo.h Sat May 4 15:42:55 2013 (r250240) +++ stable/9/contrib/libcxxrt/typeinfo.h Sat May 4 15:43:09 2013 (r250241) @@ -70,6 +70,14 @@ namespace std */ public: /** + * Returns true if this is some pointer type, false otherwise. + */ + virtual bool __is_pointer_p() const { return false; } + /** + * Returns true if this is some function type, false otherwise. + */ + virtual bool __is_function_p() const { return false; } + /** * Catch function. Allows external libraries to implement * their own basic types. This is used, for example, in the * GNUstep Objective-C runtime to allow Objective-C types to be @@ -95,14 +103,6 @@ namespace std { return false; } - /** - * Returns true if this is some pointer type, false otherwise. - */ - virtual bool __is_pointer_p() const { return false; } - /** - * Returns true if this is some function type, false otherwise. - */ - virtual bool __is_function_p() const { return false; } }; } @@ -284,7 +284,6 @@ namespace ABI_NAMESPACE /** Pointer is a pointer to a member of an incomplete class. */ __incomplete_class_mask = 0x10 }; - virtual bool __is_pointer_p() const { return true; } virtual bool __do_catch(const type_info *thrown_type, void **thrown_object, unsigned outer) const; @@ -296,6 +295,7 @@ namespace ABI_NAMESPACE struct __pointer_type_info : public __pbase_type_info { virtual ~__pointer_type_info(); + virtual bool __is_pointer_p() const { return true; } }; /** From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 16:42:20 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CD8FA645; Sat, 4 May 2013 16:42:20 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) by mx1.freebsd.org (Postfix) with ESMTP id BE167335; Sat, 4 May 2013 16:42:19 +0000 (UTC) Received: by mail-wg0-f49.google.com with SMTP id j13so2387120wgh.4 for ; Sat, 04 May 2013 09:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=9MgvaCdM+b9S1BDRQlzN5s3o/8Td0goZeDVEXaWysgA=; b=HPXyNvOsWbVKahuOxjd8a7ZwTKk+RYLbxNsUIJUvUKp55wuCwBXUc4uVPWM9sB1ZW7 yiumbE+Qay6mi5ShkvBokGx0acqvMIkLfoHCRCCzCRtPQxNovsIM8Bu1miSkuNyI0hzH vwXYcfl46SFrjISyYjlAO1DQMRqwfccQLY9tjvojKiEN93YCnBvO1Oe+MI9N93SYtQP4 FSXIX8Ww3JUE/d/qea5h21b/ozVLDctxJopnB1eei5azajVsL36mA7aQO1dEr2COyUNP OxV9uoUYajAK0oVqV2nWQrVQlG4YS21DqebIzZdBt63MIgegeOj0WHAqHZVAbUBqmnqy 0yGQ== MIME-Version: 1.0 X-Received: by 10.194.78.137 with SMTP id b9mr18876809wjx.10.1367685738781; Sat, 04 May 2013 09:42:18 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.194.29.199 with HTTP; Sat, 4 May 2013 09:42:18 -0700 (PDT) In-Reply-To: <51851969.6020802@freebsd.org> References: <201305031552.r43FqiPN024580@svn.freebsd.org> <5183E899.4000503@freebsd.org> <20130503195540.GA52657@stack.nl> <5184ED7E.3040703@freebsd.org> <51851969.6020802@freebsd.org> Date: Sat, 4 May 2013 20:42:18 +0400 X-Google-Sender-Auth: NXXOKYIQf5Qaty25auKGgsY3GTk Message-ID: Subject: Re: svn commit: r250215 - stable/9/lib/libc/locale From: Sergey Kandaurov To: Andrey Chernov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, Jilles Tjoelker X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 16:42:20 -0000 On 4 May 2013 18:21, Andrey Chernov wrote: > On 04.05.2013 16:03, Sergey Kandaurov wrote: >>> BTW, I don't run tests and look in asm code for sure, but it seems >>> property[0] == p[0] is unneeded because almost every compiler tries to >>> inline strcmp(). >> >> Doesn't seem so (in-lining), see below. > > Yes, system's GNU cc don't inline strcmp() but inlines memcmp(): > repz > cmpsb > I don't have clang nearby right now to test what it does. I've checked gcc46 and clang3.2, and they behave similarly (poor). It's worth to note that inlined memcmp didn't help with performance relative to strcmp(). note2 - it's surprising that only base gcc inlined memcmp. This explains the difference between base gcc and {gcc46, clang} in the table below. 1 - base gcc 4.2 2 - gcc46 3 - base clang 3.2 a - if (property[0] == p[0] && strcmp(property, p) == 0) b - if (property[0] == p[0] && memcmp(property, p, *len2) == 0) c - if (memcmp(property, p, *len2) == 0) Time spend for 2097152 wctype() calls for each of wctype property 1a 2a 3a 1b 2b 3b 1c 2c 3c alnum 0.034 0.036 0.034 0.049 0.071 0.073 0.046 0.068 0.069 alpha 0.045 0.049 0.046 0.111 0.156 0.158 0.107 0.153 0.154 blank 0.037 0.041 0.038 0.053 0.075 0.079 0.153 0.224 0.223 cntrl 0.039 0.044 0.042 0.058 0.078 0.081 0.206 0.300 0.301 digit 0.039 0.044 0.043 0.059 0.080 0.085 0.259 0.378 0.378 graph 0.043 0.049 0.050 0.061 0.082 0.087 0.313 0.455 0.455 lower 0.044 0.049 0.051 0.062 0.085 0.090 0.365 0.532 0.533 print 0.048 0.054 0.059 0.067 0.088 0.092 0.419 0.610 0.610 punct 0.060 0.067 0.103 0.127 0.183 0.211 0.477 0.692 0.692 space 0.053 0.059 0.067 0.072 0.092 0.097 0.525 0.764 0.765 upper 0.054 0.059 0.068 0.074 0.094 0.100 0.578 0.841 0.842 xdigit 0.060 0.066 0.077 0.079 0.099 0.106 0.635 0.922 0.985 ideogram 0.068 0.074 0.084 0.087 0.089 0.094 0.695 0.986 0.985 special 0.098 0.104 0.113 0.169 0.210 0.212 0.753 1.116 1.118 phonogram 0.136 0.156 0.187 0.240 0.285 0.325 0.815 1.181 1.183 rune 0.064 0.070 0.087 0.099 0.104 0.113 0.842 1.293 1.283 -- wbr, pluknet From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 18:44:15 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6CB2BBBD; Sat, 4 May 2013 18:44:15 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 440E4A68; Sat, 4 May 2013 18:44:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r44IiFOE094710; Sat, 4 May 2013 18:44:15 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r44IiEfS094708; Sat, 4 May 2013 18:44:14 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201305041844.r44IiEfS094708@svn.freebsd.org> From: Matthew D Fleming Date: Sat, 4 May 2013 18:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250248 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 18:44:15 -0000 Author: mdf Date: Sat May 4 18:44:14 2013 New Revision: 250248 URL: http://svnweb.freebsd.org/changeset/base/250248 Log: MFC r248933: Use a shared lock for VOP_GETEXTATTR, as it is a read-like operation. Modified: stable/9/sys/kern/vfs_extattr.c stable/9/sys/kern/vfs_vnops.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/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/dev/puc/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) stable/9/sys/net/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/kern/vfs_extattr.c ============================================================================== --- stable/9/sys/kern/vfs_extattr.c Sat May 4 18:38:16 2013 (r250247) +++ stable/9/sys/kern/vfs_extattr.c Sat May 4 18:44:14 2013 (r250248) @@ -339,7 +339,7 @@ extattr_get_vp(struct vnode *vp, int att int error; VFS_ASSERT_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); /* * Slightly unusual semantics: if the user provides a NULL data Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Sat May 4 18:38:16 2013 (r250247) +++ stable/9/sys/kern/vfs_vnops.c Sat May 4 18:44:14 2013 (r250248) @@ -1744,7 +1744,7 @@ vn_extattr_get(struct vnode *vp, int iof auio.uio_resid = *buflen; if ((ioflg & IO_NODELOCKED) == 0) - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); ASSERT_VOP_LOCKED(vp, "IO_NODELOCKED with no vp lock held"); From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 21:56:40 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B121D7DB; Sat, 4 May 2013 21:56:40 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A14D31FD; Sat, 4 May 2013 21:56:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r44LuebZ063487; Sat, 4 May 2013 21:56:40 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r44Luexb063485; Sat, 4 May 2013 21:56:40 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201305042156.r44Luexb063485@svn.freebsd.org> From: Rick Macklem Date: Sat, 4 May 2013 21:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250257 - in stable/9/sys: fs/nfsclient nfsclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 21:56:40 -0000 Author: rmacklem Date: Sat May 4 21:56:39 2013 New Revision: 250257 URL: http://svnweb.freebsd.org/changeset/base/250257 Log: MFC: r249623 Both NFS clients can deadlock when using the "rdirplus" mount option. This can occur when an nfsiod thread that already holds a buffer lock attempts to acquire a vnode lock on an entry in the directory (a LOR) when another thread holding the vnode lock is waiting on an nfsiod thread. This patch avoids the deadlock by disabling readahead for this case, so the nfsiod threads never do readdirplus. Since readaheads for directories need the directory offset cookie from the previous read, they cannot normally happen in parallel. As such, testing by jhb@ and myself didn't find any performance degredation when this patch is applied. If there is a case where this results in a significant performance degradation, mounting without the "rdirplus" option can be done to re-enable readahead for directories. Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c stable/9/sys/nfsclient/nfs_bio.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clbio.c Sat May 4 21:36:47 2013 (r250256) +++ stable/9/sys/fs/nfsclient/nfs_clbio.c Sat May 4 21:56:39 2013 (r250257) @@ -1401,10 +1401,18 @@ ncl_asyncio(struct nfsmount *nmp, struct * Commits are usually short and sweet so lets save some cpu and * leave the async daemons for more important rpc's (such as reads * and writes). + * + * Readdirplus RPCs do vget()s to acquire the vnodes for entries + * in the directory in order to update attributes. This can deadlock + * with another thread that is waiting for async I/O to be done by + * an nfsiod thread while holding a lock on one of these vnodes. + * To avoid this deadlock, don't allow the async nfsiod threads to + * perform Readdirplus RPCs. */ mtx_lock(&ncl_iod_mutex); - if (bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && - (nmp->nm_bufqiods > ncl_numasync / 2)) { + if ((bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && + (nmp->nm_bufqiods > ncl_numasync / 2)) || + (bp->b_vp->v_type == VDIR && (nmp->nm_flag & NFSMNT_RDIRPLUS))) { mtx_unlock(&ncl_iod_mutex); return(EIO); } Modified: stable/9/sys/nfsclient/nfs_bio.c ============================================================================== --- stable/9/sys/nfsclient/nfs_bio.c Sat May 4 21:36:47 2013 (r250256) +++ stable/9/sys/nfsclient/nfs_bio.c Sat May 4 21:56:39 2013 (r250257) @@ -1344,10 +1344,18 @@ nfs_asyncio(struct nfsmount *nmp, struct * Commits are usually short and sweet so lets save some cpu and * leave the async daemons for more important rpc's (such as reads * and writes). + * + * Readdirplus RPCs do vget()s to acquire the vnodes for entries + * in the directory in order to update attributes. This can deadlock + * with another thread that is waiting for async I/O to be done by + * an nfsiod thread while holding a lock on one of these vnodes. + * To avoid this deadlock, don't allow the async nfsiod threads to + * perform Readdirplus RPCs. */ mtx_lock(&nfs_iod_mtx); - if (bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && - (nmp->nm_bufqiods > nfs_numasync / 2)) { + if ((bp->b_iocmd == BIO_WRITE && (bp->b_flags & B_NEEDCOMMIT) && + (nmp->nm_bufqiods > nfs_numasync / 2)) || + (bp->b_vp->v_type == VDIR && (nmp->nm_flag & NFSMNT_RDIRPLUS))) { mtx_unlock(&nfs_iod_mtx); return(EIO); } From owner-svn-src-stable-9@FreeBSD.ORG Sat May 4 22:05:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 56B57429; Sat, 4 May 2013 22:05:44 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 38894266; Sat, 4 May 2013 22:05:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r44M5i6K067478; Sat, 4 May 2013 22:05:44 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r44M5hLR067470; Sat, 4 May 2013 22:05:43 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201305042205.r44M5hLR067470@svn.freebsd.org> From: Rick Macklem Date: Sat, 4 May 2013 22:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r250258 - in stable/9/sys: fs/nfsclient nfsclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 May 2013 22:05:44 -0000 Author: rmacklem Date: Sat May 4 22:05:43 2013 New Revision: 250258 URL: http://svnweb.freebsd.org/changeset/base/250258 Log: MFC: r249630 When an NFS unmount occurs, once vflush() writes the last dirty buffer for the last vnode on the mount back to the server, it returns. At that point, the code continues with the unmount, including freeing up the nfs specific part of the mount structure. It is possible that an nfsiod thread will try to check for an empty I/O queue in the nfs specific part of the mount structure after it has been free'd by the unmount. This patch avoids this problem by setting the iodmount entries for the mount back to NULL while holding the mutex in the unmount and checking the appropriate entry is non-NULL after acquiring the mutex in the nfsiod thread. Modified: stable/9/sys/fs/nfsclient/nfs_clnfsiod.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/nfsclient/nfs_nfsiod.c stable/9/sys/nfsclient/nfs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clnfsiod.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clnfsiod.c Sat May 4 21:56:39 2013 (r250257) +++ stable/9/sys/fs/nfsclient/nfs_clnfsiod.c Sat May 4 22:05:43 2013 (r250258) @@ -304,6 +304,14 @@ nfssvc_iod(void *instance) } mtx_lock(&ncl_iod_mutex); /* + * Make sure the nmp hasn't been dismounted as soon as + * ncl_doio() completes for the last buffer. + */ + nmp = ncl_iodmount[myiod]; + if (nmp == NULL) + break; + + /* * If there are more than one iod on this mount, then defect * so that the iods can be shared out fairly between the mounts */ Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sat May 4 21:56:39 2013 (r250257) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sat May 4 22:05:43 2013 (r250258) @@ -80,6 +80,9 @@ extern int nfscl_ticks; extern struct timeval nfsboottime; extern struct nfsstats newnfsstats; extern int nfsrv_useacl; +extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON]; +extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON]; +extern struct mtx ncl_iod_mutex; MALLOC_DEFINE(M_NEWNFSREQ, "newnfsclient_req", "New NFS request header"); MALLOC_DEFINE(M_NEWNFSMNT, "newnfsmnt", "New NFS mount struct"); @@ -1410,7 +1413,7 @@ nfs_unmount(struct mount *mp, int mntfla { struct thread *td; struct nfsmount *nmp; - int error, flags = 0, trycnt = 0; + int error, flags = 0, i, trycnt = 0; td = curthread; @@ -1445,6 +1448,14 @@ nfs_unmount(struct mount *mp, int mntfla */ if ((mntflags & MNT_FORCE) == 0) nfscl_umount(nmp, td); + /* Make sure no nfsiods are assigned to this mount. */ + mtx_lock(&ncl_iod_mutex); + for (i = 0; i < NFS_MAXASYNCDAEMON; i++) + if (ncl_iodmount[i] == nmp) { + ncl_iodwant[i] = NFSIOD_AVAILABLE; + ncl_iodmount[i] = NULL; + } + mtx_unlock(&ncl_iod_mutex); newnfs_disconnect(&nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); FREE(nmp->nm_nam, M_SONAME); Modified: stable/9/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- stable/9/sys/nfsclient/nfs_nfsiod.c Sat May 4 21:56:39 2013 (r250257) +++ stable/9/sys/nfsclient/nfs_nfsiod.c Sat May 4 22:05:43 2013 (r250258) @@ -308,6 +308,14 @@ nfssvc_iod(void *instance) mtx_unlock(&Giant); mtx_lock(&nfs_iod_mtx); /* + * Make sure the nmp hasn't been dismounted as soon as + * nfs_doio() completes for the last buffer. + */ + nmp = nfs_iodmount[myiod]; + if (nmp == NULL) + break; + + /* * If there are more than one iod on this mount, then defect * so that the iods can be shared out fairly between the mounts */ Modified: stable/9/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vfsops.c Sat May 4 21:56:39 2013 (r250257) +++ stable/9/sys/nfsclient/nfs_vfsops.c Sat May 4 22:05:43 2013 (r250258) @@ -1362,7 +1362,7 @@ static int nfs_unmount(struct mount *mp, int mntflags) { struct nfsmount *nmp; - int error, flags = 0; + int error, flags = 0, i; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; @@ -1387,6 +1387,14 @@ nfs_unmount(struct mount *mp, int mntfla /* * We are now committed to the unmount. */ + /* Make sure no nfsiods are assigned to this mount. */ + mtx_lock(&nfs_iod_mtx); + for (i = 0; i < NFS_MAXASYNCDAEMON; i++) + if (nfs_iodmount[i] == nmp) { + nfs_iodwant[i] = NFSIOD_AVAILABLE; + nfs_iodmount[i] = NULL; + } + mtx_unlock(&nfs_iod_mtx); nfs_disconnect(nmp); free(nmp->nm_nam, M_SONAME);