From owner-svn-src-stable@freebsd.org Sun Jan 22 11:13:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E062CBCE29; Sun, 22 Jan 2017 11:13:55 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F15BCE5C; Sun, 22 Jan 2017 11:13:54 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MBDsZR080512; Sun, 22 Jan 2017 11:13:54 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MBDs5h080511; Sun, 22 Jan 2017 11:13:54 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701221113.v0MBDs5h080511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 22 Jan 2017 11:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312619 - stable/11/usr.sbin/pciconf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 11:13:55 -0000 Author: bapt Date: Sun Jan 22 11:13:53 2017 New Revision: 312619 URL: https://svnweb.freebsd.org/changeset/base/312619 Log: MFC r311953 (by cem) pciconf(8): Reallow trailing colon in selectors Reallow device selectors to have a trailing colon, as documented in the manual page. This was broken along with some unrelated cleanups in r295806. PR: 215979 Reported by: David Boyd Sponsored by: Dell EMC Isilon Modified: stable/11/usr.sbin/pciconf/pciconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/11/usr.sbin/pciconf/pciconf.c Sun Jan 22 07:05:41 2017 (r312618) +++ stable/11/usr.sbin/pciconf/pciconf.c Sun Jan 22 11:13:53 2017 (r312619) @@ -917,11 +917,8 @@ parsesel(const char *str) while (isdigit(*ep) && i < 4) { selarr[i++] = strtoul(ep, &eppos, 10); ep = eppos; - if (*ep == ':') { + if (*ep == ':') ep++; - if (*ep == '\0') - i = 0; - } } if (i > 0 && *ep == '\0') { sel.pc_func = (i > 2) ? selarr[--i] : 0; From owner-svn-src-stable@freebsd.org Sun Jan 22 13:21:21 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06B62CBC55C; Sun, 22 Jan 2017 13:21:21 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9E0EE42; Sun, 22 Jan 2017 13:21:20 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MDLJdb031665; Sun, 22 Jan 2017 13:21:19 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MDLJst031664; Sun, 22 Jan 2017 13:21:19 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201701221321.v0MDLJst031664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 22 Jan 2017 13:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312620 - stable/11/sys/boot/fdt/dts/arm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 13:21:21 -0000 Author: jmcneill Date: Sun Jan 22 13:21:19 2017 New Revision: 312620 URL: https://svnweb.freebsd.org/changeset/base/312620 Log: MFC r310854, r310972 r310854: Add missing reg property to usbphy node. r310972: Fix a typo in the third address of the reg property for the usbphy node. Modified: stable/11/sys/boot/fdt/dts/arm/a83t.dtsi Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/dts/arm/a83t.dtsi ============================================================================== --- stable/11/sys/boot/fdt/dts/arm/a83t.dtsi Sun Jan 22 11:13:53 2017 (r312619) +++ stable/11/sys/boot/fdt/dts/arm/a83t.dtsi Sun Jan 22 13:21:19 2017 (r312620) @@ -132,6 +132,9 @@ usbphy: phy@01c19400 { compatible = "allwinner,sun8i-a83t-usb-phy"; + reg = <0x01c19400 0x2c>, + <0x01c1a800 0x4>, + <0x01c1b800 0x4>; clocks = <&usb_clk 8>, <&usb_clk 9>, <&usb_clk 10>, From owner-svn-src-stable@freebsd.org Sun Jan 22 21:31:33 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4672CBCF07; Sun, 22 Jan 2017 21:31:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92D4A8EA; Sun, 22 Jan 2017 21:31:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MLVW3F037265; Sun, 22 Jan 2017 21:31:32 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MLVWjg037264; Sun, 22 Jan 2017 21:31:32 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201701222131.v0MLVWjg037264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 22 Jan 2017 21:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312653 - stable/11/share/skel X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 21:31:33 -0000 Author: jilles Date: Sun Jan 22 21:31:32 2017 New Revision: 312653 URL: https://svnweb.freebsd.org/changeset/base/312653 Log: MFC r312230: skel: Do not set -o emacs in .shrc. sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set this again in .shrc, since that only serves to prevent invocations like 'sh -o vi' and 'sh +o emacs' to have the intended effect. PR: 215958 Submitted by: Andras Farkas Modified: stable/11/share/skel/dot.shrc Directory Properties: stable/11/ (props changed) Modified: stable/11/share/skel/dot.shrc ============================================================================== --- stable/11/share/skel/dot.shrc Sun Jan 22 20:11:24 2017 (r312652) +++ stable/11/share/skel/dot.shrc Sun Jan 22 21:31:32 2017 (r312653) @@ -13,10 +13,6 @@ # # umask 022 -# Enable the builtin emacs(1) command line editor in sh(1), -# e.g. C-a -> beginning-of-line. -set -o emacs - # Uncomment this and comment the above to enable the builtin vi(1) command # line editor in sh(1), e.g. ESC to go into visual mode. # set -o vi From owner-svn-src-stable@freebsd.org Sun Jan 22 21:34:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9024ECBCFD8; Sun, 22 Jan 2017 21:34:27 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F543B2A; Sun, 22 Jan 2017 21:34:27 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MLYQVb038101; Sun, 22 Jan 2017 21:34:26 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MLYQpG038100; Sun, 22 Jan 2017 21:34:26 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201701222134.v0MLYQpG038100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 22 Jan 2017 21:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312654 - stable/10/share/skel X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 21:34:27 -0000 Author: jilles Date: Sun Jan 22 21:34:26 2017 New Revision: 312654 URL: https://svnweb.freebsd.org/changeset/base/312654 Log: MFC r312230: skel: Do not set -o emacs in .shrc. sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set this again in .shrc, since that only serves to prevent invocations like 'sh -o vi' and 'sh +o emacs' to have the intended effect. PR: 215958 Submitted by: Andras Farkas Modified: stable/10/share/skel/dot.shrc Directory Properties: stable/10/ (props changed) Modified: stable/10/share/skel/dot.shrc ============================================================================== --- stable/10/share/skel/dot.shrc Sun Jan 22 21:31:32 2017 (r312653) +++ stable/10/share/skel/dot.shrc Sun Jan 22 21:34:26 2017 (r312654) @@ -13,10 +13,6 @@ # # umask 022 -# Enable the builtin emacs(1) command line editor in sh(1), -# e.g. C-a -> beginning-of-line. -set -o emacs - # Uncomment this and comment the above to enable the builtin vi(1) command # line editor in sh(1), e.g. ESC to go into visual mode. # set -o vi From owner-svn-src-stable@freebsd.org Sun Jan 22 23:30:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C4DFCBD37E; Sun, 22 Jan 2017 23:30:28 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0241FC12; Sun, 22 Jan 2017 23:30:27 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v0MNUOQb000256; Sun, 22 Jan 2017 15:30:24 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v0MNUJMp000255; Sun, 22 Jan 2017 15:30:19 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201701222330.v0MNUJMp000255@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r312653 - stable/11/share/skel In-Reply-To: <201701222131.v0MLVWjg037264@repo.freebsd.org> To: Jilles Tjoelker Date: Sun, 22 Jan 2017 15:30:19 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 23:30:28 -0000 > Author: jilles > Date: Sun Jan 22 21:31:32 2017 > New Revision: 312653 > URL: https://svnweb.freebsd.org/changeset/base/312653 > > Log: > MFC r312230: skel: Do not set -o emacs in .shrc. > > sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set > this again in .shrc, since that only serves to prevent invocations like > 'sh -o vi' and 'sh +o emacs' to have the intended effect. > > PR: 215958 > Submitted by: Andras Farkas > > Modified: > stable/11/share/skel/dot.shrc > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/share/skel/dot.shrc > ============================================================================== > --- stable/11/share/skel/dot.shrc Sun Jan 22 20:11:24 2017 (r312652) > +++ stable/11/share/skel/dot.shrc Sun Jan 22 21:31:32 2017 (r312653) > @@ -13,10 +13,6 @@ > # > # umask 022 > > -# Enable the builtin emacs(1) command line editor in sh(1), > -# e.g. C-a -> beginning-of-line. > -set -o emacs > - > # Uncomment this and comment the above to enable the builtin vi(1) command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ documentation error.... please correct that too. > # line editor in sh(1), e.g. ESC to go into visual mode. > # set -o vi > _______________________________________________ > svn-src-stable-11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 > To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Mon Jan 23 01:20:59 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB595CBCB6D; Mon, 23 Jan 2017 01:20:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 954993ED; Mon, 23 Jan 2017 01:20:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N1Kwkk031477; Mon, 23 Jan 2017 01:20:58 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N1KwtK031474; Mon, 23 Jan 2017 01:20:58 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701230120.v0N1KwtK031474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 23 Jan 2017 01:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312656 - in stable/11/sys: conf netgraph X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 01:20:59 -0000 Author: pfg Date: Mon Jan 23 01:20:58 2017 New Revision: 312656 URL: https://svnweb.freebsd.org/changeset/base/312656 Log: MFC r312443: mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION. There were several places where reference to compression were left unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID which is not defined in the tree and therefore were sure to break with INVARIANTS: comment them out. Reported by: Eugene Grosbein PR: 216265 Modified: stable/11/sys/conf/NOTES stable/11/sys/conf/options stable/11/sys/netgraph/ng_mppc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Sun Jan 22 23:45:59 2017 (r312655) +++ stable/11/sys/conf/NOTES Mon Jan 23 01:20:58 2017 (r312656) @@ -769,8 +769,7 @@ options NETGRAPH_IPFW options NETGRAPH_KSOCKET options NETGRAPH_L2TP options NETGRAPH_LMI -# MPPC compression requires proprietary files (not included) -#options NETGRAPH_MPPC_COMPRESSION +options NETGRAPH_MPPC_COMPRESSION options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_NETFLOW options NETGRAPH_NAT Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Sun Jan 22 23:45:59 2017 (r312655) +++ stable/11/sys/conf/options Mon Jan 23 01:20:58 2017 (r312656) @@ -510,7 +510,6 @@ NETGRAPH_IPFW opt_netgraph.h NETGRAPH_KSOCKET opt_netgraph.h NETGRAPH_L2TP opt_netgraph.h NETGRAPH_LMI opt_netgraph.h -# MPPC compression requires proprietary files (not included) NETGRAPH_MPPC_COMPRESSION opt_netgraph.h NETGRAPH_MPPC_ENCRYPTION opt_netgraph.h NETGRAPH_NAT opt_netgraph.h Modified: stable/11/sys/netgraph/ng_mppc.c ============================================================================== --- stable/11/sys/netgraph/ng_mppc.c Sun Jan 22 23:45:59 2017 (r312655) +++ stable/11/sys/netgraph/ng_mppc.c Mon Jan 23 01:20:58 2017 (r312656) @@ -66,7 +66,7 @@ #if !defined(NETGRAPH_MPPC_COMPRESSION) && !defined(NETGRAPH_MPPC_ENCRYPTION) #ifdef KLD_MODULE -/* XXX NETGRAPH_MPPC_COMPRESSION isn't functional yet */ +#define NETGRAPH_MPPC_COMPRESSION #define NETGRAPH_MPPC_ENCRYPTION #else /* This case is indicative of an error in sys/conf files */ @@ -81,7 +81,6 @@ static MALLOC_DEFINE(M_NETGRAPH_MPPC, "n #endif #ifdef NETGRAPH_MPPC_COMPRESSION -/* XXX this file doesn't exist yet, but hopefully someday it will... */ #include #endif #ifdef NETGRAPH_MPPC_ENCRYPTION @@ -543,7 +542,7 @@ err1: &destCnt, d->history, flags, 0); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_EXPANDED) == 0 && (rtn & MPPC_COMP_OK) == MPPC_COMP_OK) { outlen -= destCnt; @@ -805,7 +804,7 @@ failed: &sourceCnt, &destCnt, d->history, flags); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_DEST_EXHAUSTED) != 0 || (rtn & MPPC_DECOMP_OK) != MPPC_DECOMP_OK) { log(LOG_ERR, "%s: decomp returned 0x%x", From owner-svn-src-stable@freebsd.org Mon Jan 23 01:21:40 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C5FECBCD38; Mon, 23 Jan 2017 01:21:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 672E7817; Mon, 23 Jan 2017 01:21:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N1LdmS032929; Mon, 23 Jan 2017 01:21:39 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N1Ldgp032467; Mon, 23 Jan 2017 01:21:39 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701230121.v0N1Ldgp032467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 23 Jan 2017 01:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312657 - in stable/10/sys: conf netgraph X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 01:21:40 -0000 Author: pfg Date: Mon Jan 23 01:21:39 2017 New Revision: 312657 URL: https://svnweb.freebsd.org/changeset/base/312657 Log: MFC r312443: mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION. There were several places where reference to compression were left unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID which is not defined in the tree and therefore were sure to break with INVARIANTS: comment them out. Reported by: Eugene Grosbein PR: 216265 Modified: stable/10/sys/conf/NOTES stable/10/sys/conf/options stable/10/sys/netgraph/ng_mppc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Mon Jan 23 01:20:58 2017 (r312656) +++ stable/10/sys/conf/NOTES Mon Jan 23 01:21:39 2017 (r312657) @@ -747,8 +747,7 @@ options NETGRAPH_IPFW options NETGRAPH_KSOCKET options NETGRAPH_L2TP options NETGRAPH_LMI -# MPPC compression requires proprietary files (not included) -#options NETGRAPH_MPPC_COMPRESSION +options NETGRAPH_MPPC_COMPRESSION options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_NETFLOW options NETGRAPH_NAT Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Mon Jan 23 01:20:58 2017 (r312656) +++ stable/10/sys/conf/options Mon Jan 23 01:21:39 2017 (r312657) @@ -512,7 +512,6 @@ NETGRAPH_IPFW opt_netgraph.h NETGRAPH_KSOCKET opt_netgraph.h NETGRAPH_L2TP opt_netgraph.h NETGRAPH_LMI opt_netgraph.h -# MPPC compression requires proprietary files (not included) NETGRAPH_MPPC_COMPRESSION opt_netgraph.h NETGRAPH_MPPC_ENCRYPTION opt_netgraph.h NETGRAPH_NAT opt_netgraph.h Modified: stable/10/sys/netgraph/ng_mppc.c ============================================================================== --- stable/10/sys/netgraph/ng_mppc.c Mon Jan 23 01:20:58 2017 (r312656) +++ stable/10/sys/netgraph/ng_mppc.c Mon Jan 23 01:21:39 2017 (r312657) @@ -66,7 +66,7 @@ #if !defined(NETGRAPH_MPPC_COMPRESSION) && !defined(NETGRAPH_MPPC_ENCRYPTION) #ifdef KLD_MODULE -/* XXX NETGRAPH_MPPC_COMPRESSION isn't functional yet */ +#define NETGRAPH_MPPC_COMPRESSION #define NETGRAPH_MPPC_ENCRYPTION #else /* This case is indicative of an error in sys/conf files */ @@ -81,7 +81,6 @@ static MALLOC_DEFINE(M_NETGRAPH_MPPC, "n #endif #ifdef NETGRAPH_MPPC_COMPRESSION -/* XXX this file doesn't exist yet, but hopefully someday it will... */ #include #endif #ifdef NETGRAPH_MPPC_ENCRYPTION @@ -546,7 +545,7 @@ err1: &destCnt, d->history, flags, 0); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_EXPANDED) == 0 && (rtn & MPPC_COMP_OK) == MPPC_COMP_OK) { outlen -= destCnt; @@ -808,7 +807,7 @@ failed: &sourceCnt, &destCnt, d->history, flags); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_DEST_EXHAUSTED) != 0 || (rtn & MPPC_DECOMP_OK) != MPPC_DECOMP_OK) { log(LOG_ERR, "%s: decomp returned 0x%x", From owner-svn-src-stable@freebsd.org Mon Jan 23 08:34:43 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BBF5CBD607; Mon, 23 Jan 2017 08:34:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B212A9B; Mon, 23 Jan 2017 08:34:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N8Yggx010992; Mon, 23 Jan 2017 08:34:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N8Yg8H010990; Mon, 23 Jan 2017 08:34:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701230834.v0N8Yg8H010990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 23 Jan 2017 08:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312665 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 08:34:43 -0000 Author: avg Date: Mon Jan 23 08:34:41 2017 New Revision: 312665 URL: https://svnweb.freebsd.org/changeset/base/312665 Log: MFC r312426: fix a thread preemption regression in schedulers introduced in r270423 Modified: stable/11/sys/kern/sched_4bsd.c stable/11/sys/kern/sched_ule.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sched_4bsd.c ============================================================================== --- stable/11/sys/kern/sched_4bsd.c Mon Jan 23 07:32:47 2017 (r312664) +++ stable/11/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) @@ -968,8 +968,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; Modified: stable/11/sys/kern/sched_ule.c ============================================================================== --- stable/11/sys/kern/sched_ule.c Mon Jan 23 07:32:47 2017 (r312664) +++ stable/11/sys/kern/sched_ule.c Mon Jan 23 08:34:41 2017 (r312665) @@ -1898,8 +1898,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) From owner-svn-src-stable@freebsd.org Mon Jan 23 08:34:52 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 961F8CBD64B; Mon, 23 Jan 2017 08:34:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65ABDB01; Mon, 23 Jan 2017 08:34:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N8YpSN011044; Mon, 23 Jan 2017 08:34:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N8Ypnu011042; Mon, 23 Jan 2017 08:34:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701230834.v0N8Ypnu011042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 23 Jan 2017 08:34:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312666 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 08:34:52 -0000 Author: avg Date: Mon Jan 23 08:34:51 2017 New Revision: 312666 URL: https://svnweb.freebsd.org/changeset/base/312666 Log: MFC r312426: fix a thread preemption regression in schedulers introduced in r270423 Modified: stable/10/sys/kern/sched_4bsd.c stable/10/sys/kern/sched_ule.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sched_4bsd.c ============================================================================== --- stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) +++ stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:51 2017 (r312666) @@ -963,8 +963,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; Modified: stable/10/sys/kern/sched_ule.c ============================================================================== --- stable/10/sys/kern/sched_ule.c Mon Jan 23 08:34:41 2017 (r312665) +++ stable/10/sys/kern/sched_ule.c Mon Jan 23 08:34:51 2017 (r312666) @@ -1870,8 +1870,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) From owner-svn-src-stable@freebsd.org Mon Jan 23 13:34:51 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A755CBCF0B; Mon, 23 Jan 2017 13:34:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 0507CA86; Mon, 23 Jan 2017 13:34:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id BDED0D65BE7; Tue, 24 Jan 2017 00:34:41 +1100 (AEDT) Date: Tue, 24 Jan 2017 00:34:41 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r312666 - stable/10/sys/kern In-Reply-To: <201701230834.v0N8Ypnu011042@repo.freebsd.org> Message-ID: <20170124002712.Q903@besplex.bde.org> References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=BKLDlBYG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=RN40QYc7CpQC_wqHqSMA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 13:34:51 -0000 On Mon, 23 Jan 2017, Andriy Gapon wrote: > ============================================================================== > --- stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) > +++ stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:51 2017 (r312666) > @@ -963,8 +963,8 @@ sched_switch(struct thread *td, struct t > sched_load_rem(); > > td->td_lastcpu = td->td_oncpu; > - preempted = !((td->td_flags & TDF_SLICEEND) || > - (flags & SWT_RELINQUISH)); > + preempted = (td->td_flags & TDF_SLICEEND) == 0 && > + (flags & SW_PREEMPT) != 0; > td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); > td->td_owepreempt = 0; > td->td_oncpu = NOCPU; Please also merge to FreeBSD-9. FreeBSD-9 has best performance for a makeworld benchmark. What is a good benchmark for showing that the fix helps? Involuntary context switches increased by almost a factor of 2 for the makeworld benchmark (over nfs) recently, but that was just caused by pessimizations in the NIC driver. Bruce From owner-svn-src-stable@freebsd.org Mon Jan 23 16:04:51 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75EDACBE5E6; Mon, 23 Jan 2017 16:04:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2F16E3BC; Mon, 23 Jan 2017 16:04:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA20869; Mon, 23 Jan 2017 18:04:47 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cVh6t-0007iT-0P; Mon, 23 Jan 2017 18:04:47 +0200 Subject: Re: svn commit: r312666 - stable/10/sys/kern To: Bruce Evans References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> <20170124002712.Q903@besplex.bde.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Andriy Gapon Message-ID: <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Date: Mon, 23 Jan 2017 18:03:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170124002712.Q903@besplex.bde.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 16:04:51 -0000 On 23/01/2017 15:34, Bruce Evans wrote: > On Mon, 23 Jan 2017, Andriy Gapon wrote: > >> ============================================================================== >> --- stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) >> +++ stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:51 2017 (r312666) >> @@ -963,8 +963,8 @@ sched_switch(struct thread *td, struct t >> sched_load_rem(); >> >> td->td_lastcpu = td->td_oncpu; >> - preempted = !((td->td_flags & TDF_SLICEEND) || >> - (flags & SWT_RELINQUISH)); >> + preempted = (td->td_flags & TDF_SLICEEND) == 0 && >> + (flags & SW_PREEMPT) != 0; >> td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); >> td->td_owepreempt = 0; >> td->td_oncpu = NOCPU; > > Please also merge to FreeBSD-9. FreeBSD-9 has best performance for a > makeworld benchmark. Will do. > What is a good benchmark for showing that the fix helps? Honestly, I do not know. We ran into a pathology where a thread was not getting scheduled for a long time after being preempted while in a critical section (so the actual preemption was a voluntary switch when exiting the critical section). I am not sure what kind of a synthetic benchmark or a test case would readily demonstrate the problem. > Involuntary context switches increased by almost a factor of 2 for the > makeworld benchmark (over nfs) recently, but that was just caused by > pessimizations in the NIC driver. -- Andriy Gapon From owner-svn-src-stable@freebsd.org Mon Jan 23 18:12:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87E7FCBE43D; Mon, 23 Jan 2017 18:12:22 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id 6ACA3C5F; Mon, 23 Jan 2017 18:12:21 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 992655649D; Mon, 23 Jan 2017 12:12:15 -0600 (CST) Subject: Re: svn commit: r312666 - stable/10/sys/kern To: Andriy Gapon , Bruce Evans References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> <20170124002712.Q903@besplex.bde.org> <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Eric van Gyzen Message-ID: Date: Mon, 23 Jan 2017 12:12:14 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 18:12:22 -0000 On 01/23/2017 10:03, Andriy Gapon wrote: > On 23/01/2017 15:34, Bruce Evans wrote: >> What is a good benchmark for showing that the fix helps? > > Honestly, I do not know. We ran into a pathology where a thread was not getting > scheduled for a long time after being preempted while in a critical section (so > the actual preemption was a voluntary switch when exiting the critical section). > I am not sure what kind of a synthetic benchmark or a test case would readily > demonstrate the problem. I submitted r270423, which introduced the bug Andriy just fixed. I'm already setting up the performance test that I used for that change. It's a macro-benchmark of a commercial product, so I can't elaborate on details, but at least I can give a thumb indication in the style of a Roman Dictator. Eric From owner-svn-src-stable@freebsd.org Mon Jan 23 20:51:31 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29723CBE830; Mon, 23 Jan 2017 20:51:31 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB96DD91; Mon, 23 Jan 2017 20:51:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0NKpUwd017932; Mon, 23 Jan 2017 20:51:30 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NKpTVL017928; Mon, 23 Jan 2017 20:51:29 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201701232051.v0NKpTVL017928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 23 Jan 2017 20:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312671 - in stable/11/sys: conf dev/sdhci modules modules/sdhci_acpi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 20:51:31 -0000 Author: gonzo Date: Mon Jan 23 20:51:29 2017 New Revision: 312671 URL: https://svnweb.freebsd.org/changeset/base/312671 Log: MFC r311911, r311923 r311911: [sdhci] Add ACPI platform support for SDHCI driver - Create ACPI version of SDHCI attach/detach/accessors logic. Some platforms (e.g. BayTrail-based Minnowboard) expose SDHCI devices via ACPI, not PCI - Add sdchi_acpi kernel module Reviewed by: ian, imp Differential Revision: https://reviews.freebsd.org/D9112 r311923: Add acpi_if.h and opt_acpi.h to Makefile to unbreak "make depend" with sys/modules/sdhci_acpi X-MFC with: r311911 Reported by: Jenkins Added: stable/11/sys/dev/sdhci/sdhci_acpi.c - copied unchanged from r311911, head/sys/dev/sdhci/sdhci_acpi.c stable/11/sys/modules/sdhci_acpi/ - copied from r311911, head/sys/modules/sdhci_acpi/ Modified: stable/11/sys/conf/files stable/11/sys/modules/Makefile stable/11/sys/modules/sdhci_acpi/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Mon Jan 23 19:20:55 2017 (r312670) +++ stable/11/sys/conf/files Mon Jan 23 20:51:29 2017 (r312671) @@ -2557,6 +2557,7 @@ dev/scd/scd.c optional scd isa dev/scd/scd_isa.c optional scd isa dev/sdhci/sdhci.c optional sdhci dev/sdhci/sdhci_if.m optional sdhci +dev/sdhci/sdhci_acpi.c optional sdhci acpi dev/sdhci/sdhci_pci.c optional sdhci pci dev/sf/if_sf.c optional sf pci dev/sge/if_sge.c optional sge pci Copied: stable/11/sys/dev/sdhci/sdhci_acpi.c (from r311911, head/sys/dev/sdhci/sdhci_acpi.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/sdhci/sdhci_acpi.c Mon Jan 23 20:51:29 2017 (r312671, copy of r311911, head/sys/dev/sdhci/sdhci_acpi.c) @@ -0,0 +1,370 @@ +/*- + * Copyright (c) 2017 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "sdhci.h" +#include "mmcbr_if.h" +#include "sdhci_if.h" + +static const struct sdhci_acpi_device { + const char* hid; + int uid; + const char *desc; + u_int quirks; +} sdhci_acpi_devices[] = { + { "80860F14", 1, "Intel Bay Trail eMMC 4.5 Controller", + SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | + SDHCI_QUIRK_INTEL_POWER_UP_RESET }, + { "80860F16", 0, "Intel Bay Trail SD Host Controller", + 0 }, + { NULL, 0, NULL, 0} +}; + +static char *sdhci_ids[] = { + "80860F14", + "80860F16", + NULL +}; + +struct sdhci_acpi_softc { + u_int quirks; /* Chip specific quirks */ + struct resource *irq_res; /* IRQ resource */ + void *intrhand; /* Interrupt handle */ + + struct sdhci_slot slot; + struct resource *mem_res; /* Memory resource */ +}; + +static void sdhci_acpi_intr(void *arg); +static int sdhci_acpi_detach(device_t dev); + +static uint8_t +sdhci_acpi_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return bus_read_1(sc->mem_res, off); +} + +static void +sdhci_acpi_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + bus_write_1(sc->mem_res, off, val); +} + +static uint16_t +sdhci_acpi_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return bus_read_2(sc->mem_res, off); +} + +static void +sdhci_acpi_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + bus_write_2(sc->mem_res, off, val); +} + +static uint32_t +sdhci_acpi_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return bus_read_4(sc->mem_res, off); +} + +static void +sdhci_acpi_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + bus_write_4(sc->mem_res, off, val); +} + +static void +sdhci_acpi_read_multi_4(device_t dev, struct sdhci_slot *slot, + bus_size_t off, uint32_t *data, bus_size_t count) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_read_multi_stream_4(sc->mem_res, off, data, count); +} + +static void +sdhci_acpi_write_multi_4(device_t dev, struct sdhci_slot *slot, + bus_size_t off, uint32_t *data, bus_size_t count) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_write_multi_stream_4(sc->mem_res, off, data, count); +} + +static const struct sdhci_acpi_device * +sdhci_acpi_find_device(device_t dev) +{ + const char *hid; + int i, uid; + ACPI_HANDLE handle; + ACPI_STATUS status; + + hid = ACPI_ID_PROBE(device_get_parent(dev), dev, sdhci_ids); + if (hid == NULL) + return (NULL); + + handle = acpi_get_handle(dev); + status = acpi_GetInteger(handle, "_UID", &uid); + if (ACPI_FAILURE(status)) + uid = 0; + + for (i = 0; sdhci_acpi_devices[i].hid != NULL; i++) { + if (strcmp(sdhci_acpi_devices[i].hid, hid) != 0) + continue; + if ((sdhci_acpi_devices[i].uid != 0) && + (sdhci_acpi_devices[i].uid != uid)) + continue; + return &sdhci_acpi_devices[i]; + } + + return (NULL); +} + +static int +sdhci_acpi_probe(device_t dev) +{ + const struct sdhci_acpi_device *acpi_dev; + + acpi_dev = sdhci_acpi_find_device(dev); + if (acpi_dev == NULL) + return (ENXIO); + + device_set_desc(dev, acpi_dev->desc); + + return (BUS_PROBE_DEFAULT); +} + +static int +sdhci_acpi_attach(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + int rid, err; + const struct sdhci_acpi_device *acpi_dev; + + acpi_dev = sdhci_acpi_find_device(dev); + if (acpi_dev == NULL) + return (ENXIO); + + sc->quirks = acpi_dev->quirks; + + /* Allocate IRQ. */ + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "can't allocate IRQ\n"); + return (ENOMEM); + } + + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "can't allocate memory resource for slot\n"); + sdhci_acpi_detach(dev); + return (ENOMEM); + } + + sc->slot.quirks = sc->quirks; + + err = sdhci_init_slot(dev, &sc->slot, 0); + if (err) { + device_printf(dev, "failed to init slot\n"); + sdhci_acpi_detach(dev); + return (err); + } + + /* Activate the interrupt */ + err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, sdhci_acpi_intr, sc, &sc->intrhand); + if (err) { + device_printf(dev, "can't setup IRQ\n"); + sdhci_acpi_detach(dev); + return (err); + } + + /* Process cards detection. */ + sdhci_start_slot(&sc->slot); + + return (0); +} + +static int +sdhci_acpi_detach(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + if (sc->intrhand) + bus_teardown_intr(dev, sc->irq_res, sc->intrhand); + if (sc->irq_res) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->irq_res), sc->irq_res); + + if (sc->mem_res) { + sdhci_cleanup_slot(&sc->slot); + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem_res), sc->mem_res); + } + + return (0); +} + +static int +sdhci_acpi_shutdown(device_t dev) +{ + + return (0); +} + +static int +sdhci_acpi_suspend(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + int err; + + err = bus_generic_suspend(dev); + if (err) + return (err); + sdhci_generic_suspend(&sc->slot); + return (0); +} + +static int +sdhci_acpi_resume(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + int err; + + sdhci_generic_resume(&sc->slot); + err = bus_generic_resume(dev); + if (err) + return (err); + return (0); +} + +static void +sdhci_acpi_intr(void *arg) +{ + struct sdhci_acpi_softc *sc = (struct sdhci_acpi_softc *)arg; + + sdhci_generic_intr(&sc->slot); +} + +static device_method_t sdhci_methods[] = { + /* device_if */ + DEVMETHOD(device_probe, sdhci_acpi_probe), + DEVMETHOD(device_attach, sdhci_acpi_attach), + DEVMETHOD(device_detach, sdhci_acpi_detach), + DEVMETHOD(device_shutdown, sdhci_acpi_shutdown), + DEVMETHOD(device_suspend, sdhci_acpi_suspend), + DEVMETHOD(device_resume, sdhci_acpi_resume), + + /* Bus interface */ + DEVMETHOD(bus_read_ivar, sdhci_generic_read_ivar), + DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), + + /* mmcbr_if */ + DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), + DEVMETHOD(mmcbr_request, sdhci_generic_request), + DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), + DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), + DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), + + /* SDHCI registers accessors */ + DEVMETHOD(sdhci_read_1, sdhci_acpi_read_1), + DEVMETHOD(sdhci_read_2, sdhci_acpi_read_2), + DEVMETHOD(sdhci_read_4, sdhci_acpi_read_4), + DEVMETHOD(sdhci_read_multi_4, sdhci_acpi_read_multi_4), + DEVMETHOD(sdhci_write_1, sdhci_acpi_write_1), + DEVMETHOD(sdhci_write_2, sdhci_acpi_write_2), + DEVMETHOD(sdhci_write_4, sdhci_acpi_write_4), + DEVMETHOD(sdhci_write_multi_4, sdhci_acpi_write_multi_4), + + DEVMETHOD_END +}; + +static driver_t sdhci_acpi_driver = { + "sdhci_acpi", + sdhci_methods, + sizeof(struct sdhci_acpi_softc), +}; +static devclass_t sdhci_acpi_devclass; + +DRIVER_MODULE(sdhci_acpi, acpi, sdhci_acpi_driver, sdhci_acpi_devclass, NULL, + NULL); +MODULE_DEPEND(sdhci_acpi, sdhci, 1, 1, 1); +DRIVER_MODULE(mmc, sdhci_acpi, mmc_driver, mmc_devclass, NULL, NULL); +MODULE_DEPEND(sdhci_acpi, mmc, 1, 1, 1); Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Mon Jan 23 19:20:55 2017 (r312670) +++ stable/11/sys/modules/Makefile Mon Jan 23 20:51:29 2017 (r312671) @@ -330,6 +330,7 @@ SUBDIR= \ scd \ ${_scsi_low} \ sdhci \ + ${_sdhci_acpi} \ sdhci_pci \ sem \ send \ @@ -662,6 +663,7 @@ _padlock_rng= padlock_rng _rdrand_rng= rdrand_rng .endif _s3= s3 +_sdhci_acpi= sdhci_acpi _tpm= tpm _twa= twa _vesa= vesa Modified: stable/11/sys/modules/sdhci_acpi/Makefile ============================================================================== --- head/sys/modules/sdhci_acpi/Makefile Wed Jan 11 01:53:54 2017 (r311911) +++ stable/11/sys/modules/sdhci_acpi/Makefile Mon Jan 23 20:51:29 2017 (r312671) @@ -3,6 +3,7 @@ .PATH: ${.CURDIR}/../../dev/sdhci KMOD= sdhci_acpi -SRCS= sdhci_acpi.c sdhci.h sdhci_if.h device_if.h bus_if.h pci_if.h mmcbr_if.h +SRCS= sdhci_acpi.c sdhci.h sdhci_if.h +SRCS+= acpi_if.h device_if.h bus_if.h opt_acpi.h pci_if.h mmcbr_if.h .include From owner-svn-src-stable@freebsd.org Tue Jan 24 00:36:47 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D35F0CBD4FF; Tue, 24 Jan 2017 00:36:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADFB8DC; Tue, 24 Jan 2017 00:36:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O0akG6011502; Tue, 24 Jan 2017 00:36:46 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O0akT2011501; Tue, 24 Jan 2017 00:36:46 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201701240036.v0O0akT2011501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 24 Jan 2017 00:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312676 - stable/11/sys/netinet6 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 00:36:47 -0000 Author: ae Date: Tue Jan 24 00:36:46 2017 New Revision: 312676 URL: https://svnweb.freebsd.org/changeset/base/312676 Log: MFC r309888: Modify IPv6 statistic accounting in ip6_input(). Add rcvif local variable to keep inbound interface pointer. Count ifs6_in_discard errors in all "goto bad" cases. Now it will count errors even if mbuf was freed. Modify all places where m->m_pkthdr.rcvif is used to use local rcvif variable. Modified: stable/11/sys/netinet6/ip6_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_input.c ============================================================================== --- stable/11/sys/netinet6/ip6_input.c Mon Jan 23 23:20:00 2017 (r312675) +++ stable/11/sys/netinet6/ip6_input.c Tue Jan 24 00:36:46 2017 (r312676) @@ -549,6 +549,7 @@ ip6_input(struct mbuf *m) struct in6_addr odst; struct ip6_hdr *ip6; struct in6_ifaddr *ia; + struct ifnet *rcvif; u_int32_t plen; u_int32_t rtalert = ~0; int off = sizeof(struct ip6_hdr), nest; @@ -558,7 +559,8 @@ ip6_input(struct mbuf *m) /* * Drop the packet if IPv6 operation is disabled on the interface. */ - if ((ND_IFINFO(m->m_pkthdr.rcvif)->flags & ND6_IFF_IFDISABLED)) + rcvif = m->m_pkthdr.rcvif; + if ((ND_IFINFO(rcvif)->flags & ND6_IFF_IFDISABLED)) goto bad; #ifdef IPSEC @@ -595,16 +597,15 @@ ip6_input(struct mbuf *m) if (m->m_next) { if (m->m_flags & M_LOOP) { 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 if (rcvif->if_index < IP6S_M2MMAX) + IP6STAT_INC(ip6s_m2m[rcvif->if_index]); else IP6STAT_INC(ip6s_m2m[0]); } else IP6STAT_INC(ip6s_m1); } - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); + in6_ifstat_inc(rcvif, ifs6_in_receive); IP6STAT_INC(ip6s_total); #ifndef PULLDOWN_TEST @@ -620,10 +621,8 @@ ip6_input(struct mbuf *m) n = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); else n = m_gethdr(M_NOWAIT, MT_DATA); - if (n == NULL) { - m_freem(m); - return; /* ENOBUFS */ - } + if (n == NULL) + goto bad; m_move_pkthdr(n, m); m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); @@ -635,26 +634,22 @@ ip6_input(struct mbuf *m) #endif if (m->m_len < sizeof(struct ip6_hdr)) { - struct ifnet *inifp; - inifp = m->m_pkthdr.rcvif; if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { IP6STAT_INC(ip6s_toosmall); - in6_ifstat_inc(inifp, ifs6_in_hdrerr); - return; + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); + goto bad; } } ip6 = mtod(m, struct ip6_hdr *); - if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { IP6STAT_INC(ip6s_badvers); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); goto bad; } IP6STAT_INC(ip6s_nxthist[ip6->ip6_nxt]); - - IP_PROBE(receive, NULL, NULL, ip6, m->m_pkthdr.rcvif, NULL, ip6); + IP_PROBE(receive, NULL, NULL, ip6, rcvif, NULL, ip6); /* * Check against address spoofing/corruption. @@ -665,7 +660,7 @@ ip6_input(struct mbuf *m) * XXX: "badscope" is not very suitable for a multicast source. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } if (IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst) && @@ -677,7 +672,7 @@ ip6_input(struct mbuf *m) * as the outgoing/incoming interface. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) && @@ -689,7 +684,7 @@ ip6_input(struct mbuf *m) * a packet is received, it must be silently dropped. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #ifdef ALTQ @@ -713,7 +708,7 @@ ip6_input(struct mbuf *m) if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #if 0 @@ -813,8 +808,8 @@ passin: 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)) { + if (in6_setscope(&ip6->ip6_src, rcvif, NULL) || + in6_setscope(&ip6->ip6_dst, rcvif, NULL)) { IP6STAT_INC(ip6s_badscope); goto bad; } @@ -824,7 +819,7 @@ passin: */ if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { ours = 1; - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast); + in6_ifstat_inc(rcvif, ifs6_in_mcast); goto hbhcheck; } /* @@ -859,7 +854,6 @@ passin: */ if (!V_ip6_forwarding) { IP6STAT_INC(ip6s_cantforward); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } @@ -891,7 +885,7 @@ passin: */ if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { IP6STAT_INC(ip6s_tooshort); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + in6_ifstat_inc(rcvif, ifs6_in_truncated); goto bad; } if (m->m_pkthdr.len > sizeof(struct ip6_hdr) + plen) { @@ -918,10 +912,8 @@ passin: * XXX TODO: Check hlim and multicast scope here to avoid * unnecessarily calling into ip6_mforward(). */ - if (ip6_mforward && - ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { + if (ip6_mforward && ip6_mforward(ip6, rcvif, m)) { IP6STAT_INC(ip6s_cantforward); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } } else if (!ours) { @@ -943,7 +935,7 @@ passin: if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } @@ -951,7 +943,7 @@ passin: * Tell launch routine the next header */ IP6STAT_INC(ip6s_delivered); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_deliver); + in6_ifstat_inc(rcvif, ifs6_in_deliver); nest = 0; while (nxt != IPPROTO_DONE) { @@ -966,7 +958,7 @@ passin: */ if (m->m_pkthdr.len < off) { IP6STAT_INC(ip6s_tooshort); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + in6_ifstat_inc(rcvif, ifs6_in_truncated); goto bad; } @@ -984,7 +976,9 @@ passin: } return; bad: - m_freem(m); + in6_ifstat_inc(rcvif, ifs6_in_discard); + if (m != NULL) + m_freem(m); } /* From owner-svn-src-stable@freebsd.org Tue Jan 24 00:38:36 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AB1DCBD5B8; Tue, 24 Jan 2017 00:38:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A0632A1; Tue, 24 Jan 2017 00:38:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O0cZs6011621; Tue, 24 Jan 2017 00:38:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O0cZtB011620; Tue, 24 Jan 2017 00:38:35 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201701240038.v0O0cZtB011620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 24 Jan 2017 00:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312677 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 00:38:36 -0000 Author: ae Date: Tue Jan 24 00:38:35 2017 New Revision: 312677 URL: https://svnweb.freebsd.org/changeset/base/312677 Log: MFC r312341: Initialize IPFW static rules rmlock with RM_RECURSE flag. This lock was replaced from rwlock in r272840. But unlike rwlock, rmlock doesn't allow recursion on rm_rlock(), so at this time fix this with RM_RECURSE flag. Later we need to change ipfw to avoid such recursions. PR: 216171 Modified: stable/11/sys/netpfil/ipfw/ip_fw_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_private.h Tue Jan 24 00:36:46 2017 (r312676) +++ stable/11/sys/netpfil/ipfw/ip_fw_private.h Tue Jan 24 00:38:35 2017 (r312677) @@ -412,7 +412,7 @@ struct ipfw_ifc { #define IPFW_PF_RUNLOCK(p) IPFW_RUNLOCK(p) #else /* FreeBSD */ #define IPFW_LOCK_INIT(_chain) do { \ - rm_init(&(_chain)->rwmtx, "IPFW static rules"); \ + rm_init_flags(&(_chain)->rwmtx, "IPFW static rules", RM_RECURSE); \ rw_init(&(_chain)->uh_lock, "IPFW UH lock"); \ } while (0) From owner-svn-src-stable@freebsd.org Tue Jan 24 11:13:43 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FDE0CBFE71; Tue, 24 Jan 2017 11:13:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4D132B1; Tue, 24 Jan 2017 11:13:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OBDfUx069371; Tue, 24 Jan 2017 11:13:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OBDfkU069370; Tue, 24 Jan 2017 11:13:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701241113.v0OBDfkU069370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Jan 2017 11:13:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312693 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 11:13:43 -0000 Author: kib Date: Tue Jan 24 11:13:41 2017 New Revision: 312693 URL: https://svnweb.freebsd.org/changeset/base/312693 Log: MFC r311886: Fix acquisition of nested write compat rtld locks. PR: 215826 Modified: stable/11/libexec/rtld-elf/rtld_lock.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/rtld_lock.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld_lock.c Tue Jan 24 10:42:21 2017 (r312692) +++ stable/11/libexec/rtld-elf/rtld_lock.c Tue Jan 24 11:13:41 2017 (r312693) @@ -64,7 +64,7 @@ typedef struct Struct_Lock { } Lock; static sigset_t fullsigmask, oldsigmask; -static int thread_flag; +static int thread_flag, wnested; static void * def_lock_create(void) @@ -117,29 +117,34 @@ def_rlock_acquire(void *lock) static void def_wlock_acquire(void *lock) { - Lock *l = (Lock *)lock; - sigset_t tmp_oldsigmask; + Lock *l; + sigset_t tmp_oldsigmask; - for ( ; ; ) { - sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); - if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) - break; - sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); - } - oldsigmask = tmp_oldsigmask; + l = (Lock *)lock; + for (;;) { + sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); + if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) + break; + sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); + } + if (atomic_fetchadd_int(&wnested, 1) == 0) + oldsigmask = tmp_oldsigmask; } static void def_lock_release(void *lock) { - Lock *l = (Lock *)lock; + Lock *l; - if ((l->lock & WAFLAG) == 0) - atomic_add_rel_int(&l->lock, -RC_INCR); - else { - atomic_add_rel_int(&l->lock, -WAFLAG); - sigprocmask(SIG_SETMASK, &oldsigmask, NULL); - } + l = (Lock *)lock; + if ((l->lock & WAFLAG) == 0) + atomic_add_rel_int(&l->lock, -RC_INCR); + else { + assert(wnested > 0); + atomic_add_rel_int(&l->lock, -WAFLAG); + if (atomic_fetchadd_int(&wnested, -1) == 1) + sigprocmask(SIG_SETMASK, &oldsigmask, NULL); + } } static int @@ -373,12 +378,12 @@ _rtld_atfork_pre(int *locks) return; /* - * Warning: this does not work with the rtld compat locks - * above, since the thread signal mask is corrupted (set to - * all signals blocked) if two locks are taken in write mode. - * The caller of the _rtld_atfork_pre() must provide the - * working implementation of the locks, and libthr locks are - * fine. + * Warning: this did not worked well with the rtld compat + * locks above, when the thread signal mask was corrupted (set + * to all signals blocked) if two locks were taken + * simultaneously in the write mode. The caller of the + * _rtld_atfork_pre() must provide the working implementation + * of the locks anyway, and libthr locks are fine. */ wlock_acquire(rtld_phdr_lock, &ls[0]); wlock_acquire(rtld_bind_lock, &ls[1]); From owner-svn-src-stable@freebsd.org Tue Jan 24 12:15:11 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5ED9CBF9B0; Tue, 24 Jan 2017 12:15:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A54731AC6; Tue, 24 Jan 2017 12:15:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OCFAJW096552; Tue, 24 Jan 2017 12:15:10 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OCFAHM096550; Tue, 24 Jan 2017 12:15:10 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701241215.v0OCFAHM096550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 24 Jan 2017 12:15:10 +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: r312695 - 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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 12:15:11 -0000 Author: avg Date: Tue Jan 24 12:15:10 2017 New Revision: 312695 URL: https://svnweb.freebsd.org/changeset/base/312695 Log: MFC r312426: fix a thread preemption regression in schedulers introduced in r270423 Modified: stable/9/sys/kern/sched_4bsd.c stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sched_4bsd.c ============================================================================== --- stable/9/sys/kern/sched_4bsd.c Tue Jan 24 12:13:41 2017 (r312694) +++ stable/9/sys/kern/sched_4bsd.c Tue Jan 24 12:15:10 2017 (r312695) @@ -985,8 +985,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Tue Jan 24 12:13:41 2017 (r312694) +++ stable/9/sys/kern/sched_ule.c Tue Jan 24 12:15:10 2017 (r312695) @@ -1838,8 +1838,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) From owner-svn-src-stable@freebsd.org Tue Jan 24 16:47:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E47DCC0C03; Tue, 24 Jan 2017 16:47:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D74AE8A; Tue, 24 Jan 2017 16:47:07 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OGl7fc009836; Tue, 24 Jan 2017 16:47:07 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OGl7pr009835; Tue, 24 Jan 2017 16:47:07 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201701241647.v0OGl7pr009835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 24 Jan 2017 16:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312700 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 16:47:08 -0000 Author: bdrewery Date: Tue Jan 24 16:47:06 2017 New Revision: 312700 URL: https://svnweb.freebsd.org/changeset/base/312700 Log: MFC r310025: Take write lock for rtld_bind before modifying obj_list in dl_iterate_phdr(). Modified: stable/10/libexec/rtld-elf/rtld.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld.c Tue Jan 24 16:13:59 2017 (r312699) +++ stable/10/libexec/rtld-elf/rtld.c Tue Jan 24 16:47:06 2017 (r312700) @@ -3470,7 +3470,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac error = 0; wlock_acquire(rtld_phdr_lock, &phdr_lockstate); - rlock_acquire(rtld_bind_lock, &bind_lockstate); + wlock_acquire(rtld_bind_lock, &bind_lockstate); for (obj = globallist_curr(TAILQ_FIRST(&obj_list)); obj != NULL;) { TAILQ_INSERT_AFTER(&obj_list, obj, &marker, next); rtld_fill_dl_phdr_info(obj, &phdr_info); @@ -3478,7 +3478,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac error = callback(&phdr_info, sizeof phdr_info, param); - rlock_acquire(rtld_bind_lock, &bind_lockstate); + wlock_acquire(rtld_bind_lock, &bind_lockstate); obj = globallist_next(&marker); TAILQ_REMOVE(&obj_list, &marker, next); if (error != 0) { From owner-svn-src-stable@freebsd.org Tue Jan 24 17:30:14 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E05A2CC0009; Tue, 24 Jan 2017 17:30:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A29A89D; Tue, 24 Jan 2017 17:30:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OHUDxh026295; Tue, 24 Jan 2017 17:30:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OHUD4u026294; Tue, 24 Jan 2017 17:30:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701241730.v0OHUD4u026294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Jan 2017 17:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312701 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 17:30:15 -0000 Author: kib Date: Tue Jan 24 17:30:13 2017 New Revision: 312701 URL: https://svnweb.freebsd.org/changeset/base/312701 Log: MFC r311886: Fix acquisition of nested write compat rtld locks. PR: 215826 Modified: stable/10/libexec/rtld-elf/rtld_lock.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld_lock.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld_lock.c Tue Jan 24 16:47:06 2017 (r312700) +++ stable/10/libexec/rtld-elf/rtld_lock.c Tue Jan 24 17:30:13 2017 (r312701) @@ -64,7 +64,7 @@ typedef struct Struct_Lock { } Lock; static sigset_t fullsigmask, oldsigmask; -static int thread_flag; +static int thread_flag, wnested; static void * def_lock_create(void) @@ -117,29 +117,34 @@ def_rlock_acquire(void *lock) static void def_wlock_acquire(void *lock) { - Lock *l = (Lock *)lock; - sigset_t tmp_oldsigmask; + Lock *l; + sigset_t tmp_oldsigmask; - for ( ; ; ) { - sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); - if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) - break; - sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); - } - oldsigmask = tmp_oldsigmask; + l = (Lock *)lock; + for (;;) { + sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); + if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) + break; + sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); + } + if (atomic_fetchadd_int(&wnested, 1) == 0) + oldsigmask = tmp_oldsigmask; } static void def_lock_release(void *lock) { - Lock *l = (Lock *)lock; + Lock *l; - if ((l->lock & WAFLAG) == 0) - atomic_add_rel_int(&l->lock, -RC_INCR); - else { - atomic_add_rel_int(&l->lock, -WAFLAG); - sigprocmask(SIG_SETMASK, &oldsigmask, NULL); - } + l = (Lock *)lock; + if ((l->lock & WAFLAG) == 0) + atomic_add_rel_int(&l->lock, -RC_INCR); + else { + assert(wnested > 0); + atomic_add_rel_int(&l->lock, -WAFLAG); + if (atomic_fetchadd_int(&wnested, -1) == 1) + sigprocmask(SIG_SETMASK, &oldsigmask, NULL); + } } static int @@ -373,12 +378,12 @@ _rtld_atfork_pre(int *locks) return; /* - * Warning: this does not work with the rtld compat locks - * above, since the thread signal mask is corrupted (set to - * all signals blocked) if two locks are taken in write mode. - * The caller of the _rtld_atfork_pre() must provide the - * working implementation of the locks, and libthr locks are - * fine. + * Warning: this did not worked well with the rtld compat + * locks above, when the thread signal mask was corrupted (set + * to all signals blocked) if two locks were taken + * simultaneously in the write mode. The caller of the + * _rtld_atfork_pre() must provide the working implementation + * of the locks anyway, and libthr locks are fine. */ wlock_acquire(rtld_phdr_lock, &ls[0]); wlock_acquire(rtld_bind_lock, &ls[1]); From owner-svn-src-stable@freebsd.org Tue Jan 24 18:44:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA51BCC0B33; Tue, 24 Jan 2017 18:44:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 93CEC1B3; Tue, 24 Jan 2017 18:44:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id AA3D05649D; Tue, 24 Jan 2017 12:44:26 -0600 (CST) Subject: Re: svn commit: r312666 - stable/10/sys/kern To: Andriy Gapon , Bruce Evans References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> <20170124002712.Q903@besplex.bde.org> <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Eric van Gyzen Message-ID: <0f2c3b59-54d3-a83a-29ba-4fcda2db25f2@FreeBSD.org> Date: Tue, 24 Jan 2017 12:44:25 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 18:44:27 -0000 On 01/23/2017 12:12, Eric van Gyzen wrote: > On 01/23/2017 10:03, Andriy Gapon wrote: >> On 23/01/2017 15:34, Bruce Evans wrote: >>> What is a good benchmark for showing that the fix helps? >> >> Honestly, I do not know. We ran into a pathology where a thread was not getting >> scheduled for a long time after being preempted while in a critical section (so >> the actual preemption was a voluntary switch when exiting the critical section). >> I am not sure what kind of a synthetic benchmark or a test case would readily >> demonstrate the problem. > > I submitted r270423, which introduced the bug Andriy just fixed. I'm > already setting up the performance test that I used for that change. > It's a macro-benchmark of a commercial product, so I can't elaborate on > details, but at least I can give a thumb indication in the style of a > Roman Dictator. My performance tests showed no change, so although r312666 does not improve performance under my workload, it also does not hurt. Specifically, it does not reintroduce the regression introduced in r239157 that I poorly fixed in r270423. Thanks again for the fix, Andriy. Eric From owner-svn-src-stable@freebsd.org Tue Jan 24 19:38:11 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 968BFCC049C; Tue, 24 Jan 2017 19:38:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65856ABA; Tue, 24 Jan 2017 19:38:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJcAWP081550; Tue, 24 Jan 2017 19:38:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJcAtl081549; Tue, 24 Jan 2017 19:38:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241938.v0OJcAtl081549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312713 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:38:11 -0000 Author: mjg Date: Tue Jan 24 19:38:10 2017 New Revision: 312713 URL: https://svnweb.freebsd.org/changeset/base/312713 Log: MFC r310907: Use vrefact in vnode_pager_alloc. Modified: stable/11/sys/vm/vnode_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Tue Jan 24 19:18:27 2017 (r312712) +++ stable/11/sys/vm/vnode_pager.c Tue Jan 24 19:38:10 2017 (r312713) @@ -265,7 +265,7 @@ retry: #endif VM_OBJECT_WUNLOCK(object); } - vref(vp); + vrefact(vp); return (object); } From owner-svn-src-stable@freebsd.org Tue Jan 24 19:39:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F6D8CC0534; Tue, 24 Jan 2017 19:39:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15F25D04; Tue, 24 Jan 2017 19:39:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJdP9S081650; Tue, 24 Jan 2017 19:39:25 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJdOmP081646; Tue, 24 Jan 2017 19:39:24 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241939.v0OJdOmP081646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:39:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312714 - in stable/11/sys: kern sys vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:39:26 -0000 Author: mjg Date: Tue Jan 24 19:39:24 2017 New Revision: 312714 URL: https://svnweb.freebsd.org/changeset/base/312714 Log: MFC r310805: Remove cpu_spinwait after seq_consistent. It does not add any benefit as the read routine will do it as necessary. Modified: stable/11/sys/kern/kern_descrip.c stable/11/sys/sys/seq.h stable/11/sys/vm/vm_domain.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_descrip.c ============================================================================== --- stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:38:10 2017 (r312713) +++ stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:39:24 2017 (r312714) @@ -2477,10 +2477,8 @@ fget_unlocked(struct filedesc *fdp, int fde = &fdt->fdt_ofiles[fd]; haverights = *cap_rights_fde(fde); fp = fde->fde_file; - if (!seq_consistent(fd_seq(fdt, fd), seq)) { - cpu_spinwait(); + if (!seq_consistent(fd_seq(fdt, fd), seq)) continue; - } #else fp = fdt->fdt_ofiles[fd].fde_file; #endif Modified: stable/11/sys/sys/seq.h ============================================================================== --- stable/11/sys/sys/seq.h Tue Jan 24 19:38:10 2017 (r312713) +++ stable/11/sys/sys/seq.h Tue Jan 24 19:39:24 2017 (r312714) @@ -59,7 +59,6 @@ typedef uint32_t seq_t; * lobj = gobj; * if (seq_consistent(&gobj->seq, seq)) * break; - * cpu_spinwait(); * } * foo(lobj); */ Modified: stable/11/sys/vm/vm_domain.c ============================================================================== --- stable/11/sys/vm/vm_domain.c Tue Jan 24 19:38:10 2017 (r312713) +++ stable/11/sys/vm/vm_domain.c Tue Jan 24 19:39:24 2017 (r312714) @@ -140,7 +140,6 @@ vm_domain_policy_localcopy(struct vm_dom *dst = *src; if (seq_consistent(&src->seq, seq)) return; - cpu_spinwait(); } } @@ -168,7 +167,6 @@ vm_domain_policy_copy(struct vm_domain_p seq_write_end(&dst->seq); return; } - cpu_spinwait(); } } @@ -330,7 +328,6 @@ vm_domain_iterator_set_policy(struct vm_ _vm_domain_iterator_set_policy(vi, &vt_lcl); return; } - cpu_spinwait(); } } From owner-svn-src-stable@freebsd.org Tue Jan 24 19:40:36 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6571CCC05B5; Tue, 24 Jan 2017 19:40:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 400A9E99; Tue, 24 Jan 2017 19:40:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJeZ2R081772; Tue, 24 Jan 2017 19:40:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJeZnS081771; Tue, 24 Jan 2017 19:40:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241940.v0OJeZnS081771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312715 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:40:36 -0000 Author: mjg Date: Tue Jan 24 19:40:35 2017 New Revision: 312715 URL: https://svnweb.freebsd.org/changeset/base/312715 Log: MFC r310983: vfs: switch nodes_created, recycles_count and free_owe_inact to counter(9) Modified: stable/11/sys/kern/vfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_subr.c ============================================================================== --- stable/11/sys/kern/vfs_subr.c Tue Jan 24 19:39:24 2017 (r312714) +++ stable/11/sys/kern/vfs_subr.c Tue Jan 24 19:40:35 2017 (r312715) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -123,9 +124,9 @@ static unsigned long numvnodes; SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0, "Number of vnodes in existence"); -static u_long vnodes_created; -SYSCTL_ULONG(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created, - 0, "Number of vnodes created by getnewvnode"); +static counter_u64_t vnodes_created; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created, + "Number of vnodes created by getnewvnode"); /* * Conversion tables for conversion from vnode types to inode formats @@ -175,8 +176,8 @@ static u_long freevnodes; SYSCTL_ULONG(_vfs, OID_AUTO, freevnodes, CTLFLAG_RD, &freevnodes, 0, "Number of \"free\" vnodes"); -static u_long recycles_count; -SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0, +static counter_u64_t recycles_count; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, "Number of vnodes recycled to meet vnode cache targets"); /* @@ -188,8 +189,8 @@ static int reassignbufcalls; SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW, &reassignbufcalls, 0, "Number of calls to reassignbuf"); -static u_long free_owe_inact; -SYSCTL_ULONG(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, 0, +static counter_u64_t free_owe_inact; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, "Number of times free vnodes kept on active list due to VFS " "owing inactivation"); @@ -472,6 +473,11 @@ vntblinit(void *dummy __unused) NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE | UMA_ZONE_VM); uma_prealloc(buf_trie_zone, nbuf); + + vnodes_created = counter_u64_alloc(M_WAITOK); + recycles_count = counter_u64_alloc(M_WAITOK); + free_owe_inact = counter_u64_alloc(M_WAITOK); + /* * Initialize the filesystem syncer. */ @@ -918,7 +924,7 @@ vlrureclaim(struct mount *mp, int reclai } KASSERT((vp->v_iflag & VI_DOOMED) == 0, ("VI_DOOMED unexpectedly detected in vlrureclaim()")); - atomic_add_long(&recycles_count, 1); + counter_u64_add(recycles_count, 1); vgonel(vp); VOP_UNLOCK(vp, 0); vdropl(vp); @@ -1217,7 +1223,7 @@ vtryrecycle(struct vnode *vp) return (EBUSY); } if ((vp->v_iflag & VI_DOOMED) == 0) { - atomic_add_long(&recycles_count, 1); + counter_u64_add(recycles_count, 1); vgonel(vp); } VOP_UNLOCK(vp, LK_INTERLOCK); @@ -1376,7 +1382,7 @@ getnewvnode(const char *tag, struct moun atomic_add_long(&numvnodes, 1); mtx_unlock(&vnode_free_list_mtx); alloc: - atomic_add_long(&vnodes_created, 1); + counter_u64_add(vnodes_created, 1); vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK); /* * Locks are given the generic name "vnode" when created. @@ -2855,7 +2861,7 @@ _vdrop(struct vnode *vp, bool locked) vp->v_iflag |= VI_FREE; mtx_unlock(&vnode_free_list_mtx); } else { - atomic_add_long(&free_owe_inact, 1); + counter_u64_add(free_owe_inact, 1); } VI_UNLOCK(vp); return; From owner-svn-src-stable@freebsd.org Tue Jan 24 19:41:57 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EA67CC064E; Tue, 24 Jan 2017 19:41:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D90711F5; Tue, 24 Jan 2017 19:41:56 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJfulP084824; Tue, 24 Jan 2017 19:41:56 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJfuZ4084823; Tue, 24 Jan 2017 19:41:56 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241941.v0OJfuZ4084823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312716 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:41:57 -0000 Author: mjg Date: Tue Jan 24 19:41:55 2017 New Revision: 312716 URL: https://svnweb.freebsd.org/changeset/base/312716 Log: MFC r311004: fd: access openfiles once in falloc_noinstall This is similar to what's done with nprocs. Note this is only a band aid. Modified: stable/11/sys/kern/kern_descrip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_descrip.c ============================================================================== --- stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:40:35 2017 (r312715) +++ stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:41:55 2017 (r312716) @@ -1751,21 +1751,23 @@ falloc_noinstall(struct thread *td, stru { struct file *fp; int maxuserfiles = maxfiles - (maxfiles / 20); + int openfiles_new; static struct timeval lastfail; static int curfail; KASSERT(resultfp != NULL, ("%s: resultfp == NULL", __func__)); - if ((openfiles >= maxuserfiles && + openfiles_new = atomic_fetchadd_int(&openfiles, 1) + 1; + if ((openfiles_new >= maxuserfiles && priv_check(td, PRIV_MAXFILES) != 0) || - openfiles >= maxfiles) { + openfiles_new >= maxfiles) { + atomic_subtract_int(&openfiles, 1); if (ppsratecheck(&lastfail, &curfail, 1)) { printf("kern.maxfiles limit exceeded by uid %i, (%s) " "please see tuning(7).\n", td->td_ucred->cr_ruid, td->td_proc->p_comm); } return (ENFILE); } - atomic_add_int(&openfiles, 1); fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); refcount_init(&fp->f_count, 1); fp->f_cred = crhold(td->td_ucred); From owner-svn-src-stable@freebsd.org Tue Jan 24 19:45:34 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96470CC0836; Tue, 24 Jan 2017 19:45:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70F141660; Tue, 24 Jan 2017 19:45:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJjXZ9086095; Tue, 24 Jan 2017 19:45:33 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJjXM6086094; Tue, 24 Jan 2017 19:45:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241945.v0OJjXM6086094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312718 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:45:34 -0000 Author: mjg Date: Tue Jan 24 19:45:33 2017 New Revision: 312718 URL: https://svnweb.freebsd.org/changeset/base/312718 Log: MFC r310766,r310767,r310774,r310779: cache: drop the NULL check from VP2VNODELOCK Now that negative entries are annotated with a dedicated flag, NULL vnodes are no longer passed. == cache: depessimize hashing macros/inlines All hash sizes are power-of-2, but the compiler does not know that for sure and 'foo % size' forces doing a division. Store the size - 1 and use 'foo & hash' instead which allows mere shift. == cache: move shrink lock init to nchinit This gets rid of unnecesary sysinit usage. While here also rename the lock to be consistent with the rest. == cache: sprinkle __predict_false Modified: stable/11/sys/kern/vfs_cache.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_cache.c ============================================================================== --- stable/11/sys/kern/vfs_cache.c Tue Jan 24 19:42:24 2017 (r312717) +++ stable/11/sys/kern/vfs_cache.c Tue Jan 24 19:45:33 2017 (r312718) @@ -229,8 +229,6 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncneghitsreq struct nchstats nchstats; /* cache effectiveness statistics */ static struct mtx ncneg_shrink_lock; -MTX_SYSINIT(vfscache_shrink_neg, &ncneg_shrink_lock, "Name Cache shrink neg", - MTX_DEF); struct neglist { struct mtx nl_lock; @@ -242,30 +240,29 @@ static struct neglist ncneg_hot; static int shrink_list_turn; -static u_int numneglists; +#define numneglists (ncneghash + 1) +static u_int ncneghash; static inline struct neglist * NCP2NEGLIST(struct namecache *ncp) { - return (&neglists[(((uintptr_t)(ncp) >> 8) % numneglists)]); + return (&neglists[(((uintptr_t)(ncp) >> 8) & ncneghash)]); } -static u_int numbucketlocks; +#define numbucketlocks (ncbuckethash + 1) +static u_int ncbuckethash; static struct rwlock_padalign *bucketlocks; #define HASH2BUCKETLOCK(hash) \ - ((struct rwlock *)(&bucketlocks[((hash) % numbucketlocks)])) + ((struct rwlock *)(&bucketlocks[((hash) & ncbuckethash)])) -static u_int numvnodelocks; +#define numvnodelocks (ncvnodehash + 1) +static u_int ncvnodehash; static struct mtx *vnodelocks; static inline struct mtx * VP2VNODELOCK(struct vnode *vp) { - struct mtx *vlp; - if (vp == NULL) - return (NULL); - vlp = &vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]; - return (vlp); + return (&vnodelocks[(((uintptr_t)(vp) >> 8) & ncvnodehash)]); } /* @@ -1107,7 +1104,7 @@ cache_lookup(struct vnode *dvp, struct v uint32_t hash; int error, ltype; - if (!doingcache) { + if (__predict_false(!doingcache)) { cnp->cn_flags &= ~MAKEENTRY; return (0); } @@ -1374,8 +1371,8 @@ cache_lock_vnodes_cel_3(struct celocksta cache_assert_vlp_locked(cel->vlp[1]); MPASS(cel->vlp[2] == NULL); + MPASS(vp != NULL); vlp = VP2VNODELOCK(vp); - MPASS(vlp != NULL); ret = true; if (vlp >= cel->vlp[1]) { @@ -1547,13 +1544,13 @@ cache_enter_time(struct vnode *dvp, stru VNASSERT(dvp == NULL || (dvp->v_iflag & VI_DOOMED) == 0, dvp, ("cache_enter: Doomed vnode used as src")); - if (!doingcache) + if (__predict_false(!doingcache)) return; /* * Avoid blowout in namecache entries. */ - if (numcache >= desiredvnodes * ncsizefactor) + if (__predict_false(numcache >= desiredvnodes * ncsizefactor)) return; cache_celockstate_init(&cel); @@ -1779,21 +1776,21 @@ nchinit(void *dummy __unused) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); - numbucketlocks = cache_roundup_2(mp_ncpus * 64); - if (numbucketlocks > nchash + 1) - numbucketlocks = nchash + 1; + ncbuckethash = cache_roundup_2(mp_ncpus * 64) - 1; + if (ncbuckethash > nchash) + ncbuckethash = nchash; bucketlocks = malloc(sizeof(*bucketlocks) * numbucketlocks, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numbucketlocks; i++) rw_init_flags(&bucketlocks[i], "ncbuc", RW_DUPOK | RW_RECURSE); - numvnodelocks = cache_roundup_2(mp_ncpus * 64); + ncvnodehash = cache_roundup_2(mp_ncpus * 64) - 1; vnodelocks = malloc(sizeof(*vnodelocks) * numvnodelocks, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numvnodelocks; i++) mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE); ncpurgeminvnodes = numbucketlocks; - numneglists = 4; + ncneghash = 3; neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numneglists; i++) { @@ -1803,6 +1800,8 @@ nchinit(void *dummy __unused) mtx_init(&ncneg_hot.nl_lock, "ncneglh", NULL, MTX_DEF); TAILQ_INIT(&ncneg_hot.nl_list); + mtx_init(&ncneg_shrink_lock, "ncnegs", NULL, MTX_DEF); + numcalls = counter_u64_alloc(M_WAITOK); dothits = counter_u64_alloc(M_WAITOK); dotdothits = counter_u64_alloc(M_WAITOK); @@ -2055,9 +2054,9 @@ kern___getcwd(struct thread *td, char *b struct vnode *cdir, *rdir; int error; - if (disablecwd) + if (__predict_false(disablecwd)) return (ENODEV); - if (buflen < 2) + if (__predict_false(buflen < 2)) return (EINVAL); if (buflen > path_max) buflen = path_max; @@ -2108,9 +2107,9 @@ vn_fullpath(struct thread *td, struct vn struct vnode *rdir; int error; - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); - if (vn == NULL) + if (__predict_false(vn == NULL)) return (EINVAL); buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); @@ -2142,9 +2141,9 @@ vn_fullpath_global(struct thread *td, st char *buf; int error; - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); - if (vn == NULL) + if (__predict_false(vn == NULL)) return (EINVAL); buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); error = vn_fullpath1(td, vn, rootvnode, buf, retbuf, MAXPATHLEN); @@ -2408,7 +2407,7 @@ vn_path_to_global_path(struct thread *td ASSERT_VOP_ELOCKED(vp, __func__); /* Return ENODEV if sysctl debug.disablefullpath==1 */ - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); /* Construct global filesystem path from vp. */ From owner-svn-src-stable@freebsd.org Tue Jan 24 21:07:45 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A20ACBD3DA; Tue, 24 Jan 2017 21:07:45 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 088B2334; Tue, 24 Jan 2017 21:07:45 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id E577A3D; Tue, 24 Jan 2017 22:07:42 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id D708328494; Tue, 24 Jan 2017 22:07:42 +0100 (CET) Date: Tue, 24 Jan 2017 22:07:42 +0100 From: Jilles Tjoelker To: "Rodney W. Grimes" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r312653 - stable/11/share/skel Message-ID: <20170124210742.GA83102@stack.nl> References: <201701222131.v0MLVWjg037264@repo.freebsd.org> <201701222330.v0MNUJMp000255@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201701222330.v0MNUJMp000255@pdx.rh.CN85.dnsmgr.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 21:07:45 -0000 On Sun, Jan 22, 2017 at 03:30:19PM -0800, Rodney W. Grimes wrote: > > -# Enable the builtin emacs(1) command line editor in sh(1), > > -# e.g. C-a -> beginning-of-line. > > -set -o emacs > > - > > # Uncomment this and comment the above to enable the builtin vi(1) command > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > documentation error.... please correct that too. Fixed, thanks. -- Jilles Tjoelker From owner-svn-src-stable@freebsd.org Wed Jan 25 00:44:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6A86CBEF92; Wed, 25 Jan 2017 00:44:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7751B816; Wed, 25 Jan 2017 00:44:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P0iLDK012609; Wed, 25 Jan 2017 00:44:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P0iLaS012608; Wed, 25 Jan 2017 00:44:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701250044.v0P0iLaS012608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 00:44:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312729 - stable/11/contrib/elftoolchain/libelftc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 00:44:22 -0000 Author: emaste Date: Wed Jan 25 00:44:21 2017 New Revision: 312729 URL: https://svnweb.freebsd.org/changeset/base/312729 Log: readelf: add PPC64 relocation types MFC of r311941, r311942 Modified: stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Wed Jan 25 00:23:38 2017 (r312728) +++ stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Wed Jan 25 00:44:21 2017 (r312729) @@ -501,6 +501,120 @@ elftc_reloc_type_str(unsigned int mach, case 116: return "R_PPC_EMB_RELSDA"; } break; + case EM_PPC64: + switch(type) { + case 0: return "R_PPC64_NONE"; + case 1: return "R_PPC64_ADDR32"; + case 2: return "R_PPC64_ADDR24"; + case 3: return "R_PPC64_ADDR16"; + case 4: return "R_PPC64_ADDR16_LO"; + case 5: return "R_PPC64_ADDR16_HI"; + case 6: return "R_PPC64_ADDR16_HA"; + case 7: return "R_PPC64_ADDR14"; + case 8: return "R_PPC64_ADDR14_BRTAKEN"; + case 9: return "R_PPC64_ADDR14_BRNTAKEN"; + case 10: return "R_PPC64_REL24"; + case 11: return "R_PPC64_REL14"; + case 12: return "R_PPC64_REL14_BRTAKEN"; + case 13: return "R_PPC64_REL14_BRNTAKEN"; + case 14: return "R_PPC64_GOT16"; + case 15: return "R_PPC64_GOT16_LO"; + case 16: return "R_PPC64_GOT16_HI"; + case 17: return "R_PPC64_GOT16_HA"; + case 19: return "R_PPC64_COPY"; + case 20: return "R_PPC64_GLOB_DAT"; + case 21: return "R_PPC64_JMP_SLOT"; + case 22: return "R_PPC64_RELATIVE"; + case 24: return "R_PPC64_UADDR32"; + case 25: return "R_PPC64_UADDR16"; + case 26: return "R_PPC64_REL32"; + case 27: return "R_PPC64_PLT32"; + case 28: return "R_PPC64_PLTREL32"; + case 29: return "R_PPC64_PLT16_LO"; + case 30: return "R_PPC64_PLT16_HI"; + case 31: return "R_PPC64_PLT16_HA"; + case 33: return "R_PPC64_SECTOFF"; + case 34: return "R_PPC64_SECTOFF_LO"; + case 35: return "R_PPC64_SECTOFF_HI"; + case 36: return "R_PPC64_SECTOFF_HA"; + case 37: return "R_PPC64_ADDR30"; + case 38: return "R_PPC64_ADDR64"; + case 39: return "R_PPC64_ADDR16_HIGHER"; + case 40: return "R_PPC64_ADDR16_HIGHERA"; + case 41: return "R_PPC64_ADDR16_HIGHEST"; + case 42: return "R_PPC64_ADDR16_HIGHESTA"; + case 43: return "R_PPC64_UADDR64"; + case 44: return "R_PPC64_REL64"; + case 45: return "R_PPC64_PLT64"; + case 46: return "R_PPC64_PLTREL64"; + case 47: return "R_PPC64_TOC16"; + case 48: return "R_PPC64_TOC16_LO"; + case 49: return "R_PPC64_TOC16_HI"; + case 50: return "R_PPC64_TOC16_HA"; + case 51: return "R_PPC64_TOC"; + case 52: return "R_PPC64_PLTGOT16"; + case 53: return "R_PPC64_PLTGOT16_LO"; + case 54: return "R_PPC64_PLTGOT16_HI"; + case 55: return "R_PPC64_PLTGOT16_HA"; + case 56: return "R_PPC64_ADDR16_DS"; + case 57: return "R_PPC64_ADDR16_LO_DS"; + case 58: return "R_PPC64_GOT16_DS"; + case 59: return "R_PPC64_GOT16_LO_DS"; + case 60: return "R_PPC64_PLT16_LO_DS"; + case 61: return "R_PPC64_SECTOFF_DS"; + case 62: return "R_PPC64_SECTOFF_LO_DS"; + case 63: return "R_PPC64_TOC16_DS"; + case 64: return "R_PPC64_TOC16_LO_DS"; + case 65: return "R_PPC64_PLTGOT16_DS"; + case 66: return "R_PPC64_PLTGOT16_LO_DS"; + case 67: return "R_PPC64_TLS"; + case 68: return "R_PPC64_DTPMOD64"; + case 69: return "R_PPC64_TPREL16"; + case 70: return "R_PPC64_TPREL16_LO"; + case 71: return "R_PPC64_TPREL16_HI"; + case 72: return "R_PPC64_TPREL16_HA"; + case 73: return "R_PPC64_TPREL64"; + case 74: return "R_PPC64_DTPREL16"; + case 75: return "R_PPC64_DTPREL16_LO"; + case 76: return "R_PPC64_DTPREL16_HI"; + case 77: return "R_PPC64_DTPREL16_HA"; + case 78: return "R_PPC64_DTPREL64"; + case 79: return "R_PPC64_GOT_TLSGD16"; + case 80: return "R_PPC64_GOT_TLSGD16_LO"; + case 81: return "R_PPC64_GOT_TLSGD16_HI"; + case 82: return "R_PPC64_GOT_TLSGD16_HA"; + case 83: return "R_PPC64_GOT_TLSLD16"; + case 84: return "R_PPC64_GOT_TLSLD16_LO"; + case 85: return "R_PPC64_GOT_TLSLD16_HI"; + case 86: return "R_PPC64_GOT_TLSLD16_HA"; + case 87: return "R_PPC64_GOT_TPREL16_DS"; + case 88: return "R_PPC64_GOT_TPREL16_LO_DS"; + case 89: return "R_PPC64_GOT_TPREL16_HI"; + case 90: return "R_PPC64_GOT_TPREL16_HA"; + case 91: return "R_PPC64_GOT_DTPREL16_DS"; + case 92: return "R_PPC64_GOT_DTPREL16_LO_DS"; + case 93: return "R_PPC64_GOT_DTPREL16_HI"; + case 94: return "R_PPC64_GOT_DTPREL16_HA"; + case 95: return "R_PPC64_TPREL16_DS"; + case 96: return "R_PPC64_TPREL16_LO_DS"; + case 97: return "R_PPC64_TPREL16_HIGHER"; + case 98: return "R_PPC64_TPREL16_HIGHERA"; + case 99: return "R_PPC64_TPREL16_HIGHEST"; + case 100: return "R_PPC64_TPREL16_HIGHESTA"; + case 101: return "R_PPC64_DTPREL16_DS"; + case 102: return "R_PPC64_DTPREL16_LO_DS"; + case 103: return "R_PPC64_DTPREL16_HIGHER"; + case 104: return "R_PPC64_DTPREL16_HIGHERA"; + case 105: return "R_PPC64_DTPREL16_HIGHEST"; + case 106: return "R_PPC64_DTPREL16_HIGHESTA"; + case 107: return "R_PPC64_TLSGD"; + case 108: return "R_PPC64_TLSLD"; + case 249: return "R_PPC64_REL16"; + case 250: return "R_PPC64_REL16_LO"; + case 251: return "R_PPC64_REL16_HI"; + case 252: return "R_PPC64_REL16_HA"; + } + break; case EM_RISCV: switch(type) { case 0: return "R_RISCV_NONE"; From owner-svn-src-stable@freebsd.org Wed Jan 25 01:04:53 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E379CC0548; Wed, 25 Jan 2017 01:04:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 200E811F; Wed, 25 Jan 2017 01:04:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P14q9b020556; Wed, 25 Jan 2017 01:04:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P14pCu020550; Wed, 25 Jan 2017 01:04:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701250104.v0P14pCu020550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 01:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312730 - in stable/11: share/mk sys/boot/common sys/conf tools/build/options X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 01:04:53 -0000 Author: emaste Date: Wed Jan 25 01:04:51 2017 New Revision: 312730 URL: https://svnweb.freebsd.org/changeset/base/312730 Log: Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob MFC r310128: Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob to disable kernel metadata The kernel builds reproducibly, except for the time, date, user, and hostname baked into the kernel (reported at startup and via the kern.version sysctl for uname). Add a build knob to disable the inclusion of this metadata. MFC r310268: Build loaders reproducibly when WITH_REPRODUCIBLE_BUILD When WITH_REPRODUCIBLE_BUILD=yes is set in src.conf(5), eliminate the time, user, and host from the loader's version information. This allows builds to produce bit-for-bit identical output. Added: stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD - copied, changed from r310128, head/tools/build/options/WITH_REPRODUCIBLE_BUILD Modified: stable/11/share/mk/src.opts.mk stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/common/newvers.sh stable/11/sys/conf/kern.opts.mk stable/11/sys/conf/kern.post.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/share/mk/src.opts.mk Wed Jan 25 01:04:51 2017 (r312730) @@ -187,6 +187,7 @@ __DEFAULT_NO_OPTIONS = \ NAND \ OFED \ OPENLDAP \ + REPRODUCIBLE_BUILD \ SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/boot/common/Makefile.inc Wed Jan 25 01:04:51 2017 (r312730) @@ -73,5 +73,9 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/lib CLEANFILES+= vers.c VERSION_FILE?= ${.CURDIR}/version +.if ${MK_REPRODUCIBLE_BUILD} != no +REPRO_FLAG= -r +.endif vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} - sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT} + sh ${SRCTOP}/sys/boot/common/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ + ${NEWVERSWHAT} Modified: stable/11/sys/boot/common/newvers.sh ============================================================================== --- stable/11/sys/boot/common/newvers.sh Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/boot/common/newvers.sh Wed Jan 25 01:04:51 2017 (r312730) @@ -35,11 +35,26 @@ tempfile=$(mktemp tmp.XXXXXX) || exit trap "rm -f $tempfile" EXIT INT TERM +include_metadata=true +while getopts r opt; do + case "$opt" in + r) + include_metadata= + ;; + esac +done +shift $((OPTIND - 1)) + LC_ALL=C; export LC_ALL u=${USER-root} h=${HOSTNAME-`hostname`} t=`date` #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` -echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} ${u}@${h})\\n\";" > $tempfile +bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n" +if [ -n "${include_metadata}" ]; then + bootprog_info="$bootprog_info(${t} ${u}@${h})\\n" +fi + +echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile mv $tempfile vers.c Modified: stable/11/sys/conf/kern.opts.mk ============================================================================== --- stable/11/sys/conf/kern.opts.mk Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/conf/kern.opts.mk Wed Jan 25 01:04:51 2017 (r312730) @@ -47,7 +47,8 @@ __DEFAULT_NO_OPTIONS = \ EISA \ EXTRA_TCP_STACKS \ NAND \ - OFED + OFED \ + REPRODUCIBLE_BUILD # Some options are totally broken on some architectures. We disable # them. If you need to enable them on an experimental basis, you Modified: stable/11/sys/conf/kern.post.mk ============================================================================== --- stable/11/sys/conf/kern.post.mk Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/conf/kern.post.mk Wed Jan 25 01:04:51 2017 (r312730) @@ -357,8 +357,11 @@ config.o env.o hints.o vers.o vnode_if.o config.ln env.ln hints.ln vers.ln vnode_if.ln: ${NORMAL_LINT} +.if ${MK_REPRODUCIBLE_BUILD} != "no" +REPRO_FLAG="-r" +.endif vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} - MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT} + MAKE=${MAKE} sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c Copied and modified: stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD (from r310128, head/tools/build/options/WITH_REPRODUCIBLE_BUILD) ============================================================================== --- head/tools/build/options/WITH_REPRODUCIBLE_BUILD Thu Dec 15 21:26:58 2016 (r310128, copy source) +++ stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD Wed Jan 25 01:04:51 2017 (r312730) @@ -1,3 +1,4 @@ $FreeBSD$ -Set to exclude build metadata (build time, user, host and path) from the -kernel and uname output. +Set to exclude build metadata (such as the build time, user, or host) +from the kernel, boot loaders, and uname output, so that builds produce +bit-for-bit identical output. From owner-svn-src-stable@freebsd.org Wed Jan 25 01:16:11 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99DDFCC0A41; Wed, 25 Jan 2017 01:16:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5054A938; Wed, 25 Jan 2017 01:16:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P1GArX024797; Wed, 25 Jan 2017 01:16:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P1GATb024796; Wed, 25 Jan 2017 01:16:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701250116.v0P1GATb024796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 01:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312731 - stable/11/share/man/man5 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 01:16:11 -0000 Author: emaste Date: Wed Jan 25 01:16:10 2017 New Revision: 312731 URL: https://svnweb.freebsd.org/changeset/base/312731 Log: Regen src.conf.5 after r312730 WITH_REPRODUCIBLE_BUILD Also pick up r312019 Modified: stable/11/share/man/man5/src.conf.5 Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Wed Jan 25 01:04:51 2017 (r312730) +++ stable/11/share/man/man5/src.conf.5 Wed Jan 25 01:16:10 2017 (r312731) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: stable/11/tools/build/options/makeman 292283 2015-12-15 18:42:30Z bdrewery .\" $FreeBSD$ -.Dd January 6, 2017 +.Dd January 25, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1352,6 +1352,11 @@ Set to not build .Xr rcs 1 , .Xr etcupdate 8 , and related utilities. +.It Va WITH_REPRODUCIBLE_BUILD +from FreeBSD: stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD 312730 2017-01-25 01:04:51Z emaste +Set to exclude build metadata (such as the build time, user, or host) +from the kernel, boot loaders, and uname output, so that builds produce +bit-for-bit identical output. .It Va WITHOUT_RESCUE .\" from FreeBSD: stable/11/tools/build/options/WITHOUT_RESCUE 156932 2006-03-21 07:50:50Z ru Set to not build @@ -1580,8 +1585,8 @@ and related programs. .\" from FreeBSD: stable/11/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru Set to not build USB-related programs and libraries. .It Va WITHOUT_USB_GADGET_EXAMPLES -.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_USB_GADGET_EXAMPLES 274665 2014-11-18 17:06:50Z imp -Set to build USB gadget kernel modules. +.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_USB_GADGET_EXAMPLES 312019 2017-01-13 08:15:32Z ngie +Set to not build USB gadget kernel modules. .It Va WITHOUT_UTMPX .\" from FreeBSD: stable/11/tools/build/options/WITHOUT_UTMPX 231530 2012-02-11 20:28:42Z ed Set to not build user accounting tools such as From owner-svn-src-stable@freebsd.org Wed Jan 25 07:51:21 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 327D7CC0AE6; Wed, 25 Jan 2017 07:51:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEEC9A1F; Wed, 25 Jan 2017 07:51:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P7pKM4083810; Wed, 25 Jan 2017 07:51:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P7pKA3083809; Wed, 25 Jan 2017 07:51:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701250751.v0P7pKA3083809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Jan 2017 07:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312741 - stable/11/sys/dev/ntb/if_ntb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 07:51:21 -0000 Author: mav Date: Wed Jan 25 07:51:19 2017 New Revision: 312741 URL: https://svnweb.freebsd.org/changeset/base/312741 Log: MFC r311935: Pretend we support some IOCTLs to not scary upper layers. Modified: stable/11/sys/dev/ntb/if_ntb/if_ntb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- stable/11/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 06:11:07 2017 (r312740) +++ stable/11/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 07:51:19 2017 (r312741) @@ -237,6 +237,11 @@ ntb_ioctl(if_t ifp, u_long command, cadd int error = 0; switch (command) { + case SIOCSIFFLAGS: + case SIOCADDMULTI: + case SIOCDELMULTI: + break; + case SIOCSIFMTU: { if (ifr->ifr_mtu > sc->mtu - ETHER_HDR_LEN) { From owner-svn-src-stable@freebsd.org Wed Jan 25 07:51:54 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63681CC0BA3; Wed, 25 Jan 2017 07:51:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32C91BD5; Wed, 25 Jan 2017 07:51:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P7prHS083883; Wed, 25 Jan 2017 07:51:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P7prei083882; Wed, 25 Jan 2017 07:51:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701250751.v0P7prei083882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Jan 2017 07:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312742 - stable/10/sys/dev/ntb/if_ntb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 07:51:54 -0000 Author: mav Date: Wed Jan 25 07:51:53 2017 New Revision: 312742 URL: https://svnweb.freebsd.org/changeset/base/312742 Log: MFC r311935: Pretend we support some IOCTLs to not scary upper layers. Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- stable/10/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 07:51:19 2017 (r312741) +++ stable/10/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 07:51:53 2017 (r312742) @@ -237,6 +237,11 @@ ntb_ioctl(struct ifnet *ifp, u_long comm int error = 0; switch (command) { + case SIOCSIFFLAGS: + case SIOCADDMULTI: + case SIOCDELMULTI: + break; + case SIOCSIFMTU: { if (ifr->ifr_mtu > sc->mtu - ETHER_HDR_LEN) { From owner-svn-src-stable@freebsd.org Wed Jan 25 14:49:43 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ED22CC1647; Wed, 25 Jan 2017 14:49:43 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F66BD02; Wed, 25 Jan 2017 14:49:43 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PEngY6051941; Wed, 25 Jan 2017 14:49:42 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PEngmo051939; Wed, 25 Jan 2017 14:49:42 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251449.v0PEngmo051939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 14:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312756 - in stable/11/sys: boot/fdt/dts/arm modules/dtb/am335x X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 14:49:43 -0000 Author: loos Date: Wed Jan 25 14:49:42 2017 New Revision: 312756 URL: https://svnweb.freebsd.org/changeset/base/312756 Log: MFC r308458, r311157 and r312347: Add the DTS for the Netgate SG-1000 (micro-Firewall). Remove a GPL licensed DTS. The micro-Firewall DTS is now a single BSD licensed file. The write-protect is not wired on uFW, disable it to allow writes to SD card. Obtained from: pfSense Sponsored by: Rubicon Communications, LLC (Netgate) Added: stable/11/sys/boot/fdt/dts/arm/ufw.dts - copied, changed from r308458, head/sys/boot/fdt/dts/arm/ufw.dts Modified: stable/11/sys/modules/dtb/am335x/Makefile Directory Properties: stable/11/ (props changed) Copied and modified: stable/11/sys/boot/fdt/dts/arm/ufw.dts (from r308458, head/sys/boot/fdt/dts/arm/ufw.dts) ============================================================================== --- head/sys/boot/fdt/dts/arm/ufw.dts Wed Nov 9 04:07:15 2016 (r308458, copy source) +++ stable/11/sys/boot/fdt/dts/arm/ufw.dts Wed Jan 25 14:49:42 2017 (r312756) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2016, 2017 Rubicon Communications, LLC (Netgate) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +29,247 @@ /dts-v1/; #include "am33xx.dtsi" -#include "ubmc.dtsi" / { model = "AM335x uFW"; compatible = "ti,am335x-ufw", "ti,am335x-ubmc", "ti,am33xx"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x10000000>; /* 256 MB */ + }; + + vmmcsd_fixed: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vmmcsd_fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; +}; + +&am33xx_pinmux { + pinctrl-names = "default"; + pinctrl-0 = <&clkout2_pin>; + + i2c0_pins: pinmux_i2c0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ + AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ + >; + }; + + i2c1_pins: pinmux_i2c1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_ctsn.i2c1_sda */ + AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_rtsn.i2c1_scl */ + >; + }; + + uart0_pins: pinmux_uart0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */ + AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */ + >; + }; + + clkout2_pin: pinmux_clkout2_pin { + pinctrl-single,pins = < + AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */ + >; + }; + + cpsw_default: cpsw_default { + pinctrl-single,pins = < + /* Slave 1 */ + AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii_1_txen */ + AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxdv.rgmii_1_rxdv */ + AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii_1_txd3 */ + AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii_1_txd2 */ + AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii_1_txd1 */ + AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii_1_txd0 */ + AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii_1_txclk */ + AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxclk.rgmii_1_rxclk */ + AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd3.rgmii_1_rxd3 */ + AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd2.rgmii_1_rxd2 */ + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd1.rgmii_1_rxd1 */ + AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd0.rgmii_1_rxd0 */ + + /* Slave 2 */ + AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a0.rgmii_2_txen */ + AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a1.rgmii_2_rxdv */ + AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a2.rgmii_2_txd3 */ + AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a3.rgmii_2_txd2 */ + AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a4.rgmii_2_txd1 */ + AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a5.rgmii_2_txd0 */ + AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a6.rgmii_2_txclk */ + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a7.rgmii_2_rxclk */ + AM33XX_IOPAD(0x860, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a8.rgmii_2_rxd3 */ + AM33XX_IOPAD(0x864, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a9.rgmii_2_rxd2 */ + AM33XX_IOPAD(0x868, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a10.rgmii_2_rxd1 */ + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a11.rgmii_2_rxd0 */ + >; + }; + + cpsw_sleep: cpsw_sleep { + pinctrl-single,pins = < + /* Slave 1 reset value */ + AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7) + + /* Slave 2 reset value */ + AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7) + >; + }; + + davinci_mdio_default: davinci_mdio_default { + pinctrl-single,pins = < + /* MDIO */ + AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */ + AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */ + >; + }; + + davinci_mdio_sleep: davinci_mdio_sleep { + pinctrl-single,pins = < + /* MDIO reset value */ + AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7) + >; + }; + + mmc1_pins: pinmux_mmc1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */ + AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */ + AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */ + AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */ + AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */ + AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */ + AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE5) /* spi0_cs1.mmc0_cd */ + >; + }; + + emmc_pins: pinmux_emmc_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x994, PIN_INPUT_PULLUP | MUX_MODE4) /* mcasp0_fsx.mmc1_cd */ + AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */ + AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */ + AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */ + AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */ + AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */ + AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */ + AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */ + AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */ + AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */ + AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */ + >; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + + status = "okay"; +}; + +&usb { + status = "okay"; +}; + +&usb_ctrl_mod { + status = "okay"; +}; + +&usb0_phy { + status = "okay"; +}; + +&usb1_phy { + status = "okay"; +}; + +&usb0 { + status = "okay"; + dr_mode = "host"; +}; + +&usb1 { + status = "okay"; + dr_mode = "host"; +}; + +&cppi41dma { + status = "okay"; +}; + +&cpsw_emac0 { + phy_id = <&davinci_mdio>, <1>; + phy-mode = "rgmii"; + dual_emac_res_vlan = <4071>; +}; + +&cpsw_emac1 { + phy_id = <&davinci_mdio>, <2>; + phy-mode = "rgmii"; + dual_emac_res_vlan = <4072>; +}; + +&mac { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&cpsw_default>; + pinctrl-1 = <&cpsw_sleep>; + active_slave = <1>; + status = "okay"; + dual_emac; + txen-skew-ps = <0>; + rxdv-skew-ps = <1400>; + rxd0-skew-ps = <1400>; + rxd1-skew-ps = <1400>; + rxd2-skew-ps = <1400>; + rxd3-skew-ps = <1400>; + txd0-skew-ps = <0>; + txd1-skew-ps = <0>; + txd2-skew-ps = <0>; + txd3-skew-ps = <0>; + rxc-skew-ps = <4400>; + txc-skew-ps = <6200>; +}; + +&davinci_mdio { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&davinci_mdio_default>; + pinctrl-1 = <&davinci_mdio_sleep>; + status = "okay"; +}; + +&aes { + status = "okay"; +}; + +&sham { + status = "okay"; }; &mmc1 { @@ -42,6 +278,7 @@ pinctrl-0 = <&mmc1_pins>; bus-width = <4>; non-removable; + wp-disable; status = "okay"; }; @@ -60,6 +297,18 @@ pinctrl-0 = <&i2c0_pins>; status = "okay"; + clock-frequency = <400000>; + + baseboard_eeprom: baseboard_eeprom@50 { + compatible = "atmel,24c02"; + reg = <0x50>; + + #address-cells = <1>; + #size-cells = <1>; + baseboard_data: baseboard_data@0 { + reg = <0 0x100>; + }; + }; }; &i2c1 { Modified: stable/11/sys/modules/dtb/am335x/Makefile ============================================================================== --- stable/11/sys/modules/dtb/am335x/Makefile Wed Jan 25 14:37:05 2017 (r312755) +++ stable/11/sys/modules/dtb/am335x/Makefile Wed Jan 25 14:49:42 2017 (r312756) @@ -2,6 +2,7 @@ # All the dts files for am335x systems we support. DTS= \ beaglebone.dts \ - beaglebone-black.dts + beaglebone-black.dts \ + ufw.dts .include From owner-svn-src-stable@freebsd.org Wed Jan 25 15:27:07 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DA2CCC00D0; Wed, 25 Jan 2017 15:27:07 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B898C7B0; Wed, 25 Jan 2017 15:27:06 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PFR5V4068088; Wed, 25 Jan 2017 15:27:05 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PFR5tw068087; Wed, 25 Jan 2017 15:27:05 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251527.v0PFR5tw068087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 15:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312757 - stable/11/sys/arm/ti/cpsw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 15:27:07 -0000 Author: loos Date: Wed Jan 25 15:27:05 2017 New Revision: 312757 URL: https://svnweb.freebsd.org/changeset/base/312757 Log: MFC r312408: The port number and the to_port_en flag are valid only on SOP descriptor. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 14:49:42 2017 (r312756) +++ stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 15:27:05 2017 (r312757) @@ -1801,13 +1801,8 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) struct cpsw_cpdma_bd bd; struct cpsw_slot *first_new_slot, *last, *last_old_slot, *next, *slot; struct mbuf *m0; - int error, flags, nsegs, seg, added = 0, padlen; + int error, nsegs, seg, added = 0, padlen; - flags = 0; - if (sc->swsc->dualemac) { - flags = CPDMA_BD_TO_PORT | - ((sc->unit + 1) & CPDMA_BD_PORT_MASK); - } /* Pull pending packets from IF queue and prep them for DMA. */ last = NULL; first_new_slot = NULL; @@ -1885,7 +1880,11 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufoff = 0; bd.buflen = segs[0].ds_len; bd.pktlen = m_length(slot->mbuf, NULL) + padlen; - bd.flags = CPDMA_BD_SOP | CPDMA_BD_OWNER | flags; + bd.flags = CPDMA_BD_SOP | CPDMA_BD_OWNER; + if (sc->swsc->dualemac) { + bd.flags |= CPDMA_BD_TO_PORT; + bd.flags |= ((sc->unit + 1) & CPDMA_BD_PORT_MASK); + } for (seg = 1; seg < nsegs; ++seg) { /* Save the previous buffer (which isn't EOP) */ cpsw_cpdma_write_bd(sc->swsc, slot, &bd); @@ -1903,7 +1902,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufoff = 0; bd.buflen = segs[seg].ds_len; bd.pktlen = 0; - bd.flags = CPDMA_BD_OWNER | flags; + bd.flags = CPDMA_BD_OWNER; } /* Save the final buffer. */ if (padlen <= 0) @@ -1925,7 +1924,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufoff = 0; bd.buflen = padlen; bd.pktlen = 0; - bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER | flags; + bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER; cpsw_cpdma_write_bd(sc->swsc, slot, &bd); ++nsegs; From owner-svn-src-stable@freebsd.org Wed Jan 25 16:10:37 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19E0ACC10F5; Wed, 25 Jan 2017 16:10:37 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEC017E7; Wed, 25 Jan 2017 16:10:36 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PGAZiB085454; Wed, 25 Jan 2017 16:10:35 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PGAZeb085452; Wed, 25 Jan 2017 16:10:35 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251610.v0PGAZeb085452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 16:10:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312761 - stable/11/sys/arm/ti/cpsw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 16:10:37 -0000 Author: loos Date: Wed Jan 25 16:10:35 2017 New Revision: 312761 URL: https://svnweb.freebsd.org/changeset/base/312761 Log: MFC r312411: Handle the set capabilities ioctl, letting the hardware checksum be disabled (Hi netmap!). Only remove the CRC bytes from packets when the hardware tell us to do so. Fixes the 'discard frame w/o leading ethernet header' issues. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c stable/11/sys/arm/ti/cpsw/if_cpswreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 15:54:44 2017 (r312760) +++ stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 16:10:35 2017 (r312761) @@ -1396,6 +1396,16 @@ cpswp_ioctl(struct ifnet *ifp, u_long co ifr = (struct ifreq *)data; switch (command) { + case SIOCSIFCAP: + changed = ifp->if_capenable ^ ifr->ifr_reqcap; + if (changed & IFCAP_HWCSUM) { + if ((ifr->ifr_reqcap & changed) & IFCAP_HWCSUM) + ifp->if_capenable |= IFCAP_HWCSUM; + else + ifp->if_capenable &= ~IFCAP_HWCSUM; + } + error = 0; + break; case SIOCSIFFLAGS: CPSW_PORT_LOCK(sc); if (ifp->if_flags & IFF_UP) { @@ -1633,15 +1643,22 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) /* TODO: track SOP/EOP bits to assemble a full mbuf out of received fragments. */ slot->mbuf->m_data += bd.bufoff; - slot->mbuf->m_len = bd.pktlen - 4; - slot->mbuf->m_pkthdr.len = bd.pktlen - 4; - slot->mbuf->m_flags |= M_PKTHDR; - slot->mbuf->m_pkthdr.rcvif = psc->ifp; + slot->mbuf->m_len = bd.buflen; + if (bd.flags & CPDMA_BD_SOP) { + slot->mbuf->m_pkthdr.len = bd.pktlen; + slot->mbuf->m_pkthdr.rcvif = psc->ifp; + slot->mbuf->m_flags |= M_PKTHDR; + } + slot->mbuf->m_next = NULL; slot->mbuf->m_nextpkt = NULL; + if (bd.flags & CPDMA_BD_PASS_CRC) + m_adj(slot->mbuf, -ETHER_CRC_LEN); if ((psc->ifp->if_capenable & IFCAP_RXCSUM) != 0) { /* check for valid CRC by looking into pkt_err[5:4] */ - if ((bd.flags & CPDMA_BD_PKT_ERR_MASK) == 0) { + if ((bd.flags & + (CPDMA_BD_SOP | CPDMA_BD_PKT_ERR_MASK)) == + CPDMA_BD_SOP) { slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID; slot->mbuf->m_pkthdr.csum_data = 0xffff; Modified: stable/11/sys/arm/ti/cpsw/if_cpswreg.h ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpswreg.h Wed Jan 25 15:54:44 2017 (r312760) +++ stable/11/sys/arm/ti/cpsw/if_cpswreg.h Wed Jan 25 16:10:35 2017 (r312761) @@ -191,6 +191,7 @@ #define CPDMA_BD_OWNER (1 << 13) #define CPDMA_BD_EOQ (1 << 12) #define CPDMA_BD_TDOWNCMPLT (1 << 11) +#define CPDMA_BD_PASS_CRC (1 << 10) #define CPDMA_BD_PKT_ERR_MASK (3 << 4) #define CPDMA_BD_TO_PORT (1 << 4) #define CPDMA_BD_PORT_MASK 3 From owner-svn-src-stable@freebsd.org Wed Jan 25 16:18:41 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D437CC149A; Wed, 25 Jan 2017 16:18:41 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57D351056; Wed, 25 Jan 2017 16:18:41 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PGIe7n090032; Wed, 25 Jan 2017 16:18:40 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PGIeYH090030; Wed, 25 Jan 2017 16:18:40 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251618.v0PGIeYH090030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 16:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312762 - stable/11/sys/arm/ti/cpsw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 16:18:41 -0000 Author: loos Date: Wed Jan 25 16:18:40 2017 New Revision: 312762 URL: https://svnweb.freebsd.org/changeset/base/312762 Log: MFC r312604 and r312605: Simplify the handling of small packets padding in cpsw: - Pad small packets to 60 bytes and not 64 (exclude the CRC bytes); - Pad the packet using m_append(9), if the packet has enough space for padding, which is usually true, it will not be necessary append a newly allocated mbuf to the chain. Suggested by: yongari MFC r312608: Handle the rx queue stall while reading the packets from NIC (when the descriptor state will not change anymore). This seems to eliminate the race where we can miss a stalled queue under high load. While here remove the unnecessary curly brackets. Reported by: Konstantin Kormashev MFC r312636: Properly assemble an mbuf chain out of received fragments. Remove the rx_batch hack, it makes no difference now that most of bugs have been sorted out. MFC r312637: Be a little more pedantic here, the TRM says the hardware is supposed to only clean the OWNER bit on SOP descriptors. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c stable/11/sys/arm/ti/cpsw/if_cpswvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 16:10:35 2017 (r312761) +++ stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 16:18:40 2017 (r312762) @@ -784,8 +784,7 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, static int cpsw_attach(device_t dev) { - bus_dma_segment_t segs[1]; - int error, i, nsegs; + int error, i; struct cpsw_softc *sc; uint32_t reg; @@ -860,15 +859,8 @@ cpsw_attach(device_t dev) return (error); } - /* Allocate the null mbuf and pre-sync it. */ - sc->null_mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - memset(sc->null_mbuf->m_data, 0, sc->null_mbuf->m_ext.ext_size); - bus_dmamap_create(sc->mbuf_dtag, 0, &sc->null_mbuf_dmamap); - bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, sc->null_mbuf_dmamap, - sc->null_mbuf, segs, &nsegs, BUS_DMA_NOWAIT); - bus_dmamap_sync(sc->mbuf_dtag, sc->null_mbuf_dmamap, - BUS_DMASYNC_PREWRITE); - sc->null_mbuf_paddr = segs[0].ds_addr; + /* Allocate a NULL buffer for padding. */ + sc->nullpad = malloc(ETHER_MIN_LEN, M_DEVBUF, M_WAITOK | M_ZERO); cpsw_init_slots(sc); @@ -947,13 +939,9 @@ cpsw_detach(device_t dev) for (i = 0; i < nitems(sc->_slots); ++i) cpsw_free_slot(sc, &sc->_slots[i]); - /* Free null mbuf. */ - if (sc->null_mbuf_dmamap) { - bus_dmamap_unload(sc->mbuf_dtag, sc->null_mbuf_dmamap); - error = bus_dmamap_destroy(sc->mbuf_dtag, sc->null_mbuf_dmamap); - KASSERT(error == 0, ("Mapping still active")); - m_freem(sc->null_mbuf); - } + /* Free null padding buffer. */ + if (sc->nullpad) + free(sc->nullpad, M_DEVBUF); /* Free DMA tag */ if (sc->mbuf_dtag) { @@ -1595,14 +1583,19 @@ cpsw_intr_rx(void *arg) static struct mbuf * cpsw_rx_dequeue(struct cpsw_softc *sc) { + int nsegs, port, removed; struct cpsw_cpdma_bd bd; struct cpsw_slot *last, *slot; struct cpswp_softc *psc; - struct mbuf *mb_head, *mb_tail; - int port, removed = 0; + struct mbuf *m, *m0, *mb_head, *mb_tail; + uint16_t m0_flags; + nsegs = 0; + m0 = NULL; last = NULL; - mb_head = mb_tail = NULL; + mb_head = NULL; + mb_tail = NULL; + removed = 0; /* Pull completed packets off hardware RX queue. */ while ((slot = STAILQ_FIRST(&sc->rx.active)) != NULL) { @@ -1625,10 +1618,12 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->mbuf_dtag, slot->dmamap); + m = slot->mbuf; + slot->mbuf = NULL; + if (bd.flags & CPDMA_BD_TDOWNCMPLT) { CPSW_DEBUGF(sc, ("RX teardown is complete")); - m_freem(slot->mbuf); - slot->mbuf = NULL; + m_freem(m); sc->rx.running = 0; sc->rx.teardown = 0; break; @@ -1640,41 +1635,63 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) psc = device_get_softc(sc->port[port].dev); /* Set up mbuf */ - /* TODO: track SOP/EOP bits to assemble a full mbuf - out of received fragments. */ - slot->mbuf->m_data += bd.bufoff; - slot->mbuf->m_len = bd.buflen; + m->m_data += bd.bufoff; + m->m_len = bd.buflen; if (bd.flags & CPDMA_BD_SOP) { - slot->mbuf->m_pkthdr.len = bd.pktlen; - slot->mbuf->m_pkthdr.rcvif = psc->ifp; - slot->mbuf->m_flags |= M_PKTHDR; - } - slot->mbuf->m_next = NULL; - slot->mbuf->m_nextpkt = NULL; - if (bd.flags & CPDMA_BD_PASS_CRC) - m_adj(slot->mbuf, -ETHER_CRC_LEN); + m->m_pkthdr.len = bd.pktlen; + m->m_pkthdr.rcvif = psc->ifp; + m->m_flags |= M_PKTHDR; + m0_flags = bd.flags; + m0 = m; + } + nsegs++; + m->m_next = NULL; + m->m_nextpkt = NULL; + if (bd.flags & CPDMA_BD_EOP && m0 != NULL) { + if (m0_flags & CPDMA_BD_PASS_CRC) + m_adj(m0, -ETHER_CRC_LEN); + m0_flags = 0; + m0 = NULL; + if (nsegs > sc->rx.longest_chain) + sc->rx.longest_chain = nsegs; + nsegs = 0; + } if ((psc->ifp->if_capenable & IFCAP_RXCSUM) != 0) { /* check for valid CRC by looking into pkt_err[5:4] */ if ((bd.flags & (CPDMA_BD_SOP | CPDMA_BD_PKT_ERR_MASK)) == CPDMA_BD_SOP) { - slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID; - slot->mbuf->m_pkthdr.csum_data = 0xffff; + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + m->m_pkthdr.csum_data = 0xffff; } } + if (STAILQ_FIRST(&sc->rx.active) != NULL && + (bd.flags & (CPDMA_BD_EOP | CPDMA_BD_EOQ)) == + (CPDMA_BD_EOP | CPDMA_BD_EOQ)) { + cpsw_write_hdp_slot(sc, &sc->rx, + STAILQ_FIRST(&sc->rx.active)); + sc->rx.queue_restart++; + } + /* Add mbuf to packet list to be returned. */ - if (mb_tail) { - mb_tail->m_nextpkt = slot->mbuf; + if (mb_tail != NULL && (bd.flags & CPDMA_BD_SOP)) { + mb_tail->m_nextpkt = m; + } else if (mb_tail != NULL) { + mb_tail->m_next = m; + } else if (mb_tail == NULL && (bd.flags & CPDMA_BD_SOP) == 0) { + if (bootverbose) + printf( + "%s: %s: discanding fragment packet w/o header\n", + __func__, psc->ifp->if_xname); + m_freem(m); + continue; } else { - mb_head = slot->mbuf; + mb_head = m; } - mb_tail = slot->mbuf; - slot->mbuf = NULL; - if (sc->rx_batch > 0 && sc->rx_batch == removed) - break; + mb_tail = m; } if (removed != 0) { @@ -1697,7 +1714,6 @@ cpsw_rx_enqueue(struct cpsw_softc *sc) struct cpsw_cpdma_bd bd; struct cpsw_slot *first_new_slot, *last_old_slot, *next, *slot; int error, nsegs, added = 0; - uint32_t flags; /* Register new mbufs with hardware. */ first_new_slot = NULL; @@ -1763,22 +1779,13 @@ cpsw_rx_enqueue(struct cpsw_softc *sc) } else { /* Add buffers to end of current queue. */ cpsw_cpdma_write_bd_next(sc, last_old_slot, first_new_slot); - /* If underrun, restart queue. */ - if ((flags = cpsw_cpdma_read_bd_flags(sc, last_old_slot)) & - CPDMA_BD_EOQ) { - flags &= ~CPDMA_BD_EOQ; - cpsw_cpdma_write_bd_flags(sc, last_old_slot, flags); - cpsw_write_hdp_slot(sc, &sc->rx, first_new_slot); - sc->rx.queue_restart++; - } } sc->rx.queue_adds += added; sc->rx.avail_queue_len -= added; sc->rx.active_queue_len += added; cpsw_write_4(sc, CPSW_CPDMA_RX_FREEBUFFER(0), added); - if (sc->rx.active_queue_len > sc->rx.max_active_queue_len) { + if (sc->rx.active_queue_len > sc->rx.max_active_queue_len) sc->rx.max_active_queue_len = sc->rx.active_queue_len; - } } static void @@ -1830,21 +1837,19 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) break; slot->mbuf = m0; - padlen = ETHER_MIN_LEN - slot->mbuf->m_pkthdr.len; + padlen = ETHER_MIN_LEN - ETHER_CRC_LEN - m0->m_pkthdr.len; if (padlen < 0) padlen = 0; + else if (padlen > 0) + m_append(slot->mbuf, padlen, sc->swsc->nullpad); /* Create mapping in DMA memory */ error = bus_dmamap_load_mbuf_sg(sc->swsc->mbuf_dtag, slot->dmamap, slot->mbuf, segs, &nsegs, BUS_DMA_NOWAIT); /* If the packet is too fragmented, try to simplify. */ if (error == EFBIG || - (error == 0 && - nsegs + (padlen > 0 ? 1 : 0) > sc->swsc->tx.avail_queue_len)) { + (error == 0 && nsegs > sc->swsc->tx.avail_queue_len)) { bus_dmamap_unload(sc->swsc->mbuf_dtag, slot->dmamap); - if (padlen > 0) /* May as well add padding. */ - m_append(slot->mbuf, padlen, - sc->swsc->null_mbuf->m_data); m0 = m_defrag(slot->mbuf, M_NOWAIT); if (m0 == NULL) { device_printf(sc->dev, @@ -1896,7 +1901,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufptr = segs[0].ds_addr; bd.bufoff = 0; bd.buflen = segs[0].ds_len; - bd.pktlen = m_length(slot->mbuf, NULL) + padlen; + bd.pktlen = m_length(slot->mbuf, NULL); bd.flags = CPDMA_BD_SOP | CPDMA_BD_OWNER; if (sc->swsc->dualemac) { bd.flags |= CPDMA_BD_TO_PORT; @@ -1921,42 +1926,18 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.pktlen = 0; bd.flags = CPDMA_BD_OWNER; } + /* Save the final buffer. */ - if (padlen <= 0) - bd.flags |= CPDMA_BD_EOP; - else { - next = STAILQ_NEXT(slot, next); - bd.next = cpsw_cpdma_bd_paddr(sc->swsc, next); - } + bd.flags |= CPDMA_BD_EOP; cpsw_cpdma_write_bd(sc->swsc, slot, &bd); STAILQ_REMOVE_HEAD(&sc->swsc->tx.avail, next); STAILQ_INSERT_TAIL(&sc->swsc->tx.active, slot, next); - if (padlen > 0) { - slot = STAILQ_FIRST(&sc->swsc->tx.avail); - - /* Setup buffer of null pad bytes (definitely EOP). */ - bd.next = 0; - bd.bufptr = sc->swsc->null_mbuf_paddr; - bd.bufoff = 0; - bd.buflen = padlen; - bd.pktlen = 0; - bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER; - cpsw_cpdma_write_bd(sc->swsc, slot, &bd); - ++nsegs; - - STAILQ_REMOVE_HEAD(&sc->swsc->tx.avail, next); - STAILQ_INSERT_TAIL(&sc->swsc->tx.active, slot, next); - } - last = slot; - added += nsegs; if (nsegs > sc->swsc->tx.longest_chain) sc->swsc->tx.longest_chain = nsegs; - // TODO: Should we defer the BPF tap until - // after all packets are queued? BPF_MTAP(sc->ifp, m0); } @@ -2001,7 +1982,8 @@ cpsw_tx_dequeue(struct cpsw_softc *sc) sc->tx.teardown = 1; } - if ((flags & CPDMA_BD_OWNER) != 0 && sc->tx.teardown == 0) + if ((flags & (CPDMA_BD_SOP | CPDMA_BD_OWNER)) == + (CPDMA_BD_SOP | CPDMA_BD_OWNER) && sc->tx.teardown == 0) break; /* Hardware is still using this packet. */ bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTWRITE); @@ -2727,9 +2709,6 @@ cpsw_add_sysctls(struct cpsw_softc *sc) SYSCTL_ADD_INT(ctx, parent, OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, 0, "Enable switch debug messages"); - SYSCTL_ADD_INT(ctx, parent, OID_AUTO, "rx_batch", - CTLFLAG_RW, &sc->rx_batch, 0, "Set the rx batch size"); - SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, "attachedSecs", CTLTYPE_UINT | CTLFLAG_RD, sc, 0, cpsw_stat_attached, "IU", "Time since driver attach"); Modified: stable/11/sys/arm/ti/cpsw/if_cpswvar.h ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpswvar.h Wed Jan 25 16:10:35 2017 (r312761) +++ stable/11/sys/arm/ti/cpsw/if_cpswvar.h Wed Jan 25 16:18:40 2017 (r312762) @@ -89,7 +89,6 @@ struct cpsw_softc { int active_slave; int debug; int dualemac; - int rx_batch; phandle_t node; struct bintime attach_uptime; /* system uptime when attach happened. */ struct cpsw_port port[2]; @@ -104,10 +103,8 @@ struct cpsw_softc { struct resource *irq_res[CPSW_INTR_COUNT]; void *ih_cookie[CPSW_INTR_COUNT]; - /* An mbuf full of nulls for TX padding. */ - bus_dmamap_t null_mbuf_dmamap; - struct mbuf *null_mbuf; - bus_addr_t null_mbuf_paddr; + /* A buffer full of nulls for TX padding. */ + void *nullpad; bus_dma_tag_t mbuf_dtag; From owner-svn-src-stable@freebsd.org Wed Jan 25 18:07:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09AD4CC1659; Wed, 25 Jan 2017 18:07:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D82E5DD; Wed, 25 Jan 2017 18:07:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PI7Ra1036457; Wed, 25 Jan 2017 18:07:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PI7Rsp036456; Wed, 25 Jan 2017 18:07:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251807.v0PI7Rsp036456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 18:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312766 - stable/11/tools/build/mk X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 18:07:29 -0000 Author: dim Date: Wed Jan 25 18:07:27 2017 New Revision: 312766 URL: https://svnweb.freebsd.org/changeset/base/312766 Log: MFC r311807: Add recently added libc++ headers to OptionalObsoleteFiles.inc. Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Jan 25 17:59:22 2017 (r312765) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Jan 25 18:07:27 2017 (r312766) @@ -4390,6 +4390,8 @@ OLD_FILES+=usr/lib/libcxxrt.a OLD_FILES+=usr/lib/libcxxrt.so OLD_FILES+=usr/lib/libcxxrt_p.a OLD_FILES+=usr/include/c++/v1/__bit_reference +OLD_FILES+=usr/include/c++/v1/__bsd_locale_defaults.h +OLD_FILES+=usr/include/c++/v1/__bsd_locale_fallbacks.h OLD_FILES+=usr/include/c++/v1/__config OLD_FILES+=usr/include/c++/v1/__debug OLD_FILES+=usr/include/c++/v1/__functional_03 @@ -4398,10 +4400,12 @@ OLD_FILES+=usr/include/c++/v1/__function OLD_FILES+=usr/include/c++/v1/__hash_table OLD_FILES+=usr/include/c++/v1/__locale OLD_FILES+=usr/include/c++/v1/__mutex_base +OLD_FILES+=usr/include/c++/v1/__nullptr OLD_FILES+=usr/include/c++/v1/__refstring OLD_FILES+=usr/include/c++/v1/__split_buffer OLD_FILES+=usr/include/c++/v1/__sso_allocator OLD_FILES+=usr/include/c++/v1/__std_stream +OLD_FILES+=usr/include/c++/v1/__threading_support OLD_FILES+=usr/include/c++/v1/__tree OLD_FILES+=usr/include/c++/v1/__tuple OLD_FILES+=usr/include/c++/v1/__undef___deallocate @@ -4437,30 +4441,51 @@ OLD_FILES+=usr/include/c++/v1/cstdlib OLD_FILES+=usr/include/c++/v1/cstring OLD_FILES+=usr/include/c++/v1/ctgmath OLD_FILES+=usr/include/c++/v1/ctime +OLD_FILES+=usr/include/c++/v1/ctype.h OLD_FILES+=usr/include/c++/v1/cwchar OLD_FILES+=usr/include/c++/v1/cwctype OLD_FILES+=usr/include/c++/v1/cxxabi.h OLD_FILES+=usr/include/c++/v1/deque +OLD_FILES+=usr/include/c++/v1/errno.h OLD_FILES+=usr/include/c++/v1/exception OLD_FILES+=usr/include/c++/v1/experimental/__config +OLD_FILES+=usr/include/c++/v1/experimental/__memory +OLD_FILES+=usr/include/c++/v1/experimental/algorithm +OLD_FILES+=usr/include/c++/v1/experimental/any OLD_FILES+=usr/include/c++/v1/experimental/chrono +OLD_FILES+=usr/include/c++/v1/experimental/deque OLD_FILES+=usr/include/c++/v1/experimental/dynarray -OLD_FILES+=usr/include/c++/v1/experimental/dynarray +OLD_FILES+=usr/include/c++/v1/experimental/filesystem +OLD_FILES+=usr/include/c++/v1/experimental/forward_list +OLD_FILES+=usr/include/c++/v1/experimental/functional +OLD_FILES+=usr/include/c++/v1/experimental/iterator +OLD_FILES+=usr/include/c++/v1/experimental/list +OLD_FILES+=usr/include/c++/v1/experimental/map +OLD_FILES+=usr/include/c++/v1/experimental/memory_resource OLD_FILES+=usr/include/c++/v1/experimental/optional +OLD_FILES+=usr/include/c++/v1/experimental/propagate_const OLD_FILES+=usr/include/c++/v1/experimental/ratio +OLD_FILES+=usr/include/c++/v1/experimental/regex +OLD_FILES+=usr/include/c++/v1/experimental/set +OLD_FILES+=usr/include/c++/v1/experimental/string OLD_FILES+=usr/include/c++/v1/experimental/string_view OLD_FILES+=usr/include/c++/v1/experimental/system_error OLD_FILES+=usr/include/c++/v1/experimental/tuple OLD_FILES+=usr/include/c++/v1/experimental/type_traits +OLD_FILES+=usr/include/c++/v1/experimental/unordered_map +OLD_FILES+=usr/include/c++/v1/experimental/unordered_set OLD_FILES+=usr/include/c++/v1/experimental/utility +OLD_FILES+=usr/include/c++/v1/experimental/vector OLD_FILES+=usr/include/c++/v1/ext/__hash OLD_FILES+=usr/include/c++/v1/ext/hash_map OLD_FILES+=usr/include/c++/v1/ext/hash_set +OLD_FILES+=usr/include/c++/v1/float.h OLD_FILES+=usr/include/c++/v1/forward_list OLD_FILES+=usr/include/c++/v1/fstream OLD_FILES+=usr/include/c++/v1/functional OLD_FILES+=usr/include/c++/v1/future OLD_FILES+=usr/include/c++/v1/initializer_list +OLD_FILES+=usr/include/c++/v1/inttypes.h OLD_FILES+=usr/include/c++/v1/iomanip OLD_FILES+=usr/include/c++/v1/ios OLD_FILES+=usr/include/c++/v1/iosfwd @@ -4471,6 +4496,7 @@ OLD_FILES+=usr/include/c++/v1/limits OLD_FILES+=usr/include/c++/v1/list OLD_FILES+=usr/include/c++/v1/locale OLD_FILES+=usr/include/c++/v1/map +OLD_FILES+=usr/include/c++/v1/math.h OLD_FILES+=usr/include/c++/v1/memory OLD_FILES+=usr/include/c++/v1/mutex OLD_FILES+=usr/include/c++/v1/new @@ -4482,17 +4508,25 @@ OLD_FILES+=usr/include/c++/v1/ratio OLD_FILES+=usr/include/c++/v1/regex OLD_FILES+=usr/include/c++/v1/scoped_allocator OLD_FILES+=usr/include/c++/v1/set +OLD_FILES+=usr/include/c++/v1/setjmp.h OLD_FILES+=usr/include/c++/v1/shared_mutex OLD_FILES+=usr/include/c++/v1/sstream OLD_FILES+=usr/include/c++/v1/stack +OLD_FILES+=usr/include/c++/v1/stdbool.h +OLD_FILES+=usr/include/c++/v1/stddef.h OLD_FILES+=usr/include/c++/v1/stdexcept +OLD_FILES+=usr/include/c++/v1/stdio.h +OLD_FILES+=usr/include/c++/v1/stdlib.h OLD_FILES+=usr/include/c++/v1/streambuf OLD_FILES+=usr/include/c++/v1/string +OLD_FILES+=usr/include/c++/v1/string.h OLD_FILES+=usr/include/c++/v1/strstream OLD_FILES+=usr/include/c++/v1/system_error OLD_FILES+=usr/include/c++/v1/tgmath.h OLD_FILES+=usr/include/c++/v1/thread OLD_FILES+=usr/include/c++/v1/tr1/__bit_reference +OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_defaults.h +OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_fallbacks.h OLD_FILES+=usr/include/c++/v1/tr1/__config OLD_FILES+=usr/include/c++/v1/tr1/__debug OLD_FILES+=usr/include/c++/v1/tr1/__functional_03 @@ -4501,13 +4535,15 @@ OLD_FILES+=usr/include/c++/v1/tr1/__func OLD_FILES+=usr/include/c++/v1/tr1/__hash_table OLD_FILES+=usr/include/c++/v1/tr1/__locale OLD_FILES+=usr/include/c++/v1/tr1/__mutex_base +OLD_FILES+=usr/include/c++/v1/tr1/__nullptr OLD_FILES+=usr/include/c++/v1/tr1/__refstring OLD_FILES+=usr/include/c++/v1/tr1/__split_buffer OLD_FILES+=usr/include/c++/v1/tr1/__sso_allocator OLD_FILES+=usr/include/c++/v1/tr1/__std_stream +OLD_FILES+=usr/include/c++/v1/tr1/__threading_support OLD_FILES+=usr/include/c++/v1/tr1/__tree OLD_FILES+=usr/include/c++/v1/tr1/__tuple -OLD_FILES+=usr/include/c++/v1/tr1/__tuple_03 +OLD_FILES+=usr/include/c++/v1/tr1/__undef___deallocate OLD_FILES+=usr/include/c++/v1/tr1/__undef_min_max OLD_FILES+=usr/include/c++/v1/tr1/algorithm OLD_FILES+=usr/include/c++/v1/tr1/array @@ -4540,15 +4576,19 @@ OLD_FILES+=usr/include/c++/v1/tr1/cstdli OLD_FILES+=usr/include/c++/v1/tr1/cstring OLD_FILES+=usr/include/c++/v1/tr1/ctgmath OLD_FILES+=usr/include/c++/v1/tr1/ctime +OLD_FILES+=usr/include/c++/v1/tr1/ctype.h OLD_FILES+=usr/include/c++/v1/tr1/cwchar OLD_FILES+=usr/include/c++/v1/tr1/cwctype OLD_FILES+=usr/include/c++/v1/tr1/deque +OLD_FILES+=usr/include/c++/v1/tr1/errno.h OLD_FILES+=usr/include/c++/v1/tr1/exception +OLD_FILES+=usr/include/c++/v1/tr1/float.h OLD_FILES+=usr/include/c++/v1/tr1/forward_list OLD_FILES+=usr/include/c++/v1/tr1/fstream OLD_FILES+=usr/include/c++/v1/tr1/functional OLD_FILES+=usr/include/c++/v1/tr1/future OLD_FILES+=usr/include/c++/v1/tr1/initializer_list +OLD_FILES+=usr/include/c++/v1/tr1/inttypes.h OLD_FILES+=usr/include/c++/v1/tr1/iomanip OLD_FILES+=usr/include/c++/v1/tr1/ios OLD_FILES+=usr/include/c++/v1/tr1/iosfwd @@ -4559,6 +4599,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/limits OLD_FILES+=usr/include/c++/v1/tr1/list OLD_FILES+=usr/include/c++/v1/tr1/locale OLD_FILES+=usr/include/c++/v1/tr1/map +OLD_FILES+=usr/include/c++/v1/tr1/math.h OLD_FILES+=usr/include/c++/v1/tr1/memory OLD_FILES+=usr/include/c++/v1/tr1/mutex OLD_FILES+=usr/include/c++/v1/tr1/new @@ -4570,12 +4611,18 @@ OLD_FILES+=usr/include/c++/v1/tr1/ratio OLD_FILES+=usr/include/c++/v1/tr1/regex OLD_FILES+=usr/include/c++/v1/tr1/scoped_allocator OLD_FILES+=usr/include/c++/v1/tr1/set +OLD_FILES+=usr/include/c++/v1/tr1/setjmp.h OLD_FILES+=usr/include/c++/v1/tr1/shared_mutex OLD_FILES+=usr/include/c++/v1/tr1/sstream OLD_FILES+=usr/include/c++/v1/tr1/stack +OLD_FILES+=usr/include/c++/v1/tr1/stdbool.h +OLD_FILES+=usr/include/c++/v1/tr1/stddef.h OLD_FILES+=usr/include/c++/v1/tr1/stdexcept +OLD_FILES+=usr/include/c++/v1/tr1/stdio.h +OLD_FILES+=usr/include/c++/v1/tr1/stdlib.h OLD_FILES+=usr/include/c++/v1/tr1/streambuf OLD_FILES+=usr/include/c++/v1/tr1/string +OLD_FILES+=usr/include/c++/v1/tr1/string.h OLD_FILES+=usr/include/c++/v1/tr1/strstream OLD_FILES+=usr/include/c++/v1/tr1/system_error OLD_FILES+=usr/include/c++/v1/tr1/tgmath.h @@ -4589,6 +4636,8 @@ OLD_FILES+=usr/include/c++/v1/tr1/unorde OLD_FILES+=usr/include/c++/v1/tr1/utility OLD_FILES+=usr/include/c++/v1/tr1/valarray OLD_FILES+=usr/include/c++/v1/tr1/vector +OLD_FILES+=usr/include/c++/v1/tr1/wchar.h +OLD_FILES+=usr/include/c++/v1/tr1/wctype.h OLD_FILES+=usr/include/c++/v1/tuple OLD_FILES+=usr/include/c++/v1/type_traits OLD_FILES+=usr/include/c++/v1/typeindex @@ -4601,6 +4650,8 @@ OLD_FILES+=usr/include/c++/v1/unwind.h OLD_FILES+=usr/include/c++/v1/utility OLD_FILES+=usr/include/c++/v1/valarray OLD_FILES+=usr/include/c++/v1/vector +OLD_FILES+=usr/include/c++/v1/wchar.h +OLD_FILES+=usr/include/c++/v1/wctype.h OLD_FILES+=usr/lib32/libc++.a OLD_FILES+=usr/lib32/libc++.so OLD_LIBS+=usr/lib32/libc++.so.1 From owner-svn-src-stable@freebsd.org Wed Jan 25 18:21:50 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1F8FCC1C4D; Wed, 25 Jan 2017 18:21:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89454D9F; Wed, 25 Jan 2017 18:21:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PILngn044566; Wed, 25 Jan 2017 18:21:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PILnqE044565; Wed, 25 Jan 2017 18:21:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251821.v0PILnqE044565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 18:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312768 - stable/11/usr.sbin/mfiutil X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 18:21:50 -0000 Author: dim Date: Wed Jan 25 18:21:49 2017 New Revision: 312768 URL: https://svnweb.freebsd.org/changeset/base/312768 Log: MFC r311811: Avoid taking the address of a packed struct member in mfiutil Fix a clang 4.0.0 warning about taking the address of a packed member of struct mfi_evt in mfiutil: usr.sbin/mfiutil/mfi_evt.c:583:30: error: taking address of packed member 'members' of class or structure 'mfi_evt' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] if (parse_locale(optarg, &filter.members.locale) < 0) { ^~~~~~~~~~~~~~~~~~~~~ Use a local variable instead, and copy that into the struct. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D9069 Modified: stable/11/usr.sbin/mfiutil/mfi_evt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- stable/11/usr.sbin/mfiutil/mfi_evt.c Wed Jan 25 18:16:17 2017 (r312767) +++ stable/11/usr.sbin/mfiutil/mfi_evt.c Wed Jan 25 18:21:49 2017 (r312768) @@ -540,6 +540,7 @@ show_events(int ac, char **av) char *cp; ssize_t size; uint32_t seq, start, stop; + uint16_t locale; uint8_t status; int ch, error, fd, num_events, verbose; u_int i; @@ -580,12 +581,13 @@ show_events(int ac, char **av) } break; case 'l': - if (parse_locale(optarg, &filter.members.locale) < 0) { + if (parse_locale(optarg, &locale) < 0) { error = errno; warn("Error parsing event locale"); close(fd); return (error); } + filter.members.locale = locale; break; case 'n': val = strtol(optarg, &cp, 0); From owner-svn-src-stable@freebsd.org Wed Jan 25 18:31:53 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47192CBC27C; Wed, 25 Jan 2017 18:31:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4617A9D; Wed, 25 Jan 2017 18:31:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PIVqfS048629; Wed, 25 Jan 2017 18:31:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PIVqXE048628; Wed, 25 Jan 2017 18:31:52 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251831.v0PIVqXE048628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 18:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312769 - stable/11/sys/boot/efi/boot1 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 18:31:53 -0000 Author: dim Date: Wed Jan 25 18:31:51 2017 New Revision: 312769 URL: https://svnweb.freebsd.org/changeset/base/312769 Log: MFC r311933: Use proper prototypes in struct boot_module_t With clang 4.0.0, we are getting the following warnings about struct boot_module_t in efi's boot_module.h: In file included from sys/boot/efi/boot1/ufs_module.c:41: sys/boot/efi/boot1/boot_module.h:67:14: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*init)(); ^ void sys/boot/efi/boot1/boot_module.h:92:16: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*status)(); ^ void sys/boot/efi/boot1/boot_module.h:95:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] dev_info_t *(*devices)(); ^ void 3 errors generated. Fix this by adding 'void' to the parameter lists. No functional change. Reviewed by: emaste, imp, smh Differential Revision: https://reviews.freebsd.org/D9144 Modified: stable/11/sys/boot/efi/boot1/boot_module.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/boot1/boot_module.h ============================================================================== --- stable/11/sys/boot/efi/boot1/boot_module.h Wed Jan 25 18:21:49 2017 (r312768) +++ stable/11/sys/boot/efi/boot1/boot_module.h Wed Jan 25 18:31:51 2017 (r312769) @@ -64,7 +64,7 @@ typedef struct boot_module_t const char *name; /* init is the optional initialiser for the module. */ - void (*init)(); + void (*init)(void); /* * probe checks to see if the module can handle dev. @@ -89,10 +89,10 @@ typedef struct boot_module_t void **buf, size_t *bufsize); /* status outputs information about the probed devices. */ - void (*status)(); + void (*status)(void); /* valid devices as found by probe. */ - dev_info_t *(*devices)(); + dev_info_t *(*devices)(void); } boot_module_t; /* Standard boot modules. */ From owner-svn-src-stable@freebsd.org Wed Jan 25 19:16:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23227CC0340; Wed, 25 Jan 2017 19:16:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5E4CBC2; Wed, 25 Jan 2017 19:16:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PJGPDo065558; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJGPMf065557; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251916.v0PJGPMf065557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312771 - in stable: 10/sys/boot/common 11/sys/boot/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 19:16:26 -0000 Author: dim Date: Wed Jan 25 19:16:24 2017 New Revision: 312771 URL: https://svnweb.freebsd.org/changeset/base/312771 Log: MFC r311929: Don't include in reloc_elf.c, as it includes just after it, which has a conflicting definition of errno. This leads to the following warning with clang 4.0.0: In file included from sys/boot/common/reloc_elf32.c:6: In file included from sys/boot/common/reloc_elf.c:37: /usr/obj/usr/src/tmp/usr/include/stand.h:155:12: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int errno; ^ sys/sys/errno.h:46:26: note: expanded from macro 'errno' #define errno (* __error()) ^ Modified: stable/11/sys/boot/common/reloc_elf.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/boot/common/reloc_elf.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/boot/common/reloc_elf.c ============================================================================== --- stable/11/sys/boot/common/reloc_elf.c Wed Jan 25 19:04:08 2017 (r312770) +++ stable/11/sys/boot/common/reloc_elf.c Wed Jan 25 19:16:24 2017 (r312771) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #define FREEBSD_ELF From owner-svn-src-stable@freebsd.org Wed Jan 25 19:16:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5887ACC0346; Wed, 25 Jan 2017 19:16:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27925BC3; Wed, 25 Jan 2017 19:16:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PJGPJ3065564; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJGPpP065563; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251916.v0PJGPpP065563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312771 - in stable: 10/sys/boot/common 11/sys/boot/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 19:16:26 -0000 Author: dim Date: Wed Jan 25 19:16:24 2017 New Revision: 312771 URL: https://svnweb.freebsd.org/changeset/base/312771 Log: MFC r311929: Don't include in reloc_elf.c, as it includes just after it, which has a conflicting definition of errno. This leads to the following warning with clang 4.0.0: In file included from sys/boot/common/reloc_elf32.c:6: In file included from sys/boot/common/reloc_elf.c:37: /usr/obj/usr/src/tmp/usr/include/stand.h:155:12: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int errno; ^ sys/sys/errno.h:46:26: note: expanded from macro 'errno' #define errno (* __error()) ^ Modified: stable/10/sys/boot/common/reloc_elf.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/boot/common/reloc_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/boot/common/reloc_elf.c ============================================================================== --- stable/10/sys/boot/common/reloc_elf.c Wed Jan 25 19:04:08 2017 (r312770) +++ stable/10/sys/boot/common/reloc_elf.c Wed Jan 25 19:16:24 2017 (r312771) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #define FREEBSD_ELF From owner-svn-src-stable@freebsd.org Wed Jan 25 19:55:37 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27655CC11B2; Wed, 25 Jan 2017 19:55:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA63F9; Wed, 25 Jan 2017 19:55:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PJta1W081691; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJtacZ081690; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251955.v0PJtacZ081690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312772 - in stable: 10/sys/boot/efi/include 11/sys/boot/efi/include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 19:55:37 -0000 Author: dim Date: Wed Jan 25 19:55:35 2017 New Revision: 312772 URL: https://svnweb.freebsd.org/changeset/base/312772 Log: MFC r311932: Make EFI_RESERVED_SERVICE a proper prototype With clang 4.0.0, the EFI API header causes the following warning: In file included from sys/boot/efi/loader/bootinfo.c:43: In file included from sys/boot/efi/loader/../include/efi.h:52: sys/boot/efi/include/efiapi.h:534:32: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] (EFIAPI *EFI_RESERVED_SERVICE) ( ^ Add VOID to make it into a real prototype. Reviewed by: imp, emaste, tsoome Differential Revision: https://reviews.freebsd.org/D9132 Modified: stable/11/sys/boot/efi/include/efiapi.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/boot/efi/include/efiapi.h Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/boot/efi/include/efiapi.h ============================================================================== --- stable/11/sys/boot/efi/include/efiapi.h Wed Jan 25 19:16:24 2017 (r312771) +++ stable/11/sys/boot/efi/include/efiapi.h Wed Jan 25 19:55:35 2017 (r312772) @@ -532,6 +532,7 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *EFI_RESERVED_SERVICE) ( + VOID ); typedef From owner-svn-src-stable@freebsd.org Wed Jan 25 19:55:37 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DE44CC11B6; Wed, 25 Jan 2017 19:55:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CCA1A; Wed, 25 Jan 2017 19:55:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PJtawD081697; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJtaYU081696; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251955.v0PJtaYU081696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312772 - in stable: 10/sys/boot/efi/include 11/sys/boot/efi/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 19:55:37 -0000 Author: dim Date: Wed Jan 25 19:55:35 2017 New Revision: 312772 URL: https://svnweb.freebsd.org/changeset/base/312772 Log: MFC r311932: Make EFI_RESERVED_SERVICE a proper prototype With clang 4.0.0, the EFI API header causes the following warning: In file included from sys/boot/efi/loader/bootinfo.c:43: In file included from sys/boot/efi/loader/../include/efi.h:52: sys/boot/efi/include/efiapi.h:534:32: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] (EFIAPI *EFI_RESERVED_SERVICE) ( ^ Add VOID to make it into a real prototype. Reviewed by: imp, emaste, tsoome Differential Revision: https://reviews.freebsd.org/D9132 Modified: stable/10/sys/boot/efi/include/efiapi.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/boot/efi/include/efiapi.h Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/boot/efi/include/efiapi.h ============================================================================== --- stable/10/sys/boot/efi/include/efiapi.h Wed Jan 25 19:16:24 2017 (r312771) +++ stable/10/sys/boot/efi/include/efiapi.h Wed Jan 25 19:55:35 2017 (r312772) @@ -536,6 +536,7 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *EFI_RESERVED_SERVICE) ( + VOID ); typedef From owner-svn-src-stable@freebsd.org Wed Jan 25 20:12:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEDDDCC15FD; Wed, 25 Jan 2017 20:12:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F521C84; Wed, 25 Jan 2017 20:12:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PKC7Sk089774; Wed, 25 Jan 2017 20:12:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKC7kl089773; Wed, 25 Jan 2017 20:12:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701252012.v0PKC7kl089773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 20:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312773 - stable/10/sys/boot/efi/boot1 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 20:12:08 -0000 Author: dim Date: Wed Jan 25 20:12:07 2017 New Revision: 312773 URL: https://svnweb.freebsd.org/changeset/base/312773 Log: MFC r311933: Use proper prototypes in struct boot_module_t With clang 4.0.0, we are getting the following warnings about struct boot_module_t in efi's boot_module.h: In file included from sys/boot/efi/boot1/ufs_module.c:41: sys/boot/efi/boot1/boot_module.h:67:14: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*init)(); ^ void sys/boot/efi/boot1/boot_module.h:92:16: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*status)(); ^ void sys/boot/efi/boot1/boot_module.h:95:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] dev_info_t *(*devices)(); ^ void 3 errors generated. Fix this by adding 'void' to the parameter lists. No functional change. Reviewed by: emaste, imp, smh Differential Revision: https://reviews.freebsd.org/D9144 Modified: stable/10/sys/boot/efi/boot1/boot_module.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/efi/boot1/boot_module.h ============================================================================== --- stable/10/sys/boot/efi/boot1/boot_module.h Wed Jan 25 19:55:35 2017 (r312772) +++ stable/10/sys/boot/efi/boot1/boot_module.h Wed Jan 25 20:12:07 2017 (r312773) @@ -64,7 +64,7 @@ typedef struct boot_module_t const char *name; /* init is the optional initialiser for the module. */ - void (*init)(); + void (*init)(void); /* * probe checks to see if the module can handle dev. @@ -89,10 +89,10 @@ typedef struct boot_module_t void **buf, size_t *bufsize); /* status outputs information about the probed devices. */ - void (*status)(); + void (*status)(void); /* valid devices as found by probe. */ - dev_info_t *(*devices)(); + dev_info_t *(*devices)(void); } boot_module_t; /* Standard boot modules. */ From owner-svn-src-stable@freebsd.org Wed Jan 25 20:44:58 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CB20CC1283; Wed, 25 Jan 2017 20:44:58 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BF4D368; Wed, 25 Jan 2017 20:44:58 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PKiv79002235; Wed, 25 Jan 2017 20:44:57 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKivDY002234; Wed, 25 Jan 2017 20:44:57 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201701252044.v0PKivDY002234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 25 Jan 2017 20:44:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312778 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 20:44:58 -0000 Author: avos Date: Wed Jan 25 20:44:57 2017 New Revision: 312778 URL: https://svnweb.freebsd.org/changeset/base/312778 Log: MFC r312560: ifconfig(8): fix '-stbc' parameter name. Modified: stable/11/sbin/ifconfig/ifieee80211.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/11/sbin/ifconfig/ifieee80211.c Wed Jan 25 20:41:16 2017 (r312777) +++ stable/11/sbin/ifconfig/ifieee80211.c Wed Jan 25 20:44:57 2017 (r312778) @@ -5405,7 +5405,7 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD("stbctx", 1, set80211stbc), DEF_CMD("-stbctx", -1, set80211stbc), DEF_CMD("stbc", 3, set80211stbc), /* NB: tx+rx */ - DEF_CMD("-ampdu", -3, set80211stbc), + DEF_CMD("-stbc", -3, set80211stbc), DEF_CMD("puren", 1, set80211puren), DEF_CMD("-puren", 0, set80211puren), DEF_CMD("doth", 1, set80211doth), From owner-svn-src-stable@freebsd.org Wed Jan 25 21:35:16 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB827CC104C; Wed, 25 Jan 2017 21:35:16 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BE9286A; Wed, 25 Jan 2017 21:35:16 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PLZFFD022347; Wed, 25 Jan 2017 21:35:15 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PLZFcJ022343; Wed, 25 Jan 2017 21:35:15 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701252135.v0PLZFcJ022343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 21:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312783 - stable/11/sys/dev/netmap X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 21:35:16 -0000 Author: loos Date: Wed Jan 25 21:35:15 2017 New Revision: 312783 URL: https://svnweb.freebsd.org/changeset/base/312783 Log: Fix a crash in netmap when using the emulated mode. This is a direct commit to stable/11 as the -head version was already fixed by a recent import of a new netmap version. Submitted by: Vincenzo Maffione Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/dev/netmap/netmap_freebsd.c stable/11/sys/dev/netmap/netmap_generic.c stable/11/sys/dev/netmap/netmap_kern.h Modified: stable/11/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- stable/11/sys/dev/netmap/netmap_freebsd.c Wed Jan 25 21:25:26 2017 (r312782) +++ stable/11/sys/dev/netmap/netmap_freebsd.c Wed Jan 25 21:35:15 2017 (r312783) @@ -218,30 +218,16 @@ generic_xmit_frame(struct ifnet *ifp, st { int ret; - /* - * The mbuf should be a cluster from our special pool, - * so we do not need to do an m_copyback but just copy - * (and eventually, just reference the netmap buffer) - */ + /* Link the external storage to the netmap buffer, so that + * no copy is necessary. */ + m->m_ext.ext_buf = m->m_data = addr; + m->m_ext.ext_size = len; - if (GET_MBUF_REFCNT(m) != 1) { - D("invalid refcnt %d for %p", - GET_MBUF_REFCNT(m), m); - panic("in generic_xmit_frame"); - } - // XXX the ext_size check is unnecessary if we link the netmap buf - if (m->m_ext.ext_size < len) { - RD(5, "size %d < len %d", m->m_ext.ext_size, len); - len = m->m_ext.ext_size; - } - if (0) { /* XXX seems to have negligible benefits */ - m->m_ext.ext_buf = m->m_data = addr; - } else { - bcopy(addr, m->m_data, len); - } m->m_len = m->m_pkthdr.len = len; - // inc refcount. All ours, we could skip the atomic - atomic_fetchadd_int(PNT_MBUF_REFCNT(m), 1); + + /* mbuf refcnt is not contended, no need to use atomic + * (a memory barrier is enough). */ + SET_MBUF_REFCNT(m, 2); M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); m->m_pkthdr.flowid = ring_nr; m->m_pkthdr.rcvif = ifp; /* used for tx notification */ Modified: stable/11/sys/dev/netmap/netmap_generic.c ============================================================================== --- stable/11/sys/dev/netmap/netmap_generic.c Wed Jan 25 21:25:26 2017 (r312782) +++ stable/11/sys/dev/netmap/netmap_generic.c Wed Jan 25 21:35:15 2017 (r312783) @@ -90,53 +90,40 @@ __FBSDID("$FreeBSD$"); /* * FreeBSD mbuf allocator/deallocator in emulation mode: * - * We allocate EXT_PACKET mbuf+clusters, but need to set M_NOFREE - * so that the destructor, if invoked, will not free the packet. - * In principle we should set the destructor only on demand, - * but since there might be a race we better do it on allocation. - * As a consequence, we also need to set the destructor or we - * would leak buffers. - */ - -/* - * mbuf wrappers + * We allocate mbufs with m_gethdr(), since the mbuf header is needed + * by the driver. We also attach a customly-provided external storage, + * which in this case is a netmap buffer. When calling m_extadd(), however + * we pass a NULL address, since the real address (and length) will be + * filled in by nm_os_generic_xmit_frame() right before calling + * if_transmit(). + * + * The dtor function does nothing, however we need it since mb_free_ext() + * has a KASSERT(), checking that the mbuf dtor function is not NULL. */ -/* mbuf destructor, also need to change the type to EXT_EXTREF, - * add an M_NOFREE flag, and then clear the flag and - * chain into uma_zfree(zone_pack, mf) - * (or reinstall the buffer ?) - */ -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = (void *)fn; \ - (m)->m_ext.ext_type = EXT_EXTREF; \ -} while (0) +static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } -static void -netmap_default_mbuf_destructor(struct mbuf *m) +static inline void +SET_MBUF_DESTRUCTOR(struct mbuf *m, void *fn) { - /* restore original mbuf */ - m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg1; - m->m_ext.ext_arg1 = NULL; - m->m_ext.ext_type = EXT_PACKET; - m->m_ext.ext_free = NULL; - if (GET_MBUF_REFCNT(m) == 0) - SET_MBUF_REFCNT(m, 1); - uma_zfree(zone_pack, m); + m->m_ext.ext_free = fn ? fn : (void *)void_mbuf_dtor; } static inline struct mbuf * netmap_get_mbuf(int len) { struct mbuf *m; - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - if (m) { - m->m_flags |= M_NOFREE; /* XXXNP: Almost certainly incorrect. */ - m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save - m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor; - m->m_ext.ext_type = EXT_EXTREF; - ND(5, "create m %p refcnt %d", m, GET_MBUF_REFCNT(m)); + + (void)len; + + m = m_gethdr(M_NOWAIT, MT_DATA); + if (m == NULL) { + return m; } + + m_extadd(m, NULL /* buf */, 0 /* size */, void_mbuf_dtor, + NULL, NULL, 0, EXT_NET_DRV); + return m; } @@ -412,11 +399,6 @@ static void generic_mbuf_destructor(struct mbuf *m) { netmap_generic_irq(MBUF_IFP(m), MBUF_TXQ(m), NULL); -#ifdef __FreeBSD__ - if (netmap_verbose) - RD(5, "Tx irq (%p) queue %d index %d" , m, MBUF_TXQ(m), (int)(uintptr_t)m->m_ext.ext_arg1); - netmap_default_mbuf_destructor(m); -#endif /* __FreeBSD__ */ IFRATE(rate_ctx.new.txirq++); } @@ -447,7 +429,7 @@ generic_netmap_tx_clean(struct netmap_kr // XXX how do we proceed ? break ? return -ENOMEM; } - } else if (GET_MBUF_REFCNT(m) != 1) { + } else if (MBUF_REFCNT(m) != 1) { break; /* This mbuf is still busy: its refcnt is 2. */ } n++; @@ -476,62 +458,39 @@ generic_netmap_tx_clean(struct netmap_kr return n; } - -/* - * We have pending packets in the driver between nr_hwtail +1 and hwcur. - * Compute a position in the middle, to be used to generate - * a notification. - */ -static inline u_int -generic_tx_event_middle(struct netmap_kring *kring, u_int hwcur) -{ - u_int n = kring->nkr_num_slots; - u_int ntc = nm_next(kring->nr_hwtail, n-1); - u_int e; - - if (hwcur >= ntc) { - e = (hwcur + ntc) / 2; - } else { /* wrap around */ - e = (hwcur + n + ntc) / 2; - if (e >= n) { - e -= n; - } - } - - if (unlikely(e >= n)) { - D("This cannot happen"); - e = 0; - } - - return e; -} - -/* - * We have pending packets in the driver between nr_hwtail+1 and hwcur. - * Schedule a notification approximately in the middle of the two. - * There is a race but this is only called within txsync which does - * a double check. - */ static void generic_set_tx_event(struct netmap_kring *kring, u_int hwcur) { + u_int lim = kring->nkr_num_slots - 1; struct mbuf *m; u_int e; + u_int ntc = nm_next(kring->nr_hwtail, lim); /* next to clean */ - if (nm_next(kring->nr_hwtail, kring->nkr_num_slots -1) == hwcur) { + if (ntc == hwcur) { return; /* all buffers are free */ } - e = generic_tx_event_middle(kring, hwcur); + + /* + * We have pending packets in the driver between hwtail+1 + * and hwcur, and we have to chose one of these slot to + * generate a notification. + * There is a race but this is only called within txsync which + * does a double check. + */ + + /* Choose the first pending slot, to be safe against driver + * reordering mbuf transmissions. */ + e = ntc; m = kring->tx_pool[e]; - ND(5, "Request Event at %d mbuf %p refcnt %d", e, m, m ? GET_MBUF_REFCNT(m) : -2 ); + ND(5, "Request Event at %d mbuf %p refcnt %d", e, m, m ? MBUF_REFCNT(m) : -2 ); if (m == NULL) { /* This can happen if there is already an event on the netmap slot 'e': There is nothing to do. */ return; } kring->tx_pool[e] = NULL; - SET_MBUF_DESTRUCTOR(m, generic_mbuf_destructor); + SET_MBUF_DESTRUCTOR(m, (void *)generic_mbuf_destructor); // XXX wmb() ? /* Decrement the refcount an free it if we have the last one. */ Modified: stable/11/sys/dev/netmap/netmap_kern.h ============================================================================== --- stable/11/sys/dev/netmap/netmap_kern.h Wed Jan 25 21:25:26 2017 (r312782) +++ stable/11/sys/dev/netmap/netmap_kern.h Wed Jan 25 21:35:15 2017 (r312783) @@ -97,13 +97,11 @@ struct netmap_adapter *netmap_getna(if_t #endif #if __FreeBSD_version >= 1100027 -#define GET_MBUF_REFCNT(m) ((m)->m_ext.ext_cnt ? *((m)->m_ext.ext_cnt) : -1) -#define SET_MBUF_REFCNT(m, x) *((m)->m_ext.ext_cnt) = x -#define PNT_MBUF_REFCNT(m) ((m)->m_ext.ext_cnt) +#define MBUF_REFCNT(m) ((m)->m_ext.ext_count) +#define SET_MBUF_REFCNT(m, x) (m)->m_ext.ext_count = x #else -#define GET_MBUF_REFCNT(m) ((m)->m_ext.ref_cnt ? *((m)->m_ext.ref_cnt) : -1) +#define MBUF_REFCNT(m) ((m)->m_ext.ref_cnt ? *((m)->m_ext.ref_cnt) : -1) #define SET_MBUF_REFCNT(m, x) *((m)->m_ext.ref_cnt) = x -#define PNT_MBUF_REFCNT(m) ((m)->m_ext.ref_cnt) #endif MALLOC_DECLARE(M_NETMAP); From owner-svn-src-stable@freebsd.org Thu Jan 26 03:05:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F6EFCC2CFE; Thu, 26 Jan 2017 03:05:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 548CADB7; Thu, 26 Jan 2017 03:05:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0Q35Rdu056151; Thu, 26 Jan 2017 03:05:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q35RkZ056149; Thu, 26 Jan 2017 03:05:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701260305.v0Q35RkZ056149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Jan 2017 03:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312789 - stable/11/libexec/rtld-elf/amd64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 03:05:28 -0000 Author: emaste Date: Thu Jan 26 03:05:27 2017 New Revision: 312789 URL: https://svnweb.freebsd.org/changeset/base/312789 Log: MFC r312288: rtld: do not rely on a populated GOT on amd64 On rela architectures GNU BFD ld and gold store the relocation addend in GOT entries (in addition to the relocation's r_addend field). rtld previously relied on this to access its own _DYNAMIC symbol in order to apply its own relocations. However, recording addends in the GOT is not specified by the ABI, and some versions of LLVM's LLD linker leave the GOT uninitialized on rela architectures. BFD ld does not populate the GOT on sparc64, and sparc64 rtld has a machine-dependent rtld_dynamic_addr() function that returns the _DYNAMIC address. Use the same approach on amd64, obtaining the %rip- relative _DYNAMIC address following a suggestion from Rafael Espíndola. Architectures other than amd64 should be addressed in future work. Modified: stable/11/libexec/rtld-elf/amd64/rtld_machdep.h stable/11/libexec/rtld-elf/amd64/rtld_start.S Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/amd64/rtld_machdep.h ============================================================================== --- stable/11/libexec/rtld-elf/amd64/rtld_machdep.h Thu Jan 26 02:22:23 2017 (r312788) +++ stable/11/libexec/rtld-elf/amd64/rtld_machdep.h Thu Jan 26 03:05:27 2017 (r312789) @@ -35,8 +35,8 @@ struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ -#define rtld_dynamic(obj) \ - ((const Elf_Dyn *)((obj)->relocbase + (Elf_Addr)&_DYNAMIC)) +Elf_Dyn *rtld_dynamic_addr(void); +#define rtld_dynamic(obj) rtld_dynamic_addr() /* Fixup the jump slot at "where" to transfer control to "target". */ static inline Elf_Addr Modified: stable/11/libexec/rtld-elf/amd64/rtld_start.S ============================================================================== --- stable/11/libexec/rtld-elf/amd64/rtld_start.S Thu Jan 26 02:22:23 2017 (r312788) +++ stable/11/libexec/rtld-elf/amd64/rtld_start.S Thu Jan 26 03:05:27 2017 (r312789) @@ -156,4 +156,16 @@ _rtld_bind_start: .cfi_endproc .size _rtld_bind_start, . - _rtld_bind_start + .align 4 + .globl rtld_dynamic_addr + .type rtld_dynamic_addr,@function +rtld_dynamic_addr: + .cfi_startproc + .weak _DYNAMIC + .hidden _DYNAMIC + lea _DYNAMIC(%rip),%rax + ret + .cfi_endproc + .size rtld_dynamic_addr, . - rtld_dynamic_addr + .section .note.GNU-stack,"",%progbits From owner-svn-src-stable@freebsd.org Thu Jan 26 04:44:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F522CC24FE; Thu, 26 Jan 2017 04:44:19 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44969895; Thu, 26 Jan 2017 04:44:19 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0Q4iIEu096112; Thu, 26 Jan 2017 04:44:18 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q4iIaE096111; Thu, 26 Jan 2017 04:44:18 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201701260444.v0Q4iIaE096111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Thu, 26 Jan 2017 04:44:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312790 - stable/11/release/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 04:44:19 -0000 Author: cperciva Date: Thu Jan 26 04:44:18 2017 New Revision: 312790 URL: https://svnweb.freebsd.org/changeset/base/312790 Log: MFC r312214: Enable IPv6 on EC2 AMIs. Modified: stable/11/release/tools/ec2.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/release/tools/ec2.conf ============================================================================== --- stable/11/release/tools/ec2.conf Thu Jan 26 03:05:27 2017 (r312789) +++ stable/11/release/tools/ec2.conf Thu Jan 26 04:44:18 2017 (r312790) @@ -6,7 +6,7 @@ # Packages to install into the image we're creating. This is a deliberately # minimalist set, providing only the packages necessary to bootstrap further # package installation as specified via EC2 user-data. -export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs" +export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient" # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_ephemeralswap ec2_loghostkey firstboot_freebsd_update firstboot_pkgs" @@ -39,8 +39,9 @@ vm_extra_pre_umount() { # time; expand our filesystem to fill the disk. echo 'growfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf - # EC2 instances use DHCP to get their network configuration. - echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf + # EC2 instances use DHCP to get their network configuration. IPv6 + # requires accept_rtadv. + echo 'ifconfig_DEFAULT="SYNCDHCP accept_rtadv"' >> ${DESTDIR}/etc/rc.conf # Unless the system has been configured via EC2 user-data, the user # will need to SSH in to do anything. @@ -51,6 +52,10 @@ vm_extra_pre_umount() { # via EC2 user-data. echo 'firstboot_pkgs_list="awscli"' >> ${DESTDIR}/etc/rc.conf + # Enable IPv6 on all interfaces, and use DHCP on both IPv4 and IPv6. + echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf + echo 'dhclient_program="/usr/local/sbin/dual-dhclient"' >> ${DESTDIR}/etc/rc.conf + # The EC2 console is output-only, so while printing a backtrace can # be useful, there's no point dropping into a debugger or waiting # for a keypress. From owner-svn-src-stable@freebsd.org Thu Jan 26 09:46:35 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92C80CBFB7A; Thu, 26 Jan 2017 09:46:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 511D466E; Thu, 26 Jan 2017 09:46:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0Q9kYIo021337; Thu, 26 Jan 2017 09:46:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q9kYet021336; Thu, 26 Jan 2017 09:46:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701260946.v0Q9kYet021336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 26 Jan 2017 09:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312794 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 09:46:35 -0000 Author: avg Date: Thu Jan 26 09:46:34 2017 New Revision: 312794 URL: https://svnweb.freebsd.org/changeset/base/312794 Log: MFC r312532: don't abort writing of a core dump after EFAULT Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Thu Jan 26 07:07:09 2017 (r312793) +++ stable/11/sys/kern/imgact_elf.c Thu Jan 26 09:46:34 2017 (r312794) @@ -1160,7 +1160,7 @@ struct coredump_params { static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); -static int core_write(struct coredump_params *, void *, size_t, off_t, +static int core_write(struct coredump_params *, const void *, size_t, off_t, enum uio_seg); static void each_writable_segment(struct thread *, segment_callback, void *); static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, @@ -1202,7 +1202,14 @@ compress_chunk(struct coredump_params *p while (len > 0) { chunk_len = MIN(len, CORE_BUF_SIZE); - copyin(base, buf, chunk_len); + + /* + * We can get EFAULT error here. + * In that case zero out the current chunk of the segment. + */ + error = copyin(base, buf, chunk_len); + if (error != 0) + bzero(buf, chunk_len); error = gzio_write(p->gzs, buf, chunk_len); if (error != 0) break; @@ -1222,12 +1229,12 @@ core_gz_write(void *base, size_t len, of #endif /* GZIO */ static int -core_write(struct coredump_params *p, void *base, size_t len, off_t offset, - enum uio_seg seg) +core_write(struct coredump_params *p, const void *base, size_t len, + off_t offset, enum uio_seg seg) { - return (vn_rdwr_inchunks(UIO_WRITE, p->vp, base, len, offset, - seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, + return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base), + len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, p->active_cred, p->file_cred, NULL, p->td)); } @@ -1235,12 +1242,32 @@ static int core_output(void *base, size_t len, off_t offset, struct coredump_params *p, void *tmpbuf) { + int error; #ifdef GZIO if (p->gzs != NULL) return (compress_chunk(p, base, tmpbuf, len)); #endif - return (core_write(p, base, len, offset, UIO_USERSPACE)); + /* + * EFAULT is a non-fatal error that we can get, for example, + * if the segment is backed by a file but extends beyond its + * end. + */ + error = core_write(p, base, len, offset, UIO_USERSPACE); + if (error == EFAULT) { + log(LOG_WARNING, "Failed to fully fault in a core file segment " + "at VA %p with size 0x%zx to be written at offset 0x%jx " + "for process %s\n", base, len, offset, curproc->p_comm); + + /* + * Write a "real" zero byte at the end of the target region + * in the case this is the last segment. + * The intermediate space will be implicitly zero-filled. + */ + error = core_write(p, zero_region, 1, offset + len - 1, + UIO_SYSSPACE); + } + return (error); } /* From owner-svn-src-stable@freebsd.org Thu Jan 26 10:15:42 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90961CC0797; Thu, 26 Jan 2017 10:15:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CCA5A3A; Thu, 26 Jan 2017 10:15:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAFfXv033648; Thu, 26 Jan 2017 10:15:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAFfHa033647; Thu, 26 Jan 2017 10:15:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261015.v0QAFfHa033647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:15:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312795 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:15:42 -0000 Author: kib Date: Thu Jan 26 10:15:41 2017 New Revision: 312795 URL: https://svnweb.freebsd.org/changeset/base/312795 Log: MFC r311531 (by mjg): Perform a lockless check in tmpfs_itimes. Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 09:46:34 2017 (r312794) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:15:41 2017 (r312795) @@ -1743,19 +1743,22 @@ tmpfs_set_status(struct tmpfs_node *node } /* Sync timestamps */ -static void -tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc, +void +tmpfs_itimes(struct vnode *vp, const struct timespec *acc, const struct timespec *mod) { + struct tmpfs_node *node; struct timespec now; - TMPFS_ASSERT_LOCKED(node); + ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); + node = VP_TO_TMPFS_NODE(vp); if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED)) == 0) return; vfs_timestamp(&now); + TMPFS_NODE_LOCK(node); if (node->tn_status & TMPFS_NODE_ACCESSED) { if (acc == NULL) acc = &now; @@ -1770,19 +1773,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n node->tn_ctime = now; node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED); -} - -void -tmpfs_itimes(struct vnode *vp, const struct timespec *acc, - const struct timespec *mod) -{ - struct tmpfs_node *node; - - ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); - node = VP_TO_TMPFS_NODE(vp); - - TMPFS_NODE_LOCK(node); - tmpfs_itimes_locked(node, acc, mod); TMPFS_NODE_UNLOCK(node); /* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */ From owner-svn-src-stable@freebsd.org Thu Jan 26 10:18:02 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 195F8CC084F; Thu, 26 Jan 2017 10:18:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA555BD0; Thu, 26 Jan 2017 10:18:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAI03c033777; Thu, 26 Jan 2017 10:18:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAI0cs033776; Thu, 26 Jan 2017 10:18:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261018.v0QAI0cs033776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:18:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312796 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:18:02 -0000 Author: kib Date: Thu Jan 26 10:18:00 2017 New Revision: 312796 URL: https://svnweb.freebsd.org/changeset/base/312796 Log: MFC r311526 (by mjg): tmpfs: enable MNTK_EXTENDED_SHARED. Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:15:41 2017 (r312795) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:18:00 2017 (r312796) @@ -257,7 +257,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; MNT_IUNLOCK(mp); mp->mnt_data = tmp; From owner-svn-src-stable@freebsd.org Thu Jan 26 10:19:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 356CACC0949; Thu, 26 Jan 2017 10:19:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9B4BD5B; Thu, 26 Jan 2017 10:19:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAJsdV033889; Thu, 26 Jan 2017 10:19:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAJrBa033886; Thu, 26 Jan 2017 10:19:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261019.v0QAJrBa033886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312797 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:19:55 -0000 Author: kib Date: Thu Jan 26 10:19:53 2017 New Revision: 312797 URL: https://svnweb.freebsd.org/changeset/base/312797 Log: MFC r312124 (by mjg): tmpfs: manage tm_pages_used with atomics. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:18:00 2017 (r312796) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:19:53 2017 (r312797) @@ -312,12 +312,12 @@ struct tmpfs_mount { /* Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of - * free memory; in the extreme case, it will hold the SIZE_MAX + * free memory; in the extreme case, it will hold the ULONG_MAX * value. */ - size_t tm_pages_max; + u_long tm_pages_max; /* Number of pages in use by the file system. */ - size_t tm_pages_used; + u_long tm_pages_used; /* Pointer to the node representing the root directory of this * file system. */ Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:18:00 2017 (r312796) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:19:53 2017 (r312797) @@ -130,7 +130,7 @@ tmpfs_pages_check_avail(struct tmpfs_mou if (tmpfs_mem_avail() < req_pages) return (0); - if (tmp->tm_pages_max != SIZE_MAX && + if (tmp->tm_pages_max != ULONG_MAX && tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp)) return (0); @@ -328,9 +328,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { - TMPFS_LOCK(tmp); - tmp->tm_pages_used -= uobj->size; - TMPFS_UNLOCK(tmp); + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); @@ -1413,9 +1411,7 @@ retry: uobj->size = newpages; VM_OBJECT_WUNLOCK(uobj); - TMPFS_LOCK(tmp); - tmp->tm_pages_used += (newpages - oldpages); - TMPFS_UNLOCK(tmp); + atomic_add_long(&tmp->tm_pages_used, newpages - oldpages); node->tn_size = newsize; return (0); Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:18:00 2017 (r312796) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:19:53 2017 (r312797) @@ -397,7 +397,7 @@ tmpfs_statfs(struct mount *mp, struct st sbp->f_bsize = PAGE_SIZE; used = tmpfs_pages_used(tmp); - if (tmp->tm_pages_max != SIZE_MAX) + if (tmp->tm_pages_max != ULONG_MAX) sbp->f_blocks = tmp->tm_pages_max; else sbp->f_blocks = used + tmpfs_mem_avail(); From owner-svn-src-stable@freebsd.org Thu Jan 26 10:29:25 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31BDDCC0DA3; Thu, 26 Jan 2017 10:29:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F27BF625; Thu, 26 Jan 2017 10:29:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QATO95037869; Thu, 26 Jan 2017 10:29:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QATOpY037868; Thu, 26 Jan 2017 10:29:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261029.v0QATOpY037868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312798 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:29:25 -0000 Author: kib Date: Thu Jan 26 10:29:23 2017 New Revision: 312798 URL: https://svnweb.freebsd.org/changeset/base/312798 Log: MFC r311531 (by mjg): Perform a lockless check in tmpfs_itimes. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:19:53 2017 (r312797) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:29:23 2017 (r312798) @@ -1745,19 +1745,22 @@ tmpfs_set_status(struct tmpfs_node *node } /* Sync timestamps */ -static void -tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc, +void +tmpfs_itimes(struct vnode *vp, const struct timespec *acc, const struct timespec *mod) { + struct tmpfs_node *node; struct timespec now; - TMPFS_ASSERT_LOCKED(node); + ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); + node = VP_TO_TMPFS_NODE(vp); if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED)) == 0) return; vfs_timestamp(&now); + TMPFS_NODE_LOCK(node); if (node->tn_status & TMPFS_NODE_ACCESSED) { if (acc == NULL) acc = &now; @@ -1772,19 +1775,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n node->tn_ctime = now; node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED); -} - -void -tmpfs_itimes(struct vnode *vp, const struct timespec *acc, - const struct timespec *mod) -{ - struct tmpfs_node *node; - - ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); - node = VP_TO_TMPFS_NODE(vp); - - TMPFS_NODE_LOCK(node); - tmpfs_itimes_locked(node, acc, mod); TMPFS_NODE_UNLOCK(node); } From owner-svn-src-stable@freebsd.org Thu Jan 26 10:35:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 492D5CC10C7; Thu, 26 Jan 2017 10:35:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0899BB8F; Thu, 26 Jan 2017 10:35:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAZ5h3041628; Thu, 26 Jan 2017 10:35:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAZ4N9041625; Thu, 26 Jan 2017 10:35:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261035.v0QAZ4N9041625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312799 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:35:06 -0000 Author: kib Date: Thu Jan 26 10:35:04 2017 New Revision: 312799 URL: https://svnweb.freebsd.org/changeset/base/312799 Log: MFC r312124 (by mjg): tmpfs: manage tm_pages_used with atomics. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:29:23 2017 (r312798) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:35:04 2017 (r312799) @@ -312,12 +312,12 @@ struct tmpfs_mount { /* Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of - * free memory; in the extreme case, it will hold the SIZE_MAX + * free memory; in the extreme case, it will hold the ULONG_MAX * value. */ - size_t tm_pages_max; + u_long tm_pages_max; /* Number of pages in use by the file system. */ - size_t tm_pages_used; + u_long tm_pages_used; /* Pointer to the node representing the root directory of this * file system. */ Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:29:23 2017 (r312798) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:35:04 2017 (r312799) @@ -129,7 +129,7 @@ tmpfs_pages_check_avail(struct tmpfs_mou if (tmpfs_mem_avail() < req_pages) return (0); - if (tmp->tm_pages_max != SIZE_MAX && + if (tmp->tm_pages_max != ULONG_MAX && tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp)) return (0); @@ -327,9 +327,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { - TMPFS_LOCK(tmp); - tmp->tm_pages_used -= uobj->size; - TMPFS_UNLOCK(tmp); + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); @@ -1413,9 +1411,7 @@ retry: uobj->size = newpages; VM_OBJECT_WUNLOCK(uobj); - TMPFS_LOCK(tmp); - tmp->tm_pages_used += (newpages - oldpages); - TMPFS_UNLOCK(tmp); + atomic_add_long(&tmp->tm_pages_used, newpages - oldpages); node->tn_size = newsize; return (0); Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:29:23 2017 (r312798) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:35:04 2017 (r312799) @@ -395,7 +395,7 @@ tmpfs_statfs(struct mount *mp, struct st sbp->f_bsize = PAGE_SIZE; used = tmpfs_pages_used(tmp); - if (tmp->tm_pages_max != SIZE_MAX) + if (tmp->tm_pages_max != ULONG_MAX) sbp->f_blocks = tmp->tm_pages_max; else sbp->f_blocks = used + tmpfs_mem_avail(); From owner-svn-src-stable@freebsd.org Thu Jan 26 10:41:57 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB665CC134A; Thu, 26 Jan 2017 10:41:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1326F84; Thu, 26 Jan 2017 10:41:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAfuDp045463; Thu, 26 Jan 2017 10:41:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAfu8w045462; Thu, 26 Jan 2017 10:41:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261041.v0QAfu8w045462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312800 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:41:58 -0000 Author: kib Date: Thu Jan 26 10:41:56 2017 New Revision: 312800 URL: https://svnweb.freebsd.org/changeset/base/312800 Log: MFC r312407: Remove unused union member, fifos on tmpfs are implemented in common code. Modified: stable/11/sys/fs/tmpfs/tmpfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:35:04 2017 (r312799) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:41:56 2017 (r312800) @@ -259,12 +259,6 @@ struct tmpfs_node { vm_object_t tn_aobj; }tn_reg; - - /* Valid when tn_type = VFIFO */ - struct tn_fifo { - fo_rdwr_t *tn_fo_read; - fo_rdwr_t *tn_fo_write; - }tn_fifo; }tn_spec; }; LIST_HEAD(tmpfs_node_list, tmpfs_node); From owner-svn-src-stable@freebsd.org Thu Jan 26 10:43:38 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BD50CC1439; Thu, 26 Jan 2017 10:43:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCCCE1198; Thu, 26 Jan 2017 10:43:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAhaii045597; Thu, 26 Jan 2017 10:43:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAhag8045596; Thu, 26 Jan 2017 10:43:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261043.v0QAhag8045596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312801 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:43:38 -0000 Author: kib Date: Thu Jan 26 10:43:36 2017 New Revision: 312801 URL: https://svnweb.freebsd.org/changeset/base/312801 Log: MFC r312407: Remove unused union member, fifos on tmpfs are implemented in common code. Modified: stable/10/sys/fs/tmpfs/tmpfs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:41:56 2017 (r312800) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:43:36 2017 (r312801) @@ -259,12 +259,6 @@ struct tmpfs_node { vm_object_t tn_aobj; }tn_reg; - - /* Valid when tn_type = VFIFO */ - struct tn_fifo { - fo_rdwr_t *tn_fo_read; - fo_rdwr_t *tn_fo_write; - }tn_fifo; }tn_spec; }; LIST_HEAD(tmpfs_node_list, tmpfs_node); From owner-svn-src-stable@freebsd.org Thu Jan 26 10:47:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5E3ECC16D3; Thu, 26 Jan 2017 10:47:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99EC814AD; Thu, 26 Jan 2017 10:47:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAl55l045804; Thu, 26 Jan 2017 10:47:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAl5AA045799; Thu, 26 Jan 2017 10:47:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261047.v0QAl5AA045799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312802 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:47:06 -0000 Author: kib Date: Thu Jan 26 10:47:05 2017 New Revision: 312802 URL: https://svnweb.freebsd.org/changeset/base/312802 Log: MFC r312409: Style fixes and comment updates. MFC r312435: Remove mistakenly merged field. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c stable/11/sys/fs/tmpfs/tmpfs_vfsops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:47:05 2017 (r312802) @@ -80,8 +80,10 @@ struct tmpfs_dirent { uint32_t td_hash; u_int td_namelen; - /* Pointer to the node this entry refers to. In case this field - * is NULL, the node is a whiteout. */ + /* + * Pointer to the node this entry refers to. In case this field + * is NULL, the node is a whiteout. + */ struct tmpfs_node * td_node; union { @@ -94,21 +96,24 @@ struct tmpfs_dirent { } ud; }; -/* A directory in tmpfs holds a list of directory entries, which in - * turn point to other files (which can be directories themselves). +/* + * A directory in tmpfs holds a collection of directory entries, which + * in turn point to other files (which can be directories themselves). * - * In tmpfs, this list is managed by a RB-Tree, whose head is defined by - * the struct tmpfs_dir type. + * In tmpfs, this collection is managed by a RB-Tree, whose head is + * defined by the struct tmpfs_dir type. * * It is important to notice that directories do not have entries for . and * .. as other file systems do. These can be generated when requested * based on information available by other means, such as the pointer to * the node itself in the former case or the pointer to the parent directory * in the latter case. This is done to simplify tmpfs's code and, more - * importantly, to remove redundancy. */ + * importantly, to remove redundancy. + */ RB_HEAD(tmpfs_dir, tmpfs_dirent); -/* Each entry in a directory has a cookie that identifies it. Cookies +/* + * Each entry in a directory has a cookie that identifies it. Cookies * supersede offsets within directories because, given how tmpfs stores * directories in memory, there is no such thing as an offset. * @@ -139,51 +144,65 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * a particular type. The code must be careful to only access those * attributes that are actually allowed by the node's type. * - * * Below is the key of locks used to protected the fields in the following * structures. - * + * (v) vnode lock in exclusive mode + * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and + * tn_interlock + * (i) tn_interlock + * (m) tmpfs_mount allnode_lock + * (c) stable after creation */ struct tmpfs_node { - /* Doubly-linked list entry which links all existing nodes for a - * single file system. This is provided to ease the removal of - * all nodes during the unmount operation. */ - LIST_ENTRY(tmpfs_node) tn_entries; + /* + * Doubly-linked list entry which links all existing nodes for + * a single file system. This is provided to ease the removal + * of all nodes during the unmount operation, and to support + * the implementation of VOP_VNTOCNP(). + */ + LIST_ENTRY(tmpfs_node) tn_entries; /* (m) */ - /* The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', + /* + * The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', * 'VLNK', 'VREG' and 'VSOCK' is allowed. The usage of vnode * types instead of a custom enumeration is to make things simpler - * and faster, as we do not need to convert between two types. */ - enum vtype tn_type; + * and faster, as we do not need to convert between two types. + */ + enum vtype tn_type; /* (c) */ /* Node identifier. */ - ino_t tn_id; + ino_t tn_id; /* (c) */ - /* Node's internal status. This is used by several file system + /* + * Node's internal status. This is used by several file system * operations to do modifications to the node in a delayed - * fashion. */ - int tn_status; + * fashion. + */ + int tn_status; /* (vi) */ #define TMPFS_NODE_ACCESSED (1 << 1) #define TMPFS_NODE_MODIFIED (1 << 2) #define TMPFS_NODE_CHANGED (1 << 3) - /* The node size. It does not necessarily match the real amount - * of memory consumed by it. */ - off_t tn_size; + /* + * The node size. It does not necessarily match the real amount + * of memory consumed by it. + */ + off_t tn_size; /* (v) */ /* Generic node attributes. */ - uid_t tn_uid; - gid_t tn_gid; - mode_t tn_mode; - u_long tn_flags; - nlink_t tn_links; - struct timespec tn_atime; - struct timespec tn_mtime; - struct timespec tn_ctime; - struct timespec tn_birthtime; - unsigned long tn_gen; + uid_t tn_uid; /* (v) */ + gid_t tn_gid; /* (v) */ + mode_t tn_mode; /* (v) */ + u_long tn_flags; /* (v) */ + nlink_t tn_links; /* (v) */ + struct timespec tn_atime; /* (vi) */ + struct timespec tn_mtime; /* (vi) */ + struct timespec tn_ctime; /* (vi) */ + struct timespec tn_birthtime; /* (v) */ + unsigned long tn_gen; /* (c) */ - /* As there is a single vnode for each active file within the + /* + * As there is a single vnode for each active file within the * system, care has to be taken to avoid allocating more than one * vnode per file. In order to do this, a bidirectional association * is kept between vnodes and nodes. @@ -196,70 +215,81 @@ struct tmpfs_node { * tn_vnode. * * May be NULL when the node is unused (that is, no vnode has been - * allocated for it or it has been reclaimed). */ - struct vnode * tn_vnode; + * allocated for it or it has been reclaimed). + */ + struct vnode * tn_vnode; /* (i) */ - /* Interlock to protect tn_vpstate, and tn_status under shared + /* + * Interlock to protect tn_vpstate, and tn_status under shared * vnode lock. */ struct mtx tn_interlock; - /* Identify if current node has vnode assiocate with + /* + * Identify if current node has vnode assiocate with * or allocating vnode. */ - int tn_vpstate; + int tn_vpstate; /* (i) */ /* misc data field for different tn_type node */ union { /* Valid when tn_type == VBLK || tn_type == VCHR. */ - dev_t tn_rdev; + dev_t tn_rdev; /* (c) */ /* Valid when tn_type == VDIR. */ struct tn_dir { - /* Pointer to the parent directory. The root + /* + * Pointer to the parent directory. The root * directory has a pointer to itself in this field; - * this property identifies the root node. */ + * this property identifies the root node. + */ struct tmpfs_node * tn_parent; - /* Head of a tree that links the contents of - * the directory together. */ + /* + * Head of a tree that links the contents of + * the directory together. + */ struct tmpfs_dir tn_dirhead; - /* Head of a list the contains fake directory entries + /* + * Head of a list the contains fake directory entries * heads, i.e. entries with TMPFS_DIRCOOKIE_DUPHEAD - * flag. */ + * flag. + */ struct tmpfs_dir_duphead tn_dupindex; - /* Number and pointer of the first directory entry + /* + * Number and pointer of the first directory entry * returned by the readdir operation if it were * called again to continue reading data from the * same directory as before. This is used to speed * up reads of long directories, assuming that no * more than one read is in progress at a given time. - * Otherwise, these values are discarded. */ + * Otherwise, these values are discarded. + */ off_t tn_readdir_lastn; struct tmpfs_dirent * tn_readdir_lastp; } tn_dir; /* Valid when tn_type == VLNK. */ /* The link's target, allocated from a string pool. */ - char * tn_link; + char * tn_link; /* (c) */ /* Valid when tn_type == VREG. */ struct tn_reg { - /* The contents of regular files stored in a tmpfs - * file system are represented by a single anonymous - * memory object (aobj, for short). The aobj provides - * direct access to any position within the file, - * because its contents are always mapped in a - * contiguous region of virtual memory. It is a task - * of the memory management subsystem (see uvm(9)) to - * issue the required page ins or page outs whenever - * a position within the file is accessed. */ - vm_object_t tn_aobj; - - }tn_reg; - }tn_spec; + /* + * The contents of regular files stored in a + * tmpfs file system are represented by a + * single anonymous memory object (aobj, for + * short). The aobj provides direct access to + * any position within the file. It is a task + * of the memory management subsystem to issue + * the required page ins or page outs whenever + * a position within the file is accessed. + */ + vm_object_t tn_aobj; /* (c) */ + } tn_reg; + } tn_spec; /* (v) */ }; LIST_HEAD(tmpfs_node_list, tmpfs_node); @@ -303,26 +333,32 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); * Internal representation of a tmpfs mount point. */ struct tmpfs_mount { - /* Maximum number of memory pages available for use by the file + /* + * Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of * free memory; in the extreme case, it will hold the ULONG_MAX - * value. */ + * value. + */ u_long tm_pages_max; /* Number of pages in use by the file system. */ u_long tm_pages_used; - /* Pointer to the node representing the root directory of this - * file system. */ + /* + * Pointer to the node representing the root directory of this + * file system. + */ struct tmpfs_node * tm_root; - /* Maximum number of possible nodes for this file system; set + /* + * Maximum number of possible nodes for this file system; set * during mount time. We need a hard limit on the maximum number * of nodes to avoid allocating too much of them; their objects * cannot be released until the file system is unmounted. * Otherwise, we could easily run out of memory by creating lots - * of empty files and then simply removing them. */ + * of empty files and then simply removing them. + */ ino_t tm_nodes_max; /* unrhdr used to allocate inode numbers */ @@ -334,27 +370,16 @@ struct tmpfs_mount { /* maximum representable file size */ u_int64_t tm_maxfilesize; - /* Nodes are organized in two different lists. The used list - * contains all nodes that are currently used by the file system; - * i.e., they refer to existing files. The available list contains - * all nodes that are currently available for use by new files. - * Nodes must be kept in this list (instead of deleting them) - * because we need to keep track of their generation number (tn_gen - * field). - * - * Note that nodes are lazily allocated: if the available list is - * empty and we have enough space to create more nodes, they will be - * created and inserted in the used list. Once these are released, - * they will go into the available list, remaining alive until the - * file system is unmounted. */ + /* + * The used list contains all nodes that are currently used by + * the file system; i.e., they refer to existing files. + */ struct tmpfs_node_list tm_nodes_used; - /* All node lock to protect the node list and tmp_pages_used */ + /* All node lock to protect the node list and tmp_pages_used. */ struct mtx allnode_lock; - /* Pools used to store file system meta data. These are not shared - * across several instances of tmpfs for the reasons described in - * tmpfs_pool.c. */ + /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; uma_zone_t tm_node_pool; @@ -444,10 +469,6 @@ int tmpfs_truncate(struct vnode *, off_t } while (0) /* - * Memory management stuff. - */ - -/* * Amount of memory pages to reserve for the system (e.g., to not use by * tmpfs). */ @@ -464,37 +485,34 @@ size_t tmpfs_pages_used(struct tmpfs_mou * specific ones. */ -static inline -struct tmpfs_mount * +static inline struct tmpfs_mount * VFS_TO_TMPFS(struct mount *mp) { struct tmpfs_mount *tmp; - MPASS((mp) != NULL && (mp)->mnt_data != NULL); - tmp = (struct tmpfs_mount *)(mp)->mnt_data; - return tmp; + MPASS(mp != NULL && mp->mnt_data != NULL); + tmp = (struct tmpfs_mount *)mp->mnt_data; + return (tmp); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_NODE(struct vnode *vp) { struct tmpfs_node *node; - MPASS((vp) != NULL && (vp)->v_data != NULL); + MPASS(vp != NULL && vp->v_data != NULL); node = (struct tmpfs_node *)vp->v_data; - return node; + return (node); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_DIR(struct vnode *vp) { struct tmpfs_node *node; node = VP_TO_TMPFS_NODE(vp); TMPFS_VALIDATE_DIR(node); - return node; + return (node); } #endif /* _FS_TMPFS_TMPFS_H_ */ Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:47:05 2017 (r312802) @@ -199,8 +199,8 @@ tmpfs_alloc_node(struct mount *mp, struc return (EBUSY); } - nnode = (struct tmpfs_node *)uma_zalloc_arg( - tmp->tm_node_pool, tmp, M_WAITOK); + nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, + M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -258,7 +258,8 @@ tmpfs_alloc_node(struct mount *mp, struc break; default: - panic("tmpfs_alloc_node: type %p %d", nnode, (int)nnode->tn_type); + panic("tmpfs_alloc_node: type %p %d", nnode, + (int)nnode->tn_type); } TMPFS_LOCK(tmp); @@ -267,25 +268,12 @@ tmpfs_alloc_node(struct mount *mp, struc TMPFS_UNLOCK(tmp); *node = nnode; - return 0; + return (0); } /* * Destroys the node pointed to by node from the file system 'tmp'. - * If the node does not belong to the given mount point, the results are - * unpredicted. - * - * If the node references a directory; no entries are allowed because - * their removal could need a recursive algorithm, something forbidden in - * kernel space. Furthermore, there is not need to provide such - * functionality (recursive removal) because the only primitives offered - * to the user are the removal of empty directories and the deletion of - * individual files. - * - * Note that nodes are not really deleted; in fact, when a node has been - * allocated, it cannot be deleted during the whole life of the file - * system. Instead, they are moved to the available list and remain there - * until reused. + * If the node references a directory, no entries are allowed. */ void tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) @@ -610,7 +598,7 @@ loop1: VN_LOCK_ASHARE(vp); error = insmntque1(vp, mp, tmpfs_insmntque_dtr, NULL); - if (error) + if (error != 0) vp = NULL; unlock: @@ -639,7 +627,7 @@ out: } #endif - return error; + return (error); } /* @@ -707,8 +695,8 @@ tmpfs_alloc_file(struct vnode *dvp, stru /* Allocate a node that represents the new file. */ error = tmpfs_alloc_node(dvp->v_mount, tmp, vap->va_type, - cnp->cn_cred->cr_uid, - dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, &node); + cnp->cn_cred->cr_uid, dnode->tn_gid, vap->va_mode, parent, + target, vap->va_rdev, &node); if (error != 0) return (error); @@ -1116,9 +1104,8 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod * Return ENOENT if the current node is already removed. */ TMPFS_ASSERT_LOCKED(node); - if (node->tn_dir.tn_parent == NULL) { + if (node->tn_dir.tn_parent == NULL) return (ENOENT); - } TMPFS_NODE_LOCK(node->tn_dir.tn_parent); dent.d_fileno = node->tn_dir.tn_parent->tn_id; Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:47:05 2017 (r312802) @@ -190,7 +190,7 @@ tmpfs_mount(struct mount *mp) /* Do not allow mounts if we do not have enough memory to preserve * the minimum reserved pages. */ if (tmpfs_mem_avail() < TMPFS_PAGES_MINRESERVED) - return ENOSPC; + return (ENOSPC); /* Get the maximum number of memory pages this file system is * allowed to use, based on the maximum size the user passed in @@ -229,27 +229,23 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_used = 0; tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", - sizeof(struct tmpfs_dirent), - NULL, NULL, NULL, NULL, + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); tmp->tm_node_pool = uma_zcreate("TMPFS node", - sizeof(struct tmpfs_node), - tmpfs_node_ctor, tmpfs_node_dtor, - tmpfs_node_init, tmpfs_node_fini, - UMA_ALIGN_PTR, 0); + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; /* Allocate the root node. */ - error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, - root_gid, root_mode & ALLPERMS, NULL, NULL, - VNOVAL, &root); + error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid, + root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); if (error != 0 || root == NULL) { - uma_zdestroy(tmp->tm_node_pool); - uma_zdestroy(tmp->tm_dirent_pool); - delete_unrhdr(tmp->tm_ino_unr); - free(tmp, M_TMPFSMNT); - return error; + uma_zdestroy(tmp->tm_node_pool); + uma_zdestroy(tmp->tm_dirent_pool); + delete_unrhdr(tmp->tm_ino_unr); + free(tmp, M_TMPFSMNT); + return (error); } KASSERT(root->tn_id == 2, ("tmpfs root with invalid ino: %ju", (uintmax_t)root->tn_id)); @@ -340,12 +336,11 @@ static int tmpfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; - error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); - if (!error) + error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); + if (error == 0) (*vpp)->v_vflag |= VV_ROOT; - - return error; + return (error); } static int Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:47:05 2017 (r312802) @@ -117,10 +117,12 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (de != NULL && de->td_node == NULL) cnp->cn_flags |= ISWHITEOUT; if (de == NULL || de->td_node == NULL) { - /* The entry was not found in the directory. + /* + * The entry was not found in the directory. * This is OK if we are creating or renaming an * entry and are working on the last component of - * the path name. */ + * the path name. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == CREATE || \ cnp->cn_nameiop == RENAME || @@ -132,8 +134,10 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (error != 0) goto out; - /* Keep the component name in the buffer for - * future uses. */ + /* + * Keep the component name in the buffer for + * future uses. + */ cnp->cn_flags |= SAVENAME; error = EJUSTRETURN; @@ -142,14 +146,18 @@ tmpfs_lookup(struct vop_cachedlookup_arg } else { struct tmpfs_node *tnode; - /* The entry was found, so get its associated - * tmpfs_node. */ + /* + * The entry was found, so get its associated + * tmpfs_node. + */ tnode = de->td_node; - /* If we are not at the last path component and + /* + * If we are not at the last path component and * found a non-directory or non-link entry (which * may itself be pointing to a directory), raise - * an error. */ + * an error. + */ if ((tnode->tn_type != VDIR && tnode->tn_type != VLNK) && !(cnp->cn_flags & ISLASTCN)) { @@ -157,9 +165,11 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; } - /* If we are deleting or renaming the entry, keep + /* + * If we are deleting or renaming the entry, keep * track of its tmpfs_dirent so that it can be - * easily deleted later. */ + * easily deleted later. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { @@ -175,8 +185,9 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; if ((dnode->tn_mode & S_ISTXT) && - VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, cnp->cn_thread) && - VOP_ACCESS(*vpp, VADMIN, cnp->cn_cred, cnp->cn_thread)) { + VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, + cnp->cn_thread) && VOP_ACCESS(*vpp, VADMIN, + cnp->cn_cred, cnp->cn_thread)) { error = EPERM; vput(*vpp); *vpp = NULL; @@ -192,18 +203,22 @@ tmpfs_lookup(struct vop_cachedlookup_arg } } - /* Store the result of this lookup in the cache. Avoid this if the + /* + * Store the result of this lookup in the cache. Avoid this if the * request was for creation, as it does not improve timings on - * emprical tests. */ + * emprical tests. + */ if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(dvp, *vpp, cnp); out: - /* If there were no errors, *vpp cannot be null and it must be - * locked. */ + /* + * If there were no errors, *vpp cannot be null and it must be + * locked. + */ MPASS(IFF(error == 0, *vpp != NULLVP && VOP_ISLOCKED(*vpp))); - return error; + return (error); } static int @@ -1390,7 +1405,7 @@ tmpfs_whiteout(struct vop_whiteout_args } /* - * vnode operations vector used for files stored in a tmpfs file system. + * Vnode operations vector used for files stored in a tmpfs file system. */ struct vop_vector tmpfs_vnodeop_entries = { .vop_default = &default_vnodeops, From owner-svn-src-stable@freebsd.org Thu Jan 26 10:49:46 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8C39CC17DB; Thu, 26 Jan 2017 10:49:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4EE1755; Thu, 26 Jan 2017 10:49:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAnjcs046082; Thu, 26 Jan 2017 10:49:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAnj4p046078; Thu, 26 Jan 2017 10:49:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261049.v0QAnj4p046078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312803 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:49:47 -0000 Author: kib Date: Thu Jan 26 10:49:45 2017 New Revision: 312803 URL: https://svnweb.freebsd.org/changeset/base/312803 Log: MFC r312409: Style fixes and comment updates. MFC r312435: Remove mistakenly merged field. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vfsops.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:49:45 2017 (r312803) @@ -80,8 +80,10 @@ struct tmpfs_dirent { uint32_t td_hash; u_int td_namelen; - /* Pointer to the node this entry refers to. In case this field - * is NULL, the node is a whiteout. */ + /* + * Pointer to the node this entry refers to. In case this field + * is NULL, the node is a whiteout. + */ struct tmpfs_node * td_node; union { @@ -94,21 +96,24 @@ struct tmpfs_dirent { } ud; }; -/* A directory in tmpfs holds a list of directory entries, which in - * turn point to other files (which can be directories themselves). +/* + * A directory in tmpfs holds a collection of directory entries, which + * in turn point to other files (which can be directories themselves). * - * In tmpfs, this list is managed by a RB-Tree, whose head is defined by - * the struct tmpfs_dir type. + * In tmpfs, this collection is managed by a RB-Tree, whose head is + * defined by the struct tmpfs_dir type. * * It is important to notice that directories do not have entries for . and * .. as other file systems do. These can be generated when requested * based on information available by other means, such as the pointer to * the node itself in the former case or the pointer to the parent directory * in the latter case. This is done to simplify tmpfs's code and, more - * importantly, to remove redundancy. */ + * importantly, to remove redundancy. + */ RB_HEAD(tmpfs_dir, tmpfs_dirent); -/* Each entry in a directory has a cookie that identifies it. Cookies +/* + * Each entry in a directory has a cookie that identifies it. Cookies * supersede offsets within directories because, given how tmpfs stores * directories in memory, there is no such thing as an offset. * @@ -139,51 +144,65 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * a particular type. The code must be careful to only access those * attributes that are actually allowed by the node's type. * - * * Below is the key of locks used to protected the fields in the following * structures. - * + * (v) vnode lock in exclusive mode + * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and + * tn_interlock + * (i) tn_interlock + * (m) tmpfs_mount allnode_lock + * (c) stable after creation */ struct tmpfs_node { - /* Doubly-linked list entry which links all existing nodes for a - * single file system. This is provided to ease the removal of - * all nodes during the unmount operation. */ - LIST_ENTRY(tmpfs_node) tn_entries; + /* + * Doubly-linked list entry which links all existing nodes for + * a single file system. This is provided to ease the removal + * of all nodes during the unmount operation, and to support + * the implementation of VOP_VNTOCNP(). + */ + LIST_ENTRY(tmpfs_node) tn_entries; /* (m) */ - /* The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', + /* + * The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', * 'VLNK', 'VREG' and 'VSOCK' is allowed. The usage of vnode * types instead of a custom enumeration is to make things simpler - * and faster, as we do not need to convert between two types. */ - enum vtype tn_type; + * and faster, as we do not need to convert between two types. + */ + enum vtype tn_type; /* (c) */ /* Node identifier. */ - ino_t tn_id; + ino_t tn_id; /* (c) */ - /* Node's internal status. This is used by several file system + /* + * Node's internal status. This is used by several file system * operations to do modifications to the node in a delayed - * fashion. */ - int tn_status; + * fashion. + */ + int tn_status; /* (vi) */ #define TMPFS_NODE_ACCESSED (1 << 1) #define TMPFS_NODE_MODIFIED (1 << 2) #define TMPFS_NODE_CHANGED (1 << 3) - /* The node size. It does not necessarily match the real amount - * of memory consumed by it. */ - off_t tn_size; + /* + * The node size. It does not necessarily match the real amount + * of memory consumed by it. + */ + off_t tn_size; /* (v) */ /* Generic node attributes. */ - uid_t tn_uid; - gid_t tn_gid; - mode_t tn_mode; - u_long tn_flags; - nlink_t tn_links; - struct timespec tn_atime; - struct timespec tn_mtime; - struct timespec tn_ctime; - struct timespec tn_birthtime; - unsigned long tn_gen; + uid_t tn_uid; /* (v) */ + gid_t tn_gid; /* (v) */ + mode_t tn_mode; /* (v) */ + u_long tn_flags; /* (v) */ + nlink_t tn_links; /* (v) */ + struct timespec tn_atime; /* (vi) */ + struct timespec tn_mtime; /* (vi) */ + struct timespec tn_ctime; /* (vi) */ + struct timespec tn_birthtime; /* (v) */ + unsigned long tn_gen; /* (c) */ - /* As there is a single vnode for each active file within the + /* + * As there is a single vnode for each active file within the * system, care has to be taken to avoid allocating more than one * vnode per file. In order to do this, a bidirectional association * is kept between vnodes and nodes. @@ -196,70 +215,81 @@ struct tmpfs_node { * tn_vnode. * * May be NULL when the node is unused (that is, no vnode has been - * allocated for it or it has been reclaimed). */ - struct vnode * tn_vnode; + * allocated for it or it has been reclaimed). + */ + struct vnode * tn_vnode; /* (i) */ - /* Interlock to protect tn_vpstate, and tn_status under shared + /* + * Interlock to protect tn_vpstate, and tn_status under shared * vnode lock. */ struct mtx tn_interlock; - /* Identify if current node has vnode assiocate with + /* + * Identify if current node has vnode assiocate with * or allocating vnode. */ - int tn_vpstate; + int tn_vpstate; /* (i) */ /* misc data field for different tn_type node */ union { /* Valid when tn_type == VBLK || tn_type == VCHR. */ - dev_t tn_rdev; + dev_t tn_rdev; /* (c) */ /* Valid when tn_type == VDIR. */ struct tn_dir { - /* Pointer to the parent directory. The root + /* + * Pointer to the parent directory. The root * directory has a pointer to itself in this field; - * this property identifies the root node. */ + * this property identifies the root node. + */ struct tmpfs_node * tn_parent; - /* Head of a tree that links the contents of - * the directory together. */ + /* + * Head of a tree that links the contents of + * the directory together. + */ struct tmpfs_dir tn_dirhead; - /* Head of a list the contains fake directory entries + /* + * Head of a list the contains fake directory entries * heads, i.e. entries with TMPFS_DIRCOOKIE_DUPHEAD - * flag. */ + * flag. + */ struct tmpfs_dir_duphead tn_dupindex; - /* Number and pointer of the first directory entry + /* + * Number and pointer of the first directory entry * returned by the readdir operation if it were * called again to continue reading data from the * same directory as before. This is used to speed * up reads of long directories, assuming that no * more than one read is in progress at a given time. - * Otherwise, these values are discarded. */ + * Otherwise, these values are discarded. + */ off_t tn_readdir_lastn; struct tmpfs_dirent * tn_readdir_lastp; } tn_dir; /* Valid when tn_type == VLNK. */ /* The link's target, allocated from a string pool. */ - char * tn_link; + char * tn_link; /* (c) */ /* Valid when tn_type == VREG. */ struct tn_reg { - /* The contents of regular files stored in a tmpfs - * file system are represented by a single anonymous - * memory object (aobj, for short). The aobj provides - * direct access to any position within the file, - * because its contents are always mapped in a - * contiguous region of virtual memory. It is a task - * of the memory management subsystem (see uvm(9)) to - * issue the required page ins or page outs whenever - * a position within the file is accessed. */ - vm_object_t tn_aobj; - - }tn_reg; - }tn_spec; + /* + * The contents of regular files stored in a + * tmpfs file system are represented by a + * single anonymous memory object (aobj, for + * short). The aobj provides direct access to + * any position within the file. It is a task + * of the memory management subsystem to issue + * the required page ins or page outs whenever + * a position within the file is accessed. + */ + vm_object_t tn_aobj; /* (c) */ + } tn_reg; + } tn_spec; /* (v) */ }; LIST_HEAD(tmpfs_node_list, tmpfs_node); @@ -303,26 +333,32 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); * Internal representation of a tmpfs mount point. */ struct tmpfs_mount { - /* Maximum number of memory pages available for use by the file + /* + * Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of * free memory; in the extreme case, it will hold the ULONG_MAX - * value. */ + * value. + */ u_long tm_pages_max; /* Number of pages in use by the file system. */ u_long tm_pages_used; - /* Pointer to the node representing the root directory of this - * file system. */ + /* + * Pointer to the node representing the root directory of this + * file system. + */ struct tmpfs_node * tm_root; - /* Maximum number of possible nodes for this file system; set + /* + * Maximum number of possible nodes for this file system; set * during mount time. We need a hard limit on the maximum number * of nodes to avoid allocating too much of them; their objects * cannot be released until the file system is unmounted. * Otherwise, we could easily run out of memory by creating lots - * of empty files and then simply removing them. */ + * of empty files and then simply removing them. + */ ino_t tm_nodes_max; /* unrhdr used to allocate inode numbers */ @@ -334,27 +370,16 @@ struct tmpfs_mount { /* maximum representable file size */ u_int64_t tm_maxfilesize; - /* Nodes are organized in two different lists. The used list - * contains all nodes that are currently used by the file system; - * i.e., they refer to existing files. The available list contains - * all nodes that are currently available for use by new files. - * Nodes must be kept in this list (instead of deleting them) - * because we need to keep track of their generation number (tn_gen - * field). - * - * Note that nodes are lazily allocated: if the available list is - * empty and we have enough space to create more nodes, they will be - * created and inserted in the used list. Once these are released, - * they will go into the available list, remaining alive until the - * file system is unmounted. */ + /* + * The used list contains all nodes that are currently used by + * the file system; i.e., they refer to existing files. + */ struct tmpfs_node_list tm_nodes_used; - /* All node lock to protect the node list and tmp_pages_used */ + /* All node lock to protect the node list and tmp_pages_used. */ struct mtx allnode_lock; - /* Pools used to store file system meta data. These are not shared - * across several instances of tmpfs for the reasons described in - * tmpfs_pool.c. */ + /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; uma_zone_t tm_node_pool; @@ -444,10 +469,6 @@ int tmpfs_truncate(struct vnode *, off_t } while (0) /* - * Memory management stuff. - */ - -/* * Amount of memory pages to reserve for the system (e.g., to not use by * tmpfs). */ @@ -464,37 +485,34 @@ size_t tmpfs_pages_used(struct tmpfs_mou * specific ones. */ -static inline -struct tmpfs_mount * +static inline struct tmpfs_mount * VFS_TO_TMPFS(struct mount *mp) { struct tmpfs_mount *tmp; - MPASS((mp) != NULL && (mp)->mnt_data != NULL); - tmp = (struct tmpfs_mount *)(mp)->mnt_data; - return tmp; + MPASS(mp != NULL && mp->mnt_data != NULL); + tmp = (struct tmpfs_mount *)mp->mnt_data; + return (tmp); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_NODE(struct vnode *vp) { struct tmpfs_node *node; - MPASS((vp) != NULL && (vp)->v_data != NULL); + MPASS(vp != NULL && vp->v_data != NULL); node = (struct tmpfs_node *)vp->v_data; - return node; + return (node); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_DIR(struct vnode *vp) { struct tmpfs_node *node; node = VP_TO_TMPFS_NODE(vp); TMPFS_VALIDATE_DIR(node); - return node; + return (node); } #endif /* _FS_TMPFS_TMPFS_H_ */ Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:49:45 2017 (r312803) @@ -198,8 +198,8 @@ tmpfs_alloc_node(struct mount *mp, struc return (EBUSY); } - nnode = (struct tmpfs_node *)uma_zalloc_arg( - tmp->tm_node_pool, tmp, M_WAITOK); + nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, + M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -257,7 +257,8 @@ tmpfs_alloc_node(struct mount *mp, struc break; default: - panic("tmpfs_alloc_node: type %p %d", nnode, (int)nnode->tn_type); + panic("tmpfs_alloc_node: type %p %d", nnode, + (int)nnode->tn_type); } TMPFS_LOCK(tmp); @@ -266,25 +267,12 @@ tmpfs_alloc_node(struct mount *mp, struc TMPFS_UNLOCK(tmp); *node = nnode; - return 0; + return (0); } /* * Destroys the node pointed to by node from the file system 'tmp'. - * If the node does not belong to the given mount point, the results are - * unpredicted. - * - * If the node references a directory; no entries are allowed because - * their removal could need a recursive algorithm, something forbidden in - * kernel space. Furthermore, there is not need to provide such - * functionality (recursive removal) because the only primitives offered - * to the user are the removal of empty directories and the deletion of - * individual files. - * - * Note that nodes are not really deleted; in fact, when a node has been - * allocated, it cannot be deleted during the whole life of the file - * system. Instead, they are moved to the available list and remain there - * until reused. + * If the node references a directory, no entries are allowed. */ void tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) @@ -609,7 +597,7 @@ loop1: VN_LOCK_ASHARE(vp); error = insmntque1(vp, mp, tmpfs_insmntque_dtr, NULL); - if (error) + if (error != 0) vp = NULL; unlock: @@ -638,7 +626,7 @@ out: } #endif - return error; + return (error); } /* @@ -706,8 +694,8 @@ tmpfs_alloc_file(struct vnode *dvp, stru /* Allocate a node that represents the new file. */ error = tmpfs_alloc_node(dvp->v_mount, tmp, vap->va_type, - cnp->cn_cred->cr_uid, - dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, &node); + cnp->cn_cred->cr_uid, dnode->tn_gid, vap->va_mode, parent, + target, vap->va_rdev, &node); if (error != 0) return (error); @@ -1115,9 +1103,8 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod * Return ENOENT if the current node is already removed. */ TMPFS_ASSERT_LOCKED(node); - if (node->tn_dir.tn_parent == NULL) { + if (node->tn_dir.tn_parent == NULL) return (ENOENT); - } TMPFS_NODE_LOCK(node->tn_dir.tn_parent); dent.d_fileno = node->tn_dir.tn_parent->tn_id; Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:49:45 2017 (r312803) @@ -189,7 +189,7 @@ tmpfs_mount(struct mount *mp) /* Do not allow mounts if we do not have enough memory to preserve * the minimum reserved pages. */ if (tmpfs_mem_avail() < TMPFS_PAGES_MINRESERVED) - return ENOSPC; + return (ENOSPC); /* Get the maximum number of memory pages this file system is * allowed to use, based on the maximum size the user passed in @@ -228,27 +228,23 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_used = 0; tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", - sizeof(struct tmpfs_dirent), - NULL, NULL, NULL, NULL, + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); tmp->tm_node_pool = uma_zcreate("TMPFS node", - sizeof(struct tmpfs_node), - tmpfs_node_ctor, tmpfs_node_dtor, - tmpfs_node_init, tmpfs_node_fini, - UMA_ALIGN_PTR, 0); + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; /* Allocate the root node. */ - error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, - root_gid, root_mode & ALLPERMS, NULL, NULL, - VNOVAL, &root); + error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid, + root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); if (error != 0 || root == NULL) { - uma_zdestroy(tmp->tm_node_pool); - uma_zdestroy(tmp->tm_dirent_pool); - delete_unrhdr(tmp->tm_ino_unr); - free(tmp, M_TMPFSMNT); - return error; + uma_zdestroy(tmp->tm_node_pool); + uma_zdestroy(tmp->tm_dirent_pool); + delete_unrhdr(tmp->tm_ino_unr); + free(tmp, M_TMPFSMNT); + return (error); } KASSERT(root->tn_id == 2, ("tmpfs root with invalid ino: %ju", (uintmax_t)root->tn_id)); @@ -338,12 +334,11 @@ static int tmpfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; - error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); - if (!error) + error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); + if (error == 0) (*vpp)->v_vflag |= VV_ROOT; - - return error; + return (error); } static int Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:49:45 2017 (r312803) @@ -117,10 +117,12 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (de != NULL && de->td_node == NULL) cnp->cn_flags |= ISWHITEOUT; if (de == NULL || de->td_node == NULL) { - /* The entry was not found in the directory. + /* + * The entry was not found in the directory. * This is OK if we are creating or renaming an * entry and are working on the last component of - * the path name. */ + * the path name. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == CREATE || \ cnp->cn_nameiop == RENAME || @@ -132,8 +134,10 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (error != 0) goto out; - /* Keep the component name in the buffer for - * future uses. */ + /* + * Keep the component name in the buffer for + * future uses. + */ cnp->cn_flags |= SAVENAME; error = EJUSTRETURN; @@ -142,14 +146,18 @@ tmpfs_lookup(struct vop_cachedlookup_arg } else { struct tmpfs_node *tnode; - /* The entry was found, so get its associated - * tmpfs_node. */ + /* + * The entry was found, so get its associated + * tmpfs_node. + */ tnode = de->td_node; - /* If we are not at the last path component and + /* + * If we are not at the last path component and * found a non-directory or non-link entry (which * may itself be pointing to a directory), raise - * an error. */ + * an error. + */ if ((tnode->tn_type != VDIR && tnode->tn_type != VLNK) && !(cnp->cn_flags & ISLASTCN)) { @@ -157,9 +165,11 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; } - /* If we are deleting or renaming the entry, keep + /* + * If we are deleting or renaming the entry, keep * track of its tmpfs_dirent so that it can be - * easily deleted later. */ + * easily deleted later. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { @@ -175,8 +185,9 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; if ((dnode->tn_mode & S_ISTXT) && - VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, cnp->cn_thread) && - VOP_ACCESS(*vpp, VADMIN, cnp->cn_cred, cnp->cn_thread)) { + VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, + cnp->cn_thread) && VOP_ACCESS(*vpp, VADMIN, + cnp->cn_cred, cnp->cn_thread)) { error = EPERM; vput(*vpp); *vpp = NULL; @@ -192,18 +203,22 @@ tmpfs_lookup(struct vop_cachedlookup_arg } } - /* Store the result of this lookup in the cache. Avoid this if the + /* + * Store the result of this lookup in the cache. Avoid this if the * request was for creation, as it does not improve timings on - * emprical tests. */ + * emprical tests. + */ if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(dvp, *vpp, cnp); out: - /* If there were no errors, *vpp cannot be null and it must be - * locked. */ + /* + * If there were no errors, *vpp cannot be null and it must be + * locked. + */ MPASS(IFF(error == 0, *vpp != NULLVP && VOP_ISLOCKED(*vpp))); - return error; + return (error); } static int @@ -1386,7 +1401,7 @@ tmpfs_whiteout(struct vop_whiteout_args } /* - * vnode operations vector used for files stored in a tmpfs file system. + * Vnode operations vector used for files stored in a tmpfs file system. */ struct vop_vector tmpfs_vnodeop_entries = { .vop_default = &default_vnodeops, From owner-svn-src-stable@freebsd.org Thu Jan 26 10:53:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D08E0CC1A61; Thu, 26 Jan 2017 10:53:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E9E71C0F; Thu, 26 Jan 2017 10:53:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAr5gg050139; Thu, 26 Jan 2017 10:53:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAr5WU050136; Thu, 26 Jan 2017 10:53:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261053.v0QAr5WU050136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312804 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:53:06 -0000 Author: kib Date: Thu Jan 26 10:53:05 2017 New Revision: 312804 URL: https://svnweb.freebsd.org/changeset/base/312804 Log: MFC r312410: Rework some tmpfs lock assertions. MFC r312412: Protect macro argument. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:49:45 2017 (r312803) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:53:05 2017 (r312804) @@ -307,21 +307,12 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #ifdef INVARIANTS #define TMPFS_ASSERT_LOCKED(node) do { \ - MPASS(node != NULL); \ - MPASS(node->tn_vnode != NULL); \ - if (!VOP_ISLOCKED(node->tn_vnode) && \ - !mtx_owned(TMPFS_NODE_MTX(node))) \ - panic("tmpfs: node is not locked: %p", node); \ - } while (0) -#define TMPFS_ASSERT_ELOCKED(node) do { \ MPASS((node) != NULL); \ MPASS((node)->tn_vnode != NULL); \ - mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \ - ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs"); \ + ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs assert"); \ } while (0) #else #define TMPFS_ASSERT_LOCKED(node) (void)0 -#define TMPFS_ASSERT_ELOCKED(node) (void)0 #endif #define TMPFS_VNODE_ALLOCATING 1 Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:49:45 2017 (r312803) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:53:05 2017 (r312804) @@ -670,7 +670,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru struct tmpfs_node *node; struct tmpfs_node *parent; - MPASS(VOP_ISLOCKED(dvp)); + ASSERT_VOP_ELOCKED(dvp, "tmpfs_alloc_file"); MPASS(cnp->cn_flags & HASBUF); tmp = VFS_TO_TMPFS(dvp->v_mount); Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:49:45 2017 (r312803) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:53:05 2017 (r312804) @@ -1111,7 +1111,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) /* No vnode should be allocated for this entry from this point */ TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); node->tn_links--; node->tn_dir.tn_parent = NULL; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | @@ -1120,7 +1119,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) TMPFS_NODE_UNLOCK(node); TMPFS_NODE_LOCK(dnode); - TMPFS_ASSERT_ELOCKED(dnode); dnode->tn_links--; dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; @@ -1274,7 +1272,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v cache_purge(vp); TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); tmpfs_free_vp(vp); /* If the node referenced by this vnode was deleted by the user, From owner-svn-src-stable@freebsd.org Thu Jan 26 10:55:58 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C623CC1B39; Thu, 26 Jan 2017 10:55:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8481D85; Thu, 26 Jan 2017 10:55:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAtvee050308; Thu, 26 Jan 2017 10:55:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAtvNp050305; Thu, 26 Jan 2017 10:55:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261055.v0QAtvNp050305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312805 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:55:58 -0000 Author: kib Date: Thu Jan 26 10:55:56 2017 New Revision: 312805 URL: https://svnweb.freebsd.org/changeset/base/312805 Log: MFC r312410: Rework some tmpfs lock assertions. MFC r312412: Protect macro argument. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:53:05 2017 (r312804) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:55:56 2017 (r312805) @@ -307,21 +307,12 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #ifdef INVARIANTS #define TMPFS_ASSERT_LOCKED(node) do { \ - MPASS(node != NULL); \ - MPASS(node->tn_vnode != NULL); \ - if (!VOP_ISLOCKED(node->tn_vnode) && \ - !mtx_owned(TMPFS_NODE_MTX(node))) \ - panic("tmpfs: node is not locked: %p", node); \ - } while (0) -#define TMPFS_ASSERT_ELOCKED(node) do { \ MPASS((node) != NULL); \ MPASS((node)->tn_vnode != NULL); \ - mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \ - ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs"); \ + ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs assert"); \ } while (0) #else #define TMPFS_ASSERT_LOCKED(node) (void)0 -#define TMPFS_ASSERT_ELOCKED(node) (void)0 #endif #define TMPFS_VNODE_ALLOCATING 1 Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:53:05 2017 (r312804) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:55:56 2017 (r312805) @@ -669,7 +669,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru struct tmpfs_node *node; struct tmpfs_node *parent; - MPASS(VOP_ISLOCKED(dvp)); + ASSERT_VOP_ELOCKED(dvp, "tmpfs_alloc_file"); MPASS(cnp->cn_flags & HASBUF); tmp = VFS_TO_TMPFS(dvp->v_mount); Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:53:05 2017 (r312804) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:55:56 2017 (r312805) @@ -1107,7 +1107,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) /* No vnode should be allocated for this entry from this point */ TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); node->tn_links--; node->tn_dir.tn_parent = NULL; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | @@ -1116,7 +1115,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) TMPFS_NODE_UNLOCK(node); TMPFS_NODE_LOCK(dnode); - TMPFS_ASSERT_ELOCKED(dnode); dnode->tn_links--; dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; @@ -1270,7 +1268,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v cache_purge(vp); TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); tmpfs_free_vp(vp); /* If the node referenced by this vnode was deleted by the user, From owner-svn-src-stable@freebsd.org Thu Jan 26 10:58:14 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E437CC1BE1; Thu, 26 Jan 2017 10:58:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C4811EFC; Thu, 26 Jan 2017 10:58:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAwD4e050439; Thu, 26 Jan 2017 10:58:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAwDFK050437; Thu, 26 Jan 2017 10:58:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261058.v0QAwDFK050437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:58:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312806 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 10:58:14 -0000 Author: kib Date: Thu Jan 26 10:58:12 2017 New Revision: 312806 URL: https://svnweb.freebsd.org/changeset/base/312806 Log: MFC r312414: Rename tmpfs_mount member allnode_lock to include namespace prefix. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:55:56 2017 (r312805) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:58:12 2017 (r312806) @@ -150,7 +150,7 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and * tn_interlock * (i) tn_interlock - * (m) tmpfs_mount allnode_lock + * (m) tmpfs_mount tm_allnode_lock * (c) stable after creation */ struct tmpfs_node { @@ -368,7 +368,7 @@ struct tmpfs_mount { struct tmpfs_node_list tm_nodes_used; /* All node lock to protect the node list and tmp_pages_used. */ - struct mtx allnode_lock; + struct mtx tm_allnode_lock; /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; @@ -377,8 +377,9 @@ struct tmpfs_mount { /* Read-only status. */ int tm_ronly; }; -#define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock) -#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock) +#define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock) +#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock) +#define TMPFS_MP_ASSERT_LOCKED(tm) mtx_assert(&(tm)->tm_allnode_lock, MA_OWNED) /* * This structure maps a file identifier to a tmpfs node. Used by the Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:55:56 2017 (r312805) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:58:12 2017 (r312806) @@ -219,7 +219,7 @@ tmpfs_mount(struct mount *mp) tmp = (struct tmpfs_mount *)malloc(sizeof(struct tmpfs_mount), M_TMPFSMNT, M_WAITOK | M_ZERO); - mtx_init(&tmp->allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); + mtx_init(&tmp->tm_allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); tmp->tm_nodes_max = nodes_max; tmp->tm_nodes_inuse = 0; tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX; @@ -227,7 +227,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_max = pages; tmp->tm_pages_used = 0; - tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); + tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -316,7 +316,7 @@ tmpfs_unmount(struct mount *mp, int mntf uma_zdestroy(tmp->tm_node_pool); delete_unrhdr(tmp->tm_ino_unr); - mtx_destroy(&tmp->allnode_lock); + mtx_destroy(&tmp->tm_allnode_lock); MPASS(tmp->tm_pages_used == 0); MPASS(tmp->tm_nodes_inuse == 0); From owner-svn-src-stable@freebsd.org Thu Jan 26 11:00:58 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90B7BCC1D11; Thu, 26 Jan 2017 11:00:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1FB24D; Thu, 26 Jan 2017 11:00:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QB0vm0050797; Thu, 26 Jan 2017 11:00:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB0vfv050795; Thu, 26 Jan 2017 11:00:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261100.v0QB0vfv050795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312807 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 11:00:58 -0000 Author: kib Date: Thu Jan 26 11:00:57 2017 New Revision: 312807 URL: https://svnweb.freebsd.org/changeset/base/312807 Log: MFC r312414: Rename tmpfs_mount member allnode_lock to include namespace prefix. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:58:12 2017 (r312806) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:00:57 2017 (r312807) @@ -150,7 +150,7 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and * tn_interlock * (i) tn_interlock - * (m) tmpfs_mount allnode_lock + * (m) tmpfs_mount tm_allnode_lock * (c) stable after creation */ struct tmpfs_node { @@ -368,7 +368,7 @@ struct tmpfs_mount { struct tmpfs_node_list tm_nodes_used; /* All node lock to protect the node list and tmp_pages_used. */ - struct mtx allnode_lock; + struct mtx tm_allnode_lock; /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; @@ -377,8 +377,9 @@ struct tmpfs_mount { /* Read-only status. */ int tm_ronly; }; -#define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock) -#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock) +#define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock) +#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock) +#define TMPFS_MP_ASSERT_LOCKED(tm) mtx_assert(&(tm)->tm_allnode_lock, MA_OWNED) /* * This structure maps a file identifier to a tmpfs node. Used by the Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:58:12 2017 (r312806) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 11:00:57 2017 (r312807) @@ -218,7 +218,7 @@ tmpfs_mount(struct mount *mp) tmp = (struct tmpfs_mount *)malloc(sizeof(struct tmpfs_mount), M_TMPFSMNT, M_WAITOK | M_ZERO); - mtx_init(&tmp->allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); + mtx_init(&tmp->tm_allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); tmp->tm_nodes_max = nodes_max; tmp->tm_nodes_inuse = 0; tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX; @@ -226,7 +226,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_max = pages; tmp->tm_pages_used = 0; - tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); + tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -314,7 +314,7 @@ tmpfs_unmount(struct mount *mp, int mntf uma_zdestroy(tmp->tm_node_pool); delete_unrhdr(tmp->tm_ino_unr); - mtx_destroy(&tmp->allnode_lock); + mtx_destroy(&tmp->tm_allnode_lock); MPASS(tmp->tm_pages_used == 0); MPASS(tmp->tm_nodes_inuse == 0); From owner-svn-src-stable@freebsd.org Thu Jan 26 11:03:21 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E3F5CC1ED0; Thu, 26 Jan 2017 11:03:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EE90882; Thu, 26 Jan 2017 11:03:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QB3KHd054513; Thu, 26 Jan 2017 11:03:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB3Kih054511; Thu, 26 Jan 2017 11:03:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261103.v0QB3Kih054511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:03:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312808 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 11:03:21 -0000 Author: kib Date: Thu Jan 26 11:03:19 2017 New Revision: 312808 URL: https://svnweb.freebsd.org/changeset/base/312808 Log: MFC r312425: Make tmpfs directory cursor available outside tmpfs_subr.c. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:00:57 2017 (r312807) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:03:19 2017 (r312808) @@ -392,6 +392,11 @@ struct tmpfs_fid { unsigned long tf_gen; }; +struct tmpfs_dir_cursor { + struct tmpfs_dirent *tdc_current; + struct tmpfs_dirent *tdc_tree; +}; + #ifdef _KERNEL /* * Prototypes for tmpfs_subr.c. @@ -436,6 +441,10 @@ void tmpfs_itimes(struct vnode *, const void tmpfs_set_status(struct tmpfs_node *node, int status); void tmpfs_update(struct vnode *); int tmpfs_truncate(struct vnode *, off_t); +struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); +struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); /* * Convenience macros to simplify some logical expressions. Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:00:57 2017 (r312807) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:03:19 2017 (r312808) @@ -62,11 +62,6 @@ __FBSDID("$FreeBSD$"); #include #include -struct tmpfs_dir_cursor { - struct tmpfs_dirent *tdc_current; - struct tmpfs_dirent *tdc_tree; -}; - SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system"); static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; @@ -725,7 +720,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru return (0); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; @@ -739,7 +734,7 @@ tmpfs_dir_first(struct tmpfs_node *dnode return (dc->tdc_current); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_next(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; From owner-svn-src-stable@freebsd.org Thu Jan 26 11:04:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFDEACC1F51; Thu, 26 Jan 2017 11:04:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72C7A9D5; Thu, 26 Jan 2017 11:04:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QB4RRE054605; Thu, 26 Jan 2017 11:04:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB4RYA054603; Thu, 26 Jan 2017 11:04:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261104.v0QB4RYA054603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312809 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 11:04:28 -0000 Author: kib Date: Thu Jan 26 11:04:27 2017 New Revision: 312809 URL: https://svnweb.freebsd.org/changeset/base/312809 Log: MFC r312425: Make tmpfs directory cursor available outside tmpfs_subr.c. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:03:19 2017 (r312808) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:04:27 2017 (r312809) @@ -392,6 +392,11 @@ struct tmpfs_fid { unsigned long tf_gen; }; +struct tmpfs_dir_cursor { + struct tmpfs_dirent *tdc_current; + struct tmpfs_dirent *tdc_tree; +}; + #ifdef _KERNEL /* * Prototypes for tmpfs_subr.c. @@ -436,6 +441,10 @@ void tmpfs_itimes(struct vnode *, const void tmpfs_set_status(struct tmpfs_node *node, int status); void tmpfs_update(struct vnode *); int tmpfs_truncate(struct vnode *, off_t); +struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); +struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); /* * Convenience macros to simplify some logical expressions. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:03:19 2017 (r312808) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:04:27 2017 (r312809) @@ -61,11 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -struct tmpfs_dir_cursor { - struct tmpfs_dirent *tdc_current; - struct tmpfs_dirent *tdc_tree; -}; - SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system"); static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; @@ -724,7 +719,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru return (0); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; @@ -738,7 +733,7 @@ tmpfs_dir_first(struct tmpfs_node *dnode return (dc->tdc_current); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_next(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; From owner-svn-src-stable@freebsd.org Thu Jan 26 11:06:40 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68119CC203A; Thu, 26 Jan 2017 11:06:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4008FB65; Thu, 26 Jan 2017 11:06:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QB6dRd054733; Thu, 26 Jan 2017 11:06:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB6dVW054732; Thu, 26 Jan 2017 11:06:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261106.v0QB6dVW054732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312810 - stable/11/share/man/man5 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 11:06:40 -0000 Author: kib Date: Thu Jan 26 11:06:39 2017 New Revision: 312810 URL: https://svnweb.freebsd.org/changeset/base/312810 Log: MFC r312423: Refresh tmpfs(5) man page. MFC r312648: Editing and clarifications for tmpfs(5). Modified: stable/11/share/man/man5/tmpfs.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man5/tmpfs.5 ============================================================================== --- stable/11/share/man/man5/tmpfs.5 Thu Jan 26 11:04:27 2017 (r312809) +++ stable/11/share/man/man5/tmpfs.5 Thu Jan 26 11:06:39 2017 (r312810) @@ -1,7 +1,12 @@ .\"- .\" Copyright (c) 2007 Xin LI +.\" Copyright (c) 2017 The FreeBSD Foundation, Inc. .\" All rights reserved. .\" +.\" Part of this documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -49,12 +54,12 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2012 +.Dd January 17, 2017 .Dt TMPFS 5 .Os .Sh NAME .Nm tmpfs -.Nd "efficient memory file system" +.Nd "in-memory file system" .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your @@ -72,17 +77,40 @@ tmpfs_load="YES" .Sh DESCRIPTION The .Nm -driver will permit the -.Fx -kernel to access +driver implements an in-memory, or .Tn tmpfs -file systems. +file system. +The filesystem stores both file metadata and data in main memory. +This allows very fast and low latency accesses to the data. +The data is volatile. +An umount or system reboot invalidates it. +These properties make the filesystem's mounts suitable for fast +scratch storage, like +.Pa /tmp . +.Pp +If the system becomes low on memory and swap is configured (see +.Xr swapon 8 ), +the system can transfer file data to swap space, freeing memory +for other needs. +Metadata, including the directory content, is never swapped out by the +current implementation. +Keep this in mind when planning the mount limits, especially when expecting +to place many small files on a tmpfs mount. +.Pp +When +.Xr mmap 2 +is used on a file from a tmpfs mount, the swap VM object managing the +file pages is used to implement mapping and avoid double-copying of +the file data. +This quirk causes process inspection tools, like +.Xr procstat 1 , +to report anonymous memory mappings instead of file mappings. .Sh OPTIONS The following options are available when mounting .Nm file systems: -.Bl -tag -width indent +.Bl -tag -width "It Cm maxfilesize" .It Cm gid Specifies the group ID of the root inode of the file system. Defaults to the mount point's GID. @@ -114,11 +142,15 @@ memory file system: .Pp .Dl "mount -t tmpfs tmpfs /tmp" .Sh SEE ALSO +.Xr procstat 1 , .Xr nmount 2 , +.Xr mmap 2 , .Xr unmount 2 , .Xr fstab 5 , .Xr mdmfs 8 , -.Xr mount 8 +.Xr mount 8 , +.Xr swapinfo 8 , +.Xr swapon 8 .Sh HISTORY The .Nm @@ -130,7 +162,7 @@ The .Nm kernel implementation was written by .An Julio M. Merino Vidal Aq Mt jmmv@NetBSD.org -as a Google SoC project. +as a Google Summer of Code project. .Pp .An Rohit Jalan and others ported it from @@ -140,5 +172,3 @@ to .Pp This manual page was written by .An Xin LI Aq Mt delphij@FreeBSD.org . -.Sh BUGS -Some file system mount time options may not be well-supported. From owner-svn-src-stable@freebsd.org Thu Jan 26 11:07:37 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1016CC20DB; Thu, 26 Jan 2017 11:07:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9015CBE; Thu, 26 Jan 2017 11:07:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QB7aBC054824; Thu, 26 Jan 2017 11:07:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB7aQO054823; Thu, 26 Jan 2017 11:07:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261107.v0QB7aQO054823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312811 - stable/10/share/man/man5 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 11:07:38 -0000 Author: kib Date: Thu Jan 26 11:07:36 2017 New Revision: 312811 URL: https://svnweb.freebsd.org/changeset/base/312811 Log: MFC r312423: Refresh tmpfs(5) man page. MFC r312648: Editing and clarifications for tmpfs(5). Modified: stable/10/share/man/man5/tmpfs.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man5/tmpfs.5 ============================================================================== --- stable/10/share/man/man5/tmpfs.5 Thu Jan 26 11:06:39 2017 (r312810) +++ stable/10/share/man/man5/tmpfs.5 Thu Jan 26 11:07:36 2017 (r312811) @@ -1,7 +1,12 @@ .\"- .\" Copyright (c) 2007 Xin LI +.\" Copyright (c) 2017 The FreeBSD Foundation, Inc. .\" All rights reserved. .\" +.\" Part of this documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -49,12 +54,12 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2012 +.Dd January 17, 2017 .Dt TMPFS 5 .Os .Sh NAME .Nm tmpfs -.Nd "efficient memory file system" +.Nd "in-memory file system" .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your @@ -72,17 +77,40 @@ tmpfs_load="YES" .Sh DESCRIPTION The .Nm -driver will permit the -.Fx -kernel to access +driver implements an in-memory, or .Tn tmpfs -file systems. +file system. +The filesystem stores both file metadata and data in main memory. +This allows very fast and low latency accesses to the data. +The data is volatile. +An umount or system reboot invalidates it. +These properties make the filesystem's mounts suitable for fast +scratch storage, like +.Pa /tmp . +.Pp +If the system becomes low on memory and swap is configured (see +.Xr swapon 8 ), +the system can transfer file data to swap space, freeing memory +for other needs. +Metadata, including the directory content, is never swapped out by the +current implementation. +Keep this in mind when planning the mount limits, especially when expecting +to place many small files on a tmpfs mount. +.Pp +When +.Xr mmap 2 +is used on a file from a tmpfs mount, the swap VM object managing the +file pages is used to implement mapping and avoid double-copying of +the file data. +This quirk causes process inspection tools, like +.Xr procstat 1 , +to report anonymous memory mappings instead of file mappings. .Sh OPTIONS The following options are available when mounting .Nm file systems: -.Bl -tag -width indent +.Bl -tag -width "It Cm maxfilesize" .It Cm gid Specifies the group ID of the root inode of the file system. Defaults to the mount point's GID. @@ -114,11 +142,15 @@ memory file system: .Pp .Dl "mount -t tmpfs tmpfs /tmp" .Sh SEE ALSO +.Xr procstat 1 , .Xr nmount 2 , +.Xr mmap 2 , .Xr unmount 2 , .Xr fstab 5 , .Xr mdmfs 8 , -.Xr mount 8 +.Xr mount 8 , +.Xr swapinfo 8 , +.Xr swapon 8 .Sh HISTORY The .Nm @@ -130,7 +162,7 @@ The .Nm kernel implementation was written by .An Julio M. Merino Vidal Aq jmmv@NetBSD.org -as a Google SoC project. +as a Google Summer of Code project. .Pp .An Rohit Jalan and others ported it from @@ -140,5 +172,3 @@ to .Pp This manual page was written by .An Xin LI Aq delphij@FreeBSD.org . -.Sh BUGS -Some file system mount time options may not be well-supported. From owner-svn-src-stable@freebsd.org Thu Jan 26 16:38:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2065BCC33B1; Thu, 26 Jan 2017 16:38:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA280126D; Thu, 26 Jan 2017 16:38:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QGcrGn091533; Thu, 26 Jan 2017 16:38:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QGcroW091532; Thu, 26 Jan 2017 16:38:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701261638.v0QGcroW091532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 26 Jan 2017 16:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312819 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 16:38:55 -0000 Author: avg Date: Thu Jan 26 16:38:53 2017 New Revision: 312819 URL: https://svnweb.freebsd.org/changeset/base/312819 Log: MFC r312532: don't abort writing of a core dump after EFAULT Note that this change substantially differs from the change in head because of an unmerged earlier change that probably can not be merged for POLA reasons. Modified: stable/10/sys/kern/imgact_elf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/imgact_elf.c ============================================================================== --- stable/10/sys/kern/imgact_elf.c Thu Jan 26 16:36:12 2017 (r312818) +++ stable/10/sys/kern/imgact_elf.c Thu Jan 26 16:38:53 2017 (r312819) @@ -1176,9 +1176,31 @@ core_output(struct vnode *vp, void *base panic("shouldn't be here"); #endif } else { + /* + * EFAULT is a non-fatal error that we can get, for example, + * if the segment is backed by a file but extends beyond its + * end. + */ error = vn_rdwr_inchunks(UIO_WRITE, vp, base, len, offset, UIO_USERSPACE, IO_UNIT | IO_DIRECT, active_cred, file_cred, NULL, td); + if (error == EFAULT) { + log(LOG_WARNING, "Failed to fully fault in a core file " + "segment at VA %p with size 0x%zx to be written at " + "offset 0x%jx for process %s\n", base, len, offset, + curproc->p_comm); + + /* + * Write a "real" zero byte at the end of the target + * region in the case this is the last segment. + * The intermediate space will be implicitly + * zero-filled. + */ + error = vn_rdwr_inchunks(UIO_WRITE, vp, + __DECONST(void *, zero_region), 1, offset + len - 1, + UIO_SYSSPACE, IO_UNIT | IO_DIRECT, active_cred, + file_cred, NULL, td); + } } return (error); } @@ -2309,7 +2331,16 @@ compress_core (gzFile file, char *inbuf, while (len) { if (inbuf != NULL) { chunk_len = (len > CORE_BUF_SIZE) ? CORE_BUF_SIZE : len; - copyin(inbuf, dest_buf, chunk_len); + + /* + * We can get EFAULT error here. In that case zero out + * the current chunk of the segment. + */ + error = copyin(inbuf, dest_buf, chunk_len); + if (error != 0) { + bzero(dest_buf, chunk_len); + error = 0; + } inbuf += chunk_len; } else { chunk_len = len; From owner-svn-src-stable@freebsd.org Thu Jan 26 19:14:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19891CC305B; Thu, 26 Jan 2017 19:14:19 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A082B6C6; Thu, 26 Jan 2017 19:14:18 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QJEHkF059605; Thu, 26 Jan 2017 19:14:17 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QJEElY059576; Thu, 26 Jan 2017 19:14:14 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701261914.v0QJEElY059576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 19:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312826 - in stable/11: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bn crypto/openssl/crypto/... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 19:14:19 -0000 Author: jkim Date: Thu Jan 26 19:14:14 2017 New Revision: 312826 URL: https://svnweb.freebsd.org/changeset/base/312826 Log: MFC: r312825 Merge OpenSSL 1.0.2k. Modified: stable/11/crypto/openssl/CHANGES stable/11/crypto/openssl/CONTRIBUTING stable/11/crypto/openssl/Configure stable/11/crypto/openssl/INSTALL stable/11/crypto/openssl/Makefile stable/11/crypto/openssl/Makefile.org stable/11/crypto/openssl/NEWS stable/11/crypto/openssl/README stable/11/crypto/openssl/apps/apps.c stable/11/crypto/openssl/apps/apps.h stable/11/crypto/openssl/apps/ca.c stable/11/crypto/openssl/apps/cms.c stable/11/crypto/openssl/apps/dgst.c stable/11/crypto/openssl/apps/dh.c stable/11/crypto/openssl/apps/dhparam.c stable/11/crypto/openssl/apps/dsa.c stable/11/crypto/openssl/apps/dsaparam.c stable/11/crypto/openssl/apps/ec.c stable/11/crypto/openssl/apps/ecparam.c stable/11/crypto/openssl/apps/enc.c stable/11/crypto/openssl/apps/gendh.c stable/11/crypto/openssl/apps/gendsa.c stable/11/crypto/openssl/apps/genpkey.c stable/11/crypto/openssl/apps/genrsa.c stable/11/crypto/openssl/apps/pkcs12.c stable/11/crypto/openssl/apps/pkcs7.c stable/11/crypto/openssl/apps/pkcs8.c stable/11/crypto/openssl/apps/pkey.c stable/11/crypto/openssl/apps/pkeyparam.c stable/11/crypto/openssl/apps/pkeyutl.c stable/11/crypto/openssl/apps/prime.c stable/11/crypto/openssl/apps/rand.c stable/11/crypto/openssl/apps/req.c stable/11/crypto/openssl/apps/rsa.c stable/11/crypto/openssl/apps/rsautl.c stable/11/crypto/openssl/apps/s_cb.c stable/11/crypto/openssl/apps/s_client.c stable/11/crypto/openssl/apps/s_server.c stable/11/crypto/openssl/apps/smime.c stable/11/crypto/openssl/apps/speed.c stable/11/crypto/openssl/apps/spkac.c stable/11/crypto/openssl/apps/srp.c stable/11/crypto/openssl/apps/verify.c stable/11/crypto/openssl/apps/x509.c stable/11/crypto/openssl/crypto/aes/asm/aes-s390x.pl stable/11/crypto/openssl/crypto/asn1/p5_pbev2.c stable/11/crypto/openssl/crypto/asn1/x_crl.c stable/11/crypto/openssl/crypto/bn/asm/x86_64-mont.pl stable/11/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl stable/11/crypto/openssl/crypto/bn/bn_exp.c stable/11/crypto/openssl/crypto/bn/bn_mul.c stable/11/crypto/openssl/crypto/bn/bn_prime.c stable/11/crypto/openssl/crypto/bn/bn_sqr.c stable/11/crypto/openssl/crypto/cms/cms_kari.c stable/11/crypto/openssl/crypto/dh/dh_key.c stable/11/crypto/openssl/crypto/dsa/dsa_pmeth.c stable/11/crypto/openssl/crypto/ec/ec2_mult.c stable/11/crypto/openssl/crypto/ecdh/ech_ossl.c stable/11/crypto/openssl/crypto/err/err.c stable/11/crypto/openssl/crypto/evp/e_aes.c stable/11/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c stable/11/crypto/openssl/crypto/evp/evp.h stable/11/crypto/openssl/crypto/evp/evp_err.c stable/11/crypto/openssl/crypto/evp/pmeth_fn.c stable/11/crypto/openssl/crypto/evp/pmeth_lib.c stable/11/crypto/openssl/crypto/modes/ctr128.c stable/11/crypto/openssl/crypto/opensslv.h stable/11/crypto/openssl/crypto/perlasm/x86_64-xlate.pl stable/11/crypto/openssl/crypto/rsa/rsa_gen.c stable/11/crypto/openssl/crypto/rsa/rsa_oaep.c stable/11/crypto/openssl/crypto/rsa/rsa_pmeth.c stable/11/crypto/openssl/crypto/s390xcap.c stable/11/crypto/openssl/crypto/ui/ui_lib.c stable/11/crypto/openssl/crypto/ui/ui_openssl.c stable/11/crypto/openssl/doc/apps/ocsp.pod stable/11/crypto/openssl/doc/crypto/EVP_DigestSignInit.pod stable/11/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod stable/11/crypto/openssl/doc/crypto/RSA_generate_key.pod stable/11/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod stable/11/crypto/openssl/doc/crypto/X509_NAME_print_ex.pod stable/11/crypto/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod stable/11/crypto/openssl/doc/ssl/SSL_get_error.pod stable/11/crypto/openssl/doc/ssl/SSL_read.pod stable/11/crypto/openssl/doc/ssl/SSL_write.pod stable/11/crypto/openssl/engines/ccgost/Makefile stable/11/crypto/openssl/ssl/bad_dtls_test.c stable/11/crypto/openssl/ssl/s23_pkt.c stable/11/crypto/openssl/ssl/s2_lib.c stable/11/crypto/openssl/ssl/s2_pkt.c stable/11/crypto/openssl/ssl/s3_clnt.c stable/11/crypto/openssl/ssl/s3_pkt.c stable/11/crypto/openssl/ssl/s3_srvr.c stable/11/crypto/openssl/ssl/ssl_cert.c stable/11/crypto/openssl/ssl/ssl_err.c stable/11/crypto/openssl/ssl/ssl_lib.c stable/11/crypto/openssl/ssl/ssl_locl.h stable/11/crypto/openssl/ssl/ssl_sess.c stable/11/crypto/openssl/ssl/t1_lib.c stable/11/crypto/openssl/util/domd stable/11/crypto/openssl/util/mklink.pl stable/11/secure/lib/libcrypto/Makefile.inc stable/11/secure/lib/libcrypto/amd64/x86_64-mont.S stable/11/secure/lib/libcrypto/amd64/x86_64-mont5.S stable/11/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_length.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_new.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 stable/11/secure/lib/libcrypto/man/ASN1_TIME_set.3 stable/11/secure/lib/libcrypto/man/ASN1_generate_nconf.3 stable/11/secure/lib/libcrypto/man/BIO_ctrl.3 stable/11/secure/lib/libcrypto/man/BIO_f_base64.3 stable/11/secure/lib/libcrypto/man/BIO_f_buffer.3 stable/11/secure/lib/libcrypto/man/BIO_f_cipher.3 stable/11/secure/lib/libcrypto/man/BIO_f_md.3 stable/11/secure/lib/libcrypto/man/BIO_f_null.3 stable/11/secure/lib/libcrypto/man/BIO_f_ssl.3 stable/11/secure/lib/libcrypto/man/BIO_find_type.3 stable/11/secure/lib/libcrypto/man/BIO_new.3 stable/11/secure/lib/libcrypto/man/BIO_new_CMS.3 stable/11/secure/lib/libcrypto/man/BIO_push.3 stable/11/secure/lib/libcrypto/man/BIO_read.3 stable/11/secure/lib/libcrypto/man/BIO_s_accept.3 stable/11/secure/lib/libcrypto/man/BIO_s_bio.3 stable/11/secure/lib/libcrypto/man/BIO_s_connect.3 stable/11/secure/lib/libcrypto/man/BIO_s_fd.3 stable/11/secure/lib/libcrypto/man/BIO_s_file.3 stable/11/secure/lib/libcrypto/man/BIO_s_mem.3 stable/11/secure/lib/libcrypto/man/BIO_s_null.3 stable/11/secure/lib/libcrypto/man/BIO_s_socket.3 stable/11/secure/lib/libcrypto/man/BIO_set_callback.3 stable/11/secure/lib/libcrypto/man/BIO_should_retry.3 stable/11/secure/lib/libcrypto/man/BN_BLINDING_new.3 stable/11/secure/lib/libcrypto/man/BN_CTX_new.3 stable/11/secure/lib/libcrypto/man/BN_CTX_start.3 stable/11/secure/lib/libcrypto/man/BN_add.3 stable/11/secure/lib/libcrypto/man/BN_add_word.3 stable/11/secure/lib/libcrypto/man/BN_bn2bin.3 stable/11/secure/lib/libcrypto/man/BN_cmp.3 stable/11/secure/lib/libcrypto/man/BN_copy.3 stable/11/secure/lib/libcrypto/man/BN_generate_prime.3 stable/11/secure/lib/libcrypto/man/BN_mod_inverse.3 stable/11/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 stable/11/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 stable/11/secure/lib/libcrypto/man/BN_new.3 stable/11/secure/lib/libcrypto/man/BN_num_bytes.3 stable/11/secure/lib/libcrypto/man/BN_rand.3 stable/11/secure/lib/libcrypto/man/BN_set_bit.3 stable/11/secure/lib/libcrypto/man/BN_swap.3 stable/11/secure/lib/libcrypto/man/BN_zero.3 stable/11/secure/lib/libcrypto/man/CMS_add0_cert.3 stable/11/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 stable/11/secure/lib/libcrypto/man/CMS_add1_signer.3 stable/11/secure/lib/libcrypto/man/CMS_compress.3 stable/11/secure/lib/libcrypto/man/CMS_decrypt.3 stable/11/secure/lib/libcrypto/man/CMS_encrypt.3 stable/11/secure/lib/libcrypto/man/CMS_final.3 stable/11/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 stable/11/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 stable/11/secure/lib/libcrypto/man/CMS_get0_type.3 stable/11/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 stable/11/secure/lib/libcrypto/man/CMS_sign.3 stable/11/secure/lib/libcrypto/man/CMS_sign_receipt.3 stable/11/secure/lib/libcrypto/man/CMS_uncompress.3 stable/11/secure/lib/libcrypto/man/CMS_verify.3 stable/11/secure/lib/libcrypto/man/CMS_verify_receipt.3 stable/11/secure/lib/libcrypto/man/CONF_modules_free.3 stable/11/secure/lib/libcrypto/man/CONF_modules_load_file.3 stable/11/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 stable/11/secure/lib/libcrypto/man/DH_generate_key.3 stable/11/secure/lib/libcrypto/man/DH_generate_parameters.3 stable/11/secure/lib/libcrypto/man/DH_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/DH_new.3 stable/11/secure/lib/libcrypto/man/DH_set_method.3 stable/11/secure/lib/libcrypto/man/DH_size.3 stable/11/secure/lib/libcrypto/man/DSA_SIG_new.3 stable/11/secure/lib/libcrypto/man/DSA_do_sign.3 stable/11/secure/lib/libcrypto/man/DSA_dup_DH.3 stable/11/secure/lib/libcrypto/man/DSA_generate_key.3 stable/11/secure/lib/libcrypto/man/DSA_generate_parameters.3 stable/11/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/DSA_new.3 stable/11/secure/lib/libcrypto/man/DSA_set_method.3 stable/11/secure/lib/libcrypto/man/DSA_sign.3 stable/11/secure/lib/libcrypto/man/DSA_size.3 stable/11/secure/lib/libcrypto/man/EC_GFp_simple_method.3 stable/11/secure/lib/libcrypto/man/EC_GROUP_copy.3 stable/11/secure/lib/libcrypto/man/EC_GROUP_new.3 stable/11/secure/lib/libcrypto/man/EC_KEY_new.3 stable/11/secure/lib/libcrypto/man/EC_POINT_add.3 stable/11/secure/lib/libcrypto/man/EC_POINT_new.3 stable/11/secure/lib/libcrypto/man/ERR_GET_LIB.3 stable/11/secure/lib/libcrypto/man/ERR_clear_error.3 stable/11/secure/lib/libcrypto/man/ERR_error_string.3 stable/11/secure/lib/libcrypto/man/ERR_get_error.3 stable/11/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 stable/11/secure/lib/libcrypto/man/ERR_load_strings.3 stable/11/secure/lib/libcrypto/man/ERR_print_errors.3 stable/11/secure/lib/libcrypto/man/ERR_put_error.3 stable/11/secure/lib/libcrypto/man/ERR_remove_state.3 stable/11/secure/lib/libcrypto/man/ERR_set_mark.3 stable/11/secure/lib/libcrypto/man/EVP_BytesToKey.3 stable/11/secure/lib/libcrypto/man/EVP_DigestInit.3 stable/11/secure/lib/libcrypto/man/EVP_DigestSignInit.3 stable/11/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 stable/11/secure/lib/libcrypto/man/EVP_EncodeInit.3 stable/11/secure/lib/libcrypto/man/EVP_EncryptInit.3 stable/11/secure/lib/libcrypto/man/EVP_OpenInit.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_derive.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_new.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_sign.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_verify.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 stable/11/secure/lib/libcrypto/man/EVP_SealInit.3 stable/11/secure/lib/libcrypto/man/EVP_SignInit.3 stable/11/secure/lib/libcrypto/man/EVP_VerifyInit.3 stable/11/secure/lib/libcrypto/man/OBJ_nid2obj.3 stable/11/secure/lib/libcrypto/man/OPENSSL_Applink.3 stable/11/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 stable/11/secure/lib/libcrypto/man/OPENSSL_config.3 stable/11/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 stable/11/secure/lib/libcrypto/man/OPENSSL_instrument_bus.3 stable/11/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 stable/11/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 stable/11/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 stable/11/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 stable/11/secure/lib/libcrypto/man/PKCS12_create.3 stable/11/secure/lib/libcrypto/man/PKCS12_parse.3 stable/11/secure/lib/libcrypto/man/PKCS7_decrypt.3 stable/11/secure/lib/libcrypto/man/PKCS7_encrypt.3 stable/11/secure/lib/libcrypto/man/PKCS7_sign.3 stable/11/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 stable/11/secure/lib/libcrypto/man/PKCS7_verify.3 stable/11/secure/lib/libcrypto/man/RAND_add.3 stable/11/secure/lib/libcrypto/man/RAND_bytes.3 stable/11/secure/lib/libcrypto/man/RAND_cleanup.3 stable/11/secure/lib/libcrypto/man/RAND_egd.3 stable/11/secure/lib/libcrypto/man/RAND_load_file.3 stable/11/secure/lib/libcrypto/man/RAND_set_rand_method.3 stable/11/secure/lib/libcrypto/man/RSA_blinding_on.3 stable/11/secure/lib/libcrypto/man/RSA_check_key.3 stable/11/secure/lib/libcrypto/man/RSA_generate_key.3 stable/11/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/RSA_new.3 stable/11/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 stable/11/secure/lib/libcrypto/man/RSA_print.3 stable/11/secure/lib/libcrypto/man/RSA_private_encrypt.3 stable/11/secure/lib/libcrypto/man/RSA_public_encrypt.3 stable/11/secure/lib/libcrypto/man/RSA_set_method.3 stable/11/secure/lib/libcrypto/man/RSA_sign.3 stable/11/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 stable/11/secure/lib/libcrypto/man/RSA_size.3 stable/11/secure/lib/libcrypto/man/SMIME_read_CMS.3 stable/11/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 stable/11/secure/lib/libcrypto/man/SMIME_write_CMS.3 stable/11/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 stable/11/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 stable/11/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 stable/11/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 stable/11/secure/lib/libcrypto/man/X509_NAME_print_ex.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 stable/11/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 stable/11/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 stable/11/secure/lib/libcrypto/man/X509_check_host.3 stable/11/secure/lib/libcrypto/man/X509_new.3 stable/11/secure/lib/libcrypto/man/X509_verify_cert.3 stable/11/secure/lib/libcrypto/man/bio.3 stable/11/secure/lib/libcrypto/man/blowfish.3 stable/11/secure/lib/libcrypto/man/bn.3 stable/11/secure/lib/libcrypto/man/bn_internal.3 stable/11/secure/lib/libcrypto/man/buffer.3 stable/11/secure/lib/libcrypto/man/crypto.3 stable/11/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 stable/11/secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3 stable/11/secure/lib/libcrypto/man/d2i_DHparams.3 stable/11/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 stable/11/secure/lib/libcrypto/man/d2i_ECPKParameters.3 stable/11/secure/lib/libcrypto/man/d2i_ECPrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_PrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 stable/11/secure/lib/libcrypto/man/d2i_X509.3 stable/11/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 stable/11/secure/lib/libcrypto/man/d2i_X509_CRL.3 stable/11/secure/lib/libcrypto/man/d2i_X509_NAME.3 stable/11/secure/lib/libcrypto/man/d2i_X509_REQ.3 stable/11/secure/lib/libcrypto/man/d2i_X509_SIG.3 stable/11/secure/lib/libcrypto/man/des.3 stable/11/secure/lib/libcrypto/man/dh.3 stable/11/secure/lib/libcrypto/man/dsa.3 stable/11/secure/lib/libcrypto/man/ec.3 stable/11/secure/lib/libcrypto/man/ecdsa.3 stable/11/secure/lib/libcrypto/man/engine.3 stable/11/secure/lib/libcrypto/man/err.3 stable/11/secure/lib/libcrypto/man/evp.3 stable/11/secure/lib/libcrypto/man/hmac.3 stable/11/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 stable/11/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 stable/11/secure/lib/libcrypto/man/lh_stats.3 stable/11/secure/lib/libcrypto/man/lhash.3 stable/11/secure/lib/libcrypto/man/md5.3 stable/11/secure/lib/libcrypto/man/mdc2.3 stable/11/secure/lib/libcrypto/man/pem.3 stable/11/secure/lib/libcrypto/man/rand.3 stable/11/secure/lib/libcrypto/man/rc4.3 stable/11/secure/lib/libcrypto/man/ripemd.3 stable/11/secure/lib/libcrypto/man/rsa.3 stable/11/secure/lib/libcrypto/man/sha.3 stable/11/secure/lib/libcrypto/man/threads.3 stable/11/secure/lib/libcrypto/man/ui.3 stable/11/secure/lib/libcrypto/man/ui_compat.3 stable/11/secure/lib/libcrypto/man/x509.3 stable/11/secure/lib/libssl/man/SSL_CIPHER_get_name.3 stable/11/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_new.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set_flags.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 stable/11/secure/lib/libssl/man/SSL_CONF_cmd.3 stable/11/secure/lib/libssl/man/SSL_CONF_cmd_argv.3 stable/11/secure/lib/libssl/man/SSL_CTX_add1_chain_cert.3 stable/11/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 stable/11/secure/lib/libssl/man/SSL_CTX_add_session.3 stable/11/secure/lib/libssl/man/SSL_CTX_ctrl.3 stable/11/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 stable/11/secure/lib/libssl/man/SSL_CTX_free.3 stable/11/secure/lib/libssl/man/SSL_CTX_get0_param.3 stable/11/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 stable/11/secure/lib/libssl/man/SSL_CTX_new.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_number.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_sessions.3 stable/11/secure/lib/libssl/man/SSL_CTX_set1_curves.3 stable/11/secure/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_options.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_read_ahead.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_timeout.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_verify.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_certificate.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_serverinfo.3 stable/11/secure/lib/libssl/man/SSL_SESSION_free.3 stable/11/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_SESSION_get_time.3 stable/11/secure/lib/libssl/man/SSL_accept.3 stable/11/secure/lib/libssl/man/SSL_alert_type_string.3 stable/11/secure/lib/libssl/man/SSL_check_chain.3 stable/11/secure/lib/libssl/man/SSL_clear.3 stable/11/secure/lib/libssl/man/SSL_connect.3 stable/11/secure/lib/libssl/man/SSL_do_handshake.3 stable/11/secure/lib/libssl/man/SSL_free.3 stable/11/secure/lib/libssl/man/SSL_get_SSL_CTX.3 stable/11/secure/lib/libssl/man/SSL_get_ciphers.3 stable/11/secure/lib/libssl/man/SSL_get_client_CA_list.3 stable/11/secure/lib/libssl/man/SSL_get_current_cipher.3 stable/11/secure/lib/libssl/man/SSL_get_default_timeout.3 stable/11/secure/lib/libssl/man/SSL_get_error.3 stable/11/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 stable/11/secure/lib/libssl/man/SSL_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_get_fd.3 stable/11/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 stable/11/secure/lib/libssl/man/SSL_get_peer_certificate.3 stable/11/secure/lib/libssl/man/SSL_get_psk_identity.3 stable/11/secure/lib/libssl/man/SSL_get_rbio.3 stable/11/secure/lib/libssl/man/SSL_get_session.3 stable/11/secure/lib/libssl/man/SSL_get_verify_result.3 stable/11/secure/lib/libssl/man/SSL_get_version.3 stable/11/secure/lib/libssl/man/SSL_library_init.3 stable/11/secure/lib/libssl/man/SSL_load_client_CA_file.3 stable/11/secure/lib/libssl/man/SSL_new.3 stable/11/secure/lib/libssl/man/SSL_pending.3 stable/11/secure/lib/libssl/man/SSL_read.3 stable/11/secure/lib/libssl/man/SSL_rstate_string.3 stable/11/secure/lib/libssl/man/SSL_session_reused.3 stable/11/secure/lib/libssl/man/SSL_set_bio.3 stable/11/secure/lib/libssl/man/SSL_set_connect_state.3 stable/11/secure/lib/libssl/man/SSL_set_fd.3 stable/11/secure/lib/libssl/man/SSL_set_session.3 stable/11/secure/lib/libssl/man/SSL_set_shutdown.3 stable/11/secure/lib/libssl/man/SSL_set_verify_result.3 stable/11/secure/lib/libssl/man/SSL_shutdown.3 stable/11/secure/lib/libssl/man/SSL_state_string.3 stable/11/secure/lib/libssl/man/SSL_want.3 stable/11/secure/lib/libssl/man/SSL_write.3 stable/11/secure/lib/libssl/man/d2i_SSL_SESSION.3 stable/11/secure/lib/libssl/man/ssl.3 stable/11/secure/usr.bin/openssl/man/CA.pl.1 stable/11/secure/usr.bin/openssl/man/asn1parse.1 stable/11/secure/usr.bin/openssl/man/c_rehash.1 stable/11/secure/usr.bin/openssl/man/ca.1 stable/11/secure/usr.bin/openssl/man/ciphers.1 stable/11/secure/usr.bin/openssl/man/cms.1 stable/11/secure/usr.bin/openssl/man/crl.1 stable/11/secure/usr.bin/openssl/man/crl2pkcs7.1 stable/11/secure/usr.bin/openssl/man/dgst.1 stable/11/secure/usr.bin/openssl/man/dhparam.1 stable/11/secure/usr.bin/openssl/man/dsa.1 stable/11/secure/usr.bin/openssl/man/dsaparam.1 stable/11/secure/usr.bin/openssl/man/ec.1 stable/11/secure/usr.bin/openssl/man/ecparam.1 stable/11/secure/usr.bin/openssl/man/enc.1 stable/11/secure/usr.bin/openssl/man/errstr.1 stable/11/secure/usr.bin/openssl/man/gendsa.1 stable/11/secure/usr.bin/openssl/man/genpkey.1 stable/11/secure/usr.bin/openssl/man/genrsa.1 stable/11/secure/usr.bin/openssl/man/nseq.1 stable/11/secure/usr.bin/openssl/man/ocsp.1 stable/11/secure/usr.bin/openssl/man/openssl.1 stable/11/secure/usr.bin/openssl/man/passwd.1 stable/11/secure/usr.bin/openssl/man/pkcs12.1 stable/11/secure/usr.bin/openssl/man/pkcs7.1 stable/11/secure/usr.bin/openssl/man/pkcs8.1 stable/11/secure/usr.bin/openssl/man/pkey.1 stable/11/secure/usr.bin/openssl/man/pkeyparam.1 stable/11/secure/usr.bin/openssl/man/pkeyutl.1 stable/11/secure/usr.bin/openssl/man/rand.1 stable/11/secure/usr.bin/openssl/man/req.1 stable/11/secure/usr.bin/openssl/man/rsa.1 stable/11/secure/usr.bin/openssl/man/rsautl.1 stable/11/secure/usr.bin/openssl/man/s_client.1 stable/11/secure/usr.bin/openssl/man/s_server.1 stable/11/secure/usr.bin/openssl/man/s_time.1 stable/11/secure/usr.bin/openssl/man/sess_id.1 stable/11/secure/usr.bin/openssl/man/smime.1 stable/11/secure/usr.bin/openssl/man/speed.1 stable/11/secure/usr.bin/openssl/man/spkac.1 stable/11/secure/usr.bin/openssl/man/ts.1 stable/11/secure/usr.bin/openssl/man/tsget.1 stable/11/secure/usr.bin/openssl/man/verify.1 stable/11/secure/usr.bin/openssl/man/version.1 stable/11/secure/usr.bin/openssl/man/x509.1 stable/11/secure/usr.bin/openssl/man/x509v3_config.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/crypto/openssl/CHANGES ============================================================================== --- stable/11/crypto/openssl/CHANGES Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/CHANGES Thu Jan 26 19:14:14 2017 (r312826) @@ -2,6 +2,67 @@ OpenSSL CHANGES _______________ + Changes between 1.0.2j and 1.0.2k [26 Jan 2017] + + *) Truncated packet could crash via OOB read + + If one side of an SSL/TLS path is running on a 32-bit host and a specific + cipher is being used, then a truncated packet can cause that host to + perform an out-of-bounds read, usually resulting in a crash. + + This issue was reported to OpenSSL by Robert Święcki of Google. + (CVE-2017-3731) + [Andy Polyakov] + + *) BN_mod_exp may produce incorrect results on x86_64 + + There is a carry propagating bug in the x86_64 Montgomery squaring + procedure. No EC algorithms are affected. Analysis suggests that attacks + against RSA and DSA as a result of this defect would be very difficult to + perform and are not believed likely. Attacks against DH are considered just + feasible (although very difficult) because most of the work necessary to + deduce information about a private key may be performed offline. The amount + of resources required for such an attack would be very significant and + likely only accessible to a limited number of attackers. An attacker would + additionally need online access to an unpatched system using the target + private key in a scenario with persistent DH parameters and a private + key that is shared between multiple clients. For example this can occur by + default in OpenSSL DHE based SSL/TLS ciphersuites. Note: This issue is very + similar to CVE-2015-3193 but must be treated as a separate problem. + + This issue was reported to OpenSSL by the OSS-Fuzz project. + (CVE-2017-3732) + [Andy Polyakov] + + *) Montgomery multiplication may produce incorrect results + + There is a carry propagating bug in the Broadwell-specific Montgomery + multiplication procedure that handles input lengths divisible by, but + longer than 256 bits. Analysis suggests that attacks against RSA, DSA + and DH private keys are impossible. This is because the subroutine in + question is not used in operations with the private key itself and an input + of the attacker's direct choice. Otherwise the bug can manifest itself as + transient authentication and key negotiation failures or reproducible + erroneous outcome of public-key operations with specially crafted input. + Among EC algorithms only Brainpool P-512 curves are affected and one + presumably can attack ECDH key negotiation. Impact was not analyzed in + detail, because pre-requisites for attack are considered unlikely. Namely + multiple clients have to choose the curve in question and the server has to + share the private key among them, neither of which is default behaviour. + Even then only clients that chose the curve will be affected. + + This issue was publicly reported as transient failures and was not + initially recognized as a security issue. Thanks to Richard Morgan for + providing reproducible case. + (CVE-2016-7055) + [Andy Polyakov] + + *) OpenSSL now fails if it receives an unrecognised record type in TLS1.0 + or TLS1.1. Previously this only happened in SSLv3 and TLS1.2. This is to + prevent issues where no progress is being made and the peer continually + sends unrecognised record types, using up resources processing them. + [Matt Caswell] + Changes between 1.0.2i and 1.0.2j [26 Sep 2016] *) Missing CRL sanity check Modified: stable/11/crypto/openssl/CONTRIBUTING ============================================================================== --- stable/11/crypto/openssl/CONTRIBUTING Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/CONTRIBUTING Thu Jan 26 19:14:14 2017 (r312826) @@ -1,4 +1,4 @@ -HOW TO CONTRIBUTE TO PATCHES OpenSSL +HOW TO CONTRIBUTE PATCHES TO OpenSSL ------------------------------------ (Please visit https://www.openssl.org/community/getting-started.html for @@ -11,34 +11,12 @@ OpenSSL community you might want to disc list first. Someone may be already working on the same thing or there may be a good reason as to why that feature isn't implemented. -The best way to submit a patch is to make a pull request on GitHub. -(It is not necessary to send mail to rt@openssl.org to open a ticket!) -If you think the patch could use feedback from the community, please -start a thread on openssl-dev. - -You can also submit patches by sending it as mail to rt@openssl.org. -Please include the word "PATCH" and an explanation of what the patch -does in the subject line. If you do this, our preferred format is "git -format-patch" output. For example to provide a patch file containing the -last commit in your local git repository use the following command: - - % git format-patch --stdout HEAD^ >mydiffs.patch - -Another method of creating an acceptable patch file without using git is as -follows: - - % cd openssl-work - ...make your changes... - % ./Configure dist; make clean - % cd .. - % diff -ur openssl-orig openssl-work >mydiffs.patch - -Note that pull requests are generally easier for the team, and community, to -work with. Pull requests benefit from all of the standard GitHub features, -including code review tools, simpler integration, and CI build support. +To submit a patch, make a pull request on GitHub. If you think the patch +could use feedback from the community, please start a thread on openssl-dev +to discuss it. -No matter how a patch is submitted, the following items will help make -the acceptance and review process faster: +Having addressed the following items before the PR will help make the +acceptance and review process faster: 1. Anything other than trivial contributions will require a contributor licensing agreement, giving us permission to use your code. See @@ -55,21 +33,22 @@ the acceptance and review process faster in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html - 3. Patches should be as current as possible. When using GitHub, please - expect to have to rebase and update often. Note that we do not accept merge - commits. You will be asked to remove them before a patch is considered - acceptable. + 3. Patches should be as current as possible; expect to have to rebase + often. We do not accept merge commits; You will be asked to remove + them before a patch is considered acceptable. 4. Patches should follow our coding style (see https://www.openssl.org/policies/codingstyle.html) and compile without warnings. Where gcc or clang is availble you should use the --strict-warnings Configure option. OpenSSL compiles on many varied platforms: try to ensure you only use portable features. + Clean builds via Travis and AppVeyor are expected, and done whenever + a PR is created or updated. - 5. When at all possible, patches should include tests. These can either be - added to an existing test, or completely new. Please see test/README - for information on the test framework. - - 6. New features or changed functionality must include documentation. Please - look at the "pod" files in doc/apps, doc/crypto and doc/ssl for examples of - our style. + 5. When at all possible, patches should include tests. These can + either be added to an existing test, or completely new. Please see + test/README for information on the test framework. + + 6. New features or changed functionality must include + documentation. Please look at the "pod" files in doc/apps, doc/crypto + and doc/ssl for examples of our style. Modified: stable/11/crypto/openssl/Configure ============================================================================== --- stable/11/crypto/openssl/Configure Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/Configure Thu Jan 26 19:14:14 2017 (r312826) @@ -7,6 +7,7 @@ eval 'exec perl -S $0 ${1+"$@"}' require 5.000; use strict; +use File::Compare; # see INSTALL for instructions. @@ -57,12 +58,13 @@ my $usage="Usage: Configure [no- # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared # library and will be loaded in run-time by the OpenSSL library. # sctp include SCTP support -# 386 generate 80386 code # enable-weak-ssl-ciphers # Enable EXPORT and LOW SSLv3 ciphers that are disabled by # default. Note, weak SSLv2 ciphers are unconditionally # disabled. -# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 +# 386 generate 80386 code in assembly modules +# no-sse2 disables IA-32 SSE2 code in assembly modules, the above +# mentioned '386' option implies this one # no- build without specified algorithm (rsa, idea, rc5, ...) # - + compiler options are passed through # @@ -1792,8 +1794,16 @@ while () } close(IN); close(OUT); -rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; -rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; +if ((compare($Makefile, "$Makefile.new")) + or file_newer('Configure', $Makefile) + or file_newer('config', $Makefile) + or file_newer('Makefile.org', $Makefile)) + { + rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; + rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; + } +else + { unlink("$Makefile.new"); } print "CC =$cc\n"; print "CFLAG =$cflags\n"; @@ -1985,9 +1995,13 @@ print OUT "#ifdef __cplusplus\n"; print OUT "}\n"; print OUT "#endif\n"; close(OUT); -rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; -rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; - +if (compare("crypto/opensslconf.h.new","crypto/opensslconf.h")) + { + rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; + rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; + } +else + { unlink("crypto/opensslconf.h.new"); } # Fix the date @@ -2289,3 +2303,9 @@ sub test_sanity print STDERR "No sanity errors detected!\n" if $errorcnt == 0; return $errorcnt; } + +sub file_newer + { + my ($file1, $file2) = @_; + return (stat($file1))[9] > (stat($file2))[9] + } Modified: stable/11/crypto/openssl/INSTALL ============================================================================== --- stable/11/crypto/openssl/INSTALL Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/INSTALL Thu Jan 26 19:14:14 2017 (r312826) @@ -74,24 +74,26 @@ no-asm Do not use assembler code. - 386 Use the 80386 instruction set only (the default x86 code is - more efficient, but requires at least a 486). Note: Use - compiler flags for any other CPU specific configuration, - e.g. "-m32" to build x86 code on an x64 system. - - no-sse2 Exclude SSE2 code pathes. Normally SSE2 extention is - detected at run-time, but the decision whether or not the - machine code will be executed is taken solely on CPU - capability vector. This means that if you happen to run OS - kernel which does not support SSE2 extension on Intel P4 - processor, then your application might be exposed to - "illegal instruction" exception. There might be a way - to enable support in kernel, e.g. FreeBSD kernel can be - compiled with CPU_ENABLE_SSE, and there is a way to - disengage SSE2 code pathes upon application start-up, - but if you aim for wider "audience" running such kernel, - consider no-sse2. Both 386 and no-asm options above imply - no-sse2. + 386 In 32-bit x86 builds, when generating assembly modules, + use the 80386 instruction set only (the default x86 code + is more efficient, but requires at least a 486). Note: + This doesn't affect code generated by compiler, you're + likely to complement configuration command line with + suitable compiler-specific option. + + no-sse2 Exclude SSE2 code paths from 32-bit x86 assembly modules. + Normally SSE2 extension is detected at run-time, but the + decision whether or not the machine code will be executed + is taken solely on CPU capability vector. This means that + if you happen to run OS kernel which does not support SSE2 + extension on Intel P4 processor, then your application + might be exposed to "illegal instruction" exception. + There might be a way to enable support in kernel, e.g. + FreeBSD kernel can be compiled with CPU_ENABLE_SSE, and + there is a way to disengage SSE2 code paths upon application + start-up, but if you aim for wider "audience" running + such kernel, consider no-sse2. Both the 386 and + no-asm options imply no-sse2. no- Build without the specified cipher (bf, cast, des, dh, dsa, hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). @@ -101,7 +103,12 @@ -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options will be passed through to the compiler to allow you to define preprocessor symbols, specify additional libraries, - library directories or other compiler options. + library directories or other compiler options. It might be + worth noting that some compilers generate code specifically + for processor the compiler currently executes on. This is + not necessarily what you might have in mind, since it might + be unsuitable for execution on other, typically older, + processor. Consult your compiler documentation. -DHAVE_CRYPTODEV Enable the BSD cryptodev engine even if we are not using BSD. Useful if you are running ocf-linux or something @@ -159,18 +166,18 @@ OpenSSL binary ("openssl"). The libraries will be built in the top-level directory, and the binary will be in the "apps" directory. - If "make" fails, look at the output. There may be reasons for - the failure that aren't problems in OpenSSL itself (like missing - standard headers). If it is a problem with OpenSSL itself, please - report the problem to (note that your - message will be recorded in the request tracker publicly readable - at https://www.openssl.org/community/index.html#bugs and will be - forwarded to a public mailing list). Include the output of "make - report" in your message. Please check out the request tracker. Maybe - the bug was already reported or has already been fixed. + If the build fails, look at the output. There may be reasons + for the failure that aren't problems in OpenSSL itself (like + missing standard headers). If you are having problems you can + get help by sending an email to the openssl-users email list (see + https://www.openssl.org/community/mailinglists.html for details). If + it is a bug with OpenSSL itself, please open an issue on GitHub, at + https://github.com/openssl/openssl/issues. Please review the existing + ones first; maybe the bug was already reported or has already been + fixed. - [If you encounter assembler error messages, try the "no-asm" - configuration option as an immediate fix.] + (If you encounter assembler error messages, try the "no-asm" + configuration option as an immediate fix.) Compiling parts of OpenSSL with gcc and others with the system compiler will result in unresolved symbols on some systems. Modified: stable/11/crypto/openssl/Makefile ============================================================================== --- stable/11/crypto/openssl/Makefile Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/Makefile Thu Jan 26 19:14:14 2017 (r312826) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2j +VERSION=1.0.2k MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 @@ -203,7 +203,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: stable/11/crypto/openssl/Makefile.org ============================================================================== --- stable/11/crypto/openssl/Makefile.org Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/Makefile.org Thu Jan 26 19:14:14 2017 (r312826) @@ -201,7 +201,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: stable/11/crypto/openssl/NEWS ============================================================================== --- stable/11/crypto/openssl/NEWS Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/NEWS Thu Jan 26 19:14:14 2017 (r312826) @@ -5,9 +5,15 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017] + + o Truncated packet could crash via OOB read (CVE-2017-3731) + o BN_mod_exp may produce incorrect results on x86_64 (CVE-2017-3732) + o Montgomery multiplication may produce incorrect results (CVE-2016-7055) + Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016] - o Fix Use After Free for large message sizes (CVE-2016-6309) + o Missing CRL sanity check (CVE-2016-7052) Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016] Modified: stable/11/crypto/openssl/README ============================================================================== --- stable/11/crypto/openssl/README Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/README Thu Jan 26 19:14:14 2017 (r312826) @@ -1,5 +1,5 @@ - OpenSSL 1.0.2j 26 Sep 2016 + OpenSSL 1.0.2k 26 Jan 2017 Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson @@ -66,13 +66,13 @@ If you have any problems with OpenSSL then please take the following steps first: - - Download the current snapshot from ftp://ftp.openssl.org/snapshot/ + - Download the latest version from the repository to see if the problem has already been addressed - - Remove ASM versions of libraries + - Configure with no-asm - Remove compiler optimisation flags - If you wish to report a bug then please include the following information in - any bug report: + If you wish to report a bug then please include the following information + and create an issue on GitHub: - On Unix systems: Self-test report generated by 'make report' @@ -84,27 +84,9 @@ - Problem Description (steps that will reproduce the problem, if known) - Stack Traceback (if the application dumps core) - Email the report to: - - rt@openssl.org - - In order to avoid spam, this is a moderated mailing list, and it might - take a day for the ticket to show up. (We also scan posts to make sure - that security disclosures aren't publically posted by mistake.) Mail - to this address is recorded in the public RT (request tracker) database - (see https://www.openssl.org/community/index.html#bugs for details) and - also forwarded the public openssl-dev mailing list. Confidential mail - may be sent to openssl-security@openssl.org (PGP key available from the - key servers). - - Please do NOT use this for general assistance or support queries. Just because something doesn't work the way you expect does not mean it is necessarily a bug in OpenSSL. - You can also make GitHub pull requests. If you do this, please also send - mail to rt@openssl.org with a link to the PR so that we can more easily - keep track of it. - HOW TO CONTRIBUTE TO OpenSSL ---------------------------- @@ -113,7 +95,7 @@ LEGALITIES ---------- - A number of nations, in particular the U.S., restrict the use or export - of cryptography. If you are potentially subject to such restrictions - you should seek competent professional legal advice before attempting to - develop or distribute cryptographic code. + A number of nations restrict the use or export of cryptography. If you + are potentially subject to such restrictions you should seek competent + professional legal advice before attempting to develop or distribute + cryptographic code. Modified: stable/11/crypto/openssl/apps/apps.c ============================================================================== --- stable/11/crypto/openssl/apps/apps.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/apps.c Thu Jan 26 19:14:14 2017 (r312826) @@ -972,7 +972,10 @@ EVP_PKEY *load_key(BIO *err, const char if (!e) BIO_printf(err, "no engine specified\n"); else { - pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + if (ENGINE_init(e)) { + pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + ENGINE_finish(e); + } if (!pkey) { BIO_printf(err, "cannot load %s from engine\n", key_descrip); ERR_print_errors(err); @@ -1532,11 +1535,13 @@ static ENGINE *try_load_engine(BIO *err, } return e; } +#endif ENGINE *setup_engine(BIO *err, const char *engine, int debug) { ENGINE *e = NULL; +#ifndef OPENSSL_NO_ENGINE if (engine) { if (strcmp(engine, "auto") == 0) { BIO_printf(err, "enabling auto ENGINE support\n"); @@ -1561,13 +1566,19 @@ ENGINE *setup_engine(BIO *err, const cha } BIO_printf(err, "engine \"%s\" set.\n", ENGINE_get_id(e)); - - /* Free our "structural" reference. */ - ENGINE_free(e); } +#endif return e; } + +void release_engine(ENGINE *e) +{ +#ifndef OPENSSL_NO_ENGINE + if (e != NULL) + /* Free our "structural" reference. */ + ENGINE_free(e); #endif +} int load_config(BIO *err, CONF *cnf) { Modified: stable/11/crypto/openssl/apps/apps.h ============================================================================== --- stable/11/crypto/openssl/apps/apps.h Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/apps.h Thu Jan 26 19:14:14 2017 (r312826) @@ -259,9 +259,9 @@ STACK_OF(X509_CRL) *load_crls(BIO *err, const char *pass, ENGINE *e, const char *cert_descrip); X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath); -# ifndef OPENSSL_NO_ENGINE + ENGINE *setup_engine(BIO *err, const char *engine, int debug); -# endif +void release_engine(ENGINE *e); # ifndef OPENSSL_NO_OCSP OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, Modified: stable/11/crypto/openssl/apps/ca.c ============================================================================== --- stable/11/crypto/openssl/apps/ca.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/ca.c Thu Jan 26 19:14:14 2017 (r312826) @@ -319,9 +319,7 @@ int MAIN(int argc, char **argv) #define BSIZE 256 MS_STATIC char buf[3][BSIZE]; char *randfile = NULL; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif char *tofree = NULL; DB_ATTR db_attr; @@ -595,9 +593,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, conf)) goto err; -#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -#endif /* Lets get the config section we are using */ if (section == NULL) { @@ -1485,6 +1481,7 @@ int MAIN(int argc, char **argv) X509_CRL_free(crl); NCONF_free(conf); NCONF_free(extconf); + release_engine(e); OBJ_cleanup(); apps_shutdown(); OPENSSL_EXIT(ret); @@ -2227,7 +2224,6 @@ static int certify_spkac(X509 **xret, ch sk = CONF_get_section(parms, "default"); if (sk_CONF_VALUE_num(sk) == 0) { BIO_printf(bio_err, "no name/value pairs found in %s\n", infile); - CONF_free(parms); goto err; } Modified: stable/11/crypto/openssl/apps/cms.c ============================================================================== --- stable/11/crypto/openssl/apps/cms.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/cms.c Thu Jan 26 19:14:14 2017 (r312826) @@ -143,9 +143,7 @@ int MAIN(int argc, char **argv) const EVP_MD *sign_md = NULL; int informat = FORMAT_SMIME, outformat = FORMAT_SMIME; int rctformat = FORMAT_SMIME, keyform = FORMAT_PEM; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif unsigned char *secret_key = NULL, *secret_keyid = NULL; unsigned char *pwri_pass = NULL, *pwri_tmp = NULL; size_t secret_keylen = 0, secret_keyidlen = 0; @@ -665,9 +663,7 @@ int MAIN(int argc, char **argv) "cert.pem recipient certificate(s) for encryption\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); @@ -1170,6 +1166,7 @@ int MAIN(int argc, char **argv) EVP_PKEY_free(key); CMS_ContentInfo_free(cms); CMS_ContentInfo_free(rcms); + release_engine(e); BIO_free(rctin); BIO_free(in); BIO_free(indata); Modified: stable/11/crypto/openssl/apps/dgst.c ============================================================================== --- stable/11/crypto/openssl/apps/dgst.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dgst.c Thu Jan 26 19:14:14 2017 (r312826) @@ -537,6 +537,7 @@ int MAIN(int argc, char **argv) OPENSSL_free(sigbuf); if (bmd != NULL) BIO_free(bmd); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(err); } Modified: stable/11/crypto/openssl/apps/dh.c ============================================================================== --- stable/11/crypto/openssl/apps/dh.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dh.c Thu Jan 26 19:14:14 2017 (r312826) @@ -94,9 +94,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif apps_startup(); @@ -107,9 +105,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -183,9 +179,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); Modified: stable/11/crypto/openssl/apps/dhparam.c ============================================================================== --- stable/11/crypto/openssl/apps/dhparam.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dhparam.c Thu Jan 26 19:14:14 2017 (r312826) @@ -159,9 +159,8 @@ int MAIN(int argc, char **argv) int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; int num = 0, g = 0; apps_startup(); @@ -270,9 +269,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (g && !num) num = DEFBITS; @@ -512,6 +509,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dh != NULL) DH_free(dh); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: stable/11/crypto/openssl/apps/dsa.c ============================================================================== --- stable/11/crypto/openssl/apps/dsa.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dsa.c Thu Jan 26 19:14:14 2017 (r312826) @@ -106,9 +106,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; int modulus = 0; @@ -124,9 +122,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -239,9 +235,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -358,6 +352,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: stable/11/crypto/openssl/apps/dsaparam.c ============================================================================== --- stable/11/crypto/openssl/apps/dsaparam.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dsaparam.c Thu Jan 26 19:14:14 2017 (r312826) @@ -121,9 +121,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog, *inrand = NULL; int numbits = -1, num, genkey = 0; int need_rand = 0; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; # ifdef GENCB_TEST int timebomb = 0; # endif @@ -263,9 +262,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (need_rand) { app_RAND_load_file(NULL, bio_err, (inrand != NULL)); @@ -433,6 +430,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: stable/11/crypto/openssl/apps/ec.c ============================================================================== --- stable/11/crypto/openssl/apps/ec.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/ec.c Thu Jan 26 19:14:14 2017 (r312826) @@ -95,6 +95,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0, param_out = 0; char *infile, *outfile, *prog, *engine; + ENGINE *e = NULL; char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; @@ -235,9 +236,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -349,6 +348,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (eckey) EC_KEY_free(eckey); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: stable/11/crypto/openssl/apps/ecparam.c ============================================================================== --- stable/11/crypto/openssl/apps/ecparam.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/ecparam.c Thu Jan 26 19:14:14 2017 (r312826) @@ -131,6 +131,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, noout = 0, C = 0, ret = 1; char *engine = NULL; + ENGINE *e = NULL; BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL; @@ -311,9 +312,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (list_curves) { EC_builtin_curve *curves = NULL; @@ -620,12 +619,13 @@ int MAIN(int argc, char **argv) BN_free(ec_cofactor); if (buffer) OPENSSL_free(buffer); + if (group != NULL) + EC_GROUP_free(group); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); - if (group != NULL) - EC_GROUP_free(group); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: stable/11/crypto/openssl/apps/enc.c ============================================================================== --- stable/11/crypto/openssl/apps/enc.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/enc.c Thu Jan 26 19:14:14 2017 (r312826) @@ -126,9 +126,8 @@ int MAIN(int argc, char **argv) NULL, *wbio = NULL; #define PROG_NAME_SIZE 39 char pname[PROG_NAME_SIZE + 1]; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; const EVP_MD *dgst = NULL; int non_fips_allow = 0; @@ -322,9 +321,7 @@ int MAIN(int argc, char **argv) argv++; } -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) { BIO_printf(bio_err, @@ -674,6 +671,7 @@ int MAIN(int argc, char **argv) if (bzl != NULL) BIO_free(bzl); #endif + release_engine(e); if (pass) OPENSSL_free(pass); apps_shutdown(); Modified: stable/11/crypto/openssl/apps/gendh.c ============================================================================== --- stable/11/crypto/openssl/apps/gendh.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/gendh.c Thu Jan 26 19:14:14 2017 (r312826) @@ -96,9 +96,7 @@ int MAIN(int argc, char **argv) int g = 2; char *outfile = NULL; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif BIO *out = NULL; apps_startup(); @@ -162,9 +160,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, " the random number generator\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif out = BIO_new(BIO_s_file()); if (out == NULL) { Modified: stable/11/crypto/openssl/apps/gendsa.c ============================================================================== --- stable/11/crypto/openssl/apps/gendsa.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/gendsa.c Thu Jan 26 19:14:14 2017 (r312826) @@ -85,9 +85,8 @@ int MAIN(int argc, char **argv) char *passargout = NULL, *passout = NULL; BIO *out = NULL, *in = NULL; const EVP_CIPHER *enc = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; apps_startup(); @@ -206,9 +205,7 @@ int MAIN(int argc, char **argv) " - a DSA parameter file as generated by the dsaparam command\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { BIO_printf(bio_err, "Error getting password\n"); @@ -273,6 +270,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passout) OPENSSL_free(passout); apps_shutdown(); Modified: stable/11/crypto/openssl/apps/genpkey.c ============================================================================== --- stable/11/crypto/openssl/apps/genpkey.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/genpkey.c Thu Jan 26 19:14:14 2017 (r312826) @@ -275,9 +275,9 @@ int MAIN(int argc, char **argv) if (out) BIO_free_all(out); BIO_free(in); + release_engine(e); if (pass) OPENSSL_free(pass); - return ret; } Modified: stable/11/crypto/openssl/apps/genrsa.c ============================================================================== --- stable/11/crypto/openssl/apps/genrsa.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/genrsa.c Thu Jan 26 19:14:14 2017 (r312826) @@ -91,9 +91,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { BN_GENCB cb; -# ifndef OPENSSL_NO_ENGINE ENGINE *e = NULL; -# endif int ret = 1; int i, num = DEFBITS; long l; @@ -101,9 +99,7 @@ int MAIN(int argc, char **argv) unsigned long f4 = RSA_F4; char *outfile = NULL; char *passargout = NULL, *passout = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif char *inrand = NULL; BIO *out = NULL; BIGNUM *bn = BN_new(); @@ -240,9 +236,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "Error getting password\n"); goto err; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (outfile == NULL) { BIO_set_fp(out, stdout, BIO_NOCLOSE); @@ -314,6 +308,7 @@ int MAIN(int argc, char **argv) RSA_free(rsa); if (out) BIO_free_all(out); + release_engine(e); if (passout) OPENSSL_free(passout); if (ret != 0) Modified: stable/11/crypto/openssl/apps/pkcs12.c ============================================================================== --- stable/11/crypto/openssl/apps/pkcs12.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/pkcs12.c Thu Jan 26 19:14:14 2017 (r312826) @@ -129,9 +129,7 @@ int MAIN(int argc, char **argv) char *inrand = NULL; char *macalg = NULL; char *CApath = NULL, *CAfile = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif apps_startup(); @@ -406,9 +404,7 @@ int MAIN(int argc, char **argv) "-LMK Add local machine keyset attribute to private key\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (passarg) { if (export_cert) @@ -756,6 +752,7 @@ int MAIN(int argc, char **argv) # ifdef CRYPTO_MDEBUG CRYPTO_remove_all_info(); # endif + release_engine(e); BIO_free(in); BIO_free_all(out); if (canames) @@ -1110,4 +1107,6 @@ static int set_pbe(BIO *err, int *ppbe, return 1; } +#else +static void *dummy = &dummy; #endif Modified: stable/11/crypto/openssl/apps/pkcs7.c ============================================================================== --- stable/11/crypto/openssl/apps/pkcs7.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/pkcs7.c Thu Jan 26 19:14:14 2017 (r312826) @@ -90,9 +90,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog; int print_certs = 0, text = 0, noout = 0, p7_print = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; apps_startup(); @@ -175,9 +174,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); @@ -303,6 +300,7 @@ int MAIN(int argc, char **argv) end: if (p7 != NULL) PKCS7_free(p7); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) Modified: stable/11/crypto/openssl/apps/pkcs8.c ============================================================================== --- stable/11/crypto/openssl/apps/pkcs8.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/pkcs8.c Thu Jan 26 19:14:14 2017 (r312826) @@ -87,9 +87,7 @@ int MAIN(int argc, char **argv) char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; int badarg = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); @@ -223,9 +221,7 @@ int MAIN(int argc, char **argv) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Jan 26 20:10:34 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51BEACC30D1; Thu, 26 Jan 2017 20:10:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD190AA9; Thu, 26 Jan 2017 20:10:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKAXnE081576; Thu, 26 Jan 2017 20:10:33 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKAVSx081562; Thu, 26 Jan 2017 20:10:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201701262010.v0QKAVSx081562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 26 Jan 2017 20:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312828 - in stable/10: . tests/sys/geom/class/eli tests/sys/geom/class/nop X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:10:34 -0000 Author: asomers Date: Thu Jan 26 20:10:31 2017 New Revision: 312828 URL: https://svnweb.freebsd.org/changeset/base/312828 Log: MFC r310786, r310803, r310985, r311894 r310786: Reduce the runtime of the GELI tests There is no reduction in test coverage. On my system runtime is reduced from 38m32s to 6m24s. tests/sys/geom/class/eli/conf.sh tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh tests/sys/geom/class/eli/onetime_test.sh Move the looping code into common functions in conf.sh, and remove alias ciphers from the list. tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Move a few commands that don't need to be in the inner loop out. tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Reduce the sector count tests/sys/geom/class/eli/Makefile tests/sys/geom/class/eli/init_alias_test.sh Add a test for initializing a GELI device using one of the cipher aliases, and check that the alias is correctly interpreted. MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8814 r310803: ATFify the gnop tests Also, add test cases for the -p, -P, and -s options to gnop create Reviewed by: ngie MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D8892 r310985: Update ObsoleteFiles.inc for r310803 MFC after: 26 days X-MFC-with: 310803 r311894: Fix typo from change 310985 in ObsoleteFiles.inc MFC after: 16 days X-MFC-With: 310803 Sponsored by: Spectra Logic Corp Added: stable/10/tests/sys/geom/class/eli/init_alias_test.sh - copied unchanged from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh stable/10/tests/sys/geom/class/nop/nop_test.sh - copied unchanged from r310803, head/tests/sys/geom/class/nop/nop_test.sh Deleted: stable/10/tests/sys/geom/class/nop/1_test.sh stable/10/tests/sys/geom/class/nop/2_test.sh stable/10/tests/sys/geom/class/nop/conf.sh Modified: stable/10/ObsoleteFiles.inc stable/10/tests/sys/geom/class/eli/Makefile stable/10/tests/sys/geom/class/eli/conf.sh stable/10/tests/sys/geom/class/eli/init_a_test.sh stable/10/tests/sys/geom/class/eli/init_test.sh stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh stable/10/tests/sys/geom/class/eli/integrity_data_test.sh stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh stable/10/tests/sys/geom/class/eli/onetime_a_test.sh stable/10/tests/sys/geom/class/eli/onetime_test.sh stable/10/tests/sys/geom/class/nop/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/ObsoleteFiles.inc Thu Jan 26 20:10:31 2017 (r312828) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20161229: Three files from gnop tests consolidated into one +OLD_FILES+=usr/tests/sys/geom/class/nop/1_test +OLD_FILES+=usr/tests/sys/geom/class/nop/2_test +OLD_FILES+=usr/tests/sys/geom/class/nop/conf.sh # 20161121: Hyper-V manuals only apply to amd64 and i386. .if ${TARGET_ARCH} != "amd64" && ${TARGET_ARCH} != "i386" OLD_FILES+=usr/share/man/man4/hv_kvp.4.gz Modified: stable/10/tests/sys/geom/class/eli/Makefile ============================================================================== --- stable/10/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:10:31 2017 (r312828) @@ -9,6 +9,7 @@ TAP_TESTS_SH+= detach_l_test TAP_TESTS_SH+= init_B_test TAP_TESTS_SH+= init_J_test TAP_TESTS_SH+= init_a_test +TAP_TESTS_SH+= init_alias_test TAP_TESTS_SH+= init_i_P_test TAP_TESTS_SH+= init_test TAP_TESTS_SH+= integrity_copy_test Modified: stable/10/tests/sys/geom/class/eli/conf.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -11,6 +11,54 @@ while [ -c /dev/md$no ]; do : $(( no += 1 )) done +# Execute `func` for each combination of cipher, sectorsize, and hmac algo +# `func` usage should be: +# func +for_each_geli_config() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ + hmac/sha384 hmac/sha512; do + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done + done +} + +# Execute `func` for each combination of cipher, and sectorsize, with no hmac +# `func` usage should be: +# func +for_each_geli_config_nointegrity() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done +} + + geli_test_cleanup() { [ -c /dev/md${no}.eli ] && geli detach md${no}.eli Modified: stable/10/tests/sys/geom/class/eli/init_a_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -6,55 +6,45 @@ base=`basename $0` sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" - -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +echo "1..600" + +i=1 + +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +dd if=/dev/random of=${rnd} bs=8192 count=${sectors} >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd rm -f $keyfile Copied: stable/10/tests/sys/geom/class/eli/init_alias_test.sh (from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tests/sys/geom/class/eli/init_alias_test.sh Thu Jan 26 20:10:31 2017 (r312828, copy of r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) @@ -0,0 +1,64 @@ +#!/bin/sh +# $FreeBSD$ + +# Test "geli init"'s various cipher aliases +. $(dirname $0)/conf.sh + +base=`basename $0` +sectors=100 +keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 + +do_test() { + ealgo=$1 + keylen=$2 + expected_ealgo=$3 + expected_keylen=$4 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + real_ealgo=`geli list md${no}.eli | awk '/EncryptionAlgorithm/ {print $2}'` + real_keylen=`geli list md${no}.eli | awk '/KeyLength/ {print $2}'` + + if [ ${real_ealgo} = ${expected_ealgo} ]; then + echo "ok $i - ${ealgo} aliased to ${real_ealgo}" + else + echo "not ok $i - expected ${expected_ealgo} but got ${real_ealgo}" + fi + i=$((i+1)) + + if [ ${real_keylen} = ${expected_keylen} ]; then + echo "ok $i - keylen=${keylen} for ealgo=${ealgo} aliases to ${real_keylen}" + else + echo "not ok $i - expected ${expected_keylen} but got ${real_keylen}" + fi + i=$((i+1)) + + geli detach md${no} +} + +echo "1..38" +i=1 +mdconfig -a -t malloc -s 1024k -u $no || exit 1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \ + 3des:0:3DES-CBC:192 3des:192:3DES-CBC:192 \ + blowfish:0:Blowfish-CBC:128 blowfish:128:Blowfish-CBC:128 \ + blowfish:160:Blowfish-CBC:160 blowfish:192:Blowfish-CBC:192 \ + blowfish:224:Blowfish-CBC:224 blowfish:256:Blowfish-CBC:256 \ + blowfish:288:Blowfish-CBC:288 blowfish:352:Blowfish-CBC:352 \ + blowfish:384:Blowfish-CBC:384 blowfish:416:Blowfish-CBC:416 \ + blowfish:448:Blowfish-CBC:448 \ + camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \ + camellia:256:CAMELLIA-CBC:256 ; do + + ealgo=`echo $spec | cut -d : -f 1` + keylen=`echo $spec | cut -d : -f 2` + expected_ealgo=`echo $spec | cut -d : -f 3` + expected_keylen=`echo $spec | cut -d : -f 4` + + do_test $ealgo $keylen $expected_ealgo $expected_keylen +done + +rm -f $keyfile Modified: stable/10/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,62 +4,52 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=32 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +for_each_geli_config_nointegrity do_test + +rm -f $rnd rm -f $keyfile Modified: stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,96 +4,85 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..5520" +echo "1..2400" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - #mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - mdconfig -a -t malloc -s $sectors -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first small sector to the second small sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` - ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first big sector to the second big sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first small sector to the second small sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` + ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` + + # Fix the corruption + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first big sector to the second big sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/10/tests/sys/geom/class/eli/integrity_data_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,66 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of data. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of data. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,66 +4,43 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of HMAC. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 2 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of HMAC. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/10/tests/sys/geom/class/eli/onetime_a_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,51 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=8 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${rnd} bs=1024 count=1024 >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd Modified: stable/10/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -6,54 +6,45 @@ base=`basename $0` sectors=100 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 - - geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + + rnd=`mktemp $base.XXXXXX` || exit 1 + mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 + + geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + rm -f $rnd + mdconfig -d -u $no +} + +i=1 +for_each_geli_config_nointegrity do_test Modified: stable/10/tests/sys/geom/class/nop/Makefile ============================================================================== --- stable/10/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:10:31 2017 (r312828) @@ -2,15 +2,6 @@ TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -TAP_TESTS_SH+= 1_test -TAP_TESTS_SH+= 2_test - -FILES+= conf.sh -FILESNAME_conf.sh= conf.sh -FILESDIR= ${TESTSDIR} - -.for t in ${TAP_TESTS_SH} -TEST_METADATA.$t+= required_user="root" -.endfor +ATF_TESTS_SH+= nop_test .include Copied: stable/10/tests/sys/geom/class/nop/nop_test.sh (from r310803, head/tests/sys/geom/class/nop/nop_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tests/sys/geom/class/nop/nop_test.sh Thu Jan 26 20:10:31 2017 (r312828, copy of r310803, head/tests/sys/geom/class/nop/nop_test.sh) @@ -0,0 +1,166 @@ +# Copyright (c) 2016 Alan Somers +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +MD_DEVS="md.devs" +PLAINFILES=plainfiles + +atf_test_case diskinfo cleanup +diskinfo_head() +{ + atf_set "descr" "gnop should preserve diskinfo's basic properties" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +diskinfo_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + md_secsize=$(diskinfo ${us} | cut -wf 2) + md_mediasize=$(diskinfo ${us} | cut -wf 3) + md_stripesize=$(diskinfo ${us} | cut -wf 5) + nop_secsize=$(diskinfo ${us}.nop | cut -wf 2) + nop_mediasize=$(diskinfo ${us}.nop | cut -wf 3) + nop_stripesize=$(diskinfo ${us}.nop | cut -wf 5) + atf_check_equal "$md_secsize" "$nop_secsize" + atf_check_equal "$md_mediasize" "$nop_mediasize" + atf_check_equal "$md_stripesize" "$nop_stripesize" +} +diskinfo_cleanup() +{ + common_cleanup +} + +atf_test_case io cleanup +io_head() +{ + atf_set "descr" "I/O works on gnop devices" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +io_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + + echo src >> $PLAINFILES + echo dst >> $PLAINFILES + dd if=/dev/random of=src bs=1m count=1 >/dev/null 2>&1 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Jan 26 20:15:17 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B4F1CC32A1; Thu, 26 Jan 2017 20:15:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8363F11; Thu, 26 Jan 2017 20:15:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKFFkQ085281; Thu, 26 Jan 2017 20:15:15 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKFExH085265; Thu, 26 Jan 2017 20:15:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201701262015.v0QKFExH085265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 26 Jan 2017 20:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312829 - in stable/11: . tests/sys/geom/class/eli tests/sys/geom/class/nop X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:15:17 -0000 Author: asomers Date: Thu Jan 26 20:15:14 2017 New Revision: 312829 URL: https://svnweb.freebsd.org/changeset/base/312829 Log: MFC r310786, r310803, r310985, r311894 r310786: Reduce the runtime of the GELI tests There is no reduction in test coverage. On my system runtime is reduced from 38m32s to 6m24s. tests/sys/geom/class/eli/conf.sh tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh tests/sys/geom/class/eli/onetime_test.sh Move the looping code into common functions in conf.sh, and remove alias ciphers from the list. tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Move a few commands that don't need to be in the inner loop out. tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Reduce the sector count tests/sys/geom/class/eli/Makefile tests/sys/geom/class/eli/init_alias_test.sh Add a test for initializing a GELI device using one of the cipher aliases, and check that the alias is correctly interpreted. MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8814 r310803: ATFify the gnop tests Also, add test cases for the -p, -P, and -s options to gnop create Reviewed by: ngie MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D8892 r310985: Update ObsoleteFiles.inc for r310803 MFC after: 26 days X-MFC-with: 310803 r311894: Fix typo from change 310985 in ObsoleteFiles.inc MFC after: 16 days X-MFC-With: 310803 Sponsored by: Spectra Logic Corp Added: stable/11/tests/sys/geom/class/eli/init_alias_test.sh - copied unchanged from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh stable/11/tests/sys/geom/class/nop/nop_test.sh - copied unchanged from r310803, head/tests/sys/geom/class/nop/nop_test.sh Deleted: stable/11/tests/sys/geom/class/nop/1_test.sh stable/11/tests/sys/geom/class/nop/2_test.sh stable/11/tests/sys/geom/class/nop/conf.sh Modified: stable/11/ObsoleteFiles.inc stable/11/tests/sys/geom/class/eli/Makefile stable/11/tests/sys/geom/class/eli/conf.sh stable/11/tests/sys/geom/class/eli/init_a_test.sh stable/11/tests/sys/geom/class/eli/init_test.sh stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh stable/11/tests/sys/geom/class/eli/integrity_data_test.sh stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh stable/11/tests/sys/geom/class/eli/onetime_a_test.sh stable/11/tests/sys/geom/class/eli/onetime_test.sh stable/11/tests/sys/geom/class/nop/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/ObsoleteFiles.inc Thu Jan 26 20:15:14 2017 (r312829) @@ -40,6 +40,10 @@ # 20170112: sysdecode_getfsstat_flags() renamed to sysdecode_getfsstat_mode() OLD_FILES+=usr/share/man/man3/sysdecode_getfsstat_flags.3.gz +# 20161229: Three files from gnop tests consolidated into one +OLD_FILES+=usr/tests/sys/geom/class/nop/1_test +OLD_FILES+=usr/tests/sys/geom/class/nop/2_test +OLD_FILES+=usr/tests/sys/geom/class/nop/conf.sh # 20161217: new clang import which bumps version from 3.9.0 to 3.9.1. OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/asan_interface.h Modified: stable/11/tests/sys/geom/class/eli/Makefile ============================================================================== --- stable/11/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:15:14 2017 (r312829) @@ -11,6 +11,7 @@ TAP_TESTS_SH+= detach_l_test TAP_TESTS_SH+= init_B_test TAP_TESTS_SH+= init_J_test TAP_TESTS_SH+= init_a_test +TAP_TESTS_SH+= init_alias_test TAP_TESTS_SH+= init_i_P_test TAP_TESTS_SH+= init_test TAP_TESTS_SH+= integrity_copy_test Modified: stable/11/tests/sys/geom/class/eli/conf.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -11,6 +11,54 @@ while [ -c /dev/md$no ]; do : $(( no += 1 )) done +# Execute `func` for each combination of cipher, sectorsize, and hmac algo +# `func` usage should be: +# func +for_each_geli_config() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ + hmac/sha384 hmac/sha512; do + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done + done +} + +# Execute `func` for each combination of cipher, and sectorsize, with no hmac +# `func` usage should be: +# func +for_each_geli_config_nointegrity() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done +} + + geli_test_cleanup() { [ -c /dev/md${no}.eli ] && geli detach md${no}.eli Modified: stable/11/tests/sys/geom/class/eli/init_a_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -6,55 +6,45 @@ base=`basename $0` sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" - -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +echo "1..600" + +i=1 + +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +dd if=/dev/random of=${rnd} bs=8192 count=${sectors} >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd rm -f $keyfile Copied: stable/11/tests/sys/geom/class/eli/init_alias_test.sh (from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/eli/init_alias_test.sh Thu Jan 26 20:15:14 2017 (r312829, copy of r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) @@ -0,0 +1,64 @@ +#!/bin/sh +# $FreeBSD$ + +# Test "geli init"'s various cipher aliases +. $(dirname $0)/conf.sh + +base=`basename $0` +sectors=100 +keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 + +do_test() { + ealgo=$1 + keylen=$2 + expected_ealgo=$3 + expected_keylen=$4 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + real_ealgo=`geli list md${no}.eli | awk '/EncryptionAlgorithm/ {print $2}'` + real_keylen=`geli list md${no}.eli | awk '/KeyLength/ {print $2}'` + + if [ ${real_ealgo} = ${expected_ealgo} ]; then + echo "ok $i - ${ealgo} aliased to ${real_ealgo}" + else + echo "not ok $i - expected ${expected_ealgo} but got ${real_ealgo}" + fi + i=$((i+1)) + + if [ ${real_keylen} = ${expected_keylen} ]; then + echo "ok $i - keylen=${keylen} for ealgo=${ealgo} aliases to ${real_keylen}" + else + echo "not ok $i - expected ${expected_keylen} but got ${real_keylen}" + fi + i=$((i+1)) + + geli detach md${no} +} + +echo "1..38" +i=1 +mdconfig -a -t malloc -s 1024k -u $no || exit 1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \ + 3des:0:3DES-CBC:192 3des:192:3DES-CBC:192 \ + blowfish:0:Blowfish-CBC:128 blowfish:128:Blowfish-CBC:128 \ + blowfish:160:Blowfish-CBC:160 blowfish:192:Blowfish-CBC:192 \ + blowfish:224:Blowfish-CBC:224 blowfish:256:Blowfish-CBC:256 \ + blowfish:288:Blowfish-CBC:288 blowfish:352:Blowfish-CBC:352 \ + blowfish:384:Blowfish-CBC:384 blowfish:416:Blowfish-CBC:416 \ + blowfish:448:Blowfish-CBC:448 \ + camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \ + camellia:256:CAMELLIA-CBC:256 ; do + + ealgo=`echo $spec | cut -d : -f 1` + keylen=`echo $spec | cut -d : -f 2` + expected_ealgo=`echo $spec | cut -d : -f 3` + expected_keylen=`echo $spec | cut -d : -f 4` + + do_test $ealgo $keylen $expected_ealgo $expected_keylen +done + +rm -f $keyfile Modified: stable/11/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,62 +4,52 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=32 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +for_each_geli_config_nointegrity do_test + +rm -f $rnd rm -f $keyfile Modified: stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,96 +4,85 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..5520" +echo "1..2400" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - #mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - mdconfig -a -t malloc -s $sectors -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first small sector to the second small sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` - ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first big sector to the second big sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first small sector to the second small sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` + ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` + + # Fix the corruption + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first big sector to the second big sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/11/tests/sys/geom/class/eli/integrity_data_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,66 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of data. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of data. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,66 +4,43 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of HMAC. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 2 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of HMAC. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/11/tests/sys/geom/class/eli/onetime_a_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,51 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=8 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${rnd} bs=1024 count=1024 >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd Modified: stable/11/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -6,54 +6,45 @@ base=`basename $0` sectors=100 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 - - geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + + rnd=`mktemp $base.XXXXXX` || exit 1 + mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 + + geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + rm -f $rnd + mdconfig -d -u $no +} + +i=1 +for_each_geli_config_nointegrity do_test Modified: stable/11/tests/sys/geom/class/nop/Makefile ============================================================================== --- stable/11/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:15:14 2017 (r312829) @@ -4,13 +4,6 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -TAP_TESTS_SH+= 1_test -TAP_TESTS_SH+= 2_test - -${PACKAGE}FILES+= conf.sh - -.for t in ${TAP_TESTS_SH} -TEST_METADATA.$t+= required_user="root" -.endfor +ATF_TESTS_SH+= nop_test .include Copied: stable/11/tests/sys/geom/class/nop/nop_test.sh (from r310803, head/tests/sys/geom/class/nop/nop_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/nop/nop_test.sh Thu Jan 26 20:15:14 2017 (r312829, copy of r310803, head/tests/sys/geom/class/nop/nop_test.sh) @@ -0,0 +1,166 @@ +# Copyright (c) 2016 Alan Somers +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +MD_DEVS="md.devs" +PLAINFILES=plainfiles + +atf_test_case diskinfo cleanup +diskinfo_head() +{ + atf_set "descr" "gnop should preserve diskinfo's basic properties" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +diskinfo_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + md_secsize=$(diskinfo ${us} | cut -wf 2) + md_mediasize=$(diskinfo ${us} | cut -wf 3) + md_stripesize=$(diskinfo ${us} | cut -wf 5) + nop_secsize=$(diskinfo ${us}.nop | cut -wf 2) + nop_mediasize=$(diskinfo ${us}.nop | cut -wf 3) + nop_stripesize=$(diskinfo ${us}.nop | cut -wf 5) + atf_check_equal "$md_secsize" "$nop_secsize" + atf_check_equal "$md_mediasize" "$nop_mediasize" + atf_check_equal "$md_stripesize" "$nop_stripesize" +} +diskinfo_cleanup() +{ + common_cleanup +} + +atf_test_case io cleanup +io_head() +{ + atf_set "descr" "I/O works on gnop devices" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +io_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + + echo src >> $PLAINFILES + echo dst >> $PLAINFILES + dd if=/dev/random of=src bs=1m count=1 >/dev/null 2>&1 + dd if=src of=/dev/${us}.nop bs=1m count=1 > /dev/null 2>&1 + dd if=/dev/${us}.nop of=dst bs=1m count=1 > /dev/null 2>&1 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Jan 26 20:49:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9A15CC100E; Thu, 26 Jan 2017 20:49:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52A50BD6; Thu, 26 Jan 2017 20:49:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKnJ8w098177; Thu, 26 Jan 2017 20:49:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKnJeR098175; Thu, 26 Jan 2017 20:49:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262049.v0QKnJeR098175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312834 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:49:20 -0000 Author: mav Date: Thu Jan 26 20:49:19 2017 New Revision: 312834 URL: https://svnweb.freebsd.org/changeset/base/312834 Log: MFC r310778, r310782: Improve use of I/O's private area. - Since I/Os are allocates from per-port pools, make allocations store pointer to CTL softc there, and use it where needed instead of global. - Created bunch of helper macros to access LUN, port and CTL softc. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_backend_block.c stable/11/sys/cam/ctl/ctl_backend_ramdisk.c stable/11/sys/cam/ctl/ctl_error.c stable/11/sys/cam/ctl/ctl_io.h stable/11/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:45:04 2017 (r312833) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:49:19 2017 (r312834) @@ -437,7 +437,6 @@ static int ctl_alloc_lun(struct ctl_soft struct ctl_be_lun *be_lun); static int ctl_free_lun(struct ctl_lun *lun); static void ctl_create_lun(struct ctl_be_lun *be_lun); -static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr); static int ctl_do_mode_select(union ctl_io *io); static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, @@ -448,7 +447,7 @@ static int ctl_pro_preempt(struct ctl_so struct scsi_per_res_out_parms* param); static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg); -static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); +static void ctl_hndl_per_res_out_on_other_sc(union ctl_io *io); static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); @@ -567,13 +566,12 @@ static struct ctl_frontend ha_frontend = static void ctl_ha_datamove(union ctl_io *io) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(io); struct ctl_sg_entry *sgl; union ctl_ha_msg msg; uint32_t sg_entries_sent; int do_sg_copy, i, j; - lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; memset(&msg.dt, 0, sizeof(msg.dt)); msg.hdr.msg_type = CTL_MSG_DATAMOVE; msg.hdr.original_sc = io->io_hdr.original_sc; @@ -1803,7 +1801,8 @@ ctl_init(void) args.mda_si_drv1 = softc; error = make_dev_s(&args, &softc->dev, "cam/ctl"); if (error != 0) { - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); + control_softc = NULL; return (error); } @@ -1815,7 +1814,7 @@ ctl_init(void) if (softc->sysctl_tree == NULL) { printf("%s: unable to allocate sysctl tree\n", __func__); destroy_dev(softc->dev); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; return (ENOMEM); } @@ -1963,7 +1962,7 @@ ctl_shutdown(void) sysctl_ctx_free(&softc->sysctl_ctx); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; } @@ -2205,18 +2204,16 @@ ctl_create_iid(struct ctl_port *port, in static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); union ctl_ha_msg msg_info; - struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; - mtx_lock(&softc->ctl_lock); /* Make sure that we know about this port. */ - port = ctl_io_port(&ctsio->io_hdr); if (port == NULL || (port->status & CTL_PORT_STATUS_ONLINE) == 0) { ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, /*retry_count*/ 1); @@ -2224,6 +2221,7 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ + mtx_lock(&softc->ctl_lock); if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); @@ -2256,8 +2254,8 @@ ctl_serialize_other_sc_cmd(struct ctl_sc goto badjuju; } - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = lun->be_lun; + CTL_LUN(ctsio) = lun; + CTL_BACKEND_LUN(ctsio) = lun->be_lun; /* * Every I/O goes into the OOA queue for a @@ -3625,13 +3623,6 @@ ctl_encode_lun(uint32_t decoded) return ((((uint64_t)RPL_LUNDATA_ATYP_EXTLUN | 0x22) << 56) | (l << 16)); } -static struct ctl_port * -ctl_io_port(struct ctl_io_hdr *io_hdr) -{ - - return (control_softc->ctl_ports[io_hdr->nexus.targ_port]); -} - int ctl_ffz(uint32_t *mask, uint32_t first, uint32_t last) { @@ -3749,7 +3740,6 @@ int ctl_pool_create(struct ctl_softc *ctl_softc, const char *pool_name, uint32_t total_ctl_io, void **npool) { -#ifdef IO_POOLS struct ctl_io_pool *pool; pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, @@ -3759,14 +3749,15 @@ ctl_pool_create(struct ctl_softc *ctl_so snprintf(pool->name, sizeof(pool->name), "CTL IO %s", pool_name); pool->ctl_softc = ctl_softc; +#ifdef IO_POOLS pool->zone = uma_zsecond_create(pool->name, NULL, NULL, NULL, NULL, ctl_softc->io_zone); /* uma_prealloc(pool->zone, total_ctl_io); */ - - *npool = pool; #else - *npool = ctl_softc->io_zone; + pool->zone = ctl_softc->io_zone; #endif + + *npool = pool; return (0); } @@ -3779,64 +3770,54 @@ ctl_pool_free(struct ctl_io_pool *pool) #ifdef IO_POOLS uma_zdestroy(pool->zone); - free(pool, M_CTL); #endif + free(pool, M_CTL); } union ctl_io * ctl_alloc_io(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_WAITOK); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_WAITOK); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } union ctl_io * ctl_alloc_io_nowait(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_NOWAIT); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_NOWAIT); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } void ctl_free_io(union ctl_io *io) { -#ifdef IO_POOLS struct ctl_io_pool *pool; -#endif if (io == NULL) return; -#ifdef IO_POOLS pool = (struct ctl_io_pool *)io->io_hdr.pool; uma_zfree(pool->zone, io); -#else - uma_zfree((uma_zone_t)io->io_hdr.pool, io); -#endif } void ctl_zero_io(union ctl_io *io) { - void *pool_ref; + struct ctl_io_pool *pool; if (io == NULL) return; @@ -3844,9 +3825,10 @@ ctl_zero_io(union ctl_io *io) /* * May need to preserve linked list pointers at some point too. */ - pool_ref = io->io_hdr.pool; + pool = io->io_hdr.pool; memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; + io->io_hdr.pool = pool; + CTL_SOFTC(io) = pool->ctl_softc; } int @@ -4653,12 +4635,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft static int ctl_free_lun(struct ctl_lun *lun) { - struct ctl_softc *softc; + struct ctl_softc *softc = lun->ctl_softc; struct ctl_lun *nlun; int i; - softc = lun->ctl_softc; - mtx_assert(&softc->ctl_lock, MA_OWNED); STAILQ_REMOVE(&softc->lun_list, lun, ctl_lun, links); @@ -5159,13 +5139,12 @@ ctl_config_read_done(union ctl_io *io) int ctl_scsi_release(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_scsi_release\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5197,13 +5176,12 @@ ctl_scsi_release(struct ctl_scsiio *ctsi int ctl_scsi_reserve(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_reserve\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5238,13 +5216,12 @@ bailout: int ctl_start_stop(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_start_stop_unit *cdb; - struct ctl_lun *lun; int retval; CTL_DEBUG_PRINT(("ctl_start_stop\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; if ((cdb->how & SSS_PC_MASK) == 0) { @@ -5293,14 +5270,13 @@ ctl_start_stop(struct ctl_scsiio *ctsio) int ctl_prevent_allow(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_prevent *cdb; int retval; uint32_t initidx; CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_prevent *)ctsio->cdb; if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { @@ -5334,8 +5310,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts int ctl_sync_cache(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; - struct ctl_softc *softc; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t starting_lba; uint32_t block_count; @@ -5344,8 +5319,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_sync_cache\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; retval = 0; switch (ctsio->cdb[0]) { @@ -5401,13 +5374,10 @@ int ctl_format(struct ctl_scsiio *ctsio) { struct scsi_format *cdb; - struct ctl_lun *lun; int length, defect_list_len; CTL_DEBUG_PRINT(("ctl_format\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - cdb = (struct scsi_format *)ctsio->cdb; length = 0; @@ -5486,7 +5456,7 @@ bailout: int ctl_read_buffer(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint64_t buffer_offset; uint32_t len; uint8_t byte2; @@ -5494,7 +5464,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio static uint8_t echo_descr[4] = { 0 }; CTL_DEBUG_PRINT(("ctl_read_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + switch (ctsio->cdb[0]) { case READ_BUFFER: { struct scsi_read_buffer *cdb; @@ -5561,13 +5531,12 @@ ctl_read_buffer(struct ctl_scsiio *ctsio int ctl_write_buffer(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_write_buffer *cdb; - struct ctl_lun *lun; int buffer_offset, len; CTL_DEBUG_PRINT(("ctl_write_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_write_buffer *)ctsio->cdb; len = scsi_3btoul(cdb->length); @@ -5614,7 +5583,7 @@ ctl_write_buffer(struct ctl_scsiio *ctsi int ctl_write_same(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; @@ -5623,8 +5592,6 @@ ctl_write_same(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_write_same\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - switch (ctsio->cdb[0]) { case WRITE_SAME_10: { struct scsi_write_same_10 *cdb; @@ -5728,7 +5695,7 @@ ctl_write_same(struct ctl_scsiio *ctsio) int ctl_unmap(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_unmap *cdb; struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_header *hdr; @@ -5740,9 +5707,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_unmap\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_unmap *)ctsio->cdb; - len = scsi_2btoul(cdb->length); byte2 = cdb->byte2; @@ -5832,12 +5797,11 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint8_t *current_cp; int set_ua; uint32_t initidx; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); set_ua = 0; @@ -5887,13 +5851,12 @@ int ctl_ie_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_info_exceptions_page *pg; - struct ctl_lun *lun; uint64_t t; (void)ctl_default_page_handler(ctsio, page_index, page_ptr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; pg = (struct scsi_info_exceptions_page *)page_ptr; mtx_lock(&lun->lun_lock); if (pg->info_flags & SIEP_FLAGS_TEST) { @@ -5930,19 +5893,18 @@ ctl_ie_page_handler(struct ctl_scsiio *c static int ctl_do_mode_select(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct scsi_mode_page_header *page_header; struct ctl_page_index *page_index; struct ctl_scsiio *ctsio; int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; - struct ctl_lun *lun; uint16_t *len_left, *len_used; int retval, i; ctsio = &io->scsiio; page_index = NULL; page_len = 0; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; modepage_info = (union ctl_modepage_info *) ctsio->io_hdr.ctl_private[CTL_PRIV_MODEPAGE].bytes; @@ -6155,12 +6117,11 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); union ctl_modepage_info *modepage_info; int bd_len, i, header_size, param_len, pf, rtd, sp; uint32_t initidx; - lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { @@ -6305,7 +6266,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio int ctl_mode_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int pc, page_code, dbd, llba, subpage; int alloc_len, page_len, header_len, total_len; struct scsi_mode_block_descr *block_desc; @@ -6317,7 +6278,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_mode_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; switch (ctsio->cdb[0]) { case MODE_SENSE_6: { struct scsi_mode_sense_6 *cdb; @@ -6653,12 +6613,11 @@ ctl_lbp_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_param_header *phdr; uint8_t *data; uint64_t val; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = page_index->page_data; if (lun->backend->lun_attr != NULL && @@ -6722,13 +6681,12 @@ ctl_sap_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; uint64_t rn, wn, rb, wb; struct bintime rt, wt; int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct stat_page *)page_index->page_data; scsi_ulto2b(SLP_SAP, data->sap.hdr.param_code); @@ -6781,10 +6739,9 @@ ctl_ie_log_sense_handler(struct ctl_scsi struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_informational_exceptions *data; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct scsi_log_informational_exceptions *)page_index->page_data; scsi_ulto2b(SLP_IE_GEN, data->hdr.param_code); @@ -6800,7 +6757,7 @@ ctl_ie_log_sense_handler(struct ctl_scsi int ctl_log_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int i, pc, page_code, subpage; int alloc_len, total_len; struct ctl_page_index *page_index; @@ -6809,7 +6766,6 @@ ctl_log_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_log_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_log_sense *)ctsio->cdb; pc = (cdb->page & SLS_PAGE_CTRL_MASK) >> 6; page_code = cdb->page & SLS_PAGE_CODE; @@ -6886,9 +6842,9 @@ ctl_log_sense(struct ctl_scsiio *ctsio) int ctl_read_capacity(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity *cdb; struct scsi_read_capacity_data *data; - struct ctl_lun *lun; uint32_t lba; CTL_DEBUG_PRINT(("ctl_read_capacity\n")); @@ -6908,8 +6864,6 @@ ctl_read_capacity(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data *)ctsio->kern_data_ptr; ctsio->residual = 0; @@ -6944,9 +6898,9 @@ ctl_read_capacity(struct ctl_scsiio *cts int ctl_read_capacity_16(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity_16 *cdb; struct scsi_read_capacity_data_long *data; - struct ctl_lun *lun; uint64_t lba; uint32_t alloc_len; @@ -6969,8 +6923,6 @@ ctl_read_capacity_16(struct ctl_scsiio * return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data_long *)ctsio->kern_data_ptr; @@ -7005,9 +6957,9 @@ ctl_read_capacity_16(struct ctl_scsiio * int ctl_get_lba_status(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_get_lba_status *cdb; struct scsi_get_lba_status_data *data; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t alloc_len, total_len; @@ -7015,7 +6967,6 @@ ctl_get_lba_status(struct ctl_scsiio *ct CTL_DEBUG_PRINT(("ctl_get_lba_status\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_get_lba_status *)ctsio->cdb; lba = scsi_8btou64(cdb->addr); alloc_len = scsi_4btoul(cdb->alloc_len); @@ -7128,12 +7079,12 @@ ctl_read_defect(struct ctl_scsiio *ctsio int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_maintenance_in *cdb; int retval; int alloc_len, ext, total_len = 0, g, pc, pg, ts, os; int num_ha_groups, num_target_ports, shared_group; - struct ctl_lun *lun; - struct ctl_softc *softc; struct ctl_port *port; struct scsi_target_group_data *rtg_ptr; struct scsi_target_group_data_extended *rtg_ext_ptr; @@ -7142,9 +7093,6 @@ ctl_report_tagret_port_groups(struct ctl CTL_DEBUG_PRINT(("ctl_report_tagret_port_groups\n")); cdb = (struct scsi_maintenance_in *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retval = CTL_RETVAL_COMPLETE; switch (cdb->byte2 & STG_PDF_MASK) { @@ -7310,7 +7258,7 @@ ctl_report_tagret_port_groups(struct ctl int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_report_supported_opcodes *cdb; const struct ctl_cmd_entry *entry, *sentry; struct scsi_report_supported_opcodes_all *all; @@ -7323,8 +7271,6 @@ ctl_report_supported_opcodes(struct ctl_ CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n")); cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - retval = CTL_RETVAL_COMPLETE; opcode = cdb->requested_opcode; @@ -7589,11 +7535,11 @@ ctl_report_timestamp(struct ctl_scsiio * int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_per_res_in *cdb; int alloc_len, total_len = 0; /* struct scsi_per_res_in_rsrv in_data; */ - struct ctl_lun *lun; - struct ctl_softc *softc; uint64_t key; CTL_DEBUG_PRINT(("ctl_persistent_reserve_in\n")); @@ -7602,9 +7548,6 @@ ctl_persistent_reserve_in(struct ctl_scs alloc_len = scsi_2btoul(cdb->length); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retry: mtx_lock(&lun->lun_lock); switch (cdb->action) { @@ -8167,12 +8110,12 @@ ctl_pro_preempt_other(struct ctl_lun *lu int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); int retval; u_int32_t param_len; struct scsi_per_res_out *cdb; - struct ctl_lun *lun; struct scsi_per_res_out_parms* param; - struct ctl_softc *softc; uint32_t residx; uint64_t res_key, sa_res_key, key; uint8_t type; @@ -8181,11 +8124,8 @@ ctl_persistent_reserve_out(struct ctl_sc CTL_DEBUG_PRINT(("ctl_persistent_reserve_out\n")); - retval = CTL_RETVAL_COMPLETE; - cdb = (struct scsi_per_res_out *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; + retval = CTL_RETVAL_COMPLETE; /* * We only support whole-LUN scope. The scope & type are ignored for @@ -8559,9 +8499,10 @@ done: * in sync. */ static void -ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) +ctl_hndl_per_res_out_on_other_sc(union ctl_io *io) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(io); + union ctl_ha_msg *msg = (union ctl_ha_msg *)&io->presio.pr_msg; struct ctl_lun *lun; int i; uint32_t residx, targ_lun; @@ -8680,15 +8621,13 @@ ctl_hndl_per_res_out_on_other_sc(union c int ctl_read_write(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; int isread; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_read_write: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8873,15 +8812,14 @@ ctl_read_write(struct ctl_scsiio *ctsio) static int ctl_cnw_cont(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct ctl_scsiio *ctsio; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; int retval; ctsio = &io->scsiio; ctsio->io_hdr.status = CTL_STATUS_NONE; ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; lbalen = (struct ctl_lba_len_flags *) &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; lbalen->flags &= ~CTL_LLF_COMPARE; @@ -8895,14 +8833,12 @@ ctl_cnw_cont(union ctl_io *io) int ctl_cnw(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_cnw: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8983,15 +8919,13 @@ ctl_cnw(struct ctl_scsiio *ctsio) int ctl_verify(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int bytchk, flags; int retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_verify: command: %#x\n", ctsio->cdb[0])); bytchk = 0; @@ -9087,19 +9021,17 @@ ctl_verify(struct ctl_scsiio *ctsio) int ctl_report_luns(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun, *request_lun = CTL_LUN(ctsio); struct scsi_report_luns *cdb; struct scsi_report_luns_data *lun_data; - struct ctl_lun *lun, *request_lun; - struct ctl_port *port; int num_filled, num_luns, num_port_luns, retval; uint32_t alloc_len, lun_datalen; uint32_t initidx, targ_lun_id, lun_id; retval = CTL_RETVAL_COMPLETE; cdb = (struct scsi_report_luns *)ctsio->cdb; - port = ctl_io_port(&ctsio->io_hdr); - softc = port->ctl_softc; CTL_DEBUG_PRINT(("ctl_report_luns\n")); @@ -9152,9 +9084,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio return (retval); } - request_lun = (struct ctl_lun *) - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - lun_datalen = sizeof(*lun_data) + (num_luns * sizeof(struct scsi_report_luns_lundata)); @@ -9245,10 +9174,10 @@ ctl_report_luns(struct ctl_scsiio *ctsio int ctl_request_sense(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_request_sense *cdb; struct scsi_sense_data *sense_ptr; - struct ctl_softc *softc; - struct ctl_lun *lun; uint32_t initidx; int have_error; u_int sense_len = SSD_FULL_SIZE; @@ -9258,9 +9187,6 @@ ctl_request_sense(struct ctl_scsiio *cts cdb = (struct scsi_request_sense *)ctsio->cdb; - softc = control_softc; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_request_sense\n")); /* @@ -9403,13 +9329,11 @@ ctl_tur(struct ctl_scsiio *ctsio) static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_supported_pages *pages; int sup_page_size; - struct ctl_lun *lun; int p; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - sup_page_size = sizeof(struct scsi_vpd_supported_pages) * SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); @@ -9478,12 +9402,10 @@ ctl_inquiry_evpd_supported(struct ctl_sc static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_unit_serial_number *sn_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = 4 + CTL_SN_LEN; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; @@ -9537,12 +9459,10 @@ ctl_inquiry_evpd_serial(struct ctl_scsii static int ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_extended_inquiry_data *eid_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; @@ -9613,12 +9533,10 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_mode_page_policy *mpp_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + sizeof(struct scsi_vpd_mode_page_policy_descr); @@ -9667,19 +9585,14 @@ ctl_inquiry_evpd_mpp(struct ctl_scsiio * static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_device_id *devid_ptr; struct scsi_vpd_id_descriptor *desc; - struct ctl_softc *softc; - struct ctl_lun *lun; - struct ctl_port *port; int data_len, g; uint8_t proto; - softc = control_softc; - - port = ctl_io_port(&ctsio->io_hdr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_device_id) + sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_rel_trgt_port_id) + @@ -9792,16 +9705,14 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_scsi_ports *sp; struct scsi_vpd_port_designation *pd; struct scsi_vpd_port_designation_cont *pdc; - struct ctl_lun *lun; struct ctl_port *port; int data_len, num_target_ports, iid_len, id_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - num_target_ports = 0; iid_len = 0; id_len = 0; @@ -9895,12 +9806,10 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_limits *bl_ptr; - struct ctl_lun *lun; uint64_t ival; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9972,13 +9881,11 @@ ctl_inquiry_evpd_block_limits(struct ctl static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_device_characteristics *bdc_ptr; - struct ctl_lun *lun; const char *value; u_int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bdc_ptr), M_CTL, M_WAITOK | M_ZERO); bdc_ptr = (struct scsi_vpd_block_device_characteristics *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10032,12 +9939,10 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * static int ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_logical_block_prov *lbp_ptr; - struct ctl_lun *lun; const char *value; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10095,11 +10000,10 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_inquiry *cdb; int alloc_len, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; alloc_len = scsi_2btoul(cdb->length); @@ -10162,21 +10066,19 @@ err: static int ctl_inquiry_std(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Jan 26 20:50:02 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1A08CC10E3; Thu, 26 Jan 2017 20:50:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5912CD7E; Thu, 26 Jan 2017 20:50:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKo19E098293; Thu, 26 Jan 2017 20:50:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKo1hD098291; Thu, 26 Jan 2017 20:50:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262050.v0QKo1hD098291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312835 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:50:02 -0000 Author: mav Date: Thu Jan 26 20:50:01 2017 New Revision: 312835 URL: https://svnweb.freebsd.org/changeset/base/312835 Log: MFC r310778, r310782: Improve use of I/O's private area. - Since I/Os are allocates from per-port pools, make allocations store pointer to CTL softc there, and use it where needed instead of global. - Created bunch of helper macros to access LUN, port and CTL softc. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_backend_ramdisk.c stable/10/sys/cam/ctl/ctl_error.c stable/10/sys/cam/ctl/ctl_io.h stable/10/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:49:19 2017 (r312834) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:50:01 2017 (r312835) @@ -439,7 +439,6 @@ static int ctl_alloc_lun(struct ctl_soft struct ctl_be_lun *be_lun); static int ctl_free_lun(struct ctl_lun *lun); static void ctl_create_lun(struct ctl_be_lun *be_lun); -static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr); static int ctl_do_mode_select(union ctl_io *io); static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, @@ -450,7 +449,7 @@ static int ctl_pro_preempt(struct ctl_so struct scsi_per_res_out_parms* param); static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg); -static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); +static void ctl_hndl_per_res_out_on_other_sc(union ctl_io *io); static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); @@ -569,13 +568,12 @@ static struct ctl_frontend ha_frontend = static void ctl_ha_datamove(union ctl_io *io) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(io); struct ctl_sg_entry *sgl; union ctl_ha_msg msg; uint32_t sg_entries_sent; int do_sg_copy, i, j; - lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; memset(&msg.dt, 0, sizeof(msg.dt)); msg.hdr.msg_type = CTL_MSG_DATAMOVE; msg.hdr.original_sc = io->io_hdr.original_sc; @@ -1805,7 +1803,8 @@ ctl_init(void) args.mda_si_drv1 = softc; error = make_dev_s(&args, &softc->dev, "cam/ctl"); if (error != 0) { - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); + control_softc = NULL; return (error); } @@ -1817,7 +1816,7 @@ ctl_init(void) if (softc->sysctl_tree == NULL) { printf("%s: unable to allocate sysctl tree\n", __func__); destroy_dev(softc->dev); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; return (ENOMEM); } @@ -1967,7 +1966,7 @@ ctl_shutdown(void) sysctl_ctx_free(&softc->sysctl_ctx); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; } @@ -2209,18 +2208,16 @@ ctl_create_iid(struct ctl_port *port, in static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); union ctl_ha_msg msg_info; - struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; - mtx_lock(&softc->ctl_lock); /* Make sure that we know about this port. */ - port = ctl_io_port(&ctsio->io_hdr); if (port == NULL || (port->status & CTL_PORT_STATUS_ONLINE) == 0) { ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, /*retry_count*/ 1); @@ -2228,6 +2225,7 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ + mtx_lock(&softc->ctl_lock); if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); @@ -2260,8 +2258,8 @@ ctl_serialize_other_sc_cmd(struct ctl_sc goto badjuju; } - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = lun->be_lun; + CTL_LUN(ctsio) = lun; + CTL_BACKEND_LUN(ctsio) = lun->be_lun; /* * Every I/O goes into the OOA queue for a @@ -3616,13 +3614,6 @@ ctl_encode_lun(uint32_t decoded) return ((((uint64_t)RPL_LUNDATA_ATYP_EXTLUN | 0x22) << 56) | (l << 16)); } -static struct ctl_port * -ctl_io_port(struct ctl_io_hdr *io_hdr) -{ - - return (control_softc->ctl_ports[io_hdr->nexus.targ_port]); -} - int ctl_ffz(uint32_t *mask, uint32_t first, uint32_t last) { @@ -3740,7 +3731,6 @@ int ctl_pool_create(struct ctl_softc *ctl_softc, const char *pool_name, uint32_t total_ctl_io, void **npool) { -#ifdef IO_POOLS struct ctl_io_pool *pool; pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, @@ -3750,14 +3740,15 @@ ctl_pool_create(struct ctl_softc *ctl_so snprintf(pool->name, sizeof(pool->name), "CTL IO %s", pool_name); pool->ctl_softc = ctl_softc; +#ifdef IO_POOLS pool->zone = uma_zsecond_create(pool->name, NULL, NULL, NULL, NULL, ctl_softc->io_zone); /* uma_prealloc(pool->zone, total_ctl_io); */ - - *npool = pool; #else - *npool = ctl_softc->io_zone; + pool->zone = ctl_softc->io_zone; #endif + + *npool = pool; return (0); } @@ -3770,64 +3761,54 @@ ctl_pool_free(struct ctl_io_pool *pool) #ifdef IO_POOLS uma_zdestroy(pool->zone); - free(pool, M_CTL); #endif + free(pool, M_CTL); } union ctl_io * ctl_alloc_io(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_WAITOK); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_WAITOK); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } union ctl_io * ctl_alloc_io_nowait(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_NOWAIT); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_NOWAIT); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } void ctl_free_io(union ctl_io *io) { -#ifdef IO_POOLS struct ctl_io_pool *pool; -#endif if (io == NULL) return; -#ifdef IO_POOLS pool = (struct ctl_io_pool *)io->io_hdr.pool; uma_zfree(pool->zone, io); -#else - uma_zfree((uma_zone_t)io->io_hdr.pool, io); -#endif } void ctl_zero_io(union ctl_io *io) { - void *pool_ref; + struct ctl_io_pool *pool; if (io == NULL) return; @@ -3835,9 +3816,10 @@ ctl_zero_io(union ctl_io *io) /* * May need to preserve linked list pointers at some point too. */ - pool_ref = io->io_hdr.pool; + pool = io->io_hdr.pool; memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; + io->io_hdr.pool = pool; + CTL_SOFTC(io) = pool->ctl_softc; } int @@ -4644,12 +4626,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft static int ctl_free_lun(struct ctl_lun *lun) { - struct ctl_softc *softc; + struct ctl_softc *softc = lun->ctl_softc; struct ctl_lun *nlun; int i; - softc = lun->ctl_softc; - mtx_assert(&softc->ctl_lock, MA_OWNED); STAILQ_REMOVE(&softc->lun_list, lun, ctl_lun, links); @@ -5150,13 +5130,12 @@ ctl_config_read_done(union ctl_io *io) int ctl_scsi_release(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_scsi_release\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5188,13 +5167,12 @@ ctl_scsi_release(struct ctl_scsiio *ctsi int ctl_scsi_reserve(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_reserve\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5229,13 +5207,12 @@ bailout: int ctl_start_stop(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_start_stop_unit *cdb; - struct ctl_lun *lun; int retval; CTL_DEBUG_PRINT(("ctl_start_stop\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; if ((cdb->how & SSS_PC_MASK) == 0) { @@ -5284,14 +5261,13 @@ ctl_start_stop(struct ctl_scsiio *ctsio) int ctl_prevent_allow(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_prevent *cdb; int retval; uint32_t initidx; CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_prevent *)ctsio->cdb; if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { @@ -5325,8 +5301,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts int ctl_sync_cache(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; - struct ctl_softc *softc; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t starting_lba; uint32_t block_count; @@ -5335,8 +5310,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_sync_cache\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; retval = 0; switch (ctsio->cdb[0]) { @@ -5392,13 +5365,10 @@ int ctl_format(struct ctl_scsiio *ctsio) { struct scsi_format *cdb; - struct ctl_lun *lun; int length, defect_list_len; CTL_DEBUG_PRINT(("ctl_format\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - cdb = (struct scsi_format *)ctsio->cdb; length = 0; @@ -5477,7 +5447,7 @@ bailout: int ctl_read_buffer(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint64_t buffer_offset; uint32_t len; uint8_t byte2; @@ -5485,7 +5455,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio static uint8_t echo_descr[4] = { 0 }; CTL_DEBUG_PRINT(("ctl_read_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + switch (ctsio->cdb[0]) { case READ_BUFFER: { struct scsi_read_buffer *cdb; @@ -5552,13 +5522,12 @@ ctl_read_buffer(struct ctl_scsiio *ctsio int ctl_write_buffer(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_write_buffer *cdb; - struct ctl_lun *lun; int buffer_offset, len; CTL_DEBUG_PRINT(("ctl_write_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_write_buffer *)ctsio->cdb; len = scsi_3btoul(cdb->length); @@ -5605,7 +5574,7 @@ ctl_write_buffer(struct ctl_scsiio *ctsi int ctl_write_same(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; @@ -5614,8 +5583,6 @@ ctl_write_same(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_write_same\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - switch (ctsio->cdb[0]) { case WRITE_SAME_10: { struct scsi_write_same_10 *cdb; @@ -5719,7 +5686,7 @@ ctl_write_same(struct ctl_scsiio *ctsio) int ctl_unmap(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_unmap *cdb; struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_header *hdr; @@ -5731,9 +5698,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_unmap\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_unmap *)ctsio->cdb; - len = scsi_2btoul(cdb->length); byte2 = cdb->byte2; @@ -5823,12 +5788,11 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint8_t *current_cp; int set_ua; uint32_t initidx; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); set_ua = 0; @@ -5878,13 +5842,12 @@ int ctl_ie_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_info_exceptions_page *pg; - struct ctl_lun *lun; uint64_t t; (void)ctl_default_page_handler(ctsio, page_index, page_ptr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; pg = (struct scsi_info_exceptions_page *)page_ptr; mtx_lock(&lun->lun_lock); if (pg->info_flags & SIEP_FLAGS_TEST) { @@ -5921,19 +5884,18 @@ ctl_ie_page_handler(struct ctl_scsiio *c static int ctl_do_mode_select(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct scsi_mode_page_header *page_header; struct ctl_page_index *page_index; struct ctl_scsiio *ctsio; int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; - struct ctl_lun *lun; uint16_t *len_left, *len_used; int retval, i; ctsio = &io->scsiio; page_index = NULL; page_len = 0; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; modepage_info = (union ctl_modepage_info *) ctsio->io_hdr.ctl_private[CTL_PRIV_MODEPAGE].bytes; @@ -6146,12 +6108,11 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); union ctl_modepage_info *modepage_info; int bd_len, i, header_size, param_len, pf, rtd, sp; uint32_t initidx; - lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { @@ -6296,7 +6257,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio int ctl_mode_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int pc, page_code, dbd, llba, subpage; int alloc_len, page_len, header_len, total_len; struct scsi_mode_block_descr *block_desc; @@ -6308,7 +6269,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_mode_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; switch (ctsio->cdb[0]) { case MODE_SENSE_6: { struct scsi_mode_sense_6 *cdb; @@ -6644,12 +6604,11 @@ ctl_lbp_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_param_header *phdr; uint8_t *data; uint64_t val; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = page_index->page_data; if (lun->backend->lun_attr != NULL && @@ -6713,13 +6672,12 @@ ctl_sap_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; uint64_t rn, wn, rb, wb; struct bintime rt, wt; int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct stat_page *)page_index->page_data; scsi_ulto2b(SLP_SAP, data->sap.hdr.param_code); @@ -6772,10 +6730,9 @@ ctl_ie_log_sense_handler(struct ctl_scsi struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_informational_exceptions *data; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct scsi_log_informational_exceptions *)page_index->page_data; scsi_ulto2b(SLP_IE_GEN, data->hdr.param_code); @@ -6791,7 +6748,7 @@ ctl_ie_log_sense_handler(struct ctl_scsi int ctl_log_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int i, pc, page_code, subpage; int alloc_len, total_len; struct ctl_page_index *page_index; @@ -6800,7 +6757,6 @@ ctl_log_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_log_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_log_sense *)ctsio->cdb; pc = (cdb->page & SLS_PAGE_CTRL_MASK) >> 6; page_code = cdb->page & SLS_PAGE_CODE; @@ -6877,9 +6833,9 @@ ctl_log_sense(struct ctl_scsiio *ctsio) int ctl_read_capacity(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity *cdb; struct scsi_read_capacity_data *data; - struct ctl_lun *lun; uint32_t lba; CTL_DEBUG_PRINT(("ctl_read_capacity\n")); @@ -6899,8 +6855,6 @@ ctl_read_capacity(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data *)ctsio->kern_data_ptr; ctsio->residual = 0; @@ -6935,9 +6889,9 @@ ctl_read_capacity(struct ctl_scsiio *cts int ctl_read_capacity_16(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity_16 *cdb; struct scsi_read_capacity_data_long *data; - struct ctl_lun *lun; uint64_t lba; uint32_t alloc_len; @@ -6960,8 +6914,6 @@ ctl_read_capacity_16(struct ctl_scsiio * return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data_long *)ctsio->kern_data_ptr; @@ -6996,9 +6948,9 @@ ctl_read_capacity_16(struct ctl_scsiio * int ctl_get_lba_status(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_get_lba_status *cdb; struct scsi_get_lba_status_data *data; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t alloc_len, total_len; @@ -7006,7 +6958,6 @@ ctl_get_lba_status(struct ctl_scsiio *ct CTL_DEBUG_PRINT(("ctl_get_lba_status\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_get_lba_status *)ctsio->cdb; lba = scsi_8btou64(cdb->addr); alloc_len = scsi_4btoul(cdb->alloc_len); @@ -7119,12 +7070,12 @@ ctl_read_defect(struct ctl_scsiio *ctsio int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_maintenance_in *cdb; int retval; int alloc_len, ext, total_len = 0, g, pc, pg, ts, os; int num_ha_groups, num_target_ports, shared_group; - struct ctl_lun *lun; - struct ctl_softc *softc; struct ctl_port *port; struct scsi_target_group_data *rtg_ptr; struct scsi_target_group_data_extended *rtg_ext_ptr; @@ -7133,9 +7084,6 @@ ctl_report_tagret_port_groups(struct ctl CTL_DEBUG_PRINT(("ctl_report_tagret_port_groups\n")); cdb = (struct scsi_maintenance_in *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retval = CTL_RETVAL_COMPLETE; switch (cdb->byte2 & STG_PDF_MASK) { @@ -7301,7 +7249,7 @@ ctl_report_tagret_port_groups(struct ctl int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_report_supported_opcodes *cdb; const struct ctl_cmd_entry *entry, *sentry; struct scsi_report_supported_opcodes_all *all; @@ -7314,8 +7262,6 @@ ctl_report_supported_opcodes(struct ctl_ CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n")); cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - retval = CTL_RETVAL_COMPLETE; opcode = cdb->requested_opcode; @@ -7580,11 +7526,11 @@ ctl_report_timestamp(struct ctl_scsiio * int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_per_res_in *cdb; int alloc_len, total_len = 0; /* struct scsi_per_res_in_rsrv in_data; */ - struct ctl_lun *lun; - struct ctl_softc *softc; uint64_t key; CTL_DEBUG_PRINT(("ctl_persistent_reserve_in\n")); @@ -7593,9 +7539,6 @@ ctl_persistent_reserve_in(struct ctl_scs alloc_len = scsi_2btoul(cdb->length); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retry: mtx_lock(&lun->lun_lock); switch (cdb->action) { @@ -8158,12 +8101,12 @@ ctl_pro_preempt_other(struct ctl_lun *lu int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); int retval; u_int32_t param_len; struct scsi_per_res_out *cdb; - struct ctl_lun *lun; struct scsi_per_res_out_parms* param; - struct ctl_softc *softc; uint32_t residx; uint64_t res_key, sa_res_key, key; uint8_t type; @@ -8172,11 +8115,8 @@ ctl_persistent_reserve_out(struct ctl_sc CTL_DEBUG_PRINT(("ctl_persistent_reserve_out\n")); - retval = CTL_RETVAL_COMPLETE; - cdb = (struct scsi_per_res_out *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; + retval = CTL_RETVAL_COMPLETE; /* * We only support whole-LUN scope. The scope & type are ignored for @@ -8550,9 +8490,10 @@ done: * in sync. */ static void -ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) +ctl_hndl_per_res_out_on_other_sc(union ctl_io *io) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(io); + union ctl_ha_msg *msg = (union ctl_ha_msg *)&io->presio.pr_msg; struct ctl_lun *lun; int i; uint32_t residx, targ_lun; @@ -8671,15 +8612,13 @@ ctl_hndl_per_res_out_on_other_sc(union c int ctl_read_write(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; int isread; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_read_write: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8864,15 +8803,14 @@ ctl_read_write(struct ctl_scsiio *ctsio) static int ctl_cnw_cont(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct ctl_scsiio *ctsio; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; int retval; ctsio = &io->scsiio; ctsio->io_hdr.status = CTL_STATUS_NONE; ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; lbalen = (struct ctl_lba_len_flags *) &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; lbalen->flags &= ~CTL_LLF_COMPARE; @@ -8886,14 +8824,12 @@ ctl_cnw_cont(union ctl_io *io) int ctl_cnw(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_cnw: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8974,15 +8910,13 @@ ctl_cnw(struct ctl_scsiio *ctsio) int ctl_verify(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int bytchk, flags; int retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_verify: command: %#x\n", ctsio->cdb[0])); bytchk = 0; @@ -9078,19 +9012,17 @@ ctl_verify(struct ctl_scsiio *ctsio) int ctl_report_luns(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun, *request_lun = CTL_LUN(ctsio); struct scsi_report_luns *cdb; struct scsi_report_luns_data *lun_data; - struct ctl_lun *lun, *request_lun; - struct ctl_port *port; int num_filled, num_luns, num_port_luns, retval; uint32_t alloc_len, lun_datalen; uint32_t initidx, targ_lun_id, lun_id; retval = CTL_RETVAL_COMPLETE; cdb = (struct scsi_report_luns *)ctsio->cdb; - port = ctl_io_port(&ctsio->io_hdr); - softc = port->ctl_softc; CTL_DEBUG_PRINT(("ctl_report_luns\n")); @@ -9143,9 +9075,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio return (retval); } - request_lun = (struct ctl_lun *) - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - lun_datalen = sizeof(*lun_data) + (num_luns * sizeof(struct scsi_report_luns_lundata)); @@ -9236,10 +9165,10 @@ ctl_report_luns(struct ctl_scsiio *ctsio int ctl_request_sense(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_request_sense *cdb; struct scsi_sense_data *sense_ptr; - struct ctl_softc *softc; - struct ctl_lun *lun; uint32_t initidx; int have_error; u_int sense_len = SSD_FULL_SIZE; @@ -9249,9 +9178,6 @@ ctl_request_sense(struct ctl_scsiio *cts cdb = (struct scsi_request_sense *)ctsio->cdb; - softc = control_softc; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_request_sense\n")); /* @@ -9394,13 +9320,11 @@ ctl_tur(struct ctl_scsiio *ctsio) static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_supported_pages *pages; int sup_page_size; - struct ctl_lun *lun; int p; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - sup_page_size = sizeof(struct scsi_vpd_supported_pages) * SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); @@ -9469,12 +9393,10 @@ ctl_inquiry_evpd_supported(struct ctl_sc static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_unit_serial_number *sn_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = 4 + CTL_SN_LEN; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; @@ -9528,12 +9450,10 @@ ctl_inquiry_evpd_serial(struct ctl_scsii static int ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_extended_inquiry_data *eid_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; @@ -9604,12 +9524,10 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_mode_page_policy *mpp_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + sizeof(struct scsi_vpd_mode_page_policy_descr); @@ -9658,19 +9576,14 @@ ctl_inquiry_evpd_mpp(struct ctl_scsiio * static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_device_id *devid_ptr; struct scsi_vpd_id_descriptor *desc; - struct ctl_softc *softc; - struct ctl_lun *lun; - struct ctl_port *port; int data_len, g; uint8_t proto; - softc = control_softc; - - port = ctl_io_port(&ctsio->io_hdr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_device_id) + sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_rel_trgt_port_id) + @@ -9783,16 +9696,14 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_scsi_ports *sp; struct scsi_vpd_port_designation *pd; struct scsi_vpd_port_designation_cont *pdc; - struct ctl_lun *lun; struct ctl_port *port; int data_len, num_target_ports, iid_len, id_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - num_target_ports = 0; iid_len = 0; id_len = 0; @@ -9886,12 +9797,10 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_limits *bl_ptr; - struct ctl_lun *lun; uint64_t ival; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9963,13 +9872,11 @@ ctl_inquiry_evpd_block_limits(struct ctl static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_device_characteristics *bdc_ptr; - struct ctl_lun *lun; const char *value; u_int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bdc_ptr), M_CTL, M_WAITOK | M_ZERO); bdc_ptr = (struct scsi_vpd_block_device_characteristics *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10023,12 +9930,10 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * static int ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_logical_block_prov *lbp_ptr; - struct ctl_lun *lun; const char *value; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10086,11 +9991,10 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_inquiry *cdb; int alloc_len, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; alloc_len = scsi_2btoul(cdb->length); @@ -10153,21 +10057,19 @@ err: static int ctl_inquiry_std(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Jan 26 20:51:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B578CC1180; Thu, 26 Jan 2017 20:51:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61608F57; Thu, 26 Jan 2017 20:51:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKpI4F099784; Thu, 26 Jan 2017 20:51:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKpIjT099783; Thu, 26 Jan 2017 20:51:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262051.v0QKpIjT099783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312836 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:51:19 -0000 Author: mav Date: Thu Jan 26 20:51:18 2017 New Revision: 312836 URL: https://svnweb.freebsd.org/changeset/base/312836 Log: MFC r311680: Make CTL_GETSTATS ioctl return partial data if buffer is small. Modified: stable/11/sys/cam/ctl/ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:50:01 2017 (r312835) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:51:18 2017 (r312836) @@ -2779,32 +2779,29 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } case CTL_GETSTATS: { - struct ctl_stats *stats; + struct ctl_stats *stats = (struct ctl_stats *)addr; int i; - stats = (struct ctl_stats *)addr; - - if ((sizeof(struct ctl_lun_io_stats) * softc->num_luns) > - stats->alloc_len) { - stats->status = CTL_SS_NEED_MORE_SPACE; - stats->num_luns = softc->num_luns; - break; - } /* * XXX KDM no locking here. If the LUN list changes, * things can blow up. */ i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } retval = copyout(&lun->stats, &stats->lun_stats[i++], sizeof(lun->stats)); if (retval != 0) break; + stats->fill_len += sizeof(lun->stats); } stats->num_luns = softc->num_luns; - stats->fill_len = sizeof(struct ctl_lun_io_stats) * - softc->num_luns; - stats->status = CTL_SS_OK; #ifdef CTL_TIME_IO stats->flags = CTL_STATS_FLAG_TIME_VALID; #else From owner-svn-src-stable@freebsd.org Thu Jan 26 20:51:52 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B479CC1357; Thu, 26 Jan 2017 20:51:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC1561114; Thu, 26 Jan 2017 20:51:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKpoMo099856; Thu, 26 Jan 2017 20:51:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKpo6U099855; Thu, 26 Jan 2017 20:51:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262051.v0QKpo6U099855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312837 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:51:52 -0000 Author: mav Date: Thu Jan 26 20:51:50 2017 New Revision: 312837 URL: https://svnweb.freebsd.org/changeset/base/312837 Log: MFC r311680: Make CTL_GETSTATS ioctl return partial data if buffer is small. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:51:18 2017 (r312836) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:51:50 2017 (r312837) @@ -2770,32 +2770,29 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } case CTL_GETSTATS: { - struct ctl_stats *stats; + struct ctl_stats *stats = (struct ctl_stats *)addr; int i; - stats = (struct ctl_stats *)addr; - - if ((sizeof(struct ctl_lun_io_stats) * softc->num_luns) > - stats->alloc_len) { - stats->status = CTL_SS_NEED_MORE_SPACE; - stats->num_luns = softc->num_luns; - break; - } /* * XXX KDM no locking here. If the LUN list changes, * things can blow up. */ i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } retval = copyout(&lun->stats, &stats->lun_stats[i++], sizeof(lun->stats)); if (retval != 0) break; + stats->fill_len += sizeof(lun->stats); } stats->num_luns = softc->num_luns; - stats->fill_len = sizeof(struct ctl_lun_io_stats) * - softc->num_luns; - stats->status = CTL_SS_OK; #ifdef CTL_TIME_IO stats->flags = CTL_STATS_FLAG_TIME_VALID; #else From owner-svn-src-stable@freebsd.org Thu Jan 26 20:57:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA4FECC1454; Thu, 26 Jan 2017 20:57:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6875514F3; Thu, 26 Jan 2017 20:57:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKvJv3002345; Thu, 26 Jan 2017 20:57:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKvJmO002343; Thu, 26 Jan 2017 20:57:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262057.v0QKvJmO002343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312838 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:57:20 -0000 Author: mav Date: Thu Jan 26 20:57:19 2017 New Revision: 312838 URL: https://svnweb.freebsd.org/changeset/base/312838 Log: MFC r311787: Allocate memory for prevent flags only for removable LUs. This array takes 64KB of RAM now, that was more then half of struct ctl_lun size. If at some point we support more ports, this may need another tune. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:51:50 2017 (r312837) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:57:19 2017 (r312838) @@ -4585,6 +4585,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); ctl_tpc_lun_init(lun); + if (lun->flags & CTL_LUN_REMOVABLE) { + lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4, + M_CTL, M_WAITOK); + } /* * Initialize the mode and log page index. @@ -4666,6 +4670,7 @@ ctl_free_lun(struct ctl_lun *lun) for (i = 0; i < CTL_MAX_PORTS; i++) free(lun->pr_keys[i], M_CTL); free(lun->write_buffer, M_CTL); + free(lun->prevent, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); @@ -5276,7 +5281,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts cdb = (struct scsi_prevent *)ctsio->cdb; - if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { + if ((lun->flags & CTL_LUN_REMOVABLE) == 0 || lun->prevent == NULL) { ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -11872,8 +11877,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, un ctl_clear_mask(lun->have_ca, i); #endif lun->prevent_count = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) - ctl_clear_mask(lun->prevent, i); + if (lun->prevent) { + for (i = 0; i < CTL_MAX_INITIATORS; i++) + ctl_clear_mask(lun->prevent, i); + } mtx_unlock(&lun->lun_lock); return (0); @@ -12019,7 +12026,7 @@ ctl_i_t_nexus_reset(union ctl_io *io) #endif if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx)) lun->flags &= ~CTL_LUN_RESERVED; - if (ctl_is_set(lun->prevent, initidx)) { + if (lun->prevent && ctl_is_set(lun->prevent, initidx)) { ctl_clear_mask(lun->prevent, initidx); lun->prevent_count--; } Modified: stable/11/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:51:50 2017 (r312837) +++ stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:19 2017 (r312838) @@ -412,7 +412,7 @@ struct ctl_lun { uint32_t pr_res_idx; uint8_t pr_res_type; int prevent_count; - uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; + uint32_t *prevent; uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; From owner-svn-src-stable@freebsd.org Thu Jan 26 20:57:50 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C7BFCC151A; Thu, 26 Jan 2017 20:57:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF0EC16C0; Thu, 26 Jan 2017 20:57:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKvmKk002419; Thu, 26 Jan 2017 20:57:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKvme9002417; Thu, 26 Jan 2017 20:57:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262057.v0QKvme9002417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:57:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312839 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:57:50 -0000 Author: mav Date: Thu Jan 26 20:57:48 2017 New Revision: 312839 URL: https://svnweb.freebsd.org/changeset/base/312839 Log: MFC r311787: Allocate memory for prevent flags only for removable LUs. This array takes 64KB of RAM now, that was more then half of struct ctl_lun size. If at some point we support more ports, this may need another tune. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:57:19 2017 (r312838) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:57:48 2017 (r312839) @@ -4576,6 +4576,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); ctl_tpc_lun_init(lun); + if (lun->flags & CTL_LUN_REMOVABLE) { + lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4, + M_CTL, M_WAITOK); + } /* * Initialize the mode and log page index. @@ -4657,6 +4661,7 @@ ctl_free_lun(struct ctl_lun *lun) for (i = 0; i < CTL_MAX_PORTS; i++) free(lun->pr_keys[i], M_CTL); free(lun->write_buffer, M_CTL); + free(lun->prevent, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); @@ -5267,7 +5272,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts cdb = (struct scsi_prevent *)ctsio->cdb; - if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { + if ((lun->flags & CTL_LUN_REMOVABLE) == 0 || lun->prevent == NULL) { ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -11863,8 +11868,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, un ctl_clear_mask(lun->have_ca, i); #endif lun->prevent_count = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) - ctl_clear_mask(lun->prevent, i); + if (lun->prevent) { + for (i = 0; i < CTL_MAX_INITIATORS; i++) + ctl_clear_mask(lun->prevent, i); + } mtx_unlock(&lun->lun_lock); return (0); @@ -12010,7 +12017,7 @@ ctl_i_t_nexus_reset(union ctl_io *io) #endif if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx)) lun->flags &= ~CTL_LUN_RESERVED; - if (ctl_is_set(lun->prevent, initidx)) { + if (lun->prevent && ctl_is_set(lun->prevent, initidx)) { ctl_clear_mask(lun->prevent, initidx); lun->prevent_count--; } Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:19 2017 (r312838) +++ stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:48 2017 (r312839) @@ -412,7 +412,7 @@ struct ctl_lun { uint32_t pr_res_idx; uint8_t pr_res_type; int prevent_count; - uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; + uint32_t *prevent; uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; From owner-svn-src-stable@freebsd.org Thu Jan 26 20:59:39 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33C2FCC1619; Thu, 26 Jan 2017 20:59:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF4D318AC; Thu, 26 Jan 2017 20:59:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKxbwo002539; Thu, 26 Jan 2017 20:59:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKxb0D002531; Thu, 26 Jan 2017 20:59:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262059.v0QKxb0D002531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312840 - in stable/11: sys/cam/ctl usr.bin/ctlstat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 20:59:39 -0000 Author: mav Date: Thu Jan 26 20:59:36 2017 New Revision: 312840 URL: https://svnweb.freebsd.org/changeset/base/312840 Log: MFC r311804: Rewrite CTL statistics in more simple and scalable way. Instead of collecting statistics for each combination of ports and logical units, that consumed ~45KB per LU with present number of ports, collect separate statistics for every port and every logical unit separately, that consume only 176 bytes per each single LU/port. This reduces struct ctl_lun size down to just 6KB. Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should allow handling of very large quantities. Old API is still enabled in stable branches for compatibility reasons. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_backend.h stable/11/sys/cam/ctl/ctl_frontend.c stable/11/sys/cam/ctl/ctl_frontend.h stable/11/sys/cam/ctl/ctl_ioctl.h stable/11/sys/cam/ctl/ctl_private.h stable/11/usr.bin/ctlstat/ctlstat.8 stable/11/usr.bin/ctlstat/ctlstat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:59:36 2017 (r312840) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003-2009 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -2567,6 +2567,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, struct thread *td) { struct ctl_softc *softc = dev->si_drv1; + struct ctl_port *port; struct ctl_lun *lun; int retval; @@ -2778,6 +2779,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, #endif /* CTL_IO_DELAY */ break; } +#ifdef CTL_LEGACY_STATS case CTL_GETSTATS: { struct ctl_stats *stats = (struct ctl_stats *)addr; int i; @@ -2790,26 +2792,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, stats->status = CTL_SS_OK; stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (stats->fill_len + sizeof(lun->stats) > + if (stats->fill_len + sizeof(lun->legacy_stats) > stats->alloc_len) { stats->status = CTL_SS_NEED_MORE_SPACE; break; } - retval = copyout(&lun->stats, &stats->lun_stats[i++], - sizeof(lun->stats)); + retval = copyout(&lun->legacy_stats, &stats->lun_stats[i++], + sizeof(lun->legacy_stats)); if (retval != 0) break; - stats->fill_len += sizeof(lun->stats); + stats->fill_len += sizeof(lun->legacy_stats); } stats->num_luns = softc->num_luns; -#ifdef CTL_TIME_IO - stats->flags = CTL_STATS_FLAG_TIME_VALID; -#else stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; #endif getnanouptime(&stats->timestamp); break; } +#endif /* CTL_LEGACY_STATS */ case CTL_ERROR_INJECT: { struct ctl_error_desc *err_desc, *new_err_desc; @@ -3397,6 +3399,72 @@ ctl_ioctl(struct cdev *dev, u_long cmd, ctl_isc_announce_port(port); break; } + case CTL_GET_LUN_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (lun->lun < stats->first_item) + continue; + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&lun->stats, &stats->stats[i++], + sizeof(lun->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(lun->stats); + } + stats->num_items = softc->num_luns; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } + case CTL_GET_PORT_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port->targ_port < stats->first_item) + continue; + if (stats->fill_len + sizeof(port->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&port->stats, &stats->stats[i++], + sizeof(port->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(port->stats); + } + stats->num_items = softc->num_ports; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } default: { /* XXX KDM should we fix this? */ #if 0 @@ -4391,7 +4459,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; const char *eui, *naa, *scsiname, *uuid, *vendor, *value; - int lun_number, i, lun_malloced; + int lun_number, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; if (be_lun == NULL) @@ -4613,13 +4681,16 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_softc->num_luns++; /* Setup statistics gathering */ - lun->stats.device_type = be_lun->lun_type; - lun->stats.lun_number = lun_number; - lun->stats.blocksize = be_lun->blocksize; +#ifdef CTL_LEGACY_STATS + lun->legacy_stats.device_type = be_lun->lun_type; + lun->legacy_stats.lun_number = lun_number; + lun->legacy_stats.blocksize = be_lun->blocksize; if (be_lun->blocksize == 0) - lun->stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; - for (i = 0;i < CTL_MAX_PORTS;i++) - lun->stats.ports[i].targ_port = i; + lun->legacy_stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; + for (len = 0; len < CTL_MAX_PORTS; len++) + lun->legacy_stats.ports[len].targ_port = len; +#endif /* CTL_LEGACY_STATS */ + lun->stats.item = lun_number; mtx_unlock(&ctl_softc->ctl_lock); @@ -6685,9 +6756,7 @@ ctl_sap_log_sense_handler(struct ctl_scs { struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; - uint64_t rn, wn, rb, wb; - struct bintime rt, wt; - int i; + struct bintime *t; data = (struct stat_page *)page_index->page_data; @@ -6695,28 +6764,21 @@ ctl_sap_log_sense_handler(struct ctl_scs data->sap.hdr.param_control = SLP_LBIN; data->sap.hdr.param_len = sizeof(struct scsi_log_stat_and_perf) - sizeof(struct scsi_log_param_header); - rn = wn = rb = wb = 0; - bintime_clear(&rt); - bintime_clear(&wt); - for (i = 0; i < CTL_MAX_PORTS; i++) { - rn += lun->stats.ports[i].operations[CTL_STATS_READ]; - wn += lun->stats.ports[i].operations[CTL_STATS_WRITE]; - rb += lun->stats.ports[i].bytes[CTL_STATS_READ]; - wb += lun->stats.ports[i].bytes[CTL_STATS_WRITE]; - bintime_add(&rt, &lun->stats.ports[i].time[CTL_STATS_READ]); - bintime_add(&wt, &lun->stats.ports[i].time[CTL_STATS_WRITE]); - } - scsi_u64to8b(rn, data->sap.read_num); - scsi_u64to8b(wn, data->sap.write_num); - if (lun->stats.blocksize > 0) { - scsi_u64to8b(wb / lun->stats.blocksize, - data->sap.recvieved_lba); - scsi_u64to8b(rb / lun->stats.blocksize, - data->sap.transmitted_lba); + scsi_u64to8b(lun->stats.operations[CTL_STATS_READ], + data->sap.read_num); + scsi_u64to8b(lun->stats.operations[CTL_STATS_WRITE], + data->sap.write_num); + if (lun->be_lun->blocksize > 0) { + scsi_u64to8b(lun->stats.bytes[CTL_STATS_WRITE] / + lun->be_lun->blocksize, data->sap.recvieved_lba); + scsi_u64to8b(lun->stats.bytes[CTL_STATS_READ] / + lun->be_lun->blocksize, data->sap.transmitted_lba); } - scsi_u64to8b((uint64_t)rt.sec * 1000 + rt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_READ]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.read_int); - scsi_u64to8b((uint64_t)wt.sec * 1000 + wt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_WRITE]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.write_int); scsi_u64to8b(0, data->sap.weighted_num); scsi_u64to8b(0, data->sap.weighted_int); @@ -13053,13 +13115,13 @@ static void ctl_process_done(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); + struct ctl_port *port = CTL_PORT(io); struct ctl_lun *lun = CTL_LUN(io); void (*fe_done)(union ctl_io *io); union ctl_ha_msg msg; - uint32_t targ_port = io->io_hdr.nexus.targ_port; CTL_DEBUG_PRINT(("ctl_process_done\n")); - fe_done = softc->ctl_ports[targ_port]->fe_done; + fe_done = port->fe_done; #ifdef CTL_TIME_IO if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { @@ -13162,11 +13224,13 @@ ctl_process_done(union ctl_io *io) */ if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS && io->io_hdr.io_type == CTL_IO_SCSI) { -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif int type; +#ifdef CTL_TIME_IO + struct bintime bt; + getbinuptime(&bt); + bintime_sub(&bt, &io->io_hdr.start_bt); +#endif if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) type = CTL_STATS_READ; @@ -13176,18 +13240,38 @@ ctl_process_done(union ctl_io *io) else type = CTL_STATS_NO_IO; - lun->stats.ports[targ_port].bytes[type] += +#ifdef CTL_LEGACY_STATS + uint32_t targ_port = port->targ_port; + lun->legacy_stats.ports[targ_port].bytes[type] += io->scsiio.kern_total_len; - lun->stats.ports[targ_port].operations[type]++; + lun->legacy_stats.ports[targ_port].operations[type] ++; + lun->legacy_stats.ports[targ_port].num_dmas[type] += + io->io_hdr.num_dmas; #ifdef CTL_TIME_IO - bintime_add(&lun->stats.ports[targ_port].dma_time[type], + bintime_add(&lun->legacy_stats.ports[targ_port].dma_time[type], &io->io_hdr.dma_bt); - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.start_bt); - bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); + bintime_add(&lun->legacy_stats.ports[targ_port].time[type], + &bt); #endif - lun->stats.ports[targ_port].num_dmas[type] += - io->io_hdr.num_dmas; +#endif /* CTL_LEGACY_STATS */ + + lun->stats.bytes[type] += io->scsiio.kern_total_len; + lun->stats.operations[type] ++; + lun->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&lun->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&lun->stats.time[type], &bt); +#endif + + mtx_lock(&port->port_lock); + port->stats.bytes[type] += io->scsiio.kern_total_len; + port->stats.operations[type] ++; + port->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&port->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&port->stats.time[type], &bt); +#endif + mtx_unlock(&port->port_lock); } /* Modified: stable/11/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_backend.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,54 +40,7 @@ #ifndef _CTL_BACKEND_H_ #define _CTL_BACKEND_H_ -/* - * XXX KDM move this to another header file? - */ -#define CTL_BE_NAME_LEN 32 - -/* - * The ID_REQ flag is used to say that the caller has requested a - * particular LUN ID in the req_lun_id field. If we cannot allocate that - * LUN ID, the ctl_add_lun() call will fail. - * - * The STOPPED flag tells us that the LUN should default to the powered - * off state. It will return 0x04,0x02 until it is powered up. ("Logical - * unit not ready, initializing command required.") - * - * The NO_MEDIA flag tells us that the LUN has no media inserted. - * - * The PRIMARY flag tells us that this LUN is registered as a Primary LUN - * which is accessible via the Master shelf controller in an HA. This flag - * being set indicates a Primary LUN. This flag being reset represents a - * Secondary LUN controlled by the Secondary controller in an HA - * configuration. Flag is applicable at this time to T_DIRECT types. - * - * The SERIAL_NUM flag tells us that the serial_num field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x80. - * - * The DEVID flag tells us that the device_id field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x83. - * - * The DEV_TYPE flag tells us that the device_type field is filled in. - * - * The EJECTED flag tells us that the removable LUN has tray open. - * - * The UNMAP flag tells us that this LUN supports UNMAP. - * - * The OFFLINE flag tells us that this LUN can not access backing store. - */ -typedef enum { - CTL_LUN_FLAG_ID_REQ = 0x01, - CTL_LUN_FLAG_STOPPED = 0x02, - CTL_LUN_FLAG_NO_MEDIA = 0x04, - CTL_LUN_FLAG_PRIMARY = 0x08, - CTL_LUN_FLAG_SERIAL_NUM = 0x10, - CTL_LUN_FLAG_DEVID = 0x20, - CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80, - CTL_LUN_FLAG_EJECTED = 0x100, - CTL_LUN_FLAG_READONLY = 0x200 -} ctl_backend_lun_flags; +#include typedef enum { CTL_LUN_SERSEQ_OFF, Modified: stable/11/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend.c Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_frontend.c Thu Jan 26 20:59:36 2017 (r312840) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,13 +193,14 @@ error: mtx_unlock(&softc->ctl_lock); return (retval); } + port->targ_port = port_num; port->ctl_pool_ref = pool; - if (port->options.stqh_first == NULL) STAILQ_INIT(&port->options); + port->stats.item = port_num; + mtx_init(&port->port_lock, "CTL port", NULL, MTX_DEF); mtx_lock(&softc->ctl_lock); - port->targ_port = port_num; STAILQ_INSERT_TAIL(&port->frontend->port_list, port, fe_links); for (tport = NULL, nport = STAILQ_FIRST(&softc->port_list); nport != NULL && nport->targ_port < port_num; @@ -218,17 +220,11 @@ int ctl_port_deregister(struct ctl_port *port) { struct ctl_softc *softc = port->ctl_softc; - struct ctl_io_pool *pool; - int retval, i; - - retval = 0; - - pool = (struct ctl_io_pool *)port->ctl_pool_ref; + struct ctl_io_pool *pool = (struct ctl_io_pool *)port->ctl_pool_ref; + int i; - if (port->targ_port == -1) { - retval = 1; - goto bailout; - } + if (port->targ_port == -1) + return (1); mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->port_list, port, ctl_port, links); @@ -251,9 +247,9 @@ ctl_port_deregister(struct ctl_port *por for (i = 0; i < port->max_initiators; i++) free(port->wwpn_iid[i].name, M_CTL); free(port->wwpn_iid, M_CTL); + mtx_destroy(&port->port_lock); -bailout: - return (retval); + return (0); } void Modified: stable/11/sys/cam/ctl/ctl_frontend.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_frontend.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +40,8 @@ #ifndef _CTL_FRONTEND_H_ #define _CTL_FRONTEND_H_ +#include + typedef enum { CTL_PORT_STATUS_NONE = 0x00, CTL_PORT_STATUS_ONLINE = 0x01, @@ -243,6 +246,8 @@ struct ctl_port { struct ctl_devid *port_devid; /* passed to CTL */ struct ctl_devid *target_devid; /* passed to CTL */ struct ctl_devid *init_devid; /* passed to CTL */ + struct ctl_io_stats stats; /* used by CTL */ + struct mtx port_lock; /* used by CTL */ STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ STAILQ_ENTRY(ctl_port) links; /* used by CTL */ }; Modified: stable/11/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2011 Spectra Logic Corporation + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,6 +81,9 @@ /* Hopefully this won't conflict with new misc devices that pop up */ #define CTL_MINOR 225 +/* Legacy statistics accumulated for every port for every LU. */ +#define CTL_LEGACY_STATS 1 + typedef enum { CTL_DELAY_TYPE_NONE, CTL_DELAY_TYPE_CONT, @@ -117,6 +121,18 @@ typedef enum { #define CTL_STATS_NUM_TYPES 3 typedef enum { + CTL_SS_OK, + CTL_SS_NEED_MORE_SPACE, + CTL_SS_ERROR +} ctl_stats_status; + +typedef enum { + CTL_STATS_FLAG_NONE = 0x00, + CTL_STATS_FLAG_TIME_VALID = 0x01 +} ctl_stats_flags; + +#ifdef CTL_LEGACY_STATS +typedef enum { CTL_LUN_STATS_NO_BLOCKSIZE = 0x01 } ctl_lun_stats_flags; @@ -137,17 +153,6 @@ struct ctl_lun_io_stats { struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; }; -typedef enum { - CTL_SS_OK, - CTL_SS_NEED_MORE_SPACE, - CTL_SS_ERROR -} ctl_stats_status; - -typedef enum { - CTL_STATS_FLAG_NONE = 0x00, - CTL_STATS_FLAG_TIME_VALID = 0x01 -} ctl_stats_flags; - struct ctl_stats { int alloc_len; /* passed to kernel */ struct ctl_lun_io_stats *lun_stats; /* passed to/from kernel */ @@ -157,6 +162,27 @@ struct ctl_stats { ctl_stats_flags flags; /* passed to userland */ struct timespec timestamp; /* passed to userland */ }; +#endif /* CTL_LEGACY_STATS */ + +struct ctl_io_stats { + uint32_t item; + uint64_t bytes[CTL_STATS_NUM_TYPES]; + uint64_t operations[CTL_STATS_NUM_TYPES]; + uint64_t dmas[CTL_STATS_NUM_TYPES]; + struct bintime time[CTL_STATS_NUM_TYPES]; + struct bintime dma_time[CTL_STATS_NUM_TYPES]; +}; + +struct ctl_get_io_stats { + struct ctl_io_stats *stats; /* passed to/from kernel */ + size_t alloc_len; /* passed to kernel */ + size_t fill_len; /* passed to userland */ + int first_item; /* passed to kernel */ + int num_items; /* passed to userland */ + ctl_stats_status status; /* passed to userland */ + ctl_stats_flags flags; /* passed to userland */ + struct timespec timestamp; /* passed to userland */ +}; /* * The types of errors that can be injected: @@ -342,12 +368,54 @@ typedef enum { CTL_LUNREQ_MODIFY, } ctl_lunreq_type; +/* + * The ID_REQ flag is used to say that the caller has requested a + * particular LUN ID in the req_lun_id field. If we cannot allocate that + * LUN ID, the ctl_add_lun() call will fail. + * + * The STOPPED flag tells us that the LUN should default to the powered + * off state. It will return 0x04,0x02 until it is powered up. ("Logical + * unit not ready, initializing command required.") + * + * The NO_MEDIA flag tells us that the LUN has no media inserted. + * + * The PRIMARY flag tells us that this LUN is registered as a Primary LUN + * which is accessible via the Master shelf controller in an HA. This flag + * being set indicates a Primary LUN. This flag being reset represents a + * Secondary LUN controlled by the Secondary controller in an HA + * configuration. Flag is applicable at this time to T_DIRECT types. + * + * The SERIAL_NUM flag tells us that the serial_num field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x80. + * + * The DEVID flag tells us that the device_id field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x83. + * + * The DEV_TYPE flag tells us that the device_type field is filled in. + * + * The EJECTED flag tells us that the removable LUN has tray open. + * + * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. + */ +typedef enum { + CTL_LUN_FLAG_ID_REQ = 0x01, + CTL_LUN_FLAG_STOPPED = 0x02, + CTL_LUN_FLAG_NO_MEDIA = 0x04, + CTL_LUN_FLAG_PRIMARY = 0x08, + CTL_LUN_FLAG_SERIAL_NUM = 0x10, + CTL_LUN_FLAG_DEVID = 0x20, + CTL_LUN_FLAG_DEV_TYPE = 0x40, + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_EJECTED = 0x100, + CTL_LUN_FLAG_READONLY = 0x200 +} ctl_backend_lun_flags; /* * LUN creation parameters: * - * flags: Various LUN flags, see ctl_backend.h for a - * description of the flag values and meanings. + * flags: Various LUN flags, see above. * * device_type: The SCSI device type. e.g. 0 for Direct Access, * 3 for Processor, etc. Only certain backends may @@ -465,6 +533,7 @@ union ctl_lunreq_data { * kern_be_args: For kernel use only. */ struct ctl_lun_req { +#define CTL_BE_NAME_LEN 32 char backend[CTL_BE_NAME_LEN]; ctl_lunreq_type reqtype; union ctl_lunreq_data reqdata; @@ -773,6 +842,8 @@ struct ctl_lun_map { #define CTL_PORT_REQ _IOWR(CTL_MINOR, 0x26, struct ctl_req) #define CTL_PORT_LIST _IOWR(CTL_MINOR, 0x27, struct ctl_lun_list) #define CTL_LUN_MAP _IOW(CTL_MINOR, 0x28, struct ctl_lun_map) +#define CTL_GET_LUN_STATS _IOWR(CTL_MINOR, 0x29, struct ctl_get_io_stats) +#define CTL_GET_PORT_STATS _IOWR(CTL_MINOR, 0x2a, struct ctl_get_io_stats) #endif /* _CTL_IOCTL_H_ */ Modified: stable/11/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003, 2004, 2005, 2008 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -404,7 +404,10 @@ struct ctl_lun { struct callout ie_callout; /* INTERVAL TIMER */ struct ctl_mode_pages mode_pages; struct ctl_log_pages log_pages; - struct ctl_lun_io_stats stats; +#ifdef CTL_LEGACY_STATS + struct ctl_lun_io_stats legacy_stats; +#endif /* CTL_LEGACY_STATS */ + struct ctl_io_stats stats; uint32_t res_idx; uint32_t pr_generation; uint64_t *pr_keys[CTL_MAX_PORTS]; Modified: stable/11/usr.bin/ctlstat/ctlstat.8 ============================================================================== --- stable/11/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 20:59:36 2017 (r312840) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.bin/ctlstat/ctlstat.8#2 $ .\" $FreeBSD$ .\" -.Dd September 21, 2015 +.Dd January 9, 2017 .Dt CTLSTAT 8 .Os .Sh NAME @@ -120,3 +120,4 @@ every 10 seconds. .Sh AUTHORS .An Ken Merry Aq Mt ken@FreeBSD.org .An Will Andrews Aq Mt will@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org Modified: stable/11/usr.bin/ctlstat/ctlstat.c ============================================================================== --- stable/11/usr.bin/ctlstat/ctlstat.c Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/usr.bin/ctlstat/ctlstat.c Thu Jan 26 20:59:36 2017 (r312840) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004, 2008, 2009 Silicon Graphics International Corp. + * Copyright (c) 2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,17 +67,17 @@ __FBSDID("$FreeBSD$"); #include /* - * The default amount of space we allocate for LUN storage space. We - * dynamically allocate more if needed. + * The default amount of space we allocate for stats storage space. + * We dynamically allocate more if needed. */ -#define CTL_STAT_NUM_LUNS 30 +#define CTL_STAT_NUM_ITEMS 256 /* * The default number of LUN selection bits we allocate. This is large * because we don't currently increase it if the user specifies a LUN * number of 1024 or larger. */ -#define CTL_STAT_LUN_BITS 1024L +#define CTL_STAT_BITS 1024L static const char *ctlstat_opts = "Cc:Ddhjl:n:p:tw:"; static const char *ctlstat_usage = "Usage: ctlstat [-CDdjht] [-l lunnum]" @@ -101,31 +102,32 @@ typedef enum { #define CTLSTAT_FLAG_FIRST_RUN (1 << 2) #define CTLSTAT_FLAG_TOTALS (1 << 3) #define CTLSTAT_FLAG_DMA_TIME (1 << 4) -#define CTLSTAT_FLAG_LUN_TIME_VALID (1 << 5) -#define CTLSTAT_FLAG_LUN_MASK (1 << 6) -#define CTLSTAT_FLAG_PORT_MASK (1 << 7) +#define CTLSTAT_FLAG_TIME_VALID (1 << 5) +#define CTLSTAT_FLAG_MASK (1 << 6) +#define CTLSTAT_FLAG_LUNS (1 << 7) +#define CTLSTAT_FLAG_PORTS (1 << 8) #define F_CPU(ctx) ((ctx)->flags & CTLSTAT_FLAG_CPU) #define F_HDR(ctx) ((ctx)->flags & CTLSTAT_FLAG_HEADER) #define F_FIRST(ctx) ((ctx)->flags & CTLSTAT_FLAG_FIRST_RUN) #define F_TOTALS(ctx) ((ctx)->flags & CTLSTAT_FLAG_TOTALS) #define F_DMA(ctx) ((ctx)->flags & CTLSTAT_FLAG_DMA_TIME) -#define F_LUNVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_TIME_VALID) -#define F_LUNMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_MASK) -#define F_PORTMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORT_MASK) +#define F_TIMEVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_TIME_VALID) +#define F_MASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_MASK) +#define F_LUNS(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUNS) +#define F_PORTS(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORTS) struct ctlstat_context { ctlstat_mode_types mode; int flags; - struct ctl_lun_io_stats *cur_lun_stats, *prev_lun_stats, - *tmp_lun_stats; - struct ctl_lun_io_stats cur_total_stats[3], prev_total_stats[3]; + struct ctl_io_stats *cur_stats, *prev_stats; + struct ctl_io_stats cur_total_stats[3], prev_total_stats[3]; struct timespec cur_time, prev_time; struct ctl_cpu_stats cur_cpu, prev_cpu; uint64_t cur_total_jiffies, prev_total_jiffies; uint64_t cur_idle, prev_idle; - bitstr_t bit_decl(lun_mask, CTL_STAT_LUN_BITS); - bitstr_t bit_decl(port_mask, CTL_MAX_PORTS); - int num_luns; + bitstr_t bit_decl(item_mask, CTL_STAT_BITS); + int cur_items, prev_items; + int cur_alloc, prev_alloc; int numdevs; int header_interval; }; @@ -135,12 +137,11 @@ struct ctlstat_context { #endif static void usage(int error); -static int getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, - struct timespec *cur_time, int *lun_time_valid); +static int getstats(int fd, int *alloc_items, int *num_items, + struct ctl_io_stats **xstats, struct timespec *cur_time, int *time_valid); static int getcpu(struct ctl_cpu_stats *cpu_stats); -static void compute_stats(struct ctlstat_context *ctx, - struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, +static void compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, @@ -155,64 +156,55 @@ usage(int error) } static int -getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, +getstats(int fd, int *alloc_items, int *num_items, struct ctl_io_stats **stats, struct timespec *cur_time, int *flags) { - struct ctl_lun_io_stats *lun_stats; - struct ctl_stats stats; - int more_space_count; + struct ctl_get_io_stats get_stats; + int more_space_count = 0; - more_space_count = 0; - - if (*num_luns == 0) - *num_luns = CTL_STAT_NUM_LUNS; - - lun_stats = *xlun_stats; + if (*alloc_items == 0) + *alloc_items = CTL_STAT_NUM_ITEMS; retry: + if (*stats == NULL) + *stats = malloc(sizeof(**stats) * *alloc_items); - if (lun_stats == NULL) { - lun_stats = (struct ctl_lun_io_stats *)malloc( - sizeof(*lun_stats) * *num_luns); - } - - memset(&stats, 0, sizeof(stats)); - stats.alloc_len = *num_luns * sizeof(*lun_stats); - memset(lun_stats, 0, stats.alloc_len); - stats.lun_stats = lun_stats; - - if (ioctl(fd, CTL_GETSTATS, &stats) == -1) - err(1, "error returned from CTL_GETSTATS ioctl"); + memset(&get_stats, 0, sizeof(get_stats)); + get_stats.alloc_len = *alloc_items * sizeof(**stats); + memset(*stats, 0, get_stats.alloc_len); + get_stats.stats = *stats; + + if (ioctl(fd, (*flags & CTLSTAT_FLAG_PORTS) ? CTL_GET_PORT_STATS : + CTL_GET_LUN_STATS, &get_stats) == -1) + err(1, "CTL_GET_*_STATS ioctl returned error"); - switch (stats.status) { + switch (get_stats.status) { case CTL_SS_OK: break; case CTL_SS_ERROR: - err(1, "CTL_SS_ERROR returned from CTL_GETSTATS ioctl"); + err(1, "CTL_GET_*_STATS ioctl returned CTL_SS_ERROR"); break; case CTL_SS_NEED_MORE_SPACE: - if (more_space_count > 0) { - errx(1, "CTL_GETSTATS returned NEED_MORE_SPACE again"); - } - *num_luns = stats.num_luns; - free(lun_stats); - lun_stats = NULL; + if (more_space_count >= 2) + errx(1, "CTL_GET_*_STATS returned NEED_MORE_SPACE again"); + *alloc_items = get_stats.num_items * 5 / 4; + free(*stats); + *stats = NULL; more_space_count++; goto retry; break; /* NOTREACHED */ default: - errx(1, "unknown status %d returned from CTL_GETSTATS ioctl", - stats.status); + errx(1, "CTL_GET_*_STATS ioctl returned unknown status %d", + get_stats.status); break; } - *xlun_stats = lun_stats; - *num_luns = stats.num_luns; - cur_time->tv_sec = stats.timestamp.tv_sec; - cur_time->tv_nsec = stats.timestamp.tv_nsec; - if (stats.flags & CTL_STATS_FLAG_TIME_VALID) - *flags |= CTLSTAT_FLAG_LUN_TIME_VALID; + *num_items = get_stats.fill_len / sizeof(**stats); + cur_time->tv_sec = get_stats.timestamp.tv_sec; + cur_time->tv_nsec = get_stats.timestamp.tv_nsec; + if (get_stats.flags & CTL_STATS_FLAG_TIME_VALID) + *flags |= CTLSTAT_FLAG_TIME_VALID; else - *flags &= ~CTLSTAT_FLAG_LUN_TIME_VALID; + *flags &= ~CTLSTAT_FLAG_TIME_VALID; return (0); } @@ -240,14 +232,13 @@ getcpu(struct ctl_cpu_stats *cpu_stats) } static void -compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, long double etime, +compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, long double *ms_per_transfer, long double *ms_per_dma, long double *dmas_per_second) { uint64_t total_bytes = 0, total_operations = 0, total_dmas = 0; - uint32_t port; struct bintime total_time_bt, total_dma_bt; struct timespec total_time_ts, total_dma_ts; int i; @@ -256,31 +247,18 @@ compute_stats(struct ctlstat_context *ct bzero(&total_dma_bt, sizeof(total_dma_bt)); bzero(&total_time_ts, sizeof(total_time_ts)); bzero(&total_dma_ts, sizeof(total_dma_ts)); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { - total_bytes += cur_stats->ports[port].bytes[i]; - total_operations += - cur_stats->ports[port].operations[i]; - total_dmas += cur_stats->ports[port].num_dmas[i]; - bintime_add(&total_time_bt, - &cur_stats->ports[port].time[i]); - bintime_add(&total_dma_bt, - &cur_stats->ports[port].dma_time[i]); - if (prev_stats != NULL) { - total_bytes -= - prev_stats->ports[port].bytes[i]; - total_operations -= - prev_stats->ports[port].operations[i]; - total_dmas -= - prev_stats->ports[port].num_dmas[i]; - bintime_sub(&total_time_bt, - &prev_stats->ports[port].time[i]); - bintime_sub(&total_dma_bt, - &prev_stats->ports[port].dma_time[i]); - } + for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { + total_bytes += cur_stats->bytes[i]; + total_operations += cur_stats->operations[i]; + total_dmas += cur_stats->dmas[i]; + bintime_add(&total_time_bt, &cur_stats->time[i]); + bintime_add(&total_dma_bt, &cur_stats->dma_time[i]); + if (prev_stats != NULL) { + total_bytes -= prev_stats->bytes[i]; + total_operations -= prev_stats->operations[i]; + total_dmas -= prev_stats->dmas[i]; + bintime_sub(&total_time_bt, &prev_stats->time[i]); + bintime_sub(&total_dma_bt, &prev_stats->dma_time[i]); } } @@ -340,35 +318,25 @@ compute_stats(struct ctlstat_context *ct static const char *iotypes[] = {"NO IO", "READ", "WRITE"}; static void -ctlstat_dump(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; +ctlstat_dump(struct ctlstat_context *ctx) +{ + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - for (lun = 0; lun < ctx->num_luns;lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + for (i = 0; i < ctx->cur_items;i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("lun %d\n", lun); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf(" port %d\n", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf(" io type %d (%s)\n", iotype, - iotypes[iotype]); - printf(" bytes %ju\n", (uintmax_t) - stats[lun].ports[port].bytes[iotype]); - printf(" operations %ju\n", (uintmax_t) - stats[lun].ports[port].operations[iotype]); - PRINT_BINTIME(" io time", - stats[lun].ports[port].time[iotype]); - printf(" num dmas %ju\n", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - PRINT_BINTIME(" dma time", - stats[lun].ports[port].dma_time[iotype]); - } + printf("%s %d\n", F_PORTS(ctx) ? "port" : "lun", stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf(" io type %d (%s)\n", iotype, iotypes[iotype]); + printf(" bytes %ju\n", (uintmax_t) + stats[i].bytes[iotype]); + printf(" operations %ju\n", (uintmax_t) + stats[i].operations[iotype]); + printf(" dmas %ju\n", (uintmax_t) + stats[i].dmas[iotype]); + PRINT_BINTIME(" io time", stats[i].time[iotype]); + PRINT_BINTIME(" dma time", stats[i].dma_time[iotype]); } } } @@ -378,63 +346,49 @@ ctlstat_dump(struct ctlstat_context *ctx (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32)) static void ctlstat_json(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - printf("{\"luns\":["); - for (lun = 0; lun < ctx->num_luns; lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + printf("{\"%s\":[", F_PORTS(ctx) ? "ports" : "luns"); + for (i = 0; i < ctx->cur_items; i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("{\"ports\":["); - for (port = 0; port < CTL_MAX_PORTS;port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf("{\"num\":%d,\"io\":[", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf("{\"type\":\"%s\",", iotypes[iotype]); - printf("\"bytes\":%ju,", (uintmax_t)stats[ - lun].ports[port].bytes[iotype]); - printf("\"operations\":%ju,", (uintmax_t)stats[ - lun].ports[port].operations[iotype]); - JSON_BINTIME("io time", - stats[lun].ports[port].time[iotype]); - JSON_BINTIME("dma time", - stats[lun].ports[port].dma_time[iotype]); - printf("\"num dmas\":%ju}", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - if (iotype < (CTL_STATS_NUM_TYPES - 1)) - printf(","); /* continue io array */ - } - printf("]}"); /* close port */ - if (port < (CTL_MAX_PORTS - 1)) - printf(","); /* continue port array */ + printf("{\"num\":%d,\"io\":[", + stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf("{\"type\":\"%s\",", iotypes[iotype]); + printf("\"bytes\":%ju,", (uintmax_t)stats[ + i].bytes[iotype]); + printf("\"operations\":%ju,", (uintmax_t)stats[ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Jan 26 21:00:51 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50C28CC1731; Thu, 26 Jan 2017 21:00:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC44F1A54; Thu, 26 Jan 2017 21:00:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL0o4O002692; Thu, 26 Jan 2017 21:00:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL0noK002684; Thu, 26 Jan 2017 21:00:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262100.v0QL0noK002684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:00:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312841 - in stable/10: sys/cam/ctl usr.bin/ctlstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:00:51 -0000 Author: mav Date: Thu Jan 26 21:00:49 2017 New Revision: 312841 URL: https://svnweb.freebsd.org/changeset/base/312841 Log: MFC r311804: Rewrite CTL statistics in more simple and scalable way. Instead of collecting statistics for each combination of ports and logical units, that consumed ~45KB per LU with present number of ports, collect separate statistics for every port and every logical unit separately, that consume only 176 bytes per each single LU/port. This reduces struct ctl_lun size down to just 6KB. Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should allow handling of very large quantities. Old API is still enabled in stable branches for compatibility reasons. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend.h stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_frontend.h stable/10/sys/cam/ctl/ctl_ioctl.h stable/10/sys/cam/ctl/ctl_private.h stable/10/usr.bin/ctlstat/ctlstat.8 stable/10/usr.bin/ctlstat/ctlstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:00:49 2017 (r312841) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003-2009 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -2558,6 +2558,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, struct thread *td) { struct ctl_softc *softc = dev->si_drv1; + struct ctl_port *port; struct ctl_lun *lun; int retval; @@ -2769,6 +2770,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, #endif /* CTL_IO_DELAY */ break; } +#ifdef CTL_LEGACY_STATS case CTL_GETSTATS: { struct ctl_stats *stats = (struct ctl_stats *)addr; int i; @@ -2781,26 +2783,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, stats->status = CTL_SS_OK; stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (stats->fill_len + sizeof(lun->stats) > + if (stats->fill_len + sizeof(lun->legacy_stats) > stats->alloc_len) { stats->status = CTL_SS_NEED_MORE_SPACE; break; } - retval = copyout(&lun->stats, &stats->lun_stats[i++], - sizeof(lun->stats)); + retval = copyout(&lun->legacy_stats, &stats->lun_stats[i++], + sizeof(lun->legacy_stats)); if (retval != 0) break; - stats->fill_len += sizeof(lun->stats); + stats->fill_len += sizeof(lun->legacy_stats); } stats->num_luns = softc->num_luns; -#ifdef CTL_TIME_IO - stats->flags = CTL_STATS_FLAG_TIME_VALID; -#else stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; #endif getnanouptime(&stats->timestamp); break; } +#endif /* CTL_LEGACY_STATS */ case CTL_ERROR_INJECT: { struct ctl_error_desc *err_desc, *new_err_desc; @@ -3388,6 +3390,72 @@ ctl_ioctl(struct cdev *dev, u_long cmd, ctl_isc_announce_port(port); break; } + case CTL_GET_LUN_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (lun->lun < stats->first_item) + continue; + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&lun->stats, &stats->stats[i++], + sizeof(lun->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(lun->stats); + } + stats->num_items = softc->num_luns; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } + case CTL_GET_PORT_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port->targ_port < stats->first_item) + continue; + if (stats->fill_len + sizeof(port->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&port->stats, &stats->stats[i++], + sizeof(port->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(port->stats); + } + stats->num_items = softc->num_ports; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } default: { /* XXX KDM should we fix this? */ #if 0 @@ -4382,7 +4450,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; const char *eui, *naa, *scsiname, *uuid, *vendor, *value; - int lun_number, i, lun_malloced; + int lun_number, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; if (be_lun == NULL) @@ -4604,13 +4672,16 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_softc->num_luns++; /* Setup statistics gathering */ - lun->stats.device_type = be_lun->lun_type; - lun->stats.lun_number = lun_number; - lun->stats.blocksize = be_lun->blocksize; +#ifdef CTL_LEGACY_STATS + lun->legacy_stats.device_type = be_lun->lun_type; + lun->legacy_stats.lun_number = lun_number; + lun->legacy_stats.blocksize = be_lun->blocksize; if (be_lun->blocksize == 0) - lun->stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; - for (i = 0;i < CTL_MAX_PORTS;i++) - lun->stats.ports[i].targ_port = i; + lun->legacy_stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; + for (len = 0; len < CTL_MAX_PORTS; len++) + lun->legacy_stats.ports[len].targ_port = len; +#endif /* CTL_LEGACY_STATS */ + lun->stats.item = lun_number; mtx_unlock(&ctl_softc->ctl_lock); @@ -6676,9 +6747,7 @@ ctl_sap_log_sense_handler(struct ctl_scs { struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; - uint64_t rn, wn, rb, wb; - struct bintime rt, wt; - int i; + struct bintime *t; data = (struct stat_page *)page_index->page_data; @@ -6686,28 +6755,21 @@ ctl_sap_log_sense_handler(struct ctl_scs data->sap.hdr.param_control = SLP_LBIN; data->sap.hdr.param_len = sizeof(struct scsi_log_stat_and_perf) - sizeof(struct scsi_log_param_header); - rn = wn = rb = wb = 0; - bintime_clear(&rt); - bintime_clear(&wt); - for (i = 0; i < CTL_MAX_PORTS; i++) { - rn += lun->stats.ports[i].operations[CTL_STATS_READ]; - wn += lun->stats.ports[i].operations[CTL_STATS_WRITE]; - rb += lun->stats.ports[i].bytes[CTL_STATS_READ]; - wb += lun->stats.ports[i].bytes[CTL_STATS_WRITE]; - bintime_add(&rt, &lun->stats.ports[i].time[CTL_STATS_READ]); - bintime_add(&wt, &lun->stats.ports[i].time[CTL_STATS_WRITE]); - } - scsi_u64to8b(rn, data->sap.read_num); - scsi_u64to8b(wn, data->sap.write_num); - if (lun->stats.blocksize > 0) { - scsi_u64to8b(wb / lun->stats.blocksize, - data->sap.recvieved_lba); - scsi_u64to8b(rb / lun->stats.blocksize, - data->sap.transmitted_lba); + scsi_u64to8b(lun->stats.operations[CTL_STATS_READ], + data->sap.read_num); + scsi_u64to8b(lun->stats.operations[CTL_STATS_WRITE], + data->sap.write_num); + if (lun->be_lun->blocksize > 0) { + scsi_u64to8b(lun->stats.bytes[CTL_STATS_WRITE] / + lun->be_lun->blocksize, data->sap.recvieved_lba); + scsi_u64to8b(lun->stats.bytes[CTL_STATS_READ] / + lun->be_lun->blocksize, data->sap.transmitted_lba); } - scsi_u64to8b((uint64_t)rt.sec * 1000 + rt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_READ]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.read_int); - scsi_u64to8b((uint64_t)wt.sec * 1000 + wt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_WRITE]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.write_int); scsi_u64to8b(0, data->sap.weighted_num); scsi_u64to8b(0, data->sap.weighted_int); @@ -13044,13 +13106,13 @@ static void ctl_process_done(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); + struct ctl_port *port = CTL_PORT(io); struct ctl_lun *lun = CTL_LUN(io); void (*fe_done)(union ctl_io *io); union ctl_ha_msg msg; - uint32_t targ_port = io->io_hdr.nexus.targ_port; CTL_DEBUG_PRINT(("ctl_process_done\n")); - fe_done = softc->ctl_ports[targ_port]->fe_done; + fe_done = port->fe_done; #ifdef CTL_TIME_IO if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { @@ -13153,11 +13215,13 @@ ctl_process_done(union ctl_io *io) */ if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS && io->io_hdr.io_type == CTL_IO_SCSI) { -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif int type; +#ifdef CTL_TIME_IO + struct bintime bt; + getbinuptime(&bt); + bintime_sub(&bt, &io->io_hdr.start_bt); +#endif if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) type = CTL_STATS_READ; @@ -13167,18 +13231,38 @@ ctl_process_done(union ctl_io *io) else type = CTL_STATS_NO_IO; - lun->stats.ports[targ_port].bytes[type] += +#ifdef CTL_LEGACY_STATS + uint32_t targ_port = port->targ_port; + lun->legacy_stats.ports[targ_port].bytes[type] += io->scsiio.kern_total_len; - lun->stats.ports[targ_port].operations[type]++; + lun->legacy_stats.ports[targ_port].operations[type] ++; + lun->legacy_stats.ports[targ_port].num_dmas[type] += + io->io_hdr.num_dmas; #ifdef CTL_TIME_IO - bintime_add(&lun->stats.ports[targ_port].dma_time[type], + bintime_add(&lun->legacy_stats.ports[targ_port].dma_time[type], &io->io_hdr.dma_bt); - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.start_bt); - bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); + bintime_add(&lun->legacy_stats.ports[targ_port].time[type], + &bt); #endif - lun->stats.ports[targ_port].num_dmas[type] += - io->io_hdr.num_dmas; +#endif /* CTL_LEGACY_STATS */ + + lun->stats.bytes[type] += io->scsiio.kern_total_len; + lun->stats.operations[type] ++; + lun->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&lun->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&lun->stats.time[type], &bt); +#endif + + mtx_lock(&port->port_lock); + port->stats.bytes[type] += io->scsiio.kern_total_len; + port->stats.operations[type] ++; + port->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&port->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&port->stats.time[type], &bt); +#endif + mtx_unlock(&port->port_lock); } /* Modified: stable/10/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_backend.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,54 +40,7 @@ #ifndef _CTL_BACKEND_H_ #define _CTL_BACKEND_H_ -/* - * XXX KDM move this to another header file? - */ -#define CTL_BE_NAME_LEN 32 - -/* - * The ID_REQ flag is used to say that the caller has requested a - * particular LUN ID in the req_lun_id field. If we cannot allocate that - * LUN ID, the ctl_add_lun() call will fail. - * - * The STOPPED flag tells us that the LUN should default to the powered - * off state. It will return 0x04,0x02 until it is powered up. ("Logical - * unit not ready, initializing command required.") - * - * The NO_MEDIA flag tells us that the LUN has no media inserted. - * - * The PRIMARY flag tells us that this LUN is registered as a Primary LUN - * which is accessible via the Master shelf controller in an HA. This flag - * being set indicates a Primary LUN. This flag being reset represents a - * Secondary LUN controlled by the Secondary controller in an HA - * configuration. Flag is applicable at this time to T_DIRECT types. - * - * The SERIAL_NUM flag tells us that the serial_num field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x80. - * - * The DEVID flag tells us that the device_id field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x83. - * - * The DEV_TYPE flag tells us that the device_type field is filled in. - * - * The EJECTED flag tells us that the removable LUN has tray open. - * - * The UNMAP flag tells us that this LUN supports UNMAP. - * - * The OFFLINE flag tells us that this LUN can not access backing store. - */ -typedef enum { - CTL_LUN_FLAG_ID_REQ = 0x01, - CTL_LUN_FLAG_STOPPED = 0x02, - CTL_LUN_FLAG_NO_MEDIA = 0x04, - CTL_LUN_FLAG_PRIMARY = 0x08, - CTL_LUN_FLAG_SERIAL_NUM = 0x10, - CTL_LUN_FLAG_DEVID = 0x20, - CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80, - CTL_LUN_FLAG_EJECTED = 0x100, - CTL_LUN_FLAG_READONLY = 0x200 -} ctl_backend_lun_flags; +#include typedef enum { CTL_LUN_SERSEQ_OFF, Modified: stable/10/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.c Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_frontend.c Thu Jan 26 21:00:49 2017 (r312841) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,13 +193,14 @@ error: mtx_unlock(&softc->ctl_lock); return (retval); } + port->targ_port = port_num; port->ctl_pool_ref = pool; - if (port->options.stqh_first == NULL) STAILQ_INIT(&port->options); + port->stats.item = port_num; + mtx_init(&port->port_lock, "CTL port", NULL, MTX_DEF); mtx_lock(&softc->ctl_lock); - port->targ_port = port_num; STAILQ_INSERT_TAIL(&port->frontend->port_list, port, fe_links); for (tport = NULL, nport = STAILQ_FIRST(&softc->port_list); nport != NULL && nport->targ_port < port_num; @@ -218,17 +220,11 @@ int ctl_port_deregister(struct ctl_port *port) { struct ctl_softc *softc = port->ctl_softc; - struct ctl_io_pool *pool; - int retval, i; - - retval = 0; - - pool = (struct ctl_io_pool *)port->ctl_pool_ref; + struct ctl_io_pool *pool = (struct ctl_io_pool *)port->ctl_pool_ref; + int i; - if (port->targ_port == -1) { - retval = 1; - goto bailout; - } + if (port->targ_port == -1) + return (1); mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->port_list, port, ctl_port, links); @@ -251,9 +247,9 @@ ctl_port_deregister(struct ctl_port *por for (i = 0; i < port->max_initiators; i++) free(port->wwpn_iid[i].name, M_CTL); free(port->wwpn_iid, M_CTL); + mtx_destroy(&port->port_lock); -bailout: - return (retval); + return (0); } void Modified: stable/10/sys/cam/ctl/ctl_frontend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_frontend.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +40,8 @@ #ifndef _CTL_FRONTEND_H_ #define _CTL_FRONTEND_H_ +#include + typedef enum { CTL_PORT_STATUS_NONE = 0x00, CTL_PORT_STATUS_ONLINE = 0x01, @@ -243,6 +246,8 @@ struct ctl_port { struct ctl_devid *port_devid; /* passed to CTL */ struct ctl_devid *target_devid; /* passed to CTL */ struct ctl_devid *init_devid; /* passed to CTL */ + struct ctl_io_stats stats; /* used by CTL */ + struct mtx port_lock; /* used by CTL */ STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ STAILQ_ENTRY(ctl_port) links; /* used by CTL */ }; Modified: stable/10/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2011 Spectra Logic Corporation + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,6 +81,9 @@ /* Hopefully this won't conflict with new misc devices that pop up */ #define CTL_MINOR 225 +/* Legacy statistics accumulated for every port for every LU. */ +#define CTL_LEGACY_STATS 1 + typedef enum { CTL_DELAY_TYPE_NONE, CTL_DELAY_TYPE_CONT, @@ -117,6 +121,18 @@ typedef enum { #define CTL_STATS_NUM_TYPES 3 typedef enum { + CTL_SS_OK, + CTL_SS_NEED_MORE_SPACE, + CTL_SS_ERROR +} ctl_stats_status; + +typedef enum { + CTL_STATS_FLAG_NONE = 0x00, + CTL_STATS_FLAG_TIME_VALID = 0x01 +} ctl_stats_flags; + +#ifdef CTL_LEGACY_STATS +typedef enum { CTL_LUN_STATS_NO_BLOCKSIZE = 0x01 } ctl_lun_stats_flags; @@ -137,17 +153,6 @@ struct ctl_lun_io_stats { struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; }; -typedef enum { - CTL_SS_OK, - CTL_SS_NEED_MORE_SPACE, - CTL_SS_ERROR -} ctl_stats_status; - -typedef enum { - CTL_STATS_FLAG_NONE = 0x00, - CTL_STATS_FLAG_TIME_VALID = 0x01 -} ctl_stats_flags; - struct ctl_stats { int alloc_len; /* passed to kernel */ struct ctl_lun_io_stats *lun_stats; /* passed to/from kernel */ @@ -157,6 +162,27 @@ struct ctl_stats { ctl_stats_flags flags; /* passed to userland */ struct timespec timestamp; /* passed to userland */ }; +#endif /* CTL_LEGACY_STATS */ + +struct ctl_io_stats { + uint32_t item; + uint64_t bytes[CTL_STATS_NUM_TYPES]; + uint64_t operations[CTL_STATS_NUM_TYPES]; + uint64_t dmas[CTL_STATS_NUM_TYPES]; + struct bintime time[CTL_STATS_NUM_TYPES]; + struct bintime dma_time[CTL_STATS_NUM_TYPES]; +}; + +struct ctl_get_io_stats { + struct ctl_io_stats *stats; /* passed to/from kernel */ + size_t alloc_len; /* passed to kernel */ + size_t fill_len; /* passed to userland */ + int first_item; /* passed to kernel */ + int num_items; /* passed to userland */ + ctl_stats_status status; /* passed to userland */ + ctl_stats_flags flags; /* passed to userland */ + struct timespec timestamp; /* passed to userland */ +}; /* * The types of errors that can be injected: @@ -342,12 +368,54 @@ typedef enum { CTL_LUNREQ_MODIFY, } ctl_lunreq_type; +/* + * The ID_REQ flag is used to say that the caller has requested a + * particular LUN ID in the req_lun_id field. If we cannot allocate that + * LUN ID, the ctl_add_lun() call will fail. + * + * The STOPPED flag tells us that the LUN should default to the powered + * off state. It will return 0x04,0x02 until it is powered up. ("Logical + * unit not ready, initializing command required.") + * + * The NO_MEDIA flag tells us that the LUN has no media inserted. + * + * The PRIMARY flag tells us that this LUN is registered as a Primary LUN + * which is accessible via the Master shelf controller in an HA. This flag + * being set indicates a Primary LUN. This flag being reset represents a + * Secondary LUN controlled by the Secondary controller in an HA + * configuration. Flag is applicable at this time to T_DIRECT types. + * + * The SERIAL_NUM flag tells us that the serial_num field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x80. + * + * The DEVID flag tells us that the device_id field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x83. + * + * The DEV_TYPE flag tells us that the device_type field is filled in. + * + * The EJECTED flag tells us that the removable LUN has tray open. + * + * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. + */ +typedef enum { + CTL_LUN_FLAG_ID_REQ = 0x01, + CTL_LUN_FLAG_STOPPED = 0x02, + CTL_LUN_FLAG_NO_MEDIA = 0x04, + CTL_LUN_FLAG_PRIMARY = 0x08, + CTL_LUN_FLAG_SERIAL_NUM = 0x10, + CTL_LUN_FLAG_DEVID = 0x20, + CTL_LUN_FLAG_DEV_TYPE = 0x40, + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_EJECTED = 0x100, + CTL_LUN_FLAG_READONLY = 0x200 +} ctl_backend_lun_flags; /* * LUN creation parameters: * - * flags: Various LUN flags, see ctl_backend.h for a - * description of the flag values and meanings. + * flags: Various LUN flags, see above. * * device_type: The SCSI device type. e.g. 0 for Direct Access, * 3 for Processor, etc. Only certain backends may @@ -465,6 +533,7 @@ union ctl_lunreq_data { * kern_be_args: For kernel use only. */ struct ctl_lun_req { +#define CTL_BE_NAME_LEN 32 char backend[CTL_BE_NAME_LEN]; ctl_lunreq_type reqtype; union ctl_lunreq_data reqdata; @@ -761,6 +830,8 @@ struct ctl_lun_map { #define CTL_PORT_REQ _IOWR(CTL_MINOR, 0x26, struct ctl_req) #define CTL_PORT_LIST _IOWR(CTL_MINOR, 0x27, struct ctl_lun_list) #define CTL_LUN_MAP _IOW(CTL_MINOR, 0x28, struct ctl_lun_map) +#define CTL_GET_LUN_STATS _IOWR(CTL_MINOR, 0x29, struct ctl_get_io_stats) +#define CTL_GET_PORT_STATS _IOWR(CTL_MINOR, 0x2a, struct ctl_get_io_stats) #endif /* _CTL_IOCTL_H_ */ Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003, 2004, 2005, 2008 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -404,7 +404,10 @@ struct ctl_lun { struct callout ie_callout; /* INTERVAL TIMER */ struct ctl_mode_pages mode_pages; struct ctl_log_pages log_pages; - struct ctl_lun_io_stats stats; +#ifdef CTL_LEGACY_STATS + struct ctl_lun_io_stats legacy_stats; +#endif /* CTL_LEGACY_STATS */ + struct ctl_io_stats stats; uint32_t res_idx; uint32_t pr_generation; uint64_t *pr_keys[CTL_MAX_PORTS]; Modified: stable/10/usr.bin/ctlstat/ctlstat.8 ============================================================================== --- stable/10/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 21:00:49 2017 (r312841) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.bin/ctlstat/ctlstat.8#2 $ .\" $FreeBSD$ .\" -.Dd September 21, 2015 +.Dd January 9, 2017 .Dt CTLSTAT 8 .Os .Sh NAME @@ -118,5 +118,6 @@ every 10 seconds. .Xr ctld 8 , .Xr iostat 8 .Sh AUTHORS -.An Ken Merry Aq ken@FreeBSD.org -.An Will Andrews Aq will@FreeBSD.org +.An Ken Merry Aq Mt ken@FreeBSD.org +.An Will Andrews Aq Mt will@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org Modified: stable/10/usr.bin/ctlstat/ctlstat.c ============================================================================== --- stable/10/usr.bin/ctlstat/ctlstat.c Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/usr.bin/ctlstat/ctlstat.c Thu Jan 26 21:00:49 2017 (r312841) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004, 2008, 2009 Silicon Graphics International Corp. + * Copyright (c) 2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,17 +67,17 @@ __FBSDID("$FreeBSD$"); #include /* - * The default amount of space we allocate for LUN storage space. We - * dynamically allocate more if needed. + * The default amount of space we allocate for stats storage space. + * We dynamically allocate more if needed. */ -#define CTL_STAT_NUM_LUNS 30 +#define CTL_STAT_NUM_ITEMS 256 /* * The default number of LUN selection bits we allocate. This is large * because we don't currently increase it if the user specifies a LUN * number of 1024 or larger. */ -#define CTL_STAT_LUN_BITS 1024L +#define CTL_STAT_BITS 1024L static const char *ctlstat_opts = "Cc:Ddhjl:n:p:tw:"; static const char *ctlstat_usage = "Usage: ctlstat [-CDdjht] [-l lunnum]" @@ -101,31 +102,32 @@ typedef enum { #define CTLSTAT_FLAG_FIRST_RUN (1 << 2) #define CTLSTAT_FLAG_TOTALS (1 << 3) #define CTLSTAT_FLAG_DMA_TIME (1 << 4) -#define CTLSTAT_FLAG_LUN_TIME_VALID (1 << 5) -#define CTLSTAT_FLAG_LUN_MASK (1 << 6) -#define CTLSTAT_FLAG_PORT_MASK (1 << 7) +#define CTLSTAT_FLAG_TIME_VALID (1 << 5) +#define CTLSTAT_FLAG_MASK (1 << 6) +#define CTLSTAT_FLAG_LUNS (1 << 7) +#define CTLSTAT_FLAG_PORTS (1 << 8) #define F_CPU(ctx) ((ctx)->flags & CTLSTAT_FLAG_CPU) #define F_HDR(ctx) ((ctx)->flags & CTLSTAT_FLAG_HEADER) #define F_FIRST(ctx) ((ctx)->flags & CTLSTAT_FLAG_FIRST_RUN) #define F_TOTALS(ctx) ((ctx)->flags & CTLSTAT_FLAG_TOTALS) #define F_DMA(ctx) ((ctx)->flags & CTLSTAT_FLAG_DMA_TIME) -#define F_LUNVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_TIME_VALID) -#define F_LUNMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_MASK) -#define F_PORTMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORT_MASK) +#define F_TIMEVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_TIME_VALID) +#define F_MASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_MASK) +#define F_LUNS(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUNS) +#define F_PORTS(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORTS) struct ctlstat_context { ctlstat_mode_types mode; int flags; - struct ctl_lun_io_stats *cur_lun_stats, *prev_lun_stats, - *tmp_lun_stats; - struct ctl_lun_io_stats cur_total_stats[3], prev_total_stats[3]; + struct ctl_io_stats *cur_stats, *prev_stats; + struct ctl_io_stats cur_total_stats[3], prev_total_stats[3]; struct timespec cur_time, prev_time; struct ctl_cpu_stats cur_cpu, prev_cpu; uint64_t cur_total_jiffies, prev_total_jiffies; uint64_t cur_idle, prev_idle; - bitstr_t bit_decl(lun_mask, CTL_STAT_LUN_BITS); - bitstr_t bit_decl(port_mask, CTL_MAX_PORTS); - int num_luns; + bitstr_t bit_decl(item_mask, CTL_STAT_BITS); + int cur_items, prev_items; + int cur_alloc, prev_alloc; int numdevs; int header_interval; }; @@ -135,12 +137,11 @@ struct ctlstat_context { #endif static void usage(int error); -static int getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, - struct timespec *cur_time, int *lun_time_valid); +static int getstats(int fd, int *alloc_items, int *num_items, + struct ctl_io_stats **xstats, struct timespec *cur_time, int *time_valid); static int getcpu(struct ctl_cpu_stats *cpu_stats); -static void compute_stats(struct ctlstat_context *ctx, - struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, +static void compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, @@ -155,64 +156,55 @@ usage(int error) } static int -getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, +getstats(int fd, int *alloc_items, int *num_items, struct ctl_io_stats **stats, struct timespec *cur_time, int *flags) { - struct ctl_lun_io_stats *lun_stats; - struct ctl_stats stats; - int more_space_count; + struct ctl_get_io_stats get_stats; + int more_space_count = 0; - more_space_count = 0; - - if (*num_luns == 0) - *num_luns = CTL_STAT_NUM_LUNS; - - lun_stats = *xlun_stats; + if (*alloc_items == 0) + *alloc_items = CTL_STAT_NUM_ITEMS; retry: + if (*stats == NULL) + *stats = malloc(sizeof(**stats) * *alloc_items); - if (lun_stats == NULL) { - lun_stats = (struct ctl_lun_io_stats *)malloc( - sizeof(*lun_stats) * *num_luns); - } - - memset(&stats, 0, sizeof(stats)); - stats.alloc_len = *num_luns * sizeof(*lun_stats); - memset(lun_stats, 0, stats.alloc_len); - stats.lun_stats = lun_stats; - - if (ioctl(fd, CTL_GETSTATS, &stats) == -1) - err(1, "error returned from CTL_GETSTATS ioctl"); + memset(&get_stats, 0, sizeof(get_stats)); + get_stats.alloc_len = *alloc_items * sizeof(**stats); + memset(*stats, 0, get_stats.alloc_len); + get_stats.stats = *stats; + + if (ioctl(fd, (*flags & CTLSTAT_FLAG_PORTS) ? CTL_GET_PORT_STATS : + CTL_GET_LUN_STATS, &get_stats) == -1) + err(1, "CTL_GET_*_STATS ioctl returned error"); - switch (stats.status) { + switch (get_stats.status) { case CTL_SS_OK: break; case CTL_SS_ERROR: - err(1, "CTL_SS_ERROR returned from CTL_GETSTATS ioctl"); + err(1, "CTL_GET_*_STATS ioctl returned CTL_SS_ERROR"); break; case CTL_SS_NEED_MORE_SPACE: - if (more_space_count > 0) { - errx(1, "CTL_GETSTATS returned NEED_MORE_SPACE again"); - } - *num_luns = stats.num_luns; - free(lun_stats); - lun_stats = NULL; + if (more_space_count >= 2) + errx(1, "CTL_GET_*_STATS returned NEED_MORE_SPACE again"); + *alloc_items = get_stats.num_items * 5 / 4; + free(*stats); + *stats = NULL; more_space_count++; goto retry; break; /* NOTREACHED */ default: - errx(1, "unknown status %d returned from CTL_GETSTATS ioctl", - stats.status); + errx(1, "CTL_GET_*_STATS ioctl returned unknown status %d", + get_stats.status); break; } - *xlun_stats = lun_stats; - *num_luns = stats.num_luns; - cur_time->tv_sec = stats.timestamp.tv_sec; - cur_time->tv_nsec = stats.timestamp.tv_nsec; - if (stats.flags & CTL_STATS_FLAG_TIME_VALID) - *flags |= CTLSTAT_FLAG_LUN_TIME_VALID; + *num_items = get_stats.fill_len / sizeof(**stats); + cur_time->tv_sec = get_stats.timestamp.tv_sec; + cur_time->tv_nsec = get_stats.timestamp.tv_nsec; + if (get_stats.flags & CTL_STATS_FLAG_TIME_VALID) + *flags |= CTLSTAT_FLAG_TIME_VALID; else - *flags &= ~CTLSTAT_FLAG_LUN_TIME_VALID; + *flags &= ~CTLSTAT_FLAG_TIME_VALID; return (0); } @@ -240,14 +232,13 @@ getcpu(struct ctl_cpu_stats *cpu_stats) } static void -compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, long double etime, +compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, long double *ms_per_transfer, long double *ms_per_dma, long double *dmas_per_second) { uint64_t total_bytes = 0, total_operations = 0, total_dmas = 0; - uint32_t port; struct bintime total_time_bt, total_dma_bt; struct timespec total_time_ts, total_dma_ts; int i; @@ -256,31 +247,18 @@ compute_stats(struct ctlstat_context *ct bzero(&total_dma_bt, sizeof(total_dma_bt)); bzero(&total_time_ts, sizeof(total_time_ts)); bzero(&total_dma_ts, sizeof(total_dma_ts)); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { - total_bytes += cur_stats->ports[port].bytes[i]; - total_operations += - cur_stats->ports[port].operations[i]; - total_dmas += cur_stats->ports[port].num_dmas[i]; - bintime_add(&total_time_bt, - &cur_stats->ports[port].time[i]); - bintime_add(&total_dma_bt, - &cur_stats->ports[port].dma_time[i]); - if (prev_stats != NULL) { - total_bytes -= - prev_stats->ports[port].bytes[i]; - total_operations -= - prev_stats->ports[port].operations[i]; - total_dmas -= - prev_stats->ports[port].num_dmas[i]; - bintime_sub(&total_time_bt, - &prev_stats->ports[port].time[i]); - bintime_sub(&total_dma_bt, - &prev_stats->ports[port].dma_time[i]); - } + for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { + total_bytes += cur_stats->bytes[i]; + total_operations += cur_stats->operations[i]; + total_dmas += cur_stats->dmas[i]; + bintime_add(&total_time_bt, &cur_stats->time[i]); + bintime_add(&total_dma_bt, &cur_stats->dma_time[i]); + if (prev_stats != NULL) { + total_bytes -= prev_stats->bytes[i]; + total_operations -= prev_stats->operations[i]; + total_dmas -= prev_stats->dmas[i]; + bintime_sub(&total_time_bt, &prev_stats->time[i]); + bintime_sub(&total_dma_bt, &prev_stats->dma_time[i]); } } @@ -340,35 +318,25 @@ compute_stats(struct ctlstat_context *ct static const char *iotypes[] = {"NO IO", "READ", "WRITE"}; static void -ctlstat_dump(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; +ctlstat_dump(struct ctlstat_context *ctx) +{ + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - for (lun = 0; lun < ctx->num_luns;lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + for (i = 0; i < ctx->cur_items;i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("lun %d\n", lun); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf(" port %d\n", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf(" io type %d (%s)\n", iotype, - iotypes[iotype]); - printf(" bytes %ju\n", (uintmax_t) - stats[lun].ports[port].bytes[iotype]); - printf(" operations %ju\n", (uintmax_t) - stats[lun].ports[port].operations[iotype]); - PRINT_BINTIME(" io time", - stats[lun].ports[port].time[iotype]); - printf(" num dmas %ju\n", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - PRINT_BINTIME(" dma time", - stats[lun].ports[port].dma_time[iotype]); - } + printf("%s %d\n", F_PORTS(ctx) ? "port" : "lun", stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf(" io type %d (%s)\n", iotype, iotypes[iotype]); + printf(" bytes %ju\n", (uintmax_t) + stats[i].bytes[iotype]); + printf(" operations %ju\n", (uintmax_t) + stats[i].operations[iotype]); + printf(" dmas %ju\n", (uintmax_t) + stats[i].dmas[iotype]); + PRINT_BINTIME(" io time", stats[i].time[iotype]); + PRINT_BINTIME(" dma time", stats[i].dma_time[iotype]); } } } @@ -378,63 +346,49 @@ ctlstat_dump(struct ctlstat_context *ctx (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32)) static void ctlstat_json(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - printf("{\"luns\":["); - for (lun = 0; lun < ctx->num_luns; lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + printf("{\"%s\":[", F_PORTS(ctx) ? "ports" : "luns"); + for (i = 0; i < ctx->cur_items; i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("{\"ports\":["); - for (port = 0; port < CTL_MAX_PORTS;port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf("{\"num\":%d,\"io\":[", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf("{\"type\":\"%s\",", iotypes[iotype]); - printf("\"bytes\":%ju,", (uintmax_t)stats[ - lun].ports[port].bytes[iotype]); - printf("\"operations\":%ju,", (uintmax_t)stats[ - lun].ports[port].operations[iotype]); - JSON_BINTIME("io time", - stats[lun].ports[port].time[iotype]); - JSON_BINTIME("dma time", - stats[lun].ports[port].dma_time[iotype]); - printf("\"num dmas\":%ju}", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - if (iotype < (CTL_STATS_NUM_TYPES - 1)) - printf(","); /* continue io array */ - } - printf("]}"); /* close port */ - if (port < (CTL_MAX_PORTS - 1)) - printf(","); /* continue port array */ + printf("{\"num\":%d,\"io\":[", + stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Jan 26 21:01:39 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD061CC17C7; Thu, 26 Jan 2017 21:01:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8006A1D80; Thu, 26 Jan 2017 21:01:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL1cpG006457; Thu, 26 Jan 2017 21:01:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL1cKb006456; Thu, 26 Jan 2017 21:01:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262101.v0QL1cKb006456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312842 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:01:39 -0000 Author: mav Date: Thu Jan 26 21:01:38 2017 New Revision: 312842 URL: https://svnweb.freebsd.org/changeset/base/312842 Log: MFC r311873: Fix malloc(M_WAITOK) under mutex, introduced at r311787. Modified: stable/11/sys/cam/ctl/ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 21:00:49 2017 (r312841) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 21:01:38 2017 (r312842) @@ -4593,6 +4593,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft printf("ctl: requested LUN ID %d is already " "in use\n", be_lun->req_lun_id); } +fail: + free(lun->lun_devid, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); be_lun->lun_config_status(be_lun->be_lun, @@ -4605,14 +4607,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (lun_number == -1) { mtx_unlock(&ctl_softc->ctl_lock); printf("ctl: can't allocate LUN, out of LUNs\n"); - if (lun->flags & CTL_LUN_MALLOCED) - free(lun, M_CTL); - be_lun->lun_config_status(be_lun->be_lun, - CTL_LUN_CONFIG_FAILURE); - return (ENOSPC); + goto fail; } } ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number); + mtx_unlock(&ctl_softc->ctl_lock); mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF); lun->lun = lun_number; @@ -4664,22 +4663,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_init_page_index(lun); ctl_init_log_page_index(lun); - /* - * Now, before we insert this lun on the lun list, set the lun - * inventory changed UA for all other luns. - */ - STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { - mtx_lock(&nlun->lun_lock); - ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); - mtx_unlock(&nlun->lun_lock); - } - - STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); - - ctl_softc->ctl_luns[lun_number] = lun; - - ctl_softc->num_luns++; - /* Setup statistics gathering */ #ifdef CTL_LEGACY_STATS lun->legacy_stats.device_type = be_lun->lun_type; @@ -4692,6 +4675,19 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft #endif /* CTL_LEGACY_STATS */ lun->stats.item = lun_number; + /* + * Now, before we insert this lun on the lun list, set the lun + * inventory changed UA for all other luns. + */ + mtx_lock(&ctl_softc->ctl_lock); + STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { + mtx_lock(&nlun->lun_lock); + ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); + mtx_unlock(&nlun->lun_lock); + } + STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); + ctl_softc->ctl_luns[lun_number] = lun; + ctl_softc->num_luns++; mtx_unlock(&ctl_softc->ctl_lock); lun->be_lun->lun_config_status(lun->be_lun->be_lun, CTL_LUN_CONFIG_OK); From owner-svn-src-stable@freebsd.org Thu Jan 26 21:02:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 394B9CC1984; Thu, 26 Jan 2017 21:02:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E05211F34; Thu, 26 Jan 2017 21:02:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL263w006530; Thu, 26 Jan 2017 21:02:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL26CW006529; Thu, 26 Jan 2017 21:02:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262102.v0QL26CW006529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312843 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:02:08 -0000 Author: mav Date: Thu Jan 26 21:02:06 2017 New Revision: 312843 URL: https://svnweb.freebsd.org/changeset/base/312843 Log: MFC r311873: Fix malloc(M_WAITOK) under mutex, introduced at r311787. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:01:38 2017 (r312842) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:02:06 2017 (r312843) @@ -4584,6 +4584,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft printf("ctl: requested LUN ID %d is already " "in use\n", be_lun->req_lun_id); } +fail: + free(lun->lun_devid, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); be_lun->lun_config_status(be_lun->be_lun, @@ -4596,14 +4598,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (lun_number == -1) { mtx_unlock(&ctl_softc->ctl_lock); printf("ctl: can't allocate LUN, out of LUNs\n"); - if (lun->flags & CTL_LUN_MALLOCED) - free(lun, M_CTL); - be_lun->lun_config_status(be_lun->be_lun, - CTL_LUN_CONFIG_FAILURE); - return (ENOSPC); + goto fail; } } ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number); + mtx_unlock(&ctl_softc->ctl_lock); mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF); lun->lun = lun_number; @@ -4655,22 +4654,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_init_page_index(lun); ctl_init_log_page_index(lun); - /* - * Now, before we insert this lun on the lun list, set the lun - * inventory changed UA for all other luns. - */ - STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { - mtx_lock(&nlun->lun_lock); - ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); - mtx_unlock(&nlun->lun_lock); - } - - STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); - - ctl_softc->ctl_luns[lun_number] = lun; - - ctl_softc->num_luns++; - /* Setup statistics gathering */ #ifdef CTL_LEGACY_STATS lun->legacy_stats.device_type = be_lun->lun_type; @@ -4683,6 +4666,19 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft #endif /* CTL_LEGACY_STATS */ lun->stats.item = lun_number; + /* + * Now, before we insert this lun on the lun list, set the lun + * inventory changed UA for all other luns. + */ + mtx_lock(&ctl_softc->ctl_lock); + STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { + mtx_lock(&nlun->lun_lock); + ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); + mtx_unlock(&nlun->lun_lock); + } + STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); + ctl_softc->ctl_luns[lun_number] = lun; + ctl_softc->num_luns++; mtx_unlock(&ctl_softc->ctl_lock); lun->be_lun->lun_config_status(lun->be_lun->be_lun, CTL_LUN_CONFIG_OK); From owner-svn-src-stable@freebsd.org Thu Jan 26 21:07:01 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0030CC1AF4; Thu, 26 Jan 2017 21:07:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E18C29C; Thu, 26 Jan 2017 21:07:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL70Gm006760; Thu, 26 Jan 2017 21:07:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL6xq2006751; Thu, 26 Jan 2017 21:06:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262106.v0QL6xq2006751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312844 - in stable/11/sys/cam: . ctl scsi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:07:01 -0000 Author: mav Date: Thu Jan 26 21:06:59 2017 New Revision: 312844 URL: https://svnweb.freebsd.org/changeset/base/312844 Log: MFC r312026: Improve CAM_CDB_POINTER support. Modified: stable/11/sys/cam/cam_ccb.h stable/11/sys/cam/cam_periph.c stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c stable/11/sys/cam/ctl/scsi_ctl.c stable/11/sys/cam/scsi/scsi_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_ccb.h ============================================================================== --- stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:06:59 2017 (r312844) @@ -780,6 +780,13 @@ struct ccb_accept_tio { struct scsi_sense_data sense_data; }; +static __inline uint8_t * +atio_cdb_ptr(struct ccb_accept_tio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* Release SIM Queue */ struct ccb_relsim { struct ccb_hdr ccb_h; Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/cam_periph.c Thu Jan 26 21:06:59 2017 (r312844) @@ -1925,10 +1925,7 @@ cam_periph_devctl_notify(union ccb *ccb) if (ccb->ccb_h.func_code == XPT_SCSI_IO) { sbuf_printf(&sb, "CDB=\""); - if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb); - else - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb); + scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb); sbuf_printf(&sb, "\" "); } else if (ccb->ccb_h.func_code == XPT_ATA_IO) { sbuf_printf(&sb, "ACB=\""); Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:06:59 2017 (r312844) @@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union c __func__, csio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len); ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:06:59 2017 (r312844) @@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, un && (csio->sglist_cnt != 0))) { printf("%s: tag %04x cdb %02x flags %#x dxfer_len " "%d sg %u\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0], flags, dxfer_len, + atio_cdb_ptr(atio)[0], flags, dxfer_len, csio->sglist_cnt); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); @@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * { uint64_t lba; uint32_t num_blocks, nbc; - uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)? - atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes; + uint8_t *cmdbyt = atio_cdb_ptr(atio); nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */ @@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, uni __func__, atio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len); #ifdef CTLFEDEBUG printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__, @@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, uni printf("%s: tag %04x no status or " "len cdb = %02x\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0]); + atio_cdb_ptr(atio)[0]); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/scsi/scsi_all.c Thu Jan 26 21:06:59 2017 (r312844) @@ -3617,15 +3617,9 @@ scsi_command_string(struct cam_device *d #endif /* _KERNEL/!_KERNEL */ - if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_ptr, sb); - } else { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_bytes, sb); - } + sbuf_printf(sb, "%s. CDB: ", + scsi_op_desc(scsiio_cdb_ptr(csio)[0], inq_data)); + scsi_cdb_sbuf(scsiio_cdb_ptr(csio), sb); #ifdef _KERNEL xpt_free_ccb((union ccb *)cgd); @@ -5030,7 +5024,6 @@ scsi_sense_sbuf(struct cam_device *devic struct ccb_getdev *cgd; #endif /* _KERNEL */ char path_str[64]; - uint8_t *cdb; #ifndef _KERNEL if (device == NULL) @@ -5128,14 +5121,9 @@ scsi_sense_sbuf(struct cam_device *devic sense = &csio->sense_data; } - if (csio->ccb_h.flags & CAM_CDB_POINTER) - cdb = csio->cdb_io.cdb_ptr; - else - cdb = csio->cdb_io.cdb_bytes; - scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb, - path_str, inq_data, cdb, csio->cdb_len); - + path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len); + #ifdef _KERNEL xpt_free_ccb((union ccb*)cgd); #endif /* _KERNEL/!_KERNEL */ From owner-svn-src-stable@freebsd.org Thu Jan 26 21:07:48 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E3DCCC1C1D; Thu, 26 Jan 2017 21:07:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F05B46A9; Thu, 26 Jan 2017 21:07:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL7leU006845; Thu, 26 Jan 2017 21:07:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL7ksv006840; Thu, 26 Jan 2017 21:07:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262107.v0QL7ksv006840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:07:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312845 - in stable/10/sys/cam: . ctl scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:07:48 -0000 Author: mav Date: Thu Jan 26 21:07:46 2017 New Revision: 312845 URL: https://svnweb.freebsd.org/changeset/base/312845 Log: MFC r312026: Improve CAM_CDB_POINTER support. Modified: stable/10/sys/cam/cam_ccb.h stable/10/sys/cam/cam_periph.c stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c stable/10/sys/cam/ctl/scsi_ctl.c stable/10/sys/cam/scsi/scsi_all.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_ccb.h ============================================================================== --- stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:07:46 2017 (r312845) @@ -760,6 +760,13 @@ struct ccb_accept_tio { struct scsi_sense_data sense_data; }; +static __inline uint8_t * +atio_cdb_ptr(struct ccb_accept_tio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* Release SIM Queue */ struct ccb_relsim { struct ccb_hdr ccb_h; Modified: stable/10/sys/cam/cam_periph.c ============================================================================== --- stable/10/sys/cam/cam_periph.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/cam_periph.c Thu Jan 26 21:07:46 2017 (r312845) @@ -1909,10 +1909,7 @@ cam_periph_devctl_notify(union ccb *ccb) if (ccb->ccb_h.func_code == XPT_SCSI_IO) { sbuf_printf(&sb, "CDB=\""); - if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb); - else - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb); + scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb); sbuf_printf(&sb, "\" "); } else if (ccb->ccb_h.func_code == XPT_ATA_IO) { sbuf_printf(&sb, "ACB=\""); Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:07:46 2017 (r312845) @@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union c __func__, csio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len); ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:07:46 2017 (r312845) @@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, un && (csio->sglist_cnt != 0))) { printf("%s: tag %04x cdb %02x flags %#x dxfer_len " "%d sg %u\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0], flags, dxfer_len, + atio_cdb_ptr(atio)[0], flags, dxfer_len, csio->sglist_cnt); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); @@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * { uint64_t lba; uint32_t num_blocks, nbc; - uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)? - atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes; + uint8_t *cmdbyt = atio_cdb_ptr(atio); nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */ @@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, uni __func__, atio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len); #ifdef CTLFEDEBUG printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__, @@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, uni printf("%s: tag %04x no status or " "len cdb = %02x\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0]); + atio_cdb_ptr(atio)[0]); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); Modified: stable/10/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/scsi/scsi_all.c Thu Jan 26 21:07:46 2017 (r312845) @@ -3616,15 +3616,9 @@ scsi_command_string(struct cam_device *d #endif /* _KERNEL/!_KERNEL */ - if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_ptr, sb); - } else { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_bytes, sb); - } + sbuf_printf(sb, "%s. CDB: ", + scsi_op_desc(scsiio_cdb_ptr(csio)[0], inq_data)); + scsi_cdb_sbuf(scsiio_cdb_ptr(csio), sb); #ifdef _KERNEL xpt_free_ccb((union ccb *)cgd); @@ -5029,7 +5023,6 @@ scsi_sense_sbuf(struct cam_device *devic struct ccb_getdev *cgd; #endif /* _KERNEL */ char path_str[64]; - uint8_t *cdb; #ifndef _KERNEL if (device == NULL) @@ -5127,14 +5120,9 @@ scsi_sense_sbuf(struct cam_device *devic sense = &csio->sense_data; } - if (csio->ccb_h.flags & CAM_CDB_POINTER) - cdb = csio->cdb_io.cdb_ptr; - else - cdb = csio->cdb_io.cdb_bytes; - scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb, - path_str, inq_data, cdb, csio->cdb_len); - + path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len); + #ifdef _KERNEL xpt_free_ccb((union ccb*)cgd); #endif /* _KERNEL/!_KERNEL */ From owner-svn-src-stable@freebsd.org Thu Jan 26 21:08:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E8B5CC1CC8; Thu, 26 Jan 2017 21:08:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF4BA86C; Thu, 26 Jan 2017 21:08:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL8Raw006927; Thu, 26 Jan 2017 21:08:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL8RAE006925; Thu, 26 Jan 2017 21:08:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262108.v0QL8RAE006925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312846 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:08:29 -0000 Author: mav Date: Thu Jan 26 21:08:27 2017 New Revision: 312846 URL: https://svnweb.freebsd.org/changeset/base/312846 Log: MFC r312231: When in kernel, map ctl_scsi_zero_io() to ctl_zero_io(). Modified: stable/11/sys/cam/ctl/ctl_util.c stable/11/sys/cam/ctl/ctl_util.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_util.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_util.c Thu Jan 26 21:07:46 2017 (r312845) +++ stable/11/sys/cam/ctl/ctl_util.c Thu Jan 26 21:08:27 2017 (r312846) @@ -697,7 +697,6 @@ ctl_scsi_free_io(union ctl_io *io) free(io); } -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io) { @@ -707,11 +706,10 @@ ctl_scsi_zero_io(union ctl_io *io) return; pool_ref = io->io_hdr.pool; - memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; } +#endif /* !_KERNEL */ const char * ctl_scsi_task_string(struct ctl_taskio *taskio) Modified: stable/11/sys/cam/ctl/ctl_util.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_util.h Thu Jan 26 21:07:46 2017 (r312845) +++ stable/11/sys/cam/ctl/ctl_util.h Thu Jan 26 21:08:27 2017 (r312846) @@ -96,8 +96,10 @@ void ctl_scsi_maintenance_in(union ctl_i #ifndef _KERNEL union ctl_io *ctl_scsi_alloc_io(uint32_t initid); void ctl_scsi_free_io(union ctl_io *io); -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io); +#else +#define ctl_scsi_zero_io(io) ctl_zero_io(io) +#endif /* !_KERNEL */ const char *ctl_scsi_task_string(struct ctl_taskio *taskio); void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb); void ctl_io_error_sbuf(union ctl_io *io, From owner-svn-src-stable@freebsd.org Thu Jan 26 21:08:59 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9410CC1D4C; Thu, 26 Jan 2017 21:08:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A34819AF; Thu, 26 Jan 2017 21:08:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL8wn7007001; Thu, 26 Jan 2017 21:08:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL8wFt006999; Thu, 26 Jan 2017 21:08:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262108.v0QL8wFt006999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:08:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312847 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:09:00 -0000 Author: mav Date: Thu Jan 26 21:08:58 2017 New Revision: 312847 URL: https://svnweb.freebsd.org/changeset/base/312847 Log: MFC r312231: When in kernel, map ctl_scsi_zero_io() to ctl_zero_io(). Modified: stable/10/sys/cam/ctl/ctl_util.c stable/10/sys/cam/ctl/ctl_util.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_util.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_util.c Thu Jan 26 21:08:27 2017 (r312846) +++ stable/10/sys/cam/ctl/ctl_util.c Thu Jan 26 21:08:58 2017 (r312847) @@ -697,7 +697,6 @@ ctl_scsi_free_io(union ctl_io *io) free(io); } -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io) { @@ -707,11 +706,10 @@ ctl_scsi_zero_io(union ctl_io *io) return; pool_ref = io->io_hdr.pool; - memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; } +#endif /* !_KERNEL */ const char * ctl_scsi_task_string(struct ctl_taskio *taskio) Modified: stable/10/sys/cam/ctl/ctl_util.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_util.h Thu Jan 26 21:08:27 2017 (r312846) +++ stable/10/sys/cam/ctl/ctl_util.h Thu Jan 26 21:08:58 2017 (r312847) @@ -96,8 +96,10 @@ void ctl_scsi_maintenance_in(union ctl_i #ifndef _KERNEL union ctl_io *ctl_scsi_alloc_io(uint32_t initid); void ctl_scsi_free_io(union ctl_io *io); -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io); +#else +#define ctl_scsi_zero_io(io) ctl_zero_io(io) +#endif /* !_KERNEL */ const char *ctl_scsi_task_string(struct ctl_taskio *taskio); void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb); void ctl_io_error_sbuf(union ctl_io *io, From owner-svn-src-stable@freebsd.org Thu Jan 26 21:21:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8D60CC22C5; Thu, 26 Jan 2017 21:21:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A708E7A; Thu, 26 Jan 2017 21:21:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QLLQWQ014141; Thu, 26 Jan 2017 21:21:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QLLQh8014139; Thu, 26 Jan 2017 21:21:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262121.v0QLLQh8014139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312848 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:21:28 -0000 Author: mav Date: Thu Jan 26 21:21:26 2017 New Revision: 312848 URL: https://svnweb.freebsd.org/changeset/base/312848 Log: MFC r312232: Add under-/overrun support to IOCTL and CAM SIM frontends. Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:08:58 2017 (r312847) +++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:21:26 2017 (r312848) @@ -304,10 +304,6 @@ cfcs_datamove(union ctl_io *io) int ctl_watermark, cam_watermark; int i, j; - - cam_sg_offset = 0; - cam_sg_start = 0; - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; /* @@ -330,6 +326,8 @@ cfcs_datamove(union ctl_io *io) cam_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr; cam_sg_count = ccb->csio.sglist_cnt; + cam_sg_start = cam_sg_count; + cam_sg_offset = 0; for (i = 0, len_seen = 0; i < cam_sg_count; i++) { if ((len_seen + cam_sglist[i].ds_len) >= @@ -422,9 +420,20 @@ cfcs_datamove(union ctl_io *io) io->scsiio.ext_data_filled += len_copied; + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < ctl_sg_count) { + io->io_hdr.port_status = 43; + } else + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL; io->io_hdr.flags |= CTL_FLAG_STATUS_SENT; + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(ccb); @@ -453,6 +462,10 @@ cfcs_done(union ctl_io *io) /* * Translate CTL status to CAM status. */ + if (ccb->ccb_h.func_code == XPT_SCSI_IO) { + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; + } ccb->ccb_h.status &= ~CAM_STATUS_MASK; switch (io->io_hdr.status & CTL_STATUS_MASK) { case CTL_SUCCESS: Modified: stable/11/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:08:58 2017 (r312847) +++ stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:21:26 2017 (r312848) @@ -143,16 +143,13 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int ext_sglist_malloced; int i, j; - ext_sglist_malloced = 0; - ext_sg_start = 0; - ext_offset = 0; - CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove\n")); /* * If this flag is set, fake the data transfer. */ if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) { + ext_sglist_malloced = 0; ctsio->ext_data_filled = ctsio->ext_data_len; goto bailout; } @@ -165,7 +162,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int len_seen; ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist); - ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); ext_sglist_malloced = 1; @@ -174,6 +170,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio goto bailout; } ext_sg_entries = ctsio->ext_sg_entries; + ext_sg_start = ext_sg_entries; + ext_offset = 0; len_seen = 0; for (i = 0; i < ext_sg_entries; i++) { if ((len_seen + ext_sglist[i].len) >= @@ -186,6 +184,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio } } else { ext_sglist = &ext_entry; + ext_sglist_malloced = 0; ext_sglist->addr = ctsio->ext_data_ptr; ext_sglist->len = ctsio->ext_data_len; ext_sg_entries = 1; @@ -203,7 +202,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio kern_sg_entries = 1; } - kern_watermark = 0; ext_watermark = ext_offset; len_copied = 0; @@ -274,10 +272,16 @@ ctl_ioctl_do_datamove(struct ctl_scsiio "kern_data_len = %d\n", ctsio->ext_data_len, ctsio->kern_data_len)); + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < kern_sg_entries) { + ctsio->io_hdr.port_status = 43; + } - /* XXX KDM set residual?? */ bailout: - if (ext_sglist_malloced != 0) free(ext_sglist, M_CTL); @@ -397,7 +401,7 @@ ctl_ioctl_io(struct cdev *dev, u_long cm struct thread *td) { union ctl_io *io; - void *pool_tmp; + void *pool_tmp, *sc_tmp; int retval = 0; /* @@ -414,8 +418,10 @@ ctl_ioctl_io(struct cdev *dev, u_long cm * spammed by the user's ctl_io. */ pool_tmp = io->io_hdr.pool; + sc_tmp = CTL_SOFTC(io); memcpy(io, (void *)addr, sizeof(*io)); io->io_hdr.pool = pool_tmp; + CTL_SOFTC(io) = sc_tmp; /* * No status yet, so make sure the status is set properly. From owner-svn-src-stable@freebsd.org Thu Jan 26 21:22:01 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E26ECC235E; Thu, 26 Jan 2017 21:22:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DBBC303; Thu, 26 Jan 2017 21:22:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QLM0mQ014899; Thu, 26 Jan 2017 21:22:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QLLxB4014875; Thu, 26 Jan 2017 21:21:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262121.v0QLLxB4014875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312849 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:22:01 -0000 Author: mav Date: Thu Jan 26 21:21:59 2017 New Revision: 312849 URL: https://svnweb.freebsd.org/changeset/base/312849 Log: MFC r312232: Add under-/overrun support to IOCTL and CAM SIM frontends. Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c stable/10/sys/cam/ctl/ctl_frontend_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:21:26 2017 (r312848) +++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:21:59 2017 (r312849) @@ -304,10 +304,6 @@ cfcs_datamove(union ctl_io *io) int ctl_watermark, cam_watermark; int i, j; - - cam_sg_offset = 0; - cam_sg_start = 0; - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; /* @@ -330,6 +326,8 @@ cfcs_datamove(union ctl_io *io) cam_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr; cam_sg_count = ccb->csio.sglist_cnt; + cam_sg_start = cam_sg_count; + cam_sg_offset = 0; for (i = 0, len_seen = 0; i < cam_sg_count; i++) { if ((len_seen + cam_sglist[i].ds_len) >= @@ -422,9 +420,20 @@ cfcs_datamove(union ctl_io *io) io->scsiio.ext_data_filled += len_copied; + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < ctl_sg_count) { + io->io_hdr.port_status = 43; + } else + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL; io->io_hdr.flags |= CTL_FLAG_STATUS_SENT; + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(ccb); @@ -453,6 +462,10 @@ cfcs_done(union ctl_io *io) /* * Translate CTL status to CAM status. */ + if (ccb->ccb_h.func_code == XPT_SCSI_IO) { + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; + } ccb->ccb_h.status &= ~CAM_STATUS_MASK; switch (io->io_hdr.status & CTL_STATUS_MASK) { case CTL_SUCCESS: Modified: stable/10/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:21:26 2017 (r312848) +++ stable/10/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:21:59 2017 (r312849) @@ -143,16 +143,13 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int ext_sglist_malloced; int i, j; - ext_sglist_malloced = 0; - ext_sg_start = 0; - ext_offset = 0; - CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove\n")); /* * If this flag is set, fake the data transfer. */ if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) { + ext_sglist_malloced = 0; ctsio->ext_data_filled = ctsio->ext_data_len; goto bailout; } @@ -165,7 +162,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int len_seen; ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist); - ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); ext_sglist_malloced = 1; @@ -174,6 +170,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio goto bailout; } ext_sg_entries = ctsio->ext_sg_entries; + ext_sg_start = ext_sg_entries; + ext_offset = 0; len_seen = 0; for (i = 0; i < ext_sg_entries; i++) { if ((len_seen + ext_sglist[i].len) >= @@ -186,6 +184,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio } } else { ext_sglist = &ext_entry; + ext_sglist_malloced = 0; ext_sglist->addr = ctsio->ext_data_ptr; ext_sglist->len = ctsio->ext_data_len; ext_sg_entries = 1; @@ -203,7 +202,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio kern_sg_entries = 1; } - kern_watermark = 0; ext_watermark = ext_offset; len_copied = 0; @@ -274,10 +272,16 @@ ctl_ioctl_do_datamove(struct ctl_scsiio "kern_data_len = %d\n", ctsio->ext_data_len, ctsio->kern_data_len)); + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < kern_sg_entries) { + ctsio->io_hdr.port_status = 43; + } - /* XXX KDM set residual?? */ bailout: - if (ext_sglist_malloced != 0) free(ext_sglist, M_CTL); @@ -397,7 +401,7 @@ ctl_ioctl_io(struct cdev *dev, u_long cm struct thread *td) { union ctl_io *io; - void *pool_tmp; + void *pool_tmp, *sc_tmp; int retval = 0; /* @@ -414,8 +418,10 @@ ctl_ioctl_io(struct cdev *dev, u_long cm * spammed by the user's ctl_io. */ pool_tmp = io->io_hdr.pool; + sc_tmp = CTL_SOFTC(io); memcpy(io, (void *)addr, sizeof(*io)); io->io_hdr.pool = pool_tmp; + CTL_SOFTC(io) = sc_tmp; /* * No status yet, so make sure the status is set properly. From owner-svn-src-stable@freebsd.org Thu Jan 26 21:36:00 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 507D0CC27F2; Thu, 26 Jan 2017 21:36:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E358DE2; Thu, 26 Jan 2017 21:35:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QLZxJ2019148; Thu, 26 Jan 2017 21:35:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QLZw4J019142; Thu, 26 Jan 2017 21:35:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262135.v0QLZw4J019142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312850 - in stable/10/sys: cam dev/arcmsr dev/iir dev/isci dev/ppbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 21:36:00 -0000 Author: mav Date: Thu Jan 26 21:35:58 2017 New Revision: 312850 URL: https://svnweb.freebsd.org/changeset/base/312850 Log: MFC r296891 (by imp): Make sure we check for CAM_CDB_POINTER for all drivers. Also, for the drivers I've touched, filter out CAM_CDB_PHYS. Differential Revision: https://reviews.freebsd.org/D5585 Modified: stable/10/sys/cam/cam_ccb.h stable/10/sys/dev/arcmsr/arcmsr.c stable/10/sys/dev/iir/iir.c stable/10/sys/dev/isci/isci_controller.c stable/10/sys/dev/isci/isci_io_request.c stable/10/sys/dev/ppbus/vpo.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_ccb.h ============================================================================== --- stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:35:58 2017 (r312850) @@ -727,6 +727,13 @@ struct ccb_scsiio { u_int init_id; /* initiator id of who selected */ }; +static __inline uint8_t * +scsiio_cdb_ptr(struct ccb_scsiio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* * ATA I/O Request CCB used for the XPT_ATA_IO function code. */ Modified: stable/10/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/10/sys/dev/arcmsr/arcmsr.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/arcmsr/arcmsr.c Thu Jan 26 21:35:58 2017 (r312850) @@ -872,7 +872,7 @@ static void arcmsr_srb_timeout(void *arg ARCMSR_LOCK_ACQUIRE(&acb->isr_lock); if(srb->srb_state == ARCMSR_SRB_START) { - cmd = srb->pccb->csio.cdb_io.cdb_bytes[0]; + cmd = scsiio_cdb_ptr(&srb->pccb->csio)[0]; srb->srb_state = ARCMSR_SRB_TIMEOUT; srb->pccb->ccb_h.status |= CAM_CMD_TIMEOUT; arcmsr_srb_complete(srb, 1); @@ -997,7 +997,7 @@ static void arcmsr_build_srb(struct Comm arcmsr_cdb->LUN = pccb->ccb_h.target_lun; arcmsr_cdb->Function = 1; arcmsr_cdb->CdbLength = (u_int8_t)pcsio->cdb_len; - bcopy(pcsio->cdb_io.cdb_bytes, arcmsr_cdb->Cdb, pcsio->cdb_len); + bcopy(scsiio_cdb_ptr(pcsio), arcmsr_cdb->Cdb, pcsio->cdb_len); if(nseg != 0) { struct AdapterControlBlock *acb = srb->acb; bus_dmasync_op_t op; @@ -2453,10 +2453,11 @@ static int arcmsr_iop_message_xfer(struc struct CMD_MESSAGE_FIELD *pcmdmessagefld; int retvalue = 0, transfer_len = 0; char *buffer; - u_int32_t controlcode = (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[5] << 24 | - (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[6] << 16 | - (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[7] << 8 | - (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[8]; + uint8_t *ptr = scsiio_cdb_ptr(&pccb->csio); + u_int32_t controlcode = (u_int32_t ) ptr[5] << 24 | + (u_int32_t ) ptr[6] << 16 | + (u_int32_t ) ptr[7] << 8 | + (u_int32_t ) ptr[8]; /* 4 bytes: Areca io control code */ if ((pccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) { buffer = pccb->csio.data_ptr; @@ -2683,7 +2684,7 @@ static void arcmsr_execute_srb(void *arg if(acb->devstate[target][lun] == ARECA_RAID_GONE) { u_int8_t block_cmd, cmd; - cmd = pccb->csio.cdb_io.cdb_bytes[0]; + cmd = scsiio_cdb_ptr(&pccb->csio)[0]; block_cmd = cmd & 0x0f; if(block_cmd == 0x08 || block_cmd == 0x0a) { printf("arcmsr%d:block 'read/write' command " @@ -2800,7 +2801,7 @@ static void arcmsr_handle_virtual_comman return; } pccb->ccb_h.status |= CAM_REQ_CMP; - switch (pccb->csio.cdb_io.cdb_bytes[0]) { + switch (scsiio_cdb_ptr(&pccb->csio)[0]) { case INQUIRY: { unsigned char inqdata[36]; char *buffer = pccb->csio.data_ptr; @@ -2853,6 +2854,12 @@ static void arcmsr_action(struct cam_sim int target = pccb->ccb_h.target_id; int error; + if (pccb->ccb_h.flags & CAM_CDB_PHYS) { + pccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(pccb); + return; + } + if(target == 16) { /* virtual device for iop message transfer */ arcmsr_handle_virtual_command(acb, pccb); Modified: stable/10/sys/dev/iir/iir.c ============================================================================== --- stable/10/sys/dev/iir/iir.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/iir/iir.c Thu Jan 26 21:35:58 2017 (r312850) @@ -744,9 +744,9 @@ gdt_next(struct gdt_softc *gdt) ccb->ccb_h.flags)); csio = &ccb->csio; ccbh = &ccb->ccb_h; - cmd = csio->cdb_io.cdb_bytes[0]; - /* Max CDB length is 12 bytes */ - if (csio->cdb_len > 12) { + cmd = scsiio_cdb_ptr(csio)[0]; + /* Max CDB length is 12 bytes, can't be phys addr */ + if (csio->cdb_len > 12 || (ccbh->flags & CAM_CDB_PHYS)) { ccbh->status = CAM_REQ_INVALID; --gdt_stat.io_count_act; xpt_done(ccb); Modified: stable/10/sys/dev/isci/isci_controller.c ============================================================================== --- stable/10/sys/dev/isci/isci_controller.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/isci/isci_controller.c Thu Jan 26 21:35:58 2017 (r312850) @@ -740,6 +740,11 @@ void isci_action(struct cam_sim *sim, un } break; case XPT_SCSI_IO: + if (ccb->ccb_h.flags & CAM_CDB_PHYS) { + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + break; + } isci_io_request_execute_scsi_io(ccb, controller); break; #if __FreeBSD_version >= 900026 @@ -802,6 +807,7 @@ isci_controller_release_queued_ccbs(stru { struct ISCI_REMOTE_DEVICE *dev; struct ccb_hdr *ccb_h; + uint8_t *ptr; int dev_idx; KASSERT(mtx_owned(&controller->lock), ("controller lock not owned")); @@ -821,8 +827,8 @@ isci_controller_release_queued_ccbs(stru if (ccb_h == NULL) continue; - isci_log_message(1, "ISCI", "release %p %x\n", ccb_h, - ((union ccb *)ccb_h)->csio.cdb_io.cdb_bytes[0]); + ptr = scsiio_cdb_ptr(&((union ccb *)ccb_h)->csio); + isci_log_message(1, "ISCI", "release %p %x\n", ccb_h, *ptr); dev->queued_ccb_in_progress = (union ccb *)ccb_h; isci_io_request_execute_scsi_io( Modified: stable/10/sys/dev/isci/isci_io_request.c ============================================================================== --- stable/10/sys/dev/isci/isci_io_request.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/isci/isci_io_request.c Thu Jan 26 21:35:58 2017 (r312850) @@ -86,6 +86,7 @@ isci_io_request_complete(SCI_CONTROLLER_ struct ISCI_REMOTE_DEVICE *isci_remote_device; union ccb *ccb; BOOL complete_ccb; + struct ccb_scsiio *csio; complete_ccb = TRUE; isci_controller = (struct ISCI_CONTROLLER *) sci_object_get_association(scif_controller); @@ -93,7 +94,7 @@ isci_io_request_complete(SCI_CONTROLLER_ (struct ISCI_REMOTE_DEVICE *) sci_object_get_association(remote_device); ccb = isci_request->ccb; - + csio = &ccb->csio; ccb->ccb_h.status &= ~CAM_STATUS_MASK; switch (completion_status) { @@ -124,7 +125,6 @@ isci_io_request_complete(SCI_CONTROLLER_ SCI_SSP_RESPONSE_IU_T * response_buffer; uint32_t sense_length; int error_code, sense_key, asc, ascq; - struct ccb_scsiio *csio = &ccb->csio; response_buffer = (SCI_SSP_RESPONSE_IU_T *) scif_io_request_get_response_iu_address( @@ -146,7 +146,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(1, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x status=%x key=%x asc=%x ascq=%x\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, csio->cdb_io.cdb_bytes[0], + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio), csio->scsi_status, sense_key, asc, ascq); break; } @@ -157,7 +157,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(0, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x remote device reset required\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0]); + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio)); break; case SCI_IO_FAILURE_TERMINATED: @@ -165,7 +165,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(0, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x terminated\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0]); + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio)); break; case SCI_IO_FAILURE_INVALID_STATE: @@ -208,7 +208,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(1, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x completion status=%x\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0], + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio), completion_status); ccb->ccb_h.status |= CAM_REQ_CMP_ERR; break; @@ -285,13 +285,13 @@ isci_io_request_complete(SCI_CONTROLLER_ * get a ready notification for this device. */ isci_log_message(1, "ISCI", "already queued %p %x\n", - ccb, ccb->csio.cdb_io.cdb_bytes[0]); + ccb, scsiio_cdb_ptr(csio)); isci_remote_device->queued_ccb_in_progress = NULL; } else { isci_log_message(1, "ISCI", "queue %p %x\n", ccb, - ccb->csio.cdb_io.cdb_bytes[0]); + scsiio_cdb_ptr(csio)); ccb->ccb_h.status |= CAM_SIM_QUEUED; TAILQ_INSERT_TAIL(&isci_remote_device->queued_ccbs, @@ -373,7 +373,7 @@ scif_cb_io_request_get_cdb_address(void struct ISCI_IO_REQUEST *isci_request = (struct ISCI_IO_REQUEST *)scif_user_io_request; - return (isci_request->ccb->csio.cdb_io.cdb_bytes); + return (scsiio_cdb_ptr(&isci_request->ccb->csio)); } /** Modified: stable/10/sys/dev/ppbus/vpo.c ============================================================================== --- stable/10/sys/dev/ppbus/vpo.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/ppbus/vpo.c Thu Jan 26 21:35:58 2017 (r312850) @@ -187,17 +187,19 @@ vpo_intr(struct vpo_data *vpo, struct cc #ifdef VP0_DEBUG int i; #endif + uint8_t *ptr; + ptr = scsiio_cdb_ptr(csio); if (vpo->vpo_isplus) { errno = imm_do_scsi(&vpo->vpo_io, VP0_INITIATOR, csio->ccb_h.target_id, - (char *)&csio->cdb_io.cdb_bytes, csio->cdb_len, + ptr, csio->cdb_len, (char *)csio->data_ptr, csio->dxfer_len, &vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error); } else { errno = vpoio_do_scsi(&vpo->vpo_io, VP0_INITIATOR, csio->ccb_h.target_id, - (char *)&csio->cdb_io.cdb_bytes, csio->cdb_len, + ptr, csio->cdb_len, (char *)csio->data_ptr, csio->dxfer_len, &vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error); } @@ -208,7 +210,7 @@ vpo_intr(struct vpo_data *vpo, struct cc /* dump of command */ for (i=0; icdb_len; i++) - printf("%x ", ((char *)&csio->cdb_io.cdb_bytes)[i]); + printf("%x ", ((char *)ptr)[i]); printf("\n"); #endif @@ -307,11 +309,15 @@ vpo_action(struct cam_sim *sim, union cc csio = &ccb->csio; + if (ccb->ccb_h.flags & CAM_CDB_PHYS) { + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + break; + } #ifdef VP0_DEBUG device_printf(vpo->vpo_dev, "XPT_SCSI_IO (0x%x) request\n", - csio->cdb_io.cdb_bytes[0]); + scsiio_cdb_ptr(csio)); #endif - vpo_intr(vpo, csio); xpt_done(ccb); From owner-svn-src-stable@freebsd.org Thu Jan 26 23:29:32 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47147CC39E8; Thu, 26 Jan 2017 23:29:32 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12972812; Thu, 26 Jan 2017 23:29:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QNTVcP062808; Thu, 26 Jan 2017 23:29:31 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QNTUR9062799; Thu, 26 Jan 2017 23:29:30 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701262329.v0QNTUR9062799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 23:29:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312851 - stable/10/secure/lib/libcrypto X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 23:29:32 -0000 Author: jkim Date: Thu Jan 26 23:29:30 2017 New Revision: 312851 URL: https://svnweb.freebsd.org/changeset/base/312851 Log: Disable assembly sources when compiler/assembler cannot compile certain instructions. Note this is a direct commit because head and stable/11 has OpenSSL 1.0.2 branch. However, it is based on r304320. Requested by: julian Added: stable/10/secure/lib/libcrypto/opensslconf-arm.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-arm.h stable/10/secure/lib/libcrypto/opensslconf-ia64.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-ia64.h stable/10/secure/lib/libcrypto/opensslconf-mips.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-mips.h stable/10/secure/lib/libcrypto/opensslconf-powerpc.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-powerpc.h stable/10/secure/lib/libcrypto/opensslconf-sparc64.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-sparc64.h stable/10/secure/lib/libcrypto/opensslconf-x86.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-x86.h Deleted: stable/10/secure/lib/libcrypto/opensslconf-arm.h stable/10/secure/lib/libcrypto/opensslconf-ia64.h stable/10/secure/lib/libcrypto/opensslconf-mips.h stable/10/secure/lib/libcrypto/opensslconf-powerpc.h stable/10/secure/lib/libcrypto/opensslconf-sparc64.h stable/10/secure/lib/libcrypto/opensslconf-x86.h Modified: stable/10/secure/lib/libcrypto/Makefile stable/10/secure/lib/libcrypto/Makefile.asm stable/10/secure/lib/libcrypto/Makefile.inc Modified: stable/10/secure/lib/libcrypto/Makefile ============================================================================== --- stable/10/secure/lib/libcrypto/Makefile Thu Jan 26 21:35:58 2017 (r312850) +++ stable/10/secure/lib/libcrypto/Makefile Thu Jan 26 23:29:30 2017 (r312851) @@ -22,9 +22,9 @@ MAN+= config.5 des_modes.7 # base sources SRCS= cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \ o_fips.c o_init.c o_str.c o_time.c uid.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= x86_64cpuid.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= x86cpuid.S .else SRCS+= mem_clr.c @@ -33,10 +33,10 @@ INCS+= crypto.h ebcdic.h opensslv.h ossl # aes SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= aes-x86_64.S aesni-sha1-x86_64.S aesni-x86_64.S bsaes-x86_64.S \ vpaes-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= aes-586.S aesni-x86.S vpaes-x86.S .else SRCS+= aes_cbc.c aes_core.c @@ -60,7 +60,7 @@ INCS+= asn1.h asn1_mac.h asn1t.h # bf SRCS+= bf_cfb64.c bf_ecb.c bf_ofb64.c bf_skey.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) .if ${MACHINE_CPU:Mi686} SRCS+= bf-686.S .else @@ -82,10 +82,10 @@ SRCS+= bn_add.c bn_blind.c bn_const.c bn bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_kron.c bn_lib.c bn_mod.c \ bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c bn_print.c bn_rand.c \ bn_recp.c bn_shift.c bn_sqr.c bn_sqrt.c bn_word.c bn_x931p.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= modexp512-x86_64.S x86_64-gcc.c x86_64-gf2m.S x86_64-mont.S \ x86_64-mont5.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= bn-586.S co-586.S x86-gf2m.S x86-mont.S .else SRCS+= bn_asm.c @@ -98,9 +98,9 @@ INCS+= buffer.h # camellia SRCS+= cmll_cfb.c cmll_ctr.c cmll_ecb.c cmll_ofb.c cmll_utl.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= cmll_misc.c cmll-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= cmll-x86.S .else SRCS+= camellia.c cmll_cbc.c cmll_misc.c @@ -134,7 +134,7 @@ SRCS+= cbc_cksm.c cbc_enc.c cfb64ede.c c des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c enc_read.c enc_writ.c \ fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c \ rand_key.c read2pwd.c rpc_enc.c set_key.c str2key.c xcbc_enc.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) SRCS+= crypt586.S des-586.S .else SRCS+= des_enc.c fcrypt_b.c @@ -215,9 +215,9 @@ INCS+= md4.h # md5 SRCS+= md5_dgst.c md5_one.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= md5-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= md5-586.S .endif INCS+= md5.h @@ -228,9 +228,9 @@ INCS+= mdc2.h # modes SRCS+= cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c xts128.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= ghash-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= ghash-x86.S .endif INCS+= modes.h @@ -274,9 +274,9 @@ INCS+= rc2.h # rc4 SRCS+= rc4_utl.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= rc4-md5-x86_64.S rc4-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= rc4-586.S .else SRCS+= rc4_enc.c rc4_skey.c @@ -285,7 +285,7 @@ INCS+= rc4.h # rc5 SRCS+= rc5_ecb.c rc5_skey.c rc5cfb64.c rc5ofb64.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) SRCS+= rc5-586.S .else SRCS+= rc5_enc.c @@ -294,7 +294,7 @@ INCS+= rc5.h # ripemd SRCS+= rmd_dgst.c rmd_one.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) SRCS+= rmd-586.S .endif INCS+= ripemd.h @@ -312,9 +312,9 @@ INCS+= seed.h # sha SRCS+= sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= sha1-x86_64.S sha256-x86_64.S sha512-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= sha1-586.S sha256-586.S sha512-586.S .endif INCS+= sha.h @@ -343,9 +343,9 @@ INCS+= ui.h ui_compat.h # whrlpool SRCS+= wp_dgst.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= wp-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= wp-mmx.S wp_block.c .else SRCS+= wp_block.c @@ -382,7 +382,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/crypto/modes ACFLAGS+= -Wa,--noexecstack .endif -CLEANFILES= buildinf.h opensslconf.h +CLEANFILES= buildinf.h opensslconf.h opensslconf.h.tmp buildinf.h: ${.CURDIR}/Makefile ( echo "#ifndef MK1MF_BUILD"; \ @@ -391,23 +391,21 @@ buildinf.h: ${.CURDIR}/Makefile echo " #define PLATFORM \"platform: FreeBSD-${MACHINE_ARCH}\""; \ echo "#endif" ) > ${.TARGET} -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" -opensslconf.h: opensslconf-x86.h +opensslconf.h: opensslconf-${MACHINE_CPUARCH:C/^(amd64|i386)$/x86/}.h.in +.if defined(ASM_${MACHINE_CPUARCH}) + sed 's/%%ASM%%//; /%%NO_ASM%%/d' ${.ALLSRC} > ${.TARGET}.tmp .else -opensslconf.h: opensslconf-${MACHINE_CPUARCH}.h + sed '/%%ASM%%/d; s/%%NO_ASM%%//' ${.ALLSRC} > ${.TARGET}.tmp .endif - cp -f ${.ALLSRC} ${.TARGET} + cp -f ${.TARGET}.tmp ${.TARGET} .include -.if ${MACHINE_CPUARCH} == "amd64" -.PATH: ${.CURDIR}/amd64 -.elif ${MACHINE_CPUARCH} == "i386" -.PATH: ${.CURDIR}/i386 +.if defined(ASM_${MACHINE_CPUARCH}) +.PATH: ${.CURDIR}/${MACHINE_CPUARCH} +.if defined(ASM_amd64) +.PATH: ${LCRYPTO_SRC}/crypto/bn/asm .endif - -.if ${MACHINE_CPUARCH} == "amd64" -_bn_asmpath= ${LCRYPTO_SRC}/crypto/bn/asm .endif .PATH: ${LCRYPTO_SRC}/crypto \ @@ -416,7 +414,6 @@ _bn_asmpath= ${LCRYPTO_SRC}/crypto/bn/as ${LCRYPTO_SRC}/crypto/bf \ ${LCRYPTO_SRC}/crypto/bio \ ${LCRYPTO_SRC}/crypto/bn \ - ${_bn_asmpath} \ ${LCRYPTO_SRC}/crypto/buffer \ ${LCRYPTO_SRC}/crypto/camellia \ ${LCRYPTO_SRC}/crypto/cast \ Modified: stable/10/secure/lib/libcrypto/Makefile.asm ============================================================================== --- stable/10/secure/lib/libcrypto/Makefile.asm Thu Jan 26 21:35:58 2017 (r312850) +++ stable/10/secure/lib/libcrypto/Makefile.asm Thu Jan 26 23:29:30 2017 (r312851) @@ -6,7 +6,7 @@ .include "Makefile.inc" -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) .PATH: ${LCRYPTO_SRC}/crypto \ ${LCRYPTO_SRC}/crypto/aes/asm \ @@ -73,7 +73,7 @@ ${s}.S: ${s}.s cat ${s}.s ) > ${.TARGET} .endfor -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) .PATH: ${LCRYPTO_SRC}/crypto \ ${LCRYPTO_SRC}/crypto/aes/asm \ Modified: stable/10/secure/lib/libcrypto/Makefile.inc ============================================================================== --- stable/10/secure/lib/libcrypto/Makefile.inc Thu Jan 26 21:35:58 2017 (r312850) +++ stable/10/secure/lib/libcrypto/Makefile.inc Thu Jan 26 23:29:30 2017 (r312851) @@ -21,7 +21,17 @@ CFLAGS+=-DL_ENDIAN CFLAGS+=-DB_ENDIAN .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +_ASM_AVX!= { \ + echo vzeroall | \ + ${CC} -x assembler -o /dev/null -c - 2> /dev/null; \ + } && echo yes || echo no +.if ${_ASM_AVX} == yes +ASM_${MACHINE_CPUARCH}= +.endif +.endif + +.if defined(ASM_amd64) CFLAGS+=-DOPENSSL_IA32_SSE2 CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m @@ -29,7 +39,7 @@ CFLAGS+=-DMD5_ASM CFLAGS+=-DGHASH_ASM CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM CFLAGS+=-DWHIRLPOOL_ASM -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) CFLAGS+=-DOPENSSL_IA32_SSE2 CFLAGS+=-DAES_ASM -DVPAES_ASM CFLAGS+=-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-arm.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-arm.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-arm.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-arm.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -83,6 +83,8 @@ extern "C" { # endif #endif +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-ia64.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-ia64.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-ia64.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-ia64.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -36,9 +36,9 @@ #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-mips.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-mips.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-mips.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-mips.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-powerpc.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-powerpc.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-powerpc.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-powerpc.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -83,6 +83,8 @@ extern "C" { # endif #endif +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-sparc64.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-sparc64.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-sparc64.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-sparc64.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -83,6 +83,8 @@ extern "C" { # endif #endif +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-x86.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-x86.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-x86.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-x86.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,6 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -80,8 +83,8 @@ extern "C" { # endif #endif -#define OPENSSL_CPUID_OBJ - +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ From owner-svn-src-stable@freebsd.org Fri Jan 27 02:35:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A6ACCC349B; Fri, 27 Jan 2017 02:35:06 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 564DB1356; Fri, 27 Jan 2017 02:35:06 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R2Z53g039298; Fri, 27 Jan 2017 02:35:05 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R2Z5LD039297; Fri, 27 Jan 2017 02:35:05 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201701270235.v0R2Z5LD039297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 27 Jan 2017 02:35:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312856 - stable/11/usr.bin/netstat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 02:35:06 -0000 Author: araujo Date: Fri Jan 27 02:35:05 2017 New Revision: 312856 URL: https://svnweb.freebsd.org/changeset/base/312856 Log: MFC r310698: Print hostcache usage counts with TCP statistics. PR: 196252 Submitted by: Anton Yuzhaninov MFC after: 3 weeks. Modified: stable/11/usr.bin/netstat/inet.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/inet.c ============================================================================== --- stable/11/usr.bin/netstat/inet.c Fri Jan 27 01:59:12 2017 (r312855) +++ stable/11/usr.bin/netstat/inet.c Fri Jan 27 02:35:05 2017 (r312856) @@ -750,6 +750,12 @@ tcp_stats(u_long off, const char *name, "{N:/ignored RSTs in the window%s}\n"); p(tcps_connects, "\t{:connections-established/%ju} " "{N:/connection%s established (including accepts)}\n"); + p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} " + "{N:/time%s used RTT from hostcache}\n"); + p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} " + "{N:/time%s used RTT variance from hostcache}\n"); + p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} " + "{N:/time%s used slow-start threshold from hostcache}\n"); p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} " "{N:/connection%s closed (including} " "{:connection-drops/%ju} {N:/drop%s})\n"); From owner-svn-src-stable@freebsd.org Fri Jan 27 03:44:51 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E362CC37A3; Fri, 27 Jan 2017 03:44:51 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AF2410F9; Fri, 27 Jan 2017 03:44:51 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R3iowN068514; Fri, 27 Jan 2017 03:44:50 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R3iosH068513; Fri, 27 Jan 2017 03:44:50 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201701270344.v0R3iosH068513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Fri, 27 Jan 2017 03:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312858 - stable/11/sys/dev/nand X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 03:44:51 -0000 Author: kan Date: Fri Jan 27 03:44:50 2017 New Revision: 312858 URL: https://svnweb.freebsd.org/changeset/base/312858 Log: MFC r311993: Fix typo in r311971 and now in r312405 too. Modified: stable/11/sys/dev/nand/nand_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nand/nand_geom.c ============================================================================== --- stable/11/sys/dev/nand/nand_geom.c Fri Jan 27 03:43:18 2017 (r312857) +++ stable/11/sys/dev/nand/nand_geom.c Fri Jan 27 03:44:50 2017 (r312858) @@ -416,7 +416,7 @@ create_geom_disk(struct nand_chip *chip) snprintf(rdisk->d_ident, sizeof(rdisk->d_ident), "nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id); - disk->d_rotation_rate = DISK_RR_NON_ROTATING; + rdisk->d_rotation_rate = DISK_RR_NON_ROTATING; disk_create(rdisk, DISK_VERSION); From owner-svn-src-stable@freebsd.org Fri Jan 27 04:52:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BFCFCC396D; Fri, 27 Jan 2017 04:52:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08AFA238; Fri, 27 Jan 2017 04:52:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R4qSkg096822; Fri, 27 Jan 2017 04:52:28 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R4qS2M096821; Fri, 27 Jan 2017 04:52:28 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701270452.v0R4qS2M096821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 27 Jan 2017 04:52:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312860 - stable/11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 04:52:29 -0000 Author: pfg Date: Fri Jan 27 04:52:27 2017 New Revision: 312860 URL: https://svnweb.freebsd.org/changeset/base/312860 Log: MFC r312538: Addition of clang nullability qualifiers. For consistency with the qualifiers added in r310977, define a new qualifier _Null_unspecified which is also defined in clang 3.7+. Add two new macros: __NULLABILITY_PRAGMA_PUSH __NULLABILITY_PRAGMA_POP These are for use in headers when we want avoid noisy warnings if some pointers are left without nullability annotations. These are added with way ahead of their first use to teach the GCC ports headers of their existance before their first use. Modified: stable/11/sys/sys/cdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/cdefs.h ============================================================================== --- stable/11/sys/sys/cdefs.h Fri Jan 27 04:08:24 2017 (r312859) +++ stable/11/sys/sys/cdefs.h Fri Jan 27 04:52:27 2017 (r312860) @@ -793,6 +793,13 @@ #if !(defined(__clang__) && __has_feature(nullability)) #define _Nonnull #define _Nullable +#define _Null_unspecified +#define __NULLABILITY_PRAGMA_PUSH +#define __NULLABILITY_PRAGMA_POP +#else +#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") +#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop") #endif /* From owner-svn-src-stable@freebsd.org Fri Jan 27 05:58:54 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0014CC379B; Fri, 27 Jan 2017 05:58:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75C6B1BC2; Fri, 27 Jan 2017 05:58:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R5wrWi020998; Fri, 27 Jan 2017 05:58:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R5wrLd020997; Fri, 27 Jan 2017 05:58:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701270558.v0R5wrLd020997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Jan 2017 05:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312861 - stable/11/sys/geom/multipath X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 05:58:54 -0000 Author: mav Date: Fri Jan 27 05:58:53 2017 New Revision: 312861 URL: https://svnweb.freebsd.org/changeset/base/312861 Log: MFC r312533: Report disk addition errors on `add` or `create` subcommand. Modified: stable/11/sys/geom/multipath/g_multipath.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/11/sys/geom/multipath/g_multipath.c Fri Jan 27 04:52:27 2017 (r312860) +++ stable/11/sys/geom/multipath/g_multipath.c Fri Jan 27 05:58:53 2017 (r312861) @@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req struct g_provider *pp; const char *mpname; static const char devpf[6] = "/dev/"; + int error; g_topology_assert(); @@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req return; } - /* - * Now add.... - */ - (void) g_multipath_add_disk(gp, pp); + error = g_multipath_add_disk(gp, pp); + if (error != 0) + gctl_error(req, "Provider addition error: %d", error); } static void From owner-svn-src-stable@freebsd.org Fri Jan 27 05:59:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 373E4CC3803; Fri, 27 Jan 2017 05:59:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03F901D14; Fri, 27 Jan 2017 05:59:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R5xRuN021081; Fri, 27 Jan 2017 05:59:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R5xRH9021080; Fri, 27 Jan 2017 05:59:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701270559.v0R5xRH9021080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Jan 2017 05:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312862 - stable/10/sys/geom/multipath X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 05:59:28 -0000 Author: mav Date: Fri Jan 27 05:59:26 2017 New Revision: 312862 URL: https://svnweb.freebsd.org/changeset/base/312862 Log: MFC r312533: Report disk addition errors on `add` or `create` subcommand. Modified: stable/10/sys/geom/multipath/g_multipath.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/10/sys/geom/multipath/g_multipath.c Fri Jan 27 05:58:53 2017 (r312861) +++ stable/10/sys/geom/multipath/g_multipath.c Fri Jan 27 05:59:26 2017 (r312862) @@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req struct g_provider *pp; const char *mpname; static const char devpf[6] = "/dev/"; + int error; g_topology_assert(); @@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req return; } - /* - * Now add.... - */ - (void) g_multipath_add_disk(gp, pp); + error = g_multipath_add_disk(gp, pp); + if (error != 0) + gctl_error(req, "Provider addition error: %d", error); } static void From owner-svn-src-stable@freebsd.org Fri Jan 27 07:45:07 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1202CC317C; Fri, 27 Jan 2017 07:45:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0144EA3; Fri, 27 Jan 2017 07:45:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R7j6jW065130; Fri, 27 Jan 2017 07:45:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R7j6Yk065129; Fri, 27 Jan 2017 07:45:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201701270745.v0R7j6Yk065129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 27 Jan 2017 07:45:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312863 - stable/10/crypto/openssl/crypto/evp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 07:45:08 -0000 Author: delphij Date: Fri Jan 27 07:45:06 2017 New Revision: 312863 URL: https://svnweb.freebsd.org/changeset/base/312863 Log: Backport OpenSSL commit 56336b6c7a75ed28067cadedd8ac46572348bc2f: crypto/evp: harden RC4_MD5 cipher. Originally a crash in 32-bit build was reported CHACHA20-POLY1305 cipher. The crash is triggered by truncated packet and is result of excessive hashing to the edge of accessible memory (or bogus MAC value is produced if x86 MD5 assembly module is involved). Since hash operation is read-only it is not considered to be exploitable beyond a DoS condition. Thanks to Robert Święcki for report. This is a direct commit to stable/10. Security: CVE-2017-3731 Modified: stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c Modified: stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c ============================================================================== --- stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c Fri Jan 27 05:59:26 2017 (r312862) +++ stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c Fri Jan 27 07:45:06 2017 (r312863) @@ -267,6 +267,8 @@ static int rc4_hmac_md5_ctrl(EVP_CIPHER_ len = p[arg - 2] << 8 | p[arg - 1]; if (!ctx->encrypt) { + if (len < MD5_DIGEST_LENGTH) + return -1; len -= MD5_DIGEST_LENGTH; p[arg - 2] = len >> 8; p[arg - 1] = len; From owner-svn-src-stable@freebsd.org Fri Jan 27 09:04:31 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03B52CC3845; Fri, 27 Jan 2017 09:04:31 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7197B19; Fri, 27 Jan 2017 09:04:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R94Tng098124; Fri, 27 Jan 2017 09:04:29 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R94TTT098123; Fri, 27 Jan 2017 09:04:29 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201701270904.v0R94TTT098123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 27 Jan 2017 09:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312869 - stable/10/share/zoneinfo X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 09:04:31 -0000 Author: julian Date: Fri Jan 27 09:04:29 2017 New Revision: 312869 URL: https://svnweb.freebsd.org/changeset/base/312869 Log: MFH: r308671 When you select make OLDTIMEZONES=1 then you need a few added directories to be made or the command fails Sponsored by: panzura Modified: stable/10/share/zoneinfo/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/zoneinfo/Makefile ============================================================================== --- stable/10/share/zoneinfo/Makefile Fri Jan 27 08:54:33 2017 (r312868) +++ stable/10/share/zoneinfo/Makefile Fri Jan 27 09:04:29 2017 (r312869) @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ Pacific \ SystemV +.if defined(OLDTIMEZONES) +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil +.endif + all: zoneinfo .PHONY: zoneinfo From owner-svn-src-stable@freebsd.org Fri Jan 27 09:07:12 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1B13CC38C0; Fri, 27 Jan 2017 09:07:12 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 860FCCAA; Fri, 27 Jan 2017 09:07:12 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R97BEQ098311; Fri, 27 Jan 2017 09:07:11 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R97Bo5098310; Fri, 27 Jan 2017 09:07:11 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201701270907.v0R97Bo5098310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 27 Jan 2017 09:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312870 - stable/10/share/zoneinfo X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 09:07:12 -0000 Author: julian Date: Fri Jan 27 09:07:11 2017 New Revision: 312870 URL: https://svnweb.freebsd.org/changeset/base/312870 Log: MFH: r310426 If you are going to be run individually to make a new timezone set then ensure the destination directories exist. Especially if you define OLDTIMEZONES because the mtree pass doesn't do it for you. MFC after: 1 week Sponsored by: Panzura Modified: stable/10/share/zoneinfo/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/zoneinfo/Makefile ============================================================================== --- stable/10/share/zoneinfo/Makefile Fri Jan 27 09:04:29 2017 (r312869) +++ stable/10/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) @@ -82,6 +82,8 @@ zoneinfo: yearistype ${TDATA} ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES} beforeinstall: + mkdir -p ${DESTDIR}/usr/share/zoneinfo + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} cd ${TZBUILDDIR} && \ find -s * -type f -print -exec ${INSTALL} \ -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ From owner-svn-src-stable@freebsd.org Fri Jan 27 09:11:46 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05444CC3975; Fri, 27 Jan 2017 09:11:46 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8884FF6; Fri, 27 Jan 2017 09:11:45 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R9BiYp000148; Fri, 27 Jan 2017 09:11:44 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R9BiQr000147; Fri, 27 Jan 2017 09:11:44 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201701270911.v0R9BiQr000147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 27 Jan 2017 09:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312871 - stable/11/share/zoneinfo X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 09:11:46 -0000 Author: julian Date: Fri Jan 27 09:11:44 2017 New Revision: 312871 URL: https://svnweb.freebsd.org/changeset/base/312871 Log: MFH: r308671 When you select make OLDTIMEZONES=1 then you need a few added directories to be made or the command fails Sponsored by: panzura MFH: r310426 If you are going to be run individually to make a new timezone set then ensure the destination directories exist. Especially if you define OLDTIMEZONES because the mtree pass doesn't do it for you. Sponsored by: Panzura Modified: stable/11/share/zoneinfo/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/zoneinfo/Makefile ============================================================================== --- stable/11/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) +++ stable/11/share/zoneinfo/Makefile Fri Jan 27 09:11:44 2017 (r312871) @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ Pacific \ SystemV +.if defined(OLDTIMEZONES) +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil +.endif + .if !defined(_SKIP_BUILD) all: zoneinfo .endif @@ -81,6 +85,8 @@ zoneinfo: yearistype ${TDATA} beforeinstall: install-zoneinfo install-zoneinfo: + mkdir -p ${DESTDIR}/usr/share/zoneinfo + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} cd ${TZBUILDDIR} && \ find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \ -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ From owner-svn-src-stable@freebsd.org Fri Jan 27 10:05:18 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1BE7CC2B08; Fri, 27 Jan 2017 10:05:18 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1073D98; Fri, 27 Jan 2017 10:05:18 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RA5HZg022589; Fri, 27 Jan 2017 10:05:17 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RA5H45022588; Fri, 27 Jan 2017 10:05:17 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201701271005.v0RA5H45022588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 27 Jan 2017 10:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312873 - stable/10/sys/amd64/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 10:05:19 -0000 Author: tijl Date: Fri Jan 27 10:05:17 2017 New Revision: 312873 URL: https://svnweb.freebsd.org/changeset/base/312873 Log: MFC r312699: Apply r210555 to 64 bit linux support: The interpreter name should no longer be treated as a buffer that can be overwritten. PR: 216346 Modified: stable/10/sys/amd64/linux/linux_sysvec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/10/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:03:50 2017 (r312872) +++ stable/10/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:05:17 2017 (r312873) @@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_param { const char *head = (const char *)imgp->image_header; char *rpath; - int error = -1, len; + int error = -1; /* * The interpreter for shell scripts run from a linux binary needs @@ -736,17 +736,12 @@ exec_linux_imgact_try(struct image_param linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) { - len = strlen(rpath) + 1; - - if (len <= MAXSHELLCMDLEN) - memcpy(imgp->interpreter_name, - rpath, len); - free(rpath, M_TEMP); - } + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; } } - return(error); + return (error); } #define LINUX_VSYSCALL_START (-10UL << 20) From owner-svn-src-stable@freebsd.org Fri Jan 27 10:06:21 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0A0ACC2C19; Fri, 27 Jan 2017 10:06:21 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCA18F4E; Fri, 27 Jan 2017 10:06:21 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RA6KI6022683; Fri, 27 Jan 2017 10:06:20 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RA6K2c022682; Fri, 27 Jan 2017 10:06:20 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201701271006.v0RA6K2c022682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 27 Jan 2017 10:06:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312874 - stable/11/sys/amd64/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 10:06:22 -0000 Author: tijl Date: Fri Jan 27 10:06:20 2017 New Revision: 312874 URL: https://svnweb.freebsd.org/changeset/base/312874 Log: MFC r312699: Apply r210555 to 64 bit linux support: The interpreter name should no longer be treated as a buffer that can be overwritten. PR: 216346 Modified: stable/11/sys/amd64/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:05:17 2017 (r312873) +++ stable/11/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:06:20 2017 (r312874) @@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_param { const char *head = (const char *)imgp->image_header; char *rpath; - int error = -1, len; + int error = -1; /* * The interpreter for shell scripts run from a linux binary needs @@ -736,17 +736,12 @@ exec_linux_imgact_try(struct image_param linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) { - len = strlen(rpath) + 1; - - if (len <= MAXSHELLCMDLEN) - memcpy(imgp->interpreter_name, - rpath, len); - free(rpath, M_TEMP); - } + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; } } - return(error); + return (error); } #define LINUX_VSYSCALL_START (-10UL << 20) From owner-svn-src-stable@freebsd.org Fri Jan 27 15:26:04 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B308CC3E6E; Fri, 27 Jan 2017 15:26:04 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB907E74; Fri, 27 Jan 2017 15:26:03 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v0RFPsx4025333; Fri, 27 Jan 2017 07:25:54 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v0RFPmVq025332; Fri, 27 Jan 2017 07:25:48 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201701271525.v0RFPmVq025332@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r312871 - stable/11/share/zoneinfo In-Reply-To: <201701270911.v0R9BiQr000147@repo.freebsd.org> To: Julian Elischer Date: Fri, 27 Jan 2017 07:25:48 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 15:26:04 -0000 > Author: julian > Date: Fri Jan 27 09:11:44 2017 > New Revision: 312871 > URL: https://svnweb.freebsd.org/changeset/base/312871 > > Log: > MFH: r308671 > > When you select make OLDTIMEZONES=1 then you need a few added directories > to be made or the command fails > > Sponsored by: panzura > > MFH: r310426 > > If you are going to be run individually to make a new timezone set > then ensure the destination directories exist. > Especially if you define OLDTIMEZONES because the mtree pass > doesn't do it for you. Perhaps it is time to start pre-processing mtree files so this would no longer be the case? > Sponsored by: Panzura > > Modified: > stable/11/share/zoneinfo/Makefile > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/share/zoneinfo/Makefile > ============================================================================== > --- stable/11/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) > +++ stable/11/share/zoneinfo/Makefile Fri Jan 27 09:11:44 2017 (r312871) > @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ > Pacific \ > SystemV > > +.if defined(OLDTIMEZONES) > +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil > +.endif > + > .if !defined(_SKIP_BUILD) > all: zoneinfo > .endif > @@ -81,6 +85,8 @@ zoneinfo: yearistype ${TDATA} > > beforeinstall: install-zoneinfo > install-zoneinfo: > + mkdir -p ${DESTDIR}/usr/share/zoneinfo > + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} This has the failure mode that your current uid and umask, etc are used in creating the directories. Please add appropriate chown/chmod commands to reflect what mtree would of done had it done this. > cd ${TZBUILDDIR} && \ > find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \ > -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ > _______________________________________________ > svn-src-stable-11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 > To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Fri Jan 27 17:54:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 418DCCBFBAB; Fri, 27 Jan 2017 17:54:26 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10B1BD4A; Fri, 27 Jan 2017 17:54:25 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RHsPNc011648; Fri, 27 Jan 2017 17:54:25 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RHsPLj011647; Fri, 27 Jan 2017 17:54:25 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201701271754.v0RHsPLj011647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Fri, 27 Jan 2017 17:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312892 - stable/11/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2017 17:54:26 -0000 Author: wblock (doc committer) Date: Fri Jan 27 17:54:24 2017 New Revision: 312892 URL: https://svnweb.freebsd.org/changeset/base/312892 Log: MFC r312547: Mention sendfile(2) by popular demand. Sponsored by: iXsystems Modified: stable/11/lib/libc/sys/shm_open.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/shm_open.2 ============================================================================== --- stable/11/lib/libc/sys/shm_open.2 Fri Jan 27 16:53:53 2017 (r312891) +++ stable/11/lib/libc/sys/shm_open.2 Fri Jan 27 17:54:24 2017 (r312892) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 13, 2017 +.Dd January 20, 2017 .Dt SHM_OPEN 2 .Os .Sh NAME @@ -187,6 +187,11 @@ kernel implementation explicitly include and .Xr write 2 . .Pp +.Fx +also supports zero-copy transmission of data from shared memory +objects with +.Xr sendfile 2 . +.Pp Neither shared memory objects nor their contents persist across reboots. .Pp Writes do not extend shared memory objects, so @@ -281,7 +286,8 @@ requires write permission to the shared .Xr fstat 2 , .Xr ftruncate 2 , .Xr mmap 2 , -.Xr munmap 2 +.Xr munmap 2 , +.Xr sendfile 2 .Sh STANDARDS The .Fn shm_open From owner-svn-src-stable@freebsd.org Sat Jan 28 13:25:36 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB913CC43DB; Sat, 28 Jan 2017 13:25:36 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BD92D17; Sat, 28 Jan 2017 13:25:36 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-228-247.lns20.per1.internode.on.net [121.45.228.247]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id v0SDPOqJ094549 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sat, 28 Jan 2017 05:25:27 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r312871 - stable/11/share/zoneinfo To: "Rodney W. Grimes" References: <201701271525.v0RFPmVq025332@pdx.rh.CN85.dnsmgr.net> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org From: Julian Elischer Message-ID: <722a5ab1-f997-fa44-4f67-91430673622d@freebsd.org> Date: Sat, 28 Jan 2017 21:25:18 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <201701271525.v0RFPmVq025332@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2017 13:25:36 -0000 Hi Rod, On 27/1/17 11:25 pm, Rodney W. Grimes wrote: >> Author: julian >> Date: Fri Jan 27 09:11:44 2017 >> New Revision: 312871 >> URL: https://svnweb.freebsd.org/changeset/base/312871 >> >> Log: >> MFH: r308671 >> >> When you select make OLDTIMEZONES=1 then you need a few added directories >> to be made or the command fails >> >> Sponsored by: panzura >> >> MFH: r310426 >> >> If you are going to be run individually to make a new timezone set >> then ensure the destination directories exist. >> Especially if you define OLDTIMEZONES because the mtree pass >> doesn't do it for you. > Perhaps it is time to start pre-processing mtree files so this > would no longer be the case? A much bigger question than I can handle at this time.. :-) > >> Sponsored by: Panzura >> >> Modified: >> stable/11/share/zoneinfo/Makefile >> Directory Properties: >> stable/11/ (props changed) >> >> Modified: stable/11/share/zoneinfo/Makefile >> ============================================================================== >> --- stable/11/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) >> +++ stable/11/share/zoneinfo/Makefile Fri Jan 27 09:11:44 2017 (r312871) >> @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ >> Pacific \ >> SystemV >> >> +.if defined(OLDTIMEZONES) >> +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil >> +.endif >> + >> .if !defined(_SKIP_BUILD) >> all: zoneinfo >> .endif >> @@ -81,6 +85,8 @@ zoneinfo: yearistype ${TDATA} >> >> beforeinstall: install-zoneinfo >> install-zoneinfo: >> + mkdir -p ${DESTDIR}/usr/share/zoneinfo >> + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} > This has the failure mode that your current uid and umask, etc are > used in creating the directories. Please add appropriate chown/chmod > commands to reflect what mtree would of done had it done this. This is mostly because it failed when run as an individual operation to update zoninfo files. which would probably be done as root, or someone who wants the files owned by them. You can't write here unless you are root, so I'm not sure what the right thing to do would be. and chown doesn't work if you are not root, so what would you suggest? (what is needed for the offline permissions tool)? should we assume ${DESTDIR}/usr/share exists already? the following might be a very slight improvement, but ... mkdir -p -m 755 ${DESTDIR}/usr/share mkdir -p -m 755 ${DESTDIR}/usr/share/zoneinfo cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p -m 755 ${TZBUILDSUBDIRS} -cd ${DESTDIR}/usr/share/zoneinfo; chown -R ${BINOWN}:${BINGRP} . < would fail if you are not root. >> cd ${TZBUILDDIR} && \ >> find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \ >> -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ >> _______________________________________________ >> svn-src-stable-11@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 >> To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" >> From owner-svn-src-stable@freebsd.org Sat Jan 28 17:37:53 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F494CC4D30; Sat, 28 Jan 2017 17:37:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B75DE1AB0; Sat, 28 Jan 2017 17:37:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SHbpM2094121; Sat, 28 Jan 2017 17:37:51 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SHbpKP094120; Sat, 28 Jan 2017 17:37:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281737.v0SHbpKP094120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 17:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312930 - stable/11/lib/libstand X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2017 17:37:53 -0000 Author: bapt Date: Sat Jan 28 17:37:51 2017 New Revision: 312930 URL: https://svnweb.freebsd.org/changeset/base/312930 Log: MFC r311659: remove network mask calculation for Classful network Nowadays it's not necessary to compute network mask from the IP address and compare to given by DHCP. Submitted by: kczekirda Reviewed by: glebius, bapt Sponsored by: Oktawave MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D8740 Modified: stable/11/lib/libstand/bootp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libstand/bootp.c ============================================================================== --- stable/11/lib/libstand/bootp.c Sat Jan 28 17:08:40 2017 (r312929) +++ stable/11/lib/libstand/bootp.c Sat Jan 28 17:37:51 2017 (r312930) @@ -62,8 +62,6 @@ __FBSDID("$FreeBSD$"); struct in_addr servip; -static n_long nmask, smask; - static time_t bot; static char vm_rfc1048[4] = VM_RFC1048; @@ -223,30 +221,19 @@ bootp(sock, flag) bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile)); bootfile[sizeof(bootfile) - 1] = '\0'; - if (IN_CLASSA(ntohl(myip.s_addr))) - nmask = htonl(IN_CLASSA_NET); - else if (IN_CLASSB(ntohl(myip.s_addr))) - nmask = htonl(IN_CLASSB_NET); - else - nmask = htonl(IN_CLASSC_NET); -#ifdef BOOTP_DEBUG - if (debug) - printf("'native netmask' is %s\n", intoa(nmask)); -#endif - - /* Check subnet mask against net mask; toss if bogus */ - if ((nmask & smask) != nmask) { + if (!netmask) { + if (IN_CLASSA(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSB_NET); + else + netmask = htonl(IN_CLASSC_NET); #ifdef BOOTP_DEBUG if (debug) - printf("subnet mask (%s) bad\n", intoa(smask)); + printf("'native netmask' is %s\n", intoa(netmask)); #endif - smask = 0; } - /* Get subnet (or natural net) mask */ - netmask = nmask; - if (smask) - netmask = smask; #ifdef BOOTP_DEBUG if (debug) printf("mask: %s\n", intoa(netmask)); @@ -385,7 +372,7 @@ vend_rfc1048(cp, len) break; if (tag == TAG_SUBNET_MASK) { - bcopy(cp, &smask, sizeof(smask)); + bcopy(cp, &netmask, sizeof(netmask)); } if (tag == TAG_GATEWAY) { bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr)); @@ -445,7 +432,7 @@ vend_cmu(cp) vp = (struct cmu_vend *)cp; if (vp->v_smask.s_addr != 0) { - smask = vp->v_smask.s_addr; + netmask = vp->v_smask.s_addr; } if (vp->v_dgate.s_addr != 0) { gateip = vp->v_dgate; From owner-svn-src-stable@freebsd.org Sat Jan 28 17:40:38 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF64DCC4E25; Sat, 28 Jan 2017 17:40:38 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2F981C57; Sat, 28 Jan 2017 17:40:38 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SHebjj094373; Sat, 28 Jan 2017 17:40:37 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SHebel094370; Sat, 28 Jan 2017 17:40:37 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281740.v0SHebel094370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 17:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312931 - in stable/11/usr.sbin/pw: . tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2017 17:40:39 -0000 Author: bapt Date: Sat Jan 28 17:40:37 2017 New Revision: 312931 URL: https://svnweb.freebsd.org/changeset/base/312931 Log: MFC r312644, r312650 r312644: Readd a feature lost in pw(8) refactoring pw usermod foo -m It used to be able to (re)create the home directory if it didn't exists PR: 216224 Reported by: ae MFC after: 3 days r312650: Really restore the old behaviour for pw usermod -m It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after: 3 days Modified: stable/11/usr.sbin/pw/psdate.c stable/11/usr.sbin/pw/pw_user.c stable/11/usr.sbin/pw/tests/pw_usermod.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pw/psdate.c ============================================================================== --- stable/11/usr.sbin/pw/psdate.c Sat Jan 28 17:37:51 2017 (r312930) +++ stable/11/usr.sbin/pw/psdate.c Sat Jan 28 17:40:37 2017 (r312931) @@ -41,12 +41,8 @@ static const char rcsid[] = static int numerics(char const * str) { - int rc = isdigit((unsigned char)*str); - if (rc) - while (isdigit((unsigned char)*str) || *str == 'x') - ++str; - return rc && !*str; + return (str[strspn(str, "0123456789x")] == '\0'); } static int Modified: stable/11/usr.sbin/pw/pw_user.c ============================================================================== --- stable/11/usr.sbin/pw/pw_user.c Sat Jan 28 17:37:51 2017 (r312930) +++ stable/11/usr.sbin/pw/pw_user.c Sat Jan 28 17:40:37 2017 (r312931) @@ -1493,7 +1493,7 @@ pw_user_mod(int argc, char **argv, char intmax_t id = -1; int ch, fd = -1; size_t i, j; - bool quiet, createhome, pretty, dryrun, nis, edited, docreatehome; + bool quiet, createhome, pretty, dryrun, nis, edited; bool precrypted; mode_t homemode = 0; time_t expire_days, password_days, now; @@ -1503,7 +1503,7 @@ pw_user_mod(int argc, char **argv, char passwd = NULL; class = nispasswd = NULL; quiet = createhome = pretty = dryrun = nis = precrypted = false; - edited = docreatehome = false; + edited = false; if (arg1 != NULL) { if (arg1[strspn(arg1, "0123456789")] == '\0') @@ -1704,8 +1704,6 @@ pw_user_mod(int argc, char **argv, char if (!createhome) warnx("WARNING: home `%s' does not exist", pwd->pw_dir); - else - docreatehome = true; } else if (!S_ISDIR(st.st_mode)) { warnx("WARNING: home `%s' is not a directory", pwd->pw_dir); @@ -1797,7 +1795,7 @@ pw_user_mod(int argc, char **argv, char * that this also `works' for editing users if -m is used, but * existing files will *not* be overwritten. */ - if (PWALTDIR() != PWF_ALT && docreatehome && pwd->pw_dir && + if (PWALTDIR() != PWF_ALT && createhome && pwd->pw_dir && *pwd->pw_dir == '/' && pwd->pw_dir[1]) { if (!skel) skel = cnf->dotdir; Modified: stable/11/usr.sbin/pw/tests/pw_usermod.sh ============================================================================== --- stable/11/usr.sbin/pw/tests/pw_usermod.sh Sat Jan 28 17:37:51 2017 (r312930) +++ stable/11/usr.sbin/pw/tests/pw_usermod.sh Sat Jan 28 17:40:37 2017 (r312931) @@ -253,6 +253,26 @@ user_mod_w_yes_body() { $(atf_get_srcdir)/crypt $passhash "foo" } +atf_test_case user_mod_m +user_mod_m_body() { + populate_root_etc_skel + + mkdir -p ${HOME}/home + mkdir -p ${HOME}/skel + echo "entry" > ${HOME}/skel/.file + atf_check -s exit:0 ${RPW} useradd foo + ! test -d ${HOME}/home/foo || atf_fail "Directory should not have been created" + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -d ${HOME}/home/foo || atf_fail "Directory should have been created" + test -f ${HOME}/home/foo/.file || atf_fail "Skell files not added" + echo "entry" > ${HOME}/skel/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -f ${HOME}/home/foo/.file2 || atf_fail "Skell files not added" + echo > ${HOME}/home/foo/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + atf_check -s exit:0 -o inline:"\n" cat ${HOME}/home/foo/.file2 +} + atf_init_test_cases() { atf_add_test_case user_mod @@ -275,4 +295,5 @@ atf_init_test_cases() { atf_add_test_case user_mod_w_none atf_add_test_case user_mod_w_random atf_add_test_case user_mod_w_yes + atf_add_test_case user_mod_m }