From owner-svn-src-head@freebsd.org  Sun Jul 28 00:48:29 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84E0CC577F;
 Sun, 28 Jul 2019 00:48:29 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 5D321751C1;
 Sun, 28 Jul 2019 00:48:29 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32F9B7BE0;
 Sun, 28 Jul 2019 00:48:29 +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 x6S0mSXa037145;
 Sun, 28 Jul 2019 00:48:28 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6S0mS0M037143;
 Sun, 28 Jul 2019 00:48:28 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907280048.x6S0mS0M037143@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Sun, 28 Jul 2019 00:48:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350386 - in head/sys: kern sys
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: in head/sys: kern sys
X-SVN-Commit-Revision: 350386
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 5D321751C1
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.955,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 00:48:29 -0000

Author: asomers
Date: Sun Jul 28 00:48:28 2019
New Revision: 350386
URL: https://svnweb.freebsd.org/changeset/base/350386

Log:
  Add v_inval_buf_range, like vtruncbuf but for a range of a file
  
  v_inval_buf_range invalidates all buffers within a certain LBA range of a
  file. It will be used by fusefs(5). This commit is a partial merge of
  r346162, r346606, and r346756 from projects/fuse2.
  
  Reviewed by:	kib
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21032

Modified:
  head/sys/kern/vfs_subr.c
  head/sys/sys/vnode.h

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat Jul 27 19:29:28 2019	(r350385)
+++ head/sys/kern/vfs_subr.c	Sun Jul 28 00:48:28 2019	(r350386)
@@ -118,6 +118,8 @@ static void	vfs_knl_assert_locked(void *arg);
 static void	vfs_knl_assert_unlocked(void *arg);
 static void	vnlru_return_batches(struct vfsops *mnt_op);
 static void	destroy_vpollinfo(struct vpollinfo *vi);
+static int	v_inval_buf_range_locked(struct vnode *vp, struct bufobj *bo,
+		    daddr_t startlbn, daddr_t endlbn);
 
 /*
  * These fences are intended for cases where some synchronization is
@@ -1954,9 +1956,8 @@ int
 vtruncbuf(struct vnode *vp, off_t length, int blksize)
 {
 	struct buf *bp, *nbp;
-	int anyfreed;
-	daddr_t trunclbn;
 	struct bufobj *bo;
+	daddr_t startlbn;
 
 	CTR4(KTR_VFS, "%s: vp %p with block %d:%ju", __func__,
 	    vp, blksize, (uintmax_t)length);
@@ -1964,91 +1965,134 @@ vtruncbuf(struct vnode *vp, off_t length, int blksize)
 	/*
 	 * Round up to the *next* lbn.
 	 */
-	trunclbn = howmany(length, blksize);
+	startlbn = howmany(length, blksize);
 
 	ASSERT_VOP_LOCKED(vp, "vtruncbuf");
-restart:
+
 	bo = &vp->v_bufobj;
+restart_unlocked:
 	BO_LOCK(bo);
-	anyfreed = 1;
-	for (;anyfreed;) {
-		anyfreed = 0;
-		TAILQ_FOREACH_SAFE(bp, &bo->bo_clean.bv_hd, b_bobufs, nbp) {
-			if (bp->b_lblkno < trunclbn)
+
+	while (v_inval_buf_range_locked(vp, bo, startlbn, INT64_MAX) == EAGAIN)
+		;
+
+	if (length > 0) {
+restartsync:
+		TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
+			if (bp->b_lblkno > 0)
 				continue;
+			/*
+			 * Since we hold the vnode lock this should only
+			 * fail if we're racing with the buf daemon.
+			 */
 			if (BUF_LOCK(bp,
 			    LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
 			    BO_LOCKPTR(bo)) == ENOLCK)
-				goto restart;
+				goto restart_unlocked;
 
-			bremfree(bp);
-			bp->b_flags |= (B_INVAL | B_RELBUF);
-			bp->b_flags &= ~B_ASYNC;
-			brelse(bp);
-			anyfreed = 1;
+			VNASSERT((bp->b_flags & B_DELWRI), vp,
+			    ("buf(%p) on dirty queue without DELWRI", bp));
 
+			bremfree(bp);
+			bawrite(bp);
 			BO_LOCK(bo);
-			if (nbp != NULL &&
-			    (((nbp->b_xflags & BX_VNCLEAN) == 0) ||
-			    (nbp->b_vp != vp) ||
-			    (nbp->b_flags & B_DELWRI))) {
-				BO_UNLOCK(bo);
-				goto restart;
-			}
+			goto restartsync;
 		}
+	}
 
-		TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
-			if (bp->b_lblkno < trunclbn)
+	bufobj_wwait(bo, 0, 0);
+	BO_UNLOCK(bo);
+	vnode_pager_setsize(vp, length);
+
+	return (0);
+}
+
+/*
+ * Invalidate the cached pages of a file's buffer within the range of block
+ * numbers [startlbn, endlbn).
+ */
+void
+v_inval_buf_range(struct vnode *vp, daddr_t startlbn, daddr_t endlbn,
+    int blksize)
+{
+	struct bufobj *bo;
+	off_t start, end;
+
+	ASSERT_VOP_LOCKED(vp, "v_inval_buf_range");
+
+	start = blksize * startlbn;
+	end = blksize * endlbn;
+
+	bo = &vp->v_bufobj;
+	BO_LOCK(bo);
+	MPASS(blksize == bo->bo_bsize);
+
+	while (v_inval_buf_range_locked(vp, bo, startlbn, endlbn) == EAGAIN)
+		;
+
+	BO_UNLOCK(bo);
+	vn_pages_remove(vp, OFF_TO_IDX(start), OFF_TO_IDX(end + PAGE_SIZE - 1));
+}
+
+static int
+v_inval_buf_range_locked(struct vnode *vp, struct bufobj *bo,
+    daddr_t startlbn, daddr_t endlbn)
+{
+	struct buf *bp, *nbp;
+	bool anyfreed;
+
+	ASSERT_VOP_LOCKED(vp, "v_inval_buf_range_locked");
+	ASSERT_BO_LOCKED(bo);
+
+	do {
+		anyfreed = false;
+		TAILQ_FOREACH_SAFE(bp, &bo->bo_clean.bv_hd, b_bobufs, nbp) {
+			if (bp->b_lblkno < startlbn || bp->b_lblkno >= endlbn)
 				continue;
 			if (BUF_LOCK(bp,
 			    LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
-			    BO_LOCKPTR(bo)) == ENOLCK)
-				goto restart;
+			    BO_LOCKPTR(bo)) == ENOLCK) {
+				BO_LOCK(bo);
+				return (EAGAIN);
+			}
+
 			bremfree(bp);
-			bp->b_flags |= (B_INVAL | B_RELBUF);
+			bp->b_flags |= B_INVAL | B_RELBUF;
 			bp->b_flags &= ~B_ASYNC;
 			brelse(bp);
-			anyfreed = 1;
+			anyfreed = true;
 
 			BO_LOCK(bo);
 			if (nbp != NULL &&
-			    (((nbp->b_xflags & BX_VNDIRTY) == 0) ||
-			    (nbp->b_vp != vp) ||
-			    (nbp->b_flags & B_DELWRI) == 0)) {
-				BO_UNLOCK(bo);
-				goto restart;
-			}
+			    (((nbp->b_xflags & BX_VNCLEAN) == 0) ||
+			    nbp->b_vp != vp ||
+			    (nbp->b_flags & B_DELWRI) != 0))
+				return (EAGAIN);
 		}
-	}
 
-	if (length > 0) {
-restartsync:
 		TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
-			if (bp->b_lblkno > 0)
+			if (bp->b_lblkno < startlbn || bp->b_lblkno >= endlbn)
 				continue;
-			/*
-			 * Since we hold the vnode lock this should only
-			 * fail if we're racing with the buf daemon.
-			 */
 			if (BUF_LOCK(bp,
 			    LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
 			    BO_LOCKPTR(bo)) == ENOLCK) {
-				goto restart;
+				BO_LOCK(bo);
+				return (EAGAIN);
 			}
-			VNASSERT((bp->b_flags & B_DELWRI), vp,
-			    ("buf(%p) on dirty queue without DELWRI", bp));
-
 			bremfree(bp);
-			bawrite(bp);
+			bp->b_flags |= B_INVAL | B_RELBUF;
+			bp->b_flags &= ~B_ASYNC;
+			brelse(bp);
+			anyfreed = true;
+
 			BO_LOCK(bo);
-			goto restartsync;
+			if (nbp != NULL &&
+			    (((nbp->b_xflags & BX_VNDIRTY) == 0) ||
+			    (nbp->b_vp != vp) ||
+			    (nbp->b_flags & B_DELWRI) == 0))
+				return (EAGAIN);
 		}
-	}
-
-	bufobj_wwait(bo, 0, 0);
-	BO_UNLOCK(bo);
-	vnode_pager_setsize(vp, length);
-
+	} while (anyfreed);
 	return (0);
 }
 

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Sat Jul 27 19:29:28 2019	(r350385)
+++ head/sys/sys/vnode.h	Sun Jul 28 00:48:28 2019	(r350386)
@@ -659,6 +659,8 @@ void	_vhold(struct vnode *, bool);
 void	vinactive(struct vnode *, struct thread *);
 int	vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo);
 int	vtruncbuf(struct vnode *vp, off_t length, int blksize);
+void	v_inval_buf_range(struct vnode *vp, daddr_t startlbn, daddr_t endlbn,
+	    int blksize);
 void	vunref(struct vnode *);
 void	vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3);
 int	vrecycle(struct vnode *vp);

From owner-svn-src-head@freebsd.org  Sun Jul 28 15:21:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BDB1ADAC2;
 Sun, 28 Jul 2019 15:21:47 +0000 (UTC) (envelope-from jilles@stack.nl)
Received: from ecc05.stack.nl (ws0.zlo.nu [190.2.135.243])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "*.stack.nl",
 Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id D97D96A4A0;
 Sun, 28 Jul 2019 15:21:45 +0000 (UTC) (envelope-from jilles@stack.nl)
Received: from mail04.stack.nl (blade.stack.nl [51.15.111.152])
 by ecc05.stack.nl (Postfix) with ESMTPS id 7205B100226;
 Sun, 28 Jul 2019 15:21:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=stack.nl; s=mail;
 t=1564327296; bh=2mhkYMLcPI9ma7LMIEwuyEXscQ0gGeHxDOV+MyXa4xg=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=v8t9gkenwlbZjtGy9XwXqa6tVCaD6s3jrDOy3JZkFLcJquuzxrrXUx9ghktx+4M1p
 oPj9WydjTvrGRGet0YI+hnXs0E57Dza5u8qKJpYymbfZPNnpHxjp2icFPwHfRfjc3+
 lJ1tGi1doREVupR4V7meg7acPSqPNVFU3mKE8w/RWv8/qmXGMOMOa8xQsHmis0OTuA
 vHKPCM6HQI7kx2+Iz7Y8HGASgo+iNB9pPQ23iTYkxGIsxL1P6N3ej4QQ6TUuLkDwJX
 /WZF5YfnK2xin7x5dZgGp1E8TxjHlsQki+BwRFS8GLGs7acxmiH1TKCuHew+YTMsKO
 m418EfhQJfNlQ==
Received: from localhost (localhost.localdomain [127.0.0.1])
 by mail04.stack.nl (Postfix) with ESMTP id 42C0BA42;
 Sun, 28 Jul 2019 15:21:36 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at mail04.stack.nl
Received: from mail04.stack.nl ([127.0.0.1])
 by localhost (mail04.stack.nl [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id jvVjN24qWqL6; Sun, 28 Jul 2019 15:21:33 +0000 (UTC)
Received: from blade.stack.nl (blade.stack.nl [192.168.122.130])
 by mail04.stack.nl (Postfix) with ESMTP id 9F094345;
 Sun, 28 Jul 2019 15:21:33 +0000 (UTC)
Received: by blade.stack.nl (Postfix, from userid 1677)
 id 7922A2094C; Sun, 28 Jul 2019 17:21:33 +0200 (CEST)
Date: Sun, 28 Jul 2019 17:21:33 +0200
From: Jilles Tjoelker <jilles@stack.nl>
To: Ian Lepore <ian@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r349974 - head/libexec/rc/rc.d
Message-ID: <20190728152133.GA3481@stack.nl>
References: <201907131607.x6DG7cTR067202@repo.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201907131607.x6DG7cTR067202@repo.freebsd.org>
User-Agent: Mutt/1.9.4 (2018-02-28)
X-Rspamd-Queue-Id: D97D96A4A0
X-Spamd-Bar: ---
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=stack.nl header.s=mail header.b=v8t9gken;
 spf=pass (mx1.freebsd.org: domain of jilles@stack.nl designates 190.2.135.243
 as permitted sender) smtp.mailfrom=jilles@stack.nl
X-Spamd-Result: default: False [-3.13 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-0.72)[-0.721,0];
 R_DKIM_ALLOW(-0.20)[stack.nl:s=mail]; RCVD_COUNT_FIVE(0.00)[6];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip4:190.2.135.243];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 DMARC_NA(0.00)[stack.nl]; NEURAL_HAM_LONG(-1.00)[-0.999,0];
 TO_DN_SOME(0.00)[];
 IP_SCORE(-0.46)[asn: 49981(-2.32), country: NL(0.01)];
 DKIM_TRACE(0.00)[stack.nl:+]; MX_GOOD(-0.01)[mail01.stack.nl];
 NEURAL_HAM_SHORT(-0.44)[-0.442,0]; FROM_EQ_ENVFROM(0.00)[];
 MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:49981, ipnet:190.2.128.0/20, country:NL];
 MID_RHS_MATCH_FROM(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 15:21:47 -0000

On Sat, Jul 13, 2019 at 04:07:38PM +0000, Ian Lepore wrote:
> Author: ian
> Date: Sat Jul 13 16:07:38 2019
> New Revision: 349974
> URL: https://svnweb.freebsd.org/changeset/base/349974

> Log:
>   Limit access to system accounting files.

>   In 2013 the security chapter of the Handbook was updated in r42501 to
>   suggest limiting access to the system accounting file [*1] by creating the
>   initial file with a mode of 0600. This was in part based on a discussion in
>   the forums [*2]. Unfortunately, this advice is overridden by the fact that a
>   new file is created as part of periodic daily processing, and the file mode
>   is set by the rc.d/accounting script.

>   These changes update the accounting script to create the directory with mode
>   0750 if it doesn't already exist, and to create the daily file with mode
>   0640. This limits write access to root only, read access to root and members
>   of wheel, and eliminates world access completely. For admins who want to
>   prevent even members of wheel from accessing the files, the mode of the
>   /var/account directory can be manually changed to 0700, because the script
>   never creates or changes that directory if it already exists.

I like it. However, the /var/account directory is normally created by
mtree: etc/mtree/BSD.var.dist. Perhaps the permissions should be
adjusted there as well.

-- 
Jilles Tjoelker

From owner-svn-src-head@freebsd.org  Sun Jul 28 16:07:28 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A196AE988;
 Sun, 28 Jul 2019 16:07:28 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 7A4A96BEF8;
 Sun, 28 Jul 2019 16:07:28 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48A6B1A2E3;
 Sun, 28 Jul 2019 16:07:28 +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 x6SG7SjS080650;
 Sun, 28 Jul 2019 16:07:28 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6SG7SV3080649;
 Sun, 28 Jul 2019 16:07:28 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907281607.x6SG7SV3080649@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Sun, 28 Jul 2019 16:07:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350390 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350390
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 7A4A96BEF8
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.991,0];
 NEURAL_HAM_SHORT(-0.97)[-0.966,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 16:07:28 -0000

Author: asomers
Date: Sun Jul 28 16:07:27 2019
New Revision: 350390
URL: https://svnweb.freebsd.org/changeset/base/350390

Log:
  Better comments for vlrureclaim
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sun Jul 28 15:20:47 2019	(r350389)
+++ head/sys/kern/vfs_subr.c	Sun Jul 28 16:07:27 2019	(r350390)
@@ -947,9 +947,16 @@ vattr_null(struct vattr *vap)
  * desirable to reuse such vnodes.  These conditions may cause the
  * number of vnodes to reach some minimum value regardless of what
  * you set kern.maxvnodes to.  Do not set kern.maxvnodes too low.
+ *
+ * @param mp		 Try to reclaim vnodes from this mountpoint
+ * @param reclaim_nc_src Only reclaim directories with outgoing namecache
+ * 			 entries if this argument is strue
+ * @param trigger	 Only reclaim vnodes with fewer than this many resident
+ *			 pages.
+ * @return		 The number of vnodes that were reclaimed.
  */
 static int
-vlrureclaim(struct mount *mp, int reclaim_nc_src, int trigger)
+vlrureclaim(struct mount *mp, bool reclaim_nc_src, int trigger)
 {
 	struct vnode *vp;
 	int count, done, target;
@@ -1238,7 +1245,8 @@ vnlru_proc(void)
 {
 	struct mount *mp, *nmp;
 	unsigned long onumvnodes;
-	int done, force, reclaim_nc_src, trigger, usevnodes;
+	int done, force, trigger, usevnodes;
+	bool reclaim_nc_src;
 
 	EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc,
 	    SHUTDOWN_PRI_FIRST);

From owner-svn-src-head@freebsd.org  Sun Jul 28 16:11:24 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1572AEA54;
 Sun, 28 Jul 2019 16:11:24 +0000 (UTC)
 (envelope-from zeising+freebsd@daemonic.se)
Received: from mail.daemonic.se (mail.daemonic.se [176.58.89.161])
 (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 B754F6C0F2;
 Sun, 28 Jul 2019 16:11:23 +0000 (UTC)
 (envelope-from zeising+freebsd@daemonic.se)
Received: from cid.daemonic.se (localhost [IPv6:::1])
 by mail.daemonic.se (Postfix) with ESMTP id 45xSVW1M26z3ksN;
 Sun, 28 Jul 2019 16:11:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=daemonic.se; h=
 content-transfer-encoding:content-language:content-type
 :content-type:in-reply-to:mime-version:user-agent:date:date
 :message-id:from:from:references:subject:subject:received
 :received; s=20151023; t=1564330274; bh=olWekjUVTsy6P2bL8wmEMzIX
 Dn2/snIVtsndBs70h1w=; b=cImCrWhtWBwq6jZfyFbqPrlF/ViP0rt70ZpW0wxu
 UthV+4oKCAfjtht8cIeqQ7ismMBVJS3kDL5QSxnx+WDB0lU6AnEgoGd7RTm5OHcu
 vt3J9vXsXoizlEs1cxxzbsnMZYLjvxvPrns4uihb/3gXs79dvo8moy0JLV4qg+G2
 vgI=
X-Virus-Scanned: amavisd-new at daemonic.se
Received: from mail.daemonic.se ([IPv6:::1]) (using TLS with cipher
 ECDHE-RSA-AES128-GCM-SHA256)
 by cid.daemonic.se (mailscanner.daemonic.se [IPv6:::1]) (amavisd-new,
 port 10587)
 with ESMTPS id vcm2nqpSBhOm; Sun, 28 Jul 2019 16:11:14 +0000 (UTC)
Received: from vivi.daemonic.se (vivi.daemonic.se [IPv6:2001:470:dca9:2::4])
 by mail.daemonic.se (Postfix) with ESMTPSA id 45xSVT5fw7z3c7W;
 Sun, 28 Jul 2019 16:11:13 +0000 (UTC)
Subject: Re: svn commit: r350390 - head/sys/kern
To: Alan Somers <asomers@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201907281607.x6SG7SV3080649@repo.freebsd.org>
From: Niclas Zeising <zeising+freebsd@daemonic.se>
Message-ID: <a5096797-5a6e-46ca-af28-fc4ebfd29dbc@daemonic.se>
Date: Sun, 28 Jul 2019 18:11:02 +0200
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <201907281607.x6SG7SV3080649@repo.freebsd.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: B754F6C0F2
X-Spamd-Bar: -------
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=daemonic.se header.s=20151023 header.b=cImCrWht;
 dmarc=pass (policy=none) header.from=daemonic.se;
 spf=pass (mx1.freebsd.org: domain of zeising@daemonic.se designates
 176.58.89.161 as permitted sender) smtp.mailfrom=zeising@daemonic.se
X-Spamd-Result: default: False [-7.71 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[daemonic.se:s=20151023];
 NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 IP_SCORE(-3.73)[ip: (-9.83), ipnet: 176.58.89.0/24(-4.91), asn: 36236(-3.87),
 country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4];
 MX_GOOD(-0.01)[mail.daemonic.se];
 DKIM_TRACE(0.00)[daemonic.se:+];
 DMARC_POLICY_ALLOW(-0.50)[daemonic.se,none];
 NEURAL_HAM_SHORT(-0.98)[-0.976,0]; FROM_EQ_ENVFROM(0.00)[];
 MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:36236, ipnet:176.58.89.0/24, country:US];
 TAGGED_FROM(0.00)[freebsd]; MID_RHS_MATCH_FROM(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 16:11:24 -0000

On 2019-07-28 18:07, Alan Somers wrote:
> Author: asomers
> Date: Sun Jul 28 16:07:27 2019
> New Revision: 350390
> URL: https://svnweb.freebsd.org/changeset/base/350390
> 
> Log:
>    Better comments for vlrureclaim
>    
>    MFC after:	2 weeks
>    Sponsored by:	The FreeBSD Foundation
> 
> Modified:
>    head/sys/kern/vfs_subr.c
> 
> Modified: head/sys/kern/vfs_subr.c
> ==============================================================================
> --- head/sys/kern/vfs_subr.c	Sun Jul 28 15:20:47 2019	(r350389)
> +++ head/sys/kern/vfs_subr.c	Sun Jul 28 16:07:27 2019	(r350390)
> @@ -947,9 +947,16 @@ vattr_null(struct vattr *vap)
>    * desirable to reuse such vnodes.  These conditions may cause the
>    * number of vnodes to reach some minimum value regardless of what
>    * you set kern.maxvnodes to.  Do not set kern.maxvnodes too low.
> + *
> + * @param mp		 Try to reclaim vnodes from this mountpoint
> + * @param reclaim_nc_src Only reclaim directories with outgoing namecache
> + * 			 entries if this argument is strue
> + * @param trigger	 Only reclaim vnodes with fewer than this many resident
> + *			 pages.
> + * @return		 The number of vnodes that were reclaimed.
>    */
>   static int
> -vlrureclaim(struct mount *mp, int reclaim_nc_src, int trigger)
> +vlrureclaim(struct mount *mp, bool reclaim_nc_src, int trigger)
>   {
>   	struct vnode *vp;
>   	int count, done, target;
> @@ -1238,7 +1245,8 @@ vnlru_proc(void)
>   {
>   	struct mount *mp, *nmp;
>   	unsigned long onumvnodes;
> -	int done, force, reclaim_nc_src, trigger, usevnodes;
> +	int done, force, trigger, usevnodes;
> +	bool reclaim_nc_src;
>   
>   	EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc,
>   	    SHUTDOWN_PRI_FIRST);

Was this change intended?  It's not mentioned in the commit message.
Thanks!
Regards
-- 
Niclas


From owner-svn-src-head@freebsd.org  Sun Jul 28 16:14:33 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E6B6AEC94;
 Sun, 28 Jul 2019 16:14:33 +0000 (UTC)
 (envelope-from asomers@gmail.com)
Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com
 [209.85.208.193])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id B04366C55F;
 Sun, 28 Jul 2019 16:14:32 +0000 (UTC)
 (envelope-from asomers@gmail.com)
Received: by mail-lj1-f193.google.com with SMTP id x25so56183617ljh.2;
 Sun, 28 Jul 2019 09:14:32 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=z7zft41QOnIocm4Kx6vXi2U06rgxr1GSRQjkIvjsv2s=;
 b=TNXQb6vAHmQPq271S7ur787nIuQzFC+cdpliqf1E4nIbUVHONXLXSLDFbwoJBaNLLT
 QVYQcC01se3xet8CudF5Ore+UExfvrJyKotX3c9shy4aXQ4agi8ahf7OP9TX2gMFKI8t
 wCiL+Lh6UPd3uV3XMuMGuf36ww1AGWLQlqGnIxFSGE2u1BqNSqJvn4T0xaLYWPP2+6Ic
 o/sZw6WSPKaaeJXKUs2VozXpVUZ1GHEHhPZ4k6BrSq5uSdmxDagjtJxlWIg6/rjIA7gH
 wnTc2143P5YwkMgjx31YgcBu7hq+Up/yiRo/Dytuf21O/2Hua4czocf+6O3h4NPyLqeZ
 gDFQ==
X-Gm-Message-State: APjAAAV0vv1LGUIbqRXHrVWthkwQk+P+TtPpP5+faO8oir2d5sIDR2zN
 wgaZWyH075gOB9dTkw0PaWxk4W20c1U0tjFpXP9yJQ==
X-Google-Smtp-Source: APXvYqzITniiEegWinPiwV9+7AnEr/jC865DMyo9DQpcUnbQmG7FF9haP9bzSwfcA6vp4sgiDaGOvsU/It5Ok3yRVsE=
X-Received: by 2002:a2e:1290:: with SMTP id 16mr53077476ljs.88.1564330470749; 
 Sun, 28 Jul 2019 09:14:30 -0700 (PDT)
MIME-Version: 1.0
References: <201907281607.x6SG7SV3080649@repo.freebsd.org>
 <a5096797-5a6e-46ca-af28-fc4ebfd29dbc@daemonic.se>
In-Reply-To: <a5096797-5a6e-46ca-af28-fc4ebfd29dbc@daemonic.se>
From: Alan Somers <asomers@freebsd.org>
Date: Sun, 28 Jul 2019 10:14:19 -0600
Message-ID: <CAOtMX2hP5hSVFyBR9yUsq94v3+M6ZTRsdEov0EPR4i+iJ0dDAA@mail.gmail.com>
Subject: Re: svn commit: r350390 - head/sys/kern
To: Niclas Zeising <zeising+freebsd@daemonic.se>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: B04366C55F
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates
 209.85.208.193 as permitted sender) smtp.mailfrom=asomers@gmail.com
X-Spamd-Result: default: False [-4.16 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-0.96)[-0.959,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[freebsd];
 MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org];
 MIME_TRACE(0.00)[0:+]; TO_DN_ALL(0.00)[];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 TO_MATCH_ENVRCPT_SOME(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[193.208.85.209.list.dnswl.org : 127.0.5.0];
 NEURAL_HAM_SHORT(-0.92)[-0.916,0]; RCVD_TLS_LAST(0.00)[];
 FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com];
 RWL_MAILSPIKE_POSSIBLE(0.00)[193.208.85.209.rep.mailspike.net : 127.0.0.17];
 R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com];
 IP_SCORE(-1.27)[ip: (-0.46), ipnet: 209.85.128.0/17(-3.42), asn: 15169(-2.44),
 country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 16:14:33 -0000

On Sun, Jul 28, 2019 at 10:11 AM Niclas Zeising
<zeising+freebsd@daemonic.se> wrote:
>
> On 2019-07-28 18:07, Alan Somers wrote:
> > Author: asomers
> > Date: Sun Jul 28 16:07:27 2019
> > New Revision: 350390
> > URL: https://svnweb.freebsd.org/changeset/base/350390
> >
> > Log:
> >    Better comments for vlrureclaim
> >
> >    MFC after: 2 weeks
> >    Sponsored by:      The FreeBSD Foundation
> >
> > Modified:
> >    head/sys/kern/vfs_subr.c
> >
> > Modified: head/sys/kern/vfs_subr.c
> > ==============================================================================
> > --- head/sys/kern/vfs_subr.c  Sun Jul 28 15:20:47 2019        (r350389)
> > +++ head/sys/kern/vfs_subr.c  Sun Jul 28 16:07:27 2019        (r350390)
> > @@ -947,9 +947,16 @@ vattr_null(struct vattr *vap)
> >    * desirable to reuse such vnodes.  These conditions may cause the
> >    * number of vnodes to reach some minimum value regardless of what
> >    * you set kern.maxvnodes to.  Do not set kern.maxvnodes too low.
> > + *
> > + * @param mp          Try to reclaim vnodes from this mountpoint
> > + * @param reclaim_nc_src Only reclaim directories with outgoing namecache
> > + *                    entries if this argument is strue
> > + * @param trigger     Only reclaim vnodes with fewer than this many resident
> > + *                    pages.
> > + * @return            The number of vnodes that were reclaimed.
> >    */
> >   static int
> > -vlrureclaim(struct mount *mp, int reclaim_nc_src, int trigger)
> > +vlrureclaim(struct mount *mp, bool reclaim_nc_src, int trigger)
> >   {
> >       struct vnode *vp;
> >       int count, done, target;
> > @@ -1238,7 +1245,8 @@ vnlru_proc(void)
> >   {
> >       struct mount *mp, *nmp;
> >       unsigned long onumvnodes;
> > -     int done, force, reclaim_nc_src, trigger, usevnodes;
> > +     int done, force, trigger, usevnodes;
> > +     bool reclaim_nc_src;
> >
> >       EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc,
> >           SHUTDOWN_PRI_FIRST);
>
> Was this change intended?  It's not mentioned in the commit message.
> Thanks!
> Regards
> --
> Niclas

Yes, it was intended.  Since it makes no difference at runtime, I
thought of the type change as basically being documentation.  That's
why I didn't explicitly mention it.
-Alan

From owner-svn-src-head@freebsd.org  Sun Jul 28 16:27:24 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38AF7AEFA7;
 Sun, 28 Jul 2019 16:27:24 +0000 (UTC)
 (envelope-from zeising+freebsd@daemonic.se)
Received: from mail.daemonic.se (mail.daemonic.se [176.58.89.161])
 (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 C40A46CCFD;
 Sun, 28 Jul 2019 16:27:22 +0000 (UTC)
 (envelope-from zeising+freebsd@daemonic.se)
Received: from cid.daemonic.se (localhost [IPv6:::1])
 by mail.daemonic.se (Postfix) with ESMTP id 45xSs52c82z3ktq;
 Sun, 28 Jul 2019 16:27:21 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=daemonic.se; h=
 content-transfer-encoding:content-language:content-type
 :content-type:in-reply-to:mime-version:user-agent:date:date
 :message-id:from:from:references:subject:subject:received
 :received; s=20151023; t=1564331240; bh=l0jAwBEAgJ3wpg4pvFEea/Hd
 7zjl630f45NkfJORKlc=; b=oOFs4jAiB+QkC7JWI1/+2+SLNWfvE9ERk2HkD8Hb
 TYgmvJxRKAeADZ3FbaQz9c2+AJUJs38pMy6sufthI823Mi29J5wO5RUA7bmfx46I
 nnc1zQJmgia1o7ilBt0Catv6HW49hTjzcUV1ltmHAkRdednlaORy2hakE6S0MuUK
 RHE=
X-Virus-Scanned: amavisd-new at daemonic.se
Received: from mail.daemonic.se ([127.0.0.1]) (using TLS with cipher
 ECDHE-RSA-AES128-GCM-SHA256)
 by cid.daemonic.se (mailscanner.daemonic.se [127.0.0.1]) (amavisd-new,
 port 10587)
 with ESMTPS id pJM3Vn90v0zz; Sun, 28 Jul 2019 16:27:20 +0000 (UTC)
Received: from vivi.daemonic.se (vivi.daemonic.se [IPv6:2001:470:dca9:2::4])
 by mail.daemonic.se (Postfix) with ESMTPSA id 45xSs26BKVz3ktp;
 Sun, 28 Jul 2019 16:27:18 +0000 (UTC)
Subject: Re: svn commit: r350390 - head/sys/kern
To: Alan Somers <asomers@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
References: <201907281607.x6SG7SV3080649@repo.freebsd.org>
 <a5096797-5a6e-46ca-af28-fc4ebfd29dbc@daemonic.se>
 <CAOtMX2hP5hSVFyBR9yUsq94v3+M6ZTRsdEov0EPR4i+iJ0dDAA@mail.gmail.com>
From: Niclas Zeising <zeising+freebsd@daemonic.se>
Message-ID: <1a4155c0-8c32-7424-9482-0f257b16beac@daemonic.se>
Date: Sun, 28 Jul 2019 18:27:14 +0200
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <CAOtMX2hP5hSVFyBR9yUsq94v3+M6ZTRsdEov0EPR4i+iJ0dDAA@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: C40A46CCFD
X-Spamd-Bar: -------
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=daemonic.se header.s=20151023 header.b=oOFs4jAi;
 dmarc=pass (policy=none) header.from=daemonic.se;
 spf=pass (mx1.freebsd.org: domain of zeising@daemonic.se designates
 176.58.89.161 as permitted sender) smtp.mailfrom=zeising@daemonic.se
X-Spamd-Result: default: False [-7.70 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[daemonic.se:s=20151023];
 NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 IP_SCORE(-3.73)[ip: (-9.83), ipnet: 176.58.89.0/24(-4.91), asn: 36236(-3.87),
 country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[];
 DKIM_TRACE(0.00)[daemonic.se:+];
 MX_GOOD(-0.01)[cached: mail.daemonic.se];
 DMARC_POLICY_ALLOW(-0.50)[daemonic.se,none];
 NEURAL_HAM_SHORT(-0.97)[-0.970,0]; FROM_EQ_ENVFROM(0.00)[];
 MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:36236, ipnet:176.58.89.0/24, country:US];
 TAGGED_FROM(0.00)[freebsd]; MID_RHS_MATCH_FROM(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 16:27:24 -0000

On 2019-07-28 18:14, Alan Somers wrote:
> On Sun, Jul 28, 2019 at 10:11 AM Niclas Zeising
> <zeising+freebsd@daemonic.se> wrote:
>>
>> On 2019-07-28 18:07, Alan Somers wrote:
>>> Author: asomers
>>> Date: Sun Jul 28 16:07:27 2019
>>> New Revision: 350390
>>> URL: https://svnweb.freebsd.org/changeset/base/350390
>>>
>>> Log:
>>>     Better comments for vlrureclaim
>>>
>>>     MFC after: 2 weeks
>>>     Sponsored by:      The FreeBSD Foundation
>>>
>>> Modified:
>>>     head/sys/kern/vfs_subr.c
>>>
>>> Modified: head/sys/kern/vfs_subr.c
>>> ==============================================================================
>>> --- head/sys/kern/vfs_subr.c  Sun Jul 28 15:20:47 2019        (r350389)
>>> +++ head/sys/kern/vfs_subr.c  Sun Jul 28 16:07:27 2019        (r350390)
>>> @@ -947,9 +947,16 @@ vattr_null(struct vattr *vap)
>>>     * desirable to reuse such vnodes.  These conditions may cause the
>>>     * number of vnodes to reach some minimum value regardless of what
>>>     * you set kern.maxvnodes to.  Do not set kern.maxvnodes too low.
>>> + *
>>> + * @param mp          Try to reclaim vnodes from this mountpoint
>>> + * @param reclaim_nc_src Only reclaim directories with outgoing namecache
>>> + *                    entries if this argument is strue
>>> + * @param trigger     Only reclaim vnodes with fewer than this many resident
>>> + *                    pages.
>>> + * @return            The number of vnodes that were reclaimed.
>>>     */
>>>    static int
>>> -vlrureclaim(struct mount *mp, int reclaim_nc_src, int trigger)
>>> +vlrureclaim(struct mount *mp, bool reclaim_nc_src, int trigger)
>>>    {
>>>        struct vnode *vp;
>>>        int count, done, target;
>>> @@ -1238,7 +1245,8 @@ vnlru_proc(void)
>>>    {
>>>        struct mount *mp, *nmp;
>>>        unsigned long onumvnodes;
>>> -     int done, force, reclaim_nc_src, trigger, usevnodes;
>>> +     int done, force, trigger, usevnodes;
>>> +     bool reclaim_nc_src;
>>>
>>>        EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc,
>>>            SHUTDOWN_PRI_FIRST);
>>
>> Was this change intended?  It's not mentioned in the commit message.
>> Thanks!
>> Regards
>> --
>> Niclas
> 
> Yes, it was intended.  Since it makes no difference at runtime, I
> thought of the type change as basically being documentation.  That's
> why I didn't explicitly mention it.

Ok!
Thank you for the explanation.
Regards
-- 
Niclas

From owner-svn-src-head@freebsd.org  Sun Jul 28 19:32:24 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 728C5B25A1;
 Sun, 28 Jul 2019 19:32:24 +0000 (UTC)
 (envelope-from dougm@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4D29773290;
 Sun, 28 Jul 2019 19:32:24 +0000 (UTC)
 (envelope-from dougm@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24AF01C933;
 Sun, 28 Jul 2019 19:32:24 +0000 (UTC)
 (envelope-from dougm@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6SJWO8u006577;
 Sun, 28 Jul 2019 19:32:24 GMT (envelope-from dougm@FreeBSD.org)
Received: (from dougm@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6SJWOFw006576;
 Sun, 28 Jul 2019 19:32:24 GMT (envelope-from dougm@FreeBSD.org)
Message-Id: <201907281932.x6SJWOFw006576@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: dougm set sender to
 dougm@FreeBSD.org using -f
From: Doug Moore <dougm@FreeBSD.org>
Date: Sun, 28 Jul 2019 19:32:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350392 - head/sys/vm
X-SVN-Group: head
X-SVN-Commit-Author: dougm
X-SVN-Commit-Paths: head/sys/vm
X-SVN-Commit-Revision: 350392
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4D29773290
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.991,0];
 NEURAL_HAM_SHORT(-0.96)[-0.959,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 19:32:24 -0000

Author: dougm
Date: Sun Jul 28 19:32:23 2019
New Revision: 350392
URL: https://svnweb.freebsd.org/changeset/base/350392

Log:
  In swap_pager_putpages, move the initialization of a free-blocks
  counter, and the final freeing of freed swap blocks, outside the
  region where an object lock is held.  Correct some style(9) and
  spelling errors.  Change a panic() to a KASSERT().  Change a boolean_t
  to a bool.
  
  Suggested by: alc
  Reviewed by: alc
  Approved by: kib, markj (mentors)
  Differential Revision: https://reviews.freebsd.org/D21093

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==============================================================================
--- head/sys/vm/swap_pager.c	Sun Jul 28 16:22:50 2019	(r350391)
+++ head/sys/vm/swap_pager.c	Sun Jul 28 19:32:23 2019	(r350392)
@@ -1332,31 +1332,27 @@ swap_pager_getpages_async(vm_object_t object, vm_page_
  *	completion.
  *
  *	The parent has soft-busy'd the pages it passes us and will unbusy
- *	those whos rtvals[] entry is not set to VM_PAGER_PEND on return.
+ *	those whose rtvals[] entry is not set to VM_PAGER_PEND on return.
  *	We need to unbusy the rest on I/O completion.
  */
 static void
 swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
     int flags, int *rtvals)
 {
-	int i, n;
-	boolean_t sync;
-	daddr_t addr, n_free, s_free;
+	struct buf *bp;
+	daddr_t addr, blk, n_free, s_free;
+	vm_page_t mreq;
+	int i, j, n;
+	bool async;
 
-	swp_pager_init_freerange(&s_free, &n_free);
-	if (count && ma[0]->object != object) {
-		panic("swap_pager_putpages: object mismatch %p/%p",
-		    object,
-		    ma[0]->object
-		);
-	}
+	KASSERT(count == 0 || ma[0]->object == object,
+	    ("%s: object mismatch %p/%p",
+	    __func__, object, ma[0]->object));
 
 	/*
 	 * Step 1
 	 *
-	 * Turn object into OBJT_SWAP
-	 * check for bogus sysops
-	 * force sync if not pageout process
+	 * Turn object into OBJT_SWAP.  Force sync if not a pageout process.
 	 */
 	if (object->type != OBJT_SWAP) {
 		addr = swp_pager_meta_build(object, 0, SWAPBLK_NONE);
@@ -1364,13 +1360,9 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 		    ("unexpected object swap block"));
 	}
 	VM_OBJECT_WUNLOCK(object);
+	async = curproc == pageproc && (flags & VM_PAGER_PUT_SYNC) == 0;
+	swp_pager_init_freerange(&s_free, &n_free);
 
-	n = 0;
-	if (curproc != pageproc)
-		sync = TRUE;
-	else
-		sync = (flags & VM_PAGER_PUT_SYNC) != 0;
-
 	/*
 	 * Step 2
 	 *
@@ -1379,10 +1371,6 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 	 * successfully.
 	 */
 	for (i = 0; i < count; i += n) {
-		int j;
-		struct buf *bp;
-		daddr_t blk;
-
 		/* Maximum I/O size is limited by maximum swap block size. */
 		n = min(count - i, nsw_cluster_max);
 
@@ -1390,15 +1378,15 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 		blk = swp_pager_getswapspace(&n, 4);
 		if (blk == SWAPBLK_NONE) {
 			for (j = 0; j < n; ++j)
-				rtvals[i+j] = VM_PAGER_FAIL;
+				rtvals[i + j] = VM_PAGER_FAIL;
 			continue;
 		}
 
 		/*
-		 * All I/O parameters have been satisfied, build the I/O
+		 * All I/O parameters have been satisfied.  Build the I/O
 		 * request and assign the swap space.
 		 */
-		if (sync != TRUE) {
+		if (async) {
 			mtx_lock(&swbuf_mtx);
 			while (nsw_wcount_async == 0)
 				msleep(&nsw_wcount_async, &swbuf_mtx, PVM,
@@ -1407,7 +1395,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 			mtx_unlock(&swbuf_mtx);
 		}
 		bp = uma_zalloc(swwbuf_zone, M_WAITOK);
-		if (sync != TRUE)
+		if (async)
 			bp->b_flags = B_ASYNC;
 		bp->b_flags |= B_PAGING;
 		bp->b_iocmd = BIO_WRITE;
@@ -1420,8 +1408,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 
 		VM_OBJECT_WLOCK(object);
 		for (j = 0; j < n; ++j) {
-			vm_page_t mreq = ma[i+j];
-
+			mreq = ma[i + j];
 			addr = swp_pager_meta_build(mreq->object, mreq->pindex,
 			    blk + j);
 			if (addr != SWAPBLK_NONE)
@@ -1455,9 +1442,9 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 		/*
 		 * asynchronous
 		 *
-		 * NOTE: b_blkno is destroyed by the call to swapdev_strategy
+		 * NOTE: b_blkno is destroyed by the call to swapdev_strategy.
 		 */
-		if (sync == FALSE) {
+		if (async) {
 			bp->b_iodone = swp_pager_async_iodone;
 			BUF_KERNPROC(bp);
 			swp_pager_strategy(bp);
@@ -1467,7 +1454,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 		/*
 		 * synchronous
 		 *
-		 * NOTE: b_blkno is destroyed by the call to swapdev_strategy
+		 * NOTE: b_blkno is destroyed by the call to swapdev_strategy.
 		 */
 		bp->b_iodone = bdone;
 		swp_pager_strategy(bp);
@@ -1483,8 +1470,8 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma,
 		 */
 		swp_pager_async_iodone(bp);
 	}
-	VM_OBJECT_WLOCK(object);
 	swp_pager_freeswapspace(s_free, n_free);
+	VM_OBJECT_WLOCK(object);
 }
 
 /*

From owner-svn-src-head@freebsd.org  Sun Jul 28 20:17:41 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 864D6B301F;
 Sun, 28 Jul 2019 20:17:41 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 6632074EDC;
 Sun, 28 Jul 2019 20:17:41 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E0B91D0E3;
 Sun, 28 Jul 2019 20:17:41 +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 x6SKHfns031332;
 Sun, 28 Jul 2019 20:17:41 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6SKHew3031330;
 Sun, 28 Jul 2019 20:17:40 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907282017.x6SKHew3031330@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Sun, 28 Jul 2019 20:17:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350393 - in head: sbin/camcontrol sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head: sbin/camcontrol sys/sys
X-SVN-Commit-Revision: 350393
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 6632074EDC
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.991,0];
 NEURAL_HAM_SHORT(-0.96)[-0.959,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 20:17:41 -0000

Author: mav
Date: Sun Jul 28 20:17:40 2019
New Revision: 350393
URL: https://svnweb.freebsd.org/changeset/base/350393

Log:
  Decode some more IDENTIFY DEVICE bits.
  
  MFC after:	2 weeks

Modified:
  head/sbin/camcontrol/camcontrol.c
  head/sys/sys/ata.h

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Sun Jul 28 19:32:23 2019	(r350392)
+++ head/sbin/camcontrol/camcontrol.c	Sun Jul 28 20:17:40 2019	(r350393)
@@ -1521,6 +1521,7 @@ atacapprint(struct ata_params *parm)
 		printf("WWN                   %04x%04x%04x%04x\n",
 		    parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]);
 	}
+	printf("additional product id %.8s\n", parm->product_id);
 	if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) {
 		printf("media serial number   %.30s\n",
 		    parm->media_serial);
@@ -1650,35 +1651,39 @@ atacapprint(struct ata_params *parm)
 		} else
 			printf("\n");
 	printf("Native Command Queuing (NCQ)   ");
-	if (parm->satacapabilities != 0xffff &&
-	    (parm->satacapabilities & ATA_SUPPORT_NCQ)) {
+	if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) {
 		printf("yes		%d tags\n",
 		    ATA_QUEUE_LEN(parm->queue) + 1);
+		printf("NCQ Priority Information       %s\n",
+		    parm->satacapabilities & ATA_SUPPORT_NCQ_PRIO ?
+		    "yes" : "no");
+		printf("NCQ Non-Data Command           %s\n",
+		    parm->satacapabilities2 & ATA_SUPPORT_NCQ_NON_DATA ?
+		    "yes" : "no");
+		printf("NCQ Streaming                  %s\n",
+		    parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ?
+		    "yes" : "no");
+		printf("Receive & Send FPDMA Queued    %s\n",
+		    parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
+		    "yes" : "no");
+		printf("NCQ Autosense                  %s\n",
+		    parm->satasupport & ATA_SUPPORT_NCQ_AUTOSENSE ?
+		    "yes" : "no");
 	} else
 		printf("no\n");
 
-	printf("NCQ Queue Management           %s\n", atasata(parm) &&
-		parm->satacapabilities2 & ATA_SUPPORT_NCQ_QMANAGEMENT ?
-		"yes" : "no");
-	printf("NCQ Streaming                  %s\n", atasata(parm) &&
-		parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ?
-		"yes" : "no");
-	printf("Receive & Send FPDMA Queued    %s\n", atasata(parm) &&
-		parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
-		"yes" : "no");
-
 	printf("SMART                          %s	%s\n",
 		parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no",
 		parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no");
-	printf("microcode download             %s	%s\n",
-		parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no",
-		parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no");
 	printf("security                       %s	%s\n",
 		parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no",
 		parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no");
 	printf("power management               %s	%s\n",
 		parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no",
 		parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no");
+	printf("microcode download             %s	%s\n",
+		parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no",
+		parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no");
 	printf("advanced power management      %s	%s",
 		parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no",
 		parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no");
@@ -1721,6 +1726,15 @@ atacapprint(struct ata_params *parm)
 	printf("free-fall                      %s	%s\n",
 		parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no",
 		parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no");
+	printf("sense data reporting           %s	%s\n",
+		parm->support2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no",
+		parm->enabled2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no");
+	printf("extended power conditions      %s	%s\n",
+		parm->support2 & ATA_SUPPORT_EPC ? "yes" : "no",
+		parm->enabled2 & ATA_SUPPORT_EPC ? "yes" : "no");
+	printf("device statistics notification %s	%s\n",
+		parm->support2 & ATA_SUPPORT_DSN ? "yes" : "no",
+		parm->enabled2 & ATA_SUPPORT_DSN ? "yes" : "no");
 	printf("Data Set Management (DSM/TRIM) ");
 	if (parm->support_dsm & ATA_SUPPORT_DSM_TRIM) {
 		printf("yes\n");
@@ -1743,6 +1757,8 @@ atacapprint(struct ata_params *parm)
 	} else {
 		printf("no\n");
 	}
+	printf("encrypts all user data         %s\n",
+		parm->support3 & ATA_ENCRYPTS_ALL_USER_DATA ? "yes" : "no");
 	printf("Sanitize                       ");
 	if (parm->multi & ATA_SUPPORT_SANITIZE) {
 		printf("yes\t\t%s%s%s\n",

Modified: head/sys/sys/ata.h
==============================================================================
--- head/sys/sys/ata.h	Sun Jul 28 19:32:23 2019	(r350392)
+++ head/sys/sys/ata.h	Sun Jul 28 20:17:40 2019	(r350393)
@@ -143,7 +143,8 @@ struct ata_params {
 /*77*/  u_int16_t       satacapabilities2;
 #define ATA_SATA_CURR_GEN_MASK          0x0006
 #define ATA_SUPPORT_NCQ_STREAM          0x0010
-#define ATA_SUPPORT_NCQ_QMANAGEMENT     0x0020
+#define ATA_SUPPORT_NCQ_NON_DATA        0x0020
+#define ATA_SUPPORT_NCQ_QMANAGEMENT     ATA_SUPPORT_NCQ_NON_DATA
 #define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040
 /*78*/  u_int16_t       satasupport;
 #define ATA_SUPPORT_NONZERO             0x0002
@@ -152,6 +153,7 @@ struct ata_params {
 #define ATA_SUPPORT_INORDERDATA         0x0010
 #define ATA_SUPPORT_ASYNCNOTIF          0x0020
 #define ATA_SUPPORT_SOFTSETPRESERVE     0x0040
+#define ATA_SUPPORT_NCQ_AUTOSENSE       0x0080
 /*79*/  u_int16_t       sataenabled;
 #define ATA_ENABLED_DAPST               0x0080
 
@@ -285,7 +287,8 @@ struct ata_params {
 #define ATA_FORM_FACTOR_C_FAST		0x0009
 /*169*/	u_int16_t       support_dsm;
 #define ATA_SUPPORT_DSM_TRIM		0x0001
-	u_int16_t       reserved170[6];
+/*170*/ u_int8_t        product_id[8];	/* Additional Product Identifier */
+	u_int16_t       reserved174[2];
 /*176*/ u_int8_t        media_serial[60];
 /*206*/ u_int16_t       sct;
 	u_int16_t       reserved207[2];

From owner-svn-src-head@freebsd.org  Sun Jul 28 21:44:01 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE5A6B5C5D;
 Sun, 28 Jul 2019 21:44:01 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9945580D4B;
 Sun, 28 Jul 2019 21:44:01 +0000 (UTC)
 (envelope-from rmacklem@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DD681E2F2;
 Sun, 28 Jul 2019 21:44:01 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6SLi1e1085124;
 Sun, 28 Jul 2019 21:44:01 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6SLi1B6085123;
 Sun, 28 Jul 2019 21:44:01 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907282144.x6SLi1B6085123@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Sun, 28 Jul 2019 21:44:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350395 - head/usr.bin/nfsstat
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head/usr.bin/nfsstat
X-SVN-Commit-Revision: 350395
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 9945580D4B
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.94 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.991,0];
 NEURAL_HAM_SHORT(-0.95)[-0.951,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 21:44:01 -0000

Author: rmacklem
Date: Sun Jul 28 21:44:01 2019
New Revision: 350395
URL: https://svnweb.freebsd.org/changeset/base/350395

Log:
  Fix printing of Server Re-Failed and Server Faults.
  
  nfsstat -s prints bogus large numbers for the Server Re-Failed and Server
  Faults fields. This was introduced by r328588.
  Although I know nothing about libxo, these lines aren't titles and this
  patch seems to fix the problem, so I am committing it for rea@ who emailed
  it to me.
  It also deleted the trailing ':' from the title lines, since those were not
  in the pre-r328588 output.
  
  If there is a more correct fix, someone conversant with libxo will need
  to do so.
  
  Submitted by:	rea
  MFC after:	2 weeks

Modified:
  head/usr.bin/nfsstat/nfsstat.c

Modified: head/usr.bin/nfsstat/nfsstat.c
==============================================================================
--- head/usr.bin/nfsstat/nfsstat.c	Sun Jul 28 21:37:38 2019	(r350394)
+++ head/usr.bin/nfsstat/nfsstat.c	Sun Jul 28 21:44:01 2019	(r350395)
@@ -460,11 +460,11 @@ intpr(int clientOnly, int serverOnly)
 		xo_close_container("operations");
 
 		xo_open_container("server");
-		xo_emit("{T:Server Re-Failed:}\n");
-		xo_emit("{T:retfailed/%17ju}\n", (uintmax_t)ext_nfsstats.srvrpc_errs);
+		xo_emit("{T:Server Re-Failed}\n");
+		xo_emit("{:retfailed/%16ju}\n", (uintmax_t)ext_nfsstats.srvrpc_errs);
 
-		xo_emit("{T:Server Faults:}\n");
-		xo_emit("{T:faults/%13ju}\n", (uintmax_t)ext_nfsstats.srv_errs);
+		xo_emit("{T:Server Faults}\n");
+		xo_emit("{:faults/%13ju}\n", (uintmax_t)ext_nfsstats.srv_errs);
 
 		xo_emit("{T:Server Write Gathering:/%13.13s}\n");
 

From owner-svn-src-head@freebsd.org  Sun Jul 28 21:47:05 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EFF4B5DA4;
 Sun, 28 Jul 2019 21:47:05 +0000 (UTC)
 (envelope-from hselasky@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4EF1180F41;
 Sun, 28 Jul 2019 21:47:05 +0000 (UTC)
 (envelope-from hselasky@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2592E1E30B;
 Sun, 28 Jul 2019 21:47:05 +0000 (UTC)
 (envelope-from hselasky@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6SLl4bM085323;
 Sun, 28 Jul 2019 21:47:04 GMT (envelope-from hselasky@FreeBSD.org)
Received: (from hselasky@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6SLl4nh085322;
 Sun, 28 Jul 2019 21:47:04 GMT (envelope-from hselasky@FreeBSD.org)
Message-Id: <201907282147.x6SLl4nh085322@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: hselasky set sender to
 hselasky@FreeBSD.org using -f
From: Hans Petter Selasky <hselasky@FreeBSD.org>
Date: Sun, 28 Jul 2019 21:47:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350396 - head/sys/dev/usb/net
X-SVN-Group: head
X-SVN-Commit-Author: hselasky
X-SVN-Commit-Paths: head/sys/dev/usb/net
X-SVN-Commit-Revision: 350396
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4EF1180F41
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.94 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.991,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.951,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jul 2019 21:47:05 -0000

Author: hselasky
Date: Sun Jul 28 21:47:04 2019
New Revision: 350396
URL: https://svnweb.freebsd.org/changeset/base/350396

Log:
  Add support for tethering with Nokia 7 plus and the alike.
  
  PR:		239495
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/usb/net/if_urndis.c

Modified: head/sys/dev/usb/net/if_urndis.c
==============================================================================
--- head/sys/dev/usb/net/if_urndis.c	Sun Jul 28 21:44:01 2019	(r350395)
+++ head/sys/dev/usb/net/if_urndis.c	Sun Jul 28 21:47:04 2019	(r350396)
@@ -175,6 +175,9 @@ static const STRUCT_USB_HOST_ID urndis_host_devs[] = {
 	{USB_VENDOR(USB_VENDOR_PALM), USB_IFACE_CLASS(UICLASS_CDC),
 		USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL),
 		USB_IFACE_PROTOCOL(0xff)},
+	/* Nokia 7 plus */
+	{USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(0x4),
+		USB_IFACE_PROTOCOL(UIPROTO_ACTIVESYNC)},
 };
 
 DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, NULL);

From owner-svn-src-head@freebsd.org  Mon Jul 29 03:28:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32DFBBBC23;
 Mon, 29 Jul 2019 03:28:47 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 157768B5AC;
 Mon, 29 Jul 2019 03:28:47 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9B38220F9;
 Mon, 29 Jul 2019 03:28:46 +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 x6T3SkZo088931;
 Mon, 29 Jul 2019 03:28:46 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T3SksA088929;
 Mon, 29 Jul 2019 03:28:46 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907290328.x6T3SksA088929@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Mon, 29 Jul 2019 03:28:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350399 - in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Commit-Revision: 350399
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 157768B5AC
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.97)[-0.965,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 03:28:47 -0000

Author: mav
Date: Mon Jul 29 03:28:46 2019
New Revision: 350399
URL: https://svnweb.freebsd.org/changeset/base/350399

Log:
  Add some new fields and bits from NVMe 1.4.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sbin/nvmecontrol/identify_ext.c
  head/sys/dev/nvme/nvme.h

Modified: head/sbin/nvmecontrol/identify_ext.c
==============================================================================
--- head/sbin/nvmecontrol/identify_ext.c	Mon Jul 29 01:00:41 2019	(r350398)
+++ head/sbin/nvmecontrol/identify_ext.c	Mon Jul 29 03:28:46 2019	(r350399)
@@ -49,7 +49,7 @@ nvme_print_controller(struct nvme_controller_data *cda
 	uint8_t str[128];
 	char cbuf[UINT128_DIG + 1];
 	uint16_t oncs, oacs;
-	uint8_t compare, write_unc, dsm, vwc_present;
+	uint8_t compare, write_unc, dsm, t;
 	uint8_t security, fmt, fw, nsmgmt;
 	uint8_t	fw_slot1_ro, fw_num_slots;
 	uint8_t ns_smart;
@@ -63,8 +63,6 @@ nvme_print_controller(struct nvme_controller_data *cda
 		NVME_CTRLR_DATA_ONCS_WRITE_UNC_MASK;
 	dsm = (oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) &
 		NVME_CTRLR_DATA_ONCS_DSM_MASK;
-	vwc_present = (cdata->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
-		NVME_CTRLR_DATA_VWC_PRESENT_MASK;
 
 	oacs = cdata->oacs;
 	security = (oacs >> NVME_CTRLR_DATA_OACS_SECURITY_SHIFT) &
@@ -107,8 +105,10 @@ nvme_print_controller(struct nvme_controller_data *cda
 	printf("Recommended Arb Burst:       %d\n", cdata->rab);
 	printf("IEEE OUI Identifier:         %02x %02x %02x\n",
 		cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]);
-	printf("Multi-Path I/O Capabilities: %s%s%s%s\n",
+	printf("Multi-Path I/O Capabilities: %s%s%s%s%s\n",
 	    (cdata->mic == 0) ? "Not Supported" : "",
+	    ((cdata->mic >> NVME_CTRLR_DATA_MIC_ANAR_SHIFT) &
+	     NVME_CTRLR_DATA_MIC_SRIOVVF_MASK) ? "Asymmetric, " : "",
 	    ((cdata->mic >> NVME_CTRLR_DATA_MIC_SRIOVVF_SHIFT) &
 	     NVME_CTRLR_DATA_MIC_SRIOVVF_MASK) ? "SR-IOV VF, " : "",
 	    ((cdata->mic >> NVME_CTRLR_DATA_MIC_MCTRLRS_SHIFT) &
@@ -149,9 +149,24 @@ nvme_print_controller(struct nvme_controller_data *cda
 	printf("Virtualization Management:   %sSupported\n",
 	    ((oacs >> NVME_CTRLR_DATA_OACS_VM_SHIFT) &
 	     NVME_CTRLR_DATA_OACS_VM_MASK) ? "" : "Not ");
-	printf("Doorbell Buffer Config       %sSupported\n",
+	printf("Doorbell Buffer Config:      %sSupported\n",
 	    ((oacs >> NVME_CTRLR_DATA_OACS_DBBUFFER_SHIFT) &
 	     NVME_CTRLR_DATA_OACS_DBBUFFER_MASK) ? "" : "Not ");
+	printf("Get LBA Status:              %sSupported\n",
+	    ((oacs >> NVME_CTRLR_DATA_OACS_GETLBA_SHIFT) &
+	     NVME_CTRLR_DATA_OACS_GETLBA_MASK) ? "" : "Not ");
+	printf("Sanitize:                    ");
+	if (cdata->sanicap != 0) {
+		printf("%s%s%s\n",
+		    ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_CES_SHIFT) &
+		     NVME_CTRLR_DATA_SANICAP_CES_SHIFT) ? "crypto, " : "",
+		    ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) &
+		     NVME_CTRLR_DATA_SANICAP_BES_SHIFT) ? "block, " : "",
+		    ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) &
+		     NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) ? "overwrite" : "");
+	} else {
+		printf("Not Supported\n");
+	}
 	printf("Abort Command Limit:         %d\n", cdata->acl+1);
 	printf("Async Event Request Limit:   %d\n", cdata->aerl+1);
 	printf("Number of Firmware Slots:    ");
@@ -197,6 +212,9 @@ nvme_print_controller(struct nvme_controller_data *cda
 	printf("Timestamp feature:           %sSupported\n",
 	    ((oncs >> NVME_CTRLR_DATA_ONCS_TIMESTAMP_SHIFT) &
 	     NVME_CTRLR_DATA_ONCS_TIMESTAMP_MASK) ? "" : "Not ");
+	printf("Verify feature:              %sSupported\n",
+	    ((oncs >> NVME_CTRLR_DATA_ONCS_VERIFY_SHIFT) &
+	     NVME_CTRLR_DATA_ONCS_VERIFY_MASK) ? "" : "Not ");
 	printf("Fused Operation Support:     %s%s\n",
 	    (cdata->fuses == 0) ? "Not Supported" : "",
 	    ((cdata->fuses >> NVME_CTRLR_DATA_FUSES_CNW_SHIFT) &
@@ -208,8 +226,13 @@ nvme_print_controller(struct nvme_controller_data *cda
 	     NVME_CTRLR_DATA_FNA_ERASE_ALL_MASK) ? "All-NVM" : "Per-NS",
 	    ((cdata->fna >> NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT) &
 	     NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK) ? "All-NVM" : "Per-NS");
-	printf("Volatile Write Cache:        %s\n",
-		vwc_present ? "Present" : "Not Present");
+	t = (cdata->vwc >> NVME_CTRLR_DATA_VWC_ALL_SHIFT) &
+	    NVME_CTRLR_DATA_VWC_ALL_MASK;
+	printf("Volatile Write Cache:        %s%s\n",
+	    ((cdata->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
+	     NVME_CTRLR_DATA_VWC_PRESENT_MASK) ? "Present" : "Not Present",
+	    (t == NVME_CTRLR_DATA_VWC_ALL_NO) ? ", no flush all" :
+	    (t == NVME_CTRLR_DATA_VWC_ALL_YES) ? ", flush all" : "");
 
 	if (nsmgmt) {
 		printf("\n");

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h	Mon Jul 29 01:00:41 2019	(r350398)
+++ head/sys/dev/nvme/nvme.h	Mon Jul 29 03:28:46 2019	(r350399)
@@ -175,6 +175,9 @@
 /* SR-IOV Virtual Function */
 #define NVME_CTRLR_DATA_MIC_SRIOVVF_SHIFT		(2)
 #define NVME_CTRLR_DATA_MIC_SRIOVVF_MASK		(0x1)
+/* Asymmetric Namespace Access Reporting */
+#define NVME_CTRLR_DATA_MIC_ANAR_SHIFT			(3)
+#define NVME_CTRLR_DATA_MIC_ANAR_MASK			(0x1)
 
 /** OACS - optional admin command support */
 /* supports security send/receive commands */
@@ -204,6 +207,9 @@
 /* supports Doorbell Buffer Config */
 #define NVME_CTRLR_DATA_OACS_DBBUFFER_SHIFT		(8)
 #define NVME_CTRLR_DATA_OACS_DBBUFFER_MASK		(0x1)
+/* supports Get LBA Status */
+#define NVME_CTRLR_DATA_OACS_GETLBA_SHIFT		(9)
+#define NVME_CTRLR_DATA_OACS_GETLBA_MASK		(0x1)
 
 /** firmware updates */
 /* first slot is read-only */
@@ -212,6 +218,9 @@
 /* number of firmware slots */
 #define NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT		(1)
 #define NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK		(0x7)
+/* firmware activation without reset */
+#define NVME_CTRLR_DATA_FRMW_ACT_WO_RESET_SHIFT		(4)
+#define NVME_CTRLR_DATA_FRMW_ACT_WO_RESET_MASK		(0x1)
 
 /** log page attributes */
 /* per namespace smart/health log page */
@@ -228,6 +237,26 @@
 #define NVME_CTRLR_DATA_APSTA_APST_SUPP_SHIFT		(0)
 #define NVME_CTRLR_DATA_APSTA_APST_SUPP_MASK		(0x1)
 
+/** Sanitize Capabilities */
+/* Crypto Erase Support  */
+#define NVME_CTRLR_DATA_SANICAP_CES_SHIFT		(0)
+#define NVME_CTRLR_DATA_SANICAP_CES_MASK		(0x1)
+/* Block Erase Support */
+#define NVME_CTRLR_DATA_SANICAP_BES_SHIFT		(1)
+#define NVME_CTRLR_DATA_SANICAP_BES_MASK		(0x1)
+/* Overwrite Support */
+#define NVME_CTRLR_DATA_SANICAP_OWS_SHIFT		(2)
+#define NVME_CTRLR_DATA_SANICAP_OWS_MASK		(0x1)
+/* No-Deallocate Inhibited  */
+#define NVME_CTRLR_DATA_SANICAP_NDI_SHIFT		(29)
+#define NVME_CTRLR_DATA_SANICAP_NDI_MASK		(0x1)
+/* No-Deallocate Modifies Media After Sanitize */
+#define NVME_CTRLR_DATA_SANICAP_NODMMAS_SHIFT		(30)
+#define NVME_CTRLR_DATA_SANICAP_NODMMAS_MASK		(0x3)
+#define NVME_CTRLR_DATA_SANICAP_NODMMAS_UNDEF		(0)
+#define NVME_CTRLR_DATA_SANICAP_NODMMAS_NO		(1)
+#define NVME_CTRLR_DATA_SANICAP_NODMMAS_YES		(2)
+
 /** submission queue entry size */
 #define NVME_CTRLR_DATA_SQES_MIN_SHIFT			(0)
 #define NVME_CTRLR_DATA_SQES_MIN_MASK			(0xF)
@@ -255,6 +284,8 @@
 #define NVME_CTRLR_DATA_ONCS_RESERV_MASK		(0x1)
 #define NVME_CTRLR_DATA_ONCS_TIMESTAMP_SHIFT		(6)
 #define NVME_CTRLR_DATA_ONCS_TIMESTAMP_MASK		(0x1)
+#define NVME_CTRLR_DATA_ONCS_VERIFY_SHIFT		(7)
+#define NVME_CTRLR_DATA_ONCS_VERIFY_MASK		(0x1)
 
 /** Fused Operation Support */
 #define NVME_CTRLR_DATA_FUSES_CNW_SHIFT		(0)
@@ -269,8 +300,15 @@
 #define NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_MASK		(0x1)
 
 /** volatile write cache */
+/* volatile write cache present */
 #define NVME_CTRLR_DATA_VWC_PRESENT_SHIFT		(0)
 #define NVME_CTRLR_DATA_VWC_PRESENT_MASK		(0x1)
+/* flush all namespaces supported */
+#define NVME_CTRLR_DATA_VWC_ALL_SHIFT			(1)
+#define NVME_CTRLR_DATA_VWC_ALL_MASK			(0x3)
+#define NVME_CTRLR_DATA_VWC_ALL_UNKNOWN			(0)
+#define NVME_CTRLR_DATA_VWC_ALL_NO			(2)
+#define NVME_CTRLR_DATA_VWC_ALL_YES			(3)
 
 /** namespace features */
 /* thin provisioning */
@@ -285,6 +323,9 @@
 /* NGUID and EUI64 fields are not reusable */
 #define NVME_NS_DATA_NSFEAT_NO_ID_REUSE_SHIFT		(3)
 #define NVME_NS_DATA_NSFEAT_NO_ID_REUSE_MASK		(0x1)
+/* NPWG, NPWA, NPDG, NPDA, and NOWS are valid */
+#define NVME_NS_DATA_NSFEAT_NPVALID_SHIFT		(4)
+#define NVME_NS_DATA_NSFEAT_NPVALID_MASK		(0x1)
 
 /** formatted lba size */
 #define NVME_NS_DATA_FLBAS_FORMAT_SHIFT			(0)
@@ -793,13 +834,28 @@ struct nvme_controller_data {
 	/** Controller Attributes */
 	uint32_t		ctratt;	/* bitfield really */
 
-	uint8_t			reserved1[12];
+	/** Read Recovery Levels Supported */
+	uint16_t		rrls;
 
+	uint8_t			reserved1[9];
+
+	/** Controller Type */
+	uint8_t			cntrltype;
+
 	/** FRU Globally Unique Identifier */
 	uint8_t			fguid[16];
 
-	uint8_t			reserved2[128];
+	/** Command Retry Delay Time 1 */
+	uint16_t		crdt1;
 
+	/** Command Retry Delay Time 2 */
+	uint16_t		crdt2;
+
+	/** Command Retry Delay Time 3 */
+	uint16_t		crdt3;
+
+	uint8_t			reserved2[122];
+
 	/* bytes 256-511: admin command set attributes */
 
 	/** optional admin command support */
@@ -878,7 +934,34 @@ struct nvme_controller_data {
 	/** Sanitize Capabilities */
 	uint32_t		sanicap; /* Really a bitfield */
 
-	uint8_t			reserved3[180];
+	/** Host Memory Buffer Minimum Descriptor Entry Size */
+	uint32_t		hmminds;
+
+	/** Host Memory Maximum Descriptors Entries */
+	uint16_t		hmmaxd;
+
+	/** NVM Set Identifier Maximum */
+	uint16_t		nsetidmax;
+
+	/** Endurance Group Identifier Maximum */
+	uint16_t		endgidmax;
+
+	/** ANA Transition Time */
+	uint8_t			anatt;
+
+	/** Asymmetric Namespace Access Capabilities */
+	uint8_t			anacap;
+
+	/** ANA Group Identifier Maximum */
+	uint32_t		anagrpmax;
+
+	/** Number of ANA Group Identifiers */
+	uint32_t		nanagrpid;
+
+	/** Persistent Event Log Size */
+	uint32_t		pels;
+
+	uint8_t			reserved3[156];
 	/* bytes 512-703: nvm command set attributes */
 
 	/** submission queue entry size */
@@ -913,8 +996,10 @@ struct nvme_controller_data {
 
 	/** NVM Vendor Specific Command Configuration */
 	uint8_t			nvscc;
-	uint8_t			reserved5;
 
+	/** Namespace Write Protection Capabilities */
+	uint8_t			nwpc;
+
 	/** Atomic Compare & Write Unit */
 	uint16_t		acwu;
 	uint16_t		reserved6;
@@ -922,8 +1007,11 @@ struct nvme_controller_data {
 	/** SGL Support */
 	uint32_t		sgls;
 
+	/** Maximum Number of Allowed Namespaces */
+	uint32_t		mnan;
+
 	/* bytes 540-767: Reserved */
-	uint8_t			reserved7[228];
+	uint8_t			reserved7[224];
 
 	/** NVM Subsystem NVMe Qualified Name */
 	uint8_t			subnqn[256];
@@ -1008,9 +1096,39 @@ struct nvme_namespace_data {
 	/** NVM Capacity */
 	uint8_t			nvmcap[16];
 
-	/* bytes 64-103: Reserved */
-	uint8_t			reserved5[40];
+	/** Namespace Preferred Write Granularity  */
+	uint16_t		npwg;
 
+	/** Namespace Preferred Write Alignment */
+	uint16_t		npwa;
+
+	/** Namespace Preferred Deallocate Granularity */
+	uint16_t		npdg;
+
+	/** Namespace Preferred Deallocate Alignment */
+	uint16_t		npda;
+
+	/** Namespace Optimal Write Size */
+	uint16_t		nows;
+
+	/* bytes 74-91: Reserved */
+	uint8_t			reserved5[18];
+
+	/** ANA Group Identifier */
+	uint32_t		anagrpid;
+
+	/* bytes 96-98: Reserved */
+	uint8_t			reserved6[3];
+
+	/** Namespace Attributes */
+	uint8_t			nsattr;
+
+	/** NVM Set Identifier */
+	uint16_t		nvmsetid;
+
+	/** Endurance Group Identifier */
+	uint16_t		endgid;
+
 	/** Namespace Globally Unique Identifier */
 	uint8_t			nguid[16];
 
@@ -1020,7 +1138,7 @@ struct nvme_namespace_data {
 	/** lba format support */
 	uint32_t		lbaf[16];
 
-	uint8_t			reserved6[192];
+	uint8_t			reserved7[192];
 
 	uint8_t			vendor_specific[3712];
 } __packed __aligned(4);
@@ -1402,6 +1520,10 @@ void	nvme_controller_data_swapbytes(struct nvme_contro
 	s->rtd3e = le32toh(s->rtd3e);
 	s->oaes = le32toh(s->oaes);
 	s->ctratt = le32toh(s->ctratt);
+	s->rrls = le16toh(s->rrls);
+	s->crdt1 = le16toh(s->crdt1);
+	s->crdt2 = le16toh(s->crdt2);
+	s->crdt3 = le16toh(s->crdt3);
 	s->oacs = le16toh(s->oacs);
 	s->wctemp = le16toh(s->wctemp);
 	s->cctemp = le16toh(s->cctemp);
@@ -1415,6 +1537,13 @@ void	nvme_controller_data_swapbytes(struct nvme_contro
 	s->mntmt = le16toh(s->mntmt);
 	s->mxtmt = le16toh(s->mxtmt);
 	s->sanicap = le32toh(s->sanicap);
+	s->hmminds = le32toh(s->hmminds);
+	s->hmmaxd = le16toh(s->hmmaxd);
+	s->nsetidmax = le16toh(s->nsetidmax);
+	s->endgidmax = le16toh(s->endgidmax);
+	s->anagrpmax = le32toh(s->anagrpmax);
+	s->nanagrpid = le32toh(s->nanagrpid);
+	s->pels = le32toh(s->pels);
 	s->maxcmd = le16toh(s->maxcmd);
 	s->nn = le32toh(s->nn);
 	s->oncs = le16toh(s->oncs);
@@ -1423,6 +1552,7 @@ void	nvme_controller_data_swapbytes(struct nvme_contro
 	s->awupf = le16toh(s->awupf);
 	s->acwu = le16toh(s->acwu);
 	s->sgls = le32toh(s->sgls);
+	s->mnan = le32toh(s->mnan);
 	for (i = 0; i < 32; i++)
 		nvme_power_state_swapbytes(&s->power_state[i]);
 }
@@ -1442,6 +1572,14 @@ void	nvme_namespace_data_swapbytes(struct nvme_namespa
 	s->nabo = le16toh(s->nabo);
 	s->nabspf = le16toh(s->nabspf);
 	s->noiob = le16toh(s->noiob);
+	s->npwg = le16toh(s->npwg);
+	s->npwa = le16toh(s->npwa);
+	s->npdg = le16toh(s->npdg);
+	s->npda = le16toh(s->npda);
+	s->nows = le16toh(s->nows);
+	s->anagrpid = le32toh(s->anagrpid);
+	s->nvmsetid = le16toh(s->nvmsetid);
+	s->endgid = le16toh(s->endgid);
 	for (i = 0; i < 16; i++)
 		s->lbaf[i] = le32toh(s->lbaf[i]);
 }

From owner-svn-src-head@freebsd.org  Mon Jul 29 08:50:36 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D69BA31F0;
 Mon, 29 Jul 2019 08:50:36 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 10EFC6EC22;
 Mon, 29 Jul 2019 08:50:36 +0000 (UTC)
 (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7AC625A4D;
 Mon, 29 Jul 2019 08:50:35 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T8oZRj077687;
 Mon, 29 Jul 2019 08:50:35 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T8oZIO077686;
 Mon, 29 Jul 2019 08:50:35 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907290850.x6T8oZIO077686@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Mon, 29 Jul 2019 08:50:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350403 - in head: share/man/man4 sys/netinet/cc
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet/cc
X-SVN-Commit-Revision: 350403
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 10EFC6EC22
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.94 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.94)[-0.945,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 08:50:36 -0000

Author: tuexen
Date: Mon Jul 29 08:50:35 2019
New Revision: 350403
URL: https://svnweb.freebsd.org/changeset/base/350403

Log:
  * Improve input validation of sysctl parameters for DCTPC.
  * Initialize the alpha parameter to a conservative value (like Linux)
  * Improve handling of arithmetic.
  * Improve man-page
  
  Obtained from:		Richard Scheffenegger
  MFC after:		1 week
  Differential Revision:	https://reviews.freebsd.org/D20549

Modified:
  head/share/man/man4/cc_dctcp.4
  head/sys/netinet/cc/cc_dctcp.c

Modified: head/share/man/man4/cc_dctcp.4
==============================================================================
--- head/share/man/man4/cc_dctcp.4	Mon Jul 29 08:23:15 2019	(r350402)
+++ head/share/man/man4/cc_dctcp.4	Mon Jul 29 08:50:35 2019	(r350403)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 12, 2015
+.Dd July 29, 2019
 .Dt CC_DCTCP 4
 .Os
 .Sh NAME
@@ -60,7 +60,7 @@ In addition, when classic ECN is used as sender and DC
 receiver, DCTCP avoids to mirror back ACKs only when the CWR flag is
 set in the incoming packet.
 .Pp
-The other specifications are based on the paper and Internet Draft referenced
+The other specifications are based on the paper and the RFC referenced
 in the
 .Sx SEE ALSO
 section below.
@@ -70,16 +70,27 @@ The algorithm exposes the following tunable variables 
 branch of the
 .Xr sysctl 3
 MIB:
-.Bl -tag -width ".Va alpha"
+.Bl -tag -width ".Va slowstart"
 .It Va alpha
-An initial estimator of the congestion on the link.
-Default is 0.
-.It Va dctcp_shift_g
-An estimation gain in the alpha calculation.
-Default is 16.
+The initial value to estimate the congestion on the link.
+The valid range is from 0 to 1024, where 1024 reduces the congestion
+window to half, if a CE is observed in the first window and
+.Va alpha
+could not yet adjust to the congestion level on that path.
+Default is 1024.
+.It Va shift_g
+An estimation gain in the
+.Va alpha
+calculation.
+This influences the responsiveness when adjusting alpha
+to the most recent observed window.
+Valid range from 0 to 10, the default is 4, resulting in an effective
+gain of 1 / ( 2 ^
+.Va shift_g
+), or 1/16th.
 .It Va slowstart
-A trigger to halve congestion window after slow start.
-Default does nothing to halve window.
+A flag if the congestion window should be reduced by one half after slow start.
+Valid settings 0 and 1, default 0.
 .El
 .Sh SEE ALSO
 .Xr cc_chd 4 ,
@@ -108,10 +119,12 @@ Default does nothing to halve window.
 .Re
 .Rs
 .%A "Stephen Bensley"
-.%A "Lars Eggert"
 .%A "Dave Thaler"
-.%T "Microsoft's Datacenter TCP (DCTCP): TCP Congestion Control for Datacenters"
-.%U "http://tools.ietf.org/html/draft-bensley-tcpm-dctcp-01"
+.%A "Praveen Balasubramanian"
+.%A "Lars Eggert"
+.%A "Glenn Judd"
+.%T "Data Center TCP (DCTCP): TCP Congestion Control for Data Centers"
+.%U "https://tools.ietf.org/html/rfc8257"
 .Re
 .Sh HISTORY
 The

Modified: head/sys/netinet/cc/cc_dctcp.c
==============================================================================
--- head/sys/netinet/cc/cc_dctcp.c	Mon Jul 29 08:23:15 2019	(r350402)
+++ head/sys/netinet/cc/cc_dctcp.c	Mon Jul 29 08:50:35 2019	(r350403)
@@ -56,8 +56,9 @@ __FBSDID("$FreeBSD$");
 #include <netinet/cc/cc.h>
 #include <netinet/cc/cc_module.h>
 
-#define MAX_ALPHA_VALUE 1024
-VNET_DEFINE_STATIC(uint32_t, dctcp_alpha) = 0;
+#define DCTCP_SHIFT 10
+#define MAX_ALPHA_VALUE (1<<DCTCP_SHIFT)
+VNET_DEFINE_STATIC(uint32_t, dctcp_alpha) = MAX_ALPHA_VALUE;
 #define V_dctcp_alpha	    VNET(dctcp_alpha)
 VNET_DEFINE_STATIC(uint32_t, dctcp_shift_g) = 4;
 #define	V_dctcp_shift_g	    VNET(dctcp_shift_g)
@@ -65,14 +66,14 @@ VNET_DEFINE_STATIC(uint32_t, dctcp_slowstart) = 0;
 #define	V_dctcp_slowstart   VNET(dctcp_slowstart)
 
 struct dctcp {
-	int     bytes_ecn;	/* # of marked bytes during a RTT */
-	int     bytes_total;	/* # of acked bytes during a RTT */
-	int     alpha;		/* the fraction of marked bytes */
-	int     ce_prev;	/* CE state of the last segment */
-	int     save_sndnxt;	/* end sequence number of the current window */
-	int	ece_curr;	/* ECE flag in this segment */
-	int	ece_prev;	/* ECE flag in the last segment */
-	uint32_t    num_cong_events; /* # of congestion events */
+	uint32_t bytes_ecn;	  /* # of marked bytes during a RTT */
+	uint32_t bytes_total;	  /* # of acked bytes during a RTT */
+	int      alpha;		  /* the fraction of marked bytes */
+	int      ce_prev;	  /* CE state of the last segment */
+	tcp_seq  save_sndnxt;	  /* end sequence number of the current window */
+	int      ece_curr;	  /* ECE flag in this segment */
+	int      ece_prev;	  /* ECE flag in the last segment */
+	uint32_t num_cong_events; /* # of congestion events */
 };
 
 static MALLOC_DEFINE(M_dctcp, "dctcp data",
@@ -369,18 +370,18 @@ dctcp_update_alpha(struct cc_var *ccv)
 	dctcp_data->bytes_total = max(dctcp_data->bytes_total, 1);
 
 	/*
-	 * Update alpha: alpha = (1 - g) * alpha + g * F.
+	 * Update alpha: alpha = (1 - g) * alpha + g * M.
 	 * Here:
 	 * g is weight factor
 	 *	recommaded to be set to 1/16
 	 *	small g = slow convergence between competitive DCTCP flows
 	 *	large g = impacts low utilization of bandwidth at switches
-	 * F is fraction of marked segments in last RTT
+	 * M is fraction of marked segments in last RTT
 	 *	updated every RTT
 	 * Alpha must be round to 0 - MAX_ALPHA_VALUE.
 	 */
-	dctcp_data->alpha = min(alpha_prev - (alpha_prev >> V_dctcp_shift_g) +
-	    (dctcp_data->bytes_ecn << (10 - V_dctcp_shift_g)) /
+	dctcp_data->alpha = ulmin(alpha_prev - (alpha_prev >> V_dctcp_shift_g) +
+	    ((uint64_t)dctcp_data->bytes_ecn << (DCTCP_SHIFT - V_dctcp_shift_g)) /
 	    dctcp_data->bytes_total, MAX_ALPHA_VALUE);
 
 	/* Initialize internal parameters for next alpha calculation */
@@ -398,14 +399,10 @@ dctcp_alpha_handler(SYSCTL_HANDLER_ARGS)
 	new = V_dctcp_alpha;
 	error = sysctl_handle_int(oidp, &new, 0, req);
 	if (error == 0 && req->newptr != NULL) {
-		if (new > 1)
+		if (new > MAX_ALPHA_VALUE)
 			error = EINVAL;
-		else {
-			if (new > MAX_ALPHA_VALUE)
-				V_dctcp_alpha = MAX_ALPHA_VALUE;
-			else
-				V_dctcp_alpha = new;
-		}
+		else
+			V_dctcp_alpha = new;
 	}
 
 	return (error);
@@ -420,7 +417,7 @@ dctcp_shift_g_handler(SYSCTL_HANDLER_ARGS)
 	new = V_dctcp_shift_g;
 	error = sysctl_handle_int(oidp, &new, 0, req);
 	if (error == 0 && req->newptr != NULL) {
-		if (new > 1)
+		if (new > DCTCP_SHIFT)
 			error = EINVAL;
 		else
 			V_dctcp_shift_g = new;
@@ -454,7 +451,7 @@ SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, dctcp, CTLFLAG
 SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, alpha,
     CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_alpha), 0,
     &dctcp_alpha_handler,
-    "IU", "dctcp alpha parameter");
+    "IU", "dctcp alpha parameter at start of session");
 
 SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, shift_g,
     CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_shift_g), 4,

From owner-svn-src-head@freebsd.org  Mon Jul 29 09:19:48 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE9B7A3B56;
 Mon, 29 Jul 2019 09:19:48 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id D0D256FBCC;
 Mon, 29 Jul 2019 09:19:48 +0000 (UTC)
 (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA9C825FCF;
 Mon, 29 Jul 2019 09:19:48 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T9Jmgo094461;
 Mon, 29 Jul 2019 09:19:48 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T9Jmra094460;
 Mon, 29 Jul 2019 09:19:48 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907290919.x6T9Jmra094460@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Mon, 29 Jul 2019 09:19:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350404 - head/sys/netinet/cc
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet/cc
X-SVN-Commit-Revision: 350404
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: D0D256FBCC
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.96)[-0.961,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 09:19:49 -0000

Author: tuexen
Date: Mon Jul 29 09:19:48 2019
New Revision: 350404
URL: https://svnweb.freebsd.org/changeset/base/350404

Log:
  When performing after_idle() or post_recovery(), don't disable the
  DCTCP specific methods. Also fallthrough NewReno for non ECN capable
  TCP connections and improve the integer arithmetic.
  
  Obtained from:		Richard Scheffenegger
  MFC after:		1 week
  Differential Revision:	https://reviews.freebsd.org/D20550

Modified:
  head/sys/netinet/cc/cc_dctcp.c

Modified: head/sys/netinet/cc/cc_dctcp.c
==============================================================================
--- head/sys/netinet/cc/cc_dctcp.c	Mon Jul 29 08:50:35 2019	(r350403)
+++ head/sys/netinet/cc/cc_dctcp.c	Mon Jul 29 09:19:48 2019	(r350404)
@@ -123,7 +123,7 @@ dctcp_ack_received(struct cc_var *ccv, uint16_t type)
 			newreno_cc_algo.ack_received(ccv, type);
 
 		if (type == CC_DUPACK)
-			bytes_acked = CCV(ccv, t_maxseg);
+			bytes_acked = min(ccv->bytes_this_ack, CCV(ccv, t_maxseg));
 
 		if (type == CC_ACK)
 			bytes_acked = ccv->bytes_this_ack;
@@ -133,6 +133,8 @@ dctcp_ack_received(struct cc_var *ccv, uint16_t type)
 
 		/* Update total marked bytes. */
 		if (dctcp_data->ece_curr) {
+			//XXRMS: For fluid-model DCTCP, update
+			//cwnd here during for RTT fairness
 			if (!dctcp_data->ece_prev
 			    && bytes_acked > CCV(ccv, t_maxseg)) {
 				dctcp_data->bytes_ecn +=
@@ -166,18 +168,20 @@ dctcp_after_idle(struct cc_var *ccv)
 {
 	struct dctcp *dctcp_data;
 
-	dctcp_data = ccv->cc_data;
+	if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
+		dctcp_data = ccv->cc_data;
 
-	/* Initialize internal parameters after idle time */
-	dctcp_data->bytes_ecn = 0;
-	dctcp_data->bytes_total = 0;
-	dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
-	dctcp_data->alpha = V_dctcp_alpha;
-	dctcp_data->ece_curr = 0;
-	dctcp_data->ece_prev = 0;
-	dctcp_data->num_cong_events = 0;
+		/* Initialize internal parameters after idle time */
+		dctcp_data->bytes_ecn = 0;
+		dctcp_data->bytes_total = 0;
+		dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
+		dctcp_data->alpha = V_dctcp_alpha;
+		dctcp_data->ece_curr = 0;
+		dctcp_data->ece_prev = 0;
+		dctcp_data->num_cong_events = 0;
+	}
 
-	dctcp_cc_algo.after_idle = newreno_cc_algo.after_idle;
+	newreno_cc_algo.after_idle(ccv);
 }
 
 static void
@@ -228,63 +232,66 @@ static void
 dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
 {
 	struct dctcp *dctcp_data;
-	u_int win, mss;
+	u_int cwin, mss;
 
-	dctcp_data = ccv->cc_data;
-	win = CCV(ccv, snd_cwnd);
-	mss = CCV(ccv, t_maxseg);
+	if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
+		dctcp_data = ccv->cc_data;
+		cwin = CCV(ccv, snd_cwnd);
+		mss = CCV(ccv, t_maxseg);
 
-	switch (type) {
-	case CC_NDUPACK:
-		if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
+		switch (type) {
+		case CC_NDUPACK:
+			if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
+				if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
+					CCV(ccv, snd_ssthresh) =
+					    max(cwin / 2, 2 * mss);
+					dctcp_data->num_cong_events++;
+				} else {
+					/* cwnd has already updated as congestion
+					 * recovery. Reverse cwnd value using
+					 * snd_cwnd_prev and recalculate snd_ssthresh
+					 */
+					cwin = CCV(ccv, snd_cwnd_prev);
+					CCV(ccv, snd_ssthresh) =
+					    max(cwin / 2, 2 * mss);
+				}
+				ENTER_RECOVERY(CCV(ccv, t_flags));
+			}
+			break;
+		case CC_ECN:
+			/*
+			 * Save current snd_cwnd when the host encounters both
+			 * congestion recovery and fast recovery.
+			 */
+			CCV(ccv, snd_cwnd_prev) = cwin;
 			if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
-				CCV(ccv, snd_ssthresh) = mss *
-				    max(win / 2 / mss, 2);
-				dctcp_data->num_cong_events++;
-			} else {
-				/* cwnd has already updated as congestion
-				 * recovery. Reverse cwnd value using
-				 * snd_cwnd_prev and recalculate snd_ssthresh
-				 */
-				win = CCV(ccv, snd_cwnd_prev);
-				CCV(ccv, snd_ssthresh) =
-				    max(win / 2 / mss, 2) * mss;
+				if (V_dctcp_slowstart &&
+				    dctcp_data->num_cong_events++ == 0) {
+					CCV(ccv, snd_ssthresh) =
+					    max(cwin / 2, 2 * mss);
+					dctcp_data->alpha = MAX_ALPHA_VALUE;
+					dctcp_data->bytes_ecn = 0;
+					dctcp_data->bytes_total = 0;
+					dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
+				} else
+					CCV(ccv, snd_ssthresh) = 
+					    max((cwin - (((uint64_t)cwin *
+					    dctcp_data->alpha) >> (DCTCP_SHIFT+1))), 
+					    2 * mss);
+				CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
+				ENTER_CONGRECOVERY(CCV(ccv, t_flags));
 			}
-			ENTER_RECOVERY(CCV(ccv, t_flags));
-		}
-		break;
-	case CC_ECN:
-		/*
-		 * Save current snd_cwnd when the host encounters both
-		 * congestion recovery and fast recovery.
-		 */
-		CCV(ccv, snd_cwnd_prev) = win;
-		if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
-			if (V_dctcp_slowstart &&
-			    dctcp_data->num_cong_events++ == 0) {
-				CCV(ccv, snd_ssthresh) =
-				    mss * max(win / 2 / mss, 2);
-				dctcp_data->alpha = MAX_ALPHA_VALUE;
-				dctcp_data->bytes_ecn = 0;
-				dctcp_data->bytes_total = 0;
-				dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
-			} else
-				CCV(ccv, snd_ssthresh) = max((win - ((win *
-				    dctcp_data->alpha) >> 11)) / mss, 2) * mss;
-			CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
-			ENTER_CONGRECOVERY(CCV(ccv, t_flags));
-		}
-		dctcp_data->ece_curr = 1;
-		break;
-	case CC_RTO:
-		if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
+			dctcp_data->ece_curr = 1;
+			break;
+		case CC_RTO:
 			CCV(ccv, t_flags) |= TF_ECN_SND_CWR;
 			dctcp_update_alpha(ccv);
 			dctcp_data->save_sndnxt += CCV(ccv, t_maxseg);
 			dctcp_data->num_cong_events++;
+			break;
 		}
-		break;
-	}
+	} else
+		newreno_cc_algo.cong_signal(ccv, type);
 }
 
 static void
@@ -304,7 +311,7 @@ dctcp_conn_init(struct cc_var *ccv)
 static void
 dctcp_post_recovery(struct cc_var *ccv)
 {
-	dctcp_cc_algo.post_recovery = newreno_cc_algo.post_recovery;
+	newreno_cc_algo.post_recovery(ccv);
 
 	if (CCV(ccv, t_flags) & TF_ECN_PERMIT)
 		dctcp_update_alpha(ccv);
@@ -330,8 +337,8 @@ dctcp_ecnpkt_handler(struct cc_var *ccv)
 	delay_ack = 1;
 
 	/*
-	 * DCTCP responses an ACK immediately when the CE state
-	 * in between this segment and the last segment is not same.
+	 * DCTCP responds with an ACK immediately when the CE state
+	 * in between this segment and the last segment has changed.
 	 */
 	if (ccflag & CCF_IPHDR_CE) {
 		if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK))
@@ -351,8 +358,6 @@ dctcp_ecnpkt_handler(struct cc_var *ccv)
 
 	if (delay_ack == 0)
 		ccv->flags |= CCF_ACKNOW;
-	else
-		ccv->flags &= ~CCF_ACKNOW;
 }
 
 /*

From owner-svn-src-head@freebsd.org  Mon Jul 29 10:40:52 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 854BDA584A;
 Mon, 29 Jul 2019 10:40:52 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 625EC76AAB;
 Mon, 29 Jul 2019 10:40:52 +0000 (UTC)
 (envelope-from manu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37BED26E6D;
 Mon, 29 Jul 2019 10:40:52 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TAeq73042700;
 Mon, 29 Jul 2019 10:40:52 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TAeq7I042699;
 Mon, 29 Jul 2019 10:40:52 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201907291040.x6TAeq7I042699@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Mon, 29 Jul 2019 10:40:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350408 - head/sys/arm/ti
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head/sys/arm/ti
X-SVN-Commit-Revision: 350408
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 625EC76AAB
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.95)[-0.952,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 10:40:52 -0000

Author: manu
Date: Mon Jul 29 10:40:51 2019
New Revision: 350408
URL: https://svnweb.freebsd.org/changeset/base/350408

Log:
  arm: ti: Get the hwmods property either from the node or the parent
  
  r350229 changed the code to lookup the ti,hwmods property in the parent
  as it's now like that in the DTS from >= Linux 5.0, allow the property
  to be also in the node itself so we can boot with an older DTB.
  
  Reported by:	"Dr. Rolf Jansen" <rj@obsigna.com>

Modified:
  head/sys/arm/ti/ti_hwmods.c

Modified: head/sys/arm/ti/ti_hwmods.c
==============================================================================
--- head/sys/arm/ti/ti_hwmods.c	Mon Jul 29 09:34:47 2019	(r350407)
+++ head/sys/arm/ti/ti_hwmods.c	Mon Jul 29 10:40:51 2019	(r350408)
@@ -97,6 +97,16 @@ struct hwmod ti_hwmods[] = {
 	{NULL,		0}
 };
 
+static inline int
+ti_get_hwmods_prop(phandle_t node, void **name)
+{
+	int len;
+
+	if ((len = OF_getprop_alloc(node, "ti,hwmods", name)) > 0)
+		return (len);
+	return (OF_getprop_alloc(OF_parent(node), "ti,hwmods", name));
+}
+
 clk_ident_t
 ti_hwmods_get_clock(device_t dev)
 {
@@ -110,7 +120,7 @@ ti_hwmods_get_clock(device_t dev)
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (INVALID_CLK_IDENT);
 
-	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
 		return (INVALID_CLK_IDENT);
 
 	buf = name;
@@ -148,7 +158,7 @@ int ti_hwmods_contains(device_t dev, const char *hwmod
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (0);
 
-	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
 		return (0);
 
 	buf = name;
@@ -182,7 +192,7 @@ ti_hwmods_get_unit(device_t dev, const char *hwmod)
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (0);
 
-	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
 		return (0);
 
 	buf = name;

From owner-svn-src-head@freebsd.org  Mon Jul 29 10:42:16 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0EF8A5945;
 Mon, 29 Jul 2019 10:42:16 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9D95576F40;
 Mon, 29 Jul 2019 10:42:16 +0000 (UTC)
 (envelope-from manu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EF5B26EE6;
 Mon, 29 Jul 2019 10:42:16 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TAgFea046760;
 Mon, 29 Jul 2019 10:42:15 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TAgFFX046759;
 Mon, 29 Jul 2019 10:42:15 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201907291042.x6TAgFFX046759@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Mon, 29 Jul 2019 10:42:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350410 - head/sys/arm/ti/cpsw
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head/sys/arm/ti/cpsw
X-SVN-Commit-Revision: 350410
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 9D95576F40
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.95)[-0.952,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 10:42:16 -0000

Author: manu
Date: Mon Jul 29 10:42:15 2019
New Revision: 350410
URL: https://svnweb.freebsd.org/changeset/base/350410

Log:
  arm: ti: cpsw: Check the new slave node address
  
  Since DTS from >= Linux 5.0 the slave address are relative to the parent
  node address and aren't the full ones.
  Check both so the cpsw driver can find the phy id.

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==============================================================================
--- head/sys/arm/ti/cpsw/if_cpsw.c	Mon Jul 29 10:41:21 2019	(r350409)
+++ head/sys/arm/ti/cpsw/if_cpsw.c	Mon Jul 29 10:42:15 2019	(r350410)
@@ -755,7 +755,9 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, int port)
 			continue;
 		}
 		OF_prop_free(name);
-		if (mdio_child_addr != slave_mdio_addr[port])
+
+		if (mdio_child_addr != slave_mdio_addr[port] &&
+		    mdio_child_addr != (slave_mdio_addr[port] & 0xFFF))
 			continue;
 
 		if (fdt_get_phyaddr(child, NULL, &phy, NULL) != 0){

From owner-svn-src-head@freebsd.org  Mon Jul 29 12:55:49 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06E30A9071;
 Mon, 29 Jul 2019 12:55:49 +0000 (UTC) (envelope-from ae@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DC336833AE;
 Mon, 29 Jul 2019 12:55:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAF637BE;
 Mon, 29 Jul 2019 12:55:48 +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 x6TCtmxo024424;
 Mon, 29 Jul 2019 12:55:48 GMT (envelope-from ae@FreeBSD.org)
Received: (from ae@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TCtmKG024423;
 Mon, 29 Jul 2019 12:55:48 GMT (envelope-from ae@FreeBSD.org)
Message-Id: <201907291255.x6TCtmKG024423@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org
 using -f
From: "Andrey V. Elsukov" <ae@FreeBSD.org>
Date: Mon, 29 Jul 2019 12:55:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350413 - head/sys/netpfil/ipfw
X-SVN-Group: head
X-SVN-Commit-Author: ae
X-SVN-Commit-Paths: head/sys/netpfil/ipfw
X-SVN-Commit-Revision: 350413
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DC336833AE
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.98)[-0.976,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 12:55:49 -0000

Author: ae
Date: Mon Jul 29 12:55:48 2019
New Revision: 350413
URL: https://svnweb.freebsd.org/changeset/base/350413

Log:
  Avoid possible lock leaking.
  
  After r343619 ipfw uses own locking for packets flow. PULLUP_LEN() macro
  is used in ipfw_chk() to make m_pullup(). When m_pullup() fails, it just
  returns via `goto pullup_failed`. There are two places where PULLUP_LEN()
  is called with IPFW_PF_RLOCK() held.
  
  Add PULLUP_LEN_LOCKED() macro to use in these places to be able release
  the lock, when m_pullup() fails.
  
  Sponsored by:	Yandex LLC

Modified:
  head/sys/netpfil/ipfw/ip_fw2.c

Modified: head/sys/netpfil/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw2.c	Mon Jul 29 10:44:04 2019	(r350412)
+++ head/sys/netpfil/ipfw/ip_fw2.c	Mon Jul 29 12:55:48 2019	(r350413)
@@ -1442,9 +1442,9 @@ ipfw_chk(struct ip_fw_args *args)
  * pointer might become stale after other pullups (but we never use it
  * this way).
  */
-#define PULLUP_TO(_len, p, T)	PULLUP_LEN(_len, p, sizeof(T))
+#define	PULLUP_TO(_len, p, T)	PULLUP_LEN(_len, p, sizeof(T))
 #define	EHLEN	(eh != NULL ? ((char *)ip - (char *)eh) : 0)
-#define PULLUP_LEN(_len, p, T)					\
+#define	_PULLUP_LOCKED(_len, p, T, unlock)			\
 do {								\
 	int x = (_len) + T + EHLEN;				\
 	if (mem) {						\
@@ -1453,12 +1453,18 @@ do {								\
 	} else {						\
 		if (__predict_false((m)->m_len < x)) {		\
 			args->m = m = m_pullup(m, x);		\
-			if (m == NULL)				\
+			if (m == NULL) {			\
+				unlock;				\
 				goto pullup_failed;		\
+			}					\
 		}						\
 		p = mtod(m, char *) + (_len) + EHLEN;		\
 	}							\
 } while (0)
+
+#define	PULLUP_LEN(_len, p, T)	_PULLUP_LOCKED(_len, p, T, )
+#define	PULLUP_LEN_LOCKED(_len, p, T)	\
+    _PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain))
 /*
  * In case pointers got stale after pullups, update them.
  */
@@ -2310,7 +2316,7 @@ do {								\
 
 			case O_TCPOPTS:
 				if (proto == IPPROTO_TCP && offset == 0 && ulp){
-					PULLUP_LEN(hlen, ulp,
+					PULLUP_LEN_LOCKED(hlen, ulp,
 					    (TCP(ulp)->th_off << 2));
 					match = tcpopts_match(TCP(ulp), cmd);
 				}
@@ -2335,7 +2341,7 @@ do {								\
 					uint16_t mss, *p;
 					int i;
 
-					PULLUP_LEN(hlen, ulp,
+					PULLUP_LEN_LOCKED(hlen, ulp,
 					    (TCP(ulp)->th_off << 2));
 					if ((tcpopts_parse(TCP(ulp), &mss) &
 					    IP_FW_TCPOPT_MSS) == 0)
@@ -3182,6 +3188,7 @@ do {								\
 
 		}	/* end of inner loop, scan opcodes */
 #undef PULLUP_LEN
+#undef PULLUP_LEN_LOCKED
 
 		if (done)
 			break;

From owner-svn-src-head@freebsd.org  Mon Jul 29 13:21:32 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 605D2A9A4F;
 Mon, 29 Jul 2019 13:21:32 +0000 (UTC) (envelope-from kp@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 42DBA83F60;
 Mon, 29 Jul 2019 13:21:32 +0000 (UTC) (envelope-from kp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1684ACE7;
 Mon, 29 Jul 2019 13:21:32 +0000 (UTC) (envelope-from kp@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TDLVEQ038569;
 Mon, 29 Jul 2019 13:21:31 GMT (envelope-from kp@FreeBSD.org)
Received: (from kp@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TDLVXs038568;
 Mon, 29 Jul 2019 13:21:31 GMT (envelope-from kp@FreeBSD.org)
Message-Id: <201907291321.x6TDLVXs038568@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org
 using -f
From: Kristof Provost <kp@FreeBSD.org>
Date: Mon, 29 Jul 2019 13:21:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350414 - head/sys/netpfil/pf
X-SVN-Group: head
X-SVN-Commit-Author: kp
X-SVN-Commit-Paths: head/sys/netpfil/pf
X-SVN-Commit-Revision: 350414
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 42DBA83F60
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.98)[-0.977,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 13:21:32 -0000

Author: kp
Date: Mon Jul 29 13:21:31 2019
New Revision: 350414
URL: https://svnweb.freebsd.org/changeset/base/350414

Log:
  pf: Remove partial RFC2675 support
  
  Remove our (very partial) support for RFC2675 Jumbograms. They're not
  used, not actually supported and not a good idea.
  
  Reviewed by:	thj@
  Differential Revision:	https://reviews.freebsd.org/D21086

Modified:
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/netpfil/pf/pf.c
==============================================================================
--- head/sys/netpfil/pf/pf.c	Mon Jul 29 12:55:48 2019	(r350413)
+++ head/sys/netpfil/pf/pf.c	Mon Jul 29 13:21:31 2019	(r350414)
@@ -6351,9 +6351,8 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struc
 	m = *m0;	/* pf_normalize messes with m0 */
 	h = mtod(m, struct ip6_hdr *);
 
-#if 1
 	/*
-	 * we do not support jumbogram yet.  if we keep going, zero ip6_plen
+	 * we do not support jumbogram.  if we keep going, zero ip6_plen
 	 * will do something bad, so drop the packet for now.
 	 */
 	if (htons(h->ip6_plen) == 0) {
@@ -6361,7 +6360,6 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struc
 		REASON_SET(&reason, PFRES_NORM);	/*XXX*/
 		goto done;
 	}
-#endif
 
 	pd.src = (struct pf_addr *)&h->ip6_src;
 	pd.dst = (struct pf_addr *)&h->ip6_dst;

Modified: head/sys/netpfil/pf/pf_norm.c
==============================================================================
--- head/sys/netpfil/pf/pf_norm.c	Mon Jul 29 12:55:48 2019	(r350413)
+++ head/sys/netpfil/pf/pf_norm.c	Mon Jul 29 13:21:31 2019	(r350414)
@@ -1139,9 +1139,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi
 	int			 off;
 	struct ip6_ext		 ext;
 	struct ip6_opt		 opt;
-	struct ip6_opt_jumbo	 jumbo;
 	struct ip6_frag		 frag;
-	u_int32_t		 jumbolen = 0, plen;
+	u_int32_t		 plen;
 	int			 optend;
 	int			 ooff;
 	u_int8_t		 proto;
@@ -1185,6 +1184,11 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi
 	if (sizeof(struct ip6_hdr) + IPV6_MAXPACKET < m->m_pkthdr.len)
 		goto drop;
 
+	plen = ntohs(h->ip6_plen);
+	/* jumbo payload option not supported */
+	if (plen == 0)
+		goto drop;
+
 	extoff = 0;
 	off = sizeof(struct ip6_hdr);
 	proto = h->ip6_nxt;
@@ -1228,26 +1232,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi
 					goto shortpkt;
 				if (ooff + sizeof(opt) + opt.ip6o_len > optend)
 					goto drop;
-				switch (opt.ip6o_type) {
-				case IP6OPT_JUMBO:
-					if (h->ip6_plen != 0)
-						goto drop;
-					if (!pf_pull_hdr(m, ooff, &jumbo,
-					    sizeof(jumbo), NULL, NULL,
-					    AF_INET6))
-						goto shortpkt;
-					memcpy(&jumbolen, jumbo.ip6oj_jumbo_len,
-					    sizeof(jumbolen));
-					jumbolen = ntohl(jumbolen);
-					if (jumbolen <= IPV6_MAXPACKET)
-						goto drop;
-					if (sizeof(struct ip6_hdr) + jumbolen !=
-					    m->m_pkthdr.len)
-						goto drop;
-					break;
-				default:
-					break;
-				}
+				if (opt.ip6o_type == IP6OPT_JUMBO)
+					goto drop;
 				ooff += sizeof(opt) + opt.ip6o_len;
 			} while (ooff < optend);
 
@@ -1260,13 +1246,6 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi
 		}
 	} while (!terminal);
 
-	/* jumbo payload option must be present, or plen > 0 */
-	if (ntohs(h->ip6_plen) == 0)
-		plen = jumbolen;
-	else
-		plen = ntohs(h->ip6_plen);
-	if (plen == 0)
-		goto drop;
 	if (sizeof(struct ip6_hdr) + plen > m->m_pkthdr.len)
 		goto shortpkt;
 
@@ -1275,10 +1254,6 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi
 	return (PF_PASS);
 
  fragment:
-	/* Jumbo payload packets cannot be fragmented. */
-	plen = ntohs(h->ip6_plen);
-	if (plen == 0 || jumbolen)
-		goto drop;
 	if (sizeof(struct ip6_hdr) + plen > m->m_pkthdr.len)
 		goto shortpkt;
 

From owner-svn-src-head@freebsd.org  Mon Jul 29 14:58:30 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A622ACFC5;
 Mon, 29 Jul 2019 14:58:30 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id F1206874C3;
 Mon, 29 Jul 2019 14:58:29 +0000 (UTC) (envelope-from br@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB64E1E10;
 Mon, 29 Jul 2019 14:58:29 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TEwTkF094246;
 Mon, 29 Jul 2019 14:58:29 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TEwTu1094245;
 Mon, 29 Jul 2019 14:58:29 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201907291458.x6TEwTu1094245@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin <br@FreeBSD.org>
Date: Mon, 29 Jul 2019 14:58:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350415 - head/sys/dev/mii
X-SVN-Group: head
X-SVN-Commit-Author: br
X-SVN-Commit-Paths: head/sys/dev/mii
X-SVN-Commit-Revision: 350415
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: F1206874C3
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.96)[-0.964,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 14:58:30 -0000

Author: br
Date: Mon Jul 29 14:58:29 2019
New Revision: 350415
URL: https://svnweb.freebsd.org/changeset/base/350415

Log:
  Find the correct node of PHY chip using "phy-handle" property of
  ethernet MAC node.
  
  This fixes operation on Terasic DE10-Pro (Intel Stratix 10 GX/SX
  FPGA Development Kit).
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/dev/mii/micphy.c

Modified: head/sys/dev/mii/micphy.c
==============================================================================
--- head/sys/dev/mii/micphy.c	Mon Jul 29 13:21:31 2019	(r350414)
+++ head/sys/dev/mii/micphy.c	Mon Jul 29 14:58:29 2019	(r350415)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
+ * Copyright (c) 2014,2019 Ruslan Bukin <br@bsdpad.com>
  * All rights reserved.
  *
  * This software was developed by SRI International and the University of
@@ -32,7 +32,7 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * Micrel KSZ9021 Gigabit Ethernet Transceiver
+ * Micrel KSZ8081/KSZ9021/KSZ9031 Gigabit Ethernet Transceiver
  */
 
 #include <sys/param.h>
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
+#include <dev/mii/mii_fdt.h>
 
 #define	MII_KSZPHY_EXTREG			0x0b
 #define	 KSZPHY_EXTREG_WRITE			(1 << 15)
@@ -251,6 +252,7 @@ micphy_probe(device_t dev)
 static int
 micphy_attach(device_t dev)
 {
+	mii_fdt_phy_config_t *cfg;
 	struct mii_softc *sc;
 	phandle_t node;
 	device_t miibus;
@@ -271,10 +273,12 @@ micphy_attach(device_t dev)
 	if ((node = ofw_bus_get_node(parent)) == -1)
 		return (ENXIO);
 
+	cfg = mii_fdt_get_config(dev);
+
 	if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ9031)
-		ksz9031_load_values(sc, node);
+		ksz9031_load_values(sc, cfg->phynode);
 	else
-		ksz9021_load_values(sc, node);
+		ksz9021_load_values(sc, cfg->phynode);
 
 	return (0);
 }

From owner-svn-src-head@freebsd.org  Mon Jul 29 14:59:15 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2E54AD027;
 Mon, 29 Jul 2019 14:59:15 +0000 (UTC) (envelope-from kp@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 5480487720;
 Mon, 29 Jul 2019 14:59:15 +0000 (UTC) (envelope-from kp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D45BB1E1A;
 Mon, 29 Jul 2019 14:59:14 +0000 (UTC) (envelope-from kp@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TExEne094445;
 Mon, 29 Jul 2019 14:59:14 GMT (envelope-from kp@FreeBSD.org)
Received: (from kp@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TExE8x094444;
 Mon, 29 Jul 2019 14:59:14 GMT (envelope-from kp@FreeBSD.org)
Message-Id: <201907291459.x6TExE8x094444@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org
 using -f
From: Kristof Provost <kp@FreeBSD.org>
Date: Mon, 29 Jul 2019 14:59:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350416 - head/sys/riscv/riscv
X-SVN-Group: head
X-SVN-Commit-Author: kp
X-SVN-Commit-Paths: head/sys/riscv/riscv
X-SVN-Commit-Revision: 350416
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 5480487720
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.97)[-0.966,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 14:59:15 -0000

Author: kp
Date: Mon Jul 29 14:59:14 2019
New Revision: 350416
URL: https://svnweb.freebsd.org/changeset/base/350416

Log:
  riscv: Fix copyin/copyout
  
  r343275 introduced a performance optimisation to the copyin/copyout
  routines by attempting to copy word-per-word rather than byte-per-byte
  where possible.
  
  This optimisation failed to account for cases where the buffer is longer
  than XLEN_BYTES, but due to misalignment does not not allow for any
  word-sized copies. E.g. a 9 byte buffer (with XLEN_BYTES == 8) which is
  misaligned by 2 bytes. The code nevertheless did a single full-word
  copy, which meant we copied too much data. This potentially clobbered
  other data.
  
  This is most easily demonstrated by a simple `sysctl -a`.
  
  Fix it by not assuming that we'll always have at least one full-word
  copy to do, but instead checking the remaining length first.
  
  Reviewed by:	markj@, mhorne@, br@ (previous version)
  MFC after:	1 week
  Sponsored by:	Axiado
  Differential Revision:	https://reviews.freebsd.org/D21100

Modified:
  head/sys/riscv/riscv/copyinout.S

Modified: head/sys/riscv/riscv/copyinout.S
==============================================================================
--- head/sys/riscv/riscv/copyinout.S	Mon Jul 29 14:58:29 2019	(r350415)
+++ head/sys/riscv/riscv/copyinout.S	Mon Jul 29 14:59:14 2019	(r350416)
@@ -65,7 +65,7 @@ END(copyio_fault)
 	ENTER_USER_ACCESS(a7)
 
 	li	t2, XLEN_BYTES
-	blt	a2, t2, 3f		/* Byte-copy if len < XLEN_BYTES */
+	blt	a2, t2, 4f		/* Byte-copy if len < XLEN_BYTES */
 
 	/*
 	 * Compare lower bits of src and dest.
@@ -73,7 +73,7 @@ END(copyio_fault)
 	 */
 	andi	t0, a0, (XLEN_BYTES-1)	/* Low bits of src */
 	andi	t1, a1, (XLEN_BYTES-1)	/* Low bits of dest */
-	bne	t0, t1, 3f		/* Misaligned. Go to byte copy */
+	bne	t0, t1, 4f		/* Misaligned. Go to byte copy */
 	beqz	t0, 2f			/* Already word-aligned, skip ahead */
 
 	/* Byte copy until the first word-aligned address */
@@ -84,6 +84,7 @@ END(copyio_fault)
 	addi	a2, a2, -1		/* len-- */
 	andi	t0, a0, (XLEN_BYTES-1)
 	bnez	t0, 1b
+	j	3f
 
 	/* Copy words */
 2:	ld	a4, 0(a0)		/* Load word from src */
@@ -91,20 +92,20 @@ END(copyio_fault)
 	sd	a4, 0(a1)		/* Store word in dest */
 	addi	a1, a1, XLEN_BYTES
 	addi	a2, a2, -XLEN_BYTES	/* len -= XLEN_BYTES */
-	bgeu	a2, t2, 2b		/* Again if len >= XLEN_BYTES */
+3:	bgeu	a2, t2, 2b		/* Again if len >= XLEN_BYTES */
 
 	/* Check if we're finished */
-	beqz	a2, 4f
+	beqz	a2, 5f
 
 	/* Copy any remaining bytes */
-3:	lb	a4, 0(a0)		/* Load byte from src */
+4:	lb	a4, 0(a0)		/* Load byte from src */
 	addi	a0, a0, 1
 	sb	a4, 0(a1)		/* Store byte in dest */
 	addi	a1, a1, 1
 	addi	a2, a2, -1		/* len-- */
-	bnez	a2, 3b
+	bnez	a2, 4b
 
-4:	EXIT_USER_ACCESS(a7)
+5:	EXIT_USER_ACCESS(a7)
 	SET_FAULT_HANDLER(x0, a7)	/* Clear the handler */
 	.endm
 

From owner-svn-src-head@freebsd.org  Mon Jul 29 15:09:13 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1C3FAD590;
 Mon, 29 Jul 2019 15:09:13 +0000 (UTC) (envelope-from ae@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 901A387EC6;
 Mon, 29 Jul 2019 15:09:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A1911FF2;
 Mon, 29 Jul 2019 15:09:13 +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 x6TF9DYS000405;
 Mon, 29 Jul 2019 15:09:13 GMT (envelope-from ae@FreeBSD.org)
Received: (from ae@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TF9CGc000401;
 Mon, 29 Jul 2019 15:09:12 GMT (envelope-from ae@FreeBSD.org)
Message-Id: <201907291509.x6TF9CGc000401@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org
 using -f
From: "Andrey V. Elsukov" <ae@FreeBSD.org>
Date: Mon, 29 Jul 2019 15:09:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350417 - head/sys/netpfil/ipfw
X-SVN-Group: head
X-SVN-Commit-Author: ae
X-SVN-Commit-Paths: head/sys/netpfil/ipfw
X-SVN-Commit-Revision: 350417
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 901A387EC6
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.97)[-0.966,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 15:09:13 -0000

Author: ae
Date: Mon Jul 29 15:09:12 2019
New Revision: 350417
URL: https://svnweb.freebsd.org/changeset/base/350417

Log:
  dd ipfw_get_action() function to get the pointer to action opcode.
  
  ACTION_PTR() returns pointer to the start of rule action section,
  but rule can keep several rule modifiers like O_LOG, O_TAG and O_ALTQ,
  and only then real action opcode is stored.
  
  ipfw_get_action() function inspects the rule action section, skips
  all modifiers and returns action opcode.
  
  Use this function in ipfw_reset_eaction() and flush_nat_ptrs().
  
  MFC after:	1 week
  Sponsored by:	Yandex LLC

Modified:
  head/sys/netpfil/ipfw/ip_fw_eaction.c
  head/sys/netpfil/ipfw/ip_fw_nat.c
  head/sys/netpfil/ipfw/ip_fw_private.h
  head/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_eaction.c	Mon Jul 29 14:59:14 2019	(r350416)
+++ head/sys/netpfil/ipfw/ip_fw_eaction.c	Mon Jul 29 15:09:12 2019	(r350417)
@@ -377,33 +377,30 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_f
     uint16_t eaction_id, uint16_t default_id, uint16_t instance_id)
 {
 	ipfw_insn *cmd, *icmd;
-	int l, cmdlen;
+	int l;
 
 	IPFW_UH_WLOCK_ASSERT(ch);
 	IPFW_WLOCK_ASSERT(ch);
 
-	cmd = ACTION_PTR(rule);
-	l = rule->cmd_len - rule->act_ofs;
-	while (l > 0) {
-		cmdlen = F_LEN(cmd);
-		l -= cmdlen;
-		if (cmd->opcode == O_EXTERNAL_ACTION || l <= 0)
-			break;
-		cmd += cmdlen;
-	}
 	/*
 	 * Return if there is not O_EXTERNAL_ACTION or its id is
 	 * different.
 	 */
+	cmd = ipfw_get_action(rule);
 	if (cmd->opcode != O_EXTERNAL_ACTION ||
 	    cmd->arg1 != eaction_id)
 		return (0);
 	/*
 	 * If instance_id is specified, we need to truncate the
 	 * rule length. Check if there is O_EXTERNAL_INSTANCE opcode.
+	 *
+	 * NOTE: F_LEN(cmd) must be 1 for O_EXTERNAL_ACTION opcode,
+	 *  and rule length should be enough to keep O_EXTERNAL_INSTANCE
+	 *  opcode, thus we do check for l > 1.
 	 */
-	if (instance_id != 0 && l > 0) {
-		MPASS(cmdlen == 1);
+	l = rule->cmd + rule->cmd_len - cmd;
+	if (instance_id != 0 && l > 1) {
+		MPASS(F_LEN(cmd) == 1);
 		icmd = cmd + 1;
 		if (icmd->opcode != O_EXTERNAL_INSTANCE ||
 		    icmd->arg1 != instance_id)
@@ -415,8 +412,9 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_f
 		 * opcode.
 		 */
 		EACTION_DEBUG("truncate rule %d: len %u -> %u",
-		    rule->rulenum, rule->cmd_len, rule->cmd_len - l);
-		rule->cmd_len -= l;
+		    rule->rulenum, rule->cmd_len,
+		    rule->cmd_len - F_LEN(icmd));
+		rule->cmd_len -= F_LEN(icmd);
 		MPASS(((uint32_t *)icmd -
 		    (uint32_t *)rule->cmd) == rule->cmd_len);
 	}

Modified: head/sys/netpfil/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_nat.c	Mon Jul 29 14:59:14 2019	(r350416)
+++ head/sys/netpfil/ipfw/ip_fw_nat.c	Mon Jul 29 15:09:12 2019	(r350417)
@@ -140,13 +140,12 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp)
 static void
 flush_nat_ptrs(struct ip_fw_chain *chain, const int ix)
 {
-	int i;
 	ipfw_insn_nat *cmd;
+	int i;
 
 	IPFW_WLOCK_ASSERT(chain);
 	for (i = 0; i < chain->n_rules; i++) {
-		cmd = (ipfw_insn_nat *)ACTION_PTR(chain->map[i]);
-		/* XXX skip log and the like ? */
+		cmd = (ipfw_insn_nat *)ipfw_get_action(chain->map[i]);
 		if (cmd->o.opcode == O_NAT && cmd->nat != NULL &&
 			    (ix < 0 || cmd->nat->id == ix))
 			cmd->nat = NULL;

Modified: head/sys/netpfil/ipfw/ip_fw_private.h
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_private.h	Mon Jul 29 14:59:14 2019	(r350416)
+++ head/sys/netpfil/ipfw/ip_fw_private.h	Mon Jul 29 15:09:12 2019	(r350417)
@@ -665,6 +665,7 @@ struct ip_fw *ipfw_alloc_rule(struct ip_fw_chain *chai
 void ipfw_free_rule(struct ip_fw *rule);
 int ipfw_match_range(struct ip_fw *rule, ipfw_range_tlv *rt);
 int ipfw_mark_object_kidx(uint32_t *bmask, uint16_t etlv, uint16_t kidx);
+ipfw_insn *ipfw_get_action(struct ip_fw *);
 
 typedef int (sopt_handler_f)(struct ip_fw_chain *ch,
     ip_fw3_opheader *op3, struct sockopt_data *sd);

Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_sockopt.c	Mon Jul 29 14:59:14 2019	(r350416)
+++ head/sys/netpfil/ipfw/ip_fw_sockopt.c	Mon Jul 29 15:09:12 2019	(r350417)
@@ -1218,6 +1218,35 @@ move_range(struct ip_fw_chain *chain, ipfw_range_tlv *
 }
 
 /*
+ * Returns pointer to action instruction, skips all possible rule
+ * modifiers like O_LOG, O_TAG, O_ALTQ.
+ */
+ipfw_insn *
+ipfw_get_action(struct ip_fw *rule)
+{
+	ipfw_insn *cmd;
+	int l, cmdlen;
+
+	cmd = ACTION_PTR(rule);
+	l = rule->cmd_len - rule->act_ofs;
+	while (l > 0) {
+		switch (cmd->opcode) {
+		case O_ALTQ:
+		case O_LOG:
+		case O_TAG:
+			break;
+		default:
+			return (cmd);
+		}
+		cmdlen = F_LEN(cmd);
+		l -= cmdlen;
+		cmd += cmdlen;
+	}
+	panic("%s: rule (%p) has not action opcode", __func__, rule);
+	return (NULL);
+}
+
+/*
  * Clear counters for a specific rule.
  * Normally run under IPFW_UH_RLOCK, but these are idempotent ops
  * so we only care that rules do not disappear.

From owner-svn-src-head@freebsd.org  Mon Jul 29 16:32:24 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 447C3AF123;
 Mon, 29 Jul 2019 16:32:24 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 1B8278A524;
 Mon, 29 Jul 2019 16:32:24 +0000 (UTC) (envelope-from br@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0BF83006;
 Mon, 29 Jul 2019 16:32:23 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TGWNZE052924;
 Mon, 29 Jul 2019 16:32:23 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TGWN0i052922;
 Mon, 29 Jul 2019 16:32:23 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201907291632.x6TGWN0i052922@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin <br@FreeBSD.org>
Date: Mon, 29 Jul 2019 16:32:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350418 - in head/sys: arm64/conf conf dev/altera/dwc
X-SVN-Group: head
X-SVN-Commit-Author: br
X-SVN-Commit-Paths: in head/sys: arm64/conf conf dev/altera/dwc
X-SVN-Commit-Revision: 350418
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 1B8278A524
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.98)[-0.976,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 16:32:24 -0000

Author: br
Date: Mon Jul 29 16:32:23 2019
New Revision: 350418
URL: https://svnweb.freebsd.org/changeset/base/350418

Log:
  Add glue driver for Altera SOCFPGA Ethernet MAC (EMAC) found in
  Terasic DE10-Pro (an Intel Stratix 10 GX/SX FPGA Development Kit).
  
  The Altera EMAC is an instance of Synopsys DesignWare Gigabit MAC.
  
  This driver sets correct clock range for MDIO interface on Intel Stratix 10
  platform.
  
  This is required due to lack of support for clock manager device for
  this platform that could tell us the clock frequency value for ethernet
  clock domain.
  
  Sponsored by:	DARPA, AFRL

Added:
  head/sys/dev/altera/dwc/
  head/sys/dev/altera/dwc/if_dwc_socfpga.c   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==============================================================================
--- head/sys/arm64/conf/GENERIC	Mon Jul 29 15:09:12 2019	(r350417)
+++ head/sys/arm64/conf/GENERIC	Mon Jul 29 16:32:23 2019	(r350418)
@@ -162,6 +162,7 @@ device  	smc		# SMSC LAN91C111
 device		vnic		# Cavium ThunderX NIC
 device		al_eth		# Annapurna Alpine Ethernet NIC
 device		dwc_rk		# Rockchip Designware
+device		dwc_socfpga	# Altera SOCFPGA Ethernet MAC
 
 # Etherswitch devices
 device		etherswitch	# Enable etherswitch support

Modified: head/sys/conf/files.arm64
==============================================================================
--- head/sys/conf/files.arm64	Mon Jul 29 15:09:12 2019	(r350417)
+++ head/sys/conf/files.arm64	Mon Jul 29 16:32:23 2019	(r350418)
@@ -206,6 +206,7 @@ dev/acpica/acpi_pci_link.c	optional	acpi pci
 dev/acpica/acpi_pcib.c		optional	acpi pci
 dev/acpica/acpi_pxm.c		optional	acpi
 dev/ahci/ahci_generic.c		optional	ahci
+dev/altera/dwc/if_dwc_socfpga.c	optional	fdt dwc_socfpga
 dev/axgbe/if_axgbe.c		optional	axgbe
 dev/axgbe/xgbe-desc.c		optional	axgbe
 dev/axgbe/xgbe-dev.c		optional	axgbe

Added: head/sys/dev/altera/dwc/if_dwc_socfpga.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/altera/dwc/if_dwc_socfpga.c	Mon Jul 29 16:32:23 2019	(r350418)
@@ -0,0 +1,113 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Ruslan Bukin <br@bsdpad.com>
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <machine/bus.h>
+
+#include <dev/dwc/if_dwc.h>
+#include <dev/dwc/if_dwcvar.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include "if_dwc_if.h"
+
+static int
+if_dwc_socfpga_probe(device_t dev)
+{
+
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+
+	if (!ofw_bus_is_compatible(dev, "altr,socfpga-stmmac"))
+		return (ENXIO);
+
+	device_set_desc(dev, "Altera SOCFPGA Ethernet MAC");
+
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+if_dwc_socfpga_init(device_t dev)
+{
+
+	return (0);
+}
+
+static int
+if_dwc_socfpga_mac_type(device_t dev)
+{
+
+	return (DWC_GMAC);
+}
+
+static int
+if_dwc_socfpga_mii_clk(device_t dev)
+{
+	phandle_t root;
+
+	root = OF_finddevice("/");
+
+	if (ofw_bus_node_is_compatible(root, "altr,socfpga-stratix10"))
+		return (GMAC_MII_CLK_35_60M_DIV26);
+
+	/* Default value. */
+	return (GMAC_MII_CLK_25_35M_DIV16);
+}
+
+static device_method_t dwc_socfpga_methods[] = {
+	DEVMETHOD(device_probe,		if_dwc_socfpga_probe),
+
+	DEVMETHOD(if_dwc_init,		if_dwc_socfpga_init),
+	DEVMETHOD(if_dwc_mac_type,	if_dwc_socfpga_mac_type),
+	DEVMETHOD(if_dwc_mii_clk,	if_dwc_socfpga_mii_clk),
+
+	DEVMETHOD_END
+};
+
+static devclass_t dwc_socfpga_devclass;
+
+extern driver_t dwc_driver;
+
+DEFINE_CLASS_1(dwc, dwc_socfpga_driver, dwc_socfpga_methods,
+    sizeof(struct dwc_softc), dwc_driver);
+EARLY_DRIVER_MODULE(dwc_socfpga, simplebus, dwc_socfpga_driver,
+    dwc_socfpga_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE);
+
+MODULE_DEPEND(dwc_socfpga, dwc, 1, 1, 1);

From owner-svn-src-head@freebsd.org  Mon Jul 29 19:02:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A4BBB2AA4;
 Mon, 29 Jul 2019 19:02:18 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 042DE8FA7B;
 Mon, 29 Jul 2019 19:02:17 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF5DC4F47;
 Mon, 29 Jul 2019 19:02:17 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TJ2HGb041791;
 Mon, 29 Jul 2019 19:02:17 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TJ2GfG041787;
 Mon, 29 Jul 2019 19:02:16 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907291902.x6TJ2GfG041787@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 29 Jul 2019 19:02:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350420 - in head: include lib/libc/stdio
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head: include lib/libc/stdio
X-SVN-Commit-Revision: 350420
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 042DE8FA7B
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.97)[-0.974,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 19:02:18 -0000

Author: markj
Date: Mon Jul 29 19:02:16 2019
New Revision: 350420
URL: https://svnweb.freebsd.org/changeset/base/350420

Log:
  Add mkostempsat(3).
  
  This is a variant of mkostemps() which takes a directory descriptor and
  returns a descriptor for a tempfile relative to that directory.  Unlike
  the other mktemp functions, mkostempsat() can be used in capability
  mode.
  
  Reviewed by:	cem
  Discussed with:	brooks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21031

Modified:
  head/include/stdlib.h
  head/lib/libc/stdio/Makefile.inc
  head/lib/libc/stdio/Symbol.map
  head/lib/libc/stdio/mktemp.3
  head/lib/libc/stdio/mktemp.c

Modified: head/include/stdlib.h
==============================================================================
--- head/include/stdlib.h	Mon Jul 29 18:02:48 2019	(r350419)
+++ head/include/stdlib.h	Mon Jul 29 19:02:16 2019	(r350420)
@@ -297,6 +297,7 @@ int	 mergesort_b(void *, size_t, size_t, int (^)(const
 #endif
 int	 mkostemp(char *, int);
 int	 mkostemps(char *, int, int);
+int	 mkostempsat(int, char *, int, int);
 void	 qsort_r(void *, size_t, size_t, void *,
 	    int (*)(void *, const void *, const void *));
 int	 radixsort(const unsigned char **, int, const unsigned char *,

Modified: head/lib/libc/stdio/Makefile.inc
==============================================================================
--- head/lib/libc/stdio/Makefile.inc	Mon Jul 29 18:02:48 2019	(r350419)
+++ head/lib/libc/stdio/Makefile.inc	Mon Jul 29 19:02:16 2019	(r350420)
@@ -63,7 +63,7 @@ MLINKS+=getc.3 fgetc.3 getc.3 getc_unlocked.3 getc.3 g
 MLINKS+=getline.3 getdelim.3
 MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3
 MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3 mktemp.3 mkstemps.3 \
-	mktemp.3 mkostemp.3 mktemp.3 mkostemps.3
+	mktemp.3 mkostemp.3 mktemp.3 mkostemps.3 mktemp.3 mkostempsat.3
 MLINKS+=open_memstream.3 open_wmemstream.3
 MLINKS+=printf.3 asprintf.3 printf.3 dprintf.3 printf.3 fprintf.3 \
 	printf.3 snprintf.3 printf.3 sprintf.3 \

Modified: head/lib/libc/stdio/Symbol.map
==============================================================================
--- head/lib/libc/stdio/Symbol.map	Mon Jul 29 18:02:48 2019	(r350419)
+++ head/lib/libc/stdio/Symbol.map	Mon Jul 29 19:02:16 2019	(r350420)
@@ -171,6 +171,10 @@ FBSD_1.5 {
 	gets_s;
 };
 
+FBSD_1.6 {
+	mkostempsat;
+};
+
 FBSDprivate_1.0 {
 	_flockfile;
 	_flockfile_debug_stub;

Modified: head/lib/libc/stdio/mktemp.3
==============================================================================
--- head/lib/libc/stdio/mktemp.3	Mon Jul 29 18:02:48 2019	(r350419)
+++ head/lib/libc/stdio/mktemp.3	Mon Jul 29 19:02:16 2019	(r350420)
@@ -28,7 +28,7 @@
 .\"     @(#)mktemp.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd August 8, 2013
+.Dd July 29, 2019
 .Dt MKTEMP 3
 .Os
 .Sh NAME
@@ -46,6 +46,8 @@
 .Fn mkostemp "char *template" "int oflags"
 .Ft int
 .Fn mkostemps "char *template" "int suffixlen" "int oflags"
+.Ft int
+.Fn mkostempsat "int dfd" "char *template" "int suffixlen" "int oflags"
 .Ft char *
 .Fn mkdtemp "char *template"
 .In unistd.h
@@ -126,6 +128,21 @@ function
 are told the length of the suffix string.
 .Pp
 The
+.Fn mkostempsat
+function acts the same as
+.Fn mkostemps
+but takes an additional directory descriptor as a parameter.
+The temporary file is created relative to the corresponding
+directory, or to the current working directory if the special
+value
+.Dv AT_FDCWD
+is specified.
+If the template path is an absolute path, the
+.Fa dfd
+parameter is ignored and the behavior is identical to
+.Fn mkostemps .
+.Pp
+The
 .Fn mkdtemp
 function makes the same replacement to the template as in
 .Fn mktemp
@@ -262,9 +279,10 @@ and is not specified by
 .St -p1003.1-2008 .
 The
 .Fn mkostemp ,
-.Fn mkstemps
-and
+.Fn mkstemps ,
 .Fn mkostemps
+and
+.Fn mkostempsat
 functions do not conform to any standard.
 .Sh HISTORY
 A
@@ -293,6 +311,10 @@ and
 .Fn mkostemps
 functions appeared in
 .Fx 10.0 .
+The
+.Fn mkostempsat
+function appeared in
+.Fx 13.0 .
 .Sh BUGS
 This family of functions produces filenames which can be guessed,
 though the risk is minimized when large numbers of
@@ -308,10 +330,11 @@ and opening it for use
 (later in the user application)
 particularly dangerous from a security perspective.
 Whenever it is possible,
-.Fn mkstemp
-or
+.Fn mkstemp ,
 .Fn mkostemp
-should be used instead, since it does not have the race condition.
+or
+.Fn mkostempsat
+should be used instead, since they do not have the race condition.
 If
 .Fn mkstemp
 cannot be used, the filename created by

Modified: head/lib/libc/stdio/mktemp.c
==============================================================================
--- head/lib/libc/stdio/mktemp.c	Mon Jul 29 18:02:48 2019	(r350419)
+++ head/lib/libc/stdio/mktemp.c	Mon Jul 29 19:02:16 2019	(r350420)
@@ -49,17 +49,25 @@ __FBSDID("$FreeBSD$");
 
 char *_mktemp(char *);
 
-static int _gettemp(char *, int *, int, int, int);
+static int _gettemp(int, char *, int *, int, int, int);
 
 static const unsigned char padchar[] =
 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
 int
+mkostempsat(int dfd, char *path, int slen, int oflags)
+{
+	int fd;
+
+	return (_gettemp(dfd, path, &fd, 0, slen, oflags) ? fd : -1);
+}
+
+int
 mkostemps(char *path, int slen, int oflags)
 {
 	int fd;
 
-	return (_gettemp(path, &fd, 0, slen, oflags) ? fd : -1);
+	return (_gettemp(AT_FDCWD, path, &fd, 0, slen, oflags) ? fd : -1);
 }
 
 int
@@ -67,7 +75,7 @@ mkstemps(char *path, int slen)
 {
 	int fd;
 
-	return (_gettemp(path, &fd, 0, slen, 0) ? fd : -1);
+	return (_gettemp(AT_FDCWD, path, &fd, 0, slen, 0) ? fd : -1);
 }
 
 int
@@ -75,7 +83,7 @@ mkostemp(char *path, int oflags)
 {
 	int fd;
 
-	return (_gettemp(path, &fd, 0, 0, oflags) ? fd : -1);
+	return (_gettemp(AT_FDCWD, path, &fd, 0, 0, oflags) ? fd : -1);
 }
 
 int
@@ -83,19 +91,19 @@ mkstemp(char *path)
 {
 	int fd;
 
-	return (_gettemp(path, &fd, 0, 0, 0) ? fd : -1);
+	return (_gettemp(AT_FDCWD, path, &fd, 0, 0, 0) ? fd : -1);
 }
 
 char *
 mkdtemp(char *path)
 {
-	return (_gettemp(path, (int *)NULL, 1, 0, 0) ? path : (char *)NULL);
+	return (_gettemp(AT_FDCWD, path, (int *)NULL, 1, 0, 0) ? path : (char *)NULL);
 }
 
 char *
 _mktemp(char *path)
 {
-	return (_gettemp(path, (int *)NULL, 0, 0, 0) ? path : (char *)NULL);
+	return (_gettemp(AT_FDCWD, path, (int *)NULL, 0, 0, 0) ? path : (char *)NULL);
 }
 
 __warn_references(mktemp,
@@ -108,7 +116,7 @@ mktemp(char *path)
 }
 
 static int
-_gettemp(char *path, int *doopen, int domkdir, int slen, int oflags)
+_gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags)
 {
 	char *start, *trv, *suffp, *carryp;
 	char *pad;
@@ -155,7 +163,7 @@ _gettemp(char *path, int *doopen, int domkdir, int sle
 		for (; trv > path; --trv) {
 			if (*trv == '/') {
 				*trv = '\0';
-				rval = stat(path, &sbuf);
+				rval = fstatat(dfd, path, &sbuf, 0);
 				*trv = '/';
 				if (rval != 0)
 					return (0);
@@ -168,11 +176,11 @@ _gettemp(char *path, int *doopen, int domkdir, int sle
 		}
 	}
 
+	oflags |= O_CREAT | O_EXCL | O_RDWR;
 	for (;;) {
 		if (doopen) {
-			if ((*doopen =
-			    _open(path, O_CREAT|O_EXCL|O_RDWR|oflags, 0600)) >=
-			    0)
+			*doopen = _openat(dfd, path, oflags, 0600);
+			if (*doopen >= 0)
 				return (1);
 			if (errno != EEXIST)
 				return (0);

From owner-svn-src-head@freebsd.org  Mon Jul 29 20:26:04 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3EB6B4DA7;
 Mon, 29 Jul 2019 20:26:04 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id B57FD6B5D1;
 Mon, 29 Jul 2019 20:26:04 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90D535F4D;
 Mon, 29 Jul 2019 20:26:04 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TKQ4nt089484;
 Mon, 29 Jul 2019 20:26:04 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TKQ1Bc089469;
 Mon, 29 Jul 2019 20:26:01 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907292026.x6TKQ1Bc089469@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 29 Jul 2019 20:26:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350421 - in head/sys: compat/freebsd32 dev/bhnd/nvram
 dev/drm2 fs/devfs fs/ext2fs fs/fuse kern mips/broadcom rpc
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head/sys: compat/freebsd32 dev/bhnd/nvram dev/drm2
 fs/devfs fs/ext2fs fs/fuse kern mips/broadcom rpc
X-SVN-Commit-Revision: 350421
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: B57FD6B5D1
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.97)[-0.973,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 20:26:04 -0000

Author: markj
Date: Mon Jul 29 20:26:01 2019
New Revision: 350421
URL: https://svnweb.freebsd.org/changeset/base/350421

Log:
  Avoid relying on header pollution from sys/refcount.h.
  
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/compat/freebsd32/freebsd32_capability.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c
  head/sys/dev/drm2/drmP.h
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/fuse/fuse_vnops.c
  head/sys/kern/kern_event.c
  head/sys/kern/kern_sig.c
  head/sys/kern/sys_process.c
  head/sys/kern/uipc_shm.c
  head/sys/mips/broadcom/bhnd_nexus.c
  head/sys/rpc/svc_vc.c

Modified: head/sys/compat/freebsd32/freebsd32_capability.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_capability.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/compat/freebsd32/freebsd32_capability.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/capsicum.h>
 #include <sys/filedesc.h>
+#include <sys/limits.h>
 #include <sys/malloc.h>
 #include <sys/proc.h>
 #include <sys/syscallsubr.h>

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
==============================================================================
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #ifdef _KERNEL
 #include <sys/param.h>
 #include <sys/ctype.h>
+#include <sys/limits.h>
 #include <sys/malloc.h>
 #include <sys/systm.h>
 #else /* !_KERNEL */

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
==============================================================================
--- head/sys/dev/bhnd/nvram/bhnd_nvram_store.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_store.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/hash.h>
+#include <sys/limits.h>
 #include <sys/queue.h>
 
 #ifdef _KERNEL

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
==============================================================================
--- head/sys/dev/bhnd/nvram/bhnd_nvram_value.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_value.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -31,6 +31,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
+#include <sys/limits.h>
 #include <sys/sbuf.h>
 
 #ifdef _KERNEL

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c
==============================================================================
--- head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -31,6 +31,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
+#include <sys/limits.h>
 #include <sys/sbuf.h>
 
 #ifdef _KERNEL

Modified: head/sys/dev/drm2/drmP.h
==============================================================================
--- head/sys/dev/drm2/drmP.h	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/dev/drm2/drmP.h	Mon Jul 29 20:26:01 2019	(r350421)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/stat.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/fcntl.h>
 #include <sys/uio.h>

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/fs/devfs/devfs_vnops.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -52,6 +52,7 @@
 #include <sys/filio.h>
 #include <sys/jail.h>
 #include <sys/kernel.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mman.h>

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/fs/ext2fs/ext2_vnops.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -51,6 +51,7 @@
 #include <sys/kernel.h>
 #include <sys/fcntl.h>
 #include <sys/filio.h>
+#include <sys/limits.h>
 #include <sys/sdt.h>
 #include <sys/stat.h>
 #include <sys/bio.h>

Modified: head/sys/fs/fuse/fuse_vnops.c
==============================================================================
--- head/sys/fs/fuse/fuse_vnops.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/fs/fuse/fuse_vnops.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/uio.h>
 #include <sys/malloc.h>
 #include <sys/queue.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/rwlock.h>
 #include <sys/sx.h>

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/kern/kern_event.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/capsicum.h>
 #include <sys/kernel.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/rwlock.h>

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/kern/kern_sig.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/kernel.h>
 #include <sys/ktr.h>
 #include <sys/ktrace.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/kern/sys_process.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/ktr.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/syscallsubr.h>

Modified: head/sys/kern/uipc_shm.c
==============================================================================
--- head/sys/kern/uipc_shm.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/kern/uipc_shm.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/filio.h>
 #include <sys/fnv_hash.h>
 #include <sys/kernel.h>
+#include <sys/limits.h>
 #include <sys/uio.h>
 #include <sys/signal.h>
 #include <sys/jail.h>

Modified: head/sys/mips/broadcom/bhnd_nexus.c
==============================================================================
--- head/sys/mips/broadcom/bhnd_nexus.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/mips/broadcom/bhnd_nexus.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/bus.h>
 #include <sys/intr.h>
+#include <sys/limits.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
 #include <sys/rman.h>

Modified: head/sys/rpc/svc_vc.c
==============================================================================
--- head/sys/rpc/svc_vc.c	Mon Jul 29 19:02:16 2019	(r350420)
+++ head/sys/rpc/svc_vc.c	Mon Jul 29 20:26:01 2019	(r350421)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include <sys/param.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>

From owner-svn-src-head@freebsd.org  Mon Jul 29 20:31:29 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A0E9B4EED;
 Mon, 29 Jul 2019 20:31:29 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 5C0D86B9B4;
 Mon, 29 Jul 2019 20:31:29 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36D255FB1;
 Mon, 29 Jul 2019 20:31:29 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TKVTLC093615;
 Mon, 29 Jul 2019 20:31:29 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TKVTwR093614;
 Mon, 29 Jul 2019 20:31:29 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907292031.x6TKVTwR093614@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 29 Jul 2019 20:31:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350422 - head/sys/arm64/arm64
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/arm64/arm64
X-SVN-Commit-Revision: 350422
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 5C0D86B9B4
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.97)[-0.971,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 20:31:29 -0000

Author: markj
Date: Mon Jul 29 20:31:28 2019
New Revision: 350422
URL: https://svnweb.freebsd.org/changeset/base/350422

Log:
  Remove an unneeded trunc_page() in pmap_fault().
  
  Reported by:	alc
  MFC with:	r350004
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Mon Jul 29 20:26:01 2019	(r350421)
+++ head/sys/arm64/arm64/pmap.c	Mon Jul 29 20:31:28 2019	(r350422)
@@ -5790,7 +5790,7 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
 		    (pmap_load(pte) & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) ==
 		    (ATTR_AP(ATTR_AP_RO) | ATTR_SW_DBM)) {
 			pmap_clear_bits(pte, ATTR_AP_RW_BIT);
-			pmap_invalidate_page(pmap, trunc_page(far));
+			pmap_invalidate_page(pmap, far);
 			rv = KERN_SUCCESS;
 		}
 		PMAP_UNLOCK(pmap);

From owner-svn-src-head@freebsd.org  Mon Jul 29 20:37:05 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3952FB5134;
 Mon, 29 Jul 2019 20:37:05 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 1BE916BBF5;
 Mon, 29 Jul 2019 20:37:05 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBA536119;
 Mon, 29 Jul 2019 20:37:04 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TKb47V095577;
 Mon, 29 Jul 2019 20:37:04 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TKb49C095576;
 Mon, 29 Jul 2019 20:37:04 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907292037.x6TKb49C095576@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 29 Jul 2019 20:37:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350423 - head/lib/libarchive/tests
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/lib/libarchive/tests
X-SVN-Commit-Revision: 350423
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 1BE916BBF5
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.97)[-0.971,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 20:37:05 -0000

Author: markj
Date: Mon Jul 29 20:37:04 2019
New Revision: 350423
URL: https://svnweb.freebsd.org/changeset/base/350423

Log:
  Remove a duplicate file listing in the libarchive tests.
  
  MFC after:	3 days

Modified:
  head/lib/libarchive/tests/Makefile

Modified: head/lib/libarchive/tests/Makefile
==============================================================================
--- head/lib/libarchive/tests/Makefile	Mon Jul 29 20:31:28 2019	(r350422)
+++ head/lib/libarchive/tests/Makefile	Mon Jul 29 20:37:04 2019	(r350423)
@@ -581,7 +581,6 @@ ${PACKAGE}FILES+=	test_read_format_zip_jar.jar.uu
 ${PACKAGE}FILES+=	test_read_format_zip_length_at_end.zip.uu
 ${PACKAGE}FILES+=	test_read_format_zip_lzma_alone_leak.zipx.uu
 ${PACKAGE}FILES+=	test_read_format_zip_lzma.zipx.uu
-${PACKAGE}FILES+=	test_read_format_zip_lzma.zipx.uu
 ${PACKAGE}FILES+=	test_read_format_zip_lzma_multi.zipx.uu
 ${PACKAGE}FILES+=	test_read_format_zip_mac_metadata.zip.uu
 ${PACKAGE}FILES+=	test_read_format_zip_malformed1.zip.uu

From owner-svn-src-head@freebsd.org  Mon Jul 29 20:41:12 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0211EB5332;
 Mon, 29 Jul 2019 20:41:12 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id D62936BDF9;
 Mon, 29 Jul 2019 20:41:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB4F8625F;
 Mon, 29 Jul 2019 20:41:11 +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 x6TKfB07095818;
 Mon, 29 Jul 2019 20:41:11 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TKfB1P095817;
 Mon, 29 Jul 2019 20:41:11 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907292041.x6TKfB1P095817@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Mon, 29 Jul 2019 20:41:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350424 - head/sbin/camcontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/camcontrol
X-SVN-Commit-Revision: 350424
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: D62936BDF9
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.97)[-0.971,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 20:41:12 -0000

Author: mav
Date: Mon Jul 29 20:41:11 2019
New Revision: 350424
URL: https://svnweb.freebsd.org/changeset/base/350424

Log:
  Use present now scsi_mode_sense_subpage().
  
  MFC after:	2 weeks

Modified:
  head/sbin/camcontrol/timestamp.c

Modified: head/sbin/camcontrol/timestamp.c
==============================================================================
--- head/sbin/camcontrol/timestamp.c	Mon Jul 29 20:37:04 2019	(r350423)
+++ head/sbin/camcontrol/timestamp.c	Mon Jul 29 20:41:11 2019	(r350424)
@@ -79,7 +79,6 @@ set_restore_flags(struct cam_device *device, uint8_t *
 	int error = 0;
 	struct scsi_control_ext_page *control_page = NULL;
 	struct scsi_mode_header_10 *mode_hdr = NULL;
-	struct scsi_mode_sense_10 *cdb = NULL;
 	union ccb *ccb = NULL;
 	unsigned long mode_buf_size = sizeof(struct scsi_mode_header_10) +
 	    sizeof(struct scsi_mode_blk_desc) +
@@ -96,25 +95,19 @@ set_restore_flags(struct cam_device *device, uint8_t *
 	 * Get the control extension subpage, we'll send it back modified to
 	 * enable SCSI control over the tape drive's timestamp
 	 */
-	scsi_mode_sense_len(&ccb->csio,
+	scsi_mode_sense_subpage(&ccb->csio,
 	    /*retries*/ retry_count,
 	    /*cbfcnp*/ NULL,
 	    /*tag_action*/ task_attr,
 	    /*dbd*/ 0,
 	    /*page_control*/ SMS_PAGE_CTRL_CURRENT,
 	    /*page*/ SCEP_PAGE_CODE,
+	    /*subpage*/ SCEP_SUBPAGE_CODE,
 	    /*param_buf*/ &mode_buf[0],
 	    /*param_len*/ mode_buf_size,
 	    /*minimum_cmd_size*/ 10,
 	    /*sense_len*/ SSD_FULL_SIZE,
 	    /*timeout*/ timeout ? timeout : 5000);
-	/*
-	 * scsi_mode_sense_len does not have a subpage argument at the moment,
-	 * so we have to manually set the subpage code before calling
-	 * cam_send_ccb().
-	 */
-	cdb = (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes;
-	cdb->subpage = SCEP_SUBPAGE_CODE;
 
 	ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
 	if (retry_count > 0)

From owner-svn-src-head@freebsd.org  Mon Jul 29 20:43:09 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 304F5B5455;
 Mon, 29 Jul 2019 20:43:09 +0000 (UTC)
 (envelope-from jilles@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 0C08A6C30C;
 Mon, 29 Jul 2019 20:43:09 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2846762E8;
 Mon, 29 Jul 2019 20:43:08 +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 x6TKh8TD001567;
 Mon, 29 Jul 2019 20:43:08 GMT (envelope-from jilles@FreeBSD.org)
Received: (from jilles@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TKh8hI001566;
 Mon, 29 Jul 2019 20:43:08 GMT (envelope-from jilles@FreeBSD.org)
Message-Id: <201907292043.x6TKh8hI001566@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jilles set sender to
 jilles@FreeBSD.org using -f
From: Jilles Tjoelker <jilles@FreeBSD.org>
Date: Mon, 29 Jul 2019 20:43:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350425 - head/usr.bin/printf
X-SVN-Group: head
X-SVN-Commit-Author: jilles
X-SVN-Commit-Paths: head/usr.bin/printf
X-SVN-Commit-Revision: 350425
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 0C08A6C30C
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.97)[-0.971,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 20:43:09 -0000

Author: jilles
Date: Mon Jul 29 20:43:07 2019
New Revision: 350425
URL: https://svnweb.freebsd.org/changeset/base/350425

Log:
  printf(1): Note that \c only works in %b strings
  
  PR:		238313
  Reported by:	Andras Farkas
  MFC after:	1 week

Modified:
  head/usr.bin/printf/printf.1

Modified: head/usr.bin/printf/printf.1
==============================================================================
--- head/usr.bin/printf/printf.1	Mon Jul 29 20:41:11 2019	(r350424)
+++ head/usr.bin/printf/printf.1	Mon Jul 29 20:43:07 2019	(r350425)
@@ -31,7 +31,7 @@
 .\"	@(#)printf.1	8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd April 21, 2014
+.Dd July 29, 2019
 .Dt PRINTF 1
 .Os
 .Sh NAME
@@ -87,8 +87,6 @@ are as follows:
 Write a <bell> character.
 .It Cm \eb
 Write a <backspace> character.
-.It Cm \ec
-Ignore remaining characters in this string.
 .It Cm \ef
 Write a <form-feed> character.
 .It Cm \en
@@ -289,7 +287,12 @@ The permitted escape sequences are slightly different 
 octal escapes are
 .Cm \e0 Ns Ar num
 instead of
-.Cm \e Ns Ar num .
+.Cm \e Ns Ar num
+and that an additional escape sequence
+.Cm \ec
+stops further output from this
+.Nm
+invocation.
 .It Cm n$
 Allows reordering of the output according to
 .Ar argument .

From owner-svn-src-head@freebsd.org  Mon Jul 29 20:50:27 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31328B584E;
 Mon, 29 Jul 2019 20:50:27 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 10DD46C776;
 Mon, 29 Jul 2019 20:50:27 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDBCE6307;
 Mon, 29 Jul 2019 20:50:26 +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 x6TKoQrS002007;
 Mon, 29 Jul 2019 20:50:26 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TKoQJv002006;
 Mon, 29 Jul 2019 20:50:26 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907292050.x6TKoQJv002006@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Mon, 29 Jul 2019 20:50:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350426 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350426
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 10DD46C776
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.97)[-0.973,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 20:50:27 -0000

Author: asomers
Date: Mon Jul 29 20:50:26 2019
New Revision: 350426
URL: https://svnweb.freebsd.org/changeset/base/350426

Log:
  sendfile: don't panic when VOP_GETPAGES_ASYNC returns an error
  
  This is a partial merge of 350144 from projects/fuse2
  
  PR:		236466
  Reviewed by:	markj
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21095

Modified:
  head/sys/kern/kern_sendfile.c
Directory Properties:
  head/   (props changed)

Modified: head/sys/kern/kern_sendfile.c
==============================================================================
--- head/sys/kern/kern_sendfile.c	Mon Jul 29 20:43:07 2019	(r350425)
+++ head/sys/kern/kern_sendfile.c	Mon Jul 29 20:50:26 2019	(r350426)
@@ -347,13 +347,13 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
  * Iterate through pages vector and request paging for non-valid pages.
  */
 static int
-sendfile_swapin(vm_object_t obj, struct sf_io *sfio, off_t off, off_t len,
-    int npages, int rhpages, int flags)
+sendfile_swapin(vm_object_t obj, struct sf_io *sfio, int *nios, off_t off,
+    off_t len, int npages, int rhpages, int flags)
 {
 	vm_page_t *pa = sfio->pa;
-	int grabbed, nios;
+	int grabbed;
 
-	nios = 0;
+	*nios = 0;
 	flags = (flags & SF_NODISKIO) ? VM_ALLOC_NOWAIT : 0;
 
 	/*
@@ -372,7 +372,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
 	}
 
 	for (int i = 0; i < npages;) {
-		int j, a, count, rv __unused;
+		int j, a, count, rv;
 
 		/* Skip valid pages. */
 		if (vm_page_is_valid(pa[i], vmoff(i, off) & PAGE_MASK,
@@ -435,6 +435,17 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
 		rv = vm_pager_get_pages_async(obj, pa + i, count, NULL,
 		    i + count == npages ? &rhpages : NULL,
 		    &sendfile_iodone, sfio);
+		if (rv != VM_PAGER_OK) {
+			for (j = i; j < i + count; j++) {
+				if (pa[j] != bogus_page) {
+					vm_page_lock(pa[j]);
+					vm_page_unwire(pa[j], PQ_INACTIVE);
+					vm_page_unlock(pa[j]);
+				}
+			}
+			VM_OBJECT_WUNLOCK(obj);
+			return (EIO);
+		}
 		KASSERT(rv == VM_PAGER_OK, ("%s: pager fail obj %p page %p",
 		    __func__, obj, pa[i]));
 
@@ -456,15 +467,15 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
 
 			}
 		i += count;
-		nios++;
+		(*nios)++;
 	}
 
 	VM_OBJECT_WUNLOCK(obj);
 
-	if (nios == 0 && npages != 0)
+	if (*nios == 0 && npages != 0)
 		SFSTAT_INC(sf_noiocnt);
 
-	return (nios);
+	return (0);
 }
 
 static int
@@ -788,8 +799,14 @@ retry_space:
 		sfio->so = so;
 		sfio->error = 0;
 
-		nios = sendfile_swapin(obj, sfio, off, space, npages, rhpages,
-		    flags);
+		error = sendfile_swapin(obj, sfio, &nios, off, space, npages,
+		    rhpages, flags);
+		if (error != 0) {
+			if (vp != NULL)
+				VOP_UNLOCK(vp, 0);
+			free(sfio, M_TEMP);
+			goto done;
+		}
 
 		/*
 		 * Loop and construct maximum sized mbuf chain to be bulk

From owner-svn-src-head@freebsd.org  Mon Jul 29 21:21:54 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73E4CB6968;
 Mon, 29 Jul 2019 21:21:54 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 569256DE15;
 Mon, 29 Jul 2019 21:21:54 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CC166965;
 Mon, 29 Jul 2019 21:21:54 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TLLsnc022788;
 Mon, 29 Jul 2019 21:21:54 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TLLsiX022787;
 Mon, 29 Jul 2019 21:21:54 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907292121.x6TLLsiX022787@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 29 Jul 2019 21:21:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350427 - head/sys/arm64/arm64
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/arm64/arm64
X-SVN-Commit-Revision: 350427
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 569256DE15
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.96)[-0.964,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 21:21:54 -0000

Author: markj
Date: Mon Jul 29 21:21:53 2019
New Revision: 350427
URL: https://svnweb.freebsd.org/changeset/base/350427

Log:
  Have arm64's pmap_fault() handle WnR faults on dirty PTEs.
  
  If we take a WnR permission fault on a managed, writeable and dirty
  PTE, simply return success without calling the main fault handler.  This
  situation can occur if multiple threads simultaneously access a clean
  writeable mapping and trigger WnR faults; losers of the race to mark the
  PTE dirty would end up calling the main fault handler, which had no work
  to do.
  
  Reported by:	alc
  Reviewed by:	alc
  MFC with:	r350004
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21097

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Mon Jul 29 20:50:26 2019	(r350426)
+++ head/sys/arm64/arm64/pmap.c	Mon Jul 29 21:21:53 2019	(r350427)
@@ -5743,7 +5743,7 @@ pmap_sync_icache(pmap_t pmap, vm_offset_t va, vm_size_
 int
 pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
 {
-	pt_entry_t *pte;
+	pt_entry_t pte, *ptep;
 	register_t intr;
 	uint64_t ec, par;
 	int lvl, rv;
@@ -5767,9 +5767,9 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
 	case ISS_DATA_DFSC_AFF_L2:
 	case ISS_DATA_DFSC_AFF_L3:
 		PMAP_LOCK(pmap);
-		pte = pmap_pte(pmap, far, &lvl);
-		if (pte != NULL) {
-			pmap_set_bits(pte, ATTR_AF);
+		ptep = pmap_pte(pmap, far, &lvl);
+		if (ptep != NULL) {
+			pmap_set_bits(ptep, ATTR_AF);
 			rv = KERN_SUCCESS;
 			/*
 			 * XXXMJ as an optimization we could mark the entry
@@ -5785,12 +5785,13 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
 		    (esr & ISS_DATA_WnR) == 0)
 			return (rv);
 		PMAP_LOCK(pmap);
-		pte = pmap_pte(pmap, far, &lvl);
-		if (pte != NULL &&
-		    (pmap_load(pte) & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) ==
-		    (ATTR_AP(ATTR_AP_RO) | ATTR_SW_DBM)) {
-			pmap_clear_bits(pte, ATTR_AP_RW_BIT);
-			pmap_invalidate_page(pmap, far);
+		ptep = pmap_pte(pmap, far, &lvl);
+		if (ptep != NULL &&
+		    ((pte = pmap_load(ptep)) & ATTR_SW_DBM) != 0) {
+			if ((pte & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RO)) {
+				pmap_clear_bits(ptep, ATTR_AP_RW_BIT);
+				pmap_invalidate_page(pmap, far);
+			}
 			rv = KERN_SUCCESS;
 		}
 		PMAP_UNLOCK(pmap);

From owner-svn-src-head@freebsd.org  Mon Jul 29 21:26:27 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC43CB6AFB;
 Mon, 29 Jul 2019 21:26:27 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 7CAF26E0C0;
 Mon, 29 Jul 2019 21:26:27 +0000 (UTC)
 (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 550CA6AD6;
 Mon, 29 Jul 2019 21:26:27 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TLQRtF025290;
 Mon, 29 Jul 2019 21:26:27 GMT (envelope-from oshogbo@FreeBSD.org)
Received: (from oshogbo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TLQR8N025289;
 Mon, 29 Jul 2019 21:26:27 GMT (envelope-from oshogbo@FreeBSD.org)
Message-Id: <201907292126.x6TLQR8N025289@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to
 oshogbo@FreeBSD.org using -f
From: Mariusz Zaborski <oshogbo@FreeBSD.org>
Date: Mon, 29 Jul 2019 21:26:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350428 - head/lib/libcasper/libcasper
X-SVN-Group: head
X-SVN-Commit-Author: oshogbo
X-SVN-Commit-Paths: head/lib/libcasper/libcasper
X-SVN-Commit-Revision: 350428
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 7CAF26E0C0
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.96)[-0.964,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 21:26:27 -0000

Author: oshogbo
Date: Mon Jul 29 21:26:26 2019
New Revision: 350428
URL: https://svnweb.freebsd.org/changeset/base/350428

Log:
  libcasper: remove reference to deprecated system.random

Modified:
  head/lib/libcasper/libcasper/libcasper.3

Modified: head/lib/libcasper/libcasper/libcasper.3
==============================================================================
--- head/lib/libcasper/libcasper/libcasper.3	Mon Jul 29 21:21:53 2019	(r350427)
+++ head/lib/libcasper/libcasper/libcasper.3	Mon Jul 29 21:26:26 2019	(r350428)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 5, 2018
+.Dd July 29, 2019
 .Dt LIBCASPER 3
 .Os
 .Sh NAME
@@ -212,9 +212,6 @@ compatible API
 provides
 .Xr getpwent 3
 compatible API
-.It system.random
-allows to obtain entropy from
-.Pa /dev/random
 .It system.sysctl
 provides
 .Xr sysctlbyname 3

From owner-svn-src-head@freebsd.org  Mon Jul 29 21:42:58 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 440A6B72C1;
 Mon, 29 Jul 2019 21:42:58 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 1CE336F0C4;
 Mon, 29 Jul 2019 21:42:58 +0000 (UTC)
 (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E39AA6E7E;
 Mon, 29 Jul 2019 21:42:57 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TLgvrK038104;
 Mon, 29 Jul 2019 21:42:57 GMT (envelope-from oshogbo@FreeBSD.org)
Received: (from oshogbo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TLgvWo038102;
 Mon, 29 Jul 2019 21:42:57 GMT (envelope-from oshogbo@FreeBSD.org)
Message-Id: <201907292142.x6TLgvWo038102@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to
 oshogbo@FreeBSD.org using -f
From: Mariusz Zaborski <oshogbo@FreeBSD.org>
Date: Mon, 29 Jul 2019 21:42:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350429 - in head/sys: kern sys
X-SVN-Group: head
X-SVN-Commit-Author: oshogbo
X-SVN-Commit-Paths: in head/sys: kern sys
X-SVN-Commit-Revision: 350429
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 1CE336F0C4
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.97)[-0.965,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 21:42:58 -0000

Author: oshogbo
Date: Mon Jul 29 21:42:57 2019
New Revision: 350429
URL: https://svnweb.freebsd.org/changeset/base/350429

Log:
  proc: make clear_orphan an public API
  
  This will be useful for other patches with process descriptors.
  Change its name as well.
  
  Reviewed by:	markj, kib

Modified:
  head/sys/kern/kern_exit.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Mon Jul 29 21:26:26 2019	(r350428)
+++ head/sys/kern/kern_exit.c	Mon Jul 29 21:42:57 2019	(r350429)
@@ -167,8 +167,8 @@ reaper_clear(struct proc *p)
 		proc_id_clear(PROC_ID_REAP, p->p_reapsubtree);
 }
 
-static void
-clear_orphan(struct proc *p)
+void
+proc_clear_orphan(struct proc *p)
 {
 	struct proc *p1;
 
@@ -522,7 +522,7 @@ exit1(struct thread *td, int rval, int signo)
 			 * list due to present P_TRACED flag. Clear
 			 * orphan link for q now while q is locked.
 			 */
-			clear_orphan(q);
+			proc_clear_orphan(q);
 			q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE);
 			q->p_flag2 &= ~P2_PTRACE_FSTP;
 			q->p_ptevents = 0;
@@ -556,7 +556,7 @@ exit1(struct thread *td, int rval, int signo)
 			kern_psignal(q, q->p_pdeathsig);
 		CTR2(KTR_PTRACE, "exit: pid %d, clearing orphan %d", p->p_pid,
 		    q->p_pid);
-		clear_orphan(q);
+		proc_clear_orphan(q);
 		PROC_UNLOCK(q);
 	}
 
@@ -912,7 +912,7 @@ proc_reap(struct thread *td, struct proc *p, int *stat
 	reaper_clear(p);
 	proc_id_clear(PROC_ID_PID, p->p_pid);
 	PROC_LOCK(p);
-	clear_orphan(p);
+	proc_clear_orphan(p);
 	PROC_UNLOCK(p);
 	leavepgrp(p);
 	if (p->p_procdesc != NULL)
@@ -1372,7 +1372,7 @@ proc_reparent(struct proc *child, struct proc *parent,
 	LIST_REMOVE(child, p_sibling);
 	LIST_INSERT_HEAD(&parent->p_children, child, p_sibling);
 
-	clear_orphan(child);
+	proc_clear_orphan(child);
 	if (child->p_flag & P_TRACED) {
 		if (LIST_EMPTY(&child->p_pptr->p_orphans)) {
 			child->p_treeflag |= P_TREE_FIRST_ORPHAN;

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Mon Jul 29 21:26:26 2019	(r350428)
+++ head/sys/sys/proc.h	Mon Jul 29 21:42:57 2019	(r350429)
@@ -1074,6 +1074,7 @@ void	proc_wkilled(struct proc *p);
 struct	pstats *pstats_alloc(void);
 void	pstats_fork(struct pstats *src, struct pstats *dst);
 void	pstats_free(struct pstats *ps);
+void	proc_clear_orphan(struct proc *p);
 void	reaper_abandon_children(struct proc *p, bool exiting);
 int	securelevel_ge(struct ucred *cr, int level);
 int	securelevel_gt(struct ucred *cr, int level);

From owner-svn-src-head@freebsd.org  Mon Jul 29 21:53:03 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93004B760F;
 Mon, 29 Jul 2019 21:53:03 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 762706F677;
 Mon, 29 Jul 2019 21:53:03 +0000 (UTC)
 (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FCC47047;
 Mon, 29 Jul 2019 21:53:03 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TLr35P044108;
 Mon, 29 Jul 2019 21:53:03 GMT (envelope-from oshogbo@FreeBSD.org)
Received: (from oshogbo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TLr2s8044106;
 Mon, 29 Jul 2019 21:53:02 GMT (envelope-from oshogbo@FreeBSD.org)
Message-Id: <201907292153.x6TLr2s8044106@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to
 oshogbo@FreeBSD.org using -f
From: Mariusz Zaborski <oshogbo@FreeBSD.org>
Date: Mon, 29 Jul 2019 21:53:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350430 - in head: share/man/man9 sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: oshogbo
X-SVN-Commit-Paths: in head: share/man/man9 sys/sys
X-SVN-Commit-Revision: 350430
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 762706F677
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.97)[-0.965,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 21:53:03 -0000

Author: oshogbo
Date: Mon Jul 29 21:53:02 2019
New Revision: 350430
URL: https://svnweb.freebsd.org/changeset/base/350430

Log:
  seqc: add man page
  
  Reviewed by:	markj
  Earlier version reviewed by:	emaste, mjg, bcr, 0mp
  Differential Revision:	https://reviews.freebsd.org/D16744

Added:
  head/share/man/man9/seqc.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile
  head/sys/sys/seqc.h

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Mon Jul 29 21:42:57 2019	(r350429)
+++ head/share/man/man9/Makefile	Mon Jul 29 21:53:02 2019	(r350430)
@@ -289,6 +289,7 @@ MAN=	accept_filter.9 \
 	securelevel_gt.9 \
 	selrecord.9 \
 	sema.9 \
+	seqc.9 \
 	sf_buf.9 \
 	sglist.9 \
 	shm_map.9 \
@@ -1825,6 +1826,10 @@ MLINKS+=sema.9 sema_destroy.9 \
 	sema.9 sema_trywait.9 \
 	sema.9 sema_value.9 \
 	sema.9 sema_wait.9
+MLINKS+=seqc.9 seqc_consistent.9 \
+	seqc.9 seqc_read.9 \
+	seqc.9 seqc_write_begin.9 \
+	seqc.9 seqc_write_end.9
 MLINKS+=sf_buf.9 sf_buf_alloc.9 \
 	sf_buf.9 sf_buf_free.9 \
 	sf_buf.9 sf_buf_kva.9 \

Added: head/share/man/man9/seqc.9
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man9/seqc.9	Mon Jul 29 21:53:02 2019	(r350430)
@@ -0,0 +1,138 @@
+.\"
+.\" Copyright (C) 2019 Mariusz Zaborski <oshogbo@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice(s), this list of conditions and the following disclaimer as
+.\"    the first lines of this file unmodified other than the possible
+.\"    addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice(s), this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 29, 2019
+.Dt SEQC 9
+.Os
+.Sh NAME
+.Nm seqc_consistent ,
+.Nm seqc_read ,
+.Nm seqc_write_begin ,
+.Nm seqc_write_end
+.Nd "lockless read algorithm"
+.Sh SYNOPSIS
+.In sys/seqc.h
+.Ft void
+.Fn seqc_write_begin "seqc_t *seqcp"
+.Ft void
+.Fn seqc_write_end "seqc_t *seqcp"
+.Ft seqc_t
+.Fn seqc_read "seqc_t *seqcp"
+.Ft seqc_t
+.Fn seqc_consistent "const seqc_t *seqcp" "seqc_t oldseqc"
+.Sh DESCRIPTION
+The
+.Nm seqc
+allows zero or more readers and zero or one writer to concurrently access
+an object, providing a consistent snapshot of the object for readers.
+No mutual exclusion between readers and writers is required,
+but readers may be starved indefinitely by writers.
+.Pp
+The functions
+.Fn seqc_write_begin
+and
+.Fn seqc_write_end
+are used to create a transaction for writer, and notify the readers that the
+object will be modified.
+.Pp
+The
+.Fn seqc_read
+function returns the current sequence number.
+If a writer has started a transaction, this function will spin until the
+transaction has ended.
+.Pp
+The
+.Fn seqc_consistent
+function compares the sequence number with a previously fetched value.
+The
+.Fa oldseqc
+variable should contain a sequence number from the beginning of read
+transaction.
+.Pp
+The reader at the end of a transaction checks if the sequence number has
+changed.
+If the sequence number didn't change the object wasn't modified, and fetched
+variables are valid.
+If the sequence number changed the object was modified and the fetch should be
+repeated.
+In case when sequence number is odd the object change is in progress and the
+reader will wait until the write will the sequence number will become even.
+.Sh EXAMPLES
+The following example for a writer changees the
+.Va var1
+and
+.Va var2
+variables in the
+.Va obj
+structure:
+.Bd -literal
+lock_exclusive(&obj->lock);
+seqc_write_begin(&obj->seqc);
+obj->var1 = 1;
+obj->var2 = 2;
+seqc_write_end(&obj->seqc);
+unlock_exclusive(&obj->lock);
+.Ed
+The following example for a reader reads the
+.Va var1
+and
+.Va var2
+variables from the
+.Va obj
+structure.
+In the case where the sequence number was changed it restarts the whole process.
+.Bd -literal
+int var1, var2;
+seqc_t seqc;
+
+for (;;) {
+	seqc = seqc_read(&obj->seqc);
+	var1 = obj->var1;
+	var2 = obj->var2;
+	if (seqc_consistent(&obj->seqc, seqc))
+		break;
+}
+.Ed
+.Sh AUTHORS
+The
+.Nm seqc
+functions was implemented by
+.An Mateusz Guzik Aq Mt mjg@FreeBSD.org .
+This manual page was written by
+.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org .
+.Sh CAVEATS
+There is no guarantee of progress for readers.
+In case when there are a lot of writers the reader can be starved.
+This concern may be solved by returning error after a few attempts.
+.Pp
+Theoretically if reading takes a very long time, and when there are many writers
+the counter may overflow and wrap around to the same value.
+In that case the reader will not notice that the object was changed.
+Given that this needs 4 billion transactional writes across a single contended
+reader, it is unlikely to ever happen.
+This could be avoided by extending the interface to allow 64-bit counters.

Modified: head/sys/sys/seqc.h
==============================================================================
--- head/sys/sys/seqc.h	Mon Jul 29 21:42:57 2019	(r350429)
+++ head/sys/sys/seqc.h	Mon Jul 29 21:53:02 2019	(r350430)
@@ -40,55 +40,6 @@ typedef uint32_t seqc_t;
 
 #ifdef _KERNEL
 
-/*
- * seqc allows readers and writers to work with a consistent snapshot. Modifying
- * operations must be enclosed within a transaction delineated by
- * seqc_write_beg/seqc_write_end. The trick works by having the writer increment
- * the sequence number twice, at the beginning and end of the transaction.
- * The reader detects that the sequence number has not changed between its start
- * and end, and that the sequence number is even, to validate consistency.
- *
- * Some fencing (both hard fencing and compiler barriers) may be needed,
- * depending on the cpu. Modern AMD cpus provide strong enough guarantees to not
- * require any fencing by the reader or writer.
- *
- * Example usage:
- *
- * writers:
- *     lock_exclusive(&obj->lock);
- *     seqc_write_begin(&obj->seqc);
- *     obj->var1 = ...;
- *     obj->var2 = ...;
- *     seqc_write_end(&obj->seqc);
- *     unlock_exclusive(&obj->lock);
- *
- * readers:
- *    int var1, var2;
- *    seqc_t seqc;
- *
- *    for (;;) {
- *    	      seqc = seqc_read(&obj->seqc);
- *            var1 = obj->var1;
- *            var2 = obj->var2;
- *            if (seqc_consistent(&obj->seqc, seqc))
- *                   break;
- *    }
- *    .....
- *
- * Writers may not block or sleep in any way.
- *
- * There are 2 minor caveats in this implementation:
- *
- * 1. There is no guarantee of progress. That is, a large number of writers can
- * interfere with the execution of the readers and cause the code to live-lock
- * in a loop trying to acquire a consistent snapshot.
- *
- * 2. If the reader loops long enough, the counter may overflow and eventually
- * wrap back to its initial value, fooling the reader into accepting the
- * snapshot.  Given that this needs 4 billion transactional writes across a
- * single contended reader, it is unlikely to ever happen.
- */		
-
 /* A hack to get MPASS macro */
 #include <sys/lock.h>
 

From owner-svn-src-head@freebsd.org  Mon Jul 29 22:01:30 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63192B78F3;
 Mon, 29 Jul 2019 22:01:30 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 193456FB61;
 Mon, 29 Jul 2019 22:01:30 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA3E370BB;
 Mon, 29 Jul 2019 22:01:29 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TM1TK5044678;
 Mon, 29 Jul 2019 22:01:29 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TM1THa044675;
 Mon, 29 Jul 2019 22:01:29 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907292201.x6TM1THa044675@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 29 Jul 2019 22:01:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350431 - in head/sys: kern vm
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head/sys: kern vm
X-SVN-Commit-Revision: 350431
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 193456FB61
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.97)[-0.966,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 22:01:30 -0000

Author: markj
Date: Mon Jul 29 22:01:28 2019
New Revision: 350431
URL: https://svnweb.freebsd.org/changeset/base/350431

Log:
  Centralize the logic in vfs_vmio_unwire() and sendfile_free_page().
  
  Both of these functions atomically unwire a page, optionally attempt
  to free the page, and enqueue or requeue the page.  Add functions
  vm_page_release() and vm_page_release_locked() to perform the same task.
  The latter must be called with the page's object lock held.
  
  As a side effect of this refactoring, the buffer cache will no longer
  attempt to free mapped pages when completing direct I/O.  This is
  consistent with the handling of pages by sendfile(SF_NOCACHE).
  
  Reviewed by:	alc, kib
  MFC after:	2 weeks
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D20986

Modified:
  head/sys/kern/kern_sendfile.c
  head/sys/kern/vfs_bio.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h

Modified: head/sys/kern/kern_sendfile.c
==============================================================================
--- head/sys/kern/kern_sendfile.c	Mon Jul 29 21:53:02 2019	(r350430)
+++ head/sys/kern/kern_sendfile.c	Mon Jul 29 22:01:28 2019	(r350431)
@@ -121,76 +121,22 @@ sfstat_sysctl(SYSCTL_HANDLER_ARGS)
 SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQUE | CTLFLAG_RW,
     NULL, 0, sfstat_sysctl, "I", "sendfile statistics");
 
-/*
- * Detach mapped page and release resources back to the system.  Called
- * by mbuf(9) code when last reference to a page is freed.
- */
 static void
-sendfile_free_page(vm_page_t pg, bool nocache)
-{
-	bool freed;
-
-	vm_page_lock(pg);
-	/*
-	 * In either case check for the object going away on us.  This can
-	 * happen since we don't hold a reference to it.  If so, we're
-	 * responsible for freeing the page.  In 'noncache' case try to free
-	 * the page, but only if it is cheap to.
-	 */
-	if (vm_page_unwire_noq(pg)) {
-		vm_object_t obj;
-
-		if ((obj = pg->object) == NULL)
-			vm_page_free(pg);
-		else {
-			freed = false;
-			if (nocache && !vm_page_xbusied(pg) &&
-			    VM_OBJECT_TRYWLOCK(obj)) {
-				/* Only free unmapped pages. */
-				if (obj->ref_count == 0 ||
-				    !pmap_page_is_mapped(pg))
-					/*
-					 * The busy test before the object is
-					 * locked cannot be relied upon.
-					 */
-					freed = vm_page_try_to_free(pg);
-				VM_OBJECT_WUNLOCK(obj);
-			}
-			if (!freed) {
-				/*
-				 * If we were asked to not cache the page, place
-				 * it near the head of the inactive queue so
-				 * that it is reclaimed sooner.  Otherwise,
-				 * maintain LRU.
-				 */
-				if (nocache)
-					vm_page_deactivate_noreuse(pg);
-				else if (vm_page_active(pg))
-					vm_page_reference(pg);
-				else
-					vm_page_deactivate(pg);
-			}
-		}
-	}
-	vm_page_unlock(pg);
-}
-
-static void
 sendfile_free_mext(struct mbuf *m)
 {
 	struct sf_buf *sf;
 	vm_page_t pg;
-	bool nocache;
+	int flags;
 
 	KASSERT(m->m_flags & M_EXT && m->m_ext.ext_type == EXT_SFBUF,
 	    ("%s: m %p !M_EXT or !EXT_SFBUF", __func__, m));
 
 	sf = m->m_ext.ext_arg1;
 	pg = sf_buf_page(sf);
-	nocache = m->m_ext.ext_flags & EXT_FLAG_NOCACHE;
+	flags = (m->m_ext.ext_flags & EXT_FLAG_NOCACHE) != 0 ? VPR_TRYFREE : 0;
 
 	sf_buf_free(sf);
-	sendfile_free_page(pg, nocache);
+	vm_page_release(pg, flags);
 
 	if (m->m_ext.ext_flags & EXT_FLAG_SYNC) {
 		struct sendfile_sync *sfs = m->m_ext.ext_arg2;
@@ -208,21 +154,21 @@ sendfile_free_mext_pg(struct mbuf *m)
 {
 	struct mbuf_ext_pgs *ext_pgs;
 	vm_page_t pg;
-	int i;
-	bool nocache, cache_last;
+	int flags, i;
+	bool cache_last;
 
 	KASSERT(m->m_flags & M_EXT && m->m_ext.ext_type == EXT_PGS,
 	    ("%s: m %p !M_EXT or !EXT_PGS", __func__, m));
 
-	nocache = m->m_ext.ext_flags & EXT_FLAG_NOCACHE;
 	cache_last = m->m_ext.ext_flags & EXT_FLAG_CACHE_LAST;
 	ext_pgs = m->m_ext.ext_pgs;
+	flags = (m->m_ext.ext_flags & EXT_FLAG_NOCACHE) != 0 ? VPR_TRYFREE : 0;
 
 	for (i = 0; i < ext_pgs->npgs; i++) {
 		if (cache_last && i == ext_pgs->npgs - 1)
-			nocache = false;
+			flags = 0;
 		pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]);
-		sendfile_free_page(pg, nocache);
+		vm_page_release(pg, flags);
 	}
 
 	if (m->m_ext.ext_flags & EXT_FLAG_SYNC) {

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Mon Jul 29 21:53:02 2019	(r350430)
+++ head/sys/kern/vfs_bio.c	Mon Jul 29 22:01:28 2019	(r350431)
@@ -2895,47 +2895,6 @@ vfs_vmio_iodone(struct buf *bp)
 }
 
 /*
- * Unwire a page held by a buf and either free it or update the page queues to
- * reflect its recent use.
- */
-static void
-vfs_vmio_unwire(struct buf *bp, vm_page_t m)
-{
-	bool freed;
-
-	vm_page_lock(m);
-	if (vm_page_unwire_noq(m)) {
-		if ((bp->b_flags & B_DIRECT) != 0)
-			freed = vm_page_try_to_free(m);
-		else
-			freed = false;
-		if (!freed) {
-			/*
-			 * Use a racy check of the valid bits to determine
-			 * whether we can accelerate reclamation of the page.
-			 * The valid bits will be stable unless the page is
-			 * being mapped or is referenced by multiple buffers,
-			 * and in those cases we expect races to be rare.  At
-			 * worst we will either accelerate reclamation of a
-			 * valid page and violate LRU, or unnecessarily defer
-			 * reclamation of an invalid page.
-			 *
-			 * The B_NOREUSE flag marks data that is not expected to
-			 * be reused, so accelerate reclamation in that case
-			 * too.  Otherwise, maintain LRU.
-			 */
-			if (m->valid == 0 || (bp->b_flags & B_NOREUSE) != 0)
-				vm_page_deactivate_noreuse(m);
-			else if (vm_page_active(m))
-				vm_page_reference(m);
-			else
-				vm_page_deactivate(m);
-		}
-	}
-	vm_page_unlock(m);
-}
-
-/*
  * Perform page invalidation when a buffer is released.  The fully invalid
  * pages will be reclaimed later in vfs_vmio_truncate().
  */
@@ -2944,7 +2903,7 @@ vfs_vmio_invalidate(struct buf *bp)
 {
 	vm_object_t obj;
 	vm_page_t m;
-	int i, resid, poffset, presid;
+	int flags, i, resid, poffset, presid;
 
 	if (buf_mapped(bp)) {
 		BUF_CHECK_MAPPED(bp);
@@ -2963,6 +2922,7 @@ vfs_vmio_invalidate(struct buf *bp)
 	 *
 	 * See man buf(9) for more information
 	 */
+	flags = (bp->b_flags & B_NOREUSE) != 0 ? VPR_NOREUSE : 0;
 	obj = bp->b_bufobj->bo_object;
 	resid = bp->b_bufsize;
 	poffset = bp->b_offset & PAGE_MASK;
@@ -2984,7 +2944,7 @@ vfs_vmio_invalidate(struct buf *bp)
 		}
 		if (pmap_page_wired_mappings(m) == 0)
 			vm_page_set_invalid(m, poffset, presid);
-		vfs_vmio_unwire(bp, m);
+		vm_page_release_locked(m, flags);
 		resid -= presid;
 		poffset = 0;
 	}
@@ -3000,7 +2960,7 @@ vfs_vmio_truncate(struct buf *bp, int desiredpages)
 {
 	vm_object_t obj;
 	vm_page_t m;
-	int i;
+	int flags, i;
 
 	if (bp->b_npages == desiredpages)
 		return;
@@ -3015,14 +2975,22 @@ vfs_vmio_truncate(struct buf *bp, int desiredpages)
 	/*
 	 * The object lock is needed only if we will attempt to free pages.
 	 */
-	obj = (bp->b_flags & B_DIRECT) != 0 ? bp->b_bufobj->bo_object : NULL;
-	if (obj != NULL)
+	flags = (bp->b_flags & B_NOREUSE) != 0 ? VPR_NOREUSE : 0;
+	if ((bp->b_flags & B_DIRECT) != 0) {
+		flags |= VPR_TRYFREE;
+		obj = bp->b_bufobj->bo_object;
 		VM_OBJECT_WLOCK(obj);
+	} else {
+		obj = NULL;
+	}
 	for (i = desiredpages; i < bp->b_npages; i++) {
 		m = bp->b_pages[i];
 		KASSERT(m != bogus_page, ("allocbuf: bogus page found"));
 		bp->b_pages[i] = NULL;
-		vfs_vmio_unwire(bp, m);
+		if (obj != NULL)
+			vm_page_release_locked(m, flags);
+		else
+			vm_page_release(m, flags);
 	}
 	if (obj != NULL)
 		VM_OBJECT_WUNLOCK(obj);

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Mon Jul 29 21:53:02 2019	(r350430)
+++ head/sys/vm/vm_page.c	Mon Jul 29 22:01:28 2019	(r350431)
@@ -3747,29 +3747,92 @@ vm_page_unswappable(vm_page_t m)
 	vm_page_enqueue(m, PQ_UNSWAPPABLE);
 }
 
+static void
+vm_page_release_toq(vm_page_t m, int flags)
+{
+
+	/*
+	 * Use a check of the valid bits to determine whether we should
+	 * accelerate reclamation of the page.  The object lock might not be
+	 * held here, in which case the check is racy.  At worst we will either
+	 * accelerate reclamation of a valid page and violate LRU, or
+	 * unnecessarily defer reclamation of an invalid page.
+	 *
+	 * If we were asked to not cache the page, place it near the head of the
+	 * inactive queue so that is reclaimed sooner.
+	 */
+	if ((flags & (VPR_TRYFREE | VPR_NOREUSE)) != 0 || m->valid == 0)
+		vm_page_deactivate_noreuse(m);
+	else if (vm_page_active(m))
+		vm_page_reference(m);
+	else
+		vm_page_deactivate(m);
+}
+
 /*
- * Attempt to free the page.  If it cannot be freed, do nothing.  Returns true
- * if the page is freed and false otherwise.
- *
- * The page must be managed.  The page and its containing object must be
- * locked.
+ * Unwire a page and either attempt to free it or re-add it to the page queues.
  */
-bool
-vm_page_try_to_free(vm_page_t m)
+void
+vm_page_release(vm_page_t m, int flags)
 {
+	vm_object_t object;
+	bool freed;
 
-	vm_page_assert_locked(m);
+	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
+	    ("vm_page_release: page %p is unmanaged", m));
+
+	vm_page_lock(m);
+	if (m->object != NULL)
+		VM_OBJECT_ASSERT_UNLOCKED(m->object);
+	if (vm_page_unwire_noq(m)) {
+		if ((object = m->object) == NULL) {
+			vm_page_free(m);
+		} else {
+			freed = false;
+			if ((flags & VPR_TRYFREE) != 0 && !vm_page_busied(m) &&
+			    /* Depends on type stability. */
+			    VM_OBJECT_TRYWLOCK(object)) {
+				/*
+				 * Only free unmapped pages.  The busy test from
+				 * before the object was locked cannot be relied
+				 * upon.
+				 */
+				if ((object->ref_count == 0 ||
+				    !pmap_page_is_mapped(m)) && m->dirty == 0 &&
+				    !vm_page_busied(m)) {
+					vm_page_free(m);
+					freed = true;
+				}
+				VM_OBJECT_WUNLOCK(object);
+			}
+
+			if (!freed)
+				vm_page_release_toq(m, flags);
+		}
+	}
+	vm_page_unlock(m);
+}
+
+/* See vm_page_release(). */
+void
+vm_page_release_locked(vm_page_t m, int flags)
+{
+
 	VM_OBJECT_ASSERT_WLOCKED(m->object);
-	KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("page %p is unmanaged", m));
-	if (m->dirty != 0 || vm_page_wired(m) || vm_page_busied(m))
-		return (false);
-	if (m->object->ref_count != 0) {
-		pmap_remove_all(m);
-		if (m->dirty != 0)
-			return (false);
+	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
+	    ("vm_page_release_locked: page %p is unmanaged", m));
+
+	vm_page_lock(m);
+	if (vm_page_unwire_noq(m)) {
+		if ((flags & VPR_TRYFREE) != 0 &&
+		    (m->object->ref_count == 0 || !pmap_page_is_mapped(m)) &&
+		    m->dirty == 0 && !vm_page_busied(m)) {
+			vm_page_free(m);
+		} else {
+			vm_page_release_toq(m, flags);
+		}
 	}
-	vm_page_free(m);
-	return (true);
+	vm_page_unlock(m);
 }
 
 /*

Modified: head/sys/vm/vm_page.h
==============================================================================
--- head/sys/vm/vm_page.h	Mon Jul 29 21:53:02 2019	(r350430)
+++ head/sys/vm/vm_page.h	Mon Jul 29 22:01:28 2019	(r350431)
@@ -562,8 +562,12 @@ bool vm_page_reclaim_contig(int req, u_long npages, vm
 bool vm_page_reclaim_contig_domain(int domain, int req, u_long npages,
     vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary);
 void vm_page_reference(vm_page_t m);
+#define	VPR_TRYFREE	0x01
+#define	VPR_NOREUSE	0x02
+void vm_page_release(vm_page_t m, int flags);
+void vm_page_release_locked(vm_page_t m, int flags);
 bool vm_page_remove(vm_page_t);
-int vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t);
+int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t);
 vm_page_t vm_page_replace(vm_page_t mnew, vm_object_t object,
     vm_pindex_t pindex);
 void vm_page_requeue(vm_page_t m);
@@ -574,7 +578,6 @@ void vm_page_set_valid_range(vm_page_t m, int base, in
 int vm_page_sleep_if_busy(vm_page_t m, const char *msg);
 vm_offset_t vm_page_startup(vm_offset_t vaddr);
 void vm_page_sunbusy(vm_page_t m);
-bool vm_page_try_to_free(vm_page_t m);
 int vm_page_trysbusy(vm_page_t m);
 void vm_page_unhold_pages(vm_page_t *ma, int count);
 void vm_page_unswappable(vm_page_t m);

From owner-svn-src-head@freebsd.org  Mon Jul 29 22:07:44 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7231DB7BD4;
 Mon, 29 Jul 2019 22:07:44 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 532306FF59;
 Mon, 29 Jul 2019 22:07:44 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42DEC7249;
 Mon, 29 Jul 2019 22:07:44 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TM7iZN050077;
 Mon, 29 Jul 2019 22:07:44 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TM7hUk050075;
 Mon, 29 Jul 2019 22:07:43 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907292207.x6TM7hUk050075@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 29 Jul 2019 22:07:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350432 - head/contrib/elftoolchain/elfcopy
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/contrib/elftoolchain/elfcopy
X-SVN-Commit-Revision: 350432
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 532306FF59
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.98 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.98)[-0.982,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 22:07:44 -0000

Author: markj
Date: Mon Jul 29 22:07:43 2019
New Revision: 350432
URL: https://svnweb.freebsd.org/changeset/base/350432

Log:
  Merge r3778 and r3779 from ELFToolchain.
  
  Modify strip(1) to not accept multiple input files when an output
  file is specified.  There is no good way to handle this combination,
  and the change is compatible with binutils.
  
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/elfcopy/main.c
  head/contrib/elftoolchain/elfcopy/strip.1

Modified: head/contrib/elftoolchain/elfcopy/main.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/main.c	Mon Jul 29 22:01:28 2019	(r350431)
+++ head/contrib/elftoolchain/elfcopy/main.c	Mon Jul 29 22:07:43 2019	(r350432)
@@ -1187,6 +1187,12 @@ strip_main(struct elfcopy *ecp, int argc, char **argv)
 		ecp->strip = STRIP_ALL;
 	if (optind == argc)
 		strip_usage();
+	/*
+	 * Only accept a single input file if an output file had been
+	 * specified.
+	 */
+	if (outfile != NULL && argc != (optind + 1))
+		strip_usage();
 
 	for (i = optind; i < argc; i++)
 		create_file(ecp, argv[i], outfile);

Modified: head/contrib/elftoolchain/elfcopy/strip.1
==============================================================================
--- head/contrib/elftoolchain/elfcopy/strip.1	Mon Jul 29 22:01:28 2019	(r350431)
+++ head/contrib/elftoolchain/elfcopy/strip.1	Mon Jul 29 22:07:43 2019	(r350432)
@@ -23,7 +23,7 @@
 .\"
 .\" $Id: strip.1 3642 2018-10-14 14:24:28Z jkoshy $
 .\"
-.Dd September 17, 2011
+.Dd July 27, 2019
 .Dt STRIP 1
 .Os
 .Sh NAME
@@ -51,8 +51,16 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility is used to discard information from ELF objects.
+utility is used to discard information from the ELF objects
+specified by the arguments
+.Ar .
 .Pp
+If an explicit output file name is not specified using the
+.Fl o
+option, the
+.Nm
+utility will modify its input arguments in-place.
+.Pp
 The
 .Nm
 utility supports the following options:
@@ -65,8 +73,9 @@ Print a help message and exit.
 Remove all content except that which would be used for debugging.
 .It Fl o Ar outputfile | Fl -output-file= Ns Ar outputfile
 Write the stripped object to file
-.Ar outputfile .
-The default behaviour is to modify objects in place.
+.Ar outputfile
+instead of modifying the input in-place.
+Only a single input object should be specified if this option is used.
 .It Fl p | Fl -preserve-dates
 Preserve the object's access and modification times.
 .It Fl s | Fl -strip-all

From owner-svn-src-head@freebsd.org  Mon Jul 29 22:38:44 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2D5BB8A3D
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Mon, 29 Jul 2019 22:38:44 +0000 (UTC)
 (envelope-from shawn.webb@hardenedbsd.org)
Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com
 [IPv6:2607:f8b0:4864:20::842])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 3714880F4C
 for <svn-src-head@freebsd.org>; Mon, 29 Jul 2019 22:38:44 +0000 (UTC)
 (envelope-from shawn.webb@hardenedbsd.org)
Received: by mail-qt1-x842.google.com with SMTP id k10so61211334qtq.1
 for <svn-src-head@freebsd.org>; Mon, 29 Jul 2019 15:38:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=hardenedbsd.org; s=google;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to:user-agent;
 bh=mV3lHvZlerLZuWP5geuA2N4HZWLzVL1rYeKGiAHoqkM=;
 b=jQsmJ44ugSI+A8pnGbeokEgF+9IRvdHXwpQFOBoVh80mJsrMJXOiey0iouyyR+fdKv
 3uTbGe0vCNio6usXxTQQuK0HppW5EdyjvEBmvtXVXOd+qoaoYDnUqG7UylPw5IBdA9YC
 6vSyh57hEZ2mNo36+SdB17WfBaRR0J1m3WvC0WaMSXcQ2nEe4WIp64qL83WHYY65DZl3
 0B12D3edAK1itP2Rjc2y8xXIfA1X6UrH5daCX1uYFGb9fVTSgw6rzpFvDWYgK8bDQku3
 zQtfA9APtyg6IEiF3zJM5hEUhFMNUrqcHPWf/SuKwjUub9aUp57fhkPlg6KTg2nED+k0
 gqLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:references
 :mime-version:content-disposition:in-reply-to:user-agent;
 bh=mV3lHvZlerLZuWP5geuA2N4HZWLzVL1rYeKGiAHoqkM=;
 b=jDNs4I9MPUgvkm4y8XTTs7u0qZyqSeA6oDNh//Jet/QIIFzSUrjVXa1VTr5IfWp8b/
 YLpJPfgz/p3Ri3G6oibqVnpW5QZtY4UTW7qviX2GurHTHByuNPqOZ0jW9aepIurMm+UW
 ftIKN9nOGxlfLQ2biFWJCFY8z2XjEdnpFT5Bnw77owzb2ZrnRMYS8jbfJGYok6BDr/6m
 4i3CxOzEkHD9LXN/Rl6vHtIKViWRCY3BzVxAzThHx3SB+TQLvYiQ7/iJwgSm3OJkUOg8
 zgcDkDbeeqTMqHYkffXZEOKI1GXIg26WApqzLU2p0sOusoqz+dAxA4RABTKQsbW3B/S/
 Z9cA==
X-Gm-Message-State: APjAAAW228KXIdnZon8IBRHxJ28NIGAOI4lEo3423+l06TKcjwDelUVk
 UYxcgPcZ//rqGPwxukp4UKWnl2DGRr0VMw==
X-Google-Smtp-Source: APXvYqzGfekNs7t0zgyCXffma3U1s3Xyp8DFs4PgdUR3OT28GcbsYlfumHCRN+QRRKTAgZQFtLUvAA==
X-Received: by 2002:a0c:aff8:: with SMTP id t53mr82343550qvc.47.1564439923404; 
 Mon, 29 Jul 2019 15:38:43 -0700 (PDT)
Received: from mutt-hbsd ([151.196.118.239])
 by smtp.gmail.com with ESMTPSA id h40sm35822541qth.4.2019.07.29.15.38.42
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Mon, 29 Jul 2019 15:38:42 -0700 (PDT)
Date: Mon, 29 Jul 2019 18:38:42 -0400
From: Shawn Webb <shawn.webb@hardenedbsd.org>
To: Mark Johnston <markj@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350420 - in head: include lib/libc/stdio
Message-ID: <20190729223842.loml7vu5esn42h34@mutt-hbsd>
References: <201907291902.x6TJ2GfG041787@repo.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature"; boundary="3emdfruccxjsz7a7"
Content-Disposition: inline
In-Reply-To: <201907291902.x6TJ2GfG041787@repo.freebsd.org>
X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD
 13.0-CURRENT-HBSD 
X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA
User-Agent: NeoMutt/20180716
X-Rspamd-Queue-Id: 3714880F4C
X-Spamd-Bar: -----
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=hardenedbsd.org header.s=google header.b=jQsmJ44u;
 spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates
 2607:f8b0:4864:20::842 as permitted sender)
 smtp.mailfrom=shawn.webb@hardenedbsd.org
X-Spamd-Result: default: False [-5.74 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[hardenedbsd.org:+];
 MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com];
 NEURAL_HAM_SHORT(-0.86)[-0.855,0]; SIGNED_PGP(-2.00)[];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+];
 RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 IP_SCORE(-0.77)[ip: (1.73), ipnet: 2607:f8b0::/32(-3.10), asn: 15169(-2.45),
 country: US(-0.05)]; 
 RECEIVED_SPAMHAUS_PBL(0.00)[239.118.196.151.zen.spamhaus.org : 127.0.0.10];
 ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0];
 R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.20)[multipart/signed,text/plain];
 PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org];
 DMARC_NA(0.00)[hardenedbsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[2.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org
 : 127.0.5.0]; MID_RHS_NOT_FQDN(0.50)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 22:38:44 -0000


--3emdfruccxjsz7a7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 29, 2019 at 07:02:16PM +0000, Mark Johnston wrote:
> Author: markj
> Date: Mon Jul 29 19:02:16 2019
> New Revision: 350420
> URL: https://svnweb.freebsd.org/changeset/base/350420
>=20
> Log:
>   Add mkostempsat(3).
>  =20
>   This is a variant of mkostemps() which takes a directory descriptor and
>   returns a descriptor for a tempfile relative to that directory.  Unlike
>   the other mktemp functions, mkostempsat() can be used in capability
>   mode.

Out of curiosity, is __FreeBSD_version typically bumped when a new
public symbol is added to libc?

Thanks,

--=20
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal:    +1 443-546-8752
Tor+XMPP+OTR:        lattera@is.a.hacker.sx
GPG Key ID:          0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2

--3emdfruccxjsz7a7
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0/dWwACgkQ/y5nonf4
4fqwxA//SSgYOtbxEswo6QtvjNe6Rj4BnSdQLoh8qDn4dr6cIby1qWZh42EBrv/D
wG0Pr+eIqnpKB90J+XsRBzgMKnfP1eQAQeeDA69k4jU4KzBOmofeU+WOZy+7ek49
dQ25mWbic6DRPEM/IlLkudopmxTZXybT+w4r13SCa72JxGQi47i2oGCYxY40Lqep
o7GBwZ1pL8TuW0rSLQY+gQi1LbL/Wf+cHMldOzT+SZyaCC+Ax0A/0NhJQLnNkJuQ
y2e2sC2FOy4d36RKIQ4MQP6NpBXSC8D8lEI7kQZAO/6BJ/hR5rZLDRX/gEpYyENL
Q/cKDbF5KOAwkAKSLt69WtoSM9ZguFv9B6QG1lZ78l8SxMq/QV6Ag/xcVx7SVHep
XXxJ6fvDALLCt7kdCwd0TA9GglTmdGfCHY/juHlMMSF0Pj15WI3KywaoXBF5MP30
31CeUchwT5e2Pqr7igzndK6/Z6u6qh1n12I6jKvLO8n0mjIj6PF1CKDcueMxuTnl
bqkIoq9VlBrQy2NHRU2oTGCg8VbDVLoPw3lYhHIAh3JVRYEzrEX0L3hr/MyyZqHF
ys1oLy7SOKUQYGirwG6GGjimTxEJI+ayKl9gyXmgb6eaArgrLiqlfjxUtWKgRb0b
xcKG54oTvbKa1w4eYwIcMb8gFJy6EsAzJ+oQq6jC6kiVOm3UnvM=
=gdFb
-----END PGP SIGNATURE-----

--3emdfruccxjsz7a7--

From owner-svn-src-head@freebsd.org  Mon Jul 29 22:47:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50FAAB8C62;
 Mon, 29 Jul 2019 22:47:35 +0000 (UTC)
 (envelope-from markjdb@gmail.com)
Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com
 [IPv6:2607:f8b0:4864:20::d42])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9CCD48135C;
 Mon, 29 Jul 2019 22:47:34 +0000 (UTC)
 (envelope-from markjdb@gmail.com)
Received: by mail-io1-xd42.google.com with SMTP id z3so4898627iog.0;
 Mon, 29 Jul 2019 15:47:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to:user-agent;
 bh=WuMb6FYwxbUAEhUPzIlkQouUZcRzhoiuT+qnEuBPH9Q=;
 b=cJm6tI8zq3poEa0JTtI+T9R90VsXTmuQVqPRwkK7w9NerWzAqsz0+iab52YwYGSRq5
 Ie0Uffh1O7AIUJsA47S541rVj4Isiefl0QiihAY7ap+qtuHDqE915AL84IfX+C3oVnJn
 h3oYnXLQuXueDkeTzT2ywiC9GLSAQpVqD/EkmrUIoJ2S/WwWjJtqiW1O7cI/rKdIp7CH
 eQMlY7gW9g9OaspkTuUAxJ9gMzqOaCLHQFmY7LhGFqB+/2klZ947R3kRZrEbTbGgJt2a
 uSJGrkcXfzKTgKU36GC+OohydXic96xTb3DjHQihz/EpP7KD+o7BfVu3m1VONvL9oG+s
 jggA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
 :references:mime-version:content-disposition:in-reply-to:user-agent;
 bh=WuMb6FYwxbUAEhUPzIlkQouUZcRzhoiuT+qnEuBPH9Q=;
 b=QR0cTY1SRGVXDhIncQbGDgJ0Gsi2659YzYzVS2e/s08VpqRW0l7Fy87Sa59TPcGGZ1
 iZWMQ4KwY1B6v4WVgMGypWbTM55jGAh+P860MNWCjz6b3fsWfWSV+itDzI+Xkdt5Vm/k
 DmiAM7/rG5zlux65odIPPJ8I8O/DJB4yIjH98/6yLvqJO03dCEr5iH0ptMME2MZRkK+l
 RXEaxAVsArgKkb4+Y6WEyw0wcyqKDa9/4zFBhUIO/DTlVtJRqm/nRuYsyqux3SdNHKYv
 E/PY0CBx9usLg/JJBc0pTqoNCagFHBw0d/OG2l2UWNgMG9DWXma4K661yf8wC651HYcw
 impA==
X-Gm-Message-State: APjAAAWyVAYpiC0LXZF+XC6P/Auf1VN24oaww+8QHSG7g9uMtKbKo1My
 Nkq106hyNVxuDwsHIv/QehyBCXMirC0=
X-Google-Smtp-Source: APXvYqxqWL5T7aFw1lJBPDOdrR/bnyf+T+1jUPOsAwO8lXehrZGe0NnbUgmUNAb4PwVfO9hVFYYPzg==
X-Received: by 2002:a5d:8ad0:: with SMTP id e16mr41571404iot.262.1564440453721; 
 Mon, 29 Jul 2019 15:47:33 -0700 (PDT)
Received: from raichu (toroon0560w-lp140-05-70-29-85-38.dsl.bell.ca.
 [70.29.85.38])
 by smtp.gmail.com with ESMTPSA id p3sm54994163iog.70.2019.07.29.15.47.32
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Mon, 29 Jul 2019 15:47:33 -0700 (PDT)
Sender: Mark Johnston <markjdb@gmail.com>
Date: Mon, 29 Jul 2019 18:47:28 -0400
From: Mark Johnston <markj@freebsd.org>
To: Shawn Webb <shawn.webb@hardenedbsd.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350420 - in head: include lib/libc/stdio
Message-ID: <20190729224728.GA3236@raichu>
References: <201907291902.x6TJ2GfG041787@repo.freebsd.org>
 <20190729223842.loml7vu5esn42h34@mutt-hbsd>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20190729223842.loml7vu5esn42h34@mutt-hbsd>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Rspamd-Queue-Id: 9CCD48135C
X-Spamd-Bar: ---
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=gmail.com header.s=20161025 header.b=cJm6tI8z;
 spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates
 2607:f8b0:4864:20::d42 as permitted sender) smtp.mailfrom=markjdb@gmail.com
X-Spamd-Result: default: False [-3.17 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025];
 NEURAL_HAM_MEDIUM(-0.96)[-0.956,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[text/plain];
 MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org];
 TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3];
 TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 RCVD_IN_DNSWL_NONE(0.00)[2.4.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org
 : 127.0.5.0]; NEURAL_HAM_SHORT(-0.78)[-0.783,0];
 RCVD_TLS_LAST(0.00)[];
 FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com];
 MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com];
 IP_SCORE(-0.72)[ip: (1.99), ipnet: 2607:f8b0::/32(-3.10), asn: 15169(-2.45),
 country: US(-0.05)]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Jul 2019 22:47:35 -0000

On Mon, Jul 29, 2019 at 06:38:42PM -0400, Shawn Webb wrote:
> On Mon, Jul 29, 2019 at 07:02:16PM +0000, Mark Johnston wrote:
> > Author: markj
> > Date: Mon Jul 29 19:02:16 2019
> > New Revision: 350420
> > URL: https://svnweb.freebsd.org/changeset/base/350420
> > 
> > Log:
> >   Add mkostempsat(3).
> >   
> >   This is a variant of mkostemps() which takes a directory descriptor and
> >   returns a descriptor for a tempfile relative to that directory.  Unlike
> >   the other mktemp functions, mkostempsat() can be used in capability
> >   mode.
> 
> Out of curiosity, is __FreeBSD_version typically bumped when a new
> public symbol is added to libc?

I don't think so, unless there's some specific reason to do so.  The
function was added for use in Capsicumizing some code in the base system
so I had no need to bump __FreeBSD_version.

From owner-svn-src-head@freebsd.org  Tue Jul 30 02:01:50 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D1FEBD991;
 Tue, 30 Jul 2019 02:01:50 +0000 (UTC)
 (envelope-from araujo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 2DD25869C1;
 Tue, 30 Jul 2019 02:01:50 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A3BA9BE2;
 Tue, 30 Jul 2019 02:01:50 +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 x6U21nY0091309;
 Tue, 30 Jul 2019 02:01:49 GMT (envelope-from araujo@FreeBSD.org)
Received: (from araujo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6U21npd091307;
 Tue, 30 Jul 2019 02:01:49 GMT (envelope-from araujo@FreeBSD.org)
Message-Id: <201907300201.x6U21npd091307@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: araujo set sender to
 araujo@FreeBSD.org using -f
From: Marcelo Araujo <araujo@FreeBSD.org>
Date: Tue, 30 Jul 2019 02:01:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350433 - head/sys/dev/sound/pci/hda
X-SVN-Group: head
X-SVN-Commit-Author: araujo
X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda
X-SVN-Commit-Revision: 350433
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 2DD25869C1
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.96)[-0.962,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 02:01:50 -0000

Author: araujo
Date: Tue Jul 30 02:01:49 2019
New Revision: 350433
URL: https://svnweb.freebsd.org/changeset/base/350433

Log:
  Fix sound on headset jack for ALC255 and ALC256 codec.
  
  PR:		219350 [1], [2]
  Submitted by:	Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1]
  		Neel Chauhan (neel_at_neelc.org) [2]
  		uri Momotyuk (yurkis_at_gmail.com) [3]
  Reported by:	miwi
  Reviewed by:	mav
  Obtained from:	https://github.com/trueos/trueos/pull/279 [3]
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D19017

Modified:
  head/sys/dev/sound/pci/hda/hdaa_patches.c
  head/sys/dev/sound/pci/hda/hdac.h

Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdaa_patches.c	Mon Jul 29 22:07:43 2019	(r350432)
+++ head/sys/dev/sound/pci/hda/hdaa_patches.c	Tue Jul 30 02:01:49 2019	(r350433)
@@ -425,12 +425,21 @@ hdac_pin_patch(struct hdaa_widget *w)
 	} else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) {
 		switch (nid) {
 		case 24:
-			config  = 0x01a1913c;
+			config = 0x01a1913c;
 			break;
 		case 26:
-			config  = 0x01a1913d;
+			config = 0x01a1913d;
 			break;
 		}
+	} else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR ) {
+		switch (nid) {
+		case 20:
+			patch = "as=1 seq=0";
+			break;
+		case 33:
+			patch = "as=1 seq=15";
+			break;
+		}
 	}
 
 	if (patch != NULL)
@@ -768,6 +777,10 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo)
 			hdaa_write_coef(dev, 0x20, 0x07, 0x7cb);
 		}
 		break;
+	}
+	if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) {
+		val = hdaa_read_coef(dev, 0x20, 0x46);
+		hdaa_write_coef(dev, 0x20, 0x46, val|0x3000);
 	}
 	if (subid == APPLE_INTEL_MAC)
 		hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,

Modified: head/sys/dev/sound/pci/hda/hdac.h
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.h	Mon Jul 29 22:07:43 2019	(r350432)
+++ head/sys/dev/sound/pci/hda/hdac.h	Tue Jul 30 02:01:49 2019	(r350433)
@@ -203,6 +203,7 @@
 #define DELL_XPSM1210_SUBVENDOR	HDA_MODEL_CONSTRUCT(DELL, 0x01d7)
 #define DELL_OPLX745_SUBVENDOR	HDA_MODEL_CONSTRUCT(DELL, 0x01da)
 #define DELL_XPS9560_SUBVENDOR	HDA_MODEL_CONSTRUCT(DELL, 0x07be)
+#define DELL_I7577_SUBVENDOR	HDA_MODEL_CONSTRUCT(DELL, 0x0802)
 #define DELL_ALL_SUBVENDOR	HDA_MODEL_CONSTRUCT(DELL, 0xffff)
 
 /* Clevo */

From owner-svn-src-head@freebsd.org  Tue Jul 30 05:13:17 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB606C0DC4;
 Tue, 30 Jul 2019 05:13:17 +0000 (UTC)
 (envelope-from delphij@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9CD7B8B8F2;
 Tue, 30 Jul 2019 05:13:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 773FEC190;
 Tue, 30 Jul 2019 05:13:17 +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 x6U5DHN3004229;
 Tue, 30 Jul 2019 05:13:17 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6U5DGJs004225;
 Tue, 30 Jul 2019 05:13:16 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201907300513.x6U5DGJs004225@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI <delphij@FreeBSD.org>
Date: Tue, 30 Jul 2019 05:13:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350436 - in head/sys: amd64/conf arm/arm conf i386/conf
 kern sys
X-SVN-Group: head
X-SVN-Commit-Author: delphij
X-SVN-Commit-Paths: in head/sys: amd64/conf arm/arm conf i386/conf kern sys
X-SVN-Commit-Revision: 350436
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 9CD7B8B8F2
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.96)[-0.961,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 05:13:17 -0000

Author: delphij
Date: Tue Jul 30 05:13:16 2019
New Revision: 350436
URL: https://svnweb.freebsd.org/changeset/base/350436

Log:
  Remove gzip'ed a.out support.
  
  The current implementation of gzipped a.out support was based
  on a very old version of InfoZIP which ships with an ancient
  modified version of zlib, and was removed from the GENERIC
  kernel in 1999 when we moved to an ELF world.
  
  PR:		205822
  Reviewed by:	imp, kib, emaste, Yoshihiro Ota <ota at j.email.ne.jp>
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D21099

Deleted:
  head/sys/arm/arm/elf_trampoline.c
  head/sys/kern/imgact_gzip.c
  head/sys/kern/subr_inflate.c
  head/sys/sys/inflate.h
Modified:
  head/sys/amd64/conf/NOTES
  head/sys/conf/files
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/i386/conf/NOTES

Modified: head/sys/amd64/conf/NOTES
==============================================================================
--- head/sys/amd64/conf/NOTES	Tue Jul 30 04:17:36 2019	(r350435)
+++ head/sys/amd64/conf/NOTES	Tue Jul 30 05:13:16 2019	(r350436)
@@ -127,7 +127,6 @@ device		nvram		# Access to rtc cmos via /dev/nvram
 device		speaker		#Play IBM BASIC-style noises out your speaker
 hint.speaker.0.at="isa"
 hint.speaker.0.port="0x61"
-device		gzip		#Exec gzipped a.out's.  REQUIRES COMPAT_AOUT!
 
 
 #####################################################################

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Jul 30 04:17:36 2019	(r350435)
+++ head/sys/conf/files	Tue Jul 30 05:13:16 2019	(r350436)
@@ -3814,7 +3814,6 @@ kern/subr_firmware.c		optional firmware
 kern/subr_gtaskqueue.c		standard
 kern/subr_hash.c		standard
 kern/subr_hints.c		standard
-kern/subr_inflate.c		optional gzip
 kern/subr_kdb.c			standard
 kern/subr_kobj.c		standard
 kern/subr_lock.c		standard

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Tue Jul 30 04:17:36 2019	(r350435)
+++ head/sys/conf/files.amd64	Tue Jul 30 05:13:16 2019	(r350436)
@@ -633,7 +633,6 @@ isa/syscons_isa.c		optional	sc
 isa/vga_isa.c			optional	vga
 kern/kern_clocksource.c		standard
 kern/imgact_aout.c		optional compat_aout
-kern/imgact_gzip.c		optional gzip
 kern/link_elf_obj.c		standard
 libkern/x86/crc32_sse42.c	standard
 #

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Tue Jul 30 04:17:36 2019	(r350435)
+++ head/sys/conf/files.i386	Tue Jul 30 05:13:16 2019	(r350436)
@@ -529,7 +529,6 @@ isa/syscons_isa.c		optional sc
 isa/vga_isa.c			optional vga
 kern/kern_clocksource.c		standard
 kern/imgact_aout.c		optional compat_aout
-kern/imgact_gzip.c		optional gzip
 kern/subr_sfbuf.c		standard
 libkern/divdi3.c		standard
 libkern/ffsll.c			standard

Modified: head/sys/i386/conf/NOTES
==============================================================================
--- head/sys/i386/conf/NOTES	Tue Jul 30 04:17:36 2019	(r350435)
+++ head/sys/i386/conf/NOTES	Tue Jul 30 05:13:16 2019	(r350436)
@@ -275,7 +275,6 @@ device		nvram		# Access to rtc cmos via /dev/nvram
 device		speaker		#Play IBM BASIC-style noises out your speaker
 hint.speaker.0.at="isa"
 hint.speaker.0.port="0x61"
-device		gzip		#Exec gzipped a.out's.  REQUIRES COMPAT_AOUT!
 device		apm_saver	# Requires APM
 
 

From owner-svn-src-head@freebsd.org  Tue Jul 30 05:14:29 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16C3DC0E35;
 Tue, 30 Jul 2019 05:14:29 +0000 (UTC)
 (envelope-from delphij@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id EC5CE8BA55;
 Tue, 30 Jul 2019 05:14:28 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6009C19A;
 Tue, 30 Jul 2019 05:14:28 +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 x6U5ESto004335;
 Tue, 30 Jul 2019 05:14:28 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6U5ESM4004334;
 Tue, 30 Jul 2019 05:14:28 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201907300514.x6U5ESM4004334@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI <delphij@FreeBSD.org>
Date: Tue, 30 Jul 2019 05:14:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350437 - head/sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: delphij
X-SVN-Commit-Paths: head/sys/sys
X-SVN-Commit-Revision: 350437
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: EC5CE8BA55
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.96)[-0.960,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 05:14:29 -0000

Author: delphij
Date: Tue Jul 30 05:14:28 2019
New Revision: 350437
URL: https://svnweb.freebsd.org/changeset/base/350437

Log:
  Bump __FreeBSD_version after removal of gzip'ed a.out support.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Tue Jul 30 05:13:16 2019	(r350436)
+++ head/sys/sys/param.h	Tue Jul 30 05:14:28 2019	(r350437)
@@ -60,7 +60,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300037	/* Master, propagated to newvers */
+#define __FreeBSD_version 1300038	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

From owner-svn-src-head@freebsd.org  Tue Jul 30 08:53:04 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20F2CC4C13;
 Tue, 30 Jul 2019 08:53:04 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 037B79100E;
 Tue, 30 Jul 2019 08:53:04 +0000 (UTC)
 (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D25ADE915;
 Tue, 30 Jul 2019 08:53:03 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6U8r3iH032896;
 Tue, 30 Jul 2019 08:53:03 GMT (envelope-from oshogbo@FreeBSD.org)
Received: (from oshogbo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6U8r365032895;
 Tue, 30 Jul 2019 08:53:03 GMT (envelope-from oshogbo@FreeBSD.org)
Message-Id: <201907300853.x6U8r365032895@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to
 oshogbo@FreeBSD.org using -f
From: Mariusz Zaborski <oshogbo@FreeBSD.org>
Date: Tue, 30 Jul 2019 08:53:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350438 - head/lib/libcasper/services/cap_fileargs
X-SVN-Group: head
X-SVN-Commit-Author: oshogbo
X-SVN-Commit-Paths: head/lib/libcasper/services/cap_fileargs
X-SVN-Commit-Revision: 350438
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 037B79100E
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.96)[-0.959,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 08:53:04 -0000

Author: oshogbo
Date: Tue Jul 30 08:53:03 2019
New Revision: 350438
URL: https://svnweb.freebsd.org/changeset/base/350438

Log:
  fileargs: fix formating in EXAMPLES
  
  PR:		239523
  Submitted by:	mikael.urankar@gmail.com

Modified:
  head/lib/libcasper/services/cap_fileargs/cap_fileargs.3

Modified: head/lib/libcasper/services/cap_fileargs/cap_fileargs.3
==============================================================================
--- head/lib/libcasper/services/cap_fileargs/cap_fileargs.3	Tue Jul 30 05:14:28 2019	(r350437)
+++ head/lib/libcasper/services/cap_fileargs/cap_fileargs.3	Tue Jul 30 08:53:03 2019	(r350438)
@@ -247,7 +247,7 @@ for (i = 0; i < argc; i++) {
 	fd = fileargs_open(fa, argv[i]);
 	if (fd < 0)
 		err(1, "unable to open file %s", argv[i]);
-	printf("File %s opened in capability mode\n", argv[i]);
+	printf("File %s opened in capability mode\en", argv[i]);
 	close(fd);
 }
 

From owner-svn-src-head@freebsd.org  Tue Jul 30 08:56:41 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85270C4F67;
 Tue, 30 Jul 2019 08:56:41 +0000 (UTC)
 (envelope-from phk@critter.freebsd.dk)
Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1EF8991452;
 Tue, 30 Jul 2019 08:56:39 +0000 (UTC)
 (envelope-from phk@critter.freebsd.dk)
Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by phk.freebsd.dk (Postfix) with ESMTPS id 7DEB71AF112;
 Tue, 30 Jul 2019 08:56:37 +0000 (UTC)
Received: from critter.freebsd.dk (localhost [127.0.0.1])
 by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id x6U8ub0q047706
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO);
 Tue, 30 Jul 2019 08:56:37 GMT (envelope-from phk@critter.freebsd.dk)
Received: (from phk@localhost)
 by critter.freebsd.dk (8.15.2/8.15.2/Submit) id x6U8ubBT047705;
 Tue, 30 Jul 2019 08:56:37 GMT (envelope-from phk)
To: Xin LI <delphij@FreeBSD.org>
cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350436 - in head/sys: amd64/conf arm/arm conf
 i386/conf kern sys
In-reply-to: <201907300513.x6U5DGJs004225@repo.freebsd.org>
From: "Poul-Henning Kamp" <phk@phk.freebsd.dk>
References: <201907300513.x6U5DGJs004225@repo.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <47703.1564476996.1@critter.freebsd.dk>
Date: Tue, 30 Jul 2019 08:56:36 +0000
Message-ID: <47704.1564476996@critter.freebsd.dk>
X-Rspamd-Queue-Id: 1EF8991452
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
 spf=pass (mx1.freebsd.org: domain of phk@critter.freebsd.dk designates
 130.225.244.222 as permitted sender) smtp.mailfrom=phk@critter.freebsd.dk
X-Spamd-Result: default: False [-0.33 / 15.00]; TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+mx]; RCVD_COUNT_THREE(0.00)[4];
 MX_GOOD(-0.01)[cached: phk.freebsd.dk];
 NEURAL_HAM_SHORT(-0.32)[-0.316,0];
 FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk];
 R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+];
 ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU];
 FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk];
 ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.28)[-0.285,0];
 MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[];
 DMARC_NA(0.00)[freebsd.dk]; NEURAL_SPAM_MEDIUM(0.22)[0.224,0];
 IP_SCORE(0.05)[ip: (0.09), ipnet: 130.225.0.0/16(0.04), asn: 1835(0.14),
 country: EU(-0.00)]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 08:56:41 -0000

--------
In message <201907300513.x6U5DGJs004225@repo.freebsd.org>, Xin LI writes:

>URL: https://svnweb.freebsd.org/changeset/base/350436
>
>Log:
>  Remove gzip'ed a.out support.

Backstory:

	http://phk.freebsd.dk/sagas/gzipaout/

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

From owner-svn-src-head@freebsd.org  Tue Jul 30 12:51:15 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8144A2927;
 Tue, 30 Jul 2019 12:51:15 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id C3C9F9842F;
 Tue, 30 Jul 2019 12:51:15 +0000 (UTC) (envelope-from br@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D06619368;
 Tue, 30 Jul 2019 12:51:15 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UCpFY9069500;
 Tue, 30 Jul 2019 12:51:15 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UCpFYU069497;
 Tue, 30 Jul 2019 12:51:15 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201907301251.x6UCpFYU069497@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin <br@FreeBSD.org>
Date: Tue, 30 Jul 2019 12:51:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350440 - in head/sys: arm64/conf conf dev/mmc/host
X-SVN-Group: head
X-SVN-Commit-Author: br
X-SVN-Commit-Paths: in head/sys: arm64/conf conf dev/mmc/host
X-SVN-Commit-Revision: 350440
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: C3C9F9842F
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.96)[-0.956,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 12:51:16 -0000

Author: br
Date: Tue Jul 30 12:51:14 2019
New Revision: 350440
URL: https://svnweb.freebsd.org/changeset/base/350440

Log:
  Add support for the SD/MMC controller found in Terasic DE10-Pro
  (an Intel Stratix 10 GX/SX FPGA Development Kit).
  
  Set the bus speed manually due to lack of clock management support.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64
  head/sys/dev/mmc/host/dwmmc_altera.c

Modified: head/sys/arm64/conf/GENERIC
==============================================================================
--- head/sys/arm64/conf/GENERIC	Tue Jul 30 12:17:11 2019	(r350439)
+++ head/sys/arm64/conf/GENERIC	Tue Jul 30 12:51:14 2019	(r350440)
@@ -189,6 +189,7 @@ device		aw_mmc			# Allwinner SD/MMC controller
 device		mmc			# mmc/sd bus
 device		mmcsd			# mmc/sd flash cards
 device		dwmmc
+device		dwmmc_altera
 device		rk_emmcphy
 
 # Serial (COM) ports

Modified: head/sys/conf/files.arm64
==============================================================================
--- head/sys/conf/files.arm64	Tue Jul 30 12:17:11 2019	(r350439)
+++ head/sys/conf/files.arm64	Tue Jul 30 12:51:14 2019	(r350440)
@@ -221,6 +221,7 @@ dev/hwpmc/hwpmc_arm64.c		optional	hwpmc
 dev/hwpmc/hwpmc_arm64_md.c	optional	hwpmc
 dev/mbox/mbox_if.m		optional	soc_brcm_bcm2837
 dev/mmc/host/dwmmc.c		optional	dwmmc fdt
+dev/mmc/host/dwmmc_altera.c	optional	dwmmc fdt dwmmc_altera
 dev/mmc/host/dwmmc_hisi.c	optional	dwmmc fdt soc_hisi_hi6220
 dev/mmc/host/dwmmc_rockchip.c	optional	dwmmc fdt soc_rockchip_rk3328
 dev/neta/if_mvneta_fdt.c	optional	neta fdt

Modified: head/sys/dev/mmc/host/dwmmc_altera.c
==============================================================================
--- head/sys/dev/mmc/host/dwmmc_altera.c	Tue Jul 30 12:17:11 2019	(r350439)
+++ head/sys/dev/mmc/host/dwmmc_altera.c	Tue Jul 30 12:51:14 2019	(r350440)
@@ -66,9 +66,17 @@ static int
 altera_dwmmc_attach(device_t dev)
 {
 	struct dwmmc_softc *sc;
+	phandle_t root;
 
 	sc = device_get_softc(dev);
 	sc->hwtype = HWTYPE_ALTERA;
+
+	root = OF_finddevice("/");
+
+	if (ofw_bus_node_is_compatible(root, "altr,socfpga-stratix10")) {
+		sc->bus_hz = 24000000;
+		sc->use_pio = 1;
+	}
 
 	return (dwmmc_attach(dev));
 }

From owner-svn-src-head@freebsd.org  Tue Jul 30 14:21:01 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26442A4BA1;
 Tue, 30 Jul 2019 14:21:01 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 095C39BC0A;
 Tue, 30 Jul 2019 14:21:01 +0000 (UTC) (envelope-from br@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0DC01A3BB;
 Tue, 30 Jul 2019 14:21:00 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UEL0N0022954;
 Tue, 30 Jul 2019 14:21:00 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UEL042022953;
 Tue, 30 Jul 2019 14:21:00 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201907301421.x6UEL042022953@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin <br@FreeBSD.org>
Date: Tue, 30 Jul 2019 14:21:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350443 - head/sys/dev/mmc/host
X-SVN-Group: head
X-SVN-Commit-Author: br
X-SVN-Commit-Paths: head/sys/dev/mmc/host
X-SVN-Commit-Revision: 350443
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 095C39BC0A
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.951,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 14:21:01 -0000

Author: br
Date: Tue Jul 30 14:21:00 2019
New Revision: 350443
URL: https://svnweb.freebsd.org/changeset/base/350443

Log:
  Fix MMCCAM kernel build.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/dev/mmc/host/dwmmc_altera.c

Modified: head/sys/dev/mmc/host/dwmmc_altera.c
==============================================================================
--- head/sys/dev/mmc/host/dwmmc_altera.c	Tue Jul 30 14:19:18 2019	(r350442)
+++ head/sys/dev/mmc/host/dwmmc_altera.c	Tue Jul 30 14:21:00 2019	(r350443)
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
 
 #include <dev/mmc/host/dwmmc_var.h>
 
+#include "opt_mmccam.h"
+
 static struct ofw_compat_data compat_data[] = {
 	{"altr,socfpga-dw-mshc",	1},
 	{NULL,				0},

From owner-svn-src-head@freebsd.org  Tue Jul 30 14:54:19 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BB2CA57FA;
 Tue, 30 Jul 2019 14:54:19 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4D8889CC72;
 Tue, 30 Jul 2019 14:54:19 +0000 (UTC) (envelope-from br@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2286D1AA97;
 Tue, 30 Jul 2019 14:54:19 +0000 (UTC) (envelope-from br@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UEsI5d045134;
 Tue, 30 Jul 2019 14:54:18 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UEsIVC045133;
 Tue, 30 Jul 2019 14:54:18 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201907301454.x6UEsIVC045133@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin <br@FreeBSD.org>
Date: Tue, 30 Jul 2019 14:54:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350444 - head/stand/efi/loader
X-SVN-Group: head
X-SVN-Commit-Author: br
X-SVN-Commit-Paths: head/stand/efi/loader
X-SVN-Commit-Revision: 350444
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4D8889CC72
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.96)[-0.961,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 14:54:19 -0000

Author: br
Date: Tue Jul 30 14:54:18 2019
New Revision: 350444
URL: https://svnweb.freebsd.org/changeset/base/350444

Log:
  Fix EFI loader build when LOADER_NET_SUPPORT=no.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/stand/efi/loader/conf.c

Modified: head/stand/efi/loader/conf.c
==============================================================================
--- head/stand/efi/loader/conf.c	Tue Jul 30 14:21:00 2019	(r350443)
+++ head/stand/efi/loader/conf.c	Tue Jul 30 14:54:18 2019	(r350444)
@@ -40,7 +40,9 @@ struct devsw *devsw[] = {
 	&efipart_cddev,
 	&efipart_hddev,
 	&efihttp_dev, /* ordering with efinet_dev matters */
+#if defined(LOADER_NET_SUPPORT)
 	&efinet_dev,
+#endif
 	&vdisk_dev,
 #ifdef EFI_ZFS_BOOT
 	&zfs_dev,
@@ -64,7 +66,9 @@ struct fs_ops *file_system[] = {
 };
 
 struct netif_driver *netif_drivers[] = {
+#if defined(LOADER_NET_SUPPORT)
 	&efinetif,
+#endif
 	NULL
 };
 

From owner-svn-src-head@freebsd.org  Tue Jul 30 15:51:29 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 112A5A6A26;
 Tue, 30 Jul 2019 15:51:29 +0000 (UTC) (envelope-from ian@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DD9289E8D9;
 Tue, 30 Jul 2019 15:51:28 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF8431B578;
 Tue, 30 Jul 2019 15:51:28 +0000 (UTC) (envelope-from ian@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UFpShj076543;
 Tue, 30 Jul 2019 15:51:28 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UFpSW5076542;
 Tue, 30 Jul 2019 15:51:28 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201907301551.x6UFpSW5076542@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore <ian@FreeBSD.org>
Date: Tue, 30 Jul 2019 15:51:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350445 - head/etc/mtree
X-SVN-Group: head
X-SVN-Commit-Author: ian
X-SVN-Commit-Paths: head/etc/mtree
X-SVN-Commit-Revision: 350445
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DD9289E8D9
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.96)[-0.955,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 15:51:29 -0000

Author: ian
Date: Tue Jul 30 15:51:28 2019
New Revision: 350445
URL: https://svnweb.freebsd.org/changeset/base/350445

Log:
  Create the /var/account dir with mode 0750; this is a followup to r349974.
  
  The rc.d/account script contains code to create the /var/account dir, so
  it hadn't occurred to me that it is normally created via mtree; thanks to
  jilles@ for pointing it out.

Modified:
  head/etc/mtree/BSD.var.dist

Modified: head/etc/mtree/BSD.var.dist
==============================================================================
--- head/etc/mtree/BSD.var.dist	Tue Jul 30 14:54:18 2019	(r350444)
+++ head/etc/mtree/BSD.var.dist	Tue Jul 30 15:51:28 2019	(r350445)
@@ -5,7 +5,7 @@
 
 /set type=dir uname=root gname=wheel mode=0755 tags=package=runtime
 .
-    account
+    account             mode=0750
     ..
     at
 /set uname=daemon

From owner-svn-src-head@freebsd.org  Tue Jul 30 15:57:32 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BD75A6F3A;
 Tue, 30 Jul 2019 15:57:32 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 1DD389EF79;
 Tue, 30 Jul 2019 15:57:32 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E776D1B602;
 Tue, 30 Jul 2019 15:57:31 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UFvVc9080609;
 Tue, 30 Jul 2019 15:57:31 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UFvVF8080608;
 Tue, 30 Jul 2019 15:57:31 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907301557.x6UFvVF8080608@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Tue, 30 Jul 2019 15:57:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350446 - head/sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/sys
X-SVN-Commit-Revision: 350446
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 1DD389EF79
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.96)[-0.956,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 15:57:32 -0000

Author: markj
Date: Tue Jul 30 15:57:31 2019
New Revision: 350446
URL: https://svnweb.freebsd.org/changeset/base/350446

Log:
  Handle refcount(9) wraparound.
  
  Attempt to mitigate the security risks around refcount overflows by
  introducing a "saturated" state for the counter.  Once a counter reaches
  INT_MAX+1, subsequent acquire and release operations will blindly set
  the counter value to INT_MAX + INT_MAX/2, ensuring that the protected
  resource will not be freed; instead, it will merely be leaked.
  
  The approach introduces a small race: if a refcount value reaches
  INT_MAX+1, a subsequent release will cause the releasing thread to set
  the counter to the saturation value after performing the decrement.  If
  in the intervening window INT_MAX refcount releases are performed by a
  different thread, a use-after-free is possible.  This is very difficult
  to trigger in practice, and any situation where it could be triggered
  would likely be vulnerable to reference count wraparound problems
  to begin with.  An alternative would be to use atomic_cmpset to acquire
  and release references, but this would introduce a larger performance
  penalty, particularly when the counter is contended.
  
  Note that refcount_acquire_checked(9) maintains its previous behaviour;
  code which must accurately track references should use it instead of
  refcount_acquire(9).
  
  Reviewed by:	kib, mjg
  MFC after:	3 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21089

Modified:
  head/sys/sys/refcount.h

Modified: head/sys/sys/refcount.h
==============================================================================
--- head/sys/sys/refcount.h	Tue Jul 30 15:51:28 2019	(r350445)
+++ head/sys/sys/refcount.h	Tue Jul 30 15:57:31 2019	(r350446)
@@ -30,7 +30,6 @@
 #ifndef __SYS_REFCOUNT_H__
 #define __SYS_REFCOUNT_H__
 
-#include <sys/limits.h>
 #include <machine/atomic.h>
 
 #ifdef _KERNEL
@@ -40,19 +39,41 @@
 #define	KASSERT(exp, msg)	/* */
 #endif
 
+#define	REFCOUNT_SATURATED(val)		(((val) & (1U << 31)) != 0)
+#define	REFCOUNT_SATURATION_VALUE	(3U << 30)
+
+/*
+ * Attempt to handle reference count overflow and underflow.  Force the counter
+ * to stay at the saturation value so that a counter overflow cannot trigger
+ * destruction of the containing object and instead leads to a less harmful
+ * memory leak.
+ */
 static __inline void
-refcount_init(volatile u_int *count, u_int value)
+_refcount_update_saturated(volatile u_int *count)
 {
+#ifdef INVARIANTS
+	panic("refcount %p wraparound", count);
+#else
+	atomic_store_int(count, REFCOUNT_SATURATION_VALUE);
+#endif
+}
 
+static __inline void
+refcount_init(volatile u_int *count, u_int value)
+{
+	KASSERT(!REFCOUNT_SATURATED(value),
+	    ("invalid initial refcount value %u", value));
 	*count = value;
 }
 
 static __inline void
 refcount_acquire(volatile u_int *count)
 {
+	u_int old;
 
-	KASSERT(*count < UINT_MAX, ("refcount %p overflowed", count));
-	atomic_add_int(count, 1);
+	old = atomic_fetchadd_int(count, 1);
+	if (__predict_false(REFCOUNT_SATURATED(old)))
+		_refcount_update_saturated(count);
 }
 
 static __inline __result_use_check bool
@@ -61,7 +82,7 @@ refcount_acquire_checked(volatile u_int *count)
 	u_int lcount;
 
 	for (lcount = *count;;) {
-		if (__predict_false(lcount + 1 < lcount))
+		if (__predict_false(REFCOUNT_SATURATED(lcount + 1)))
 			return (false);
 		if (__predict_true(atomic_fcmpset_int(count, &lcount,
 		    lcount + 1) == 1))
@@ -76,7 +97,15 @@ refcount_release(volatile u_int *count)
 
 	atomic_thread_fence_rel();
 	old = atomic_fetchadd_int(count, -1);
-	KASSERT(old > 0, ("refcount %p is zero", count));
+	if (__predict_false(old == 0 || REFCOUNT_SATURATED(old))) {
+		/*
+		 * Avoid multiple destructor invocations if underflow occurred.
+		 * This is not perfect since the memory backing the containing
+		 * object may already have been reallocated.
+		 */
+		_refcount_update_saturated(count);
+		return (false);
+	}
 	if (old > 1)
 		return (false);
 
@@ -84,7 +113,7 @@ refcount_release(volatile u_int *count)
 	 * Last reference.  Signal the user to call the destructor.
 	 *
 	 * Ensure that the destructor sees all updates.  The fence_rel
-	 * at the start of the function synchronized with this fence.
+	 * at the start of the function synchronizes with this fence.
 	 */
 	atomic_thread_fence_acq();
 	return (true);
@@ -101,9 +130,10 @@ refcount_acquire_if_not_zero(volatile u_int *count)
 
 	old = *count;
 	for (;;) {
-		KASSERT(old < UINT_MAX, ("refcount %p overflowed", count));
 		if (old == 0)
 			return (false);
+		if (__predict_false(REFCOUNT_SATURATED(old)))
+			return (true);
 		if (atomic_fcmpset_int(count, &old, old + 1))
 			return (true);
 	}
@@ -116,9 +146,10 @@ refcount_release_if_not_last(volatile u_int *count)
 
 	old = *count;
 	for (;;) {
-		KASSERT(old > 0, ("refcount %p is zero", count));
 		if (old == 1)
 			return (false);
+		if (__predict_false(REFCOUNT_SATURATED(old)))
+			return (true);
 		if (atomic_fcmpset_int(count, &old, old - 1))
 			return (true);
 	}

From owner-svn-src-head@freebsd.org  Tue Jul 30 15:59:45 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 416F5A703E;
 Tue, 30 Jul 2019 15:59:45 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 0E6839F322;
 Tue, 30 Jul 2019 15:59:45 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0A541B612;
 Tue, 30 Jul 2019 15:59:44 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UFxirs080734;
 Tue, 30 Jul 2019 15:59:44 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UFxiMA080733;
 Tue, 30 Jul 2019 15:59:44 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907301559.x6UFxiMA080733@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Tue, 30 Jul 2019 15:59:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350447 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350447
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 0E6839F322
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.96)[-0.955,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 15:59:45 -0000

Author: markj
Date: Tue Jul 30 15:59:44 2019
New Revision: 350447
URL: https://svnweb.freebsd.org/changeset/base/350447

Log:
  Enable copy_file_range(2) in capability mode.
  
  copy_file_range() operates on a pair of file descriptors; it requires
  CAP_READ for the source descriptor and CAP_WRITE for the destination
  descriptor.
  
  Reviewed by:	kevans, oshogbo
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21113

Modified:
  head/sys/kern/capabilities.conf

Modified: head/sys/kern/capabilities.conf
==============================================================================
--- head/sys/kern/capabilities.conf	Tue Jul 30 15:57:31 2019	(r350446)
+++ head/sys/kern/capabilities.conf	Tue Jul 30 15:59:44 2019	(r350447)
@@ -133,6 +133,11 @@ closefrom
 connectat
 
 ##
+## copy_file_range(2) reads from one descriptor and writes to the other.
+##
+copy_file_range
+
+##
 ## cpuset(2) and related calls are limited to caller's own process/thread.
 ##
 #cpuset

From owner-svn-src-head@freebsd.org  Tue Jul 30 16:01:17 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0964AA712D;
 Tue, 30 Jul 2019 16:01:17 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DF22C9F566;
 Tue, 30 Jul 2019 16:01:16 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8BF41B66E;
 Tue, 30 Jul 2019 16:01:16 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UG1G2J083059;
 Tue, 30 Jul 2019 16:01:16 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UG1GJQ083058;
 Tue, 30 Jul 2019 16:01:16 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907301601.x6UG1GJQ083058@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Tue, 30 Jul 2019 16:01:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350448 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350448
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: DF22C9F566
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.96)[-0.955,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 16:01:17 -0000

Author: markj
Date: Tue Jul 30 16:01:16 2019
New Revision: 350448
URL: https://svnweb.freebsd.org/changeset/base/350448

Log:
  Regenerate after r350447.

Modified:
  head/sys/kern/init_sysent.c

Modified: head/sys/kern/init_sysent.c
==============================================================================
--- head/sys/kern/init_sysent.c	Tue Jul 30 15:59:44 2019	(r350447)
+++ head/sys/kern/init_sysent.c	Tue Jul 30 16:01:16 2019	(r350448)
@@ -618,5 +618,5 @@ struct sysent sysent[] = {
 	{ AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 566 = fhlinkat */
 	{ AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 567 = fhreadlink */
 	{ AS(funlinkat_args), (sy_call_t *)sys_funlinkat, AUE_UNLINKAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 568 = funlinkat */
-	{ AS(copy_file_range_args), (sy_call_t *)sys_copy_file_range, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 569 = copy_file_range */
+	{ AS(copy_file_range_args), (sy_call_t *)sys_copy_file_range, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 569 = copy_file_range */
 };

From owner-svn-src-head@freebsd.org  Tue Jul 30 16:07:20 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8066DA7399
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Tue, 30 Jul 2019 16:07:20 +0000 (UTC) (envelope-from tsoome@me.com)
Received: from mr85p00im-zteg06011601.me.com (mr85p00im-zteg06011601.me.com
 [17.58.23.186])
 (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 2AEE49F93D
 for <svn-src-head@freebsd.org>; Tue, 30 Jul 2019 16:07:10 +0000 (UTC)
 (envelope-from tsoome@me.com)
Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148])
 by mr85p00im-zteg06011601.me.com (Postfix) with ESMTPSA id 8AB18920D77;
 Tue, 30 Jul 2019 16:00:37 +0000 (UTC)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Subject: Re: svn commit: r350444 - head/stand/efi/loader
From: Toomas Soome <tsoome@me.com>
In-Reply-To: <201907301454.x6UEsIVC045133@repo.freebsd.org>
Date: Tue, 30 Jul 2019 19:00:34 +0300
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <B6D15575-028D-44AC-8773-3920CC89BCAC@me.com>
References: <201907301454.x6UEsIVC045133@repo.freebsd.org>
To: Ruslan Bukin <br@FreeBSD.org>
X-Mailer: Apple Mail (2.3445.104.11)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, ,
 definitions=2019-07-30_07:, , signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0
 mlxlogscore=749 adultscore=0 classifier=spam adjust=0 reason=mlx
 scancount=1 engine=8.0.1-1812120000 definitions=main-1907300166
X-Rspamd-Queue-Id: 2AEE49F93D
X-Spamd-Bar: ------
X-Spamd-Result: default: False [-6.27 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 RBL_COMPOSITE_RCVD_IN_DNSWL_MED_DWL_DNSWL_LOW(0.00)[];
 TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[me.com];
 R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; MV_CASE(0.50)[];
 RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; DKIM_TRACE(0.00)[me.com:+];
 RCVD_IN_DNSWL_MED(-0.20)[186.23.58.17.list.dnswl.org : 127.0.5.2];
 DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine];
 MX_GOOD(-0.01)[mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, m
 x6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.com, mx5.mail.icloud.com,
 mx2.mail.icloud.com, mx3.mail.icloud.com, mx1.mail.icloud.com,
 mx6.mail.icloud.com, mx4.mail.icloud.co
 m, mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud.com, mx3.mail.icloud.com,
 mx1.mail.icloud.com, mx6.mail.icloud.com, mx4.mail.icloud.com,
 mx5.mail.icloud.com, mx2.mail.icloud
 .com, mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icloud.com, mx6.mail.icloud.com,
 mx4.mail.icloud.com, mx5.mail.icloud.com, mx2.mail.icloud.com,
 mx3.mail.icloud.com, mx1.mail.icl
 oud.com,mx6.mail.icloud.com,mx4.mail.icloud.com,mx5.mail.icloud.com,mx2.mail.icloud.com,mx3.mail.icloud.com,mx1.mail.icloud.com,mx6.mail.icloud.com,mx4.mail.icloud.com,mx5.mail.icloud.com,mx2.mail.icloud.com,mx3.mail.icloud.com,mx1.mail.icloud.com,mx6.mail.icloud.com,mx4.mail.icloud.com,mx5.mail.icloud.com,mx2.mail.icloud.com,mx3.mail.icloud.com,mx1.mail.icloud.com,mx6.mail.icloud.com,mx4.mail.icloud.com,mx5.mail.icloud.com,mx2.mail.icloud.com,mx3.mail.icloud.com,mx1.mail.icloud.com,mx6.mail.icloud.com,mx4.mail.icloud.com,mx5.mail.icloud.com,mx2.mail.icloud.com,mx3.mail.icloud.com,mx1.mail.icloud.com,mx6.mail.icloud.com,mx4.mail.icloud.com,mx5.mail.icloud.com,mx2.mail.icloud.com,mx3.mail.icloud.com,mx1.mail.icloud.com,mx6.mail.icloud.com,mx4.mail.icloud.com,mx5.mail.icloud.com,mx2.mail.icloud.com,mx3.mail.icloud.com];
 NEURAL_HAM_SHORT(-0.99)[-0.995,0];
 RECEIVED_SPAMHAUS_PBL(0.00)[148.52.235.80.zen.spamhaus.org : 127.0.0.10];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];
 FREEMAIL_ENVFROM(0.00)[me.com];
 ASN(0.00)[asn:714, ipnet:17.58.16.0/20, country:US];
 MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.10)[text/plain];
 IP_SCORE(-2.06)[ip: (-5.32), ipnet: 17.58.16.0/20(-2.29), asn: 714(-2.66),
 country: US(-0.05)]; 
 DWL_DNSWL_LOW(0.00)[me.com.dwl.dnswl.org : 127.0.5.1];
 TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2];
 RCVD_TLS_ALL(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 16:07:20 -0000

hi!

efihttp is also using network, is it intentionally left untouched?

rgds,
toomas

> On 30 Jul 2019, at 17:54, Ruslan Bukin <br@FreeBSD.org> wrote:
>=20
> Author: br
> Date: Tue Jul 30 14:54:18 2019
> New Revision: 350444
> URL: https://svnweb.freebsd.org/changeset/base/350444
>=20
> Log:
>  Fix EFI loader build when LOADER_NET_SUPPORT=3Dno.
>=20
>  Sponsored by:	DARPA, AFRL
>=20
> Modified:
>  head/stand/efi/loader/conf.c
>=20
> Modified: head/stand/efi/loader/conf.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/stand/efi/loader/conf.c	Tue Jul 30 14:21:00 2019	=
(r350443)
> +++ head/stand/efi/loader/conf.c	Tue Jul 30 14:54:18 2019	=
(r350444)
> @@ -40,7 +40,9 @@ struct devsw *devsw[] =3D {
> 	&efipart_cddev,
> 	&efipart_hddev,
> 	&efihttp_dev, /* ordering with efinet_dev matters */
> +#if defined(LOADER_NET_SUPPORT)
> 	&efinet_dev,
> +#endif
> 	&vdisk_dev,
> #ifdef EFI_ZFS_BOOT
> 	&zfs_dev,
> @@ -64,7 +66,9 @@ struct fs_ops *file_system[] =3D {
> };
>=20
> struct netif_driver *netif_drivers[] =3D {
> +#if defined(LOADER_NET_SUPPORT)
> 	&efinetif,
> +#endif
> 	NULL
> };
>=20
>=20


From owner-svn-src-head@freebsd.org  Tue Jul 30 16:40:34 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A8D6A7AC1;
 Tue, 30 Jul 2019 16:40:34 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 09543686FE;
 Tue, 30 Jul 2019 16:40:34 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D48AD1BD5C;
 Tue, 30 Jul 2019 16:40:33 +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 x6UGeXRk004319;
 Tue, 30 Jul 2019 16:40:33 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UGeXIV004318;
 Tue, 30 Jul 2019 16:40:33 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907301640.x6UGeXIV004318@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Tue, 30 Jul 2019 16:40:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350449 - head
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350449
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 09543686FE
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.97)[-0.971,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 16:40:34 -0000

Author: emaste
Date: Tue Jul 30 16:40:33 2019
New Revision: 350449
URL: https://svnweb.freebsd.org/changeset/base/350449

Log:
  cirrus.yml: stop fetching OVMF.fd now that we're using the pkg
  
  Missed in r350302
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/.cirrus.yml

Modified: head/.cirrus.yml
==============================================================================
--- head/.cirrus.yml	Tue Jul 30 16:01:16 2019	(r350448)
+++ head/.cirrus.yml	Tue Jul 30 16:40:33 2019	(r350449)
@@ -12,7 +12,6 @@ task:
   timeout_in: 90m
   install_script:
   - pkg install -y qemu-devel uefi-edk2-qemu-x86_64
-  - fetch https://people.freebsd.org/~emaste/OVMF.fd
   script:
   - make -j$(sysctl -n hw.ncpu) WITHOUT_TOOLCHAIN=yes buildworld buildkernel
   test_script:

From owner-svn-src-head@freebsd.org  Tue Jul 30 17:09:58 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B845DA837D;
 Tue, 30 Jul 2019 17:09:58 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 95C1A69520;
 Tue, 30 Jul 2019 17:09:58 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 837EE1C2D6;
 Tue, 30 Jul 2019 17:09:58 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UH9whb021843;
 Tue, 30 Jul 2019 17:09:58 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UH9wTT021842;
 Tue, 30 Jul 2019 17:09:58 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907301709.x6UH9wTT021842@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Tue, 30 Jul 2019 17:09:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350450 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350450
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 95C1A69520
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.95)[-0.952,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 17:09:58 -0000

Author: markj
Date: Tue Jul 30 17:09:58 2019
New Revision: 350450
URL: https://svnweb.freebsd.org/changeset/base/350450

Log:
  Enable witness(4) blessings.
  
  witness has long had a facility to "bless" designated lock pairs.  Lock
  order reversals between a pair of blessed locks are not reported upon.
  We have a number of long-standing false positive LOR reports; start
  marking well-understood LORs as blessed.
  
  This change hides reports about UFS vnode locks and the UFS dirhash
  lock, and UFS vnode locks and buffer locks, since those are the two that
  I observe most often.  In the long term it would be preferable to be
  able to limit blessings to a specific site where a lock is acquired,
  and/or extend witness to understand why some lock order reversals are
  valid (for example, if code paths with conflicting lock orders are
  serialized by a third lock), but in the meantime the false positives
  frequently confuse users and generate bug reports.
  
  Reviewed by:	cem, kib, mckusick
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21039

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Tue Jul 30 16:40:33 2019	(r350449)
+++ head/sys/kern/subr_witness.c	Tue Jul 30 17:09:58 2019	(r350450)
@@ -132,9 +132,6 @@ __FBSDID("$FreeBSD$");
 #define	LI_EXCLUSIVE	0x00010000	/* Exclusive lock instance. */
 #define	LI_NORELEASE	0x00020000	/* Lock not allowed to be released. */
 
-/* Define this to check for blessed mutexes */
-#undef BLESSING
-
 #ifndef WITNESS_COUNT
 #define	WITNESS_COUNT 		1536
 #endif
@@ -278,12 +275,10 @@ struct witness_lock_order_hash {
 	u_int	wloh_count;
 };
 
-#ifdef BLESSING
 struct witness_blessed {
 	const char	*b_lock1;
 	const char	*b_lock2;
 };
-#endif
 
 struct witness_pendhelp {
 	const char		*wh_type;
@@ -318,9 +313,7 @@ witness_lock_order_key_equal(const struct witness_lock
 static int	_isitmyx(struct witness *w1, struct witness *w2, int rmask,
 		    const char *fname);
 static void	adopt(struct witness *parent, struct witness *child);
-#ifdef BLESSING
 static int	blessed(struct witness *, struct witness *);
-#endif
 static void	depart(struct witness *w);
 static struct witness	*enroll(const char *description,
 			    struct lock_class *lock_class);
@@ -726,14 +719,25 @@ static struct witness_order_list_entry order_lists[] =
 	{ NULL, NULL }
 };
 
-#ifdef BLESSING
 /*
- * Pairs of locks which have been blessed
- * Don't complain about order problems with blessed locks
+ * Pairs of locks which have been blessed.  Witness does not complain about
+ * order problems with blessed lock pairs.  Please do not add an entry to the
+ * table without an explanatory comment.
  */
 static struct witness_blessed blessed_list[] = {
+	/*
+	 * See the comment in ufs_dirhash.c.  Basically, a vnode lock serializes
+	 * both lock orders, so a deadlock cannot happen as a result of this
+	 * LOR.
+	 */
+	{ "dirhash",	"bufwait" },
+
+	/*
+	 * A UFS vnode may be locked in vget() while a buffer belonging to the
+	 * parent directory vnode is locked.
+	 */
+	{ "ufs",	"bufwait" },
 };
-#endif
 
 /*
  * This global is set to 0 once it becomes safe to use the witness code.
@@ -1339,7 +1343,6 @@ witness_checkorder(struct lock_object *lock, int flags
 			 * We have a lock order violation, check to see if it
 			 * is allowed or has already been yelled about.
 			 */
-#ifdef BLESSING
 
 			/*
 			 * If the lock order is blessed, just bail.  We don't
@@ -1348,7 +1351,6 @@ witness_checkorder(struct lock_object *lock, int flags
 			 */
 			if (blessed(w, w1))
 				goto out;
-#endif
 
 			/* Bail if this violation is known */
 			if (w_rmatrix[w1->w_index][w->w_index] & WITNESS_REVERSAL)
@@ -2084,7 +2086,6 @@ isitmydescendant(struct witness *ancestor, struct witn
 	    __func__));
 }
 
-#ifdef BLESSING
 static int
 blessed(struct witness *w1, struct witness *w2)
 {
@@ -2104,7 +2105,6 @@ blessed(struct witness *w1, struct witness *w2)
 	}
 	return (0);
 }
-#endif
 
 static struct witness *
 witness_get(void)

From owner-svn-src-head@freebsd.org  Tue Jul 30 17:18:33 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78BC5A8701;
 Tue, 30 Jul 2019 17:18:33 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 651D669B37;
 Tue, 30 Jul 2019 17:18:33 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1543B1C4C6;
 Tue, 30 Jul 2019 17:18:33 +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 x6UHIXjL027478;
 Tue, 30 Jul 2019 17:18:33 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UHIVTC027471;
 Tue, 30 Jul 2019 17:18:31 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907301718.x6UHIVTC027471@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Tue, 30 Jul 2019 17:18:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350451 - in head/sys: amd64/linux amd64/linux32
 arm64/linux conf i386/linux modules/linux64
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux conf
 i386/linux modules/linux64
X-SVN-Commit-Revision: 350451
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 651D669B37
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.95 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.95)[-0.954,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 17:18:33 -0000

Author: emaste
Date: Tue Jul 30 17:18:31 2019
New Revision: 350451
URL: https://svnweb.freebsd.org/changeset/base/350451

Log:
  linuxulator: rename linux_locore.s to .asm
  
  It is assembled using "${CC} -x assembler-with-cpp", which by convention
  (bsd.suffixes.mk) uses the .asm extension.
  
  This is a portion of the review referenced below (D18344).  That review
  also renamed linux_support.s to .S, but that is a functional change
  (using the compiler's integrated assembler instead of as) and will be
  revisited separately.
  
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D18344

Added:
  head/sys/amd64/linux/linux_locore.asm
     - copied unchanged from r350450, head/sys/amd64/linux/linux_locore.s
  head/sys/amd64/linux32/linux32_locore.asm
     - copied unchanged from r350450, head/sys/amd64/linux32/linux32_locore.s
  head/sys/arm64/linux/linux_locore.asm
     - copied unchanged from r350450, head/sys/arm64/linux/linux_locore.s
  head/sys/i386/linux/linux_locore.asm
     - copied unchanged from r350450, head/sys/i386/linux/linux_locore.s
Deleted:
  head/sys/amd64/linux/linux_locore.s
  head/sys/amd64/linux32/linux32_locore.s
  head/sys/arm64/linux/linux_locore.s
  head/sys/i386/linux/linux_locore.s
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/linux64/Makefile

Copied: head/sys/amd64/linux/linux_locore.asm (from r350450, head/sys/amd64/linux/linux_locore.s)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/amd64/linux/linux_locore.asm	Tue Jul 30 17:18:31 2019	(r350451, copy of r350450, head/sys/amd64/linux/linux_locore.s)
@@ -0,0 +1,108 @@
+/* $FreeBSD$ */
+
+#include "linux_assym.h"			/* system definitions */
+#include <machine/asmacros.h>			/* miscellaneous asm macros */
+
+#include <amd64/linux/linux_syscall.h>		/* system call numbers */
+
+	.data
+
+	.globl linux_platform
+linux_platform:
+	.asciz "x86_64"
+
+
+	.text
+/*
+ * To avoid excess stack frame the signal trampoline code emulates
+ * the 'call' instruction.
+ */
+NON_GPROF_ENTRY(linux_rt_sigcode)
+	movq	%rsp, %rbx			/* preserve sigframe */
+	call	.getip
+.getip:
+	popq	%rax
+	add	$.startrtsigcode-.getip, %rax	/* ret address */
+	pushq	%rax
+	jmp	*LINUX_RT_SIGF_HANDLER(%rbx)
+.startrtsigcode:
+	movq	$LINUX_SYS_linux_rt_sigreturn,%rax   /* linux_rt_sigreturn() */
+	syscall					/* enter kernel with args */
+	hlt
+.endrtsigcode:
+0:	jmp	0b
+
+NON_GPROF_ENTRY(__vdso_clock_gettime)
+	movq	$LINUX_SYS_linux_clock_gettime,%rax
+	syscall
+	ret
+.weak clock_gettime
+.set clock_gettime, __vdso_clock_gettime
+
+NON_GPROF_ENTRY(__vdso_time)
+	movq	$LINUX_SYS_linux_time,%rax
+	syscall
+	ret
+.weak time
+.set time, __vdso_time
+
+NON_GPROF_ENTRY(__vdso_gettimeofday)
+	movq	$LINUX_SYS_gettimeofday,%rax
+	syscall
+	ret
+.weak gettimeofday
+.set gettimeofday, __vdso_gettimeofday
+
+NON_GPROF_ENTRY(__vdso_getcpu)
+	movq	$-38,%rax	/* not implemented */
+	ret
+.weak getcpu
+.set getcpu, __vdso_getcpu
+
+#if 0
+	.section .note.Linux, "a",@note
+	.long 2f - 1f		/* namesz */
+	.balign 4
+	.long 4f - 3f		/* descsz */
+	.long 0
+1:
+	.asciz "Linux"
+2:
+	.balign 4
+3:
+	.long LINUX_VERSION_CODE
+4:
+	.balign 4
+	.previous
+#endif
+
+	.section .eh_frame,"a",@progbits
+.LSTARTFRAMEDLSI0:
+	.long .LENDCIEDLSI0-.LSTARTCIEDLSI0
+.LSTARTCIEDLSI0:
+	.long 0					/* CIE ID */
+	.byte 1					/* Version number */
+	.string "zR"				/* NULL-terminated
+						 * augmentation string
+						 */
+	.uleb128 1				/* Code alignment factor */
+	.sleb128 -4				/* Data alignment factor */
+	.byte 8					/* Return address register column */
+	.uleb128 1				/* Augmentation value length */
+	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
+	.byte 0x0c				/* DW_CFA_def_cfa */
+	.uleb128 4
+	.uleb128 4
+	.byte 0x88				/* DW_CFA_offset, column 0x8 */
+	.uleb128 1
+	.align 4
+.LENDCIEDLSI0:
+	.long .LENDFDEDLSI0-.LSTARTFDEDLSI0	/* Length FDE */
+.LSTARTFDEDLSI0:
+	.long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0	/* CIE pointer */
+	.long .startrtsigcode-.			/* PC-relative start address */
+	.long .endrtsigcode-.startrtsigcode
+	.uleb128 0
+	.align 4
+.LENDFDEDLSI0:
+	.previous

Copied: head/sys/amd64/linux32/linux32_locore.asm (from r350450, head/sys/amd64/linux32/linux32_locore.s)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/amd64/linux32/linux32_locore.asm	Tue Jul 30 17:18:31 2019	(r350451, copy of r350450, head/sys/amd64/linux32/linux32_locore.s)
@@ -0,0 +1,156 @@
+/* $FreeBSD$ */
+
+#include "linux32_assym.h"			/* system definitions */
+#include <machine/asmacros.h>			/* miscellaneous asm macros */
+
+#include <amd64/linux32/linux32_syscall.h>	/* system call numbers */
+
+.data
+
+	.globl linux_platform
+linux_platform:
+	.asciz "i686"
+
+.text
+.code32
+
+/*
+ * To avoid excess stack frame the signal trampoline code emulates
+ * the 'call' instruction.
+ */
+NON_GPROF_ENTRY(linux32_sigcode)
+	movl	%esp, %ebx			/* preserve sigframe */
+	call .getip0
+.getip0:
+	popl	%eax
+	add	$.startsigcode-.getip0, %eax	/* ret address */
+	push	%eax
+	jmp	*LINUX_SIGF_HANDLER(%ebx)
+.startsigcode:
+	popl	%eax
+	movl	$LINUX32_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
+	int	$0x80				/* enter kernel with args */
+.endsigcode:
+0:	jmp	0b
+
+NON_GPROF_ENTRY(linux32_rt_sigcode)
+	leal	LINUX_RT_SIGF_UC(%esp),%ebx	/* linux ucp */
+	leal	LINUX_RT_SIGF_SC(%ebx),%ecx	/* linux sigcontext */
+	movl	%esp, %edi
+	call	.getip1
+.getip1:
+	popl	%eax
+	add	$.startrtsigcode-.getip1, %eax	/* ret address */
+	push	%eax
+	jmp	*LINUX_RT_SIGF_HANDLER(%edi)
+.startrtsigcode:
+	movl	$LINUX32_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
+	int	$0x80				/* enter kernel with args */
+.endrtsigcode:
+0:	jmp	0b
+
+NON_GPROF_ENTRY(linux32_vsyscall)
+.startvsyscall:
+	int $0x80
+	ret
+.endvsyscall:
+
+#if 0
+	.section .note.Linux, "a",@note
+	.long 2f - 1f		/* namesz */
+	.balign 4
+	.long 4f - 3f		/* descsz */
+	.long 0
+1:
+	.asciz "Linux"
+2:
+	.balign 4
+3:
+	.long LINUX_VERSION_CODE
+4:
+	.balign 4
+	.previous
+#endif
+
+#define do_cfa_expr(offset)						\
+	.byte 0x0f;			/* DW_CFA_def_cfa_expression */	\
+	.uleb128 11f-10f;		/*   length */			\
+10:	.byte 0x74;			/*     DW_OP_breg4 */		\
+	.sleb128 offset;		/*      offset */		\
+	.byte 0x06;			/*     DW_OP_deref */		\
+11:
+
+
+	/* CIE */
+	.section .eh_frame,"a",@progbits
+.LSTARTFRAMEDLSI1:
+	.long .LENDCIEDLSI1-.LSTARTCIEDLSI1
+.LSTARTCIEDLSI1:
+	.long 0					/* CIE ID */
+	.byte 1					/* Version number */
+	.string "zRS"				/* NULL-terminated
+						 * augmentation string
+						 */
+	.uleb128 1				/* Code alignment factor */
+	.sleb128 -4				/* Data alignment factor */
+	.byte 8					/* Return address
+						 * register column
+						 */
+	.uleb128 1				/* Augmentation value length */
+	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
+	.byte 0					/* DW_CFA_nop */
+	.align 4
+.LENDCIEDLSI1:
+
+	/* FDE */
+	.long .LENDFDEDLSI1-.LSTARTFDEDLSI1	/* Length FDE */
+.LSTARTFDEDLSI1:
+	.long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
+	.long .startsigcode-.			/* PC-relative start address */
+	.long .endsigcode-.startsigcode
+	.uleb128 0				/* Augmentation */
+	do_cfa_expr(LINUX_SIGF_SC-8)
+	.align 4
+.LENDFDEDLSI1:
+
+	.long .LENDFDEDLSI2-.LSTARTFDEDLSI2	/* Length FDE */
+.LSTARTFDEDLSI2:
+	.long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1	/* CIE pointer */
+	.long .startrtsigcode-.			/* PC-relative start address */
+	.long .endrtsigcode-.startrtsigcode
+	.uleb128 0				/* Augmentation */
+	do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP)
+	.align 4
+.LENDFDEDLSI2:
+	.previous
+
+	.section .eh_frame,"a",@progbits
+.LSTARTFRAMEDLSI2:
+	.long .LENDCIEDLSI2-.LSTARTCIEDLSI2
+.LSTARTCIEDLSI2:
+	.long 0					/* CIE ID */
+	.byte 1					/* Version number */
+	.string "zR"				/* NULL-terminated
+						 * augmentation string
+						 */
+	.uleb128 1				/* Code alignment factor */
+	.sleb128 -4				/* Data alignment factor */
+	.byte 8					/* Return address register column */
+	.uleb128 1				/* Augmentation value length */
+	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
+	.byte 0x0c				/* DW_CFA_def_cfa */
+	.uleb128 4
+	.uleb128 4
+	.byte 0x88				/* DW_CFA_offset, column 0x8 */
+	.uleb128 1
+	.align 4
+.LENDCIEDLSI2:
+	.long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */
+.LSTARTFDEDLSI3:
+	.long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */
+	.long .startvsyscall-.			/* PC-relative start address */
+	.long .endvsyscall-.startvsyscall
+	.uleb128 0
+	.align 4
+.LENDFDEDLSI3:
+	.previous

Copied: head/sys/arm64/linux/linux_locore.asm (from r350450, head/sys/arm64/linux/linux_locore.s)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm64/linux/linux_locore.asm	Tue Jul 30 17:18:31 2019	(r350451, copy of r350450, head/sys/arm64/linux/linux_locore.s)
@@ -0,0 +1,58 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (C) 2018 Turing Robotic Industries Inc.
+ *
+ * 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$
+ */
+
+/*
+ * arm64 Linux VDSO implementation.
+ */
+
+#include <machine/asm.h>
+
+	.data
+
+	.globl linux_platform
+linux_platform:
+	.asciz "arm64"
+
+	.text
+
+ENTRY(__kernel_rt_sigreturn)
+	brk #0 /* LINUXTODO: implement __kernel_rt_sigreturn */
+	ret
+
+ENTRY(__kernel_gettimeofday)
+	brk #0 /* LINUXTODO: implement __kernel_gettimeofday */
+	ret
+
+ENTRY(__kernel_clock_gettime)
+	brk #0 /* LINUXTODO: implement __kernel_clock_gettime */
+	ret
+
+ENTRY(__kernel_clock_getres)
+	brk #0 /* LINUXTODO: implement __kernel_clock_getres */
+	ret

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Tue Jul 30 17:09:58 2019	(r350450)
+++ head/sys/conf/files.amd64	Tue Jul 30 17:18:31 2019	(r350451)
@@ -45,7 +45,7 @@ linux32_assym.h			optional	compat_linux32		\
 	clean		"linux32_assym.h"
 #
 linux32_locore.o	optional	compat_linux32		\
-	dependency 	"linux32_assym.h $S/amd64/linux32/linux32_locore.s"	\
+	dependency 	"linux32_assym.h $S/amd64/linux32/linux32_locore.asm"	\
 	compile-with	"${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \
 	no-obj no-implicit-rule						\
 	clean		"linux32_locore.o"

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Tue Jul 30 17:09:58 2019	(r350450)
+++ head/sys/conf/files.i386	Tue Jul 30 17:18:31 2019	(r350451)
@@ -32,7 +32,7 @@ linux_assym.h			optional	compat_linux		\
 	clean		"linux_assym.h"
 #
 linux_locore.o			optional	compat_linux		\
-	dependency 	"linux_assym.h $S/i386/linux/linux_locore.s"	\
+	dependency 	"linux_assym.h $S/i386/linux/linux_locore.asm"	\
 	compile-with	"${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \
 	no-obj no-implicit-rule						\
 	clean		"linux_locore.o"

Copied: head/sys/i386/linux/linux_locore.asm (from r350450, head/sys/i386/linux/linux_locore.s)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/i386/linux/linux_locore.asm	Tue Jul 30 17:18:31 2019	(r350451, copy of r350450, head/sys/i386/linux/linux_locore.s)
@@ -0,0 +1,149 @@
+/* $FreeBSD$ */
+
+#include "linux_assym.h"			/* system definitions */
+#include <machine/asmacros.h>			/* miscellaneous asm macros */
+
+#include <i386/linux/linux_syscall.h>		/* system call numbers */
+
+#include "assym.inc"
+
+/*
+ * To avoid excess stack frame the signal trampoline code emulates
+ * the 'call' instruction.
+ */
+NON_GPROF_ENTRY(linux_sigcode)
+	movl	%esp, %ebx			/* preserve sigframe */
+	call .getip0
+.getip0:
+	popl	%eax
+	add	$.startsigcode-.getip0, %eax	/* ret address */
+	push	%eax
+	jmp	*LINUX_SIGF_HANDLER(%ebx)
+.startsigcode:
+	popl	%eax				/* gcc unwind code need this */
+	movl	$LINUX_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
+	int	$0x80				/* enter kernel with args */
+.endsigcode:
+0:	jmp	0b
+
+NON_GPROF_ENTRY(linux_rt_sigcode)
+	leal	LINUX_RT_SIGF_UC(%esp),%ebx	/* linux ucp */
+	leal	LINUX_RT_SIGF_SC(%ebx),%ecx	/* linux sigcontext */
+	movl	%esp, %edi
+	call	.getip1
+.getip1:
+	popl	%eax
+	add	$.startrtsigcode-.getip1, %eax	/* ret address */
+	push	%eax
+	jmp	*LINUX_RT_SIGF_HANDLER(%edi)
+.startrtsigcode:
+	movl	$LINUX_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
+	int	$0x80				/* enter kernel with args */
+.endrtsigcode:
+0:	jmp	0b
+
+NON_GPROF_ENTRY(linux_vsyscall)
+.startvsyscall:
+	int $0x80
+	ret
+.endvsyscall:
+
+#if 0
+	.section .note.Linux, "a",@note
+	.long 2f - 1f		/* namesz */
+	.balign 4
+	.long 4f - 3f		/* descsz */
+	.long 0
+1:
+	.asciz "Linux"
+2:
+	.balign 4
+3:
+	.long LINUX_VERSION_CODE
+4:
+	.balign 4
+	.previous
+#endif
+
+#define do_cfa_expr(offset)						\
+	.byte 0x0f;			/* DW_CFA_def_cfa_expression */	\
+	.uleb128 11f-10f;		/*   length */			\
+10:	.byte 0x74;			/*     DW_OP_breg4 */		\
+	.sleb128 offset;		/*      offset */		\
+	.byte 0x06;			/*     DW_OP_deref */		\
+11:
+
+
+	/* CIE */
+	.section .eh_frame,"a",@progbits
+.LSTARTFRAMEDLSI1:
+	.long .LENDCIEDLSI1-.LSTARTCIEDLSI1
+.LSTARTCIEDLSI1:
+	.long 0					/* CIE ID */
+	.byte 1					/* Version number */
+	.string "zRS"				/* NULL-terminated
+						 * augmentation string
+						 */
+	.uleb128 1				/* Code alignment factor */
+	.sleb128 -4				/* Data alignment factor */
+	.byte 8					/* Return address
+						 * register column
+						 */
+	.uleb128 1				/* Augmentation value length */
+	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
+	.byte 0					/* DW_CFA_nop */
+	.align 4
+.LENDCIEDLSI1:
+
+	/* FDE */
+	.long .LENDFDEDLSI1-.LSTARTFDEDLSI1	/* Length FDE */
+.LSTARTFDEDLSI1:
+	.long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
+	.long .startsigcode-.			/* PC-relative start address */
+	.long .endsigcode-.startsigcode
+	.uleb128 0				/* Augmentation */
+	do_cfa_expr(LINUX_SIGF_SC-8)
+	.align 4
+.LENDFDEDLSI1:
+
+	.long .LENDFDEDLSI2-.LSTARTFDEDLSI2	/* Length FDE */
+.LSTARTFDEDLSI2:
+	.long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1	/* CIE pointer */
+	.long .startrtsigcode-.			/* PC-relative start address */
+	.long .endrtsigcode-.startrtsigcode
+	.uleb128 0				/* Augmentation */
+	do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP)
+	.align 4
+.LENDFDEDLSI2:
+	.previous
+
+	.section .eh_frame,"a",@progbits
+.LSTARTFRAMEDLSI2:
+	.long .LENDCIEDLSI2-.LSTARTCIEDLSI2
+.LSTARTCIEDLSI2:
+	.long 0					/* CIE ID */
+	.byte 1					/* Version number */
+	.string "zR"				/* NULL-terminated
+						 * augmentation string
+						 */
+	.uleb128 1				/* Code alignment factor */
+	.sleb128 -4				/* Data alignment factor */
+	.byte 8					/* Return address register column */
+	.uleb128 1				/* Augmentation value length */
+	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
+	.byte 0x0c				/* DW_CFA_def_cfa */
+	.uleb128 4
+	.uleb128 4
+	.byte 0x88				/* DW_CFA_offset, column 0x8 */
+	.uleb128 1
+	.align 4
+.LENDCIEDLSI2:
+	.long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */
+.LSTARTFDEDLSI3:
+	.long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */
+	.long .startvsyscall-.			/* PC-relative start address */
+	.long .endvsyscall-.startvsyscall
+	.uleb128 0
+	.align 4
+.LENDFDEDLSI3:
+	.previous

Modified: head/sys/modules/linux64/Makefile
==============================================================================
--- head/sys/modules/linux64/Makefile	Tue Jul 30 17:09:58 2019	(r350450)
+++ head/sys/modules/linux64/Makefile	Tue Jul 30 17:18:31 2019	(r350451)
@@ -29,7 +29,7 @@ OBJS=	${VDSO}.so
 linux_assym.h: linux_genassym.o
 	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
 
-linux_locore.o: linux_locore.s linux_assym.h
+linux_locore.o: linux_locore.asm linux_assym.h
 	${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small	\
 	-pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc	\
 	-Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s	\

From owner-svn-src-head@freebsd.org  Tue Jul 30 17:24:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B6A4A89EA;
 Tue, 30 Jul 2019 17:24:08 +0000 (UTC) (envelope-from br@bsdpad.com)
Received: from sc1.bsdpad.com (sc1.bsdpad.com [163.172.212.18])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 5BF3E6A048;
 Tue, 30 Jul 2019 17:24:07 +0000 (UTC) (envelope-from br@bsdpad.com)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bsdpad.com; 
 s=20190317; h=Subject:To:From;
 bh=YEYx1/+GbbW2mHaPI7lIsXkphO7mV9A+SM9UCoIi17I=; b=EuXYfe+L5lv5KL7BMLrM3x7Pin
 OXcWfA5hoUSmTA7Bxl+7Sx76vS7ugmARjeBkEHzV0QU6nMs8rAUKF1ouEEJx7neZPr2CaP2rbfjCF
 WZ7miTemJF6fPFMBU2itLNCylUBTWCHVIAJqdRNbO5en7yGxGGhVfZ9YqNpNnJTOciQ1qS8ytsTOy
 cQR+26DOP3x8An6waRbyT2sGrCFFObhHrwGuaSaIA1Jg7Ujn8bCmwUZGT2Uvu1Ee97Wi6ZiWoAdVr
 oOIwkVP7QmQlbchSVeuF8RCZpSz0UBa4T4G/nj4HXKnNfjbtzzA5w9fmwO4uuIc9B8nKOI87Ip5f4
 KKCWd6UQ==;
Received: from localhost ([127.0.0.1] helo=bsdpad.com)
 by sc1.bsdpad.com with smtp (Exim 4.91 (FreeBSD))
 (envelope-from <br@bsdpad.com>)
 id 1hsVoo-000PVF-Bh; Tue, 30 Jul 2019 18:21:46 +0100
Received: by bsdpad.com (nbSMTP-1.00) for uid 1001
 br@bsdpad.com; Tue, 30 Jul 2019 18:21:46 +0100 (BST)
Date: Tue, 30 Jul 2019 18:21:46 +0100
From: Ruslan Bukin <br@bsdpad.com>
To: Toomas Soome <tsoome@me.com>
Cc: Ruslan Bukin <br@freebsd.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject: Re: svn commit: r350444 - head/stand/efi/loader
Message-ID: <20190730172146.GA97694@bsdpad.com>
References: <201907301454.x6UEsIVC045133@repo.freebsd.org>
 <B6D15575-028D-44AC-8773-3920CC89BCAC@me.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <B6D15575-028D-44AC-8773-3920CC89BCAC@me.com>
User-Agent: Mutt/1.11.2 (2019-01-07)
X-Rspamd-Queue-Id: 5BF3E6A048
X-Spamd-Bar: ------
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=bsdpad.com header.s=20190317 header.b=EuXYfe+L;
 spf=pass (mx1.freebsd.org: domain of br@bsdpad.com designates 163.172.212.18
 as permitted sender) smtp.mailfrom=br@bsdpad.com
X-Spamd-Result: default: False [-6.30 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 R_DKIM_ALLOW(-0.20)[bsdpad.com:s=20190317];
 FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[bsdpad.com];
 RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3];
 TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdpad.com:+];
 MX_GOOD(-0.01)[sc1.bsdpad.com];
 NEURAL_HAM_SHORT(-0.96)[-0.958,0];
 IP_SCORE(-2.83)[ip: (-9.46), ipnet: 163.172.208.0/20(-4.75), asn: 12876(0.08),
 country: FR(-0.01)]; FREEMAIL_TO(0.00)[me.com];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];
 RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:12876, ipnet:163.172.208.0/20, country:FR];
 MID_RHS_MATCH_FROM(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 17:24:08 -0000

Hi

No, this is linking-stage fix only.
efinet.c, efihttp.c are still included to the build

I guess we could exclude them from compilation as it makes no sense

Ruslan

On Tue, Jul 30, 2019 at 07:00:34PM +0300, Toomas Soome wrote:
> hi!
> 
> efihttp is also using network, is it intentionally left untouched?
> 
> rgds,
> toomas
> 
> > On 30 Jul 2019, at 17:54, Ruslan Bukin <br@FreeBSD.org> wrote:
> > 
> > Author: br
> > Date: Tue Jul 30 14:54:18 2019
> > New Revision: 350444
> > URL: https://svnweb.freebsd.org/changeset/base/350444
> > 
> > Log:
> >  Fix EFI loader build when LOADER_NET_SUPPORT=no.
> > 
> >  Sponsored by:	DARPA, AFRL
> > 
> > Modified:
> >  head/stand/efi/loader/conf.c
> > 
> > Modified: head/stand/efi/loader/conf.c
> > ==============================================================================
> > --- head/stand/efi/loader/conf.c	Tue Jul 30 14:21:00 2019	(r350443)
> > +++ head/stand/efi/loader/conf.c	Tue Jul 30 14:54:18 2019	(r350444)
> > @@ -40,7 +40,9 @@ struct devsw *devsw[] = {
> > 	&efipart_cddev,
> > 	&efipart_hddev,
> > 	&efihttp_dev, /* ordering with efinet_dev matters */
> > +#if defined(LOADER_NET_SUPPORT)
> > 	&efinet_dev,
> > +#endif
> > 	&vdisk_dev,
> > #ifdef EFI_ZFS_BOOT
> > 	&zfs_dev,
> > @@ -64,7 +66,9 @@ struct fs_ops *file_system[] = {
> > };
> > 
> > struct netif_driver *netif_drivers[] = {
> > +#if defined(LOADER_NET_SUPPORT)
> > 	&efinetif,
> > +#endif
> > 	NULL
> > };
> > 
> > 
> 
> 


From owner-svn-src-head@freebsd.org  Tue Jul 30 19:34:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AE37AB347;
 Tue, 30 Jul 2019 19:34:40 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id EF8006E343;
 Tue, 30 Jul 2019 19:34:39 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C57B21DE7C;
 Tue, 30 Jul 2019 19:34:39 +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 x6UJYdT3009999;
 Tue, 30 Jul 2019 19:34:39 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UJYdgP009998;
 Tue, 30 Jul 2019 19:34:39 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201907301934.x6UJYdgP009998@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Tue, 30 Jul 2019 19:34:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350453 - head/share/mk
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/share/mk
X-SVN-Commit-Revision: 350453
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: EF8006E343
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.97)[-0.967,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 19:34:40 -0000

Author: asomers
Date: Tue Jul 30 19:34:39 2019
New Revision: 350453
URL: https://svnweb.freebsd.org/changeset/base/350453

Log:
  Add a CXXWARNFLAGS variable
  
  Some warning flags are valid for C++ but not C. GCC 8 complains if you pass
  such flags when building a C file. Using a separate variable for these
  flags allows building both C and C++ files in the same directory (such as
  the fusefs tests) under GCC.
  
  Reviewed by:	cem, emaste
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21116

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==============================================================================
--- head/share/mk/bsd.sys.mk	Tue Jul 30 17:31:09 2019	(r350452)
+++ head/share/mk/bsd.sys.mk	Tue Jul 30 19:34:39 2019	(r350453)
@@ -234,6 +234,8 @@ DEBUG_FILES_CFLAGS?= -g
 .if ${MK_WARNS} != "no"
 CFLAGS+=	${CWARNFLAGS:M*} ${CWARNFLAGS.${COMPILER_TYPE}}
 CFLAGS+=	${CWARNFLAGS.${.IMPSRC:T}}
+CXXFLAGS+=	${CXXWARNFLAGS:M*} ${CXXWARNFLAGS.${COMPILER_TYPE}}
+CXXFLAGS+=	${CXXWARNFLAGS.${.IMPSRC:T}}
 .endif
 
 CFLAGS+=	 ${CFLAGS.${COMPILER_TYPE}}

From owner-svn-src-head@freebsd.org  Tue Jul 30 20:58:57 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63735AD437;
 Tue, 30 Jul 2019 20:58:57 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 47C4581CB1;
 Tue, 30 Jul 2019 20:58:57 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B5241EDC6;
 Tue, 30 Jul 2019 20:58:57 +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 x6UKwvwU059514;
 Tue, 30 Jul 2019 20:58:57 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UKwuud059510;
 Tue, 30 Jul 2019 20:58:56 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907302058.x6UKwuud059510@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Tue, 30 Jul 2019 20:58:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350457 - head/sbin/camcontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/camcontrol
X-SVN-Commit-Revision: 350457
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 47C4581CB1
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.96 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.96)[-0.959,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 20:58:57 -0000

Author: mav
Date: Tue Jul 30 20:58:56 2019
New Revision: 350457
URL: https://svnweb.freebsd.org/changeset/base/350457

Log:
  Make `camcontrol modepage` to use 10 byte commands.
  
  While old devices may not support 10 byte MODE SENSE/MODE SELECT commands,
  new ones may not be able to report all mode pages with 6 byte commands.
  
  This patch makes camcontrol by default start with 10 byte commands and
  fall back to 6 byte on ILLEGAL REQUEST error, or 6 byte can be forced.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/sbin/camcontrol/camcontrol.h
  head/sbin/camcontrol/modeedit.c

Modified: head/sbin/camcontrol/camcontrol.8
==============================================================================
--- head/sbin/camcontrol/camcontrol.8	Tue Jul 30 19:55:55 2019	(r350456)
+++ head/sbin/camcontrol/camcontrol.8	Tue Jul 30 20:58:56 2019	(r350457)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 25, 2019
+.Dd July 30, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -122,6 +122,7 @@
 .Ic modepage
 .Op device id
 .Op generic args
+.Op Fl 6
 .Aq Fl m Ar page[,subpage] | Fl l
 .Op Fl P Ar pgctl
 .Op Fl b | Fl e
@@ -723,6 +724,13 @@ The
 .Ic modepage
 command takes several arguments:
 .Bl -tag -width 12n
+.It Fl 6
+Use 6 byte MODE commands instead of default 10 byte.
+Old devices may not support 10 byte MODE commands, while new devices may
+not be able to report all mode pages with 6 byte commands.
+If not specified,
+.Nm
+starts with 10 byte commands and falls back to 6 byte on error.
 .It Fl d
 Disable block descriptors for mode sense.
 .It Fl b

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Tue Jul 30 19:55:55 2019	(r350456)
+++ head/sbin/camcontrol/camcontrol.c	Tue Jul 30 20:58:56 2019	(r350457)
@@ -221,7 +221,7 @@ static struct camcontrol_opts option_table[] = {
 	{"devlist", CAM_CMD_DEVTREE, CAM_ARG_NONE, "-b"},
 	{"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""},
 	{"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL},
-	{"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "bdelm:P:"},
+	{"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"},
 	{"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"},
 	{"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
 	{"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
@@ -4586,18 +4586,25 @@ reassignblocks(struct cam_device *device, u_int32_t *b
 #endif
 
 void
-mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage,
-	   int task_attr, int retry_count, int timeout, u_int8_t *data,
-	   int datalen)
+mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page,
+    int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data,
+    int datalen)
 {
 	union ccb *ccb;
-	int retval;
+	int error_code, sense_key, asc, ascq;
 
 	ccb = cam_getccb(device);
-
 	if (ccb == NULL)
 		errx(1, "mode_sense: couldn't allocate CCB");
 
+retry:
+	/*
+	 * MODE SENSE(6) can't handle more then 255 bytes.  If there are more,
+	 * device must return error, so we should not get trucated data.
+	 */
+	if (*cdb_len == 6 && datalen > 255)
+		datalen = 255;
+
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
 
 	scsi_mode_sense_subpage(&ccb->csio,
@@ -4610,36 +4617,47 @@ mode_sense(struct cam_device *device, int dbd, int pc,
 			/* subpage */ subpage,
 			/* param_buf */ data,
 			/* param_len */ datalen,
-			/* minimum_cmd_size */ 0,
+			/* minimum_cmd_size */ *cdb_len,
 			/* sense_len */ SSD_FULL_SIZE,
 			/* timeout */ timeout ? timeout : 5000);
 
+	/* Record what CDB size the above function really set. */
+	*cdb_len = ccb->csio.cdb_len;
+
 	if (arglist & CAM_ARG_ERR_RECOVER)
 		ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
 
 	/* Disable freezing the device queue */
 	ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
 
-	if (((retval = cam_send_ccb(device, ccb)) < 0)
-	 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
+	if (cam_send_ccb(device, ccb) < 0)
+		err(1, "error sending mode sense command");
+
+	/* In case of ILLEGEL REQUEST try to fall back to 6-byte command. */
+	if (*cdb_len != 6 &&
+	    ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID ||
+	     (scsi_extract_sense_ccb(ccb, &error_code, &sense_key, &asc, &ascq)
+	      && sense_key == SSD_KEY_ILLEGAL_REQUEST))) {
+		*cdb_len = 6;
+		goto retry;
+	}
+
+	if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
 		if (arglist & CAM_ARG_VERBOSE) {
 			cam_error_print(device, ccb, CAM_ESF_ALL,
 					CAM_EPF_ALL, stderr);
 		}
 		cam_freeccb(ccb);
 		cam_close_device(device);
-		if (retval < 0)
-			err(1, "error sending mode sense command");
-		else
-			errx(1, "error sending mode sense command");
+		errx(1, "mode sense command returned error");
 	}
 
 	cam_freeccb(ccb);
 }
 
 void
-mode_select(struct cam_device *device, int save_pages, int task_attr,
-	    int retry_count, int timeout, u_int8_t *data, int datalen)
+mode_select(struct cam_device *device, int cdb_len, int save_pages,
+    int task_attr, int retry_count, int timeout, u_int8_t *data, int datalen)
 {
 	union ccb *ccb;
 	int retval;
@@ -4651,7 +4669,7 @@ mode_select(struct cam_device *device, int save_pages,
 
 	CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
 
-	scsi_mode_select(&ccb->csio,
+	scsi_mode_select_len(&ccb->csio,
 			 /* retries */ retry_count,
 			 /* cbfcnp */ NULL,
 			 /* tag_action */ task_attr,
@@ -4659,6 +4677,7 @@ mode_select(struct cam_device *device, int save_pages,
 			 /* save_pages */ save_pages,
 			 /* param_buf */ data,
 			 /* param_len */ datalen,
+			 /* minimum_cmd_size */ cdb_len,
 			 /* sense_len */ SSD_FULL_SIZE,
 			 /* timeout */ timeout ? timeout : 5000);
 
@@ -4693,10 +4712,13 @@ modepage(struct cam_device *device, int argc, char **a
 {
 	char *str_subpage;
 	int c, page = -1, subpage = -1, pc = 0;
-	int binary = 0, dbd = 0, edit = 0, list = 0;
+	int binary = 0, cdb_len = 10, dbd = 0, edit = 0, list = 0;
 
 	while ((c = getopt(argc, argv, combinedopt)) != -1) {
 		switch(c) {
+		case '6':
+			cdb_len = 6;
+			break;
 		case 'b':
 			binary = 1;
 			break;
@@ -4736,11 +4758,11 @@ modepage(struct cam_device *device, int argc, char **a
 		errx(1, "you must specify a mode page!");
 
 	if (list != 0) {
-		mode_list(device, dbd, pc, list > 1, task_attr, retry_count,
-			  timeout);
+		mode_list(device, cdb_len, dbd, pc, list > 1, task_attr,
+		    retry_count, timeout);
 	} else {
-		mode_edit(device, dbd, pc, page, subpage, edit, binary,
-		    task_attr, retry_count, timeout);
+		mode_edit(device, cdb_len, dbd, pc, page, subpage, edit,
+		    binary, task_attr, retry_count, timeout);
 	}
 }
 

Modified: head/sbin/camcontrol/camcontrol.h
==============================================================================
--- head/sbin/camcontrol/camcontrol.h	Tue Jul 30 19:55:55 2019	(r350456)
+++ head/sbin/camcontrol/camcontrol.h	Tue Jul 30 20:58:56 2019	(r350457)
@@ -88,16 +88,17 @@ int epc(struct cam_device *device, int argc, char **ar
 int timestamp(struct cam_device *device, int argc, char **argv,
 	      char *combinedopt, int task_attr, int retry_count, int timeout,
 	      int verbosemode);
-void mode_sense(struct cam_device *device, int dbd, int pc, int page,
-		int subpage, int task_attr, int retry_count, int timeout,
-		uint8_t *data, int datalen);
-void mode_select(struct cam_device *device, int save_pages, int task_attr,
-		 int retry_count, int timeout, u_int8_t *data, int datalen);
-void mode_edit(struct cam_device *device, int dbd, int pc, int page,
-	       int subpage, int edit, int binary, int task_attr,
+void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc,
+		int page, int subpage, int task_attr, int retry_count,
+		int timeout, uint8_t *data, int datalen);
+void mode_select(struct cam_device *device, int cdb_len, int save_pages,
+		 int task_attr, int retry_count, int timeout, u_int8_t *data,
+		 int datalen);
+void mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc,
+	       int page, int subpage, int edit, int binary, int task_attr,
 	       int retry_count, int timeout);
-void mode_list(struct cam_device *device, int dbd, int pc, int subpages,
-	       int task_attr, int retry_count, int timeout);
+void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc,
+	       int subpages, int task_attr, int retry_count, int timeout);
 int scsidoinquiry(struct cam_device *device, int argc, char **argv,
 		  char *combinedopt, int task_attr, int retry_count,
 		  int timeout);

Modified: head/sbin/camcontrol/modeedit.c
==============================================================================
--- head/sbin/camcontrol/modeedit.c	Tue Jul 30 19:55:55 2019	(r350456)
+++ head/sbin/camcontrol/modeedit.c	Tue Jul 30 20:58:56 2019	(r350457)
@@ -60,15 +60,9 @@ __FBSDID("$FreeBSD$");
 #define	PAGENAME_START		'"'	/* Page name delimiter. */
 #define	PAGENAME_END		'"'	/* Page name delimiter. */
 #define	PAGEENTRY_END		';'	/* Page entry terminator (optional). */
-#define	MAX_COMMAND_SIZE	255	/* Mode/Log sense data buffer size. */
+#define	MAX_DATA_SIZE		4096	/* Mode/Log sense data buffer size. */
 #define PAGE_CTRL_SHIFT		6	/* Bit offset to page control field. */
 
-
-/* Macros for working with mode pages. */
-#define	MODE_PAGE_HEADER(mh)						\
-	(struct scsi_mode_page_header *)find_mode_page_6(mh)
-
-
 struct editentry {
 	STAILQ_ENTRY(editentry) link;
 	char	*name;
@@ -106,13 +100,12 @@ static int		 editentry_save(void *hook, char *name);
 static struct editentry	*editentry_lookup(char *name);
 static int		 editentry_set(char *name, char *newvalue,
 				       int editonly);
-static void		 editlist_populate(struct cam_device *device, int dbd,
-					   int pc, int page, int subpage,
-					   int task_attr, int retries,
-					   int timeout);
-static void		 editlist_save(struct cam_device *device, int dbd,
-				       int pc, int page, int subpage,
-				       int task_attr, int retries, int timeout);
+static void		 editlist_populate(struct cam_device *device,
+			    int cdb_len, int dbd, int pc, int page, int subpage,
+			    int task_attr, int retries, int timeout);
+static void		 editlist_save(struct cam_device *device, int cdb_len,
+			    int dbd, int pc, int page, int subpage,
+			    int task_attr, int retries, int timeout);
 static void		 nameentry_create(int page, int subpage, char *name);
 static struct pagename	*nameentry_lookup(int page, int subpage);
 static int		 load_format(const char *pagedb_path, int lpage,
@@ -120,9 +113,9 @@ static int		 load_format(const char *pagedb_path, int 
 static int		 modepage_write(FILE *file, int editonly);
 static int		 modepage_read(FILE *file);
 static void		 modepage_edit(void);
-static void		 modepage_dump(struct cam_device *device, int dbd,
-			    int pc, int page, int subpage, int task_attr,
-			    int retries, int timeout);
+static void		 modepage_dump(struct cam_device *device, int cdb_len,
+			    int dbd, int pc, int page, int subpage,
+			    int task_attr, int retries, int timeout);
 static void		 cleanup_editfile(void);
 
 
@@ -552,12 +545,11 @@ load_format(const char *pagedb_path, int lpage, int ls
 }
 
 static void
-editlist_populate(struct cam_device *device, int dbd, int pc, int page,
-    int subpage, int task_attr, int retries, int timeout)
+editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc,
+    int page, int subpage, int task_attr, int retries, int timeout)
 {
-	u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
+	u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */
 	u_int8_t *mode_pars;		/* Pointer to modepage params. */
-	struct scsi_mode_header_6 *mh;	/* Location of mode header. */
 	struct scsi_mode_page_header *mph;
 	struct scsi_mode_page_header_sp *mphsp;
 	size_t len;
@@ -565,11 +557,18 @@ editlist_populate(struct cam_device *device, int dbd, 
 	STAILQ_INIT(&editlist);
 
 	/* Fetch changeable values; use to build initial editlist. */
-	mode_sense(device, dbd, 1, page, subpage, task_attr, retries, timeout,
-		   data, sizeof(data));
+	mode_sense(device, &cdb_len, dbd, 1, page, subpage, task_attr, retries,
+		   timeout, data, sizeof(data));
 
-	mh = (struct scsi_mode_header_6 *)data;
-	mph = MODE_PAGE_HEADER(mh);
+	if (cdb_len == 6) {
+		struct scsi_mode_header_6 *mh =
+		    (struct scsi_mode_header_6 *)data;
+		mph = find_mode_page_6(mh);
+	} else {
+		struct scsi_mode_header_10 *mh =
+		    (struct scsi_mode_header_10 *)data;
+		mph = find_mode_page_10(mh);
+	}
 	if ((mph->page_code & SMPH_SPF) == 0) {
 		mode_pars = (uint8_t *)(mph + 1);
 		len = mph->page_length;
@@ -584,40 +583,80 @@ editlist_populate(struct cam_device *device, int dbd, 
 	buff_decode_visit(mode_pars, len, format, editentry_create, 0);
 
 	/* Fetch the current/saved values; use to set editentry values. */
-	mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout,
-	    data, sizeof(data));
+	mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr,
+	    retries, timeout, data, sizeof(data));
 	buff_decode_visit(mode_pars, len, format, editentry_update, 0);
 }
 
 static void
-editlist_save(struct cam_device *device, int dbd, int pc, int page,
-    int subpage, int task_attr, int retries, int timeout)
+editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc,
+    int page, int subpage, int task_attr, int retries, int timeout)
 {
-	u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
+	u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */
 	u_int8_t *mode_pars;		/* Pointer to modepage params. */
-	struct scsi_mode_header_6 *mh;	/* Location of mode header. */
 	struct scsi_mode_page_header *mph;
 	struct scsi_mode_page_header_sp *mphsp;
-	size_t len, hlen;
+	size_t len, hlen, mphlen;
 
 	/* Make sure that something changed before continuing. */
 	if (! editlist_changed)
 		return;
 
 	/* Preload the CDB buffer with the current mode page data. */
-	mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout,
-	    data, sizeof(data));
+	mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr,
+	    retries, timeout, data, sizeof(data));
 
 	/* Initial headers & offsets. */
-	mh = (struct scsi_mode_header_6 *)data;
-	mph = MODE_PAGE_HEADER(mh);
+	/*
+	 * Tape drives include write protect (WP), Buffered Mode and Speed
+	 * settings in the device-specific parameter.  Clearing this
+	 * parameter on a mode select can have the effect of turning off
+	 * write protect or buffered mode, or changing the speed setting of
+	 * the tape drive.
+	 *
+	 * Disks report DPO/FUA support via the device specific parameter
+	 * for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
+	 * clear this for disks (and other non-tape devices) to avoid
+	 * potential errors from the target device.
+	 */
+	if (cdb_len == 6) {
+		struct scsi_mode_header_6 *mh =
+		    (struct scsi_mode_header_6 *)data;
+		hlen = sizeof(*mh);
+		/* Eliminate block descriptors. */
+		if (mh->blk_desc_len > 0) {
+			bcopy(find_mode_page_6(mh), mh + 1,
+			    mh->data_length + 1 - hlen -
+			    mh->blk_desc_len);
+			mh->blk_desc_len = 0;
+		}
+		mh->data_length = 0;	/* Reserved for MODE SELECT command. */
+		if (device->pd_type != T_SEQUENTIAL)
+			mh->dev_spec = 0;	/* See comment above */
+		mph = find_mode_page_6(mh);
+	} else {
+		struct scsi_mode_header_10 *mh =
+		    (struct scsi_mode_header_10 *)data;
+		hlen = sizeof(*mh);
+		/* Eliminate block descriptors. */
+		if (scsi_2btoul(mh->blk_desc_len) > 0) {
+			bcopy(find_mode_page_10(mh), mh + 1,
+			    scsi_2btoul(mh->data_length) + 1 - hlen -
+			    scsi_2btoul(mh->blk_desc_len));
+			scsi_ulto2b(0, mh->blk_desc_len);
+		}
+		scsi_ulto2b(0, mh->data_length); /* Reserved for MODE SELECT. */
+		if (device->pd_type != T_SEQUENTIAL)
+			mh->dev_spec = 0;	/* See comment above */
+		mph = find_mode_page_10(mh);
+	}
 	if ((mph->page_code & SMPH_SPF) == 0) {
-		hlen = sizeof(*mph);
+		mphlen = sizeof(*mph);
 		mode_pars = (uint8_t *)(mph + 1);
 		len = mph->page_length;
 	} else {
 		mphsp = (struct scsi_mode_page_header_sp *)mph;
-		hlen = sizeof(*mphsp);
+		mphlen = sizeof(*mphsp);
 		mode_pars = (uint8_t *)(mphsp + 1);
 		len = scsi_2btoul(mphsp->page_length);
 	}
@@ -626,27 +665,6 @@ editlist_save(struct cam_device *device, int dbd, int 
 	/* Encode the value data to be passed back to the device. */
 	buff_encode_visit(mode_pars, len, format, editentry_save, 0);
 
-	/* Eliminate block descriptors. */
-	bcopy(mph, mh + 1, hlen + len);
-
-	/* Recalculate headers & offsets. */
-	mh->data_length = 0;		/* Reserved for MODE SELECT command. */
-	mh->blk_desc_len = 0;		/* No block descriptors. */
-	/*
-	 * Tape drives include write protect (WP), Buffered Mode and Speed
-	 * settings in the device-specific parameter.  Clearing this
-	 * parameter on a mode select can have the effect of turning off
-	 * write protect or buffered mode, or changing the speed setting of
-	 * the tape drive.
-	 *
-	 * Disks report DPO/FUA support via the device specific parameter
-	 * for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
-	 * clear this for disks (and other non-tape devices) to avoid
-	 * potential errors from the target device.
-	 */
-	if (device->pd_type != T_SEQUENTIAL)
-		mh->dev_spec = 0;
-	mph = MODE_PAGE_HEADER(mh);
 	mph->page_code &= ~SMPH_PS;	/* Reserved for MODE SELECT command. */
 
 	/*
@@ -654,9 +672,8 @@ editlist_save(struct cam_device *device, int dbd, int 
 	 * page 3 (saved values) then request the changes be permanently
 	 * recorded.
 	 */
-	mode_select(device, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED),
-	    task_attr, retries, timeout, (u_int8_t *)mh,
-	    sizeof(*mh) + hlen + len);
+	mode_select(device, cdb_len, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED),
+	    task_attr, retries, timeout, data, hlen + mphlen + len);
 }
 
 static int
@@ -825,21 +842,27 @@ modepage_edit(void)
 }
 
 static void
-modepage_dump(struct cam_device *device, int dbd, int pc, int page, int subpage,
-	      int task_attr, int retries, int timeout)
+modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc,
+	      int page, int subpage, int task_attr, int retries, int timeout)
 {
-	u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
+	u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */
 	u_int8_t *mode_pars;		/* Pointer to modepage params. */
-	struct scsi_mode_header_6 *mh;	/* Location of mode header. */
 	struct scsi_mode_page_header *mph;
 	struct scsi_mode_page_header_sp *mphsp;
 	size_t indx, len;
 
-	mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout,
-	    data, sizeof(data));
+	mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr,
+	    retries, timeout, data, sizeof(data));
 
-	mh = (struct scsi_mode_header_6 *)data;
-	mph = MODE_PAGE_HEADER(mh);
+	if (cdb_len == 6) {
+		struct scsi_mode_header_6 *mh =
+		    (struct scsi_mode_header_6 *)data;
+		mph = find_mode_page_6(mh);
+	} else {
+		struct scsi_mode_header_10 *mh =
+		    (struct scsi_mode_header_10 *)data;
+		mph = find_mode_page_10(mh);
+	}
 	if ((mph->page_code & SMPH_SPF) == 0) {
 		mode_pars = (uint8_t *)(mph + 1);
 		len = mph->page_length;
@@ -869,8 +892,9 @@ cleanup_editfile(void)
 }
 
 void
-mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
-	  int edit, int binary, int task_attr, int retry_count, int timeout)
+mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, int page,
+	  int subpage, int edit, int binary, int task_attr, int retry_count,
+	  int timeout)
 {
 	const char *pagedb_path;	/* Path to modepage database. */
 
@@ -901,8 +925,8 @@ mode_edit(struct cam_device *device, int dbd, int pc, 
 				exit(EX_OSFILE);
 		}
 
-		editlist_populate(device, dbd, pc, page, subpage, task_attr,
-		    retry_count, timeout);
+		editlist_populate(device, cdb_len, dbd, pc, page, subpage,
+		    task_attr, retry_count, timeout);
 	}
 
 	if (edit) {
@@ -911,12 +935,12 @@ mode_edit(struct cam_device *device, int dbd, int pc, 
 			errx(EX_USAGE, "it only makes sense to edit page 0 "
 			    "(current) or page 3 (saved values)");
 		modepage_edit();
-		editlist_save(device, dbd, pc, page, subpage, task_attr,
-		    retry_count, timeout);
+		editlist_save(device, cdb_len, dbd, pc, page, subpage,
+		    task_attr, retry_count, timeout);
 	} else if (binary || STAILQ_EMPTY(&editlist)) {
 		/* Display without formatting information. */
-		modepage_dump(device, dbd, pc, page, subpage, task_attr, 
-		    retry_count, timeout);
+		modepage_dump(device, cdb_len, dbd, pc, page, subpage,
+		    task_attr, retry_count, timeout);
 	} else {
 		/* Display with format. */
 		modepage_write(stdout, 0);
@@ -924,16 +948,15 @@ mode_edit(struct cam_device *device, int dbd, int pc, 
 }
 
 void
-mode_list(struct cam_device *device, int dbd, int pc, int subpages,
+mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages,
 	  int task_attr, int retry_count, int timeout)
 {
-	u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
-	struct scsi_mode_header_6 *mh;	/* Location of mode header. */
+	u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */
 	struct scsi_mode_page_header *mph;
 	struct scsi_mode_page_header_sp *mphsp;
 	struct pagename *nameentry;
 	const char *pagedb_path;
-	int len, page, subpage;
+	int len, off, page, subpage;
 
 	if ((pagedb_path = getenv("SCSI_MODES")) == NULL)
 		pagedb_path = DEFAULT_SCSI_MODE_DB;
@@ -944,26 +967,36 @@ mode_list(struct cam_device *device, int dbd, int pc, 
 	}
 
 	/* Build the list of all mode pages by querying the "all pages" page. */
-	mode_sense(device, dbd, pc, SMS_ALL_PAGES_PAGE,
+	mode_sense(device, &cdb_len, dbd, pc, SMS_ALL_PAGES_PAGE,
 	    subpages ? SMS_SUBPAGE_ALL : 0,
 	    task_attr, retry_count, timeout, data, sizeof(data));
 
-	mh = (struct scsi_mode_header_6 *)data;
-	len = sizeof(*mh) + mh->blk_desc_len;	/* Skip block descriptors. */
+	/* Skip block descriptors. */
+	if (cdb_len == 6) {
+		struct scsi_mode_header_6 *mh =
+		    (struct scsi_mode_header_6 *)data;
+		len = mh->data_length;
+		off = sizeof(*mh) + mh->blk_desc_len;
+	} else {
+		struct scsi_mode_header_10 *mh =
+		    (struct scsi_mode_header_10 *)data;
+		len = scsi_2btoul(mh->data_length);
+		off = sizeof(*mh) + scsi_2btoul(mh->blk_desc_len);
+	}
 	/* Iterate through the pages in the reply. */
-	while (len < mh->data_length) {
+	while (off < len) {
 		/* Locate the next mode page header. */
-		mph = (struct scsi_mode_page_header *)((intptr_t)mh + len);
+		mph = (struct scsi_mode_page_header *)(data + off);
 
 		if ((mph->page_code & SMPH_SPF) == 0) {
 			page = mph->page_code & SMS_PAGE_CODE;
 			subpage = 0;
-			len += sizeof(*mph) + mph->page_length;
+			off += sizeof(*mph) + mph->page_length;
 		} else {
 			mphsp = (struct scsi_mode_page_header_sp *)mph;
 			page = mphsp->page_code & SMS_PAGE_CODE;
 			subpage = mphsp->subpage;
-			len += sizeof(*mphsp) + scsi_2btoul(mphsp->page_length);
+			off += sizeof(*mphsp) + scsi_2btoul(mphsp->page_length);
 		}
 
 		nameentry = nameentry_lookup(page, subpage);

From owner-svn-src-head@freebsd.org  Tue Jul 30 21:26:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FB2EADAD1;
 Tue, 30 Jul 2019 21:26:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from smtp.freebsd.org (smtp.freebsd.org
 [IPv6:2610:1c1:1:606c::24b:4])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "smtp.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 719A682893;
 Tue, 30 Jul 2019 21:26:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx
 [66.234.199.215])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate) (Authenticated sender: jhb)
 by smtp.freebsd.org (Postfix) with ESMTPSA id BC7E61071;
 Tue, 30 Jul 2019 21:26:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Subject: Re: svn commit: r350211 - head/tests/sys/kern
To: Li-Wen Hsu <lwhsu@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201907221037.x6MAbvNo049181@repo.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=jhb@FreeBSD.org; keydata=
 mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0
 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo
 /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD
 /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X
 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z
 pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1
 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k
 do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk
 d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID
 AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM
 jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3
 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj
 XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH
 YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO
 EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz
 hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX
 sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16
 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH
 aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx
 Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I
 SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf
 afMAg8QvmOWnHx3wl8WslCaXaE8=
Message-ID: <2682e94f-21e3-cf76-3993-680fb16cf567@FreeBSD.org>
Date: Tue, 30 Jul 2019 14:26:17 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0)
 Gecko/20100101 Thunderbird/60.7.1
MIME-Version: 1.0
In-Reply-To: <201907221037.x6MAbvNo049181@repo.freebsd.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 719A682893
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.94 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.99)[-0.994,0];
 NEURAL_HAM_SHORT(-0.94)[-0.943,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 21:26:22 -0000

On 7/22/19 3:37 AM, Li-Wen Hsu wrote:
> Author: lwhsu
> Date: Mon Jul 22 10:37:56 2019
> New Revision: 350211
> URL: https://svnweb.freebsd.org/changeset/base/350211
> 
> Log:
>   Temporarily skip flakey test case
>   sys.kern.ptrace_test.ptrace__follow_fork_child_detached_unrelated_debugger
>   
>   PR:		239292
>   Sponsored by:	The FreeBSD Foundation

It might be good to try to reach out to folks when opening a PR (e.g. using
svn annotate to see who added the test)?  Looking at the failures, they all
indicate that a read from a pipe is failing in a child process.  It is supposed
to succeed with EOF and is either failing or returning data incorrectly.  This is
not flake but probably a real error that needs to be looked at.  I run these
tests fairly often when testing ptrace changes and have never seen this failure.
Can you reproduce it outside of CI?

Also, I see in followups that you disabled several more meaning that I can't
rely on running ptrace_test directly for my own testing via kyua anymore. :(
Is there some kind of flag we can set with kyua to say "run all the tests
because they work everywhere else except our CI setup"?

-- 
John Baldwin

From owner-svn-src-head@freebsd.org  Tue Jul 30 22:05:09 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B62D8AE3EF;
 Tue, 30 Jul 2019 22:05:09 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
 [IPv6:2610:1c1:1:6074::16:84])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "freefall.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9069183727;
 Tue, 30 Jul 2019 22:05:09 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (unknown [127.0.1.132])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by freefall.freebsd.org (Postfix) with ESMTPS id 380411DBCF;
 Tue, 30 Jul 2019 22:05:09 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (localhost [172.31.3.2])
 by mail.xzibition.com (Postfix) with ESMTP id 40B7D1252E;
 Tue, 30 Jul 2019 22:05:08 +0000 (UTC)
X-Virus-Scanned: amavisd-new at mail.xzibition.com
Received: from mail.xzibition.com ([172.31.3.2])
 by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new,
 port 10026)
 with LMTP id KKlVaFILYdlw; Tue, 30 Jul 2019 22:05:04 +0000 (UTC)
Subject: Re: svn commit: r350005 - head/sys/kern
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 5023F12525
To: Konstantin Belousov <kib@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
From: Bryan Drewery <bdrewery@FreeBSD.org>
Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF;
 url=https://zx.xk42.net/bryan.asc
Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ
 a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab
 D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+
 rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp
 VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB
 AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL
 CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu
 BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX
 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj
 IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd
 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4
 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm
 NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK
 BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8
 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C
 eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR
 lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u
 IUrMm6UAEQEAAYkBPAQYAQoAJgIbDBYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hL4BQkN
 PvONAAoJEDXXcbtuRpfPCjcH/ivBsOpdpebpgLizSNU5/X4yWN5Aixsc9VBnQhGKAKnMINJQ
 VMpA55sD2JSPwloXYM/B3qyPJRS/9cwIuX5LDNKKOZU3Qp+TzleynM15/xea14orWYRGRict
 YHBM3Cnqp7OD8K6Q1uhs0fTxyJP7PZ/G0+7Corlf1DlHhDt6C2HldRPFvAvAgl6sR9Wzgcb7
 rzub2HVtbJgl6YHbgyAG7x9NpXFqzx1JLAMdpt2DIYwoi+oMdRQlBIwNuKjQjCGzuXHandd3
 kGvBAsyJpQ+coEep9UzwANaV28cXrFr2R4FSOcR50rBA2Nh/vqUYfpsvBvJlwuKAoV1djVHa
 ihNeL5E=
Organization: FreeBSD
Message-ID: <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
Date: Tue, 30 Jul 2019 15:04:57 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <201907151918.x6FJIPFo077975@repo.freebsd.org>
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature";
 boundary="f6QZTqCCbXLuni5AVFkOjVEZTlVP3gPEb"
X-Rspamd-Queue-Id: 9069183727
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.995,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.98)[-0.976,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 22:05:09 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--f6QZTqCCbXLuni5AVFkOjVEZTlVP3gPEb
Content-Type: multipart/mixed; boundary="4O55uizLTPgHe81ycKPIhD8CUZvPh5ztB";
 protected-headers="v1"
From: Bryan Drewery <bdrewery@FreeBSD.org>
To: Konstantin Belousov <kib@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Message-ID: <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
Subject: Re: svn commit: r350005 - head/sys/kern
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
In-Reply-To: <201907151918.x6FJIPFo077975@repo.freebsd.org>

--4O55uizLTPgHe81ycKPIhD8CUZvPh5ztB
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 7/15/2019 12:18 PM, Konstantin Belousov wrote:
> Author: kib
> Date: Mon Jul 15 19:18:25 2019
> New Revision: 350005
> URL: https://svnweb.freebsd.org/changeset/base/350005
>=20
> Log:
>   In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on =
retry.
>  =20

Is this also needed in do_sem_wait()? A similar pattern seems to be there=
=2E

I ask because of what I referenced on IRC. I have some processes stuck
in here from a 10.4 jail.

> ~/git/poudriere # procstat -kk 1498
>   PID    TID COMM                TDNAME              KSTACK
>  1498 100710 python2.7           -                   mi_switch+0x174 sl=
eepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0=
x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_sy=
scall+0x2bb fast_syscall_common+0x101
>  1498 101575 python2.7           -                   mi_switch+0x174 sl=
eepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0=
x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_sy=
scall+0x2bb fast_syscall_common+0x101
>  1498 101657 python2.7           -                   <running>
=2E..
> ~/git/poudriere # procstat -kk 1498
>   PID    TID COMM                TDNAME              KSTACK
>  1498 100710 python2.7           -                   mi_switch+0x174 sl=
eepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0=
x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_sy=
scall+0x2bb fast_syscall_common+0x101
>  1498 101575 python2.7           -                   mi_switch+0x174 sl=
eepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0=
x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_sy=
scall+0x2bb fast_syscall_common+0x101
>  1498 101657 python2.7           -                   do_sem_wait+0x1b6 =
__umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
=2E..
> ~/git/poudriere # procstat -kk 94392
>   PID    TID COMM                TDNAME              KSTACK
> 94392 101815 python2.7           -                   mi_switch+0x174 sl=
eepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0=
x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_sy=
scall+0x2bb fast_syscall_common+0x101
> 94392 101816 python2.7           -                   __mtx_lock_sleep+0=
x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x16=
1 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> 94392 102076 python2.7           -                   __mtx_lock_flags+0=
x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_sy=
scall_common+0x101




>   Reported by:	ler
>   Bisected and reviewed by:	markj
>   Sponsored by:	The FreeBSD Foundation
>   MFC after:	12 days
>=20
> Modified:
>   head/sys/kern/kern_umtx.c
>=20
> Modified: head/sys/kern/kern_umtx.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/kern/kern_umtx.c	Mon Jul 15 17:13:32 2019	(r350004)
> +++ head/sys/kern/kern_umtx.c	Mon Jul 15 19:18:25 2019	(r350005)
> @@ -3316,14 +3316,13 @@ do_sem2_wait(struct thread *td, struct _usem2 *=
sem, st
> =20
>  	uq =3D td->td_umtxq;
>  	flags =3D fuword32(&sem->_flags);
> -	error =3D umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);=

> -	if (error !=3D 0)
> -		return (error);
> -
>  	if (timeout !=3D NULL)
>  		abs_timeout_init2(&timo, timeout);
> =20
>  again:
> +	error =3D umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);=

> +	if (error !=3D 0)
> +		return (error);
>  	umtxq_lock(&uq->uq_key);
>  	umtxq_busy(&uq->uq_key);
>  	umtxq_insert(uq);
>=20


--=20
Regards,
Bryan Drewery


--4O55uizLTPgHe81ycKPIhD8CUZvPh5ztB--

--f6QZTqCCbXLuni5AVFkOjVEZTlVP3gPEb
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl1AvwpfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY5
MTczQ0IyQzNBQUVBN0E1QzhBMUYwOTM1RDc3MUJCNkU0Njk3Q0YACgkQNddxu25G
l89LyQf+Kxbydl1qk2biypqhVIsZlNYcb87KKF8lSBM6ND4jVTLGdlOoiF5eAJvQ
5P46/s13v7PBNvI8ZOv3lf19vsHoDkp9npQQ6LjCzfAmv3Ic3C8dEa0CQ32obVC/
lfw2u9pw6yYq455RGLULW5ikdBwnU56RMGMKqDWOO/NHR6C0S0KII1Y9C2aVaUMc
1f4yujyUcl1q/CS9UakazBa+U4fpefeWEgsE+9x8/y8jKuZ7wC/1MQYbcfKyneCc
6qzUT+sbdAdpYGxBo8+pCRf5EbqaikbC7K73YHB1uJLbb+YoDeEferZAWGdfWgO4
WIYA6wDZbWnZ7z1QKTAY9VbYoCBmrw==
=QNR8
-----END PGP SIGNATURE-----

--f6QZTqCCbXLuni5AVFkOjVEZTlVP3gPEb--

From owner-svn-src-head@freebsd.org  Tue Jul 30 22:41:26 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE5BDAEE02;
 Tue, 30 Jul 2019 22:41:26 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9D08784511;
 Tue, 30 Jul 2019 22:41:26 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 757E82011C;
 Tue, 30 Jul 2019 22:41:26 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UMfQ5c019746;
 Tue, 30 Jul 2019 22:41:26 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UMfQER019745;
 Tue, 30 Jul 2019 22:41:26 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201907302241.x6UMfQER019745@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Tue, 30 Jul 2019 22:41:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350458 - head/sys/sys
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/sys
X-SVN-Commit-Revision: 350458
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 9D08784511
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_SHORT(-0.97)[-0.971,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 22:41:26 -0000

Author: markj
Date: Tue Jul 30 22:41:25 2019
New Revision: 350458
URL: https://svnweb.freebsd.org/changeset/base/350458

Log:
  Use VNASSERT() in checked VOP wrappers.
  
  Reviewed by:	kib
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21120

Modified:
  head/sys/sys/vnode.h

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Tue Jul 30 20:58:56 2019	(r350457)
+++ head/sys/sys/vnode.h	Tue Jul 30 22:41:25 2019	(r350458)
@@ -844,27 +844,30 @@ void	vop_rename_fail(struct vop_rename_args *ap);
 
 #define VOP_LOCK(vp, flags) VOP_LOCK1(vp, flags, __FILE__, __LINE__)
 
-#ifdef	INVARIANTS
+#ifdef INVARIANTS
 #define	VOP_ADD_WRITECOUNT_CHECKED(vp, cnt)				\
 do {									\
 	int error_;							\
 									\
 	error_ = VOP_ADD_WRITECOUNT((vp), (cnt));			\
-	MPASS(error_ == 0);						\
+	VNASSERT(error_ == 0, (vp), ("VOP_ADD_WRITECOUNT returned %d",	\
+	    error_));							\
 } while (0)
 #define	VOP_SET_TEXT_CHECKED(vp)					\
 do {									\
 	int error_;							\
 									\
 	error_ = VOP_SET_TEXT((vp));					\
-	MPASS(error_ == 0);						\
+	VNASSERT(error_ == 0, (vp), ("VOP_SET_TEXT returned %d",	\
+	    error_));							\
 } while (0)
 #define	VOP_UNSET_TEXT_CHECKED(vp)					\
 do {									\
 	int error_;							\
 									\
 	error_ = VOP_UNSET_TEXT((vp));					\
-	MPASS(error_ == 0);						\
+	VNASSERT(error_ == 0, (vp), ("VOP_UNSET_TEXT returned %d",	\
+	    error_));							\
 } while (0)
 #else
 #define	VOP_ADD_WRITECOUNT_CHECKED(vp, cnt)	VOP_ADD_WRITECOUNT((vp), (cnt))

From owner-svn-src-head@freebsd.org  Tue Jul 30 23:13:05 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44131AF8C2;
 Tue, 30 Jul 2019 23:13:05 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B1C0D8525C;
 Tue, 30 Jul 2019 23:13:04 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from tom.home (kib@localhost [127.0.0.1])
 by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x6UNCu9G026200
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO);
 Wed, 31 Jul 2019 02:12:59 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x6UNCu9G026200
Received: (from kostik@localhost)
 by tom.home (8.15.2/8.15.2/Submit) id x6UNCuBY026199;
 Wed, 31 Jul 2019 02:12:56 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Wed, 31 Jul 2019 02:12:56 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Bryan Drewery <bdrewery@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350005 - head/sys/kern
Message-ID: <20190730231256.GL2731@kib.kiev.ua>
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,
 NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 23:13:05 -0000

On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote:
> On 7/15/2019 12:18 PM, Konstantin Belousov wrote:
> > Author: kib
> > Date: Mon Jul 15 19:18:25 2019
> > New Revision: 350005
> > URL: https://svnweb.freebsd.org/changeset/base/350005
> > 
> > Log:
> >   In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on retry.
> >   
> 
> Is this also needed in do_sem_wait()? A similar pattern seems to be there.
No, I do not think do_sem_wait() has similar issue, because the again label
does not re-get the key.

> 
> I ask because of what I referenced on IRC. I have some processes stuck
> in here from a 10.4 jail.
> 
> > ~/git/poudriere # procstat -kk 1498
> >   PID    TID COMM                TDNAME              KSTACK
> >  1498 100710 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> >  1498 101575 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> >  1498 101657 python2.7           -                   <running>
> ...
> > ~/git/poudriere # procstat -kk 1498
> >   PID    TID COMM                TDNAME              KSTACK
> >  1498 100710 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> >  1498 101575 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> >  1498 101657 python2.7           -                   do_sem_wait+0x1b6 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> ...
> > ~/git/poudriere # procstat -kk 94392
> >   PID    TID COMM                TDNAME              KSTACK
> > 94392 101815 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > 94392 101816 python2.7           -                   __mtx_lock_sleep+0x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x161 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > 94392 102076 python2.7           -                   __mtx_lock_flags+0x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101

Try this.  We should only retry casueword if it failed spuriously.

diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index bb998457975..6c914ab6f3e 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout)
 	rv = casueword32(&sem->_has_waiters, 0, &count1, 1);
 	if (rv == 0)
 		rv1 = fueword32(&sem->_count, &count);
-	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) {
+	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) ||
+	    (rv == 1 && count1 == 0)) {
 		umtxq_lock(&uq->uq_key);
 		umtxq_unbusy(&uq->uq_key);
 		umtxq_remove(uq);

From owner-svn-src-head@freebsd.org  Tue Jul 30 23:27:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C41EDAFBFD;
 Tue, 30 Jul 2019 23:27:22 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 3B1708594E;
 Tue, 30 Jul 2019 23:27:22 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from tom.home (kib@localhost [127.0.0.1])
 by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x6UNREV8029683
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO);
 Wed, 31 Jul 2019 02:27:17 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x6UNREV8029683
Received: (from kostik@localhost)
 by tom.home (8.15.2/8.15.2/Submit) id x6UNREW3029682;
 Wed, 31 Jul 2019 02:27:14 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Wed, 31 Jul 2019 02:27:14 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Bryan Drewery <bdrewery@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350005 - head/sys/kern
Message-ID: <20190730232714.GM2731@kib.kiev.ua>
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20190730231256.GL2731@kib.kiev.ua>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,
 NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jul 2019 23:27:22 -0000

On Wed, Jul 31, 2019 at 02:13:02AM +0300, Konstantin Belousov wrote:
> On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote:
> > On 7/15/2019 12:18 PM, Konstantin Belousov wrote:
> > > Author: kib
> > > Date: Mon Jul 15 19:18:25 2019
> > > New Revision: 350005
> > > URL: https://svnweb.freebsd.org/changeset/base/350005
> > > 
> > > Log:
> > >   In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on retry.
> > >   
> > 
> > Is this also needed in do_sem_wait()? A similar pattern seems to be there.
> No, I do not think do_sem_wait() has similar issue, because the again label
> does not re-get the key.
> 
> > 
> > I ask because of what I referenced on IRC. I have some processes stuck
> > in here from a 10.4 jail.
> > 
> > > ~/git/poudriere # procstat -kk 1498
> > >   PID    TID COMM                TDNAME              KSTACK
> > >  1498 100710 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > >  1498 101575 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > >  1498 101657 python2.7           -                   <running>
> > ...
> > > ~/git/poudriere # procstat -kk 1498
> > >   PID    TID COMM                TDNAME              KSTACK
> > >  1498 100710 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > >  1498 101575 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > >  1498 101657 python2.7           -                   do_sem_wait+0x1b6 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > ...
> > > ~/git/poudriere # procstat -kk 94392
> > >   PID    TID COMM                TDNAME              KSTACK
> > > 94392 101815 python2.7           -                   mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > > 94392 101816 python2.7           -                   __mtx_lock_sleep+0x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x161 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> > > 94392 102076 python2.7           -                   __mtx_lock_flags+0x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> 
> Try this.  We should only retry casueword if it failed spuriously.
> 
> diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
> index bb998457975..6c914ab6f3e 100644
> --- a/sys/kern/kern_umtx.c
> +++ b/sys/kern/kern_umtx.c
> @@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout)
>  	rv = casueword32(&sem->_has_waiters, 0, &count1, 1);
>  	if (rv == 0)
>  		rv1 = fueword32(&sem->_count, &count);
> -	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) {
> +	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) ||
> +	    (rv == 1 && count1 == 0)) {
>  		umtxq_lock(&uq->uq_key);
>  		umtxq_unbusy(&uq->uq_key);
>  		umtxq_remove(uq);

I think there is another problem, since even despite our intent of looping
just because of casueword returned 1, the umtxq_check_susp() should have
terminated the loop.  I believe the following update would fix that.

If you have time, can you please apply only the umtxq_check_susp() chunk
and see if it helps as well ? [Both chunks are needed for correctness, but
the umtxq_check_susp() is almost impossible to test in combination]

diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index bb998457975..08bdd1a1a9a 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -723,13 +723,11 @@ umtxq_check_susp(struct thread *td, bool sleep)
 	error = 0;
 	p = td->td_proc;
 	PROC_LOCK(p);
-	if (P_SHOULDSTOP(p) ||
-	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) {
-		if (p->p_flag & P_SINGLE_EXIT)
-			error = EINTR;
-		else
-			error = sleep ? thread_suspend_check(0) : ERESTART;
-	}
+	if (p->p_flag & P_SINGLE_EXIT)
+		error = EINTR;
+	else if (P_SHOULDSTOP(p) ||
+	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND)))
+		error = sleep ? thread_suspend_check(0) : ERESTART;
 	PROC_UNLOCK(p);
 	return (error);
 }
@@ -3229,7 +3227,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout)
 	rv = casueword32(&sem->_has_waiters, 0, &count1, 1);
 	if (rv == 0)
 		rv1 = fueword32(&sem->_count, &count);
-	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) {
+	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) ||
+	    (rv == 1 && count1 == 0)) {
 		umtxq_lock(&uq->uq_key);
 		umtxq_unbusy(&uq->uq_key);
 		umtxq_remove(uq);

From owner-svn-src-head@freebsd.org  Wed Jul 31 02:19:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E79DB2B73;
 Wed, 31 Jul 2019 02:19:08 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
 [IPv6:2610:1c1:1:6074::16:84])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "freefall.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 634EB8A44B;
 Wed, 31 Jul 2019 02:19:08 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (unknown [127.0.1.132])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by freefall.freebsd.org (Postfix) with ESMTPS id 2B26043A;
 Wed, 31 Jul 2019 02:19:08 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (localhost [172.31.3.2])
 by mail.xzibition.com (Postfix) with ESMTP id 25B06128CF;
 Wed, 31 Jul 2019 02:19:07 +0000 (UTC)
X-Virus-Scanned: amavisd-new at mail.xzibition.com
Received: from mail.xzibition.com ([172.31.3.2])
 by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new,
 port 10026)
 with LMTP id dMY8iwK2Jd19; Wed, 31 Jul 2019 02:18:58 +0000 (UTC)
Subject: Re: svn commit: r350005 - head/sys/kern
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com CD597128C6
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
From: Bryan Drewery <bdrewery@FreeBSD.org>
Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF;
 url=https://zx.xk42.net/bryan.asc
Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ
 a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab
 D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+
 rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp
 VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB
 AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL
 CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu
 BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX
 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj
 IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd
 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4
 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm
 NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK
 BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8
 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C
 eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR
 lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u
 IUrMm6UAEQEAAYkBPAQYAQoAJgIbDBYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hL4BQkN
 PvONAAoJEDXXcbtuRpfPCjcH/ivBsOpdpebpgLizSNU5/X4yWN5Aixsc9VBnQhGKAKnMINJQ
 VMpA55sD2JSPwloXYM/B3qyPJRS/9cwIuX5LDNKKOZU3Qp+TzleynM15/xea14orWYRGRict
 YHBM3Cnqp7OD8K6Q1uhs0fTxyJP7PZ/G0+7Corlf1DlHhDt6C2HldRPFvAvAgl6sR9Wzgcb7
 rzub2HVtbJgl6YHbgyAG7x9NpXFqzx1JLAMdpt2DIYwoi+oMdRQlBIwNuKjQjCGzuXHandd3
 kGvBAsyJpQ+coEep9UzwANaV28cXrFr2R4FSOcR50rBA2Nh/vqUYfpsvBvJlwuKAoV1djVHa
 ihNeL5E=
Organization: FreeBSD
Message-ID: <47623274-f1be-7134-2f29-4941776df39f@FreeBSD.org>
Date: Tue, 30 Jul 2019 19:18:56 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <20190730232714.GM2731@kib.kiev.ua>
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature";
 boundary="8uyUCaTumRMJ4zEOnwjMI9AZI8qMzKRIp"
X-Rspamd-Queue-Id: 634EB8A44B
X-Spamd-Bar: ------
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-6.96 / 15.00];
 NEURAL_HAM_MEDIUM(-1.00)[-0.999,0];
 NEURAL_HAM_SHORT(-0.96)[-0.964,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 02:19:08 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--8uyUCaTumRMJ4zEOnwjMI9AZI8qMzKRIp
Content-Type: multipart/mixed; boundary="H026HVpn5qTcefLIsmZMlKeUwrSTao0fy";
 protected-headers="v1"
From: Bryan Drewery <bdrewery@FreeBSD.org>
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Message-ID: <47623274-f1be-7134-2f29-4941776df39f@FreeBSD.org>
Subject: Re: svn commit: r350005 - head/sys/kern
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
In-Reply-To: <20190730232714.GM2731@kib.kiev.ua>

--H026HVpn5qTcefLIsmZMlKeUwrSTao0fy
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 7/30/2019 4:27 PM, Konstantin Belousov wrote:
> On Wed, Jul 31, 2019 at 02:13:02AM +0300, Konstantin Belousov wrote:
>> On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote:
>>> On 7/15/2019 12:18 PM, Konstantin Belousov wrote:
>>>> Author: kib
>>>> Date: Mon Jul 15 19:18:25 2019
>>>> New Revision: 350005
>>>> URL: https://svnweb.freebsd.org/changeset/base/350005
>>>>
>>>> Log:
>>>>   In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() =
on retry.
>>>>  =20
>>>
>>> Is this also needed in do_sem_wait()? A similar pattern seems to be t=
here.
>> No, I do not think do_sem_wait() has similar issue, because the again =
label
>> does not re-get the key.
>>
>>>
>>> I ask because of what I referenced on IRC. I have some processes stuc=
k
>>> in here from a 10.4 jail.
>>>
>>>> ~/git/poudriere # procstat -kk 1498
>>>>   PID    TID COMM                TDNAME              KSTACK
>>>>  1498 100710 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101575 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101657 python2.7           -                   <running>
>>> ...
>>>> ~/git/poudriere # procstat -kk 1498
>>>>   PID    TID COMM                TDNAME              KSTACK
>>>>  1498 100710 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101575 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101657 python2.7           -                   do_sem_wait+0x1=
b6 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
>>> ...
>>>> ~/git/poudriere # procstat -kk 94392
>>>>   PID    TID COMM                TDNAME              KSTACK
>>>> 94392 101815 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>> 94392 101816 python2.7           -                   __mtx_lock_slee=
p+0x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0=
x161 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x10=
1
>>>> 94392 102076 python2.7           -                   __mtx_lock_flag=
s+0x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast=
_syscall_common+0x101
>>
>> Try this.  We should only retry casueword if it failed spuriously.
>>
>> diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
>> index bb998457975..6c914ab6f3e 100644
>> --- a/sys/kern/kern_umtx.c
>> +++ b/sys/kern/kern_umtx.c
>> @@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem=
, struct _umtx_time *timeout)
>>  	rv =3D casueword32(&sem->_has_waiters, 0, &count1, 1);
>>  	if (rv =3D=3D 0)
>>  		rv1 =3D fueword32(&sem->_count, &count);
>> -	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0))=
 || rv =3D=3D 1) {
>> +	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0))=
 ||
>> +	    (rv =3D=3D 1 && count1 =3D=3D 0)) {
>>  		umtxq_lock(&uq->uq_key);
>>  		umtxq_unbusy(&uq->uq_key);
>>  		umtxq_remove(uq);
>=20
> I think there is another problem, since even despite our intent of loop=
ing
> just because of casueword returned 1, the umtxq_check_susp() should hav=
e
> terminated the loop.  I believe the following update would fix that.
>=20
> If you have time, can you please apply only the umtxq_check_susp() chun=
k
> and see if it helps as well ? [Both chunks are needed for correctness, =
but
> the umtxq_check_susp() is almost impossible to test in combination]

What is the expected "working" test for the umtxq_check_susp() change? I
get the 100% CPU and kill -9 does not kill it.

> ~ # procstat -kk 19150
>   PID    TID COMM                TDNAME              KSTACK
> 19150 101524 python2.7           -                   do_sem_wait+0x150 =
__umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
> 19150 101553 python2.7           -                   mi_switch+0x174 sl=
eepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0=
x2d0 umtxq_sleep+0x153 do_sem_wait+0x41c __umtx_op_sem_wait+0x6e amd64_sy=
scall+0x2bb fast_syscall_common+0x101
> 19150 101554 python2.7           -                   __mtx_lock_sleep+0=
x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x15=
0 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101


>=20
> diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
> index bb998457975..08bdd1a1a9a 100644
> --- a/sys/kern/kern_umtx.c
> +++ b/sys/kern/kern_umtx.c
> @@ -723,13 +723,11 @@ umtxq_check_susp(struct thread *td, bool sleep)
>  	error =3D 0;
>  	p =3D td->td_proc;
>  	PROC_LOCK(p);
> -	if (P_SHOULDSTOP(p) ||
> -	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) {
> -		if (p->p_flag & P_SINGLE_EXIT)
> -			error =3D EINTR;
> -		else
> -			error =3D sleep ? thread_suspend_check(0) : ERESTART;
> -	}
> +	if (p->p_flag & P_SINGLE_EXIT)
> +		error =3D EINTR;
> +	else if (P_SHOULDSTOP(p) ||
> +	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND)))
> +		error =3D sleep ? thread_suspend_check(0) : ERESTART;
>  	PROC_UNLOCK(p);
>  	return (error);
>  }
> @@ -3229,7 +3227,8 @@ do_sem_wait(struct thread *td, struct _usem *sem,=
 struct _umtx_time *timeout)
>  	rv =3D casueword32(&sem->_has_waiters, 0, &count1, 1);
>  	if (rv =3D=3D 0)
>  		rv1 =3D fueword32(&sem->_count, &count);
> -	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0)) =
|| rv =3D=3D 1) {
> +	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0)) =
||
> +	    (rv =3D=3D 1 && count1 =3D=3D 0)) {
>  		umtxq_lock(&uq->uq_key);
>  		umtxq_unbusy(&uq->uq_key);
>  		umtxq_remove(uq);
>=20


--=20
Regards,
Bryan Drewery


--H026HVpn5qTcefLIsmZMlKeUwrSTao0fy--

--8uyUCaTumRMJ4zEOnwjMI9AZI8qMzKRIp
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl1A+pFfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY5
MTczQ0IyQzNBQUVBN0E1QzhBMUYwOTM1RDc3MUJCNkU0Njk3Q0YACgkQNddxu25G
l89ouwgAj8TT0zduz0lz1I388JEkfuITnm0qhBwXdNQGAixRzLCLn61GJtFgXnDC
j/7MBqC23he6mS+hx1XnzCV+6fLfQlG4Tyr1Ae3ywfTYF5aB4t4xZzXi0bHlMmeQ
aaVU0cY5Q7MmIe65JPQY8uZw+Jg2b8kYxMYTGZwtRYFcbyo5Ql7mxZIPTt+dkPVp
d5+bmMf0HYoqcF9f4rrFLfLoD5FeN9vw2/87st+rf3A2JZu2bOMJRa8SvChh/ydC
NjaO1RLoHQ01/fJDO6kZaUiMNDGC/ZiaZ66ilI3lJwyUYhoquth3XyXzRJtiF0Hw
bCzc35dBAJYiNnllMzYRXZPfOMzqHA==
=btpK
-----END PGP SIGNATURE-----

--8uyUCaTumRMJ4zEOnwjMI9AZI8qMzKRIp--

From owner-svn-src-head@freebsd.org  Wed Jul 31 03:40:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E948EB4185;
 Wed, 31 Jul 2019 03:40:35 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "freefall.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id AB51C8C3FC;
 Wed, 31 Jul 2019 03:40:35 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (unknown [127.0.1.132])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by freefall.freebsd.org (Postfix) with ESMTPS id 54BFBF70;
 Wed, 31 Jul 2019 03:40:35 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (localhost [172.31.3.2])
 by mail.xzibition.com (Postfix) with ESMTP id 60F871296C;
 Wed, 31 Jul 2019 03:40:34 +0000 (UTC)
X-Virus-Scanned: amavisd-new at mail.xzibition.com
Received: from mail.xzibition.com ([172.31.3.2])
 by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new,
 port 10026)
 with LMTP id 5mhQ1lvOEaZl; Wed, 31 Jul 2019 03:40:30 +0000 (UTC)
Subject: Re: svn commit: r350005 - head/sys/kern
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 4511512964
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
From: Bryan Drewery <bdrewery@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ
 a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab
 D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+
 rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp
 VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB
 AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL
 CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu
 BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX
 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj
 IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd
 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4
 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm
 NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK
 BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8
 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C
 eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR
 lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u
 IUrMm6UAEQEAAYkBJQQYAQoADwUCUmmGawIbDAUJCWYBgAAKCRA113G7bkaXz1Q+CADaYZCn
 bzIJQqwnoocVXL+Wkd+hCsoX6zsd8pNTY5tV5U1fgjxl1bVQ7jyZGrEQ7BjyvlhIfpfTo6aK
 oJfZpIxeDc3Tr+X7O2UHT5QYaWRcGO+X3+eKL5sLpvxda67RftClv2hgEr1i2hqjK5WmUCaN
 2P9w+i7rmZ4ohpLXINOMeHjnQOtbxCCF7qXRsVfgEcpNKb31T3QwvsRjX0HqIjYFlKpa61Wz
 IPvWgBERjo0aAOkI4g7oVLjX5Z5gINGPy+xr8GJqhfZ3ZIEOwLCwTB71+Dk9gyLa5UiG8vo6
 vGfA50H5OSC87LnNlI07b1Qb8mKVkqg13PbCkRpTMKEYaou9iQElBBgBCgAPAhsMBQJa6M4o
 BQkKYHs9AAoJEDXXcbtuRpfPpuQH/0d1RHcTTAHAyHrPQA4UMqH49tEj1d3gidx2ETnm00rj
 XTrnRreAAMgPCrPeLvYYiKeSBrHOkQ7E/Vuztr4F4Xenld3omOTon+cSyGKyA1btWNRskcUa
 zxJ/0DqgzerhWQj8CtWjmqRnGAqzvZQdIDLk1X4B2p1Ota4AvbTF9DqADskXfld/zPJQzYYy
 XRfyKTt0nWMyn5MHbsuKmpsOBqYXMf0X2EL2C6v3g5D/HedD6YVnW6KlgcDUR2sq6Fv9Ozhs
 38TOXyeZgbFz0HDtkHEY5Mh3+sQjOh4takC+Dp1zDRP2U19JZzo9f6R/d05c0h2TD02oogPz
 AQ97xrFwZgaJATwEGAEKACYCGwwWIQT5Fzyyw6rqelyKHwk113G7bkaXzwUCW+YS+AUJDT7z
 jQAKCRA113G7bkaXzwo3B/4rwbDqXaXm6YC4s0jVOf1+MljeQIsbHPVQZ0IRigCpzCDSUFTK
 QOebA9iUj8JaF2DPwd6sjyUUv/XMCLl+SwzSijmVN0Kfk85XspzNef8XmteKK1mERkYnLWBw
 TNwp6qezg/CukNbobNH08ciT+z2fxtPuwqK5X9Q5R4Q7egth5XUTxbwLwIJerEfVs4HG+687
 m9h1bWyYJemB24MgBu8fTaVxas8dSSwDHabdgyGMKIvqDHUUJQSMDbio0Iwhs7lx2p3Xd5Br
 wQLMiaUPnKBHqfVM8ADWldvHF6xa9keBUjnEedKwQNjYf76lGH6bLwbyZcLigKFdXY1R2ooT Xi+R
Organization: FreeBSD
Message-ID: <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
Date: Tue, 30 Jul 2019 20:40:28 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0)
 Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <20190730232714.GM2731@kib.kiev.ua>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="hwljxk2k8uM2tHhElvSoAgtwMvoOhwLgC"
X-Rspamd-Queue-Id: AB51C8C3FC
X-Spamd-Bar: ------
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-6.95 / 15.00];
 NEURAL_HAM_MEDIUM(-1.00)[-0.999,0];
 NEURAL_HAM_SHORT(-0.95)[-0.951,0]; REPLY(-4.00)[];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 03:40:36 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--hwljxk2k8uM2tHhElvSoAgtwMvoOhwLgC
Content-Type: multipart/mixed; boundary="p9Fqr5lLFAnCGEL5t8G4mRlXehaxggNpR";
 protected-headers="v1"
From: Bryan Drewery <bdrewery@FreeBSD.org>
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Message-ID: <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
Subject: Re: svn commit: r350005 - head/sys/kern
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
In-Reply-To: <20190730232714.GM2731@kib.kiev.ua>

--p9Fqr5lLFAnCGEL5t8G4mRlXehaxggNpR
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 7/30/19 4:27 PM, Konstantin Belousov wrote:
> On Wed, Jul 31, 2019 at 02:13:02AM +0300, Konstantin Belousov wrote:
>> On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote:
>>> On 7/15/2019 12:18 PM, Konstantin Belousov wrote:
>>>> Author: kib
>>>> Date: Mon Jul 15 19:18:25 2019
>>>> New Revision: 350005
>>>> URL: https://svnweb.freebsd.org/changeset/base/350005
>>>>
>>>> Log:
>>>>   In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() =
on retry.
>>>>  =20
>>>
>>> Is this also needed in do_sem_wait()? A similar pattern seems to be t=
here.
>> No, I do not think do_sem_wait() has similar issue, because the again =
label
>> does not re-get the key.
>>
>>>
>>> I ask because of what I referenced on IRC. I have some processes stuc=
k
>>> in here from a 10.4 jail.
>>>
>>>> ~/git/poudriere # procstat -kk 1498
>>>>   PID    TID COMM                TDNAME              KSTACK
>>>>  1498 100710 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101575 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101657 python2.7           -                   <running>
>>> ...
>>>> ~/git/poudriere # procstat -kk 1498
>>>>   PID    TID COMM                TDNAME              KSTACK
>>>>  1498 100710 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101575 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>>  1498 101657 python2.7           -                   do_sem_wait+0x1=
b6 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101
>>> ...
>>>> ~/git/poudriere # procstat -kk 94392
>>>>   PID    TID COMM                TDNAME              KSTACK
>>>> 94392 101815 python2.7           -                   mi_switch+0x174=
 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _slee=
p+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64=
_syscall+0x2bb fast_syscall_common+0x101
>>>> 94392 101816 python2.7           -                   __mtx_lock_slee=
p+0x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0=
x161 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x10=
1
>>>> 94392 102076 python2.7           -                   __mtx_lock_flag=
s+0x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast=
_syscall_common+0x101
>>
>> Try this.  We should only retry casueword if it failed spuriously.
>>
>> diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
>> index bb998457975..6c914ab6f3e 100644
>> --- a/sys/kern/kern_umtx.c
>> +++ b/sys/kern/kern_umtx.c
>> @@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem=
, struct _umtx_time *timeout)
>>  	rv =3D casueword32(&sem->_has_waiters, 0, &count1, 1);
>>  	if (rv =3D=3D 0)
>>  		rv1 =3D fueword32(&sem->_count, &count);
>> -	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0))=
 || rv =3D=3D 1) {
>> +	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0))=
 ||
>> +	    (rv =3D=3D 1 && count1 =3D=3D 0)) {
>>  		umtxq_lock(&uq->uq_key);
>>  		umtxq_unbusy(&uq->uq_key);
>>  		umtxq_remove(uq);
>=20
> I think there is another problem, since even despite our intent of loop=
ing
> just because of casueword returned 1, the umtxq_check_susp() should hav=
e
> terminated the loop.  I believe the following update would fix that.
>=20
> If you have time, can you please apply only the umtxq_check_susp() chun=
k
> and see if it helps as well ? [Both chunks are needed for correctness, =
but
> the umtxq_check_susp() is almost impossible to test in combination]
>=20
> diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
> index bb998457975..08bdd1a1a9a 100644
> --- a/sys/kern/kern_umtx.c
> +++ b/sys/kern/kern_umtx.c
> @@ -723,13 +723,11 @@ umtxq_check_susp(struct thread *td, bool sleep)
>  	error =3D 0;
>  	p =3D td->td_proc;
>  	PROC_LOCK(p);
> -	if (P_SHOULDSTOP(p) ||
> -	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) {
> -		if (p->p_flag & P_SINGLE_EXIT)
> -			error =3D EINTR;
> -		else
> -			error =3D sleep ? thread_suspend_check(0) : ERESTART;
> -	}
> +	if (p->p_flag & P_SINGLE_EXIT)
> +		error =3D EINTR;
> +	else if (P_SHOULDSTOP(p) ||
> +	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND)))
> +		error =3D sleep ? thread_suspend_check(0) : ERESTART;
>  	PROC_UNLOCK(p);
>  	return (error);
>  }
> @@ -3229,7 +3227,8 @@ do_sem_wait(struct thread *td, struct _usem *sem,=
 struct _umtx_time *timeout)
>  	rv =3D casueword32(&sem->_has_waiters, 0, &count1, 1);
>  	if (rv =3D=3D 0)
>  		rv1 =3D fueword32(&sem->_count, &count);
> -	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0)) =
|| rv =3D=3D 1) {
> +	if (rv =3D=3D -1 || (rv =3D=3D 0 && (rv1 =3D=3D -1 || count !=3D 0)) =
||
> +	    (rv =3D=3D 1 && count1 =3D=3D 0)) {
>  		umtxq_lock(&uq->uq_key);
>  		umtxq_unbusy(&uq->uq_key);
>  		umtxq_remove(uq);
>=20

This 2nd change alone (&& count1 =3D=3D 0) was sufficient to fix the endl=
ess
loop problem.

I am not sure how to test the umtxq_check_susp() change. Do I just need
to ptrace the process?


--=20
Regards,
Bryan Drewery


--p9Fqr5lLFAnCGEL5t8G4mRlXehaxggNpR--

--hwljxk2k8uM2tHhElvSoAgtwMvoOhwLgC
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl1BDa0ACgkQNddxu25G
l88UyAgAogITg3i08Cm7qOU4PKiomYEzSFl4ErRIe96narAXCBgPEA4V2/M9uiQv
5vVC37MB+BuBw8dbGASgnbaTEcL8GRxbt+t98fIoaTMC4BtqR6+gWPlKVn+T2YTa
wkeLcfXI4yqW2haD4J5WFFfhUDgqeT79H1arufggpHnUM/tE8LjPujIQrSFAA3A5
ZFCyvFa7FxgFCNn1R3UDgbQ3dLnqPBn6mISfJyneYuo8IS5tZhMZI+0XuEz0lAnC
/h4c4/Q11xyOqm6hZX07YcfzKVIyGBHTDrpKeykBIqLSMXqOfx0wNDR72ZhLIDny
0RMIja7p0YpULDsLhR5eFSuAyNLGVg==
=hLC5
-----END PGP SIGNATURE-----

--hwljxk2k8uM2tHhElvSoAgtwMvoOhwLgC--

From owner-svn-src-head@freebsd.org  Wed Jul 31 03:48:48 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB638B439C;
 Wed, 31 Jul 2019 03:48:48 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 84E008C7C9;
 Wed, 31 Jul 2019 03:48: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 732D123783;
 Wed, 31 Jul 2019 03:48:48 +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 x6V3mmIM001775;
 Wed, 31 Jul 2019 03:48:48 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6V3mmdS001774;
 Wed, 31 Jul 2019 03:48:48 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907310348.x6V3mmdS001774@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Wed, 31 Jul 2019 03:48:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350461 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350461
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 84E008C7C9
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.94 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.948,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 03:48:48 -0000

Author: mav
Date: Wed Jul 31 03:48:48 2019
New Revision: 350461
URL: https://svnweb.freebsd.org/changeset/base/350461

Log:
  Fix usage printing for nested subcommands.
  
  Instead of `nvmecontrol create` should be `nvmecontrol ns create`, etc.
  
  MFC after:	2 weeks

Modified:
  head/sbin/nvmecontrol/comnd.c

Modified: head/sbin/nvmecontrol/comnd.c
==============================================================================
--- head/sbin/nvmecontrol/comnd.c	Wed Jul 31 00:16:12 2019	(r350460)
+++ head/sbin/nvmecontrol/comnd.c	Wed Jul 31 03:48:48 2019	(r350461)
@@ -50,10 +50,22 @@ __FBSDID("$FreeBSD$");
 static struct cmd top;
 
 static void
+print_tree(const struct cmd *f)
+{
+
+	if (f->parent != NULL)
+		print_tree(f->parent);
+	if (f->name != NULL)
+		fprintf(stderr, " %s", f->name);
+}
+
+static void
 print_usage(const struct cmd *f)
 {
 
-	fprintf(stderr, "    %s %-15s - %s\n", getprogname(), f->name, f->descr);
+	fprintf(stderr, "    %s", getprogname());
+	print_tree(f->parent);
+	fprintf(stderr, " %-15s - %s\n", f->name, f->descr);
 }
 
 static void
@@ -120,7 +132,8 @@ arg_help(int argc __unused, char * const *argv, const 
 	// XXX walk up the cmd list...
 	if (argv[optind])
 		fprintf(stderr, "Unknown argument: %s\n", argv[optind]);
-	fprintf(stderr, "Usage:\n    %s %s", getprogname(), argv[0]);
+	fprintf(stderr, "Usage:\n    %s", getprogname());
+	print_tree(f);
 	if (opts)
 		fprintf(stderr, " <args>");
 	if (args) {

From owner-svn-src-head@freebsd.org  Wed Jul 31 04:19:54 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D47A8B4B70;
 Wed, 31 Jul 2019 04:19:54 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id B5AE68D240;
 Wed, 31 Jul 2019 04:19: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A52423CC9;
 Wed, 31 Jul 2019 04:19: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 x6V4JsHT019211;
 Wed, 31 Jul 2019 04:19:54 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6V4JrPE019207;
 Wed, 31 Jul 2019 04:19:53 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907310419.x6V4JrPE019207@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Wed, 31 Jul 2019 04:19:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350462 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350462
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: B5AE68D240
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.94 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.996,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.95)[-0.948,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 04:19:54 -0000

Author: mav
Date: Wed Jul 31 04:19:53 2019
New Revision: 350462
URL: https://svnweb.freebsd.org/changeset/base/350462

Log:
  Tune some commands desctiption.
  
  MFC after:	2 weeks

Modified:
  head/sbin/nvmecontrol/devlist.c
  head/sbin/nvmecontrol/firmware.c
  head/sbin/nvmecontrol/format.c
  head/sbin/nvmecontrol/perftest.c
  head/sbin/nvmecontrol/reset.c

Modified: head/sbin/nvmecontrol/devlist.c
==============================================================================
--- head/sbin/nvmecontrol/devlist.c	Wed Jul 31 03:48:48 2019	(r350461)
+++ head/sbin/nvmecontrol/devlist.c	Wed Jul 31 04:19:53 2019	(r350462)
@@ -53,7 +53,7 @@ static cmd_fn_t devlist;
 static struct cmd devlist_cmd = {
 	.name = "devlist",
 	.fn = devlist,
-	.descr = "Display a list of NVMe controllers and namespaces."
+	.descr = "List NVMe controllers and namespaces"
 };
 
 CMD_COMMAND(devlist_cmd);

Modified: head/sbin/nvmecontrol/firmware.c
==============================================================================
--- head/sbin/nvmecontrol/firmware.c	Wed Jul 31 03:48:48 2019	(r350461)
+++ head/sbin/nvmecontrol/firmware.c	Wed Jul 31 04:19:53 2019	(r350462)
@@ -87,7 +87,7 @@ static const struct args firmware_args[] = {
 static struct cmd firmware_cmd = {
 	.name = "firmware",
 	.fn = firmware,
-	.descr = "Download firmware image to controller.",
+	.descr = "Download firmware image to controller",
 	.ctx_size = sizeof(opt),
 	.opts = firmware_opts,
 	.args = firmware_args,

Modified: head/sbin/nvmecontrol/format.c
==============================================================================
--- head/sbin/nvmecontrol/format.c	Wed Jul 31 03:48:48 2019	(r350461)
+++ head/sbin/nvmecontrol/format.c	Wed Jul 31 04:19:53 2019	(r350462)
@@ -76,19 +76,19 @@ static struct options {
 static const struct opts format_opts[] = {
 #define OPT(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc }
 	OPT("crypto", 'C', arg_none, opt, Cflag,
-	    "Crptographically erase user data by forgetting key"),
+	    "Crptographic erase"),
 	OPT("erase", 'E', arg_none, opt, Eflag,
-	    "Erase user data"),
+	    "User data erase"),
 	OPT("lbaf", 'f', arg_uint32, opt, lbaf,
-	    "Set the LBA Format to apply to the media"),
+	    "LBA Format to apply to the media"),
 	OPT("ms", 'm', arg_uint32, opt, ms,
-	    "Slot to activate and/or download format to"),
+	    "Metadata settings"),
 	OPT("pi", 'p', arg_uint32, opt, pi,
-	    "Slot to activate and/or download format to"),
+	    "Protective information"),
 	OPT("pil", 'l', arg_uint32, opt, pil,
-	    "Slot to activate and/or download format to"),
+	    "Protective information location"),
 	OPT("ses", 's', arg_uint32, opt, ses,
-	    "Slot to activate and/or download format to"),
+	    "Secure erase settings"),
 	{ NULL, 0, arg_none, NULL, NULL }
 };
 #undef OPT
@@ -101,7 +101,7 @@ static const struct args format_args[] = {
 static struct cmd format_cmd = {
 	.name = "format",
 	.fn = format,
-	.descr = "Format/erase one or all the namespaces.",
+	.descr = "Format/erase one or all the namespaces",
 	.ctx_size = sizeof(opt),
 	.opts = format_opts,
 	.args = format_args,

Modified: head/sbin/nvmecontrol/perftest.c
==============================================================================
--- head/sbin/nvmecontrol/perftest.c	Wed Jul 31 03:48:48 2019	(r350461)
+++ head/sbin/nvmecontrol/perftest.c	Wed Jul 31 04:19:53 2019	(r350462)
@@ -99,7 +99,7 @@ static const struct args perftest_args[] = {
 static struct cmd perftest_cmd = {
 	.name = "perftest",
 	.fn = perftest,
-	.descr = "Perform low-level driver performance testing.",
+	.descr = "Perform low-level performance testing",
 	.ctx_size = sizeof(opt),
 	.opts = perftest_opts,
 	.args = perftest_args,

Modified: head/sbin/nvmecontrol/reset.c
==============================================================================
--- head/sbin/nvmecontrol/reset.c	Wed Jul 31 03:48:48 2019	(r350461)
+++ head/sbin/nvmecontrol/reset.c	Wed Jul 31 04:19:53 2019	(r350462)
@@ -69,7 +69,7 @@ reset(const struct cmd *f, int argc, char *argv[])
 static struct cmd reset_cmd = {
 	.name = "reset",
 	.fn = reset,
-	.descr = "Perform a controller-level reset.",
+	.descr = "Perform a controller-level reset",
 	.args = args,
 };
 

From owner-svn-src-head@freebsd.org  Wed Jul 31 05:15:01 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23ABBB5686;
 Wed, 31 Jul 2019 05:15:01 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B4BA88E48C;
 Wed, 31 Jul 2019 05:15:00 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from tom.home (kib@localhost [127.0.0.1])
 by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x6V5EqVX010046
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO);
 Wed, 31 Jul 2019 08:14:55 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x6V5EqVX010046
Received: (from kostik@localhost)
 by tom.home (8.15.2/8.15.2/Submit) id x6V5EqU4010045;
 Wed, 31 Jul 2019 08:14:52 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Wed, 31 Jul 2019 08:14:52 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Bryan Drewery <bdrewery@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350005 - head/sys/kern
Message-ID: <20190731051452.GN2731@kib.kiev.ua>
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua>
 <20190730232714.GM2731@kib.kiev.ua>
 <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,
 NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 05:15:01 -0000

On Tue, Jul 30, 2019 at 08:40:28PM -0700, Bryan Drewery wrote:
> This 2nd change alone (&& count1 == 0) was sufficient to fix the endless
> loop problem.
Good, thank you.

> 
> I am not sure how to test the umtxq_check_susp() change. Do I just need
> to ptrace the process?

No, you should create a situation where the python process ends the endless
loop, as reported.  Then, it should become killable by 9 with the first
chunk only applied.

From owner-svn-src-head@freebsd.org  Wed Jul 31 05:38:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E58BBB5CC8;
 Wed, 31 Jul 2019 05:38:40 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id C4EFF8EE04;
 Wed, 31 Jul 2019 05:38:40 +0000 (UTC) (envelope-from alc@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DEEB24B0C;
 Wed, 31 Jul 2019 05:38:40 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6V5cevx066069;
 Wed, 31 Jul 2019 05:38:40 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6V5ce3E066066;
 Wed, 31 Jul 2019 05:38:40 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201907310538.x6V5ce3E066066@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox <alc@FreeBSD.org>
Date: Wed, 31 Jul 2019 05:38:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350463 - in head/sys: amd64/amd64 arm64/arm64 i386/i386
X-SVN-Group: head
X-SVN-Commit-Author: alc
X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm64/arm64 i386/i386
X-SVN-Commit-Revision: 350463
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: C4EFF8EE04
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.97 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.997,0];
 NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.97)[-0.971,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 05:38:41 -0000

Author: alc
Date: Wed Jul 31 05:38:39 2019
New Revision: 350463
URL: https://svnweb.freebsd.org/changeset/base/350463

Log:
  In pmap_advise(), when we encounter a superpage mapping, we first demote the
  mapping and then destroy one of the 4 KB page mappings so that there is a
  potential trigger for repromotion.  Currently, we destroy the first 4 KB
  page mapping that falls within the (current) superpage mapping or the
  virtual address range [sva, eva).  However, I have found empirically that
  destroying the last 4 KB mapping produces slightly better results,
  specifically, more promotions and fewer failed promotion attempts.
  Accordingly, this revision changes pmap_advise() to destroy the last 4 KB
  page mapping.  It also replaces some nearby uses of boolean_t with bool.
  
  Reviewed by:	kib, markj
  Differential Revision:	https://reviews.freebsd.org/D21115

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm64/arm64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Wed Jul 31 04:19:53 2019	(r350462)
+++ head/sys/amd64/amd64/pmap.c	Wed Jul 31 05:38:39 2019	(r350463)
@@ -7444,7 +7444,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 	pt_entry_t *pte, PG_A, PG_G, PG_M, PG_RW, PG_V;
 	vm_offset_t va, va_next;
 	vm_page_t m;
-	boolean_t anychanged;
+	bool anychanged;
 
 	if (advice != MADV_DONTNEED && advice != MADV_FREE)
 		return;
@@ -7463,7 +7463,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 	PG_M = pmap_modified_bit(pmap);
 	PG_V = pmap_valid_bit(pmap);
 	PG_RW = pmap_rw_bit(pmap);
-	anychanged = FALSE;
+	anychanged = false;
 	pmap_delayed_invl_start();
 	PMAP_LOCK(pmap);
 	for (; sva < eva; sva = va_next) {
@@ -7505,17 +7505,25 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 			/*
 			 * Unless the page mappings are wired, remove the
 			 * mapping to a single page so that a subsequent
-			 * access may repromote.  Since the underlying page
-			 * table page is fully populated, this removal never
-			 * frees a page table page.
+			 * access may repromote.  Choosing the last page
+			 * within the address range [sva, min(va_next, eva))
+			 * generally results in more repromotions.  Since the
+			 * underlying page table page is fully populated, this
+			 * removal never frees a page table page.
 			 */
 			if ((oldpde & PG_W) == 0) {
-				pte = pmap_pde_to_pte(pde, sva);
+				va = eva;
+				if (va > va_next)
+					va = va_next;
+				va -= PAGE_SIZE;
+				KASSERT(va >= sva,
+				    ("pmap_advise: no address gap"));
+				pte = pmap_pde_to_pte(pde, va);
 				KASSERT((*pte & PG_V) != 0,
 				    ("pmap_advise: invalid PTE"));
-				pmap_remove_pte(pmap, pte, sva, *pde, NULL,
+				pmap_remove_pte(pmap, pte, va, *pde, NULL,
 				    &lock);
-				anychanged = TRUE;
+				anychanged = true;
 			}
 			if (lock != NULL)
 				rw_wunlock(lock);
@@ -7547,7 +7555,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 				if (va == va_next)
 					va = sva;
 			} else
-				anychanged = TRUE;
+				anychanged = true;
 			continue;
 maybe_invlrng:
 			if (va != va_next) {

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Wed Jul 31 04:19:53 2019	(r350462)
+++ head/sys/arm64/arm64/pmap.c	Wed Jul 31 05:38:39 2019	(r350463)
@@ -4888,15 +4888,23 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 			/*
 			 * Unless the page mappings are wired, remove the
 			 * mapping to a single page so that a subsequent
-			 * access may repromote.  Since the underlying page
-			 * table page is fully populated, this removal never
-			 * frees a page table page.
+			 * access may repromote.  Choosing the last page
+			 * within the address range [sva, min(va_next, eva))
+			 * generally results in more repromotions.  Since the
+			 * underlying page table page is fully populated, this
+			 * removal never frees a page table page.
 			 */
 			if ((oldl2 & ATTR_SW_WIRED) == 0) {
-				l3 = pmap_l2_to_l3(l2, sva);
+				va = eva;
+				if (va > va_next)
+					va = va_next;
+				va -= PAGE_SIZE;
+				KASSERT(va >= sva,
+				    ("pmap_advise: no address gap"));
+				l3 = pmap_l2_to_l3(l2, va);
 				KASSERT(pmap_load(l3) != 0,
 				    ("pmap_advise: invalid PTE"));
-				pmap_remove_l3(pmap, l3, sva, pmap_load(l2),
+				pmap_remove_l3(pmap, l3, va, pmap_load(l2),
 				    NULL, &lock);
 			}
 			if (lock != NULL)

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Wed Jul 31 04:19:53 2019	(r350462)
+++ head/sys/i386/i386/pmap.c	Wed Jul 31 05:38:39 2019	(r350463)
@@ -5167,19 +5167,19 @@ __CONCAT(PMTYPE, advise)(pmap_t pmap, vm_offset_t sva,
 	pt_entry_t *pte;
 	vm_offset_t va, pdnxt;
 	vm_page_t m;
-	boolean_t anychanged, pv_lists_locked;
+	bool anychanged, pv_lists_locked;
 
 	if (advice != MADV_DONTNEED && advice != MADV_FREE)
 		return;
 	if (pmap_is_current(pmap))
-		pv_lists_locked = FALSE;
+		pv_lists_locked = false;
 	else {
-		pv_lists_locked = TRUE;
+		pv_lists_locked = true;
 resume:
 		rw_wlock(&pvh_global_lock);
 		sched_pin();
 	}
-	anychanged = FALSE;
+	anychanged = false;
 	PMAP_LOCK(pmap);
 	for (; sva < eva; sva = pdnxt) {
 		pdnxt = (sva + NBPDR) & ~PDRMASK;
@@ -5193,7 +5193,7 @@ resume:
 			if ((oldpde & PG_MANAGED) == 0)
 				continue;
 			if (!pv_lists_locked) {
-				pv_lists_locked = TRUE;
+				pv_lists_locked = true;
 				if (!rw_try_wlock(&pvh_global_lock)) {
 					if (anychanged)
 						pmap_invalidate_all_int(pmap);
@@ -5212,16 +5212,24 @@ resume:
 			/*
 			 * Unless the page mappings are wired, remove the
 			 * mapping to a single page so that a subsequent
-			 * access may repromote.  Since the underlying page
-			 * table page is fully populated, this removal never
-			 * frees a page table page.
+			 * access may repromote.  Choosing the last page
+			 * within the address range [sva, min(pdnxt, eva))
+			 * generally results in more repromotions.  Since the
+			 * underlying page table page is fully populated, this
+			 * removal never frees a page table page.
 			 */
 			if ((oldpde & PG_W) == 0) {
-				pte = pmap_pte_quick(pmap, sva);
+				va = eva;
+				if (va > pdnxt)
+					va = pdnxt;
+				va -= PAGE_SIZE;
+				KASSERT(va >= sva,
+				    ("pmap_advise: no address gap"));
+				pte = pmap_pte_quick(pmap, va);
 				KASSERT((*pte & PG_V) != 0,
 				    ("pmap_advise: invalid PTE"));
-				pmap_remove_pte(pmap, pte, sva, NULL);
-				anychanged = TRUE;
+				pmap_remove_pte(pmap, pte, va, NULL);
+				anychanged = true;
 			}
 		}
 		if (pdnxt > eva)
@@ -5250,7 +5258,7 @@ resume:
 				if (va == pdnxt)
 					va = sva;
 			} else
-				anychanged = TRUE;
+				anychanged = true;
 			continue;
 maybe_invlrng:
 			if (va != pdnxt) {

From owner-svn-src-head@freebsd.org  Wed Jul 31 15:16:52 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30F96A163B;
 Wed, 31 Jul 2019 15:16:52 +0000 (UTC)
 (envelope-from kevans@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zH8N0ZLbz3x11;
 Wed, 31 Jul 2019 15:16:52 +0000 (UTC)
 (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF7033796;
 Wed, 31 Jul 2019 15:16:51 +0000 (UTC)
 (envelope-from kevans@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VFGpjf006505;
 Wed, 31 Jul 2019 15:16:51 GMT (envelope-from kevans@FreeBSD.org)
Received: (from kevans@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VFGpkb006503;
 Wed, 31 Jul 2019 15:16:51 GMT (envelope-from kevans@FreeBSD.org)
Message-Id: <201907311516.x6VFGpkb006503@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kevans set sender to
 kevans@FreeBSD.org using -f
From: Kyle Evans <kevans@FreeBSD.org>
Date: Wed, 31 Jul 2019 15:16:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350464 - in head/sys: compat/cloudabi kern
X-SVN-Group: head
X-SVN-Commit-Author: kevans
X-SVN-Commit-Paths: in head/sys: compat/cloudabi kern
X-SVN-Commit-Revision: 350464
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zH8N0ZLbz3x11
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.56 / 15.00];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.56)[0.563,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 15:16:52 -0000

Author: kevans
Date: Wed Jul 31 15:16:51 2019
New Revision: 350464
URL: https://svnweb.freebsd.org/changeset/base/350464

Log:
  kern_shm_open: push O_CLOEXEC into caller control
  
  The motivation for this change is to allow wrappers around shm to be written
  that don't set CLOEXEC. kern_shm_open currently accepts O_CLOEXEC but sets
  it unconditionally. kern_shm_open is used by the shm_open(2) syscall, which
  is mandated by POSIX to set CLOEXEC, and CloudABI's sys_fd_create1().
  Presumably O_CLOEXEC is intended in the latter caller, but it's unclear from
  the context.
  
  sys_shm_open() now unconditionally sets O_CLOEXEC to meet POSIX
  requirements, and a comment has been dropped in to kern_fd_open() to explain
  the situation and add a pointer to where O_CLOEXEC setting is maintained for
  shm_open(2) correctness. CloudABI's sys_fd_create1() also unconditionally
  sets O_CLOEXEC to match previous behavior.
  
  This also has the side-effect of making flags correctly reflect the
  O_CLOEXEC status on this fd for the rest of kern_shm_open(), but a
  glance-over leads me to believe that it didn't really matter.
  
  Reviewed by:	kib, markj
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D21119

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/kern/uipc_shm.c

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_fd.c	Wed Jul 31 05:38:39 2019	(r350463)
+++ head/sys/compat/cloudabi/cloudabi_fd.c	Wed Jul 31 15:16:51 2019	(r350464)
@@ -94,7 +94,8 @@ cloudabi_sys_fd_create1(struct thread *td,
 	case CLOUDABI_FILETYPE_SHARED_MEMORY:
 		cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_FTRUNCATE,
 		    CAP_MMAP_RWX);
-		return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, &fcaps));
+		return (kern_shm_open(td, SHM_ANON, O_RDWR | O_CLOEXEC, 0,
+		    &fcaps));
 	default:
 		return (EINVAL);
 	}

Modified: head/sys/kern/uipc_shm.c
==============================================================================
--- head/sys/kern/uipc_shm.c	Wed Jul 31 05:38:39 2019	(r350463)
+++ head/sys/kern/uipc_shm.c	Wed Jul 31 15:16:51 2019	(r350464)
@@ -729,7 +729,14 @@ kern_shm_open(struct thread *td, const char *userpath,
 	fdp = td->td_proc->p_fd;
 	cmode = (mode & ~fdp->fd_cmask) & ACCESSPERMS;
 
-	error = falloc_caps(td, &fp, &fd, O_CLOEXEC, fcaps);
+	/*
+	 * shm_open(2) created shm should always have O_CLOEXEC set, as mandated
+	 * by POSIX.  We allow it to be unset here so that an in-kernel
+	 * interface may be written as a thin layer around shm, optionally not
+	 * setting CLOEXEC.  For shm_open(2), O_CLOEXEC is set unconditionally
+	 * in sys_shm_open() to keep this implementation compliant.
+	 */
+	error = falloc_caps(td, &fp, &fd, flags & O_CLOEXEC, fcaps);
 	if (error)
 		return (error);
 
@@ -844,7 +851,8 @@ int
 sys_shm_open(struct thread *td, struct shm_open_args *uap)
 {
 
-	return (kern_shm_open(td, uap->path, uap->flags, uap->mode, NULL));
+	return (kern_shm_open(td, uap->path, uap->flags | O_CLOEXEC, uap->mode,
+	    NULL));
 }
 
 int

From owner-svn-src-head@freebsd.org  Wed Jul 31 16:22:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id F380FA2F0F;
 Wed, 31 Jul 2019 16:22:07 +0000 (UTC)
 (envelope-from luporl@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zJbg6zTPz421f;
 Wed, 31 Jul 2019 16:22:07 +0000 (UTC)
 (envelope-from luporl@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D22E143FE;
 Wed, 31 Jul 2019 16:22:07 +0000 (UTC)
 (envelope-from luporl@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VGM7sA045127;
 Wed, 31 Jul 2019 16:22:07 GMT (envelope-from luporl@FreeBSD.org)
Received: (from luporl@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VGM69X045118;
 Wed, 31 Jul 2019 16:22:06 GMT (envelope-from luporl@FreeBSD.org)
Message-Id: <201907311622.x6VGM69X045118@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: luporl set sender to
 luporl@FreeBSD.org using -f
From: Leandro Lupori <luporl@FreeBSD.org>
Date: Wed, 31 Jul 2019 16:22:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350467 - head/contrib/llvm/tools/lld/ELF
X-SVN-Group: head
X-SVN-Commit-Author: luporl
X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF
X-SVN-Commit-Revision: 350467
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zJbg6zTPz421f
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.40 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_SPAM_SHORT(0.40)[0.396,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 16:22:08 -0000

Author: luporl
Date: Wed Jul 31 16:22:05 2019
New Revision: 350467
URL: https://svnweb.freebsd.org/changeset/base/350467

Log:
  [PPC64] Backport fix for missing IRELATIVE relocations
  
  This is a backport of LLVM commit 8331f61a51a7a0a1efbf5ed398e181593023d151,
  llvm-svn: 353981:
  
  ELF: Allow GOT relocs pointing to non-preemptable ifunc to resolve to an
  IRELATIVE where possible.
  
  This is needed in order to make ifuncs work correctly on PPC64.
  
  It fixes an issue with lld, in which it would skip emitting necessary IRELATIVE
  relocations.  Without this change, indirect calls to ifuncs would result in a
  segmentation fault, in static binaries or when defined in the main binary
  (outside shared libraries).
  
  This change also reverts the local
  "Preserve relocations against ifuncs when -zifunc-noplt" commit and
  replaces it by its upstream version, as part of the merge.
  
  Reviewed by:	markj
  Differential Revision:	https://reviews.freebsd.org/D21102

Modified:
  head/contrib/llvm/tools/lld/ELF/Config.h
  head/contrib/llvm/tools/lld/ELF/Driver.cpp
  head/contrib/llvm/tools/lld/ELF/InputSection.cpp
  head/contrib/llvm/tools/lld/ELF/Relocations.cpp
  head/contrib/llvm/tools/lld/ELF/Relocations.h
  head/contrib/llvm/tools/lld/ELF/Symbols.cpp
  head/contrib/llvm/tools/lld/ELF/Symbols.h
  head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
  head/contrib/llvm/tools/lld/ELF/Writer.cpp

Modified: head/contrib/llvm/tools/lld/ELF/Config.h
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Config.h	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Config.h	Wed Jul 31 16:22:05 2019	(r350467)
@@ -191,7 +191,7 @@ struct Configuration {
   bool ZExecstack;
   bool ZGlobal;
   bool ZHazardplt;
-  bool ZIfuncnoplt;
+  bool ZIfuncNoplt;
   bool ZInitfirst;
   bool ZInterpose;
   bool ZKeepTextSectionPrefix;

Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Driver.cpp	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Driver.cpp	Wed Jul 31 16:22:05 2019	(r350467)
@@ -299,6 +299,9 @@ static void checkOptions() {
   if (!Config->Relocatable && !Config->DefineCommon)
     error("-no-define-common not supported in non relocatable output");
 
+  if (Config->ZText && Config->ZIfuncNoplt)
+    error("-z text and -z ifunc-noplt may not be used together");
+
   if (Config->Relocatable) {
     if (Config->Shared)
       error("-r and -shared may not be used together");
@@ -348,8 +351,7 @@ static bool getZFlag(opt::InputArgList &Args, StringRe
 static bool isKnownZFlag(StringRef S) {
   return S == "combreloc" || S == "copyreloc" || S == "defs" ||
          S == "execstack" || S == "global" || S == "hazardplt" ||
-         S == "ifunc-noplt" ||
-         S == "initfirst" || S == "interpose" ||
+         S == "ifunc-noplt" || S == "initfirst" || S == "interpose" ||
          S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" ||
          S == "nocombreloc" || S == "nocopyreloc" || S == "nodefaultlib" ||
          S == "nodelete" || S == "nodlopen" || S == "noexecstack" ||
@@ -875,7 +877,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args
   Config->ZExecstack = getZFlag(Args, "execstack", "noexecstack", false);
   Config->ZGlobal = hasZOption(Args, "global");
   Config->ZHazardplt = hasZOption(Args, "hazardplt");
-  Config->ZIfuncnoplt = hasZOption(Args, "ifunc-noplt");
+  Config->ZIfuncNoplt = hasZOption(Args, "ifunc-noplt");
   Config->ZInitfirst = hasZOption(Args, "initfirst");
   Config->ZInterpose = hasZOption(Args, "interpose");
   Config->ZKeepTextSectionPrefix = getZFlag(

Modified: head/contrib/llvm/tools/lld/ELF/InputSection.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/InputSection.cpp	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/InputSection.cpp	Wed Jul 31 16:22:05 2019	(r350467)
@@ -610,7 +610,6 @@ static uint64_t getRelocTargetVA(const InputFile *File
   case R_ARM_SBREL:
     return Sym.getVA(A) - getARMStaticBase(Sym);
   case R_GOT:
-  case R_GOT_PLT:
   case R_RELAX_TLS_GD_TO_IE_ABS:
     return Sym.getGotVA() + A;
   case R_GOTONLY_PC:
@@ -629,7 +628,6 @@ static uint64_t getRelocTargetVA(const InputFile *File
   case R_RELAX_TLS_GD_TO_IE_GOT_OFF:
     return Sym.getGotOffset() + A;
   case R_AARCH64_GOT_PAGE_PC:
-  case R_AARCH64_GOT_PAGE_PC_PLT:
   case R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC:
     return getAArch64Page(Sym.getGotVA() + A) - getAArch64Page(P);
   case R_GOT_PC:
@@ -677,10 +675,6 @@ static uint64_t getRelocTargetVA(const InputFile *File
            In.MipsGot->getGp(File);
   case R_AARCH64_PAGE_PC: {
     uint64_t Val = Sym.isUndefWeak() ? P + A : Sym.getVA(A);
-    return getAArch64Page(Val) - getAArch64Page(P);
-  }
-  case R_AARCH64_PLT_PAGE_PC: {
-    uint64_t Val = Sym.isUndefWeak() ? P + A : Sym.getPltVA() + A;
     return getAArch64Page(Val) - getAArch64Page(P);
   }
   case R_RISCV_PC_INDIRECT: {

Modified: head/contrib/llvm/tools/lld/ELF/Relocations.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Relocations.cpp	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Relocations.cpp	Wed Jul 31 16:22:05 2019	(r350467)
@@ -337,8 +337,7 @@ static bool isAbsoluteValue(const Symbol &Sym) {
 
 // Returns true if Expr refers a PLT entry.
 static bool needsPlt(RelExpr Expr) {
-  return isRelExprOneOf<R_PLT_PC, R_PPC_CALL_PLT, R_PLT, R_AARCH64_PLT_PAGE_PC,
-                        R_GOT_PLT, R_AARCH64_GOT_PAGE_PC_PLT>(Expr);
+  return isRelExprOneOf<R_PLT_PC, R_PPC_CALL_PLT, R_PLT>(Expr);
 }
 
 // Returns true if Expr refers a GOT entry. Note that this function
@@ -347,8 +346,7 @@ static bool needsPlt(RelExpr Expr) {
 static bool needsGot(RelExpr Expr) {
   return isRelExprOneOf<R_GOT, R_GOT_OFF, R_HEXAGON_GOT, R_MIPS_GOT_LOCAL_PAGE,
                         R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_AARCH64_GOT_PAGE_PC,
-                        R_AARCH64_GOT_PAGE_PC_PLT, R_GOT_PC, R_GOT_FROM_END,
-                        R_GOT_PLT>(Expr);
+                        R_GOT_PC, R_GOT_FROM_END>(Expr);
 }
 
 // True if this expression is of the form Sym - X, where X is a position in the
@@ -356,7 +354,7 @@ static bool needsGot(RelExpr Expr) {
 static bool isRelExpr(RelExpr Expr) {
   return isRelExprOneOf<R_PC, R_GOTREL, R_GOTREL_FROM_END, R_MIPS_GOTREL,
                         R_PPC_CALL, R_PPC_CALL_PLT, R_AARCH64_PAGE_PC,
-                        R_AARCH64_PLT_PAGE_PC, R_RELAX_GOT_PC>(Expr);
+                        R_RELAX_GOT_PC>(Expr);
 }
 
 // Returns true if a given relocation can be computed at link-time.
@@ -374,20 +372,16 @@ static bool isStaticLinkTimeConstant(RelExpr E, RelTyp
   if (isRelExprOneOf<R_GOT_FROM_END, R_GOT_OFF, R_HEXAGON_GOT, R_TLSLD_GOT_OFF,
                      R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOTREL, R_MIPS_GOT_OFF,
                      R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC, R_MIPS_TLSGD,
-                     R_AARCH64_GOT_PAGE_PC, R_AARCH64_GOT_PAGE_PC_PLT, R_GOT_PC,
-                     R_GOTONLY_PC, R_GOTONLY_PC_FROM_END, R_PLT_PC, R_TLSGD_GOT,
+                     R_AARCH64_GOT_PAGE_PC, R_GOT_PC, R_GOTONLY_PC,
+                     R_GOTONLY_PC_FROM_END, R_PLT_PC, R_TLSGD_GOT,
                      R_TLSGD_GOT_FROM_END, R_TLSGD_PC, R_PPC_CALL_PLT,
                      R_TLSDESC_CALL, R_AARCH64_TLSDESC_PAGE, R_HINT,
                      R_TLSLD_HINT, R_TLSIE_HINT>(E))
     return true;
 
-  // The computation involves output from the ifunc resolver.
-  if (Sym.isGnuIFunc() && Config->ZIfuncnoplt)
-    return false;
-
   // These never do, except if the entire file is position dependent or if
   // only the low bits are used.
-  if (E == R_GOT || E == R_GOT_PLT || E == R_PLT || E == R_TLSDESC)
+  if (E == R_GOT || E == R_PLT || E == R_TLSDESC)
     return Target->usesOnlyLowPageBits(Type) || !Config->Pic;
 
   if (Sym.IsPreemptible)
@@ -433,14 +427,8 @@ static RelExpr toPlt(RelExpr Expr) {
     return R_PPC_CALL_PLT;
   case R_PC:
     return R_PLT_PC;
-  case R_AARCH64_PAGE_PC:
-    return R_AARCH64_PLT_PAGE_PC;
-  case R_AARCH64_GOT_PAGE_PC:
-    return R_AARCH64_GOT_PAGE_PC_PLT;
   case R_ABS:
     return R_PLT;
-  case R_GOT:
-    return R_GOT_PLT;
   default:
     return Expr;
   }
@@ -772,14 +760,7 @@ static void addPltEntry(PltSection *Plt, GotPltSection
 template <class ELFT> static void addGotEntry(Symbol &Sym) {
   In.Got->addEntry(Sym);
 
-  RelExpr Expr;
-  if (Sym.isTls())
-    Expr = R_TLS;
-  else if (Sym.isGnuIFunc())
-    Expr = R_PLT;
-  else
-    Expr = R_ABS;
-
+  RelExpr Expr = Sym.isTls() ? R_TLS : R_ABS;
   uint64_t Off = Sym.getGotOffset();
 
   // If a GOT slot value can be calculated at link-time, which is now,
@@ -848,10 +829,6 @@ static void processRelocAux(InputSectionBase &Sec, Rel
     Sec.Relocations.push_back({Expr, Type, Offset, Addend, &Sym});
     return;
   }
-  if (Sym.isGnuIFunc() && Config->ZIfuncnoplt) {
-    In.RelaDyn->addReloc(Type, &Sec, Offset, &Sym, Addend, R_ADDEND, Type);
-    return;
-  }
   bool CanWrite = (Sec.Flags & SHF_WRITE) || !Config->ZText;
   if (CanWrite) {
     // R_GOT refers to a position in the got, even if the symbol is preemptible.
@@ -978,6 +955,15 @@ static void processRelocAux(InputSectionBase &Sec, Rel
               getLocation(Sec, Sym, Offset));
 }
 
+struct IRelativeReloc {
+  RelType Type;
+  InputSectionBase *Sec;
+  uint64_t Offset;
+  Symbol *Sym;
+};
+
+static std::vector<IRelativeReloc> IRelativeRelocs;
+
 template <class ELFT, class RelTy>
 static void scanReloc(InputSectionBase &Sec, OffsetGetter &GetOffset, RelTy *&I,
                       RelTy *End) {
@@ -1009,32 +995,29 @@ static void scanReloc(InputSectionBase &Sec, OffsetGet
   if (isRelExprOneOf<R_HINT, R_NONE>(Expr))
     return;
 
-  // Strenghten or relax relocations.
+  if (Sym.isGnuIFunc() && !Config->ZText && Config->WarnIfuncTextrel) {
+    warn("using ifunc symbols when text relocations are allowed may produce "
+         "a binary that will segfault, if the object file is linked with "
+         "old version of glibc (glibc 2.28 and earlier). If this applies to "
+         "you, consider recompiling the object files without -fPIC and "
+         "without -Wl,-z,notext option. Use -no-warn-ifunc-textrel to "
+         "turn off this warning." +
+         getLocation(Sec, Sym, Offset));
+  }
+
+  // Relax relocations.
   //
-  // GNU ifunc symbols must be accessed via PLT because their addresses
-  // are determined by runtime.
-  //
-  // On the other hand, if we know that a PLT entry will be resolved within
-  // the same ELF module, we can skip PLT access and directly jump to the
-  // destination function. For example, if we are linking a main exectuable,
-  // all dynamic symbols that can be resolved within the executable will
-  // actually be resolved that way at runtime, because the main exectuable
-  // is always at the beginning of a search list. We can leverage that fact.
-  if (Sym.isGnuIFunc() && !Config->ZIfuncnoplt) {
-    if (!Config->ZText && Config->WarnIfuncTextrel) {
-      warn("using ifunc symbols when text relocations are allowed may produce "
-           "a binary that will segfault, if the object file is linked with "
-           "old version of glibc (glibc 2.28 and earlier). If this applies to "
-           "you, consider recompiling the object files without -fPIC and "
-           "without -Wl,-z,notext option. Use -no-warn-ifunc-textrel to "
-           "turn off this warning." +
-           getLocation(Sec, Sym, Offset));
-    }
-    Expr = toPlt(Expr);
-  } else if (!Sym.IsPreemptible && Expr == R_GOT_PC && !isAbsoluteValue(Sym)) {
-    Expr = Target->adjustRelaxExpr(Type, RelocatedAddr, Expr);
-  } else if (!Sym.IsPreemptible) {
-    Expr = fromPlt(Expr);
+  // If we know that a PLT entry will be resolved within the same ELF module, we
+  // can skip PLT access and directly jump to the destination function. For
+  // example, if we are linking a main exectuable, all dynamic symbols that can
+  // be resolved within the executable will actually be resolved that way at
+  // runtime, because the main exectuable is always at the beginning of a search
+  // list. We can leverage that fact.
+  if (!Sym.IsPreemptible && (!Sym.isGnuIFunc() || Config->ZIfuncNoplt)) {
+    if (Expr == R_GOT_PC && !isAbsoluteValue(Sym))
+      Expr = Target->adjustRelaxExpr(Type, RelocatedAddr, Expr);
+    else
+      Expr = fromPlt(Expr);
   }
 
   // This relocation does not require got entry, but it is relative to got and
@@ -1054,29 +1037,145 @@ static void scanReloc(InputSectionBase &Sec, OffsetGet
     return;
   }
 
-  // If a relocation needs PLT, we create PLT and GOTPLT slots for the symbol.
-  if (needsPlt(Expr) && !Sym.isInPlt()) {
-    if (Sym.isGnuIFunc() && !Sym.IsPreemptible)
-      addPltEntry<ELFT>(In.Iplt, In.IgotPlt, In.RelaIplt, Target->IRelativeRel,
-                        Sym);
-    else
-      addPltEntry<ELFT>(In.Plt, In.GotPlt, In.RelaPlt, Target->PltRel, Sym);
+  // We were asked not to generate PLT entries for ifuncs. Instead, pass the
+  // direct relocation on through.
+  if (Sym.isGnuIFunc() && Config->ZIfuncNoplt) {
+    Sym.ExportDynamic = true;
+    In.RelaDyn->addReloc(Type, &Sec, Offset, &Sym, Addend, R_ADDEND, Type);
+    return;
   }
 
-  // Create a GOT slot if a relocation needs GOT.
-  if (needsGot(Expr)) {
-    if (Config->EMachine == EM_MIPS) {
-      // MIPS ABI has special rules to process GOT entries and doesn't
-      // require relocation entries for them. A special case is TLS
-      // relocations. In that case dynamic loader applies dynamic
-      // relocations to initialize TLS GOT entries.
-      // See "Global Offset Table" in Chapter 5 in the following document
-      // for detailed description:
-      // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
-      In.MipsGot->addEntry(*Sec.File, Sym, Addend, Expr);
-    } else if (!Sym.isInGot()) {
-      addGotEntry<ELFT>(Sym);
+  // Non-preemptible ifuncs require special handling. First, handle the usual
+  // case where the symbol isn't one of these.
+  if (!Sym.isGnuIFunc() || Sym.IsPreemptible) {
+    // If a relocation needs PLT, we create PLT and GOTPLT slots for the symbol.
+    if (needsPlt(Expr) && !Sym.isInPlt())
+      addPltEntry<ELFT>(In.Plt, In.GotPlt, In.RelaPlt, Target->PltRel, Sym);
+
+    // Create a GOT slot if a relocation needs GOT.
+    if (needsGot(Expr)) {
+      if (Config->EMachine == EM_MIPS) {
+        // MIPS ABI has special rules to process GOT entries and doesn't
+        // require relocation entries for them. A special case is TLS
+        // relocations. In that case dynamic loader applies dynamic
+        // relocations to initialize TLS GOT entries.
+        // See "Global Offset Table" in Chapter 5 in the following document
+        // for detailed description:
+        // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
+        In.MipsGot->addEntry(*Sec.File, Sym, Addend, Expr);
+      } else if (!Sym.isInGot()) {
+        addGotEntry<ELFT>(Sym);
+      }
     }
+  } else {
+    // Handle a reference to a non-preemptible ifunc. These are special in a
+    // few ways:
+    //
+    // - Unlike most non-preemptible symbols, non-preemptible ifuncs do not have
+    //   a fixed value. But assuming that all references to the ifunc are
+    //   GOT-generating or PLT-generating, the handling of an ifunc is
+    //   relatively straightforward. We create a PLT entry in Iplt, which is
+    //   usually at the end of .plt, which makes an indirect call using a
+    //   matching GOT entry in IgotPlt, which is usually at the end of .got.plt.
+    //   The GOT entry is relocated using an IRELATIVE relocation in RelaIplt,
+    //   which is usually at the end of .rela.plt. Unlike most relocations in
+    //   .rela.plt, which may be evaluated lazily without -z now, dynamic
+    //   loaders evaluate IRELATIVE relocs eagerly, which means that for
+    //   IRELATIVE relocs only, GOT-generating relocations can point directly to
+    //   .got.plt without requiring a separate GOT entry.
+    //
+    // - Despite the fact that an ifunc does not have a fixed value, compilers
+    //   that are not passed -fPIC will assume that they do, and will emit
+    //   direct (non-GOT-generating, non-PLT-generating) relocations to the
+    //   symbol. This means that if a direct relocation to the symbol is
+    //   seen, the linker must set a value for the symbol, and this value must
+    //   be consistent no matter what type of reference is made to the symbol.
+    //   This can be done by creating a PLT entry for the symbol in the way
+    //   described above and making it canonical, that is, making all references
+    //   point to the PLT entry instead of the resolver. In lld we also store
+    //   the address of the PLT entry in the dynamic symbol table, which means
+    //   that the symbol will also have the same value in other modules.
+    //   Because the value loaded from the GOT needs to be consistent with
+    //   the value computed using a direct relocation, a non-preemptible ifunc
+    //   may end up with two GOT entries, one in .got.plt that points to the
+    //   address returned by the resolver and is used only by the PLT entry,
+    //   and another in .got that points to the PLT entry and is used by
+    //   GOT-generating relocations.
+    //
+    // - The fact that these symbols do not have a fixed value makes them an
+    //   exception to the general rule that a statically linked executable does
+    //   not require any form of dynamic relocation. To handle these relocations
+    //   correctly, the IRELATIVE relocations are stored in an array which a
+    //   statically linked executable's startup code must enumerate using the
+    //   linker-defined symbols __rela?_iplt_{start,end}.
+    //
+    // - An absolute relocation to a non-preemptible ifunc (such as a global
+    //   variable containing a pointer to the ifunc) needs to be relocated in
+    //   the exact same way as a GOT entry, so we can avoid needing to make the
+    //   PLT entry canonical by translating such relocations into IRELATIVE
+    //   relocations in the RelaIplt.
+    if (!Sym.isInPlt()) {
+      // Create PLT and GOTPLT slots for the symbol.
+      Sym.IsInIplt = true;
+
+      // Create a copy of the symbol to use as the target of the IRELATIVE
+      // relocation in the IgotPlt. This is in case we make the PLT canonical
+      // later, which would overwrite the original symbol.
+      //
+      // FIXME: Creating a copy of the symbol here is a bit of a hack. All
+      // that's really needed to create the IRELATIVE is the section and value,
+      // so ideally we should just need to copy those.
+      auto *DirectSym = make<Defined>(cast<Defined>(Sym));
+      addPltEntry<ELFT>(In.Iplt, In.IgotPlt, In.RelaIplt, Target->IRelativeRel,
+                        *DirectSym);
+      Sym.PltIndex = DirectSym->PltIndex;
+    }
+    if (Expr == R_ABS && Addend == 0 && (Sec.Flags & SHF_WRITE)) {
+      // We might be able to represent this as an IRELATIVE. But we don't know
+      // yet whether some later relocation will make the symbol point to a
+      // canonical PLT, which would make this either a dynamic RELATIVE (PIC) or
+      // static (non-PIC) relocation. So we keep a record of the information
+      // required to process the relocation, and after scanRelocs() has been
+      // called on all relocations, the relocation is resolved by
+      // addIRelativeRelocs().
+      IRelativeRelocs.push_back({Type, &Sec, Offset, &Sym});
+      return;
+    }
+    if (needsGot(Expr)) {
+      // Redirect GOT accesses to point to the Igot.
+      //
+      // This field is also used to keep track of whether we ever needed a GOT
+      // entry. If we did and we make the PLT canonical later, we'll need to
+      // create a GOT entry pointing to the PLT entry for Sym.
+      Sym.GotInIgot = true;
+    } else if (!needsPlt(Expr)) {
+      // Make the ifunc's PLT entry canonical by changing the value of its
+      // symbol to redirect all references to point to it.
+      unsigned EntryOffset = Sym.PltIndex * Target->PltEntrySize;
+      if (Config->ZRetpolineplt)
+        EntryOffset += Target->PltHeaderSize;
+
+      auto &D = cast<Defined>(Sym);
+      D.Section = In.Iplt;
+      D.Value = EntryOffset;
+      D.Size = 0;
+      // It's important to set the symbol type here so that dynamic loaders
+      // don't try to call the PLT as if it were an ifunc resolver.
+      D.Type = STT_FUNC;
+
+      if (Sym.GotInIgot) {
+        // We previously encountered a GOT generating reference that we
+        // redirected to the Igot. Now that the PLT entry is canonical we must
+        // clear the redirection to the Igot and add a GOT entry. As we've
+        // changed the symbol type to STT_FUNC future GOT generating references
+        // will naturally use this GOT entry.
+        //
+        // We don't need to worry about creating a MIPS GOT here because ifuncs
+        // aren't a thing on MIPS.
+        Sym.GotInIgot = false;
+        addGotEntry<ELFT>(Sym);
+      }
+    }
   }
 
   processRelocAux<ELFT>(Sec, Expr, Type, Offset, Sym, Rel, Addend);
@@ -1103,6 +1202,21 @@ template <class ELFT> void elf::scanRelocations(InputS
     scanRelocs<ELFT>(S, S.relas<ELFT>());
   else
     scanRelocs<ELFT>(S, S.rels<ELFT>());
+}
+
+// Figure out which representation to use for any absolute relocs to
+// non-preemptible ifuncs that we visited during scanRelocs().
+void elf::addIRelativeRelocs() {
+  for (IRelativeReloc &R : IRelativeRelocs) {
+    if (R.Sym->Type == STT_GNU_IFUNC)
+      In.RelaIplt->addReloc(
+          {Target->IRelativeRel, R.Sec, R.Offset, true, R.Sym, 0});
+    else if (Config->Pic)
+      addRelativeReloc(R.Sec, R.Offset, R.Sym, 0, R_ABS, R.Type);
+    else
+      R.Sec->Relocations.push_back({R_ABS, R.Type, R.Offset, 0, R.Sym});
+  }
+  IRelativeRelocs.clear();
 }
 
 static bool mergeCmp(const InputSection *A, const InputSection *B) {

Modified: head/contrib/llvm/tools/lld/ELF/Relocations.h
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Relocations.h	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Relocations.h	Wed Jul 31 16:22:05 2019	(r350467)
@@ -34,19 +34,11 @@ enum RelExpr {
   R_ABS,
   R_ADDEND,
   R_AARCH64_GOT_PAGE_PC,
-  // The expression is used for IFUNC support. Describes PC-relative
-  // address of the memory page of GOT entry. This entry is used for
-  // a redirection to IPLT.
-  R_AARCH64_GOT_PAGE_PC_PLT,
   R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC,
   R_AARCH64_PAGE_PC,
-  R_AARCH64_PLT_PAGE_PC,
   R_AARCH64_TLSDESC_PAGE,
   R_ARM_SBREL,
   R_GOT,
-  // The expression is used for IFUNC support. Evaluates to GOT entry,
-  // containing redirection to the IPLT.
-  R_GOT_PLT,
   R_GOTONLY_PC,
   R_GOTONLY_PC_FROM_END,
   R_GOTREL,
@@ -154,6 +146,8 @@ struct RelocationOffsetComparator {
 };
 
 template <class ELFT> void scanRelocations(InputSectionBase &);
+
+void addIRelativeRelocs();
 
 class ThunkSection;
 class Thunk;

Modified: head/contrib/llvm/tools/lld/ELF/Symbols.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Symbols.cpp	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Symbols.cpp	Wed Jul 31 16:22:05 2019	(r350467)
@@ -121,20 +121,24 @@ uint64_t Symbol::getVA(int64_t Addend) const {
   return OutVA + Addend;
 }
 
-uint64_t Symbol::getGotVA() const { return In.Got->getVA() + getGotOffset(); }
+uint64_t Symbol::getGotVA() const {
+  if (GotInIgot)
+    return In.IgotPlt->getVA() + getGotPltOffset();
+  return In.Got->getVA() + getGotOffset();
+}
 
 uint64_t Symbol::getGotOffset() const {
   return GotIndex * Target->GotEntrySize;
 }
 
 uint64_t Symbol::getGotPltVA() const {
-  if (this->IsInIgot)
+  if (IsInIplt)
     return In.IgotPlt->getVA() + getGotPltOffset();
   return In.GotPlt->getVA() + getGotPltOffset();
 }
 
 uint64_t Symbol::getGotPltOffset() const {
-  if (IsInIgot)
+  if (IsInIplt)
     return PltIndex * Target->GotPltEntrySize;
   return (PltIndex + Target->GotPltHeaderEntriesNum) * Target->GotPltEntrySize;
 }

Modified: head/contrib/llvm/tools/lld/ELF/Symbols.h
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Symbols.h	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Symbols.h	Wed Jul 31 16:22:05 2019	(r350467)
@@ -182,7 +182,7 @@ class Symbol { (protected)
          uint8_t StOther, uint8_t Type)
       : File(File), NameData(Name.Data), NameSize(Name.Size), Binding(Binding),
         Type(Type), StOther(StOther), SymbolKind(K), NeedsPltAddr(false),
-        IsInIplt(false), IsInIgot(false), IsPreemptible(false),
+        IsInIplt(false), GotInIgot(false), IsPreemptible(false),
         Used(!Config->GcSections), NeedsTocRestore(false),
         ScriptDefined(false) {}
 
@@ -191,11 +191,13 @@ class Symbol { (protected)
   // For SharedSymbol only.
   unsigned NeedsPltAddr : 1;
 
-  // True if this symbol is in the Iplt sub-section of the Plt.
+  // True if this symbol is in the Iplt sub-section of the Plt and the Igot
+  // sub-section of the .got.plt or .got.
   unsigned IsInIplt : 1;
 
-  // True if this symbol is in the Igot sub-section of the .got.plt or .got.
-  unsigned IsInIgot : 1;
+  // True if this symbol needs a GOT entry and its GOT entry is actually in
+  // Igot. This will be true only for certain non-preemptible ifuncs.
+  unsigned GotInIgot : 1;
 
   // True if this symbol is preemptible at load time.
   unsigned IsPreemptible : 1;

Modified: head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp	Wed Jul 31 16:22:05 2019	(r350467)
@@ -1133,7 +1133,6 @@ IgotPltSection::IgotPltSection()
                        Target->GotPltEntrySize, getIgotPltName()) {}
 
 void IgotPltSection::addEntry(Symbol &Sym) {
-  Sym.IsInIgot = true;
   assert(Sym.PltIndex == Entries.size());
   Entries.push_back(&Sym);
 }
@@ -2340,10 +2339,8 @@ void PltSection::writeTo(uint8_t *Buf) {
 template <class ELFT> void PltSection::addEntry(Symbol &Sym) {
   Sym.PltIndex = Entries.size();
   RelocationBaseSection *PltRelocSection = In.RelaPlt;
-  if (IsIplt) {
+  if (IsIplt)
     PltRelocSection = In.RelaIplt;
-    Sym.IsInIplt = true;
-  }
   unsigned RelOff =
       static_cast<RelocationSection<ELFT> *>(PltRelocSection)->getRelocOffset();
   Entries.push_back(std::make_pair(&Sym, RelOff));

Modified: head/contrib/llvm/tools/lld/ELF/Writer.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/Writer.cpp	Wed Jul 31 16:07:16 2019	(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Writer.cpp	Wed Jul 31 16:22:05 2019	(r350467)
@@ -1656,17 +1656,15 @@ template <class ELFT> void Writer<ELFT>::finalizeSecti
   // earlier.
   finalizeSynthetic(In.EhFrame);
 
-  for (Symbol *S : Symtab->getSymbols()) {
-    if (!S->IsPreemptible)
-      S->IsPreemptible = computeIsPreemptible(*S);
-    if (S->isGnuIFunc() && Config->ZIfuncnoplt)
-      S->ExportDynamic = true;
-  }
+  for (Symbol *S : Symtab->getSymbols())
+    S->IsPreemptible |= computeIsPreemptible(*S);
 
   // Scan relocations. This must be done after every symbol is declared so that
   // we can correctly decide if a dynamic relocation is needed.
   if (!Config->Relocatable)
     forEachRelSec(scanRelocations<ELFT>);
+
+  addIRelativeRelocs();
 
   if (In.Plt && !In.Plt->empty())
     In.Plt->addSymbols();

From owner-svn-src-head@freebsd.org  Wed Jul 31 16:58:10 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8017DA3B7E;
 Wed, 31 Jul 2019 16:58:10 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zKPG2mbKz43vr;
 Wed, 31 Jul 2019 16:58:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 407794ABE;
 Wed, 31 Jul 2019 16:58:10 +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 x6VGwAHB066740;
 Wed, 31 Jul 2019 16:58:10 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VGwADZ066739;
 Wed, 31 Jul 2019 16:58:10 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201907311658.x6VGwADZ066739@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Wed, 31 Jul 2019 16:58:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350468 - head/sys/netpfil/pf
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/sys/netpfil/pf
X-SVN-Commit-Revision: 350468
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zKPG2mbKz43vr
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.22 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.22)[-0.216,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 16:58:10 -0000

Author: emaste
Date: Wed Jul 31 16:58:09 2019
New Revision: 350468
URL: https://svnweb.freebsd.org/changeset/base/350468

Log:
  pf: zero (another) output buffer in pfioctl
  
  Avoid potential structure padding leak.  r350294 identified a leak via
  static analysis; although there's no report of a leak with the
  DIOCGETSRCNODES ioctl it's a good practice to zero the memory.
  
  Suggested by:	kp
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==============================================================================
--- head/sys/netpfil/pf/pf_ioctl.c	Wed Jul 31 16:22:05 2019	(r350467)
+++ head/sys/netpfil/pf/pf_ioctl.c	Wed Jul 31 16:58:09 2019	(r350468)
@@ -3752,7 +3752,7 @@ DIOCCHANGEADDR_error:
 
 		nr = 0;
 
-		p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK);
+		p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK | M_ZERO);
 		for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask;
 		    i++, sh++) {
 		    PF_HASHROW_LOCK(sh);

From owner-svn-src-head@freebsd.org  Wed Jul 31 17:08:45 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7460A3FCD;
 Wed, 31 Jul 2019 17:08:45 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
 [IPv6:2610:1c1:1:6074::16:84])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "freefall.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zKdT4wfmz44qd;
 Wed, 31 Jul 2019 17:08:45 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (unknown [127.0.1.132])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by freefall.freebsd.org (Postfix) with ESMTPS id 58E48AC36;
 Wed, 31 Jul 2019 17:08:45 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (localhost [172.31.3.2])
 by mail.xzibition.com (Postfix) with ESMTP id 8E0E314C74;
 Wed, 31 Jul 2019 17:08:44 +0000 (UTC)
X-Virus-Scanned: amavisd-new at mail.xzibition.com
Received: from mail.xzibition.com ([172.31.3.2])
 by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new,
 port 10026)
 with LMTP id cDcZ5e9upcLF; Wed, 31 Jul 2019 17:08:40 +0000 (UTC)
Subject: Re: svn commit: r350005 - head/sys/kern
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 930D714C6D
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
 <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
 <20190731051452.GN2731@kib.kiev.ua>
From: Bryan Drewery <bdrewery@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ
 a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab
 D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+
 rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp
 VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB
 AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL
 CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu
 BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX
 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj
 IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd
 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4
 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm
 NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK
 BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8
 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C
 eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR
 lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u
 IUrMm6UAEQEAAYkBJQQYAQoADwUCUmmGawIbDAUJCWYBgAAKCRA113G7bkaXz1Q+CADaYZCn
 bzIJQqwnoocVXL+Wkd+hCsoX6zsd8pNTY5tV5U1fgjxl1bVQ7jyZGrEQ7BjyvlhIfpfTo6aK
 oJfZpIxeDc3Tr+X7O2UHT5QYaWRcGO+X3+eKL5sLpvxda67RftClv2hgEr1i2hqjK5WmUCaN
 2P9w+i7rmZ4ohpLXINOMeHjnQOtbxCCF7qXRsVfgEcpNKb31T3QwvsRjX0HqIjYFlKpa61Wz
 IPvWgBERjo0aAOkI4g7oVLjX5Z5gINGPy+xr8GJqhfZ3ZIEOwLCwTB71+Dk9gyLa5UiG8vo6
 vGfA50H5OSC87LnNlI07b1Qb8mKVkqg13PbCkRpTMKEYaou9iQElBBgBCgAPAhsMBQJa6M4o
 BQkKYHs9AAoJEDXXcbtuRpfPpuQH/0d1RHcTTAHAyHrPQA4UMqH49tEj1d3gidx2ETnm00rj
 XTrnRreAAMgPCrPeLvYYiKeSBrHOkQ7E/Vuztr4F4Xenld3omOTon+cSyGKyA1btWNRskcUa
 zxJ/0DqgzerhWQj8CtWjmqRnGAqzvZQdIDLk1X4B2p1Ota4AvbTF9DqADskXfld/zPJQzYYy
 XRfyKTt0nWMyn5MHbsuKmpsOBqYXMf0X2EL2C6v3g5D/HedD6YVnW6KlgcDUR2sq6Fv9Ozhs
 38TOXyeZgbFz0HDtkHEY5Mh3+sQjOh4takC+Dp1zDRP2U19JZzo9f6R/d05c0h2TD02oogPz
 AQ97xrFwZgaJATwEGAEKACYCGwwWIQT5Fzyyw6rqelyKHwk113G7bkaXzwUCW+YS+AUJDT7z
 jQAKCRA113G7bkaXzwo3B/4rwbDqXaXm6YC4s0jVOf1+MljeQIsbHPVQZ0IRigCpzCDSUFTK
 QOebA9iUj8JaF2DPwd6sjyUUv/XMCLl+SwzSijmVN0Kfk85XspzNef8XmteKK1mERkYnLWBw
 TNwp6qezg/CukNbobNH08ciT+z2fxtPuwqK5X9Q5R4Q7egth5XUTxbwLwIJerEfVs4HG+687
 m9h1bWyYJemB24MgBu8fTaVxas8dSSwDHabdgyGMKIvqDHUUJQSMDbio0Iwhs7lx2p3Xd5Br
 wQLMiaUPnKBHqfVM8ADWldvHF6xa9keBUjnEedKwQNjYf76lGH6bLwbyZcLigKFdXY1R2ooT Xi+R
Organization: FreeBSD
Message-ID: <46c7a7bc-29ec-6176-0ede-96ac91984589@FreeBSD.org>
Date: Wed, 31 Jul 2019 10:08:39 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0)
 Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <20190731051452.GN2731@kib.kiev.ua>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="aK9Kdd31p41YBj2NhYw5iUK31tZN35UP5"
X-Rspamd-Queue-Id: 45zKdT4wfmz44qd
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.44 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.44)[-0.437,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 17:08:45 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--aK9Kdd31p41YBj2NhYw5iUK31tZN35UP5
Content-Type: multipart/mixed; boundary="RDQswO8kbRZurUEp8ymmIDrxhdkg0anIP";
 protected-headers="v1"
From: Bryan Drewery <bdrewery@FreeBSD.org>
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Message-ID: <46c7a7bc-29ec-6176-0ede-96ac91984589@FreeBSD.org>
Subject: Re: svn commit: r350005 - head/sys/kern
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
 <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
 <20190731051452.GN2731@kib.kiev.ua>
In-Reply-To: <20190731051452.GN2731@kib.kiev.ua>

--RDQswO8kbRZurUEp8ymmIDrxhdkg0anIP
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 7/30/19 10:14 PM, Konstantin Belousov wrote:
> On Tue, Jul 30, 2019 at 08:40:28PM -0700, Bryan Drewery wrote:
>> This 2nd change alone (&& count1 =3D=3D 0) was sufficient to fix the e=
ndless
>> loop problem.
> Good, thank you.
>=20
>>
>> I am not sure how to test the umtxq_check_susp() change. Do I just nee=
d
>> to ptrace the process?
>=20
> No, you should create a situation where the python process ends the end=
less
> loop, as reported.  Then, it should become killable by 9 with the first=

> chunk only applied.
>=20

I don't have an easy way to test that. kill -9 inside the loop didn't
work. Once the loop ended the process was done; it is very short lived
and the calling code is buried in Python I think.

--=20
Regards,
Bryan Drewery


--RDQswO8kbRZurUEp8ymmIDrxhdkg0anIP--

--aK9Kdd31p41YBj2NhYw5iUK31tZN35UP5
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl1ByxcACgkQNddxu25G
l88+ggf/WjHcTieUJEfRfEL1FebD7EW8+d3qVPSzZJbBo/z43Ph8qGimbz0LZcF/
x72ZFaj3Zy9bgsDn0eZqC+h+bzLhwiw4b9aHT45TR5KFpGofeNmF0UcsAPflwuhH
ohwusgmz3ZAug36zbqnNvHxfGqZN+0M5mtsK3S+8JJL6rOT7+1jkvcjur0PRrPmN
HZBIe26nREjtj7Jy1Usyl0+NvwbiGr8S+t9584QXT6aqezHmiqUDlyFZSZhhQIjD
pJfStN2Lv3ysN+rmKXYV7trTQBvvMcLiOJwWlLHIbES09RZ8a7a9HD32GX3ycAFM
RN3KGgHQNmEfC7bJzpzGU4gihIX5Cw==
=DnL4
-----END PGP SIGNATURE-----

--aK9Kdd31p41YBj2NhYw5iUK31tZN35UP5--

From owner-svn-src-head@freebsd.org  Wed Jul 31 17:47:13 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86827A497D;
 Wed, 31 Jul 2019 17:47:13 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zLTs3hp7z46v9;
 Wed, 31 Jul 2019 17:47:13 +0000 (UTC)
 (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C22253D2;
 Wed, 31 Jul 2019 17:47:13 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VHlDM0097749;
 Wed, 31 Jul 2019 17:47:13 GMT (envelope-from oshogbo@FreeBSD.org)
Received: (from oshogbo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VHlCnO097744;
 Wed, 31 Jul 2019 17:47:12 GMT (envelope-from oshogbo@FreeBSD.org)
Message-Id: <201907311747.x6VHlCnO097744@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to
 oshogbo@FreeBSD.org using -f
From: Mariusz Zaborski <oshogbo@FreeBSD.org>
Date: Wed, 31 Jul 2019 17:47:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350471 - in head: lib/geom/nop sys/geom/nop
X-SVN-Group: head
X-SVN-Commit-Author: oshogbo
X-SVN-Commit-Paths: in head: lib/geom/nop sys/geom/nop
X-SVN-Commit-Revision: 350471
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zLTs3hp7z46v9
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.17 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.17)[-0.165,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 17:47:13 -0000

Author: oshogbo
Date: Wed Jul 31 17:47:12 2019
New Revision: 350471
URL: https://svnweb.freebsd.org/changeset/base/350471

Log:
  gnop: Introduce requests delay.
  
  This allows to simulated disk that is responding slowly to the IO requests.
  
  Reviewed by:	markj, bcr, pjd (previous version)
  Differential Revision:	https://reviews.freebsd.org/D21052

Modified:
  head/lib/geom/nop/geom_nop.c
  head/lib/geom/nop/gnop.8
  head/sys/geom/nop/g_nop.c
  head/sys/geom/nop/g_nop.h

Modified: head/lib/geom/nop/geom_nop.c
==============================================================================
--- head/lib/geom/nop/geom_nop.c	Wed Jul 31 17:29:14 2019	(r350470)
+++ head/lib/geom/nop/geom_nop.c	Wed Jul 31 17:47:12 2019	(r350471)
@@ -43,29 +43,36 @@ uint32_t version = G_NOP_VERSION;
 struct g_command class_commands[] = {
 	{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
 	    {
+		{ 'd', "delaymsec", "-1", G_TYPE_NUMBER },
 		{ 'e', "error", "-1", G_TYPE_NUMBER },
 		{ 'o', "offset", "0", G_TYPE_NUMBER },
 		{ 'p', "stripesize", "0", G_TYPE_NUMBER },
 		{ 'P', "stripeoffset", "0", G_TYPE_NUMBER },
+		{ 'q', "rdelayprob", "-1", G_TYPE_NUMBER },
 		{ 'r', "rfailprob", "-1", G_TYPE_NUMBER },
 		{ 's', "size", "0", G_TYPE_NUMBER },
 		{ 'S', "secsize", "0", G_TYPE_NUMBER },
 		{ 'w', "wfailprob", "-1", G_TYPE_NUMBER },
+		{ 'x', "wdelayprob", "1", G_TYPE_NUMBER },
 		{ 'z', "physpath", G_NOP_PHYSPATH_PASSTHROUGH, G_TYPE_STRING },
 		G_OPT_SENTINEL
 	    },
-	    "[-v] [-e error] [-o offset] [-p stripesize] [-P stripeoffset] "
-	    "[-r rfailprob] [-s size] [-S secsize] [-w wfailprob] "
-	    "[-z physpath] dev ..."
+	    "[-v] [-d delaymsec] [-e error] [-o offset] [-p stripesize] "
+	    "[-P stripeoffset] [-q rdelayprob] [-r rfailprob] [-s size] "
+	    "[-S secsize] [-w wfailprob] [-x wdelayprob] [-z physpath] dev ..."
 	},
 	{ "configure", G_FLAG_VERBOSE, NULL,
 	    {
+		{ 'd', "delaymsec", "-1", G_TYPE_NUMBER },
 		{ 'e', "error", "-1", G_TYPE_NUMBER },
+		{ 'q', "rdelayprob", "-1", G_TYPE_NUMBER },
 		{ 'r', "rfailprob", "-1", G_TYPE_NUMBER },
 		{ 'w', "wfailprob", "-1", G_TYPE_NUMBER },
+		{ 'x', "wdelayprob", "1", G_TYPE_NUMBER },
 		G_OPT_SENTINEL
 	    },
-	    "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..."
+	    "[-v] [-d delaymsec] [-e error] [-q rdelayprob] [-r rfailprob] "
+	    "[-w wfailprob] [-x wdelayprob] prov ..."
 	},
 	{ "destroy", G_FLAG_VERBOSE, NULL,
 	    {

Modified: head/lib/geom/nop/gnop.8
==============================================================================
--- head/lib/geom/nop/gnop.8	Wed Jul 31 17:29:14 2019	(r350470)
+++ head/lib/geom/nop/gnop.8	Wed Jul 31 17:47:12 2019	(r350471)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 17, 2018
+.Dd July 31, 2019
 .Dt GNOP 8
 .Os
 .Sh NAME
@@ -34,22 +34,28 @@
 .Nm
 .Cm create
 .Op Fl v
+.Op Fl d Ar delaymsec
 .Op Fl e Ar error
 .Op Fl o Ar offset
 .Op Fl p Ar stripesize
 .Op Fl P Ar stripeoffset
+.Op Fl q Ar rdelayprob
 .Op Fl r Ar rfailprob
 .Op Fl s Ar size
 .Op Fl S Ar secsize
 .Op Fl w Ar wfailprob
+.Op Fl x Ar wdelayprob
 .Op Fl z Ar physpath
 .Ar dev ...
 .Nm
 .Cm configure
 .Op Fl v
+.Op Fl d Ar delaymsec
 .Op Fl e Ar error
+.Op Fl q Ar rdelayprob
 .Op Fl r Ar rfailprob
 .Op Fl w Ar wfailprob
+.Op Fl x Ar wdelayprob
 .Ar prov ...
 .Nm
 .Cm destroy
@@ -113,6 +119,9 @@ See
 .Pp
 Additional options:
 .Bl -tag -width ".Fl r Ar rfailprob"
+.It Fl d Ar delaymsec
+Specifies the delay of the requests in milliseconds.
+Note that requests will be delayed before they are sent to the backing device.
 .It Fl e Ar error
 Specifies the error number to return on failure.
 .It Fl f
@@ -123,6 +132,8 @@ Where to begin on the original provider.
 Value of the stripesize property of the transparent provider.
 .It Fl P Ar stripeoffset
 Value of the stripeoffset property of the transparent provider.
+.It Fl q Ar rdelayprob
+Specifies read delay probability in percent.
 .It Fl r Ar rfailprob
 Specifies read failure probability in percent.
 .It Fl s Ar size
@@ -133,6 +144,8 @@ Sector size of the transparent provider.
 Specifies write failure probability in percent.
 .It Fl v
 Be more verbose.
+.It Fl x Ar wdelayprob
+Specifies write delay probability in percent.
 .It Fl z Ar physpath
 Physical path of the transparent provider.
 .El

Modified: head/sys/geom/nop/g_nop.c
==============================================================================
--- head/sys/geom/nop/g_nop.c	Wed Jul 31 17:29:14 2019	(r350470)
+++ head/sys/geom/nop/g_nop.c	Wed Jul 31 17:47:12 2019	(r350471)
@@ -74,6 +74,12 @@ struct g_class g_nop_class = {
 	.start = g_nop_start,
 };
 
+struct g_nop_delay {
+	struct callout			 dl_cal;
+	struct bio			*dl_bio;
+	TAILQ_ENTRY(g_nop_delay)	 dl_next;
+};
+
 static void
 g_nop_orphan(struct g_consumer *cp)
 {
@@ -143,16 +149,48 @@ g_nop_kerneldump(struct bio *bp, struct g_nop_softc *s
 }
 
 static void
+g_nop_pass(struct bio *cbp, struct g_geom *gp)
+{
+
+	G_NOP_LOGREQ(cbp, "Sending request.");
+	g_io_request(cbp, LIST_FIRST(&gp->consumer));
+}
+
+static void
+g_nop_pass_timeout(void *data)
+{
+	struct g_nop_softc *sc;
+	struct g_geom *gp;
+	struct g_nop_delay *gndelay;
+
+	gndelay = (struct g_nop_delay *)data;
+
+	gp = gndelay->dl_bio->bio_to->geom;
+	sc = gp->softc;
+
+	mtx_lock(&sc->sc_lock);
+	TAILQ_REMOVE(&sc->sc_head_delay, gndelay, dl_next);
+	mtx_unlock(&sc->sc_lock);
+
+	g_nop_pass(gndelay->dl_bio, gp);
+
+	g_free(data);
+}
+
+static void
 g_nop_start(struct bio *bp)
 {
 	struct g_nop_softc *sc;
 	struct g_geom *gp;
 	struct g_provider *pp;
 	struct bio *cbp;
-	u_int failprob = 0;
+	u_int failprob, delayprob, delaytime;
 
+	failprob = delayprob = 0;
+
 	gp = bp->bio_to->geom;
 	sc = gp->softc;
+
 	G_NOP_LOGREQ(bp, "Request received.");
 	mtx_lock(&sc->sc_lock);
 	switch (bp->bio_cmd) {
@@ -160,11 +198,15 @@ g_nop_start(struct bio *bp)
 		sc->sc_reads++;
 		sc->sc_readbytes += bp->bio_length;
 		failprob = sc->sc_rfailprob;
+		delayprob = sc->sc_rdelayprob;
+		delaytime = sc->sc_delaymsec;
 		break;
 	case BIO_WRITE:
 		sc->sc_writes++;
 		sc->sc_wrotebytes += bp->bio_length;
 		failprob = sc->sc_wfailprob;
+		delayprob = sc->sc_wdelayprob;
+		delaytime = sc->sc_delaymsec;
 		break;
 	case BIO_DELETE:
 		sc->sc_deletes++;
@@ -208,6 +250,7 @@ g_nop_start(struct bio *bp)
 			return;
 		}
 	}
+
 	cbp = g_clone_bio(bp);
 	if (cbp == NULL) {
 		g_io_deliver(bp, ENOMEM);
@@ -218,8 +261,33 @@ g_nop_start(struct bio *bp)
 	pp = LIST_FIRST(&gp->provider);
 	KASSERT(pp != NULL, ("NULL pp"));
 	cbp->bio_to = pp;
-	G_NOP_LOGREQ(cbp, "Sending request.");
-	g_io_request(cbp, LIST_FIRST(&gp->consumer));
+
+	if (delayprob > 0) {
+		struct g_nop_delay *gndelay;
+		u_int rval;
+
+		rval = arc4random() % 100;
+		if (rval < delayprob) {
+			gndelay = g_malloc(sizeof(*gndelay), M_NOWAIT | M_ZERO);
+			if (gndelay != NULL) {
+				callout_init(&gndelay->dl_cal, 1);
+
+				gndelay->dl_bio = cbp;
+
+				mtx_lock(&sc->sc_lock);
+				TAILQ_INSERT_TAIL(&sc->sc_head_delay, gndelay,
+				    dl_next);
+				mtx_unlock(&sc->sc_lock);
+
+				callout_reset(&gndelay->dl_cal,
+				    MSEC_2_TICKS(delaytime), g_nop_pass_timeout,
+				    gndelay);
+				return;
+			}
+		}
+	}
+
+	g_nop_pass(cbp, gp);
 }
 
 static int
@@ -238,8 +306,9 @@ g_nop_access(struct g_provider *pp, int dr, int dw, in
 
 static int
 g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
-    int ioerror, u_int rfailprob, u_int wfailprob, off_t offset, off_t size,
-    u_int secsize, off_t stripesize, off_t stripeoffset, const char *physpath)
+    int ioerror, u_int rfailprob, u_int wfailprob, u_int delaymsec, u_int rdelayprob,
+    u_int wdelayprob, off_t offset, off_t size, u_int secsize, off_t stripesize,
+    off_t stripeoffset, const char *physpath)
 {
 	struct g_nop_softc *sc;
 	struct g_geom *gp;
@@ -317,6 +386,9 @@ g_nop_create(struct gctl_req *req, struct g_class *mp,
 	sc->sc_error = ioerror;
 	sc->sc_rfailprob = rfailprob;
 	sc->sc_wfailprob = wfailprob;
+	sc->sc_delaymsec = delaymsec;
+	sc->sc_rdelayprob = rdelayprob;
+	sc->sc_wdelayprob = wdelayprob;
 	sc->sc_reads = 0;
 	sc->sc_writes = 0;
 	sc->sc_deletes = 0;
@@ -327,6 +399,7 @@ g_nop_create(struct gctl_req *req, struct g_class *mp,
 	sc->sc_cmd2s = 0;
 	sc->sc_readbytes = 0;
 	sc->sc_wrotebytes = 0;
+	TAILQ_INIT(&sc->sc_head_delay);
 	mtx_init(&sc->sc_lock, "gnop lock", NULL, MTX_DEF);
 	gp->softc = sc;
 
@@ -367,6 +440,9 @@ g_nop_providergone(struct g_provider *pp)
 	struct g_geom *gp = pp->geom;
 	struct g_nop_softc *sc = gp->softc;
 
+	KASSERT(TAILQ_EMPTY(&sc->sc_head_delay),
+	    ("delayed request list is not empty"));
+
 	gp->softc = NULL;
 	free(sc->sc_physpath, M_GEOM);
 	mtx_destroy(&sc->sc_lock);
@@ -396,6 +472,7 @@ g_nop_destroy(struct g_geom *gp, boolean_t force)
 	} else {
 		G_NOP_DEBUG(0, "Device %s removed.", gp->name);
 	}
+
 	g_wither_geom(gp, ENXIO);
 
 	return (0);
@@ -413,7 +490,7 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class 
 {
 	struct g_provider *pp;
 	intmax_t *error, *rfailprob, *wfailprob, *offset, *secsize, *size,
-	    *stripesize, *stripeoffset;
+	    *stripesize, *stripeoffset, *delaymsec, *rdelayprob, *wdelayprob;
 	const char *name, *physpath;
 	char param[16];
 	int i, *nargs;
@@ -452,6 +529,33 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class 
 		gctl_error(req, "Invalid '%s' argument", "wfailprob");
 		return;
 	}
+	delaymsec = gctl_get_paraml(req, "delaymsec", sizeof(*delaymsec));
+	if (delaymsec == NULL) {
+		gctl_error(req, "No '%s' argument", "delaymsec");
+		return;
+	}
+	if (*delaymsec < 1 && *delaymsec != -1) {
+		gctl_error(req, "Invalid '%s' argument", "delaymsec");
+		return;
+	}
+	rdelayprob = gctl_get_paraml(req, "rdelayprob", sizeof(*rdelayprob));
+	if (rdelayprob == NULL) {
+		gctl_error(req, "No '%s' argument", "rdelayprob");
+		return;
+	}
+	if (*rdelayprob < -1 || *rdelayprob > 100) {
+		gctl_error(req, "Invalid '%s' argument", "rdelayprob");
+		return;
+	}
+	wdelayprob = gctl_get_paraml(req, "wdelayprob", sizeof(*wdelayprob));
+	if (wdelayprob == NULL) {
+		gctl_error(req, "No '%s' argument", "wdelayprob");
+		return;
+	}
+	if (*wdelayprob < -1 || *wdelayprob > 100) {
+		gctl_error(req, "Invalid '%s' argument", "wdelayprob");
+		return;
+	}
 	offset = gctl_get_paraml(req, "offset", sizeof(*offset));
 	if (offset == NULL) {
 		gctl_error(req, "No '%s' argument", "offset");
@@ -518,6 +622,9 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class 
 		    *error == -1 ? EIO : (int)*error,
 		    *rfailprob == -1 ? 0 : (u_int)*rfailprob,
 		    *wfailprob == -1 ? 0 : (u_int)*wfailprob,
+		    *delaymsec == -1 ? 1 : (u_int)*delaymsec,
+		    *rdelayprob == -1 ? 0 : (u_int)*rdelayprob,
+		    *wdelayprob == -1 ? 0 : (u_int)*wdelayprob,
 		    (off_t)*offset, (off_t)*size, (u_int)*secsize,
 		    (off_t)*stripesize, (off_t)*stripeoffset,
 		    physpath) != 0) {
@@ -531,7 +638,7 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_cla
 {
 	struct g_nop_softc *sc;
 	struct g_provider *pp;
-	intmax_t *error, *rfailprob, *wfailprob;
+	intmax_t *delaymsec, *error, *rdelayprob, *rfailprob, *wdelayprob, *wfailprob;
 	const char *name;
 	char param[16];
 	int i, *nargs;
@@ -571,6 +678,34 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_cla
 		return;
 	}
 
+	delaymsec = gctl_get_paraml(req, "delaymsec", sizeof(*delaymsec));
+	if (delaymsec == NULL) {
+		gctl_error(req, "No '%s' argument", "delaymsec");
+		return;
+	}
+	if (*delaymsec < 1 && *delaymsec != -1) {
+		gctl_error(req, "Invalid '%s' argument", "delaymsec");
+		return;
+	}
+	rdelayprob = gctl_get_paraml(req, "rdelayprob", sizeof(*rdelayprob));
+	if (rdelayprob == NULL) {
+		gctl_error(req, "No '%s' argument", "rdelayprob");
+		return;
+	}
+	if (*rdelayprob < -1 || *rdelayprob > 100) {
+		gctl_error(req, "Invalid '%s' argument", "rdelayprob");
+		return;
+	}
+	wdelayprob = gctl_get_paraml(req, "wdelayprob", sizeof(*wdelayprob));
+	if (wdelayprob == NULL) {
+		gctl_error(req, "No '%s' argument", "wdelayprob");
+		return;
+	}
+	if (*wdelayprob < -1 || *wdelayprob > 100) {
+		gctl_error(req, "Invalid '%s' argument", "wdelayprob");
+		return;
+	}
+
 	for (i = 0; i < *nargs; i++) {
 		snprintf(param, sizeof(param), "arg%d", i);
 		name = gctl_get_asciiparam(req, param);
@@ -593,6 +728,12 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_cla
 			sc->sc_rfailprob = (u_int)*rfailprob;
 		if (*wfailprob != -1)
 			sc->sc_wfailprob = (u_int)*wfailprob;
+		if (*rdelayprob != -1)
+			sc->sc_rdelayprob = (u_int)*rdelayprob;
+		if (*wdelayprob != -1)
+			sc->sc_wdelayprob = (u_int)*wdelayprob;
+		if (*delaymsec != -1)
+			sc->sc_delaymsec = (u_int)*delaymsec;
 	}
 }
 
@@ -756,6 +897,11 @@ g_nop_dumpconf(struct sbuf *sb, const char *indent, st
 	    sc->sc_rfailprob);
 	sbuf_printf(sb, "%s<WriteFailProb>%u</WriteFailProb>\n", indent,
 	    sc->sc_wfailprob);
+	sbuf_printf(sb, "%s<ReadDelayedProb>%u</ReadDelayedProb>\n", indent,
+	    sc->sc_rdelayprob);
+	sbuf_printf(sb, "%s<WriteDelayedProb>%u</WriteDelayedProb>\n", indent,
+	    sc->sc_wdelayprob);
+	sbuf_printf(sb, "%s<Delay>%d</Delay>\n", indent, sc->sc_delaymsec);
 	sbuf_printf(sb, "%s<Error>%d</Error>\n", indent, sc->sc_error);
 	sbuf_printf(sb, "%s<Reads>%ju</Reads>\n", indent, sc->sc_reads);
 	sbuf_printf(sb, "%s<Writes>%ju</Writes>\n", indent, sc->sc_writes);

Modified: head/sys/geom/nop/g_nop.h
==============================================================================
--- head/sys/geom/nop/g_nop.h	Wed Jul 31 17:29:14 2019	(r350470)
+++ head/sys/geom/nop/g_nop.h	Wed Jul 31 17:47:12 2019	(r350471)
@@ -62,26 +62,34 @@
 	}								\
 } while (0)
 
+struct g_nop_delay;
+
+TAILQ_HEAD(g_nop_delay_head, g_nop_delay);
+
 struct g_nop_softc {
-	int		sc_error;
-	off_t		sc_offset;
-	off_t		sc_explicitsize;
-	off_t		sc_stripesize;
-	off_t		sc_stripeoffset;
-	u_int		sc_rfailprob;
-	u_int		sc_wfailprob;
-	uintmax_t	sc_reads;
-	uintmax_t	sc_writes;
-	uintmax_t	sc_deletes;
-	uintmax_t	sc_getattrs;
-	uintmax_t	sc_flushes;
-	uintmax_t	sc_cmd0s;
-	uintmax_t	sc_cmd1s;
-	uintmax_t	sc_cmd2s;
-	uintmax_t	sc_readbytes;
-	uintmax_t	sc_wrotebytes;
-	char*		sc_physpath;
-	struct mtx	sc_lock;
+	int			 sc_error;
+	off_t			 sc_offset;
+	off_t			 sc_explicitsize;
+	off_t			 sc_stripesize;
+	off_t			 sc_stripeoffset;
+	u_int			 sc_rfailprob;
+	u_int			 sc_wfailprob;
+	u_int			 sc_delaymsec;
+	u_int			 sc_rdelayprob;
+	u_int			 sc_wdelayprob;
+	uintmax_t		 sc_reads;
+	uintmax_t		 sc_writes;
+	uintmax_t		 sc_deletes;
+	uintmax_t		 sc_getattrs;
+	uintmax_t		 sc_flushes;
+	uintmax_t		 sc_cmd0s;
+	uintmax_t		 sc_cmd1s;
+	uintmax_t		 sc_cmd2s;
+	uintmax_t		 sc_readbytes;
+	uintmax_t		 sc_wrotebytes;
+	char			*sc_physpath;
+	struct mtx		 sc_lock;
+	struct g_nop_delay_head	 sc_head_delay;
 };
 #endif	/* _KERNEL */
 

From owner-svn-src-head@freebsd.org  Wed Jul 31 17:51:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63019A4BE7;
 Wed, 31 Jul 2019 17:51:07 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zLZM21dCz47Cm;
 Wed, 31 Jul 2019 17:51:07 +0000 (UTC)
 (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 272FB5424;
 Wed, 31 Jul 2019 17:51:07 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VHp7nv099475;
 Wed, 31 Jul 2019 17:51:07 GMT (envelope-from oshogbo@FreeBSD.org)
Received: (from oshogbo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VHp71X099474;
 Wed, 31 Jul 2019 17:51:07 GMT (envelope-from oshogbo@FreeBSD.org)
Message-Id: <201907311751.x6VHp71X099474@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to
 oshogbo@FreeBSD.org using -f
From: Mariusz Zaborski <oshogbo@FreeBSD.org>
Date: Wed, 31 Jul 2019 17:51:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350472 - head/sys/geom/nop
X-SVN-Group: head
X-SVN-Commit-Author: oshogbo
X-SVN-Commit-Paths: head/sys/geom/nop
X-SVN-Commit-Revision: 350472
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zLZM21dCz47Cm
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.12 / 15.00];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.12)[-0.120,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 17:51:07 -0000

Author: oshogbo
Date: Wed Jul 31 17:51:06 2019
New Revision: 350472
URL: https://svnweb.freebsd.org/changeset/base/350472

Log:
  gnop: style nits

Modified:
  head/sys/geom/nop/g_nop.c

Modified: head/sys/geom/nop/g_nop.c
==============================================================================
--- head/sys/geom/nop/g_nop.c	Wed Jul 31 17:47:12 2019	(r350471)
+++ head/sys/geom/nop/g_nop.c	Wed Jul 31 17:51:06 2019	(r350472)
@@ -116,6 +116,7 @@ static int
 g_nop_dumper(void *priv, void *virtual, vm_offset_t physical, off_t offset,
     size_t length)
 {
+
 	return (0);
 }
 
@@ -213,7 +214,7 @@ g_nop_start(struct bio *bp)
 		break;
 	case BIO_GETATTR:
 		sc->sc_getattrs++;
-		if (sc->sc_physpath && 
+		if (sc->sc_physpath &&
 		    g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath))
 			;
 		else if (strcmp(bp->bio_attribute, "GEOM::kerneldump") == 0)

From owner-svn-src-head@freebsd.org  Wed Jul 31 18:44:22 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47F0DA5C37;
 Wed, 31 Jul 2019 18:44:22 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zMlp1phmz4BTT;
 Wed, 31 Jul 2019 18:44:22 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B5815F74;
 Wed, 31 Jul 2019 18:44:22 +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 x6VIiMqR034118;
 Wed, 31 Jul 2019 18:44:22 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VIiKuF034112;
 Wed, 31 Jul 2019 18:44:20 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201907311844.x6VIiKuF034112@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Wed, 31 Jul 2019 18:44:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350477 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350477
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zMlp1phmz4BTT
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.33 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.33)[0.331,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 18:44:22 -0000

Author: mav
Date: Wed Jul 31 18:44:20 2019
New Revision: 350477
URL: https://svnweb.freebsd.org/changeset/base/350477

Log:
  Feature-complete NVMe Namespace Management.
  
  This adds several previously missed but important subcommands to list
  namespaces and controllers.  It also fixes few previously added but
  just found with real testing to be broken subcommands.
  
  Also while there, add possibility to explicitly specify nsid for
  `nvmecontrol identify` subcommand.  It may be useful to specify nsids
  not having own devices, for example 0xffffffff, or just newly created
  ones.
  
  MFC after:	2 weeks
  Relnotes:	yes
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/identify_ext.c
  head/sbin/nvmecontrol/ns.c
  head/sbin/nvmecontrol/nvmecontrol.8
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sbin/nvmecontrol/nvmecontrol.h

Modified: head/sbin/nvmecontrol/identify.c
==============================================================================
--- head/sbin/nvmecontrol/identify.c	Wed Jul 31 18:40:43 2019	(r350476)
+++ head/sbin/nvmecontrol/identify.c	Wed Jul 31 18:44:20 2019	(r350477)
@@ -48,13 +48,15 @@ static struct options {
 	bool		hex;
 	bool		verbose;
 	const char	*dev;
+	uint32_t	nsid;
 } opt = {
 	.hex = false,
 	.verbose = false,
 	.dev = NULL,
+	.nsid = 0,
 };
 
-static void
+void
 print_namespace(struct nvme_namespace_data *nsdata)
 {
 	uint32_t	i;
@@ -204,22 +206,24 @@ identify_ns(const struct cmd *f, int argc, char *argv[
 	int				fd, hexlength;
 	uint32_t			nsid;
 
-	/*
-	 * Check if the specified device node exists before continuing.
-	 *  This is a cleaner check for cases where the correct controller
-	 *  is specified, but an invalid namespace on that controller.
-	 */
 	open_dev(opt.dev, &fd, 1, 1);
-	close(fd);
-
-	/*
-	 * We send IDENTIFY commands to the controller, not the namespace,
-	 *  since it is an admin cmd.  The namespace ID will be specified in
-	 *  the IDENTIFY command itself.  So parse the namespace's device node
-	 *  string to get the controller substring and namespace ID.
-	 */
-	parse_ns_str(opt.dev, path, &nsid);
-	open_dev(path, &fd, 1, 1);
+	if (strstr(opt.dev, NVME_NS_PREFIX) != NULL) {
+		/*
+		 * Now we know that provided device name is valid, that is
+		 * good for error reporting if specified controller name is
+		 * valid, but namespace ID is not.  But we send IDENTIFY
+		 * commands to the controller, not the namespace, since it
+		 * is an admin cmd.  The namespace ID will be specified in
+		 * the IDENTIFY command itself.  So parse the namespace's
+		 * device node string to get the controller device substring
+		 * and namespace ID.
+		 */
+		close(fd);
+		parse_ns_str(opt.dev, path, &nsid);
+		open_dev(path, &fd, 1, 1);
+	} else {
+		nsid = opt.nsid;
+	}
 	read_namespace_data(fd, nsid, &nsdata);
 	close(fd);
 
@@ -248,10 +252,10 @@ identify(const struct cmd *f, int argc, char *argv[])
 	arg_parse(argc, argv, f);
 
 	/*
-	 * If device node contains "ns", we consider it a namespace,
-	 *  otherwise, consider it a controller.
+	 * If device node contains "ns" or nsid is specified, we consider
+	 * it a namespace request, otherwise, consider it a controller.
 	 */
-	if (strstr(opt.dev, NVME_NS_PREFIX) == NULL)
+	if (strstr(opt.dev, NVME_NS_PREFIX) == NULL && opt.nsid == 0)
 		identify_ctrlr(f, argc, argv);
 	else
 		identify_ns(f, argc, argv);
@@ -263,6 +267,8 @@ static const struct opts identify_opts[] = {
 	    "Print identiy information in hex"),
 	OPT("verbose", 'v', arg_none, opt, verbose,
 	    "More verbosity: print entire identify table"),
+	OPT("nsid", 'n', arg_uint32, opt, nsid,
+	    "Namespace ID to use if not in device name"),
 	{ NULL, 0, arg_none, NULL, NULL }
 };
 #undef OPT
@@ -275,7 +281,7 @@ static const struct args identify_args[] = {
 static struct cmd identify_cmd = {
 	.name = "identify",
 	.fn = identify,
-	.descr = "Print a human-readable summary of the IDENTIFY information",
+	.descr = "Print summary of the IDENTIFY information",
 	.ctx_size = sizeof(opt),
 	.opts = identify_opts,
 	.args = identify_args,

Modified: head/sbin/nvmecontrol/identify_ext.c
==============================================================================
--- head/sbin/nvmecontrol/identify_ext.c	Wed Jul 31 18:40:43 2019	(r350476)
+++ head/sbin/nvmecontrol/identify_ext.c	Wed Jul 31 18:44:20 2019	(r350477)
@@ -121,7 +121,7 @@ nvme_print_controller(struct nvme_controller_data *cda
 		printf("Unlimited\n");
 	else
 		printf("%ld\n", PAGE_SIZE * (1L << cdata->mdts));
-	printf("Controller ID:               0x%02x\n", cdata->ctrlr_id);
+	printf("Controller ID:               0x%04x\n", cdata->ctrlr_id);
 	printf("Version:                     %d.%d.%d\n",
 	    (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff,
 	    cdata->ver & 0xff);

Modified: head/sbin/nvmecontrol/ns.c
==============================================================================
--- head/sbin/nvmecontrol/ns.c	Wed Jul 31 18:40:43 2019	(r350476)
+++ head/sbin/nvmecontrol/ns.c	Wed Jul 31 18:44:20 2019	(r350477)
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
 
 #include <err.h>
 #include <fcntl.h>
+#include <stdbool.h>
+#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -44,10 +46,15 @@ __FBSDID("$FreeBSD$");
 /* Tables for command line parsing */
 
 static cmd_fn_t ns;
+static cmd_fn_t nsactive;
+static cmd_fn_t nsallocated;
+static cmd_fn_t nscontrollers;
 static cmd_fn_t nscreate;
 static cmd_fn_t nsdelete;
 static cmd_fn_t nsattach;
 static cmd_fn_t nsdetach;
+static cmd_fn_t nsattached;
+static cmd_fn_t nsidentify;
 
 #define NONE 0xffffffffu
 #define NONE64 0xffffffffffffffffull
@@ -55,11 +62,71 @@ static cmd_fn_t nsdetach;
 #define OPT_END	{ NULL, 0, arg_none, NULL, NULL }
 
 static struct cmd ns_cmd = {
-	.name = "ns", .fn = ns, .descr = "Namespace commands", .ctx_size = 0, .opts = NULL, .args = NULL,
+	.name = "ns",
+	.fn = ns,
+	.descr = "Namespace management commands",
+	.ctx_size = 0,
+	.opts = NULL,
+	.args = NULL,
 };
 
 CMD_COMMAND(ns_cmd);
 
+static struct active_options {
+	const char	*dev;
+} active_opt = {
+	.dev = NULL,
+};
+
+static const struct args active_args[] = {
+	{ arg_string, &active_opt.dev, "controller-id" },
+	{ arg_none, NULL, NULL },
+};
+
+static struct cmd active_cmd = {
+	.name = "active",
+	.fn = nsactive,
+	.descr = "List active (attached) namespaces",
+	.ctx_size = sizeof(active_opt),
+	.opts = NULL,
+	.args = active_args,
+};
+
+CMD_SUBCOMMAND(ns_cmd, active_cmd);
+
+static struct cmd allocated_cmd = {
+	.name = "allocated",
+	.fn = nsallocated,
+	.descr = "List allocated (created) namespaces",
+	.ctx_size = sizeof(active_opt),
+	.opts = NULL,
+	.args = active_args,
+};
+
+CMD_SUBCOMMAND(ns_cmd, allocated_cmd);
+
+static struct controllers_options {
+	const char	*dev;
+} controllers_opt = {
+	.dev = NULL,
+};
+
+static const struct args controllers_args[] = {
+	{ arg_string, &controllers_opt.dev, "controller-id" },
+	{ arg_none, NULL, NULL },
+};
+
+static struct cmd controllers_cmd = {
+	.name = "controllers",
+	.fn = nscontrollers,
+	.descr = "List all controllers in NVM subsystem",
+	.ctx_size = sizeof(controllers_opt),
+	.opts = NULL,
+	.args = controllers_args,
+};
+
+CMD_SUBCOMMAND(ns_cmd, controllers_cmd);
+
 static struct create_options {
 	uint64_t nsze;
 	uint64_t cap;
@@ -101,7 +168,7 @@ static const struct opts create_opts[] = {
 	    "PI field of FLBAS"),
 	OPT("pil", 'l', arg_uint32, create_opt, pil,
 	    "PIL field of FLBAS"),
-	OPT("flbas", 'l', arg_uint32, create_opt, flbas,
+	OPT("flbas", 'L', arg_uint32, create_opt, flbas,
 	    "Namespace formatted logical block size setting"),
 	OPT("dps", 'd', arg_uint32, create_opt, dps,
 	    "Data protection settings"),
@@ -118,7 +185,7 @@ static const struct args create_args[] = {
 static struct cmd create_cmd = {
 	.name = "create",
 	.fn = nscreate,
-	.descr = "Create a new namespace",
+	.descr = "Create a namespace",
 	.ctx_size = sizeof(create_opt),
 	.opts = create_opts,
 	.args = create_args,
@@ -148,7 +215,7 @@ static const struct args delete_args[] = {
 static struct cmd delete_cmd = {
 	.name = "delete",
 	.fn = nsdelete,
-	.descr = "Delete a new namespace",
+	.descr = "Delete a namespace",
 	.ctx_size = sizeof(delete_opt),
 	.opts = delete_opts,
 	.args = delete_args,
@@ -169,7 +236,7 @@ static struct attach_options {
 static const struct opts attach_opts[] = {
 	OPT("namespace-id", 'n', arg_uint32, attach_opt, nsid,
 	    "The namespace ID to attach"),
-	OPT("controller", 'c', arg_uint32, attach_opt, nsid,
+	OPT("controller", 'c', arg_uint32, attach_opt, ctrlrid,
 	    "The controller ID to attach"),
 	OPT_END
 };
@@ -182,7 +249,7 @@ static const struct args attach_args[] = {
 static struct cmd attach_cmd = {
 	.name = "attach",
 	.fn = nsattach,
-	.descr = "Attach a new namespace",
+	.descr = "Attach a controller to a namespace",
 	.ctx_size = sizeof(attach_opt),
 	.opts = attach_opts,
 	.args = attach_args,
@@ -190,6 +257,36 @@ static struct cmd attach_cmd = {
 
 CMD_SUBCOMMAND(ns_cmd, attach_cmd);
 
+static struct attached_options {
+	uint32_t	nsid;
+	const char	*dev;
+} attached_opt = {
+	.nsid = NONE,
+	.dev = NULL,
+};
+
+static const struct opts attached_opts[] = {
+	OPT("namespace-id", 'n', arg_uint32, attached_opt, nsid,
+	    "The namespace ID to request attached controllers"),
+	OPT_END
+};
+
+static const struct args attached_args[] = {
+	{ arg_string, &attached_opt.dev, "controller-id" },
+	{ arg_none, NULL, NULL },
+};
+
+static struct cmd attached_cmd = {
+	.name = "attached",
+	.fn = nsattached,
+	.descr = "List controllers attached to a namespace",
+	.ctx_size = sizeof(attached_opt),
+	.opts = attached_opts,
+	.args = attached_args,
+};
+
+CMD_SUBCOMMAND(ns_cmd, attached_cmd);
+
 static struct detach_options {
 	uint32_t	nsid;
 	uint32_t	ctrlrid;
@@ -203,7 +300,7 @@ static struct detach_options {
 static const struct opts detach_opts[] = {
 	OPT("namespace-id", 'n', arg_uint32, detach_opt, nsid,
 	    "The namespace ID to detach"),
-	OPT("controller", 'c', arg_uint32, detach_opt, nsid,
+	OPT("controller", 'c', arg_uint32, detach_opt, ctrlrid,
 	    "The controller ID to detach"),
 	OPT_END
 };
@@ -216,7 +313,7 @@ static const struct args detach_args[] = {
 static struct cmd detach_cmd = {
 	.name = "detach",
 	.fn = nsdetach,
-	.descr = "Detach a new namespace",
+	.descr = "Detach a controller from a namespace",
 	.ctx_size = sizeof(detach_opt),
 	.opts = detach_opts,
 	.args = detach_args,
@@ -224,9 +321,44 @@ static struct cmd detach_cmd = {
 
 CMD_SUBCOMMAND(ns_cmd, detach_cmd);
 
-#define NS_USAGE							\
-	"ns (create|delete|attach|detach)\n"
+static struct identify_options {
+	bool		hex;
+	bool		verbose;
+	const char	*dev;
+	uint32_t	nsid;
+} identify_opt = {
+	.hex = false,
+	.verbose = false,
+	.dev = NULL,
+	.nsid = NONE,
+};
 
+static const struct opts identify_opts[] = {
+	OPT("hex", 'x', arg_none, identify_opt, hex,
+	    "Print identiy information in hex"),
+	OPT("verbose", 'v', arg_none, identify_opt, verbose,
+	    "More verbosity: print entire identify table"),
+	OPT("nsid", 'n', arg_uint32, identify_opt, nsid,
+	    "The namespace ID to print IDENTIFY for"),
+	{ NULL, 0, arg_none, NULL, NULL }
+};
+
+static const struct args identify_args[] = {
+	{ arg_string, &identify_opt.dev, "controller-id" },
+	{ arg_none, NULL, NULL },
+};
+
+static struct cmd identify_cmd = {
+	.name = "identify",
+	.fn = nsidentify,
+	.descr = "Print IDENTIFY for allocated namespace",
+	.ctx_size = sizeof(identify_opt),
+	.opts = identify_opts,
+	.args = identify_args,
+};
+
+CMD_SUBCOMMAND(ns_cmd, identify_cmd);
+
 /* handles NVME_OPC_NAMESPACE_MANAGEMENT and ATTACHMENT admin cmds */
 
 struct ns_result_str {
@@ -245,6 +377,8 @@ static struct ns_result_str ns_result[] = {
 	{ 0x1a, "Namespace is not attached"},
 	{ 0x1b, "Thin provisioning not supported"},
 	{ 0x1c, "Controller list invalid"},
+	{ 0x24, "ANA Group Identifier Invalid"},
+	{ 0x25, "ANA Attach Failed"},
 	{ 0xFFFF, "Unknown"}
 };
 
@@ -261,6 +395,110 @@ get_res_str(uint16_t res)
 	return t->str;
 }
 
+static void
+nsactive(const struct cmd *f, int argc, char *argv[])
+{
+	struct nvme_pt_command	pt;
+	int	fd, i;
+	uint32_t list[1024];
+
+	if (arg_parse(argc, argv, f))
+		return;
+	open_dev(active_opt.dev, &fd, 1, 1);
+
+	memset(&pt, 0, sizeof(pt));
+	pt.cmd.opc = NVME_OPC_IDENTIFY;
+	pt.cmd.nsid = htole32(0);
+	pt.cmd.cdw10 = htole32(0x02);
+	pt.buf = list;
+	pt.len = sizeof(list);
+	pt.is_read = 1;
+	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
+		err(1, "identify request failed");
+	if (nvme_completion_is_error(&pt.cpl))
+		errx(1, "identify request returned error");
+
+	printf("Active namespaces:\n");
+	for (i = 0; list[i] != 0; i++)
+		printf("%10d\n", le32toh(list[i]));
+
+	exit(0);
+}
+
+static void
+nsallocated(const struct cmd *f, int argc, char *argv[])
+{
+	struct nvme_pt_command	pt;
+	struct nvme_controller_data cd;
+	int	fd, i;
+	uint32_t list[1024];
+
+	if (arg_parse(argc, argv, f))
+		return;
+	open_dev(active_opt.dev, &fd, 1, 1);
+	read_controller_data(fd, &cd);
+
+	/* Check that controller can execute this command. */
+	if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) &
+	    NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0)
+		errx(1, "controller does not support namespace management");
+
+	memset(&pt, 0, sizeof(pt));
+	pt.cmd.opc = NVME_OPC_IDENTIFY;
+	pt.cmd.nsid = htole32(0);
+	pt.cmd.cdw10 = htole32(0x10);
+	pt.buf = list;
+	pt.len = sizeof(list);
+	pt.is_read = 1;
+	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
+		err(1, "identify request failed");
+	if (nvme_completion_is_error(&pt.cpl))
+		errx(1, "identify request returned error");
+
+	printf("Allocated namespaces:\n");
+	for (i = 0; list[i] != 0; i++)
+		printf("%10d\n", le32toh(list[i]));
+
+	exit(0);
+}
+
+static void
+nscontrollers(const struct cmd *f, int argc, char *argv[])
+{
+	struct nvme_pt_command	pt;
+	struct nvme_controller_data cd;
+	int	fd, i, n;
+	uint16_t clist[2048];
+
+	if (arg_parse(argc, argv, f))
+		return;
+	open_dev(controllers_opt.dev, &fd, 1, 1);
+	read_controller_data(fd, &cd);
+
+	/* Check that controller can execute this command. */
+	if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) &
+	    NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0)
+		errx(1, "controller does not support namespace management");
+
+	memset(&pt, 0, sizeof(pt));
+	pt.cmd.opc = NVME_OPC_IDENTIFY;
+	pt.cmd.cdw10 = htole32(0x13);
+	pt.buf = clist;
+	pt.len = sizeof(clist);
+	pt.is_read = 1;
+	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
+		err(1, "identify request failed");
+	if (nvme_completion_is_error(&pt.cpl))
+		errx(1, "identify request returned error");
+
+	n = le16toh(clist[0]);
+	printf("NVM subsystem includes %d controller(s):\n", n);
+	for (i = 0; i < n; i++)
+		printf("  0x%04x\n", le16toh(clist[i + 1]));
+
+	exit(0);
+}
+
 /*
  * NS MGMT Command specific status values:
  * 0xa = Invalid Format
@@ -323,8 +561,7 @@ nscreate(const struct cmd *f, int argc, char *argv[])
 
 	memset(&pt, 0, sizeof(pt));
 	pt.cmd.opc = NVME_OPC_NAMESPACE_MANAGEMENT;
-
-	pt.cmd.cdw10 = 0; /* create */
+	pt.cmd.cdw10 = htole32(0); /* create */
 	pt.buf = &nsdata;
 	pt.len = sizeof(struct nvme_namespace_data);
 	pt.is_read = 0; /* passthrough writes data to ctrlr */
@@ -366,7 +603,7 @@ nsdelete(const struct cmd *f, int argc, char *argv[])
 
 	memset(&pt, 0, sizeof(pt));
 	pt.cmd.opc = NVME_OPC_NAMESPACE_MANAGEMENT;
-	pt.cmd.cdw10 = 1; /* delete */
+	pt.cmd.cdw10 = htole32(1); /* delete */
 	pt.buf = buf;
 	pt.len = sizeof(buf);
 	pt.is_read = 1;
@@ -444,7 +681,7 @@ nsattach(const struct cmd *f, int argc, char *argv[])
 
 	memset(&pt, 0, sizeof(pt));
 	pt.cmd.opc = NVME_OPC_NAMESPACE_ATTACHMENT;
-	pt.cmd.cdw10 = 0; /* attach */
+	pt.cmd.cdw10 = htole32(0); /* attach */
 	pt.cmd.nsid = attach_opt.nsid;
 	pt.buf = &clist;
 	pt.len = sizeof(clist);
@@ -471,11 +708,11 @@ nsdetach(const struct cmd *f, int argc, char *argv[])
 
 	if (arg_parse(argc, argv, f))
 		return;
-	if (attach_opt.nsid == NONE) {
+	if (detach_opt.nsid == NONE) {
 		fprintf(stderr, "No valid NSID specified\n");
 		arg_help(argc, argv, f);
 	}
-	open_dev(attach_opt.dev, &fd, 1, 1);
+	open_dev(detach_opt.dev, &fd, 1, 1);
 	read_controller_data(fd, &cd);
 
 	/* Check that controller can execute this command. */
@@ -513,7 +750,7 @@ nsdetach(const struct cmd *f, int argc, char *argv[])
 
 	memset(&pt, 0, sizeof(pt));
 	pt.cmd.opc = NVME_OPC_NAMESPACE_ATTACHMENT;
-	pt.cmd.cdw10 = 1; /* detach */
+	pt.cmd.cdw10 = htole32(1); /* detach */
 	pt.cmd.nsid = detach_opt.nsid;
 	pt.buf = &clist;
 	pt.len = sizeof(clist);
@@ -527,6 +764,115 @@ nsdetach(const struct cmd *f, int argc, char *argv[])
 		    NVME_STATUS_SC_MASK));
 	}
 	printf("namespace %d detached\n", detach_opt.nsid);
+	exit(0);
+}
+
+static void
+nsattached(const struct cmd *f, int argc, char *argv[])
+{
+	struct nvme_pt_command	pt;
+	struct nvme_controller_data cd;
+	int	fd, i, n;
+	uint16_t clist[2048];
+
+	if (arg_parse(argc, argv, f))
+		return;
+	if (attached_opt.nsid == NONE) {
+		fprintf(stderr, "No valid NSID specified\n");
+		arg_help(argc, argv, f);
+	}
+	open_dev(attached_opt.dev, &fd, 1, 1);
+	read_controller_data(fd, &cd);
+
+	/* Check that controller can execute this command. */
+	if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) &
+	    NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0)
+		errx(1, "controller does not support namespace management");
+
+	memset(&pt, 0, sizeof(pt));
+	pt.cmd.opc = NVME_OPC_IDENTIFY;
+	pt.cmd.nsid = htole32(attached_opt.nsid);
+	pt.cmd.cdw10 = htole32(0x12);
+	pt.buf = clist;
+	pt.len = sizeof(clist);
+	pt.is_read = 1;
+	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
+		err(1, "identify request failed");
+	if (nvme_completion_is_error(&pt.cpl))
+		errx(1, "identify request returned error");
+
+	n = le16toh(clist[0]);
+	printf("Attached %d controller(s):\n", n);
+	for (i = 0; i < n; i++)
+		printf("  0x%04x\n", le16toh(clist[i + 1]));
+
+	exit(0);
+}
+
+static void
+nsidentify(const struct cmd *f, int argc, char *argv[])
+{
+	struct nvme_pt_command	pt;
+	struct nvme_controller_data cd;
+	struct nvme_namespace_data nsdata;
+	uint8_t	*data;
+	int	fd;
+	u_int	i;
+
+	if (arg_parse(argc, argv, f))
+		return;
+	if (identify_opt.nsid == NONE) {
+		fprintf(stderr, "No valid NSID specified\n");
+		arg_help(argc, argv, f);
+	}
+	open_dev(identify_opt.dev, &fd, 1, 1);
+	read_controller_data(fd, &cd);
+
+	/* Check that controller can execute this command. */
+	if (((cd.oacs >> NVME_CTRLR_DATA_OACS_NSMGMT_SHIFT) &
+	    NVME_CTRLR_DATA_OACS_NSMGMT_MASK) == 0)
+		errx(1, "controller does not support namespace management");
+
+	memset(&pt, 0, sizeof(pt));
+	pt.cmd.opc = NVME_OPC_IDENTIFY;
+	pt.cmd.nsid = htole32(identify_opt.nsid);
+	pt.cmd.cdw10 = htole32(0x11);
+	pt.buf = &nsdata;
+	pt.len = sizeof(nsdata);
+	pt.is_read = 1;
+
+	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
+		err(1, "identify request failed");
+
+	if (nvme_completion_is_error(&pt.cpl))
+		errx(1, "identify request returned error");
+
+	close(fd);
+
+	data = (uint8_t *)&nsdata;
+	for (i = 0; i < sizeof(nsdata); i++) {
+		if (data[i] != 0)
+			break;
+	}
+	if (i == sizeof(nsdata))
+		errx(1, "namespace %d is not allocated", identify_opt.nsid);
+
+	/* Convert data to host endian */
+	nvme_namespace_data_swapbytes(&nsdata);
+
+	if (identify_opt.hex) {
+		i = sizeof(struct nvme_namespace_data);
+		if (!identify_opt.verbose) {
+			for (; i > 384; i--) {
+				if (data[i - 1] != 0)
+					break;
+			}
+		}
+		print_hex(&nsdata, i);
+		exit(0);
+	}
+
+	print_namespace(&nsdata);
 	exit(0);
 }
 

Modified: head/sbin/nvmecontrol/nvmecontrol.8
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.8	Wed Jul 31 18:40:43 2019	(r350476)
+++ head/sbin/nvmecontrol/nvmecontrol.8	Wed Jul 31 18:44:20 2019	(r350477)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 7, 2018
+.Dd July 31, 2019
 .Dt NVMECONTROL 8
 .Os
 .Sh NAME
@@ -69,6 +69,51 @@
 .Aq device id
 .Aq namespace id
 .Nm
+.Ic ns active
+.Aq device id
+.Nm
+.Ic ns allocated
+.Aq device id
+.Nm
+.Ic ns attach
+.Aq Fl n Ar nsid
+.Aq Fl c Ar cntid
+.Aq device id
+.Nm
+.Ic ns attached
+.Aq Fl n Ar nsid
+.Aq device id
+.Nm
+.Ic ns controllers
+.Aq device id
+.Nm
+.Ic ns create
+.Aq Fl s Ar nsze
+.Op Fl c Ar ncap
+.Op Fl f Ar lbaf
+.Op Fl m Ar mset
+.Op Fl n Ar nmic
+.Op Fl p Ar pi
+.Op Fl l Ar pil
+.Op Fl L Ar flbas
+.Op Fl d Ar dps
+.Aq device id
+.Nm
+.Ic ns delete
+.Aq Fl n Ar nsid
+.Aq device id
+.Nm
+.Ic ns detach
+.Aq Fl n Ar nsid
+.Aq Fl c Ar cntid
+.Aq device id
+.Nm
+.Ic ns identify
+.Op Fl v
+.Op Fl x
+.Aq Fl n Ar nsid
+.Aq device id
+.Nm
 .Ic firmware
 .Op Fl s Ar slot
 .Op Fl f Ar path_to_firmware
@@ -143,6 +188,10 @@ will list all valid vendors and pages.
 will print the page as hex.
 .Fl b
 will print the binary data for the page.
+.Ss ns
+Various namespace management commands.
+If namespace management is supported by device, allow list, create and delete
+namespaces, list, attach and detach controllers to namespaces.
 .Ss format
 Format either specified namespace, or all namespaces of specified controller,
 using specified parameters:

Modified: head/sbin/nvmecontrol/nvmecontrol.c
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.c	Wed Jul 31 18:40:43 2019	(r350476)
+++ head/sbin/nvmecontrol/nvmecontrol.c	Wed Jul 31 18:44:20 2019	(r350477)
@@ -126,6 +126,7 @@ read_namespace_data(int fd, uint32_t nsid, struct nvme
 	memset(&pt, 0, sizeof(pt));
 	pt.cmd.opc = NVME_OPC_IDENTIFY;
 	pt.cmd.nsid = htole32(nsid);
+	pt.cmd.cdw10 = htole32(0);
 	pt.buf = nsdata;
 	pt.len = sizeof(*nsdata);
 	pt.is_read = 1;

Modified: head/sbin/nvmecontrol/nvmecontrol.h
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.h	Wed Jul 31 18:40:43 2019	(r350476)
+++ head/sbin/nvmecontrol/nvmecontrol.h	Wed Jul 31 18:44:20 2019	(r350477)
@@ -73,6 +73,7 @@ void parse_ns_str(const char *ns_str, char *ctrlr_str,
 void read_controller_data(int fd, struct nvme_controller_data *cdata);
 void read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdata);
 void print_hex(void *data, uint32_t length);
+void print_namespace(struct nvme_namespace_data *nsdata);
 void read_logpage(int fd, uint8_t log_page, uint32_t nsid, void *payload,
     uint32_t payload_size);
 void print_temp(uint16_t t);

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:16:49 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCF3EA624F;
 Wed, 31 Jul 2019 19:16:49 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zNTF4cDPz4Csm;
 Wed, 31 Jul 2019 19:16:49 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 950726503;
 Wed, 31 Jul 2019 19:16:49 +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 x6VJGneu051758;
 Wed, 31 Jul 2019 19:16:49 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VJGnjo051757;
 Wed, 31 Jul 2019 19:16:49 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907311916.x6VJGnjo051757@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Wed, 31 Jul 2019 19:16:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350478 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350478
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zNTF4cDPz4Csm
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.39 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.39)[0.386,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:16:49 -0000

Author: kib
Date: Wed Jul 31 19:16:49 2019
New Revision: 350478
URL: https://svnweb.freebsd.org/changeset/base/350478

Log:
  Fix handling of transient casueword(9) failures in do_sem_wait().
  
  In particular, restart should be only done when the failure is
  transient.  For this, recheck the count1 value after the operation.
  
  Note that do_sem_wait() is older usem interface.
  
  Reported and tested by:	bdrewery
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Wed Jul 31 18:44:20 2019	(r350477)
+++ head/sys/kern/kern_umtx.c	Wed Jul 31 19:16:49 2019	(r350478)
@@ -3229,7 +3229,8 @@ again:
 	rv = casueword32(&sem->_has_waiters, 0, &count1, 1);
 	if (rv == 0)
 		rv1 = fueword32(&sem->_count, &count);
-	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) {
+	if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) ||
+	    (rv == 1 && count1 == 0)) {
 		umtxq_lock(&uq->uq_key);
 		umtxq_unbusy(&uq->uq_key);
 		umtxq_remove(uq);

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:20:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99CB5A63A8;
 Wed, 31 Jul 2019 19:20:06 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zNY23TM8z4D4q;
 Wed, 31 Jul 2019 19:20: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 550236519;
 Wed, 31 Jul 2019 19:20: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 x6VJK6p1051986;
 Wed, 31 Jul 2019 19:20:06 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VJK6wA051985;
 Wed, 31 Jul 2019 19:20:06 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907311920.x6VJK6wA051985@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Wed, 31 Jul 2019 19:20:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350479 - head/sys/compat/freebsd32
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/compat/freebsd32
X-SVN-Commit-Revision: 350479
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zNY23TM8z4D4q
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.39 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.39)[0.386,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:20:06 -0000

Author: kib
Date: Wed Jul 31 19:20:05 2019
New Revision: 350479
URL: https://svnweb.freebsd.org/changeset/base/350479

Log:
  freebsd32 shims for copy_file_range(2).
  
  Reviewed by:	brooks, rmacklem (previous version)
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D21092

Modified:
  head/sys/compat/freebsd32/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==============================================================================
--- head/sys/compat/freebsd32/syscalls.master	Wed Jul 31 19:16:49 2019	(r350478)
+++ head/sys/compat/freebsd32/syscalls.master	Wed Jul 31 19:20:05 2019	(r350479)
@@ -1147,5 +1147,8 @@
 				    size_t bufsize); }
 568	AUE_UNLINKAT	NOPROTO { int funlinkat(int dfd, const char *path, int fd, \
 				    int flag); }
+569	AUE_NULL	NOPROTO	{ ssize_t copy_file_range(int infd, \
+				    off_t *inoffp, int outfd, off_t *outoffp, \
+				    size_t len, unsigned int flags); }
 
 ; vim: syntax=off

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:20:41 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 293E1A64AF;
 Wed, 31 Jul 2019 19:20:41 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zNYj0L31z4DFq;
 Wed, 31 Jul 2019 19:20:41 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E15266522;
 Wed, 31 Jul 2019 19:20: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 x6VJKehh052059;
 Wed, 31 Jul 2019 19:20:40 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VJKe0x052055;
 Wed, 31 Jul 2019 19:20:40 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907311920.x6VJKe0x052055@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Wed, 31 Jul 2019 19:20:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350480 - head/sys/compat/freebsd32
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/compat/freebsd32
X-SVN-Commit-Revision: 350480
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zNYj0L31z4DFq
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.38 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.38)[0.378,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:20:41 -0000

Author: kib
Date: Wed Jul 31 19:20:39 2019
New Revision: 350480
URL: https://svnweb.freebsd.org/changeset/base/350480

Log:
  Regen.

Modified:
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_syscall.h	Wed Jul 31 19:20:05 2019	(r350479)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h	Wed Jul 31 19:20:39 2019	(r350480)
@@ -495,4 +495,5 @@
 #define	FREEBSD32_SYS_fhlinkat	566
 #define	FREEBSD32_SYS_fhreadlink	567
 #define	FREEBSD32_SYS_funlinkat	568
-#define	FREEBSD32_SYS_MAXSYSCALL	569
+#define	FREEBSD32_SYS_copy_file_range	569
+#define	FREEBSD32_SYS_MAXSYSCALL	570

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_syscalls.c	Wed Jul 31 19:20:05 2019	(r350479)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c	Wed Jul 31 19:20:39 2019	(r350480)
@@ -605,4 +605,5 @@ const char *freebsd32_syscallnames[] = {
 	"fhlinkat",			/* 566 = fhlinkat */
 	"fhreadlink",			/* 567 = fhreadlink */
 	"funlinkat",			/* 568 = funlinkat */
+	"copy_file_range",			/* 569 = copy_file_range */
 };

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_sysent.c	Wed Jul 31 19:20:05 2019	(r350479)
+++ head/sys/compat/freebsd32/freebsd32_sysent.c	Wed Jul 31 19:20:39 2019	(r350480)
@@ -652,4 +652,5 @@ struct sysent freebsd32_sysent[] = {
 	{ AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 566 = fhlinkat */
 	{ AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 567 = fhreadlink */
 	{ AS(funlinkat_args), (sy_call_t *)sys_funlinkat, AUE_UNLINKAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 568 = funlinkat */
+	{ AS(copy_file_range_args), (sy_call_t *)sys_copy_file_range, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 569 = copy_file_range */
 };

Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_systrace_args.c	Wed Jul 31 19:20:05 2019	(r350479)
+++ head/sys/compat/freebsd32/freebsd32_systrace_args.c	Wed Jul 31 19:20:39 2019	(r350480)
@@ -3320,6 +3320,18 @@ systrace_args(int sysnum, void *params, uint64_t *uarg
 		*n_args = 4;
 		break;
 	}
+	/* copy_file_range */
+	case 569: {
+		struct copy_file_range_args *p = params;
+		iarg[0] = p->infd; /* int */
+		uarg[1] = (intptr_t) p->inoffp; /* off_t * */
+		iarg[2] = p->outfd; /* int */
+		uarg[3] = (intptr_t) p->outoffp; /* off_t * */
+		uarg[4] = p->len; /* size_t */
+		uarg[5] = p->flags; /* unsigned int */
+		*n_args = 6;
+		break;
+	}
 	default:
 		*n_args = 0;
 		break;
@@ -8934,6 +8946,31 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d
 			break;
 		};
 		break;
+	/* copy_file_range */
+	case 569:
+		switch(ndx) {
+		case 0:
+			p = "int";
+			break;
+		case 1:
+			p = "userland off_t *";
+			break;
+		case 2:
+			p = "int";
+			break;
+		case 3:
+			p = "userland off_t *";
+			break;
+		case 4:
+			p = "size_t";
+			break;
+		case 5:
+			p = "unsigned int";
+			break;
+		default:
+			break;
+		};
+		break;
 	default:
 		break;
 	};
@@ -10807,6 +10844,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *
 	case 568:
 		if (ndx == 0 || ndx == 1)
 			p = "int";
+		break;
+	/* copy_file_range */
+	case 569:
+		if (ndx == 0 || ndx == 1)
+			p = "ssize_t";
 		break;
 	default:
 		break;

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:27:24 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9494EA67C4;
 Wed, 31 Jul 2019 19:27:24 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zNjS49Ffz4DgG;
 Wed, 31 Jul 2019 19:27:24 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7017D66DB;
 Wed, 31 Jul 2019 19:27: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 x6VJROrj057996;
 Wed, 31 Jul 2019 19:27:24 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VJRKah057978;
 Wed, 31 Jul 2019 19:27:20 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907311927.x6VJRKah057978@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Wed, 31 Jul 2019 19:27:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350481 - head/lib/libthr/thread
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/lib/libthr/thread
X-SVN-Commit-Revision: 350481
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zNjS49Ffz4DgG
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.35 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.35)[0.352,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:27:24 -0000

Author: kib
Date: Wed Jul 31 19:27:20 2019
New Revision: 350481
URL: https://svnweb.freebsd.org/changeset/base/350481

Log:
  Avoid conflicts with libc symbols in libthr jump table.
  
  In some corner cases of static linking and unexpected libraries order
  on the linker command line, libc symbol might preempt the same libthr
  symbol, in which case libthr jump table points back to libc causing
  either infinite recursion or loop.  Handle all of such symbols by
  using private libthr names for them, ensuring that the right pointers
  are installed into the table.
  
  In collaboration with: arichardson
  PR:	239475
  Tested by:	pho
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D21088

Modified:
  head/lib/libthr/thread/thr_attr.c
  head/lib/libthr/thread/thr_cancel.c
  head/lib/libthr/thread/thr_clean.c
  head/lib/libthr/thread/thr_cond.c
  head/lib/libthr/thread/thr_detach.c
  head/lib/libthr/thread/thr_equal.c
  head/lib/libthr/thread/thr_exit.c
  head/lib/libthr/thread/thr_fork.c
  head/lib/libthr/thread/thr_getthreadid_np.c
  head/lib/libthr/thread/thr_init.c
  head/lib/libthr/thread/thr_join.c
  head/lib/libthr/thread/thr_kill.c
  head/lib/libthr/thread/thr_main_np.c
  head/lib/libthr/thread/thr_mutex.c
  head/lib/libthr/thread/thr_mutexattr.c
  head/lib/libthr/thread/thr_once.c
  head/lib/libthr/thread/thr_private.h
  head/lib/libthr/thread/thr_rwlock.c
  head/lib/libthr/thread/thr_self.c
  head/lib/libthr/thread/thr_sig.c
  head/lib/libthr/thread/thr_spec.c

Modified: head/lib/libthr/thread/thr_attr.c
==============================================================================
--- head/lib/libthr/thread/thr_attr.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_attr.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -109,10 +109,11 @@ __FBSDID("$FreeBSD$");
 
 static size_t	_get_kern_cpuset_size(void);
 
-__weak_reference(_pthread_attr_destroy, pthread_attr_destroy);
+__weak_reference(_thr_attr_destroy, _pthread_attr_destroy);
+__weak_reference(_thr_attr_destroy, pthread_attr_destroy);
 
 int
-_pthread_attr_destroy(pthread_attr_t *attr)
+_thr_attr_destroy(pthread_attr_t *attr)
 {
 	int	ret;
 
@@ -136,10 +137,11 @@ _pthread_attr_destroy(pthread_attr_t *attr)
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_get_np, pthread_attr_get_np);
+__weak_reference(_thr_attr_get_np, pthread_attr_get_np);
+__weak_reference(_thr_attr_get_np, _pthread_attr_get_np);
 
 int
-_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr)
+_thr_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr)
 {
 	struct pthread *curthread;
 	struct pthread_attr attr, *dst;
@@ -173,10 +175,11 @@ _pthread_attr_get_np(pthread_t pthread, pthread_attr_t
 	return (ret);
 }
 
-__weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate);
+__weak_reference(_thr_attr_getdetachstate, pthread_attr_getdetachstate);
+__weak_reference(_thr_attr_getdetachstate, _pthread_attr_getdetachstate);
 
 int
-_pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
+_thr_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
 {
 	int	ret;
 
@@ -196,10 +199,11 @@ _pthread_attr_getdetachstate(const pthread_attr_t *att
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getguardsize, pthread_attr_getguardsize);
+__weak_reference(_thr_attr_getguardsize, pthread_attr_getguardsize);
+__weak_reference(_thr_attr_getguardsize, _pthread_attr_getguardsize);
 
 int
-_pthread_attr_getguardsize(const pthread_attr_t * __restrict attr,
+_thr_attr_getguardsize(const pthread_attr_t * __restrict attr,
     size_t * __restrict guardsize)
 {
 	int	ret;
@@ -215,10 +219,11 @@ _pthread_attr_getguardsize(const pthread_attr_t * __re
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getinheritsched, pthread_attr_getinheritsched);
+__weak_reference(_thr_attr_getinheritsched, pthread_attr_getinheritsched);
+__weak_reference(_thr_attr_getinheritsched, _pthread_attr_getinheritsched);
 
 int
-_pthread_attr_getinheritsched(const pthread_attr_t * __restrict attr,
+_thr_attr_getinheritsched(const pthread_attr_t * __restrict attr,
     int * __restrict sched_inherit)
 {
 	int ret = 0;
@@ -231,10 +236,11 @@ _pthread_attr_getinheritsched(const pthread_attr_t * _
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam);
+__weak_reference(_thr_attr_getschedparam, pthread_attr_getschedparam);
+__weak_reference(_thr_attr_getschedparam, _pthread_attr_getschedparam);
 
 int
-_pthread_attr_getschedparam(const pthread_attr_t * __restrict attr,
+_thr_attr_getschedparam(const pthread_attr_t * __restrict attr,
     struct sched_param * __restrict param)
 {
 	int ret = 0;
@@ -247,10 +253,11 @@ _pthread_attr_getschedparam(const pthread_attr_t * __r
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getschedpolicy, pthread_attr_getschedpolicy);
+__weak_reference(_thr_attr_getschedpolicy, pthread_attr_getschedpolicy);
+__weak_reference(_thr_attr_getschedpolicy, _pthread_attr_getschedpolicy);
 
 int
-_pthread_attr_getschedpolicy(const pthread_attr_t * __restrict attr,
+_thr_attr_getschedpolicy(const pthread_attr_t * __restrict attr,
     int * __restrict policy)
 {
 	int ret = 0;
@@ -263,10 +270,11 @@ _pthread_attr_getschedpolicy(const pthread_attr_t * __
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getscope, pthread_attr_getscope);
+__weak_reference(_thr_attr_getscope, pthread_attr_getscope);
+__weak_reference(_thr_attr_getscope, _pthread_attr_getscope);
 
 int
-_pthread_attr_getscope(const pthread_attr_t * __restrict attr,
+_thr_attr_getscope(const pthread_attr_t * __restrict attr,
     int * __restrict contentionscope)
 {
 	int ret = 0;
@@ -286,8 +294,7 @@ __weak_reference(_pthread_attr_getstack, pthread_attr_
 
 int
 _pthread_attr_getstack(const pthread_attr_t * __restrict attr,
-                        void ** __restrict stackaddr,
-                        size_t * __restrict stacksize)
+    void ** __restrict stackaddr, size_t * __restrict stacksize)
 {
 	int     ret;
 
@@ -304,10 +311,11 @@ _pthread_attr_getstack(const pthread_attr_t * __restri
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getstackaddr, pthread_attr_getstackaddr);
+__weak_reference(_thr_attr_getstackaddr, pthread_attr_getstackaddr);
+__weak_reference(_thr_attr_getstackaddr, _pthread_attr_getstackaddr);
 
 int
-_pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
+_thr_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
 {
 	int	ret;
 
@@ -322,10 +330,11 @@ _pthread_attr_getstackaddr(const pthread_attr_t *attr,
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_getstacksize, pthread_attr_getstacksize);
+__weak_reference(_thr_attr_getstacksize, pthread_attr_getstacksize);
+__weak_reference(_thr_attr_getstacksize, _pthread_attr_getstacksize);
 
 int
-_pthread_attr_getstacksize(const pthread_attr_t * __restrict attr,
+_thr_attr_getstacksize(const pthread_attr_t * __restrict attr,
     size_t * __restrict stacksize)
 {
 	int	ret;
@@ -341,10 +350,11 @@ _pthread_attr_getstacksize(const pthread_attr_t * __re
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_init, pthread_attr_init);
+__weak_reference(_thr_attr_init, pthread_attr_init);
+__weak_reference(_thr_attr_init, _pthread_attr_init);
 
 int
-_pthread_attr_init(pthread_attr_t *attr)
+_thr_attr_init(pthread_attr_t *attr)
 {
 	int	ret;
 	pthread_attr_t	pattr;
@@ -382,10 +392,11 @@ _pthread_attr_setcreatesuspend_np(pthread_attr_t *attr
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setdetachstate, pthread_attr_setdetachstate);
+__weak_reference(_thr_attr_setdetachstate, pthread_attr_setdetachstate);
+__weak_reference(_thr_attr_setdetachstate, _pthread_attr_setdetachstate);
 
 int
-_pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
+_thr_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
 {
 	int	ret;
 
@@ -407,10 +418,11 @@ _pthread_attr_setdetachstate(pthread_attr_t *attr, int
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setguardsize, pthread_attr_setguardsize);
+__weak_reference(_thr_attr_setguardsize, pthread_attr_setguardsize);
+__weak_reference(_thr_attr_setguardsize, _pthread_attr_setguardsize);
 
 int
-_pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
+_thr_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
 {
 	int	ret;
 
@@ -425,10 +437,11 @@ _pthread_attr_setguardsize(pthread_attr_t *attr, size_
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setinheritsched, pthread_attr_setinheritsched);
+__weak_reference(_thr_attr_setinheritsched, pthread_attr_setinheritsched);
+__weak_reference(_thr_attr_setinheritsched, _pthread_attr_setinheritsched);
 
 int
-_pthread_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit)
+_thr_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit)
 {
 	int ret = 0;
 
@@ -443,10 +456,11 @@ _pthread_attr_setinheritsched(pthread_attr_t *attr, in
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setschedparam, pthread_attr_setschedparam);
+__weak_reference(_thr_attr_setschedparam, pthread_attr_setschedparam);
+__weak_reference(_thr_attr_setschedparam, _pthread_attr_setschedparam);
 
 int
-_pthread_attr_setschedparam(pthread_attr_t * __restrict attr,
+_thr_attr_setschedparam(pthread_attr_t * __restrict attr,
     const struct sched_param * __restrict param)
 {
 	int policy;
@@ -476,10 +490,11 @@ _pthread_attr_setschedparam(pthread_attr_t * __restric
 	return (0);
 }
 
-__weak_reference(_pthread_attr_setschedpolicy, pthread_attr_setschedpolicy);
+__weak_reference(_thr_attr_setschedpolicy, pthread_attr_setschedpolicy);
+__weak_reference(_thr_attr_setschedpolicy, _pthread_attr_setschedpolicy);
 
 int
-_pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
+_thr_attr_setschedpolicy(pthread_attr_t *attr, int policy)
 {
 	int ret = 0;
 
@@ -494,10 +509,11 @@ _pthread_attr_setschedpolicy(pthread_attr_t *attr, int
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setscope, pthread_attr_setscope);
+__weak_reference(_thr_attr_setscope, pthread_attr_setscope);
+__weak_reference(_thr_attr_setscope, _pthread_attr_setscope);
 
 int
-_pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
+_thr_attr_setscope(pthread_attr_t *attr, int contentionscope)
 {
 	int ret = 0;
 
@@ -536,10 +552,11 @@ _pthread_attr_setstack(pthread_attr_t *attr, void *sta
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setstackaddr, pthread_attr_setstackaddr);
+__weak_reference(_thr_attr_setstackaddr, pthread_attr_setstackaddr);
+__weak_reference(_thr_attr_setstackaddr, _pthread_attr_setstackaddr);
 
 int
-_pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
+_thr_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
 {
 	int	ret;
 
@@ -554,10 +571,11 @@ _pthread_attr_setstackaddr(pthread_attr_t *attr, void 
 	return(ret);
 }
 
-__weak_reference(_pthread_attr_setstacksize, pthread_attr_setstacksize);
+__weak_reference(_thr_attr_setstacksize, pthread_attr_setstacksize);
+__weak_reference(_thr_attr_setstacksize, _pthread_attr_setstacksize);
 
 int
-_pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
+_thr_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
 {
 	int	ret;
 

Modified: head/lib/libthr/thread/thr_cancel.c
==============================================================================
--- head/lib/libthr/thread/thr_cancel.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_cancel.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -35,10 +35,14 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_cancel, pthread_cancel);
-__weak_reference(_pthread_setcancelstate, pthread_setcancelstate);
-__weak_reference(_pthread_setcanceltype, pthread_setcanceltype);
-__weak_reference(_pthread_testcancel, pthread_testcancel);
+__weak_reference(_thr_cancel, pthread_cancel);
+__weak_reference(_thr_cancel, _pthread_cancel);
+__weak_reference(_thr_setcancelstate, pthread_setcancelstate);
+__weak_reference(_thr_setcancelstate, _pthread_setcancelstate);
+__weak_reference(_thr_setcanceltype, pthread_setcanceltype);
+__weak_reference(_thr_setcanceltype, _pthread_setcanceltype);
+__weak_reference(_Tthr_testcancel, pthread_testcancel);
+__weak_reference(_Tthr_testcancel, _pthread_testcancel);
 
 static inline void
 testcancel(struct pthread *curthread)
@@ -55,7 +59,7 @@ _thr_testcancel(struct pthread *curthread)
 }
 
 int
-_pthread_cancel(pthread_t pthread)
+_thr_cancel(pthread_t pthread)
 {
 	struct pthread *curthread = _get_curthread();
 	int ret;
@@ -77,7 +81,7 @@ _pthread_cancel(pthread_t pthread)
 }
 
 int
-_pthread_setcancelstate(int state, int *oldstate)
+_thr_setcancelstate(int state, int *oldstate)
 {
 	struct pthread *curthread = _get_curthread();
 	int oldval;
@@ -104,7 +108,7 @@ _pthread_setcancelstate(int state, int *oldstate)
 }
 
 int
-_pthread_setcanceltype(int type, int *oldtype)
+_thr_setcanceltype(int type, int *oldtype)
 {
 	struct pthread	*curthread = _get_curthread();
 	int oldval;
@@ -130,7 +134,7 @@ _pthread_setcanceltype(int type, int *oldtype)
 }
 
 void
-_pthread_testcancel(void)
+_Tthr_testcancel(void)
 {
 	struct pthread *curthread;
 

Modified: head/lib/libthr/thread/thr_clean.c
==============================================================================
--- head/lib/libthr/thread/thr_clean.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_clean.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -46,12 +46,18 @@ __FBSDID("$FreeBSD$");
 #undef pthread_cleanup_pop
 
 /* old binary compatible interfaces */
-__weak_reference(_pthread_cleanup_push, pthread_cleanup_push);
-__weak_reference(_pthread_cleanup_pop, pthread_cleanup_pop);
+__weak_reference(_thr_cleanup_pop, pthread_cleanup_pop);
+__weak_reference(_thr_cleanup_pop, _pthread_cleanup_pop);
+__weak_reference(_thr_cleanup_push, pthread_cleanup_push);
+__weak_reference(_thr_cleanup_push, _pthread_cleanup_push);
 
+/* help static linking when libc symbols have preference */
+__weak_reference(__thr_cleanup_push_imp, __pthread_cleanup_push_imp);
+__weak_reference(__thr_cleanup_pop_imp, __pthread_cleanup_pop_imp);
+
 void
-__pthread_cleanup_push_imp(void (*routine)(void *), void *arg,
-	struct _pthread_cleanup_info *info)
+__thr_cleanup_push_imp(void (*routine)(void *), void *arg,
+    struct _pthread_cleanup_info *info)
 {
 	struct pthread	*curthread = _get_curthread();
 	struct pthread_cleanup *newbuf;
@@ -65,7 +71,7 @@ __pthread_cleanup_push_imp(void (*routine)(void *), vo
 }
 
 void
-__pthread_cleanup_pop_imp(int execute)
+__thr_cleanup_pop_imp(int execute)
 {
 	struct pthread	*curthread = _get_curthread();
 	struct pthread_cleanup *old;
@@ -80,7 +86,7 @@ __pthread_cleanup_pop_imp(int execute)
 }
 
 void
-_pthread_cleanup_push(void (*routine) (void *), void *arg)
+_thr_cleanup_push(void (*routine)(void *), void *arg)
 {
 	struct pthread	*curthread = _get_curthread();
 	struct pthread_cleanup *newbuf;
@@ -98,7 +104,7 @@ _pthread_cleanup_push(void (*routine) (void *), void *
 }
 
 void
-_pthread_cleanup_pop(int execute)
+_thr_cleanup_pop(int execute)
 {
 	__pthread_cleanup_pop_imp(execute);
 }

Modified: head/lib/libthr/thread/thr_cond.c
==============================================================================
--- head/lib/libthr/thread/thr_cond.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_cond.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -49,7 +49,6 @@ _Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZ
 /*
  * Prototypes
  */
-int	__pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
 int	__pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 		       const struct timespec * abstime);
 static int cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
@@ -63,14 +62,19 @@ static int cond_broadcast_common(pthread_cond_t *cond)
  * versions are not and are provided for libc internal usage (which
  * shouldn't introduce cancellation points).
  */
-__weak_reference(__pthread_cond_wait, pthread_cond_wait);
+__weak_reference(__thr_cond_wait, pthread_cond_wait);
+__weak_reference(__thr_cond_wait, __pthread_cond_wait);
+__weak_reference(_thr_cond_wait, _pthread_cond_wait);
 __weak_reference(__pthread_cond_timedwait, pthread_cond_timedwait);
+__weak_reference(_thr_cond_init, pthread_cond_init);
+__weak_reference(_thr_cond_init, _pthread_cond_init);
+__weak_reference(_thr_cond_destroy, pthread_cond_destroy);
+__weak_reference(_thr_cond_destroy, _pthread_cond_destroy);
+__weak_reference(_thr_cond_signal, pthread_cond_signal);
+__weak_reference(_thr_cond_signal, _pthread_cond_signal);
+__weak_reference(_thr_cond_broadcast, pthread_cond_broadcast);
+__weak_reference(_thr_cond_broadcast, _pthread_cond_broadcast);
 
-__weak_reference(_pthread_cond_init, pthread_cond_init);
-__weak_reference(_pthread_cond_destroy, pthread_cond_destroy);
-__weak_reference(_pthread_cond_signal, pthread_cond_signal);
-__weak_reference(_pthread_cond_broadcast, pthread_cond_broadcast);
-
 #define CV_PSHARED(cvp)	(((cvp)->kcond.c_flags & USYNC_PROCESS_SHARED) != 0)
 
 static void
@@ -149,7 +153,7 @@ init_static(struct pthread *thread, pthread_cond_t *co
 	}
 
 int
-_pthread_cond_init(pthread_cond_t * __restrict cond,
+_thr_cond_init(pthread_cond_t * __restrict cond,
     const pthread_condattr_t * __restrict cond_attr)
 {
 
@@ -158,7 +162,7 @@ _pthread_cond_init(pthread_cond_t * __restrict cond,
 }
 
 int
-_pthread_cond_destroy(pthread_cond_t *cond)
+_thr_cond_destroy(pthread_cond_t *cond)
 {
 	struct pthread_cond *cvp;
 	int error;
@@ -377,14 +381,14 @@ cond_wait_common(pthread_cond_t *cond, pthread_mutex_t
 }
 
 int
-_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+_thr_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
 {
 
 	return (cond_wait_common(cond, mutex, NULL, 0));
 }
 
 int
-__pthread_cond_wait(pthread_cond_t * __restrict cond,
+__thr_cond_wait(pthread_cond_t * __restrict cond,
     pthread_mutex_t * __restrict mutex)
 {
 
@@ -392,7 +396,7 @@ __pthread_cond_wait(pthread_cond_t * __restrict cond,
 }
 
 int
-_pthread_cond_timedwait(pthread_cond_t * __restrict cond,
+_thr_cond_timedwait(pthread_cond_t * __restrict cond,
     pthread_mutex_t * __restrict mutex,
     const struct timespec * __restrict abstime)
 {
@@ -541,14 +545,14 @@ cond_broadcast_common(pthread_cond_t *cond)
 }
 
 int
-_pthread_cond_signal(pthread_cond_t * cond)
+_thr_cond_signal(pthread_cond_t * cond)
 {
 
 	return (cond_signal_common(cond));
 }
 
 int
-_pthread_cond_broadcast(pthread_cond_t * cond)
+_thr_cond_broadcast(pthread_cond_t * cond)
 {
 
 	return (cond_broadcast_common(cond));

Modified: head/lib/libthr/thread/thr_detach.c
==============================================================================
--- head/lib/libthr/thread/thr_detach.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_detach.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -38,10 +38,11 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_detach, pthread_detach);
+__weak_reference(_thr_detach, pthread_detach);
+__weak_reference(_thr_detach, _pthread_detach);
 
 int
-_pthread_detach(pthread_t pthread)
+_thr_detach(pthread_t pthread)
 {
 	struct pthread *curthread = _get_curthread();
 	int rval;

Modified: head/lib/libthr/thread/thr_equal.c
==============================================================================
--- head/lib/libthr/thread/thr_equal.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_equal.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -37,10 +37,11 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "thr_private.h"
 
-__weak_reference(_pthread_equal, pthread_equal);
+__weak_reference(_thr_equal, pthread_equal);
+__weak_reference(_thr_equal, _pthread_equal);
 
 int
-_pthread_equal(pthread_t t1, pthread_t t2)
+_thr_equal(pthread_t t1, pthread_t t2)
 {
 	/* Compare the two thread pointers: */
 	return (t1 == t2);

Modified: head/lib/libthr/thread/thr_exit.c
==============================================================================
--- head/lib/libthr/thread/thr_exit.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_exit.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -50,7 +50,8 @@ __FBSDID("$FreeBSD$");
 
 static void	exit_thread(void) __dead2;
 
-__weak_reference(_pthread_exit, pthread_exit);
+__weak_reference(_Tthr_exit, pthread_exit);
+__weak_reference(_Tthr_exit, _pthread_exit);
 
 #ifdef _PTHREAD_FORCED_UNWIND
 static int message_printed;
@@ -203,7 +204,7 @@ _thread_exit(const char *fname, int lineno, const char
 }
 
 void
-_pthread_exit(void *status)
+_Tthr_exit(void *status)
 {
 	_pthread_exit_mask(status, NULL);
 }

Modified: head/lib/libthr/thread/thr_fork.c
==============================================================================
--- head/lib/libthr/thread/thr_fork.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_fork.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -75,10 +75,11 @@ __FBSDID("$FreeBSD$");
 #include "rtld_lock.h"
 #include "thr_private.h"
 
-__weak_reference(_pthread_atfork, pthread_atfork);
+__weak_reference(_thr_atfork, _pthread_atfork);
+__weak_reference(_thr_atfork, pthread_atfork);
 
 int
-_pthread_atfork(void (*prepare)(void), void (*parent)(void),
+_thr_atfork(void (*prepare)(void), void (*parent)(void),
     void (*child)(void))
 {
 	struct pthread *curthread;

Modified: head/lib/libthr/thread/thr_getthreadid_np.c
==============================================================================
--- head/lib/libthr/thread/thr_getthreadid_np.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_getthreadid_np.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -35,13 +35,14 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_getthreadid_np, pthread_getthreadid_np);
+__weak_reference(_thr_getthreadid_np, _pthread_getthreadid_np);
+__weak_reference(_thr_getthreadid_np, pthread_getthreadid_np);
 
 /*
  * Provide the equivelant to AIX pthread_getthreadid_np() function.
  */
 int
-_pthread_getthreadid_np(void)
+_thr_getthreadid_np(void)
 {
 	struct pthread *curthread;
 

Modified: head/lib/libthr/thread/thr_init.c
==============================================================================
--- head/lib/libthr/thread/thr_init.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_init.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -203,76 +203,74 @@ STATIC_LIB_REQUIRE(_thread_state_running);
 	(pthread_func_t)entry, (pthread_func_t)entry
 
 static pthread_func_t jmp_table[][2] = {
-	{DUAL_ENTRY(_pthread_atfork)},	/* PJT_ATFORK */
-	{DUAL_ENTRY(_pthread_attr_destroy)},	/* PJT_ATTR_DESTROY */
-	{DUAL_ENTRY(_pthread_attr_getdetachstate)},	/* PJT_ATTR_GETDETACHSTATE */
-	{DUAL_ENTRY(_pthread_attr_getguardsize)},	/* PJT_ATTR_GETGUARDSIZE */
-	{DUAL_ENTRY(_pthread_attr_getinheritsched)},	/* PJT_ATTR_GETINHERITSCHED */
-	{DUAL_ENTRY(_pthread_attr_getschedparam)},	/* PJT_ATTR_GETSCHEDPARAM */
-	{DUAL_ENTRY(_pthread_attr_getschedpolicy)},	/* PJT_ATTR_GETSCHEDPOLICY */
-	{DUAL_ENTRY(_pthread_attr_getscope)},	/* PJT_ATTR_GETSCOPE */
-	{DUAL_ENTRY(_pthread_attr_getstackaddr)},	/* PJT_ATTR_GETSTACKADDR */
-	{DUAL_ENTRY(_pthread_attr_getstacksize)},	/* PJT_ATTR_GETSTACKSIZE */
-	{DUAL_ENTRY(_pthread_attr_init)},	/* PJT_ATTR_INIT */
-	{DUAL_ENTRY(_pthread_attr_setdetachstate)},	/* PJT_ATTR_SETDETACHSTATE */
-	{DUAL_ENTRY(_pthread_attr_setguardsize)},	/* PJT_ATTR_SETGUARDSIZE */
-	{DUAL_ENTRY(_pthread_attr_setinheritsched)},	/* PJT_ATTR_SETINHERITSCHED */
-	{DUAL_ENTRY(_pthread_attr_setschedparam)},	/* PJT_ATTR_SETSCHEDPARAM */
-	{DUAL_ENTRY(_pthread_attr_setschedpolicy)},	/* PJT_ATTR_SETSCHEDPOLICY */
-	{DUAL_ENTRY(_pthread_attr_setscope)},	/* PJT_ATTR_SETSCOPE */
-	{DUAL_ENTRY(_pthread_attr_setstackaddr)},	/* PJT_ATTR_SETSTACKADDR */
-	{DUAL_ENTRY(_pthread_attr_setstacksize)},	/* PJT_ATTR_SETSTACKSIZE */
-	{DUAL_ENTRY(_pthread_cancel)},	/* PJT_CANCEL */
-	{DUAL_ENTRY(_pthread_cleanup_pop)},	/* PJT_CLEANUP_POP */
-	{DUAL_ENTRY(_pthread_cleanup_push)},	/* PJT_CLEANUP_PUSH */
-	{DUAL_ENTRY(_pthread_cond_broadcast)},	/* PJT_COND_BROADCAST */
-	{DUAL_ENTRY(_pthread_cond_destroy)},	/* PJT_COND_DESTROY */
-	{DUAL_ENTRY(_pthread_cond_init)},	/* PJT_COND_INIT */
-	{DUAL_ENTRY(_pthread_cond_signal)},	/* PJT_COND_SIGNAL */
-	{DUAL_ENTRY(_pthread_cond_timedwait)},	/* PJT_COND_TIMEDWAIT */
-	{(pthread_func_t)__pthread_cond_wait,
-	 (pthread_func_t)_pthread_cond_wait},	/* PJT_COND_WAIT */
-	{DUAL_ENTRY(_pthread_detach)},	/* PJT_DETACH */
-	{DUAL_ENTRY(_pthread_equal)},	/* PJT_EQUAL */
-	{DUAL_ENTRY(_pthread_exit)},	/* PJT_EXIT */
-	{DUAL_ENTRY(_pthread_getspecific)},	/* PJT_GETSPECIFIC */
-	{DUAL_ENTRY(_pthread_join)},	/* PJT_JOIN */
-	{DUAL_ENTRY(_pthread_key_create)},	/* PJT_KEY_CREATE */
-	{DUAL_ENTRY(_pthread_key_delete)},	/* PJT_KEY_DELETE*/
-	{DUAL_ENTRY(_pthread_kill)},	/* PJT_KILL */
-	{DUAL_ENTRY(_pthread_main_np)},		/* PJT_MAIN_NP */
-	{DUAL_ENTRY(_pthread_mutexattr_destroy)}, /* PJT_MUTEXATTR_DESTROY */
-	{DUAL_ENTRY(_pthread_mutexattr_init)},	/* PJT_MUTEXATTR_INIT */
-	{DUAL_ENTRY(_pthread_mutexattr_settype)}, /* PJT_MUTEXATTR_SETTYPE */
-	{DUAL_ENTRY(_pthread_mutex_destroy)},	/* PJT_MUTEX_DESTROY */
-	{DUAL_ENTRY(_pthread_mutex_init)},	/* PJT_MUTEX_INIT */
-	{(pthread_func_t)__pthread_mutex_lock,
-	 (pthread_func_t)_pthread_mutex_lock},	/* PJT_MUTEX_LOCK */
-	{(pthread_func_t)__pthread_mutex_trylock,
-	 (pthread_func_t)_pthread_mutex_trylock},/* PJT_MUTEX_TRYLOCK */
-	{DUAL_ENTRY(_pthread_mutex_unlock)},	/* PJT_MUTEX_UNLOCK */
-	{DUAL_ENTRY(_pthread_once)},		/* PJT_ONCE */
-	{DUAL_ENTRY(_pthread_rwlock_destroy)},	/* PJT_RWLOCK_DESTROY */
-	{DUAL_ENTRY(_pthread_rwlock_init)},	/* PJT_RWLOCK_INIT */
-	{DUAL_ENTRY(_pthread_rwlock_rdlock)},	/* PJT_RWLOCK_RDLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_tryrdlock)},/* PJT_RWLOCK_TRYRDLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_trywrlock)},/* PJT_RWLOCK_TRYWRLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_unlock)},	/* PJT_RWLOCK_UNLOCK */
-	{DUAL_ENTRY(_pthread_rwlock_wrlock)},	/* PJT_RWLOCK_WRLOCK */
-	{DUAL_ENTRY(_pthread_self)},		/* PJT_SELF */
-	{DUAL_ENTRY(_pthread_setcancelstate)},	/* PJT_SETCANCELSTATE */
-	{DUAL_ENTRY(_pthread_setcanceltype)},	/* PJT_SETCANCELTYPE */
-	{DUAL_ENTRY(_pthread_setspecific)},	/* PJT_SETSPECIFIC */
-	{DUAL_ENTRY(_pthread_sigmask)},		/* PJT_SIGMASK */
-	{DUAL_ENTRY(_pthread_testcancel)},	/* PJT_TESTCANCEL */
-	{DUAL_ENTRY(__pthread_cleanup_pop_imp)},/* PJT_CLEANUP_POP_IMP */
-	{DUAL_ENTRY(__pthread_cleanup_push_imp)},/* PJT_CLEANUP_PUSH_IMP */
-	{DUAL_ENTRY(_pthread_cancel_enter)},	/* PJT_CANCEL_ENTER */
-	{DUAL_ENTRY(_pthread_cancel_leave)},	/* PJT_CANCEL_LEAVE */
-	{DUAL_ENTRY(_pthread_mutex_consistent)},/* PJT_MUTEX_CONSISTENT */
-	{DUAL_ENTRY(_pthread_mutexattr_getrobust)},/* PJT_MUTEXATTR_GETROBUST */
-	{DUAL_ENTRY(_pthread_mutexattr_setrobust)},/* PJT_MUTEXATTR_SETROBUST */
-	{DUAL_ENTRY(_pthread_getthreadid_np)},	/* PJT_GETTHREADID_NP */
+	[PJT_ATFORK] = {DUAL_ENTRY(_thr_atfork)},
+	[PJT_ATTR_DESTROY] = {DUAL_ENTRY(_thr_attr_destroy)},
+	[PJT_ATTR_GETDETACHSTATE] = {DUAL_ENTRY(_thr_attr_getdetachstate)},
+	[PJT_ATTR_GETGUARDSIZE] = {DUAL_ENTRY(_thr_attr_getguardsize)},
+	[PJT_ATTR_GETINHERITSCHED] = {DUAL_ENTRY(_thr_attr_getinheritsched)},
+	[PJT_ATTR_GETSCHEDPARAM] = {DUAL_ENTRY(_thr_attr_getschedparam)},
+	[PJT_ATTR_GETSCHEDPOLICY] = {DUAL_ENTRY(_thr_attr_getschedpolicy)},
+	[PJT_ATTR_GETSCOPE] = {DUAL_ENTRY(_thr_attr_getscope)},
+	[PJT_ATTR_GETSTACKADDR] = {DUAL_ENTRY(_thr_attr_getstackaddr)},
+	[PJT_ATTR_GETSTACKSIZE] = {DUAL_ENTRY(_thr_attr_getstacksize)},
+	[PJT_ATTR_INIT] = {DUAL_ENTRY(_thr_attr_init)},
+	[PJT_ATTR_SETDETACHSTATE] = {DUAL_ENTRY(_thr_attr_setdetachstate)},
+	[PJT_ATTR_SETGUARDSIZE] = {DUAL_ENTRY(_thr_attr_setguardsize)},
+	[PJT_ATTR_SETINHERITSCHED] = {DUAL_ENTRY(_thr_attr_setinheritsched)},
+	[PJT_ATTR_SETSCHEDPARAM] = {DUAL_ENTRY(_thr_attr_setschedparam)},
+	[PJT_ATTR_SETSCHEDPOLICY] = {DUAL_ENTRY(_thr_attr_setschedpolicy)},
+	[PJT_ATTR_SETSCOPE] = {DUAL_ENTRY(_thr_attr_setscope)},
+	[PJT_ATTR_SETSTACKADDR] = {DUAL_ENTRY(_thr_attr_setstackaddr)},
+	[PJT_ATTR_SETSTACKSIZE] = {DUAL_ENTRY(_thr_attr_setstacksize)},
+	[PJT_CANCEL] = {DUAL_ENTRY(_thr_cancel)},
+	[PJT_CLEANUP_POP] = {DUAL_ENTRY(_thr_cleanup_pop)},
+	[PJT_CLEANUP_PUSH] = {DUAL_ENTRY(_thr_cleanup_push)},
+	[PJT_COND_BROADCAST] = {DUAL_ENTRY(_thr_cond_broadcast)},
+	[PJT_COND_DESTROY] = {DUAL_ENTRY(_thr_cond_destroy)},
+	[PJT_COND_INIT] = {DUAL_ENTRY(_thr_cond_init)},
+	[PJT_COND_SIGNAL] = {DUAL_ENTRY(_thr_cond_signal)},
+	[PJT_COND_TIMEDWAIT] = {DUAL_ENTRY(_thr_cond_timedwait)},
+	[PJT_COND_WAIT] = {(pthread_func_t)__thr_cond_wait,
+	    (pthread_func_t)_thr_cond_wait},
+	[PJT_DETACH] = {DUAL_ENTRY(_thr_detach)},
+	[PJT_EQUAL] = {DUAL_ENTRY(_thr_equal)},
+	[PJT_EXIT] = {DUAL_ENTRY(_Tthr_exit)},
+	[PJT_GETSPECIFIC] = {DUAL_ENTRY(_thr_getspecific)},
+	[PJT_JOIN] = {DUAL_ENTRY(_thr_join)},
+	[PJT_KEY_CREATE] = {DUAL_ENTRY(_thr_key_create)},
+	[PJT_KEY_DELETE] = {DUAL_ENTRY(_thr_key_delete)},
+	[PJT_KILL] = {DUAL_ENTRY(_Tthr_kill)},
+	[PJT_MAIN_NP] = {DUAL_ENTRY(_thr_main_np)},
+	[PJT_MUTEXATTR_DESTROY] = {DUAL_ENTRY(_thr_mutexattr_destroy)},
+	[PJT_MUTEXATTR_INIT] = {DUAL_ENTRY(_thr_mutexattr_init)},
+	[PJT_MUTEXATTR_SETTYPE] = {DUAL_ENTRY(_thr_mutexattr_settype)},
+	[PJT_MUTEX_DESTROY] = {DUAL_ENTRY(_thr_mutex_destroy)},
+	[PJT_MUTEX_INIT] = {DUAL_ENTRY(__Tthr_mutex_init)},
+	[PJT_MUTEX_LOCK] = {DUAL_ENTRY(__Tthr_mutex_lock)},
+	[PJT_MUTEX_TRYLOCK] = {DUAL_ENTRY(__Tthr_mutex_trylock)},
+	[PJT_MUTEX_UNLOCK] = {DUAL_ENTRY(_thr_mutex_unlock)},
+	[PJT_ONCE] = {DUAL_ENTRY(_thr_once)},
+	[PJT_RWLOCK_DESTROY] = {DUAL_ENTRY(_thr_rwlock_destroy)},
+	[PJT_RWLOCK_INIT] = {DUAL_ENTRY(_thr_rwlock_init)},
+	[PJT_RWLOCK_RDLOCK] = {DUAL_ENTRY(_Tthr_rwlock_rdlock)},
+	[PJT_RWLOCK_TRYRDLOCK] = {DUAL_ENTRY(_Tthr_rwlock_tryrdlock)},
+	[PJT_RWLOCK_TRYWRLOCK] = {DUAL_ENTRY(_Tthr_rwlock_trywrlock)},
+	[PJT_RWLOCK_UNLOCK] = {DUAL_ENTRY(_Tthr_rwlock_unlock)},
+	[PJT_RWLOCK_WRLOCK] = {DUAL_ENTRY(_Tthr_rwlock_wrlock)},
+	[PJT_SELF] = {DUAL_ENTRY(_Tthr_self)},
+	[PJT_SETCANCELSTATE] = {DUAL_ENTRY(_thr_setcancelstate)},
+	[PJT_SETCANCELTYPE] = {DUAL_ENTRY(_thr_setcanceltype)},
+	[PJT_SETSPECIFIC] = {DUAL_ENTRY(_thr_setspecific)},
+	[PJT_SIGMASK] = {DUAL_ENTRY(_thr_sigmask)},
+	[PJT_TESTCANCEL] = {DUAL_ENTRY(_Tthr_testcancel)},
+	[PJT_CLEANUP_POP_IMP] = {DUAL_ENTRY(__thr_cleanup_pop_imp)},
+	[PJT_CLEANUP_PUSH_IMP] = {DUAL_ENTRY(__thr_cleanup_push_imp)},
+	[PJT_CANCEL_ENTER] = {DUAL_ENTRY(_thr_cancel_enter)},
+	[PJT_CANCEL_LEAVE] = {DUAL_ENTRY(_thr_cancel_leave)},
+	[PJT_MUTEX_CONSISTENT] = {DUAL_ENTRY(_Tthr_mutex_consistent)},
+	[PJT_MUTEXATTR_GETROBUST] = {DUAL_ENTRY(_thr_mutexattr_getrobust)},
+	[PJT_MUTEXATTR_SETROBUST] = {DUAL_ENTRY(_thr_mutexattr_setrobust)},
+	[PJT_GETTHREADID_NP] = {DUAL_ENTRY(_thr_getthreadid_np)},
 };
 
 static int init_once = 0;

Modified: head/lib/libthr/thread/thr_join.c
==============================================================================
--- head/lib/libthr/thread/thr_join.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_join.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -40,7 +40,8 @@ int	_pthread_timedjoin_np(pthread_t pthread, void **th
 	const struct timespec *abstime);
 static int join_common(pthread_t, void **, const struct timespec *);
 
-__weak_reference(_pthread_join, pthread_join);
+__weak_reference(_thr_join, pthread_join);
+__weak_reference(_thr_join, _pthread_join);
 __weak_reference(_pthread_timedjoin_np, pthread_timedjoin_np);
 
 static void backout_join(void *arg)
@@ -54,7 +55,7 @@ static void backout_join(void *arg)
 }
 
 int
-_pthread_join(pthread_t pthread, void **thread_return)
+_thr_join(pthread_t pthread, void **thread_return)
 {
 	return (join_common(pthread, thread_return, NULL));
 }

Modified: head/lib/libthr/thread/thr_kill.c
==============================================================================
--- head/lib/libthr/thread/thr_kill.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_kill.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -40,10 +40,11 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_kill, pthread_kill);
+__weak_reference(_Tthr_kill, _pthread_kill);
+__weak_reference(_Tthr_kill, pthread_kill);
 
 int
-_pthread_kill(pthread_t pthread, int sig)
+_Tthr_kill(pthread_t pthread, int sig)
 {
 	struct pthread *curthread;
 	int ret;

Modified: head/lib/libthr/thread/thr_main_np.c
==============================================================================
--- head/lib/libthr/thread/thr_main_np.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_main_np.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -37,13 +37,14 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_main_np, pthread_main_np);
+__weak_reference(_thr_main_np, pthread_main_np);
+__weak_reference(_thr_main_np, _pthread_main_np);
 
 /*
  * Provide the equivalent to Solaris thr_main() function.
  */
 int
-_pthread_main_np(void)
+_thr_main_np(void)
 {
 
 	if (!_thr_initial)

Modified: head/lib/libthr/thread/thr_mutex.c
==============================================================================
--- head/lib/libthr/thread/thr_mutex.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_mutex.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -65,11 +65,6 @@ _Static_assert(sizeof(struct pthread_mutex) <= PAGE_SI
 /*
  * Prototypes
  */
-int	__pthread_mutex_consistent(pthread_mutex_t *mutex);
-int	__pthread_mutex_init(pthread_mutex_t * __restrict mutex,
-		const pthread_mutexattr_t * __restrict mutex_attr);
-int	__pthread_mutex_trylock(pthread_mutex_t *mutex);
-int	__pthread_mutex_lock(pthread_mutex_t *mutex);
 int	__pthread_mutex_timedlock(pthread_mutex_t * __restrict mutex,
 		const struct timespec * __restrict abstime);
 int	_pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count);
@@ -90,21 +85,27 @@ static int	mutex_qidx(struct pthread_mutex *m);
 static bool	is_robust_mutex(struct pthread_mutex *m);
 static bool	is_pshared_mutex(struct pthread_mutex *m);
 
-__weak_reference(__pthread_mutex_init, pthread_mutex_init);
-__strong_reference(__pthread_mutex_init, _pthread_mutex_init);
-__weak_reference(__pthread_mutex_lock, pthread_mutex_lock);
-__strong_reference(__pthread_mutex_lock, _pthread_mutex_lock);
+__weak_reference(__Tthr_mutex_init, pthread_mutex_init);
+__weak_reference(__Tthr_mutex_init, __pthread_mutex_init);
+__strong_reference(__Tthr_mutex_init, _pthread_mutex_init);
+__weak_reference(__Tthr_mutex_lock, pthread_mutex_lock);
+__weak_reference(__Tthr_mutex_lock, __pthread_mutex_lock);
+__strong_reference(__Tthr_mutex_lock, _pthread_mutex_lock);
 __weak_reference(__pthread_mutex_timedlock, pthread_mutex_timedlock);
 __strong_reference(__pthread_mutex_timedlock, _pthread_mutex_timedlock);
-__weak_reference(__pthread_mutex_trylock, pthread_mutex_trylock);
-__strong_reference(__pthread_mutex_trylock, _pthread_mutex_trylock);
-__weak_reference(_pthread_mutex_consistent, pthread_mutex_consistent);
-__strong_reference(_pthread_mutex_consistent, __pthread_mutex_consistent);
+__weak_reference(__Tthr_mutex_trylock, pthread_mutex_trylock);
+__weak_reference(__Tthr_mutex_trylock, __pthread_mutex_trylock);
+__strong_reference(__Tthr_mutex_trylock, _pthread_mutex_trylock);
+__weak_reference(_Tthr_mutex_consistent, pthread_mutex_consistent);
+__weak_reference(_Tthr_mutex_consistent, _pthread_mutex_consistent);
+__strong_reference(_Tthr_mutex_consistent, __pthread_mutex_consistent);
 
 /* Single underscore versions provided for libc internal usage: */
 /* No difference between libc and application usage of these: */
-__weak_reference(_pthread_mutex_destroy, pthread_mutex_destroy);
-__weak_reference(_pthread_mutex_unlock, pthread_mutex_unlock);
+__weak_reference(_thr_mutex_destroy, pthread_mutex_destroy);
+__weak_reference(_thr_mutex_destroy, _pthread_mutex_destroy);
+__weak_reference(_thr_mutex_unlock, pthread_mutex_unlock);
+__weak_reference(_thr_mutex_unlock, _pthread_mutex_unlock);
 
 __weak_reference(_pthread_mutex_getprioceiling, pthread_mutex_getprioceiling);
 __weak_reference(_pthread_mutex_setprioceiling, pthread_mutex_setprioceiling);
@@ -377,7 +378,7 @@ shared_mutex_init(struct pthread_mutex *pmtx, const st
 }
 
 int
-__pthread_mutex_init(pthread_mutex_t * __restrict mutex,
+__Tthr_mutex_init(pthread_mutex_t * __restrict mutex,
     const pthread_mutexattr_t * __restrict mutex_attr)
 {
 	struct pthread_mutex *pmtx;
@@ -459,7 +460,7 @@ _mutex_fork(struct pthread *curthread)
 }
 
 int
-_pthread_mutex_destroy(pthread_mutex_t *mutex)
+_thr_mutex_destroy(pthread_mutex_t *mutex)
 {
 	pthread_mutex_t m, m1;
 	int ret;
@@ -608,7 +609,7 @@ check_and_init_mutex(pthread_mutex_t *mutex, struct pt
 }
 
 int
-__pthread_mutex_trylock(pthread_mutex_t *mutex)
+__Tthr_mutex_trylock(pthread_mutex_t *mutex)
 {
 	struct pthread *curthread;
 	struct pthread_mutex *m;
@@ -737,7 +738,7 @@ mutex_lock_common(struct pthread_mutex *m, const struc
 }
 
 int
-__pthread_mutex_lock(pthread_mutex_t *mutex)
+__Tthr_mutex_lock(pthread_mutex_t *mutex)
 {
 	struct pthread_mutex *m;
 	int ret;
@@ -764,7 +765,7 @@ __pthread_mutex_timedlock(pthread_mutex_t * __restrict
 }
 
 int
-_pthread_mutex_unlock(pthread_mutex_t *mutex)
+_thr_mutex_unlock(pthread_mutex_t *mutex)
 {
 	struct pthread_mutex *mp;
 
@@ -1167,7 +1168,7 @@ _mutex_owned(struct pthread *curthread, const struct p
 }
 
 int
-_pthread_mutex_consistent(pthread_mutex_t *mutex)
+_Tthr_mutex_consistent(pthread_mutex_t *mutex)
 {
 	struct pthread_mutex *m;
 	struct pthread *curthread;

Modified: head/lib/libthr/thread/thr_mutexattr.c
==============================================================================
--- head/lib/libthr/thread/thr_mutexattr.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_mutexattr.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -72,12 +72,15 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_mutexattr_init, pthread_mutexattr_init);
+__weak_reference(_thr_mutexattr_init, pthread_mutexattr_init);
+__weak_reference(_thr_mutexattr_init, _pthread_mutexattr_init);
 __weak_reference(_pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np);
 __weak_reference(_pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np);
 __weak_reference(_pthread_mutexattr_gettype, pthread_mutexattr_gettype);
-__weak_reference(_pthread_mutexattr_settype, pthread_mutexattr_settype);
-__weak_reference(_pthread_mutexattr_destroy, pthread_mutexattr_destroy);
+__weak_reference(_thr_mutexattr_settype, pthread_mutexattr_settype);
+__weak_reference(_thr_mutexattr_settype, _pthread_mutexattr_settype);
+__weak_reference(_thr_mutexattr_destroy, pthread_mutexattr_destroy);
+__weak_reference(_thr_mutexattr_destroy, _pthread_mutexattr_destroy);
 __weak_reference(_pthread_mutexattr_getpshared, pthread_mutexattr_getpshared);
 __weak_reference(_pthread_mutexattr_setpshared, pthread_mutexattr_setpshared);
 __weak_reference(_pthread_mutexattr_getprotocol, pthread_mutexattr_getprotocol);
@@ -86,11 +89,13 @@ __weak_reference(_pthread_mutexattr_getprioceiling,
     pthread_mutexattr_getprioceiling);
 __weak_reference(_pthread_mutexattr_setprioceiling,
     pthread_mutexattr_setprioceiling);
-__weak_reference(_pthread_mutexattr_getrobust, pthread_mutexattr_getrobust);
-__weak_reference(_pthread_mutexattr_setrobust, pthread_mutexattr_setrobust);
+__weak_reference(_thr_mutexattr_getrobust, pthread_mutexattr_getrobust);
+__weak_reference(_thr_mutexattr_getrobust, _pthread_mutexattr_getrobust);
+__weak_reference(_thr_mutexattr_setrobust, pthread_mutexattr_setrobust);
+__weak_reference(_thr_mutexattr_setrobust, _pthread_mutexattr_setrobust);
 
 int
-_pthread_mutexattr_init(pthread_mutexattr_t *attr)
+_thr_mutexattr_init(pthread_mutexattr_t *attr)
 {
 	int ret;
 	pthread_mutexattr_t pattr;
@@ -136,7 +141,7 @@ _pthread_mutexattr_getkind_np(pthread_mutexattr_t attr
 }
 
 int
-_pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
+_thr_mutexattr_settype(pthread_mutexattr_t *attr, int type)
 {
 	int	ret;
 
@@ -166,7 +171,7 @@ _pthread_mutexattr_gettype(const pthread_mutexattr_t *
 }
 
 int
-_pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
+_thr_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
 	int	ret;
 	if (attr == NULL || *attr == NULL) {
@@ -263,7 +268,7 @@ _pthread_mutexattr_setprioceiling(pthread_mutexattr_t 
 }
 
 int
-_pthread_mutexattr_getrobust(pthread_mutexattr_t *mattr, int *robust)
+_thr_mutexattr_getrobust(pthread_mutexattr_t *mattr, int *robust)
 {
 	int ret;
 
@@ -277,7 +282,7 @@ _pthread_mutexattr_getrobust(pthread_mutexattr_t *matt
 }
 
 int
-_pthread_mutexattr_setrobust(pthread_mutexattr_t *mattr, int robust)
+_thr_mutexattr_setrobust(pthread_mutexattr_t *mattr, int robust)
 {
 	int ret;
 

Modified: head/lib/libthr/thread/thr_once.c
==============================================================================
--- head/lib/libthr/thread/thr_once.c	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_once.c	Wed Jul 31 19:27:20 2019	(r350481)
@@ -35,7 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_once, pthread_once);
+__weak_reference(_thr_once, pthread_once);
+__weak_reference(_thr_once, _pthread_once);
 
 #define ONCE_NEVER_DONE		PTHREAD_NEEDS_INIT
 #define ONCE_DONE		PTHREAD_DONE_INIT
@@ -63,7 +64,7 @@ once_cancel_handler(void *arg)
 }
 
 int
-_pthread_once(pthread_once_t *once_control, void (*init_routine) (void))
+_thr_once(pthread_once_t *once_control, void (*init_routine)(void))
 {
 	struct pthread *curthread;
 	int state;

Modified: head/lib/libthr/thread/thr_private.h
==============================================================================
--- head/lib/libthr/thread/thr_private.h	Wed Jul 31 19:20:39 2019	(r350480)
+++ head/lib/libthr/thread/thr_private.h	Wed Jul 31 19:27:20 2019	(r350481)
@@ -1013,6 +1013,86 @@ void __thr_malloc_init(void);
 void __thr_malloc_prefork(struct pthread *curthread);
 void __thr_malloc_postfork(struct pthread *curthread);
 
+int _thr_join(pthread_t, void **);
+int _Tthr_kill(pthread_t, int);
+int _thr_getthreadid_np(void);
+void __thr_cleanup_push_imp(void (*)(void *), void *,
+    struct _pthread_cleanup_info *);
+void __thr_cleanup_pop_imp(int);
+void _thr_cleanup_push(void (*)(void *), void *);
+void _thr_cleanup_pop(int);
+void _thr_cancel_enter(struct pthread *);
+void _thr_cancel_leave(struct pthread *, int);
+void _Tthr_testcancel(void);
+int _thr_cancel(pthread_t);
+int _thr_atfork(void (*)(void), void (*)(void), void (*)(void));
+int _thr_attr_destroy(pthread_attr_t *);
+int _thr_attr_get_np(pthread_t, pthread_attr_t *);
+int _thr_attr_getdetachstate(const pthread_attr_t *, int *);
+int _thr_attr_getguardsize(const pthread_attr_t * __restrict,
+    size_t * __restrict);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:32:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B069A6A99;
 Wed, 31 Jul 2019 19:32:40 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zNqX0LZ1z4FB8;
 Wed, 31 Jul 2019 19:32:40 +0000 (UTC)
 (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E196668A1;
 Wed, 31 Jul 2019 19:32:39 +0000 (UTC)
 (envelope-from oshogbo@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VJWdfX063769;
 Wed, 31 Jul 2019 19:32:39 GMT (envelope-from oshogbo@FreeBSD.org)
Received: (from oshogbo@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VJWdAl063768;
 Wed, 31 Jul 2019 19:32:39 GMT (envelope-from oshogbo@FreeBSD.org)
Message-Id: <201907311932.x6VJWdAl063768@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to
 oshogbo@FreeBSD.org using -f
From: Mariusz Zaborski <oshogbo@FreeBSD.org>
Date: Wed, 31 Jul 2019 19:32:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350482 - head
X-SVN-Group: head
X-SVN-Commit-Author: oshogbo
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350482
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zNqX0LZ1z4FB8
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.39 / 15.00];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.39)[0.386,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:32:40 -0000

Author: oshogbo
Date: Wed Jul 31 19:32:39 2019
New Revision: 350482
URL: https://svnweb.freebsd.org/changeset/base/350482

Log:
  gnop: add note to the RELNOTES
  
  Submitted by:	markj

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==============================================================================
--- head/RELNOTES	Wed Jul 31 19:27:20 2019	(r350481)
+++ head/RELNOTES	Wed Jul 31 19:32:39 2019	(r350482)
@@ -10,6 +10,10 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r350471:
+       gnop(8) can now configure a delay to be applied to read and write
+       request delays.  See the -d, -q and -x parameters.
+
 r350307:
 	libcap_random(3) has been removed.  Applications can use native
 	APIs to get random data in capability mode.

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:43:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2887FA6EC9;
 Wed, 31 Jul 2019 19:43:08 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zP3b36Zlz4FtT;
 Wed, 31 Jul 2019 19:43:06 +0000 (UTC)
 (envelope-from kostikbel@gmail.com)
Received: from tom.home (kib@localhost [127.0.0.1])
 by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x6VJgqjU024303
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO);
 Wed, 31 Jul 2019 22:42:55 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x6VJgqjU024303
Received: (from kostik@localhost)
 by tom.home (8.15.2/8.15.2/Submit) id x6VJgqpT024302;
 Wed, 31 Jul 2019 22:42:52 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Wed, 31 Jul 2019 22:42:52 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Bryan Drewery <bdrewery@FreeBSD.org>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350005 - head/sys/kern
Message-ID: <20190731194252.GO2731@kib.kiev.ua>
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua>
 <20190730232714.GM2731@kib.kiev.ua>
 <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
 <20190731051452.GN2731@kib.kiev.ua>
 <46c7a7bc-29ec-6176-0ede-96ac91984589@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <46c7a7bc-29ec-6176-0ede-96ac91984589@FreeBSD.org>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,
 NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:43:08 -0000

On Wed, Jul 31, 2019 at 10:08:39AM -0700, Bryan Drewery wrote:
> On 7/30/19 10:14 PM, Konstantin Belousov wrote:
> > No, you should create a situation where the python process ends the endless
> > loop, as reported.  Then, it should become killable by 9 with the first
> > chunk only applied.
> > 
> 
> I don't have an easy way to test that. kill -9 inside the loop didn't
> work. Once the loop ended the process was done; it is very short lived
> and the calling code is buried in Python I think.
With only the umtxq_check_susp() chunk applied, you would wait for
python to start looping, then verify that kill -9 works.

Anyway, I believe that the change is correct, and put the review at
https://reviews.freebsd.org/D21124.  I will commit after it get some
sanity checking by mentioned people.

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:52:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AC7CA725B;
 Wed, 31 Jul 2019 19:52:07 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "freefall.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zPFz3hkPz4GMb;
 Wed, 31 Jul 2019 19:52:07 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (unknown [127.0.1.132])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by freefall.freebsd.org (Postfix) with ESMTPS id 2F6D6DD0F;
 Wed, 31 Jul 2019 19:52:07 +0000 (UTC)
 (envelope-from bdrewery@FreeBSD.org)
Received: from mail.xzibition.com (localhost [172.31.3.2])
 by mail.xzibition.com (Postfix) with ESMTP id 413481538C;
 Wed, 31 Jul 2019 19:52:06 +0000 (UTC)
X-Virus-Scanned: amavisd-new at mail.xzibition.com
Received: from mail.xzibition.com ([172.31.3.2])
 by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new,
 port 10026)
 with LMTP id eIh8ni_eUnJx; Wed, 31 Jul 2019 19:52:03 +0000 (UTC)
Subject: Re: svn commit: r350005 - head/sys/kern
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 07D1E15385
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
 <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
 <20190731051452.GN2731@kib.kiev.ua>
 <46c7a7bc-29ec-6176-0ede-96ac91984589@FreeBSD.org>
 <20190731194252.GO2731@kib.kiev.ua>
From: Bryan Drewery <bdrewery@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata=
 mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ
 a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab
 D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+
 rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp
 VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB
 AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL
 CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu
 BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX
 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj
 IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd
 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4
 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm
 NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK
 BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8
 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C
 eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR
 lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u
 IUrMm6UAEQEAAYkBJQQYAQoADwUCUmmGawIbDAUJCWYBgAAKCRA113G7bkaXz1Q+CADaYZCn
 bzIJQqwnoocVXL+Wkd+hCsoX6zsd8pNTY5tV5U1fgjxl1bVQ7jyZGrEQ7BjyvlhIfpfTo6aK
 oJfZpIxeDc3Tr+X7O2UHT5QYaWRcGO+X3+eKL5sLpvxda67RftClv2hgEr1i2hqjK5WmUCaN
 2P9w+i7rmZ4ohpLXINOMeHjnQOtbxCCF7qXRsVfgEcpNKb31T3QwvsRjX0HqIjYFlKpa61Wz
 IPvWgBERjo0aAOkI4g7oVLjX5Z5gINGPy+xr8GJqhfZ3ZIEOwLCwTB71+Dk9gyLa5UiG8vo6
 vGfA50H5OSC87LnNlI07b1Qb8mKVkqg13PbCkRpTMKEYaou9iQElBBgBCgAPAhsMBQJa6M4o
 BQkKYHs9AAoJEDXXcbtuRpfPpuQH/0d1RHcTTAHAyHrPQA4UMqH49tEj1d3gidx2ETnm00rj
 XTrnRreAAMgPCrPeLvYYiKeSBrHOkQ7E/Vuztr4F4Xenld3omOTon+cSyGKyA1btWNRskcUa
 zxJ/0DqgzerhWQj8CtWjmqRnGAqzvZQdIDLk1X4B2p1Ota4AvbTF9DqADskXfld/zPJQzYYy
 XRfyKTt0nWMyn5MHbsuKmpsOBqYXMf0X2EL2C6v3g5D/HedD6YVnW6KlgcDUR2sq6Fv9Ozhs
 38TOXyeZgbFz0HDtkHEY5Mh3+sQjOh4takC+Dp1zDRP2U19JZzo9f6R/d05c0h2TD02oogPz
 AQ97xrFwZgaJATwEGAEKACYCGwwWIQT5Fzyyw6rqelyKHwk113G7bkaXzwUCW+YS+AUJDT7z
 jQAKCRA113G7bkaXzwo3B/4rwbDqXaXm6YC4s0jVOf1+MljeQIsbHPVQZ0IRigCpzCDSUFTK
 QOebA9iUj8JaF2DPwd6sjyUUv/XMCLl+SwzSijmVN0Kfk85XspzNef8XmteKK1mERkYnLWBw
 TNwp6qezg/CukNbobNH08ciT+z2fxtPuwqK5X9Q5R4Q7egth5XUTxbwLwIJerEfVs4HG+687
 m9h1bWyYJemB24MgBu8fTaVxas8dSSwDHabdgyGMKIvqDHUUJQSMDbio0Iwhs7lx2p3Xd5Br
 wQLMiaUPnKBHqfVM8ADWldvHF6xa9keBUjnEedKwQNjYf76lGH6bLwbyZcLigKFdXY1R2ooT Xi+R
Organization: FreeBSD
Message-ID: <df2c19b0-f24f-11f6-1067-103056dd2301@FreeBSD.org>
Date: Wed, 31 Jul 2019 12:52:01 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0)
 Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <20190731194252.GO2731@kib.kiev.ua>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="I6yGNG63gVSSbsCdCYtonEzBGlneRWRxu"
X-Rspamd-Queue-Id: 45zPFz3hkPz4GMb
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.04 / 15.00];
 ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.04)[0.035,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:52:07 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--I6yGNG63gVSSbsCdCYtonEzBGlneRWRxu
Content-Type: multipart/mixed; boundary="zfMwmzsDNvVF8e5UjDAdbGjinUa1GeAHQ";
 protected-headers="v1"
From: Bryan Drewery <bdrewery@FreeBSD.org>
To: Konstantin Belousov <kostikbel@gmail.com>
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Message-ID: <df2c19b0-f24f-11f6-1067-103056dd2301@FreeBSD.org>
Subject: Re: svn commit: r350005 - head/sys/kern
References: <201907151918.x6FJIPFo077975@repo.freebsd.org>
 <d281e1dc-1931-20a5-9f41-7c1f66d4f667@FreeBSD.org>
 <20190730231256.GL2731@kib.kiev.ua> <20190730232714.GM2731@kib.kiev.ua>
 <5d3ffe05-58f3-ea26-13ed-51cdcd1deeaa@FreeBSD.org>
 <20190731051452.GN2731@kib.kiev.ua>
 <46c7a7bc-29ec-6176-0ede-96ac91984589@FreeBSD.org>
 <20190731194252.GO2731@kib.kiev.ua>
In-Reply-To: <20190731194252.GO2731@kib.kiev.ua>

--zfMwmzsDNvVF8e5UjDAdbGjinUa1GeAHQ
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 7/31/19 12:42 PM, Konstantin Belousov wrote:
> On Wed, Jul 31, 2019 at 10:08:39AM -0700, Bryan Drewery wrote:
>> On 7/30/19 10:14 PM, Konstantin Belousov wrote:
>>> No, you should create a situation where the python process ends the e=
ndless
>>> loop, as reported.  Then, it should become killable by 9 with the fir=
st
>>> chunk only applied.
>>>
>>
>> I don't have an easy way to test that. kill -9 inside the loop didn't
>> work. Once the loop ended the process was done; it is very short lived=

>> and the calling code is buried in Python I think.
> With only the umtxq_check_susp() chunk applied, you would wait for
> python to start looping, then verify that kill -9 works.
>=20
> Anyway, I believe that the change is correct, and put the review at
> https://reviews.freebsd.org/D21124.  I will commit after it get some
> sanity checking by mentioned people.
>=20

Right. I did that earlier and it did not work. I can try again shortly.

--=20
Regards,
Bryan Drewery


--zfMwmzsDNvVF8e5UjDAdbGjinUa1GeAHQ--

--I6yGNG63gVSSbsCdCYtonEzBGlneRWRxu
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl1B8WEACgkQNddxu25G
l8+CDQf/ct3ZkblqFZjQh/iI2n4IjyCIcBzpeELKXOB23+J8lkAYp7CUlojQkEj/
ILqsj6EEMT5I2jbky7fZ3818dathQP5KvkfcByz4vhmpX7EFdKp82ylkxrR9rs1N
42i7VOPj67dtS9py6Dss8od7pMVWTPoyuZ6IsCI+pLTglzsS8E0arNieoPDXt65X
zO8PFVPlq5nbZdXojUmfkBbDhhMBuvpJvDNrkLDjc557aTtuzVOIGAC4Yj77GQFA
fzFeggYtUfOGfBSiIkL89cycjQ9qe3kiXoWd2uesr806kuilG/iOITuPrfQ4f+kz
Of9dEM3Q0EY1e9S/C5XyQxDfUt4Jkw==
=6vY7
-----END PGP SIGNATURE-----

--I6yGNG63gVSSbsCdCYtonEzBGlneRWRxu--

From owner-svn-src-head@freebsd.org  Wed Jul 31 19:52:19 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2ED54A72BC
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Wed, 31 Jul 2019 19:52:19 +0000 (UTC)
 (envelope-from susan.jackson@oceandigihub.com)
Received: from n1nlsmtp03.shr.prod.ams1.secureserver.net
 (n1nlsmtp03.shr.prod.ams1.secureserver.net [188.121.43.193])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "relay-hosting.secureserver.net",
 Issuer "Starfield Secure Certificate Authority - G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zPGB1lRpz4Gb9
 for <svn-src-head@freebsd.org>; Wed, 31 Jul 2019 19:52:16 +0000 (UTC)
 (envelope-from susan.jackson@oceandigihub.com)
Received: from n3plcpnl0282.prod.ams3.secureserver.net ([160.153.155.37])
 by : HOSTING RELAY : with ESMTP
 id suKXh7AUxDN9LsuKXhV35b; Wed, 31 Jul 2019 12:32:09 -0700
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=oceandigihub.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:
 Subject:To:From:Reply-To:Sender:Cc:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9FMX2aezbWeiLKM/xri63NJxwPYZ3/0eYi7nqs1gjvE=; b=MZWX+jxklRQe/G5g4cCI/Ankis
 F+aaqJgzfGTKyxY5pZVm6SKZhZxDEoZSzkceAfEICw8P64tJCFfEsEuE1uwv57cIcNnadRDQJgbTm
 S9niiWWuHy0phgZ617mjAG6/eKzTdBLVQMcMbJBOVdWL7Rn1kAnjF+2NhRuU+cPO7N6D808+41o7y
 wG1xLY7Ci/ZRNbEO/JmNfcgTQsVPUNoTYzuOwVrtGUF/cJNdlvCyo6jrBPU1F+QUpJqcuqys6oSZj
 J7lxN2pvzT6ZZp4RFxGSwonciweLwui8k5QsTk13ChJ0Jc6YAzhzyShvQ0zHWrBKbbbdZxJcKlDQj
 zCNDO/IA==;
Received: from [185.253.99.134] (port=56738 helo=WS56)
 by n3plcpnl0282.prod.ams3.secureserver.net with esmtpsa
 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92)
 (envelope-from <susan.jackson@oceandigihub.com>) id 1hsuKX-00Ft2z-7A
 for svn-src-head@freebsd.org; Wed, 31 Jul 2019 12:32:09 -0700
Reply-To: <susan.jackson@oceandigihub.com>
From: "Susan Jackson" <susan.jackson@oceandigihub.com>
To: <svn-src-head@freebsd.org>
Subject: Cisco Firewall Potential Business Lead
Date: Thu, 1 Aug 2019 01:02:07 +0530
Message-ID: <!&!AAAAAAAAAAAYAAAAAAAAADcaoiFjzWRGv7a5A5uXwzHCgAAAEAAAAM2DLjaoN69Atpz/ol2vYXMBAAAAAA==@oceandigihub.com>
MIME-Version: 1.0
X-Priority: 1 (Highest)
X-MSMail-Priority: High
X-Mailer: Microsoft Outlook 15.0
Thread-Index: AdVH1qHWT5ypBEH/RL+d8fJtRqWEWQ==
Importance: High
Content-Language: en-us
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - n3plcpnl0282.prod.ams3.secureserver.net
X-AntiAbuse: Original Domain - freebsd.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - oceandigihub.com
X-Get-Message-Sender-Via: n3plcpnl0282.prod.ams3.secureserver.net: authenticated_id:
 susan.jackson@oceandigihub.com
X-Authenticated-Sender: n3plcpnl0282.prod.ams3.secureserver.net: susan.jackson@oceandigihub.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-CMAE-Envelope: MS4wfLThyMMYtTRxamSAFj9sloBr2YWbRmXKPbq0ipYXbkTuBLJVSh3MOK6DeOiFqUD/h5a6a/wlf/4QeJSOyK6I7Y6rzGluNDeSX+pHP5cCrapOUh7d3cwj
 KeWx3tw7KUR2uq0Sdfyghftqon6nBLiEjWxHnSVnQUahZz+eJvN70XnTyslhtEJGHX+cDiXbTgMHpey7Xwih+ufovbixUS557/0DOCjbyrkh3Kt8m3EEKfFU
X-Rspamd-Queue-Id: 45zPGB1lRpz4Gb9
X-Spamd-Bar: +
Authentication-Results: mx1.freebsd.org;
 dkim=none (invalid DKIM record) header.d=oceandigihub.com header.s=default
 header.b=MZWX+jxk; dmarc=none;
 spf=none (mx1.freebsd.org: domain of susan.jackson@oceandigihub.com has no SPF
 policy when checking 188.121.43.193)
 smtp.mailfrom=susan.jackson@oceandigihub.com
X-Spamd-Result: default: False [1.63 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 HAS_REPLYTO(0.00)[susan.jackson@oceandigihub.com];
 MX_INVALID(0.50)[cached]; HAS_X_SOURCE(0.00)[];
 TO_DN_NONE(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[];
 RCVD_COUNT_THREE(0.00)[3];
 DKIM_TRACE(0.00)[oceandigihub.com:~]; HAS_X_ANTIABUSE(0.00)[];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~];
 HAS_X_PRIO_ONE(0.00)[1];
 ASN(0.00)[asn:26496, ipnet:188.121.40.0/22, country:US];
 MID_RHS_MATCH_FROM(0.00)[];
 HAS_X_AS(0.00)[susan.jackson@oceandigihub.com]; ARC_NA(0.00)[];
 FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[];
 NEURAL_SPAM_SHORT(0.88)[0.883,0];
 MIME_GOOD(-0.10)[multipart/alternative,text/plain];
 DMARC_NA(0.00)[oceandigihub.com]; RCPT_COUNT_ONE(0.00)[1];
 IP_SCORE(0.35)[ip: (1.10), ipnet: 188.121.40.0/22(0.50), asn: 26496(0.20),
 country: US(-0.05)]; 
 RCVD_IN_DNSWL_NONE(0.00)[193.43.121.188.list.dnswl.org : 127.0.5.0];
 R_DKIM_PERMFAIL(0.00)[oceandigihub.com:s=default];
 R_SPF_NA(0.00)[];
 HAS_X_GMSV(0.00)[susan.jackson@oceandigihub.com];
 RCVD_TLS_ALL(0.00)[]
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 19:52:19 -0000

Hi,

I'm Curious to know if you would be interested in a Records of Cisco
Firewall Users List for your sales and marketing campaigns.

 

We also have related technology users like: Sonicwall, Pfsense, Fortinrt,
Juniper, Palo Alto, Router, Checkpoint, Acl, Sophos and many more.

 

Note: We would provide any industry any job title of contact lists as per
your requirements.


Let me know if you are Interested So that I can get back to you with counts
and pricing details for your review.

Regards 

Susan Jackson 

Sr. Marketing Manager

 

If you are not interested please reply with "Not Interested" In the Subject
Line.

 


From owner-svn-src-head@freebsd.org  Wed Jul 31 20:04:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CD91A7637;
 Wed, 31 Jul 2019 20:04:40 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zPXS1Hncz4HDN;
 Wed, 31 Jul 2019 20:04: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F7136E81;
 Wed, 31 Jul 2019 20:04: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 x6VK4dWq082321;
 Wed, 31 Jul 2019 20:04:39 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VK4d74082320;
 Wed, 31 Jul 2019 20:04:39 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907312004.x6VK4d74082320@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Wed, 31 Jul 2019 20:04:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350483 - head/lib/libthr/thread
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/lib/libthr/thread
X-SVN-Commit-Revision: 350483
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zPXS1Hncz4HDN
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.41 / 15.00];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.41)[-0.414,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 20:04:40 -0000

Author: kib
Date: Wed Jul 31 20:04:39 2019
New Revision: 350483
URL: https://svnweb.freebsd.org/changeset/base/350483

Log:
  Avoid conflicts with libc symbols in libthr jump table.
  
  In some corner cases of static linking and unexpected libraries order
  on the linker command line, libc symbol might preempt the same libthr
  symbol, in which case libthr jump table points back to libc causing
  either infinite recursion or loop.  Handle all of such symbols by
  using private libthr names for them, ensuring that the right pointers
  are installed into the table.
  
  In collaboration with: arichardson
  PR:	239475
  Tested by:	pho
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D21088

Modified:
  head/lib/libthr/thread/thr_private.h

Modified: head/lib/libthr/thread/thr_private.h
==============================================================================
--- head/lib/libthr/thread/thr_private.h	Wed Jul 31 19:32:39 2019	(r350482)
+++ head/lib/libthr/thread/thr_private.h	Wed Jul 31 20:04:39 2019	(r350483)
@@ -1021,8 +1021,6 @@ void __thr_cleanup_push_imp(void (*)(void *), void *,
 void __thr_cleanup_pop_imp(int);
 void _thr_cleanup_push(void (*)(void *), void *);
 void _thr_cleanup_pop(int);
-void _thr_cancel_enter(struct pthread *);
-void _thr_cancel_leave(struct pthread *, int);
 void _Tthr_testcancel(void);
 int _thr_cancel(pthread_t);
 int _thr_atfork(void (*)(void), void (*)(void), void (*)(void));

From owner-svn-src-head@freebsd.org  Wed Jul 31 20:23:12 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9CB5A7C48;
 Wed, 31 Jul 2019 20:23:12 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zPxr3zsxz4JJ5;
 Wed, 31 Jul 2019 20:23:12 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A88C7215;
 Wed, 31 Jul 2019 20:23:12 +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 x6VKNCBw094361;
 Wed, 31 Jul 2019 20:23:12 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VKNARv094353;
 Wed, 31 Jul 2019 20:23:10 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201907312023.x6VKNARv094353@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Wed, 31 Jul 2019 20:23:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350484 - in head/sys: amd64/amd64 compat/freebsd32
 compat/ia32 kern sys
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: in head/sys: amd64/amd64 compat/freebsd32 compat/ia32 kern
 sys
X-SVN-Commit-Revision: 350484
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zPxr3zsxz4JJ5
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.38 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.38)[0.378,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 20:23:12 -0000

Author: kib
Date: Wed Jul 31 20:23:10 2019
New Revision: 350484
URL: https://svnweb.freebsd.org/changeset/base/350484

Log:
  Make randomized stack gap between strings and pointers to argv/envs.
  
  This effectively makes the stack base on the csu _start entry
  randomized.
  
  The gap is enabled if ASLR is for the ABI is enabled, and then
  kern.elf{64,32}.aslr.stack_gap specify the max percentage of the
  initial stack size that can be wasted for gap.  Setting it to zero
  disables the gap, and max is capped at 50%.
  
  Only amd64 for now.
  
  Reviewed by:	cem, markj
  Discussed with:	emaste
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D21081

Modified:
  head/sys/amd64/amd64/elf_machdep.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/ia32/ia32_sysvec.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_exec.c
  head/sys/sys/imgact.h
  head/sys/sys/imgact_elf.h
  head/sys/sys/sysent.h

Modified: head/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- head/sys/amd64/amd64/elf_machdep.c	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/amd64/amd64/elf_machdep.c	Wed Jul 31 20:23:10 2019	(r350484)
@@ -82,6 +82,7 @@ struct sysentvec elf64_freebsd_sysvec = {
 	.sv_schedtail	= NULL,
 	.sv_thread_detach = NULL,
 	.sv_trap	= NULL,
+	.sv_stackgap	= elf64_stackgap,
 };
 INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
 

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Wed Jul 31 20:23:10 2019	(r350484)
@@ -3166,6 +3166,9 @@ freebsd32_copyout_strings(struct image_params *imgp)
 	destp = rounddown2(destp, sizeof(uint32_t));
 
 	vectp = (uint32_t *)destp;
+	if (imgp->sysent->sv_stackgap != NULL)
+		imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp);
+
 	if (imgp->auxargs) {
 		/*
 		 * Allocate room on the stack for the ELF auxargs

Modified: head/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- head/sys/compat/ia32/ia32_sysvec.c	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/compat/ia32/ia32_sysvec.c	Wed Jul 31 20:23:10 2019	(r350484)
@@ -128,6 +128,7 @@ struct sysentvec ia32_freebsd_sysvec = {
 	.sv_schedtail	= NULL,
 	.sv_thread_detach = NULL,
 	.sv_trap	= NULL,
+	.sv_stackgap	= elf32_stackgap,
 };
 INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec);
 

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/kern/imgact_elf.c	Wed Jul 31 20:23:10 2019	(r350484)
@@ -156,6 +156,12 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLA
     &__elfN(aslr_honor_sbrk), 0,
     __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": assume sbrk is used");
 
+static int __elfN(aslr_stack_gap) = 3;
+SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, stack_gap, CTLFLAG_RW,
+    &__elfN(aslr_stack_gap), 0,
+    __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
+    ": maximum percentage of main stack to waste on a random gap");
+
 static Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
 
 #define	aligned(a, t)	(rounddown2((u_long)(a), sizeof(t)) == (u_long)(a))
@@ -2719,4 +2725,25 @@ __elfN(untrans_prot)(vm_prot_t prot)
 	if (prot & VM_PROT_WRITE)
 		flags |= PF_W;
 	return (flags);
+}
+
+void
+__elfN(stackgap)(struct image_params *imgp, u_long *stack_base)
+{
+	u_long range, rbase, gap;
+	int pct;
+
+	if ((imgp->map_flags & MAP_ASLR) == 0)
+		return;
+	pct = __elfN(aslr_stack_gap);
+	if (pct == 0)
+		return;
+	if (pct > 50)
+		pct = 50;
+	range = imgp->eff_stack_sz * pct / 100;
+	range *= pct;
+	arc4rand(&rbase, sizeof(rbase), 0);
+	gap = rbase % range;
+	gap &= ~(sizeof(u_long) - 1);
+	*stack_base -= gap;
 }

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/kern/kern_exec.c	Wed Jul 31 20:23:10 2019	(r350484)
@@ -1128,6 +1128,7 @@ exec_new_vmspace(struct image_params *imgp, struct sys
 	} else {
 		ssiz = maxssiz;
 	}
+	imgp->eff_stack_sz = ssiz;
 	stack_addr = sv->sv_usrstack - ssiz;
 	error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz,
 	    obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot :
@@ -1615,6 +1616,9 @@ exec_copyout_strings(struct image_params *imgp)
 	destp = rounddown2(destp, sizeof(void *));
 
 	vectp = (char **)destp;
+	if (imgp->sysent->sv_stackgap != NULL)
+		imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp);
+
 	if (imgp->auxargs) {
 		/*
 		 * Allocate room on the stack for the ELF auxargs

Modified: head/sys/sys/imgact.h
==============================================================================
--- head/sys/sys/imgact.h	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/sys/imgact.h	Wed Jul 31 20:23:10 2019	(r350484)
@@ -87,6 +87,7 @@ struct image_params {
 	int pagesizeslen;
 	vm_prot_t stack_prot;
 	u_long stack_sz;
+	u_long eff_stack_sz;
 	struct ucred *newcred;		/* new credentials if changing */
 	bool credential_setid;		/* true if becoming setid */
 	bool textset;

Modified: head/sys/sys/imgact_elf.h
==============================================================================
--- head/sys/sys/imgact_elf.h	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/sys/imgact_elf.h	Wed Jul 31 20:23:10 2019	(r350484)
@@ -98,6 +98,7 @@ int	__elfN(remove_brand_entry)(Elf_Brandinfo *entry);
 int	__elfN(freebsd_fixup)(register_t **, struct image_params *);
 int	__elfN(coredump)(struct thread *, struct vnode *, off_t, int);
 size_t	__elfN(populate_note)(int, void *, void *, size_t, void **);
+void	__elfN(stackgap)(struct image_params *, u_long *);
 
 /* Machine specific function to dump per-thread information. */
 void	__elfN(dump_thread)(struct thread *, void *, size_t *);

Modified: head/sys/sys/sysent.h
==============================================================================
--- head/sys/sys/sysent.h	Wed Jul 31 20:04:39 2019	(r350483)
+++ head/sys/sys/sysent.h	Wed Jul 31 20:23:10 2019	(r350484)
@@ -109,6 +109,7 @@ struct sysentvec {
 	int		(*sv_coredump)(struct thread *, struct vnode *, off_t, int);
 					/* function to dump core, or NULL */
 	int		(*sv_imgact_try)(struct image_params *);
+	void		(*sv_stackgap)(struct image_params *, u_long *);
 	int		sv_minsigstksz;	/* minimum signal stack size */
 	vm_offset_t	sv_minuser;	/* VM_MIN_ADDRESS */
 	vm_offset_t	sv_maxuser;	/* VM_MAXUSER_ADDRESS */

From owner-svn-src-head@freebsd.org  Wed Jul 31 20:31:37 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F12FA8042;
 Wed, 31 Jul 2019 20:31:37 +0000 (UTC)
 (envelope-from luporl@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zQ7Y1ylyz4Jqs;
 Wed, 31 Jul 2019 20:31:37 +0000 (UTC)
 (envelope-from luporl@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 264FF7293;
 Wed, 31 Jul 2019 20:31:37 +0000 (UTC)
 (envelope-from luporl@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VKVa33097698;
 Wed, 31 Jul 2019 20:31:36 GMT (envelope-from luporl@FreeBSD.org)
Received: (from luporl@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VKVaaq097695;
 Wed, 31 Jul 2019 20:31:36 GMT (envelope-from luporl@FreeBSD.org)
Message-Id: <201907312031.x6VKVaaq097695@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: luporl set sender to
 luporl@FreeBSD.org using -f
From: Leandro Lupori <luporl@FreeBSD.org>
Date: Wed, 31 Jul 2019 20:31:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350485 - head/stand/powerpc/ofw
X-SVN-Group: head
X-SVN-Commit-Author: luporl
X-SVN-Commit-Paths: head/stand/powerpc/ofw
X-SVN-Commit-Revision: 350485
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zQ7Y1ylyz4Jqs
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.43 / 15.00];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_SHORT(-0.43)[-0.428,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 20:31:37 -0000

Author: luporl
Date: Wed Jul 31 20:31:36 2019
New Revision: 350485
URL: https://svnweb.freebsd.org/changeset/base/350485

Log:
  [PPC64] Implement CAS
  
  Guest PPC OSs running under a hypervisor may communicate the features they
  support, in order for the hypervisor to expose a virtualized machine in the way
  the client (guest OS) expects (see LoPAPR 1.1 - B.6.2.3).
  
  This is done by calling the "/ibm,client-architecture-support" (CAS) method,
  informing supported features in option vectors.  Until now, FreeBSD wasn't
  using CAS, but instead relied on hypervisor/QEMU's defaults.
  
  The problem is that, without CAS, it is very inconvenient to run POWER9 VMs on
  a POWER9 host running with radix enabled.  This happens because, in this case,
  the QEMU default is to present the guest OS a dual MMU (HPT/RPT), instead of
  presenting a regular HPT MMU, as FreeBSD expects, resulting in an early panic.
  The known workarounds required either changing the host to disable radix or
  passing a flag to QEMU to run in a POWER8 compatible mode.
  
  With CAS, FreeBSD is now able to communicate that it wants an HPT MMU,
  independent of the host setup, which now makes FreeBSD work on POWER9/pseries,
  with KVM enabled and without hugepages (support added in a previous commit).
  
  As CAS is invoked through OpenFirmware's call-method interface, it needs to be
  performed early, when OpenFirmware is still operational. Besides, now that FDT
  is the default way to inspect the device tree on PPC, OFW call-method feature
  will be unavailable by default, when control is passed to the kernel. Because
  of this, the call to CAS is being performed at the loader, instead of at the
  kernel.
  
  To avoid regressions with old platforms, this change uses CAS only on
  POWER8/POWER9.
  
  Reviewed by:	jhibbits
  Differential Revision:	https://reviews.freebsd.org/D20827

Added:
  head/stand/powerpc/ofw/cas.c   (contents, props changed)
Modified:
  head/stand/powerpc/ofw/Makefile
  head/stand/powerpc/ofw/main.c

Modified: head/stand/powerpc/ofw/Makefile
==============================================================================
--- head/stand/powerpc/ofw/Makefile	Wed Jul 31 20:23:10 2019	(r350484)
+++ head/stand/powerpc/ofw/Makefile	Wed Jul 31 20:31:36 2019	(r350485)
@@ -25,6 +25,11 @@ SRCS+=		ucmpdi2.c
 SRCS+=		ofwfdt.c
 .endif
 
+.if ${MACHINE_ARCH} == "powerpc64"
+SRCS+=		cas.c
+CFLAGS+=	-DCAS
+.endif
+
 HELP_FILES=	${FDTSRC}/help.fdt
 
 # Always add MI sources
@@ -34,7 +39,7 @@ HELP_FILES=	${FDTSRC}/help.fdt
 
 # load address. set in linker script
 RELOC?=		0x1C00000
-CFLAGS+=	-DRELOC=${RELOC}
+CFLAGS+=	-DRELOC=${RELOC} -g
 
 LDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.powerpc
 

Added: head/stand/powerpc/ofw/cas.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/stand/powerpc/ofw/cas.c	Wed Jul 31 20:31:36 2019	(r350485)
@@ -0,0 +1,225 @@
+/*-
+ * Copyright (c) 2019 Leandro Lupori
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <openfirm.h>
+#include <stand.h>
+
+/* PVR */
+#define PVR_VER_P8E		0x004b0000
+#define PVR_VER_P8NVL		0x004c0000
+#define PVR_VER_P8		0x004d0000
+#define PVR_VER_P9		0x004e0000
+#define PVR_VER_MASK		0xffff0000
+
+/* loader version of kernel's CPU_MAXSIZE */
+#define MAX_CPUS		((uint32_t)256u)
+
+/* Option Vectors' settings */
+
+/* length of ignored OV */
+#define OV_IGN_LEN		0
+
+/* byte 1 (of any OV) */
+#define OV_IGN			0x80
+
+/* Option Vector 5 */
+
+/* byte 2 */
+#define OV5_LPAR		0x80
+#define OV5_SPLPAR		0x40
+#define OV5_DRMEM		0x20
+#define OV5_LP			0x10
+#define OV5_ALPHA_PART		0x08
+#define OV5_DMA_DELAY		0x04
+#define OV5_DONATE_CPU		0x02
+#define OV5_MSI			0x01
+
+/* 9-12: max cpus */
+#define OV5_MAX_CPUS(n)		((MAX_CPUS >> (3*8 - (n)*8)) & 0xff)
+
+/* 13-14: LoPAPR Level */
+#define LOPAPR_LEVEL		0x0101	/* 1.1 */
+#define OV5_LOPAPR_LEVEL(n)	((LOPAPR_LEVEL >> (8 - (n)*8)) & 0xff)
+
+/* byte 17: Platform Facilities */
+#define OV5_RNG			0x80
+#define OV5_COMP_ENG		0x40
+#define OV5_ENC_ENG		0x20
+
+/* byte 21: Sub-Processors */
+#define OV5_NO_SUBPROCS		0
+#define OV5_SUBPROCS		1
+
+/* byte 23: interrupt controller */
+#define OV5_INTC_XICS		0
+
+/* byte 24: MMU */
+#define OV5_MMU_HPT		0
+
+/* byte 25: HPT MMU Extensions */
+#define OV5_HPT_EXT_NONE	0
+
+/* byte 26: Radix MMU Extensions */
+#define OV5_RPT_EXT_NONE	0
+
+
+struct pvr {
+	uint32_t	mask;
+	uint32_t	val;
+};
+
+struct opt_vec_ignore {
+	char	data[2];
+} __packed;
+
+struct opt_vec4 {
+	char data[3];
+} __packed;
+
+struct opt_vec5 {
+	char data[27];
+} __packed;
+
+static struct ibm_arch_vec {
+	struct pvr		pvr_list[5];
+	uint8_t			num_opts;
+	struct opt_vec_ignore	vec1;
+	struct opt_vec_ignore	vec2;
+	struct opt_vec_ignore	vec3;
+	struct opt_vec4		vec4;
+	struct opt_vec5		vec5;
+} __packed ibm_arch_vec = {
+	/* pvr_list */ {
+		{ PVR_VER_MASK, PVR_VER_P8 },		/* POWER8 */
+		{ PVR_VER_MASK, PVR_VER_P8E },		/* POWER8E */
+		{ PVR_VER_MASK, PVR_VER_P8NVL },	/* POWER8NVL */
+		{ PVR_VER_MASK, PVR_VER_P9 },		/* POWER9 */
+		{ 0, 0xffffffffu }			/* terminator */
+	},
+	4,	/* num_opts (4 actually means 5 option vectors) */
+	{ OV_IGN_LEN, OV_IGN },		/* OV1 */
+	{ OV_IGN_LEN, OV_IGN },		/* OV2 */
+	{ OV_IGN_LEN, OV_IGN },		/* OV3 */
+	/* OV4 (can't be ignored) */ {
+		sizeof(struct opt_vec4) - 2,	/* length (n-2) */
+		0,
+		10 /* Minimum VP entitled capacity percentage * 100
+		    * (if absent assume 10%) */
+	},
+	/* OV5 */ {
+		sizeof(struct opt_vec5) - 2,	/* length (n-2) */
+		0,				/* don't ignore */
+		OV5_LPAR | OV5_SPLPAR | OV5_LP | OV5_MSI,
+		0,
+		0,	/* Cooperative Memory Over-commitment */
+		0,	/* Associativity Information Option */
+		0,	/* Binary Option Controls */
+		0,	/* Reserved */
+		0,	/* Reserved */
+		OV5_MAX_CPUS(0),
+		OV5_MAX_CPUS(1),		/* 10 */
+		OV5_MAX_CPUS(2),
+		OV5_MAX_CPUS(3),
+		OV5_LOPAPR_LEVEL(0),
+		OV5_LOPAPR_LEVEL(1),
+		0,	/* Reserved */
+		0,	/* Reserved */
+		0,	/* Platform Facilities */
+		0,	/* Reserved */
+		0,	/* Reserved */
+		0,	/* Reserved */		/* 20 */
+		OV5_NO_SUBPROCS,
+		0,	/* DRMEM_V2 */
+		OV5_INTC_XICS,
+		OV5_MMU_HPT,
+		OV5_HPT_EXT_NONE,
+		OV5_RPT_EXT_NONE
+	}
+};
+
+static __inline register_t
+mfpvr(void)
+{
+	register_t value;
+
+	__asm __volatile ("mfpvr %0" : "=r"(value));
+
+	return (value);
+}
+
+static __inline int
+ppc64_hv(void)
+{
+	int hv;
+
+	/* PSL_HV is bit 3 of 64-bit MSR */
+	__asm __volatile ("mfmsr %0\n\t"
+		"rldicl %0,%0,4,63" : "=r"(hv));
+
+	return (hv);
+}
+
+int
+ppc64_cas(void)
+{
+	int rc;
+	ihandle_t ihandle;
+	cell_t err;
+
+	/* Skip CAS when running on PowerNV */
+	if (!ppc64_hv())
+		return (0);
+
+	/* Perform CAS only for POWER8 and later cores */
+	switch (mfpvr() & PVR_VER_MASK) {
+		case PVR_VER_P8:
+		case PVR_VER_P8E:
+		case PVR_VER_P8NVL:
+		case PVR_VER_P9:
+			break;
+		default:
+			return (0);
+	}
+
+	ihandle = OF_open("/");
+	if (ihandle == -1) {
+		printf("cas: failed to open / node\n");
+		return (-1);
+	}
+
+	if (rc = OF_call_method("ibm,client-architecture-support",
+	    ihandle, 1, 1, &ibm_arch_vec, &err))
+		printf("cas: failed to call CAS method\n");
+	else if (err) {
+		printf("cas: error: 0x%08lX\n", err);
+		rc = -1;
+	}
+
+	OF_close(ihandle);
+	return (rc);
+}

Modified: head/stand/powerpc/ofw/main.c
==============================================================================
--- head/stand/powerpc/ofw/main.c	Wed Jul 31 20:23:10 2019	(r350484)
+++ head/stand/powerpc/ofw/main.c	Wed Jul 31 20:31:36 2019	(r350485)
@@ -89,6 +89,21 @@ memsize(void)
 	return (memsz);
 }
 
+#ifdef CAS
+extern int ppc64_cas(void);
+
+static int
+ppc64_autoload(void)
+{
+	const char *cas;
+
+	if ((cas = getenv("cas")) && cas[0] == '1')
+		if (ppc64_cas() != 0)
+			return (-1);
+	return (ofw_autoload());
+}
+#endif
+
 int
 main(int (*openfirm)(void *))
 {
@@ -169,7 +184,12 @@ main(int (*openfirm)(void *))
 	archsw.arch_copyin = ofw_copyin;
 	archsw.arch_copyout = ofw_copyout;
 	archsw.arch_readin = ofw_readin;
+#ifdef CAS
+	setenv("cas", "1", 0);
+	archsw.arch_autoload = ppc64_autoload;
+#else
 	archsw.arch_autoload = ofw_autoload;
+#endif
 
 	interact();				/* doesn't return */
 

From owner-svn-src-head@freebsd.org  Wed Jul 31 21:21:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BFFEA8E9D;
 Wed, 31 Jul 2019 21:21:35 +0000 (UTC)
 (envelope-from wosch@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zRFC1Ksdz4Mhj;
 Wed, 31 Jul 2019 21:21:35 +0000 (UTC)
 (envelope-from wosch@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 111BD7CBF;
 Wed, 31 Jul 2019 21:21:35 +0000 (UTC)
 (envelope-from wosch@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VLLYAG026588;
 Wed, 31 Jul 2019 21:21:34 GMT (envelope-from wosch@FreeBSD.org)
Received: (from wosch@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VLLYAT026587;
 Wed, 31 Jul 2019 21:21:34 GMT (envelope-from wosch@FreeBSD.org)
Message-Id: <201907312121.x6VLLYAT026587@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: wosch set sender to
 wosch@FreeBSD.org using -f
From: Wolfram Schneider <wosch@FreeBSD.org>
Date: Wed, 31 Jul 2019 21:21:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350486 - head/cddl/contrib/opensolaris/cmd/zfs
X-SVN-Group: head
X-SVN-Commit-Author: wosch
X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs
X-SVN-Commit-Revision: 350486
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zRFC1Ksdz4Mhj
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.06 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_SPAM_SHORT(0.06)[0.057,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 21:21:35 -0000

Author: wosch
Date: Wed Jul 31 21:21:34 2019
New Revision: 350486
URL: https://svnweb.freebsd.org/changeset/base/350486

Log:
  add forgotten opening bracket "("
  
  PR:		237514
  Reviewed by:	allanjude
  MFC after:	soon for 11.3 and 12 series
  Differential Revision:	https://reviews.freebsd.org/D21009

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Wed Jul 31 20:31:36 2019	(r350485)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8	Wed Jul 31 21:21:34 2019	(r350486)
@@ -1501,7 +1501,9 @@ command, or by changing the value of the
 .Sy refreservation
 property, or
 .Sy reservation
-property on pool version 8 or earlier
+property on pool 
+.Po
+version 8 or earlier
 .Pc
 after the volume has been created.
 A "sparse volume" is a volume where the value of

From owner-svn-src-head@freebsd.org  Wed Jul 31 21:29:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 280B4A9175;
 Wed, 31 Jul 2019 21:29:18 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zRQ605TZz4N8T;
 Wed, 31 Jul 2019 21:29:18 +0000 (UTC)
 (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F28357D46;
 Wed, 31 Jul 2019 21:29:17 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VLTHuL031628;
 Wed, 31 Jul 2019 21:29:17 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VLTHSO031627;
 Wed, 31 Jul 2019 21:29:17 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907312129.x6VLTHSO031627@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Wed, 31 Jul 2019 21:29:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350487 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350487
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zRQ605TZz4N8T
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.44 / 15.00];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.44)[0.445,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 21:29:18 -0000

Author: tuexen
Date: Wed Jul 31 21:29:17 2019
New Revision: 350487
URL: https://svnweb.freebsd.org/changeset/base/350487

Log:
  Consistently cleanup mbufs in case of other memory errors.
  
  MFC after:		3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Wed Jul 31 21:21:34 2019	(r350486)
+++ head/sys/netinet/sctp_output.c	Wed Jul 31 21:29:17 2019	(r350487)
@@ -5586,8 +5586,7 @@ do_a_abort:
 	m = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA);
 	if (m == NULL) {
 		/* No memory, INIT timer will re-attempt. */
-		if (op_err)
-			sctp_m_freem(op_err);
+		sctp_m_freem(op_err);
 		return;
 	}
 	chunk_len = (uint16_t)sizeof(struct sctp_init_ack_chunk);
@@ -5776,8 +5775,11 @@ do_a_abort:
 				net->ro._s_addr = sctp_source_address_selection(inp,
 				    stcb, (sctp_route_t *)&net->ro,
 				    net, 0, vrf_id);
-				if (net->ro._s_addr == NULL)
+				if (net->ro._s_addr == NULL) {
+					sctp_m_freem(op_err);
+					sctp_m_freem(m);
 					return;
+				}
 
 				net->src_addr_selected = 1;
 
@@ -5806,8 +5808,11 @@ do_a_abort:
 				net->ro._s_addr = sctp_source_address_selection(inp,
 				    stcb, (sctp_route_t *)&net->ro,
 				    net, 0, vrf_id);
-				if (net->ro._s_addr == NULL)
+				if (net->ro._s_addr == NULL) {
+					sctp_m_freem(op_err);
+					sctp_m_freem(m);
 					return;
+				}
 
 				net->src_addr_selected = 1;
 			}
@@ -5878,6 +5883,7 @@ do_a_abort:
 	so = inp->sctp_socket;
 	if (so == NULL) {
 		/* memory problem */
+		sctp_m_freem(op_err);
 		sctp_m_freem(m);
 		return;
 	} else {

From owner-svn-src-head@freebsd.org  Wed Jul 31 21:39:03 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6529A942E;
 Wed, 31 Jul 2019 21:39:03 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zRdM4rS1z4NdS;
 Wed, 31 Jul 2019 21:39:03 +0000 (UTC)
 (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87CFC7F24;
 Wed, 31 Jul 2019 21:39:03 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VLd3GC037521;
 Wed, 31 Jul 2019 21:39:03 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VLd35X037520;
 Wed, 31 Jul 2019 21:39:03 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201907312139.x6VLd35X037520@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Wed, 31 Jul 2019 21:39:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350488 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350488
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zRdM4rS1z4NdS
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.44 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.44)[0.445,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 21:39:03 -0000

Author: tuexen
Date: Wed Jul 31 21:39:03 2019
New Revision: 350488
URL: https://svnweb.freebsd.org/changeset/base/350488

Log:
  Small cleanup, no functional change intended.
  
  MFC after:		3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Wed Jul 31 21:29:17 2019	(r350487)
+++ head/sys/netinet/sctp_output.c	Wed Jul 31 21:39:03 2019	(r350488)
@@ -9089,7 +9089,6 @@ sctp_send_heartbeat_ack(struct sctp_tcb *stcb,
 	struct sctp_chunkhdr *chdr;
 	struct sctp_tmit_chunk *chk;
 
-
 	if (net == NULL)
 		/* must have a net pointer */
 		return;
@@ -9107,13 +9106,8 @@ sctp_send_heartbeat_ack(struct sctp_tcb *stcb,
 	chdr = mtod(outchain, struct sctp_chunkhdr *);
 	chdr->chunk_type = SCTP_HEARTBEAT_ACK;
 	chdr->chunk_flags = 0;
-	if (chk_length % 4) {
-		/* need pad */
-		uint32_t cpthis = 0;
-		int padlen;
-
-		padlen = 4 - (chk_length % 4);
-		m_copyback(outchain, chk_length, padlen, (caddr_t)&cpthis);
+	if (chk_length % 4 != 0) {
+		sctp_pad_lastmbuf(outchain, 4 - (chk_length % 4), NULL);
 	}
 	sctp_alloc_a_chunk(stcb, chk);
 	if (chk == NULL) {

From owner-svn-src-head@freebsd.org  Wed Jul 31 22:44:59 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DF4CAA48E;
 Wed, 31 Jul 2019 22:44:59 +0000 (UTC)
 (envelope-from mckusick@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zT5R3PSqz4RmK;
 Wed, 31 Jul 2019 22:44:59 +0000 (UTC)
 (envelope-from mckusick@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5295C8BC1;
 Wed, 31 Jul 2019 22:44:59 +0000 (UTC)
 (envelope-from mckusick@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VMixV9078543;
 Wed, 31 Jul 2019 22:44:59 GMT (envelope-from mckusick@FreeBSD.org)
Received: (from mckusick@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VMiwcw078539;
 Wed, 31 Jul 2019 22:44:58 GMT (envelope-from mckusick@FreeBSD.org)
Message-Id: <201907312244.x6VMiwcw078539@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mckusick set sender to
 mckusick@FreeBSD.org using -f
From: Kirk McKusick <mckusick@FreeBSD.org>
Date: Wed, 31 Jul 2019 22:44:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350490 - in head/sys/ufs: ffs ufs
X-SVN-Group: head
X-SVN-Commit-Author: mckusick
X-SVN-Commit-Paths: in head/sys/ufs: ffs ufs
X-SVN-Commit-Revision: 350490
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zT5R3PSqz4RmK
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.50 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_SHORT(0.50)[0.495,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 22:44:59 -0000

Author: mckusick
Date: Wed Jul 31 22:44:58 2019
New Revision: 350490
URL: https://svnweb.freebsd.org/changeset/base/350490

Log:
  When updating the user or group disk quotas for the return of inodes or
  disk blocks, set the FORCE flag in the call to chkiq() or chkdq() since
  the user is always allowed to return resources and hence there is no need
  to check the user's credential .
  
  Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
  Reported as:    FS-1-UFS-1: Denial Of Service in mount (prison_priv_check)
  Discussed with: kib
  MFC:            1 week
  Sponsored by:   Netflix

Modified:
  head/sys/ufs/ffs/ffs_inode.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ufs/ufs_quota.c
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ffs/ffs_inode.c
==============================================================================
--- head/sys/ufs/ffs/ffs_inode.c	Wed Jul 31 21:48:35 2019	(r350489)
+++ head/sys/ufs/ffs/ffs_inode.c	Wed Jul 31 22:44:58 2019	(r350490)
@@ -263,7 +263,7 @@ ffs_truncate(vp, length, flags, cred)
 			if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
 				return (error);
 #ifdef QUOTA
-			(void) chkdq(ip, -extblocks, NOCRED, 0);
+			(void) chkdq(ip, -extblocks, NOCRED, FORCE);
 #endif
 			vinvalbuf(vp, V_ALT, 0, 0);
 			vn_pages_remove(vp,
@@ -621,7 +621,7 @@ done:
 		DIP_SET(ip, i_blocks, 0);
 	ip->i_flag |= IN_CHANGE;
 #ifdef QUOTA
-	(void) chkdq(ip, -blocksreleased, NOCRED, 0);
+	(void) chkdq(ip, -blocksreleased, NOCRED, FORCE);
 #endif
 	return (allerror);
 

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Wed Jul 31 21:48:35 2019	(r350489)
+++ head/sys/ufs/ffs/ffs_softdep.c	Wed Jul 31 22:44:58 2019	(r350490)
@@ -6682,7 +6682,7 @@ softdep_journal_freeblocks(ip, cred, length, flags)
 #ifdef QUOTA
 	/* Reference the quotas in case the block count is wrong in the end. */
 	quotaref(vp, freeblks->fb_quota);
-	(void) chkdq(ip, -datablocks, NOCRED, 0);
+	(void) chkdq(ip, -datablocks, NOCRED, FORCE);
 #endif
 	freeblks->fb_chkcnt = -datablocks;
 	UFS_LOCK(ump);
@@ -6946,7 +6946,7 @@ softdep_setup_freeblocks(ip, length, flags)
 #ifdef QUOTA
 	/* Reference the quotas in case the block count is wrong in the end. */
 	quotaref(ITOV(ip), freeblks->fb_quota);
-	(void) chkdq(ip, -datablocks, NOCRED, 0);
+	(void) chkdq(ip, -datablocks, NOCRED, FORCE);
 #endif
 	freeblks->fb_chkcnt = -datablocks;
 	UFS_LOCK(ump);

Modified: head/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- head/sys/ufs/ufs/ufs_quota.c	Wed Jul 31 21:48:35 2019	(r350489)
+++ head/sys/ufs/ufs/ufs_quota.c	Wed Jul 31 22:44:58 2019	(r350490)
@@ -159,6 +159,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct uc
 	struct vnode *vp = ITOV(ip);
 	int i, error, warn, do_check;
 
+	MPASS(cred != NOCRED || (flags & FORCE) != 0);
 	/*
 	 * Disk quotas must be turned off for system files.  Currently
 	 * snapshot and quota files.
@@ -311,6 +312,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred
 	struct dquot *dq;
 	int i, error, warn, do_check;
 
+	MPASS(cred != NOCRED || (flags & FORCE) != 0);
 #ifdef DIAGNOSTIC
 	if ((flags & CHOWN) == 0)
 		chkdquot(ip);

Modified: head/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vnops.c	Wed Jul 31 21:48:35 2019	(r350489)
+++ head/sys/ufs/ufs/ufs_vnops.c	Wed Jul 31 22:44:58 2019	(r350490)
@@ -811,8 +811,8 @@ ufs_chown(vp, uid, gid, cred, td)
 		ip->i_dquot[GRPQUOTA] = NODQUOT;
 	}
 	change = DIP(ip, i_blocks);
-	(void) chkdq(ip, -change, cred, CHOWN);
-	(void) chkiq(ip, -1, cred, CHOWN);
+	(void) chkdq(ip, -change, cred, CHOWN|FORCE);
+	(void) chkiq(ip, -1, cred, CHOWN|FORCE);
 	for (i = 0; i < MAXQUOTAS; i++) {
 		dqrele(vp, ip->i_dquot[i]);
 		ip->i_dquot[i] = NODQUOT;

From owner-svn-src-head@freebsd.org  Wed Jul 31 23:36:23 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD802AB17F;
 Wed, 31 Jul 2019 23:36:23 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zVDl5Jfzz4V0f;
 Wed, 31 Jul 2019 23:36:23 +0000 (UTC)
 (envelope-from rmacklem@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 980A7953D;
 Wed, 31 Jul 2019 23:36:23 +0000 (UTC)
 (envelope-from rmacklem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VNaNbL008810;
 Wed, 31 Jul 2019 23:36:23 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VNaNVl008809;
 Wed, 31 Jul 2019 23:36:23 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201907312336.x6VNaNVl008809@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Wed, 31 Jul 2019 23:36:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350491 - head
X-SVN-Group: head
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: head
X-SVN-Commit-Revision: 350491
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zVDl5Jfzz4V0f
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.49 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_SPAM_SHORT(0.49)[0.486,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Jul 2019 23:36:23 -0000

Author: rmacklem
Date: Wed Jul 31 23:36:23 2019
New Revision: 350491
URL: https://svnweb.freebsd.org/changeset/base/350491

Log:
  Add an entry for the copy_file_range(2) syscall.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==============================================================================
--- head/RELNOTES	Wed Jul 31 22:44:58 2019	(r350490)
+++ head/RELNOTES	Wed Jul 31 23:36:23 2019	(r350491)
@@ -14,6 +14,9 @@ r350471:
        gnop(8) can now configure a delay to be applied to read and write
        request delays.  See the -d, -q and -x parameters.
 
+r350315, r350316:
+	Adds a Linux compatible copy_file_range(2) syscall.
+
 r350307:
 	libcap_random(3) has been removed.  Applications can use native
 	APIs to get random data in capability mode.

From owner-svn-src-head@freebsd.org  Thu Aug  1 02:16:51 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65034AE3F3;
 Thu,  1 Aug 2019 02:16:51 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zYnv1zQBz4bqX;
 Thu,  1 Aug 2019 02:16:51 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24F2FB267;
 Thu,  1 Aug 2019 02:16:51 +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 x712GoFC002763;
 Thu, 1 Aug 2019 02:16:50 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x712Gnko002754;
 Thu, 1 Aug 2019 02:16:49 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908010216.x712Gnko002754@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 02:16:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350492 - in head/sys/amd64: include vmm vmm/intel vmm/io
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: in head/sys/amd64: include vmm vmm/intel vmm/io
X-SVN-Commit-Revision: 350492
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zYnv1zQBz4bqX
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.39 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.78)[-0.776,0];
 NEURAL_SPAM_SHORT(0.38)[0.383,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 02:16:51 -0000

Author: emaste
Date: Thu Aug  1 02:16:48 2019
New Revision: 350492
URL: https://svnweb.freebsd.org/changeset/base/350492

Log:
  vmx: use C99 bool, not boolean_t
  
  Bhyve's vmm is a self-contained modern component and thus a good
  candidate for use of C99 types.
  
  Reviewed by:	jhb, kib, markj, Patrick Mooney
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21036

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/intel/vmx_msr.c
  head/sys/amd64/vmm/io/ppt.c
  head/sys/amd64/vmm/io/ppt.h
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_lapic.c
  head/sys/amd64/vmm/vmm_lapic.h
  head/sys/amd64/vmm/vmm_util.c
  head/sys/amd64/vmm/vmm_util.h

Modified: head/sys/amd64/include/vmm.h
==============================================================================
--- head/sys/amd64/include/vmm.h	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/include/vmm.h	Thu Aug  1 02:16:48 2019	(r350492)
@@ -319,12 +319,12 @@ vcpu_reqidle(struct vm_eventinfo *info)
 int vcpu_debugged(struct vm *vm, int vcpuid);
 
 /*
- * Return 1 if device indicated by bus/slot/func is supposed to be a
+ * Return true if device indicated by bus/slot/func is supposed to be a
  * pci passthrough device.
  *
- * Return 0 otherwise.
+ * Return false otherwise.
  */
-int vmm_is_pptdev(int bus, int slot, int func);
+bool vmm_is_pptdev(int bus, int slot, int func);
 
 void *vm_iommu_domain(struct vm *vm);
 

Modified: head/sys/amd64/vmm/intel/vmx.c
==============================================================================
--- head/sys/amd64/vmm/intel/vmx.c	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/intel/vmx.c	Thu Aug  1 02:16:48 2019	(r350492)
@@ -1973,20 +1973,20 @@ ept_fault_type(uint64_t ept_qual)
 	return (fault_type);
 }
 
-static boolean_t
+static bool
 ept_emulation_fault(uint64_t ept_qual)
 {
 	int read, write;
 
 	/* EPT fault on an instruction fetch doesn't make sense here */
 	if (ept_qual & EPT_VIOLATION_INST_FETCH)
-		return (FALSE);
+		return (false);
 
 	/* EPT fault must be a read fault or a write fault */
 	read = ept_qual & EPT_VIOLATION_DATA_READ ? 1 : 0;
 	write = ept_qual & EPT_VIOLATION_DATA_WRITE ? 1 : 0;
 	if ((read | write) == 0)
-		return (FALSE);
+		return (false);
 
 	/*
 	 * The EPT violation must have been caused by accessing a
@@ -1995,10 +1995,10 @@ ept_emulation_fault(uint64_t ept_qual)
 	 */
 	if ((ept_qual & EPT_VIOLATION_GLA_VALID) == 0 ||
 	    (ept_qual & EPT_VIOLATION_XLAT_VALID) == 0) {
-		return (FALSE);
+		return (false);
 	}
 
-	return (TRUE);
+	return (true);
 }
 
 static __inline int

Modified: head/sys/amd64/vmm/intel/vmx_msr.c
==============================================================================
--- head/sys/amd64/vmm/intel/vmx_msr.c	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/intel/vmx_msr.c	Thu Aug  1 02:16:48 2019	(r350492)
@@ -45,24 +45,18 @@ __FBSDID("$FreeBSD$");
 #include "vmx.h"
 #include "vmx_msr.h"
 
-static boolean_t
+static bool
 vmx_ctl_allows_one_setting(uint64_t msr_val, int bitpos)
 {
 
-	if (msr_val & (1UL << (bitpos + 32)))
-		return (TRUE);
-	else
-		return (FALSE);
+	return ((msr_val & (1UL << (bitpos + 32))) != 0);
 }
 
-static boolean_t
+static bool
 vmx_ctl_allows_zero_setting(uint64_t msr_val, int bitpos)
 {
 
-	if ((msr_val & (1UL << bitpos)) == 0)
-		return (TRUE);
-	else
-		return (FALSE);
+	return ((msr_val & (1UL << bitpos)) == 0);
 }
 
 uint32_t
@@ -89,16 +83,13 @@ vmx_set_ctlreg(int ctl_reg, int true_ctl_reg, uint32_t
 {
 	int i;
 	uint64_t val, trueval;
-	boolean_t true_ctls_avail, one_allowed, zero_allowed;
+	bool true_ctls_avail, one_allowed, zero_allowed;
 
 	/* We cannot ask the same bit to be set to both '1' and '0' */
 	if ((ones_mask ^ zeros_mask) != (ones_mask | zeros_mask))
 		return (EINVAL);
 
-	if (rdmsr(MSR_VMX_BASIC) & (1UL << 55))
-		true_ctls_avail = TRUE;
-	else
-		true_ctls_avail = FALSE;
+	true_ctls_avail = (rdmsr(MSR_VMX_BASIC) & (1UL << 55)) != 0;
 
 	val = rdmsr(ctl_reg);
 	if (true_ctls_avail)

Modified: head/sys/amd64/vmm/io/ppt.c
==============================================================================
--- head/sys/amd64/vmm/io/ppt.c	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/io/ppt.c	Thu Aug  1 02:16:48 2019	(r350492)
@@ -339,7 +339,7 @@ ppt_assigned_devices(struct vm *vm)
 	return (num);
 }
 
-boolean_t
+bool
 ppt_is_mmio(struct vm *vm, vm_paddr_t gpa)
 {
 	int i;
@@ -355,11 +355,11 @@ ppt_is_mmio(struct vm *vm, vm_paddr_t gpa)
 			if (seg->len == 0)
 				continue;
 			if (gpa >= seg->gpa && gpa < seg->gpa + seg->len)
-				return (TRUE);
+				return (true);
 		}
 	}
 
-	return (FALSE);
+	return (false);
 }
 
 static void

Modified: head/sys/amd64/vmm/io/ppt.h
==============================================================================
--- head/sys/amd64/vmm/io/ppt.h	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/io/ppt.h	Thu Aug  1 02:16:48 2019	(r350492)
@@ -39,7 +39,7 @@ int	ppt_setup_msi(struct vm *vm, int vcpu, int bus, in
 int	ppt_setup_msix(struct vm *vm, int vcpu, int bus, int slot, int func,
 		int idx, uint64_t addr, uint64_t msg, uint32_t vector_control);
 int	ppt_assigned_devices(struct vm *vm);
-boolean_t ppt_is_mmio(struct vm *vm, vm_paddr_t gpa);
+bool	ppt_is_mmio(struct vm *vm, vm_paddr_t gpa);
 
 /*
  * Returns the number of devices sequestered by the ppt driver for assignment

Modified: head/sys/amd64/vmm/vmm.c
==============================================================================
--- head/sys/amd64/vmm/vmm.c	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/vmm.c	Thu Aug  1 02:16:48 2019	(r350492)
@@ -847,7 +847,7 @@ vmm_sysmem_maxaddr(struct vm *vm)
 }
 
 static void
-vm_iommu_modify(struct vm *vm, boolean_t map)
+vm_iommu_modify(struct vm *vm, bool map)
 {
 	int i, sz;
 	vm_paddr_t gpa, hpa;
@@ -910,8 +910,8 @@ vm_iommu_modify(struct vm *vm, boolean_t map)
 		iommu_invalidate_tlb(vm->iommu);
 }
 
-#define	vm_iommu_unmap(vm)	vm_iommu_modify((vm), FALSE)
-#define	vm_iommu_map(vm)	vm_iommu_modify((vm), TRUE)
+#define	vm_iommu_unmap(vm)	vm_iommu_modify((vm), false)
+#define	vm_iommu_map(vm)	vm_iommu_modify((vm), true)
 
 int
 vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func)
@@ -1043,20 +1043,20 @@ vm_set_register(struct vm *vm, int vcpuid, int reg, ui
 	return (0);
 }
 
-static boolean_t
+static bool
 is_descriptor_table(int reg)
 {
 
 	switch (reg) {
 	case VM_REG_GUEST_IDTR:
 	case VM_REG_GUEST_GDTR:
-		return (TRUE);
+		return (true);
 	default:
-		return (FALSE);
+		return (false);
 	}
 }
 
-static boolean_t
+static bool
 is_segment_register(int reg)
 {
 	
@@ -1069,9 +1069,9 @@ is_segment_register(int reg)
 	case VM_REG_GUEST_GS:
 	case VM_REG_GUEST_TR:
 	case VM_REG_GUEST_LDTR:
-		return (TRUE);
+		return (true);
 	default:
-		return (FALSE);
+		return (false);
 	}
 }
 
@@ -2233,12 +2233,12 @@ vm_hpet(struct vm *vm)
 	return (vm->vhpet);
 }
 
-boolean_t
+bool
 vmm_is_pptdev(int bus, int slot, int func)
 {
-	int found, i, n;
-	int b, s, f;
+	int b, f, i, n, s;
 	char *val, *cp, *cp2;
+	bool found;
 
 	/*
 	 * XXX
@@ -2252,7 +2252,7 @@ vmm_is_pptdev(int bus, int slot, int func)
 	const char *names[] = { "pptdevs", "pptdevs2", "pptdevs3", NULL };
 
 	/* set pptdevs="1/2/3 4/5/6 7/8/9 10/11/12" */
-	found = 0;
+	found = false;
 	for (i = 0; names[i] != NULL && !found; i++) {
 		cp = val = kern_getenv(names[i]);
 		while (cp != NULL && *cp != '\0') {
@@ -2261,7 +2261,7 @@ vmm_is_pptdev(int bus, int slot, int func)
 
 			n = sscanf(cp, "%d/%d/%d", &b, &s, &f);
 			if (n == 3 && bus == b && slot == s && func == f) {
-				found = 1;
+				found = true;
 				break;
 			}
 		

Modified: head/sys/amd64/vmm/vmm_lapic.c
==============================================================================
--- head/sys/amd64/vmm/vmm_lapic.c	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/vmm_lapic.c	Thu Aug  1 02:16:48 2019	(r350492)
@@ -137,13 +137,10 @@ lapic_intr_msi(struct vm *vm, uint64_t addr, uint64_t 
 	return (0);
 }
 
-static boolean_t
+static bool
 x2apic_msr(u_int msr)
 {
-	if (msr >= 0x800 && msr <= 0xBFF)
-		return (TRUE);
-	else
-		return (FALSE);
+	return (msr >= 0x800 && msr <= 0xBFF);
 }
 
 static u_int
@@ -153,14 +150,11 @@ x2apic_msr_to_regoff(u_int msr)
 	return ((msr - 0x800) << 4);
 }
 
-boolean_t
+bool
 lapic_msr(u_int msr)
 {
 
-	if (x2apic_msr(msr) || (msr == MSR_APICBASE))
-		return (TRUE);
-	else
-		return (FALSE);
+	return (x2apic_msr(msr) || msr == MSR_APICBASE);
 }
 
 int

Modified: head/sys/amd64/vmm/vmm_lapic.h
==============================================================================
--- head/sys/amd64/vmm/vmm_lapic.h	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/vmm_lapic.h	Thu Aug  1 02:16:48 2019	(r350492)
@@ -33,7 +33,7 @@
 
 struct vm;
 
-boolean_t lapic_msr(u_int num);
+bool	lapic_msr(u_int num);
 int	lapic_rdmsr(struct vm *vm, int cpu, u_int msr, uint64_t *rval,
 	    bool *retu);
 int	lapic_wrmsr(struct vm *vm, int cpu, u_int msr, uint64_t wval,

Modified: head/sys/amd64/vmm/vmm_util.c
==============================================================================
--- head/sys/amd64/vmm/vmm_util.c	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/vmm_util.c	Thu Aug  1 02:16:48 2019	(r350492)
@@ -38,26 +38,20 @@ __FBSDID("$FreeBSD$");
 
 #include "vmm_util.h"
 
-boolean_t
+bool
 vmm_is_intel(void)
 {
 
-	if (strcmp(cpu_vendor, "GenuineIntel") == 0)
-		return (TRUE);
-	else
-		return (FALSE);
+	return (strcmp(cpu_vendor, "GenuineIntel") == 0);
 }
 
-boolean_t
+bool
 vmm_is_amd(void)
 {
-	if (strcmp(cpu_vendor, "AuthenticAMD") == 0)
-		return (TRUE);
-	else
-		return (FALSE);
+	return (strcmp(cpu_vendor, "AuthenticAMD") == 0);
 }
 
-boolean_t
+bool
 vmm_supports_1G_pages(void)
 {
 	unsigned int regs[4];
@@ -70,9 +64,9 @@ vmm_supports_1G_pages(void)
 	if (cpu_exthigh >= 0x80000001) {
 		do_cpuid(0x80000001, regs);
 		if (regs[3] & (1 << 26))
-			return (TRUE);
+			return (true);
 	}
-	return (FALSE);
+	return (false);
 }
 
 #include <sys/proc.h>

Modified: head/sys/amd64/vmm/vmm_util.h
==============================================================================
--- head/sys/amd64/vmm/vmm_util.h	Wed Jul 31 23:36:23 2019	(r350491)
+++ head/sys/amd64/vmm/vmm_util.h	Thu Aug  1 02:16:48 2019	(r350492)
@@ -33,9 +33,9 @@
 
 struct trapframe;
 
-boolean_t	vmm_is_intel(void);
-boolean_t	vmm_is_amd(void);
-boolean_t	vmm_supports_1G_pages(void);
+bool		vmm_is_intel(void);
+bool		vmm_is_amd(void);
+bool		vmm_supports_1G_pages(void);
 
 void		dump_trapframe(struct trapframe *tf);
 

From owner-svn-src-head@freebsd.org  Thu Aug  1 03:55:59 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C512FAFFC8;
 Thu,  1 Aug 2019 03:55:59 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zc0H4nhfz3CSp;
 Thu,  1 Aug 2019 03:55:59 +0000 (UTC)
 (envelope-from jhibbits@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B588C68E;
 Thu,  1 Aug 2019 03:55:59 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x713txRd062926;
 Thu, 1 Aug 2019 03:55:59 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x713txpp062924;
 Thu, 1 Aug 2019 03:55:59 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201908010355.x713txpp062924@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits <jhibbits@FreeBSD.org>
Date: Thu, 1 Aug 2019 03:55:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350493 - in head/sys/powerpc: aim include
X-SVN-Group: head
X-SVN-Commit-Author: jhibbits
X-SVN-Commit-Paths: in head/sys/powerpc: aim include
X-SVN-Commit-Revision: 350493
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zc0H4nhfz3CSp
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.59 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.297,0];
 NEURAL_HAM_SHORT(-0.30)[-0.296,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 03:55:59 -0000

Author: jhibbits
Date: Thu Aug  1 03:55:58 2019
New Revision: 350493
URL: https://svnweb.freebsd.org/changeset/base/350493

Log:
  powerpc64/mmu: Use a SLIST for the PVO delete list, instead of a RB_TREE
  
  Summary:
  Although it's convenient to reuse the pvo_plist for deletion, RB_TREE
  insertion and removal is not free, and can result in a lot of extra work
  to rebalance the tree.  Instead, use a SLIST as a LIFO delete queue,
  which gives us almost free insertion, deletion, and traversal.
  
  Reviewed by:	luporl
  Differential Revision: https://reviews.freebsd.org/D21061

Modified:
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/include/pmap.h

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Thu Aug  1 02:16:48 2019	(r350492)
+++ head/sys/powerpc/aim/mmu_oea64.c	Thu Aug  1 03:55:58 2019	(r350493)
@@ -2364,9 +2364,9 @@ void
 moea64_remove_pages(mmu_t mmu, pmap_t pm)
 {
 	struct pvo_entry *pvo, *tpvo;
-	struct pvo_tree tofree;
+	struct pvo_dlist tofree;
 
-	RB_INIT(&tofree);
+	SLIST_INIT(&tofree);
 
 	PMAP_LOCK(pm);
 	RB_FOREACH_SAFE(pvo, pvo_tree, &pm->pmap_pvo, tpvo) {
@@ -2379,13 +2379,14 @@ moea64_remove_pages(mmu_t mmu, pmap_t pm)
 		 * pass
 		 */
 		moea64_pvo_remove_from_pmap(mmu, pvo);
-		RB_INSERT(pvo_tree, &tofree, pvo);
+		SLIST_INSERT_HEAD(&tofree, pvo, pvo_dlink);
 	}
 	PMAP_UNLOCK(pm);
 
-	RB_FOREACH_SAFE(pvo, pvo_tree, &tofree, tpvo) {
+	while (!SLIST_EMPTY(&tofree)) {
+		pvo = SLIST_FIRST(&tofree);
+		SLIST_REMOVE_HEAD(&tofree, pvo_dlink);
 		moea64_pvo_remove_from_page(mmu, pvo);
-		RB_REMOVE(pvo_tree, &tofree, pvo);
 		free_pvo_entry(pvo);
 	}
 }
@@ -2397,7 +2398,7 @@ void
 moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva)
 {
 	struct  pvo_entry *pvo, *tpvo, key;
-	struct pvo_tree tofree;
+	struct pvo_dlist tofree;
 
 	/*
 	 * Perform an unsynchronized read.  This is, however, safe.
@@ -2407,7 +2408,7 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, v
 
 	key.pvo_vaddr = sva;
 
-	RB_INIT(&tofree);
+	SLIST_INIT(&tofree);
 
 	PMAP_LOCK(pm);
 	for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key);
@@ -2420,13 +2421,14 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, v
 		 * pass
 		 */
 		moea64_pvo_remove_from_pmap(mmu, pvo);
-		RB_INSERT(pvo_tree, &tofree, pvo);
+		SLIST_INSERT_HEAD(&tofree, pvo, pvo_dlink);
 	}
 	PMAP_UNLOCK(pm);
 
-	RB_FOREACH_SAFE(pvo, pvo_tree, &tofree, tpvo) {
+	while (!SLIST_EMPTY(&tofree)) {
+		pvo = SLIST_FIRST(&tofree);
+		SLIST_REMOVE_HEAD(&tofree, pvo_dlink);
 		moea64_pvo_remove_from_page(mmu, pvo);
-		RB_REMOVE(pvo_tree, &tofree, pvo);
 		free_pvo_entry(pvo);
 	}
 }

Modified: head/sys/powerpc/include/pmap.h
==============================================================================
--- head/sys/powerpc/include/pmap.h	Thu Aug  1 02:16:48 2019	(r350492)
+++ head/sys/powerpc/include/pmap.h	Thu Aug  1 03:55:58 2019	(r350493)
@@ -90,7 +90,10 @@ struct pvo_entry {
 #ifndef __powerpc64__
 	LIST_ENTRY(pvo_entry) pvo_olink;	/* Link to overflow entry */
 #endif
-	RB_ENTRY(pvo_entry) pvo_plink;	/* Link to pmap entries */
+	union {
+		RB_ENTRY(pvo_entry) pvo_plink;	/* Link to pmap entries */
+		SLIST_ENTRY(pvo_entry) pvo_dlink; /* Link to delete enty */
+	};
 	struct {
 #ifndef __powerpc64__
 		/* 32-bit fields */
@@ -106,6 +109,7 @@ struct pvo_entry {
 	uint64_t	pvo_vpn;		/* Virtual page number */
 };
 LIST_HEAD(pvo_head, pvo_entry);
+SLIST_HEAD(pvo_dlist, pvo_entry);
 RB_HEAD(pvo_tree, pvo_entry);
 int pvo_vaddr_compare(struct pvo_entry *, struct pvo_entry *);
 RB_PROTOTYPE(pvo_tree, pvo_entry, pvo_plink, pvo_vaddr_compare);

From owner-svn-src-head@freebsd.org  Thu Aug  1 03:59:26 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 227A0B0066;
 Thu,  1 Aug 2019 03:59:26 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zc4G05G2z3Cg1;
 Thu,  1 Aug 2019 03:59:26 +0000 (UTC)
 (envelope-from jhibbits@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9044C69D;
 Thu,  1 Aug 2019 03:59:25 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x713xPLL063108;
 Thu, 1 Aug 2019 03:59:25 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x713xPIm063106;
 Thu, 1 Aug 2019 03:59:25 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201908010359.x713xPIm063106@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits <jhibbits@FreeBSD.org>
Date: Thu, 1 Aug 2019 03:59:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350494 - head/sys/powerpc/powernv
X-SVN-Group: head
X-SVN-Commit-Author: jhibbits
X-SVN-Commit-Paths: head/sys/powerpc/powernv
X-SVN-Commit-Revision: 350494
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zc4G05G2z3Cg1
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.59 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.297,0];
 NEURAL_HAM_SHORT(-0.30)[-0.296,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 03:59:26 -0000

Author: jhibbits
Date: Thu Aug  1 03:59:25 2019
New Revision: 350494
URL: https://svnweb.freebsd.org/changeset/base/350494

Log:
  powerpc/powernv: Only clear EEH freeze for some errors
  
  Only clear an EEH freeze if an error occurs.  However, if an OPAL_HARDWARE
  error is returned, this indicates a hardware failure which cannot be
  unfrozen, and instead needs a hardware reset.  Attempting to unfreeze a
  broken PCH will result in console spam for each attempt.  To avoid the spam,
  just don't do it.

Modified:
  head/sys/powerpc/powernv/opal.h
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal.h
==============================================================================
--- head/sys/powerpc/powernv/opal.h	Thu Aug  1 03:55:58 2019	(r350493)
+++ head/sys/powerpc/powernv/opal.h	Thu Aug  1 03:59:25 2019	(r350494)
@@ -53,6 +53,7 @@ int opal_call(uint64_t token, ...);
 #define	OPAL_PCI_CONFIG_WRITE_BYTE	16
 #define	OPAL_PCI_CONFIG_WRITE_HALF_WORD	17
 #define	OPAL_PCI_CONFIG_WRITE_WORD	18
+#define	OPAL_PCI_EEH_FREEZE_STATUS	23
 #define	OPAL_PCI_EEH_FREEZE_CLEAR	26
 #define	OPAL_PCI_PHB_MMIO_ENABLE	27
 #define	OPAL_PCI_SET_PHB_MEM_WINDOW	28

Modified: head/sys/powerpc/powernv/opal_pci.c
==============================================================================
--- head/sys/powerpc/powernv/opal_pci.c	Thu Aug  1 03:55:58 2019	(r350493)
+++ head/sys/powerpc/powernv/opal_pci.c	Thu Aug  1 03:59:25 2019	(r350494)
@@ -117,6 +117,8 @@ static bus_dma_tag_t opalpci_get_dma_tag(device_t dev,
 #define	OPAL_EEH_ACTION_CLEAR_FREEZE_DMA	2
 #define	OPAL_EEH_ACTION_CLEAR_FREEZE_ALL	3
 
+#define	OPAL_EEH_STOPPED_NOT_FROZEN		0
+
 /*
  * Constants
  */
@@ -501,10 +503,11 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo
 {
 	struct opalpci_softc *sc;
 	uint64_t config_addr;
-	uint8_t byte;
+	uint8_t byte, eeh_state;
 	uint16_t half;
 	uint32_t word;
 	int error;
+	uint16_t err_type;
 
 	sc = device_get_softc(dev);
 
@@ -536,11 +539,19 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo
 	 *
 	 * XXX: Make this conditional on the existence of a freeze
 	 */
-	opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id, OPAL_PCI_DEFAULT_PE,
-	    OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
 	
-	if (error != OPAL_SUCCESS)
+	if (error != OPAL_SUCCESS) {
+		if (error != OPAL_HARDWARE) {
+			opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id,
+			    OPAL_PCI_DEFAULT_PE, vtophys(&eeh_state),
+			    vtophys(&err_type), NULL);
+			if (eeh_state != OPAL_EEH_STOPPED_NOT_FROZEN)
+				opal_call(OPAL_PCI_EEH_FREEZE_CLEAR,
+				    sc->phb_id, OPAL_PCI_DEFAULT_PE,
+				    OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+		}
 		word = 0xffffffff;
+	}
 
 	return (word);
 }
@@ -552,6 +563,8 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl
 	struct opalpci_softc *sc;
 	uint64_t config_addr;
 	int error = OPAL_SUCCESS;
+	uint16_t err_type;
+	uint8_t eeh_state;
 
 	sc = device_get_softc(dev);
 
@@ -577,8 +590,15 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl
 		 * Poking config state for non-existant devices can make
 		 * the host bridge hang up. Clear any errors.
 		 */
-		opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id,
-		    OPAL_PCI_DEFAULT_PE, OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+		if (error != OPAL_HARDWARE) {
+			opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id,
+			    OPAL_PCI_DEFAULT_PE, vtophys(&eeh_state),
+			    vtophys(&err_type), NULL);
+			if (eeh_state != OPAL_EEH_STOPPED_NOT_FROZEN)
+				opal_call(OPAL_PCI_EEH_FREEZE_CLEAR,
+				    sc->phb_id, OPAL_PCI_DEFAULT_PE,
+				    OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+		}
 	}
 }
 

From owner-svn-src-head@freebsd.org  Thu Aug  1 06:35:36 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6976AF3F2;
 Thu,  1 Aug 2019 06:35:36 +0000 (UTC)
 (envelope-from delphij@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zgXS5BvMz4HQy;
 Thu,  1 Aug 2019 06:35:36 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AF30E3EE;
 Thu,  1 Aug 2019 06:35:36 +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 x716ZaYU057093;
 Thu, 1 Aug 2019 06:35:36 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x716ZXUh057079;
 Thu, 1 Aug 2019 06:35:33 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201908010635.x716ZXUh057079@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI <delphij@FreeBSD.org>
Date: Thu, 1 Aug 2019 06:35:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350496 - in head/sys:
 cddl/contrib/opensolaris/uts/common/fs/zfs
 cddl/contrib/opensolaris/uts/common/zmod conf contrib/zlib dev/zlib libkern
 modules/crypto modules/zfs modules/zlib ope...
X-SVN-Group: head
X-SVN-Commit-Author: delphij
X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs
 cddl/contrib/opensolaris/uts/common/zmod conf contrib/zlib dev/zlib libkern
 modules/crypto modules/zfs modules/zlib opencrypto sys
X-SVN-Commit-Revision: 350496
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zgXS5BvMz4HQy
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.89 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.28)[-0.277,0];
 NEURAL_HAM_SHORT(-0.61)[-0.612,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 06:35:36 -0000

Author: delphij
Date: Thu Aug  1 06:35:33 2019
New Revision: 350496
URL: https://svnweb.freebsd.org/changeset/base/350496

Log:
  Allow Kernel to link in both legacy libkern/zlib and new sys/contrib/zlib,
  with an eventual goal to convert all legacl zlib callers to the new zlib
  version:
  
   * Move generic zlib shims that are not specific to zlib 1.0.4 to
     sys/dev/zlib.
   * Connect new zlib (1.2.11) to the zlib kernel module, currently built
     with Z_SOLO.
   * Prefix the legacy zlib (1.0.4) with 'zlib104_' namespace.
   * Convert sys/opencrypto/cryptodeflate.c to use new zlib.
   * Remove bundled zlib 1.2.3 from ZFS and adapt it to new zlib and make
     it depend on the zlib module.
   * Fix Z_SOLO build of new zlib.
  
  PR:		229763
  Submitted by:	Yoshihiro Ota <ota j email ne jp>
  Reviewed by:	markm (sys/dev/zlib/zlib_kmod.c)
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D19706

Added:
  head/sys/dev/zlib/
  head/sys/dev/zlib/zcalloc.c   (contents, props changed)
  head/sys/dev/zlib/zcalloc.h   (contents, props changed)
  head/sys/dev/zlib/zlib_mod.c
     - copied, changed from r350463, head/sys/libkern/zlib.c
Deleted:
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/adler32.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/crc32.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/deflate.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/deflate.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/inffast.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/inffast.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/inffixed.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/inflate.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/inflate.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/inftrees.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/inftrees.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/trees.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/zconf.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/zlib.h
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/zutil.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/zutil.h
Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk
  head/sys/contrib/zlib/deflate.c
  head/sys/contrib/zlib/zconf.h
  head/sys/contrib/zlib/zutil.h
  head/sys/libkern/zlib.c
  head/sys/modules/crypto/Makefile
  head/sys/modules/zfs/Makefile
  head/sys/modules/zlib/Makefile
  head/sys/opencrypto/cryptodeflate.c
  head/sys/opencrypto/deflate.h
  head/sys/sys/zlib.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Thu Aug  1 06:35:33 2019	(r350496)
@@ -7172,3 +7172,4 @@ MODULE_VERSION(zfsctrl, 1);
 MODULE_DEPEND(zfsctrl, opensolaris, 1, 1, 1);
 MODULE_DEPEND(zfsctrl, krpc, 1, 1, 1);
 MODULE_DEPEND(zfsctrl, acl_nfs4, 1, 1, 1);
+MODULE_DEPEND(zfsctrl, zlib, 1, 1, 1);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c	Thu Aug  1 06:35:33 2019	(r350496)
@@ -25,11 +25,49 @@
  */
 
 #include <sys/types.h>
+#include <sys/cmn_err.h>
+#include <sys/systm.h>
+#include <sys/kobj.h>
 #include <sys/zmod.h>
 
-#include "zlib.h"
-#include "zutil.h"
+#include <contrib/zlib/zlib.h>
+#include <contrib/zlib/zutil.h>
 
+struct zchdr {
+	uint_t zch_magic;
+	uint_t zch_size;
+};
+
+#define	ZCH_MAGIC	0x3cc13cc1
+
+/*ARGSUSED*/
+static void *
+zfs_zcalloc(void *opaque, uint_t items, uint_t size)
+{
+	size_t nbytes = sizeof (struct zchdr) + items * size;
+	struct zchdr *z = kobj_zalloc(nbytes, KM_NOWAIT|KM_TMP);
+
+	if (z == NULL)
+		return (NULL);
+
+	z->zch_magic = ZCH_MAGIC;
+	z->zch_size = nbytes;
+
+	return (z + 1);
+}
+
+/*ARGSUSED*/
+static void
+zfs_zcfree(void *opaque, void *ptr)
+{
+	struct zchdr *z = ((struct zchdr *)ptr) - 1;
+
+	if (z->zch_magic != ZCH_MAGIC)
+		panic("zcfree region corrupt: hdr=%p ptr=%p", (void *)z, ptr);
+
+	kobj_free(z, z->zch_size);
+}
+
 /*
  * Uncompress the buffer 'src' into the buffer 'dst'.  The caller must store
  * the expected decompressed data size externally so it can be passed in.
@@ -47,6 +85,8 @@ z_uncompress(void *dst, size_t *dstlen, const void *sr
 	zs.avail_in = srclen;
 	zs.next_out = dst;
 	zs.avail_out = *dstlen;
+	zs.zalloc = zfs_zcalloc;
+	zs.zfree = zfs_zcfree;
 
 	/*
 	 * Call inflateInit2() specifying a window size of DEF_WBITS
@@ -78,6 +118,8 @@ z_compress_level(void *dst, size_t *dstlen, const void
 	zs.avail_in = srclen;
 	zs.next_out = dst;
 	zs.avail_out = *dstlen;
+	zs.zalloc = zfs_zcalloc;
+	zs.zfree = zfs_zcfree;
 
 	if ((err = deflateInit(&zs, level)) != Z_OK)
 		return (err);

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/conf/NOTES	Thu Aug  1 06:35:33 2019	(r350496)
@@ -2981,4 +2981,6 @@ device		spigen		# Generic access to SPI devices from u
 # Enable legacy /dev/spigenN name aliases for /dev/spigenX.Y devices.
 options 	SPIGEN_LEGACY_CDEVNAME # legacy device names for spigen
 
+# Compression supports.
+device		zlib		# gzip/zlib compression/decompression library
 device		xz		# xz_embedded LZMA de-compression library

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/conf/files	Thu Aug  1 06:35:33 2019	(r350496)
@@ -273,16 +273,7 @@ cddl/contrib/opensolaris/uts/common/os/callb.c				opti
 cddl/contrib/opensolaris/uts/common/os/fm.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/os/list.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c		optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/adler32.c			optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/deflate.c			optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/inffast.c			optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/inflate.c			optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/inftrees.c			optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c		optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/trees.c			optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/zmod.c				optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c			optional zfs compile-with "${ZFS_C}"
-cddl/contrib/opensolaris/uts/common/zmod/zutil.c			optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/zmod/zmod.c				optional zfs compile-with "${ZFS_C} ${ZLIB_CFLAGS}"
 # zfs lua support
 cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lapi.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lauxlib.c		optional zfs compile-with "${ZFS_C}"
@@ -4005,6 +3996,36 @@ libkern/strvalid.c		standard
 libkern/timingsafe_bcmp.c	standard
 libkern/zlib.c			optional crypto | geom_uzip | ipsec | \
 	ipsec_support | mxge | netgraph_deflate | ddb_ctf | gzio
+contrib/zlib/adler32.c	optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
+contrib/zlib/crc32.c	optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C} -Wno-cast-qual"
+contrib/zlib/deflate.c	optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C} -Wno-cast-qual"
+contrib/zlib/inffast.c	optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
+contrib/zlib/inflate.c	optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
+contrib/zlib/inftrees.c	optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
+contrib/zlib/trees.c		optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
+contrib/zlib/zutil.c		optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
+dev/zlib/zlib_mod.c		optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
+dev/zlib/zcalloc.c		optional crypto | geom_uzip | ipsec | \
+	ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib \
+	compile-with "${ZLIB_C}"
 net/altq/altq_cbq.c		optional altq
 net/altq/altq_codel.c		optional altq
 net/altq/altq_hfsc.c		optional altq
@@ -4756,7 +4777,8 @@ opencrypto/crypto.c		optional crypto | ipsec | ipsec_s
 opencrypto/cryptodev.c		optional cryptodev
 opencrypto/cryptodev_if.m	optional crypto | ipsec | ipsec_support
 opencrypto/cryptosoft.c		optional crypto | ipsec | ipsec_support
-opencrypto/cryptodeflate.c	optional crypto | ipsec | ipsec_support
+opencrypto/cryptodeflate.c	optional crypto | ipsec | ipsec_support \
+	compile-with "${ZLIB_C}"
 opencrypto/gmac.c		optional crypto | ipsec | ipsec_support
 opencrypto/gfmult.c		optional crypto | ipsec | ipsec_support
 opencrypto/rmd160.c		optional crypto | ipsec | ipsec_support

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/conf/kern.pre.mk	Thu Aug  1 06:35:33 2019	(r350496)
@@ -173,6 +173,10 @@ NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC}
 NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \
 	-m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw}
 
+# for zlib in the kernel
+ZLIB_CFLAGS+= -DZ_SOLO
+ZLIB_C= ${CC} -c ${ZLIB_CFLAGS} ${CFLAGS} ${.IMPSRC}
+
 # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS)
 ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} -U__BMI__ ${.IMPSRC}
 

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/conf/kmod.mk	Thu Aug  1 06:35:33 2019	(r350496)
@@ -104,6 +104,8 @@ __KLD_SHARED=yes
 __KLD_SHARED=no
 .endif
 
+ZLIB_CFLAGS+=	-DZ_SOLO
+
 .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
 CFLAGS+=	-fno-strict-aliasing
 .endif

Modified: head/sys/contrib/zlib/deflate.c
==============================================================================
--- head/sys/contrib/zlib/deflate.c	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/contrib/zlib/deflate.c	Thu Aug  1 06:35:33 2019	(r350496)
@@ -189,9 +189,10 @@ local const config configuration_table[10] = {
  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
  * prev[] will be initialized on the fly.
  */
-#define CLEAR_HASH(s) \
+#define CLEAR_HASH(s) do { \
     s->head[s->hash_size-1] = NIL; \
-    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
+    } while (0)
 
 /* ===========================================================================
  * Slide the hash table when sliding the window down (could be avoided with 32
@@ -1622,8 +1623,10 @@ local void fill_window(s)
 /* Maximum stored block length in deflate format (not including header). */
 #define MAX_STORED 65535
 
+#if !defined(MIN)
 /* Minimum of a and b. */
 #define MIN(a, b) ((a) > (b) ? (b) : (a))
+#endif
 
 /* ===========================================================================
  * Copy without compression as much as possible from the input stream, return

Modified: head/sys/contrib/zlib/zconf.h
==============================================================================
--- head/sys/contrib/zlib/zconf.h	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/contrib/zlib/zconf.h	Thu Aug  1 06:35:33 2019	(r350496)
@@ -503,6 +503,9 @@ typedef uLong FAR uLongf;
 /*
  * This is hard-configured for FreeBSD.
  */
+#ifdef Z_SOLO
+#  include <sys/types.h>      /* for off_t */
+#endif
 #define	z_off_t	off_t
 #ifndef _FILE_OFFSET_BITS
 #define _FILE_OFFSET_BITS 64

Modified: head/sys/contrib/zlib/zutil.h
==============================================================================
--- head/sys/contrib/zlib/zutil.h	Thu Aug  1 05:30:31 2019	(r350495)
+++ head/sys/contrib/zlib/zutil.h	Thu Aug  1 06:35:33 2019	(r350496)
@@ -30,7 +30,10 @@
 #endif
 
 #ifdef Z_SOLO
+#ifndef _PTRDIFF_T_DECLARED
    typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */
+#define _PTRDIFF_T_DECLARED
+#endif
 #endif
 
 #ifndef local

Added: head/sys/dev/zlib/zcalloc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/zlib/zcalloc.c	Thu Aug  1 06:35:33 2019	(r350496)
@@ -0,0 +1,32 @@
+/*
+ * This file is in the public domain.
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <dev/zlib/zcalloc.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+
+MALLOC_DEFINE(M_ZLIB, "zlib", "ZLIB Compressor");
+
+void *
+zcalloc_waitok(void *nil, u_int items, u_int size)
+{
+
+	return mallocarray(items, size, M_ZLIB, M_WAITOK);
+}
+
+void *
+zcalloc_nowait(void *nil, u_int items, u_int size)
+{
+
+	return mallocarray(items, size, M_ZLIB, M_NOWAIT);
+}
+
+void
+zcfree(void *nil, void *ptr)
+{
+
+        free(ptr, M_ZLIB);
+}

Added: head/sys/dev/zlib/zcalloc.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/zlib/zcalloc.h	Thu Aug  1 06:35:33 2019	(r350496)
@@ -0,0 +1,13 @@
+/*
+ * This file is in the public domain.
+ * $FreeBSD$
+ */
+
+#ifndef _DEV_ZLIB_ZCALLOC_
+#define _DEV_ZLIB_ZCALLOC_
+
+void * zcalloc_waitok(void *nil, u_int items, u_int size);
+void * zcalloc_nowait(void *nil, u_int items, u_int size);
+void zcfree(void *nil, void *ptr);
+
+#endif

Copied and modified: head/sys/dev/zlib/zlib_mod.c (from r350463, head/sys/libkern/zlib.c)
==============================================================================
--- head/sys/libkern/zlib.c	Wed Jul 31 05:38:39 2019	(r350463, copy source)
+++ head/sys/dev/zlib/zlib_mod.c	Thu Aug  1 06:35:33 2019	(r350496)
@@ -1,5397 +1,37 @@
-/*
- * This file is derived from various .h and .c files from the zlib-1.0.4
- * distribution by Jean-loup Gailly and Mark Adler, with some additions
- * by Paul Mackerras to aid in implementing Deflate compression and
- * decompression for PPP packets.  See zlib.h for conditions of
- * distribution and use.
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
  *
- * Changes that have been made include:
- * - added Z_PACKET_FLUSH (see zlib.h for details)
- * - added inflateIncomp and deflateOutputPending
- * - allow strm->next_out to be NULL, meaning discard the output
+ * Copyright (c) 2019 The FreeBSD Foundation
  *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
  * $FreeBSD$
  */
 
-/* 
- *  ==FILEVERSION 971210==
- *
- * This marker is used by the Linux installation script to determine
- * whether an up-to-date version of this file is already installed.
- */
-
-#define NO_DUMMY_DECL
-#define NO_ZCFUNCS
-#define MY_ZCALLOC
-
-#if defined(__FreeBSD__) && defined(_KERNEL)
-#define	_tr_init		_zlib104_tr_init
-#define	_tr_align		_zlib104_tr_align
-#define	_tr_tally		_zlib104_tr_tally
-#define	_tr_flush_block		_zlib104_tr_flush_block
-#define	_tr_stored_block	_zlib104_tr_stored_block
-#define	inflate_fast		_zlib104_inflate_fast
-#define	inflate			_zlib104_inflate
-#define	zlibVersion		_zlib104_Version
-#endif
-
-
-/* +++ zutil.h */
-/*-
- * zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-1996 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-/* From: zutil.h,v 1.16 1996/07/24 13:41:13 me Exp $ */
-
-#ifndef _Z_UTIL_H
-#define _Z_UTIL_H
-
-#ifdef _KERNEL
-#include <sys/zlib.h>
-#else
-#include "zlib.h"
-#endif
-
-#ifdef _KERNEL
-/* Assume this is a *BSD or SVR4 kernel */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/systm.h>
 #include <sys/param.h>
+#include <sys/time.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
-#  define HAVE_MEMCPY
 
-#else
-#if defined(__KERNEL__)
-/* Assume this is a Linux kernel */
-#include <linux/string.h>
-#define HAVE_MEMCPY
-
-#else /* not kernel */
-
-#if defined(MSDOS)||defined(VMS)||defined(CRAY)||defined(WIN32)||defined(RISCOS)
-#   include <stddef.h>
-#   include <errno.h>
-#else
-    extern int errno;
-#endif
-#ifdef STDC
-#  include <string.h>
-#  include <stdlib.h>
-#endif
-#endif /* __KERNEL__ */
-#endif /* _KERNEL */
-
-#ifndef local
-#  define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-typedef unsigned char  uch;
-typedef uch FAR uchf;
-typedef unsigned short ush;
-typedef ush FAR ushf;
-typedef unsigned long  ulg;
-
-static const char *z_errmsg[10]; /* indexed by 2-zlib_error */
-/* (size given to avoid silly warnings with Visual C++) */
-
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
-
-#define ERR_RETURN(strm,err) \
-  return (strm->msg = (const char*)ERR_MSG(err), (err))
-/* To be used only when the state is known to be valid */
-
-        /* common constants */
-
-#ifndef DEF_WBITS
-#  define DEF_WBITS MAX_WBITS
-#endif
-/* default windowBits for decompression. MAX_WBITS is for compression only */
-
-#if MAX_MEM_LEVEL >= 8
-#  define DEF_MEM_LEVEL 8
-#else
-#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
-#endif
-/* default memLevel */
-
-#define STORED_BLOCK 0
-#define STATIC_TREES 1
-#define DYN_TREES    2
-/* The three kinds of block type */
-
-#define MIN_MATCH  3
-#define MAX_MATCH  258
-/* The minimum and maximum match lengths */
-
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
-
-        /* target dependencies */
-
-#ifdef MSDOS
-#  define OS_CODE  0x00
-#  ifdef __TURBOC__
-#    include <alloc.h>
-#  else /* MSC or DJGPP */
-#    include <malloc.h>
-#  endif
-#endif
-
-#ifdef OS2
-#  define OS_CODE  0x06
-#endif
-
-#ifdef WIN32 /* Window 95 & Windows NT */
-#  define OS_CODE  0x0b
-#endif
-
-#if defined(VAXC) || defined(VMS)
-#  define OS_CODE  0x02
-#  define FOPEN(name, mode) \
-     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
-#endif
-
-#ifdef AMIGA
-#  define OS_CODE  0x01
-#endif
-
-#if defined(ATARI) || defined(atarist)
-#  define OS_CODE  0x05
-#endif
-
-#ifdef MACOS
-#  define OS_CODE  0x07
-#endif
-
-#ifdef __50SERIES /* Prime/PRIMOS */
-#  define OS_CODE  0x0F
-#endif
-
-#ifdef TOPS20
-#  define OS_CODE  0x0a
-#endif
-
-#if defined(_BEOS_) || defined(RISCOS)
-#  define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-        /* Common defaults */
-
-#ifndef OS_CODE
-#  define OS_CODE  0x03  /* assume Unix */
-#endif
-
-#ifndef FOPEN
-#  define FOPEN(name, mode) fopen((name), (mode))
-#endif
-
-         /* functions */
-
-#ifdef HAVE_STRERROR
-   extern char *strerror OF((int));
-#  define zstrerror(errnum) strerror(errnum)
-#else
-#  define zstrerror(errnum) ""
-#endif
-
-#if defined(pyr)
-#  define NO_MEMCPY
-#endif
-#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(_MSC_VER)
- /* Use our own functions for small and medium model with MSC <= 5.0.
-  * You may have to use the same strategy for Borland C (untested).
-  */
-#  define NO_MEMCPY
-#endif
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-#  define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
-#    define zmemcpy _fmemcpy
-#    define zmemcmp _fmemcmp
-#    define zmemzero(dest, len) _fmemset(dest, 0, len)
-#  else
-#    define zmemcpy memcpy
-#    define zmemcmp memcmp
-#    define zmemzero(dest, len) memset(dest, 0, len)
-#  endif
-#else
-   extern void zmemcpy  OF((Bytef* dest, Bytef* source, uInt len));
-   extern int  zmemcmp  OF((Bytef* s1,   Bytef* s2, uInt len));
-   extern void zmemzero OF((Bytef* dest, uInt len));
-#endif
-
-/* Diagnostic functions */
-#ifdef DEBUG_ZLIB
-#  include <stdio.h>
-#  ifndef verbose
-#    define verbose 0
-#  endif
-   extern void z_error    OF((char *m));
-#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-#  define Trace(x) fprintf x
-#  define Tracev(x) {if (verbose) fprintf x ;}
-#  define Tracevv(x) {if (verbose>1) fprintf x ;}
-#  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
-#  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
-#else
-#  define Assert(cond,msg)
-#  define Trace(x)
-#  define Tracev(x)
-#  define Tracevv(x)
-#  define Tracec(c,x)
-#  define Tracecv(c,x)
-#endif
-
-
-typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len));
-
-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
-void   zcfree  OF((voidpf opaque, voidpf ptr));
-
-#define ZALLOC(strm, items, size) \
-           (*((strm)->zalloc))((strm)->opaque, (items), (size))
-#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
-
-#endif /* _Z_UTIL_H */
-/* --- zutil.h */
-
-/* +++ deflate.h */
-/* deflate.h -- internal compression state
- * Copyright (C) 1995-1996 Jean-loup Gailly
- * For conditions of distribution and use, see copyright notice in zlib.h 
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-/* From: deflate.h,v 1.10 1996/07/02 12:41:00 me Exp $ */
-
-#ifndef _DEFLATE_H
-#define _DEFLATE_H
-
-/* #include "zutil.h" */
-
-/* ===========================================================================
- * Internal compression state.
- */
-
-#define LENGTH_CODES 29
-/* number of length codes, not counting the special END_BLOCK code */
-
-#define LITERALS  256
-/* number of literal bytes 0..255 */
-
-#define L_CODES (LITERALS+1+LENGTH_CODES)
-/* number of Literal or Length codes, including the END_BLOCK code */
-
-#define D_CODES   30
-/* number of distance codes */
-
-#define BL_CODES  19
-/* number of codes used to transfer the bit lengths */
-
-#define HEAP_SIZE (2*L_CODES+1)
-/* maximum heap size */
-
-#define MAX_BITS 15
-/* All codes must not exceed MAX_BITS bits */
-
-#define INIT_STATE    42
-#define BUSY_STATE   113
-#define FINISH_STATE 666
-/* Stream status */
-
-
-/* Data structure describing a single value and its code string. */
-typedef struct ct_data_s {
-    union {
-        ush  freq;       /* frequency count */
-        ush  code;       /* bit string */
-    } fc;
-    union {
-        ush  dad;        /* father node in Huffman tree */
-        ush  len;        /* length of bit string */
-    } dl;
-} FAR ct_data;
-
-#define Freq fc.freq
-#define Code fc.code
-#define Dad  dl.dad
-#define Len  dl.len
-
-typedef struct static_tree_desc_s  static_tree_desc;
-
-typedef struct tree_desc_s {
-    ct_data *dyn_tree;           /* the dynamic tree */
-    int     max_code;            /* largest code with non zero frequency */
-    static_tree_desc *stat_desc; /* the corresponding static tree */
-} FAR tree_desc;
-
-typedef ush Pos;
-typedef Pos FAR Posf;
-typedef unsigned IPos;
-
-/* A Pos is an index in the character window. We use short instead of int to
- * save space in the various tables. IPos is used only for parameter passing.
- */
-
-typedef struct deflate_state {
-    z_streamp strm;      /* pointer back to this zlib stream */
-    int   status;        /* as the name implies */
-    Bytef *pending_buf;  /* output still pending */
-    ulg   pending_buf_size; /* size of pending_buf */
-    Bytef *pending_out;  /* next pending byte to output to the stream */
-    int   pending;       /* nb of bytes in the pending buffer */
-    int   noheader;      /* suppress zlib header and adler32 */
-    Byte  data_type;     /* UNKNOWN, BINARY or ASCII */
-    Byte  method;        /* STORED (for zip only) or DEFLATED */
-    int   last_flush;    /* value of flush param for previous deflate call */
-
-                /* used by deflate.c: */
-
-    uInt  w_size;        /* LZ77 window size (32K by default) */
-    uInt  w_bits;        /* log2(w_size)  (8..16) */
-    uInt  w_mask;        /* w_size - 1 */
-
-    Bytef *window;
-    /* Sliding window. Input bytes are read into the second half of the window,
-     * and move to the first half later to keep a dictionary of at least wSize
-     * bytes. With this organization, matches are limited to a distance of
-     * wSize-MAX_MATCH bytes, but this ensures that IO is always
-     * performed with a length multiple of the block size. Also, it limits
-     * the window size to 64K, which is quite useful on MSDOS.
-     * To do: use the user input buffer as sliding window.
-     */
-
-    ulg window_size;
-    /* Actual size of window: 2*wSize, except when the user input buffer
-     * is directly used as sliding window.
-     */
-
-    Posf *prev;
-    /* Link to older string with same hash index. To limit the size of this
-     * array to 64K, this link is maintained only for the last 32K strings.
-     * An index in this array is thus a window index modulo 32K.
-     */
-
-    Posf *head; /* Heads of the hash chains or NIL. */
-
-    uInt  ins_h;          /* hash index of string to be inserted */
-    uInt  hash_size;      /* number of elements in hash table */
-    uInt  hash_bits;      /* log2(hash_size) */
-    uInt  hash_mask;      /* hash_size-1 */
-
-    uInt  hash_shift;
-    /* Number of bits by which ins_h must be shifted at each input
-     * step. It must be such that after MIN_MATCH steps, the oldest
-     * byte no longer takes part in the hash key, that is:
-     *   hash_shift * MIN_MATCH >= hash_bits
-     */
-
-    long block_start;
-    /* Window position at the beginning of the current output block. Gets
-     * negative when the window is moved backwards.
-     */
-
-    uInt match_length;           /* length of best match */
-    IPos prev_match;             /* previous match */
-    int match_available;         /* set if previous match exists */
-    uInt strstart;               /* start of string to insert */
-    uInt match_start;            /* start of matching string */
-    uInt lookahead;              /* number of valid bytes ahead in window */
-
-    uInt prev_length;
-    /* Length of the best match at previous step. Matches not greater than this
-     * are discarded. This is used in the lazy match evaluation.
-     */
-
-    uInt max_chain_length;
-    /* To speed up deflation, hash chains are never searched beyond this
-     * length.  A higher limit improves compression ratio but degrades the
-     * speed.
-     */
-
-    uInt max_lazy_match;
-    /* Attempt to find a better match only when the current match is strictly
-     * smaller than this value. This mechanism is used only for compression
-     * levels >= 4.
-     */
-#   define max_insert_length  max_lazy_match
-    /* Insert new strings in the hash table only if the match length is not
-     * greater than this length. This saves time but degrades compression.
-     * max_insert_length is used only for compression levels <= 3.
-     */
-
-    int level;    /* compression level (1..9) */
-    int strategy; /* favor or force Huffman coding*/
-
-    uInt good_match;
-    /* Use a faster search when the previous match is longer than this */
-
-    int nice_match; /* Stop searching when current match exceeds this */
-
-                /* used by trees.c: */
-    /* Didn't use ct_data typedef below to supress compiler warning */
-    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
-    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
-    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
-
-    struct tree_desc_s l_desc;               /* desc. for literal tree */
-    struct tree_desc_s d_desc;               /* desc. for distance tree */
-    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
-
-    ush bl_count[MAX_BITS+1];
-    /* number of codes at each bit length for an optimal tree */
-
-    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
-    int heap_len;               /* number of elements in the heap */
-    int heap_max;               /* element of largest frequency */
-    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
-     * The same heap array is used to build all trees.
-     */
-
-    uch depth[2*L_CODES+1];
-    /* Depth of each subtree used as tie breaker for trees of equal frequency
-     */
-
-    uchf *l_buf;          /* buffer for literals or lengths */
-
-    uInt  lit_bufsize;
-    /* Size of match buffer for literals/lengths.  There are 4 reasons for
-     * limiting lit_bufsize to 64K:
-     *   - frequencies can be kept in 16 bit counters
-     *   - if compression is not successful for the first block, all input
-     *     data is still in the window so we can still emit a stored block even
-     *     when input comes from standard input.  (This can also be done for
-     *     all blocks if lit_bufsize is not greater than 32K.)
-     *   - if compression is not successful for a file smaller than 64K, we can
-     *     even emit a stored file instead of a stored block (saving 5 bytes).
-     *     This is applicable only for zip (not gzip or zlib).
-     *   - creating new Huffman trees less frequently may not provide fast
-     *     adaptation to changes in the input data statistics. (Take for
-     *     example a binary file with poorly compressible code followed by
-     *     a highly compressible string table.) Smaller buffer sizes give
-     *     fast adaptation but have of course the overhead of transmitting
-     *     trees more frequently.
-     *   - I can't count above 4
-     */
-
-    uInt last_lit;      /* running index in l_buf */
-
-    ushf *d_buf;
-    /* Buffer for distances. To simplify the code, d_buf and l_buf have
-     * the same number of elements. To use different lengths, an extra flag
-     * array would be necessary.
-     */
-
-    ulg opt_len;        /* bit length of current block with optimal trees */
-    ulg static_len;     /* bit length of current block with static trees */
-    ulg compressed_len; /* total bit length of compressed file */
-    uInt matches;       /* number of string matches in current block */
-    int last_eob_len;   /* bit length of EOB code for last block */
-
-#ifdef DEBUG_ZLIB
-    ulg bits_sent;      /* bit length of the compressed data */
-#endif
-
-    ush bi_buf;
-    /* Output buffer. bits are inserted starting at the bottom (least
-     * significant bits).
-     */
-    int bi_valid;
-    /* Number of valid bits in bi_buf.  All bits above the last valid bit
-     * are always zero.
-     */
-
-} FAR deflate_state;
-
-/* Output a byte on the stream.
- * IN assertion: there is enough room in pending_buf.
- */
-#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
-
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
-/* In order to simplify the code, particularly on 16 bit machines, match
- * distances are limited to MAX_DIST instead of WSIZE.
- */
-
-        /* in trees.c */
-void _tr_init         OF((deflate_state *s));
-int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
-ulg  _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
-			  int eof));
-void _tr_align        OF((deflate_state *s));
-void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
-                          int eof));
-void _tr_stored_type_only OF((deflate_state *));
-
-#endif
-/* --- deflate.h */
-
-/* +++ deflate.c */
-/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-1996 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h 
- */
-
-/*
- *  ALGORITHM
- *
- *      The "deflation" process depends on being able to identify portions
- *      of the input text which are identical to earlier input (within a
- *      sliding window trailing behind the input currently being processed).
- *
- *      The most straightforward technique turns out to be the fastest for
- *      most input files: try all possible matches and select the longest.
- *      The key feature of this algorithm is that insertions into the string
- *      dictionary are very simple and thus fast, and deletions are avoided
- *      completely. Insertions are performed at each input character, whereas
- *      string matches are performed only when the previous match ends. So it
- *      is preferable to spend more time in matches to allow very fast string
- *      insertions and avoid deletions. The matching algorithm for small
- *      strings is inspired from that of Rabin & Karp. A brute force approach
- *      is used to find longer strings when a small match has been found.
- *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
- *      (by Leonid Broukhis).
- *         A previous version of this file used a more sophisticated algorithm
- *      (by Fiala and Greene) which is guaranteed to run in linear amortized
- *      time, but has a larger average cost, uses more memory and is patented.
- *      However the F&G algorithm may be faster for some highly redundant
- *      files if the parameter max_chain_length (described below) is too large.
- *
- *  ACKNOWLEDGEMENTS
- *
- *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
- *      I found it in 'freeze' written by Leonid Broukhis.
- *      Thanks to many people for bug reports and testing.
- *
- *  REFERENCES
- *
- *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
- *      Available in ftp://ds.internic.net/rfc/rfc1951.txt
- *
- *      A description of the Rabin and Karp algorithm is given in the book
- *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
- *
- *      Fiala,E.R., and Greene,D.H.
- *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
- *
- */
-
-/* From: deflate.c,v 1.15 1996/07/24 13:40:58 me Exp $ */
-
-/* #include "deflate.h" */
-
-char deflate_copyright[] = " deflate 1.0.4 Copyright 1995-1996 Jean-loup Gailly ";
-/*
-  If you use the zlib library in a product, an acknowledgment is welcome
-  in the documentation of your product. If for some reason you cannot
-  include such an acknowledgment, I would appreciate that you keep this
-  copyright string in the executable of your product.
- */
-
-/* ===========================================================================
- *  Function prototypes.
- */
-typedef enum {
-    need_more,      /* block not completed, need more input or more output */
-    block_done,     /* block flush performed */
-    finish_started, /* finish started, need only more output at next deflate */
-    finish_done     /* finish done, accept no more input or output */
-} block_state;
-
-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
-/* Compression function. Returns the block state after the call. */
-
-local void fill_window    OF((deflate_state *s));
-local block_state deflate_stored OF((deflate_state *s, int flush));
-local block_state deflate_fast   OF((deflate_state *s, int flush));
-local block_state deflate_slow   OF((deflate_state *s, int flush));
-local void lm_init        OF((deflate_state *s));
-local void putShortMSB    OF((deflate_state *s, uInt b));
-local void flush_pending  OF((z_streamp strm));
-local int read_buf        OF((z_streamp strm, charf *buf, unsigned size));
-#ifdef ASMV
-      void match_init OF((void)); /* asm code initialization */
-      uInt longest_match  OF((deflate_state *s, IPos cur_match));
-#else
-local uInt longest_match  OF((deflate_state *s, IPos cur_match));
-#endif
-
-#ifdef DEBUG_ZLIB
-local  void check_match OF((deflate_state *s, IPos start, IPos match,
-                            int length));
-#endif
-
-/* ===========================================================================
- * Local data
- */
-
-#define NIL 0
-/* Tail of hash chains */
-
-#ifndef TOO_FAR
-#  define TOO_FAR 4096
-#endif
-/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-/* Values for max_lazy_match, good_match and max_chain_length, depending on
- * the desired pack level (0..9). The values given below have been tuned to
- * exclude worst case performance for pathological files. Better values may be
- * found for specific files.
- */
-typedef struct config_s {
-   ush good_length; /* reduce lazy search above this match length */
-   ush max_lazy;    /* do not perform lazy search above this match length */
-   ush nice_length; /* quit search above this match length */
-   ush max_chain;
-   compress_func func;
-} config;
-
-local config configuration_table[10] = {
-/*      good lazy nice chain */
-/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
-/* 1 */ {4,    4,  8,    4, deflate_fast}, /* maximum speed, no lazy matches */
-/* 2 */ {4,    5, 16,    8, deflate_fast},
-/* 3 */ {4,    6, 32,   32, deflate_fast},
-
-/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
-/* 5 */ {8,   16, 32,   32, deflate_slow},
-/* 6 */ {8,   16, 128, 128, deflate_slow},
-/* 7 */ {8,   32, 128, 256, deflate_slow},
-/* 8 */ {32, 128, 258, 1024, deflate_slow},
-/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */
-
-/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
- * For deflate_fast() (levels <= 3) good is ignored and lazy has a different

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@freebsd.org  Thu Aug  1 13:42:59 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69C02BE1BC;
 Thu,  1 Aug 2019 13:42:59 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zs1b2D1Hz4f98;
 Thu,  1 Aug 2019 13:42:59 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DDF01B230;
 Thu,  1 Aug 2019 13:42:59 +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 x71Dgxwq011656;
 Thu, 1 Aug 2019 13:42:59 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71DgxH7011655;
 Thu, 1 Aug 2019 13:42:59 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011342.x71DgxH7011655@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 13:42:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350497 - head/sys/net
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/sys/net
X-SVN-Commit-Revision: 350497
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zs1b2D1Hz4f98
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.18 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.303,0];
 NEURAL_SPAM_SHORT(0.12)[0.122,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 13:42:59 -0000

Author: emaste
Date: Thu Aug  1 13:42:58 2019
New Revision: 350497
URL: https://svnweb.freebsd.org/changeset/base/350497

Log:
  ppp: correct echo-req magic number on big endian archs
  
  The magic number is a 32-bit quantity; use uint32_t to match hton's
  return type and avoid sending zeros (upper 32 bits) on big-endian
  architectures.
  
  PR:		184141
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/net/if_spppsubr.c

Modified: head/sys/net/if_spppsubr.c
==============================================================================
--- head/sys/net/if_spppsubr.c	Thu Aug  1 06:35:33 2019	(r350496)
+++ head/sys/net/if_spppsubr.c	Thu Aug  1 13:42:58 2019	(r350497)
@@ -4803,7 +4803,7 @@ sppp_keepalive(void *dummy)
 		sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ,
 			 ++sp->pp_seq[IDX_LCP],	sp->pp_rseq[IDX_LCP]);
 	else if (sp->pp_phase >= PHASE_AUTHENTICATE) {
-		long nmagic = htonl (sp->lcp.magic);
+		uint32_t nmagic = htonl(sp->lcp.magic);
 		sp->lcp.echoid = ++sp->pp_seq[IDX_LCP];
 		sppp_cp_send (sp, PPP_LCP, ECHO_REQ,
 			sp->lcp.echoid, 4, &nmagic);

From owner-svn-src-head@freebsd.org  Thu Aug  1 13:46:04 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5675BE528;
 Thu,  1 Aug 2019 13:46:04 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zs584jmtz4fY5;
 Thu,  1 Aug 2019 13:46:04 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 834E61B23C;
 Thu,  1 Aug 2019 13:46:04 +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 x71Dk4wW011883;
 Thu, 1 Aug 2019 13:46:04 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Dk47Y011882;
 Thu, 1 Aug 2019 13:46:04 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011346.x71Dk47Y011882@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 13:46:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350498 - head/contrib/telnet/telnet
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/contrib/telnet/telnet
X-SVN-Commit-Revision: 350498
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zs584jmtz4fY5
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.18 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.303,0];
 NEURAL_SPAM_SHORT(0.12)[0.122,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 13:46:04 -0000

Author: emaste
Date: Thu Aug  1 13:46:04 2019
New Revision: 350498
URL: https://svnweb.freebsd.org/changeset/base/350498

Log:
  telnet: use asprintf for r349890 change
  
  Suggested by:	imp
  MFC after:	3 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/telnet/telnet/commands.c

Modified: head/contrib/telnet/telnet/commands.c
==============================================================================
--- head/contrib/telnet/telnet/commands.c	Thu Aug  1 13:42:58 2019	(r350497)
+++ head/contrib/telnet/telnet/commands.c	Thu Aug  1 13:46:04 2019	(r350498)
@@ -1655,14 +1655,11 @@ env_init(void)
 		|| (strncmp((char *)ep->value, "unix:", 5) == 0))) {
 		char hbuf[256+1];
 		char *cp2 = strchr((char *)ep->value, ':');
-                size_t buflen;
 
 		gethostname(hbuf, sizeof(hbuf));
 		hbuf[sizeof(hbuf)-1] = '\0';
- 		buflen = strlen(hbuf) + strlen(cp2) + 1;
-		cp = (char *)malloc(sizeof(char)*buflen);
+		asprintf(&cp, "%s%s", hbuf, cp2);
 		assert(cp != NULL);
-		snprintf((char *)cp, buflen, "%s%s", hbuf, cp2);
 		free(ep->value);
 		ep->value = (unsigned char *)cp;
 	}

From owner-svn-src-head@freebsd.org  Thu Aug  1 13:54:52 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F3EEBE811;
 Thu,  1 Aug 2019 13:54:52 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27])
 (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 45zsHG1g6Dz4g1Q;
 Thu,  1 Aug 2019 13:54:49 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: from compute6.internal (compute6.nyi.internal [10.202.2.46])
 by mailout.nyi.internal (Postfix) with ESMTP id 3DB0F21FBC;
 Thu,  1 Aug 2019 09:54:49 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute6.internal (MEProxy); Thu, 01 Aug 2019 09:54:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h=
 content-type:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to; s=fm3; bh=E
 5aymkAzrMFVNqR2nlcRvmW41zl/dRvf5CI4g81ckR0=; b=U55dBLdaP3nu6MW2j
 IMg9baszBFkSrRgRx78awj1jM8pPyCwS3TYYXWyTpuchddurIgudbaoLJFA85rVQ
 buRMG9hrZ5cnTr0JGHRq8KtZCUelXTiMQzAaHysYwY0gVoAoqi+uOGX+qXMl4HKD
 MNeHwoSQV3Zt2gIn/TctbpgiFyrFl+XK7zE0XsZScRR7DY5zsE8Bzyr687AwbJBm
 q/ziKDFUPlCU8S7xu5+UyyZwgWSU9whFK8H3wToyn9DX2B9gDz94T9wVEy/R1Aay
 pLWvpQBUWkLz5wxunslutMcTL1sS1qNU12Osy2RZfrgTfOtG68KMqankskddJQD+
 n/yHw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm3; bh=E5aymkAzrMFVNqR2nlcRvmW41zl/dRvf5CI4g81ck
 R0=; b=C44HZAxVIrdQNXp7m2sXkX1JLzhyBJWrRvl84UZjctvoPOF/zjyzGBTQS
 ujrqSUsemkCYUmJLjR083pF96k7IuwNwONeUJpZsEZhG9Mg6VIcVThBDmC481wQR
 3z07J0cltgMQChVVNbWAi5tYinl0CxyorbpU7bBpBRNM5N9CgrTMW4D/IGXxwAgF
 MdYOZTL6lp3PEVCIV7MhSlLA4PMEBjvvExCSd10xC74IqwSAULsGfUDCCWiUYN1Y
 P2E3WvdRkmmG19kBxShGvO+WNyVXnBDKTi9O4P+jv4OvkLZJI9XwKot6y21ingp1
 hzpQ5JMGyUuOiSKtu2rpStsvQA8jw==
X-ME-Sender: <xms:KO9CXZ9TXjfyMJYw0JIWptZbd-fVayttw6qxS2iJmrxm2uV1aDHfNQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrleejgdeikecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpefutghothht
 ucfnohhnghcuoehstghothhtlhesshgrmhhstghordhorhhgqeenucffohhmrghinhepfh
 hrvggvsghsugdrohhrghenucfkphepkedrgeeirdekledrvddufeenucfrrghrrghmpehm
 rghilhhfrhhomhepshgtohhtthhlsehsrghmshgtohdrohhrghenucevlhhushhtvghruf
 hiiigvpedt
X-ME-Proxy: <xmx:KO9CXYZ6iymqXxSnl-FyPgsd5Fn4lk4tVLsZlfpwanchLNoIGp6VkQ>
 <xmx:KO9CXftYgdURrk5ToRup3uzmLhD9lvlbdVihrxkjT6GtSZyBFNPRsg>
 <xmx:KO9CXUkHXomSdfmQGqZIazKBlBr05J6uu-ygbcCBOk6D7RwtBZe91w>
 <xmx:Ke9CXS3FZcg_jJz-gazg5-r8EproTL4fT4gvKYv1YhgsaiOdrc953w>
Received: from [192.168.0.146] (unknown [8.46.89.213])
 by mail.messagingengine.com (Postfix) with ESMTPA id ADD4D8005C;
 Thu,  1 Aug 2019 09:54:47 -0400 (EDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Subject: Re: svn commit: r349863 - in head/sys/contrib/dev/acpica: . compiler
 components/dispatcher components/events components/executer
 components/namespace components/tables components/utilities include
From: Scott Long <scottl@samsco.org>
In-Reply-To: <201907091802.x69I2bWv076792@repo.freebsd.org>
Date: Thu, 1 Aug 2019 07:54:46 -0600
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <A4437766-0565-4115-98AD-E59EF0E83C0D@samsco.org>
References: <201907091802.x69I2bWv076792@repo.freebsd.org>
To: Jung-uk Kim <jkim@FreeBSD.org>
X-Mailer: Apple Mail (2.3445.104.11)
X-Rspamd-Queue-Id: 45zsHG1g6Dz4g1Q
X-Spamd-Bar: -----
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=samsco.org header.s=fm3 header.b=U55dBLda;
 dkim=pass header.d=messagingengine.com header.s=fm3 header.b=C44HZAxV;
 dmarc=none;
 spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 66.111.4.27
 as permitted sender) smtp.mailfrom=scottl@samsco.org
X-Spamd-Result: default: False [-5.56 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[samsco.org:s=fm3,messagingengine.com:s=fm3];
 NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4];
 R_SPF_ALLOW(-0.20)[+ip4:66.111.4.27];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain];
 MV_CASE(0.50)[]; DMARC_NA(0.00)[samsco.org];
 TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4];
 RCVD_TLS_LAST(0.00)[];
 DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+];
 MX_GOOD(-0.01)[in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com];
 NEURAL_HAM_SHORT(-0.99)[-0.989,0];
 IP_SCORE(-3.46)[ip: (-9.78), ipnet: 66.111.4.0/24(-4.80), asn: 11403(-2.68),
 country: US(-0.05)]; 
 RCVD_IN_DNSWL_LOW(-0.10)[27.4.111.66.list.dnswl.org : 127.0.5.1];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];
 ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US];
 MID_RHS_MATCH_FROM(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 13:54:52 -0000

Hi,

I need to ask that this be backed out.  I have two systems that are =
failing
to boot when this revision is present.  One I can=E2=80=99t debug =
because it causes
USB to fail to probe, leaving me without a working console (and no =
network
access for other reasons).  The other fails in a different way and =
livelocks
the system:


ixl1: flags=3D8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu =
1500
	=
options=3De507bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCS=
UM,TSO4,TSO6,LRO,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
	ether ac:1f:6b:0a:4a:57
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
	nd6 options=3D29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting devd.

Here the boot hangs.  If I hit Ctrl-C, I get this:

^CACPI Error: AE_ERROR, Thread 100315 could not acquire Mutex =
[ACPI_MTX_Namespace] (0x1) (20190703/utmutex-434)
ACPI Error: AE_ERROR, Thread 100315 could not acquire Mutex =
[ACPI_MTX_Namespace] (0x1) (20190703/utmutex-434)
ACPI Error: AE_ERROR, Thread 100315 could not acquire Mutex =
[ACPI_MTX_Namespace] (0x1) (20190703/utmutex-434)

Breaking into DDB gives this:
db> bt
Tracing pid 11 tid 100012 td 0xfffff800038a85a0
acpi_cpu_idle_mwait() at acpi_cpu_idle_mwait+0x70/frame =
0xfffffe00005a4180
acpi_cpu_idle() at acpi_cpu_idle+0x183/frame 0xfffffe00005a41d0
cpu_idle_acpi() at cpu_idle_acpi+0x3f/frame 0xfffffe00005a41f0
cpu_idle() at cpu_idle+0xa6/frame 0xfffffe00005a4210
sched_idletd() at sched_idletd+0x442/frame 0xfffffe00005a42f0
fork_exit() at fork_exit+0x83/frame 0xfffffe00005a4330
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00005a4330
--- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 ---
db> ps
  pid  ppid  pgrp   uid  state   wmesg   wchan               cmd
  401   399    59     0  S+      piperd  0xfffff80005214000  sort
  400   399    59     0  S+      acmtx   0xfffff80003770280  devmatch
=E2=80=A6
100247                   S       acmtx   0xfffff80003770280  [usbus0]
...
db> bt 100315
Thread 100315 not found
db> bt 400
Tracing pid 400 tid 100339 td 0xfffff8002a52c5a0
sched_switch() at sched_switch+0x64a/frame 0xfffffe00b4c21d20
mi_switch() at mi_switch+0xe2/frame 0xfffffe00b4c21d50
sleepq_catch_signals() at sleepq_catch_signals+0x425/frame =
0xfffffe00b4c21da0
sleepq_wait_sig() at sleepq_wait_sig+0xf/frame 0xfffffe00b4c21dd0
_sleep() at _sleep+0x1bf/frame 0xfffffe00b4c21e50
AcpiOsAcquireMutex() at AcpiOsAcquireMutex+0xab/frame 0xfffffe00b4c21ea0
AcpiUtAcquireMutex() at AcpiUtAcquireMutex+0x3d/frame 0xfffffe00b4c21ee0
AcpiGetObjectInfo() at AcpiGetObjectInfo+0x51/frame 0xfffffe00b4c21f60
acpi_child_pnpinfo_str_method() at =
acpi_child_pnpinfo_str_method+0x24/frame 0xfffffe00b4c21f90
sysctl_devices() at sysctl_devices+0x215/frame 0xfffffe00b4c21fe0
sysctl_root_handler_locked() at sysctl_root_handler_locked+0x8b/frame =
0xfffffe00b4c22020
sysctl_root() at sysctl_root+0x24d/frame 0xfffffe00b4c220a0
userland_sysctl() at userland_sysctl+0x17a/frame 0xfffffe00b4c22150
sys___sysctl() at sys___sysctl+0x5f/frame 0xfffffe00b4c22200
amd64_syscall() at amd64_syscall+0x3b0/frame 0xfffffe00b4c22330
fast_syscall_common() at fast_syscall_common+0x101/frame =
0xfffffe00b4c22330
--- syscall (202, FreeBSD ELF64, sys___sysctl), rip =3D 0x80041cb2a, rsp =
=3D 0x7fffffffda78, rbp =3D 0x7fffffffdab0 ---
db> bt 100247
Tracing pid 45 tid 100247 td 0xfffff800077045a0
sched_switch() at sched_switch+0x64a/frame 0xfffffe00a7f76dc0
mi_switch() at mi_switch+0xe2/frame 0xfffffe00a7f76df0
sleepq_catch_signals() at sleepq_catch_signals+0x425/frame =
0xfffffe00a7f76e40
sleepq_wait_sig() at sleepq_wait_sig+0xf/frame 0xfffffe00a7f76e70
_sleep() at _sleep+0x1bf/frame 0xfffffe00a7f76ef0
AcpiOsAcquireMutex() at AcpiOsAcquireMutex+0xab/frame 0xfffffe00a7f76f40
AcpiUtAcquireMutex() at AcpiUtAcquireMutex+0x3d/frame 0xfffffe00a7f76f80
AcpiNsGetNode() at AcpiNsGetNode+0x27/frame 0xfffffe00a7f77020
AcpiNsEvaluate() at AcpiNsEvaluate+0x1a7/frame 0xfffffe00a7f77060
AcpiEvaluateObject() at AcpiEvaluateObject+0x196/frame =
0xfffffe00a7f770c0
acpi_GetInteger() at acpi_GetInteger+0x3f/frame 0xfffffe00a7f77120
acpi_get_domain() at acpi_get_domain+0x92/frame 0xfffffe00a7f77170
device_attach() at device_attach+0x2e7/frame 0xfffffe00a7f771c0
device_probe_and_attach() at device_probe_and_attach+0x42/frame =
0xfffffe00a7f771f0
usb_probe_and_attach() at usb_probe_and_attach+0x282/frame =
0xfffffe00a7f77280
usb_bus_attach() at usb_bus_attach+0x1b3/frame 0xfffffe00a7f772b0
usb_process() at usb_process+0xf5/frame 0xfffffe00a7f772f0
fork_exit() at fork_exit+0x83/frame 0xfffffe00a7f77330
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00a7f77330
--- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 ---
db>=20

It looks like there=E2=80=99s a leaked mutex inside of ACPI.  Not sure
what=E2=80=99s up with thread 100315, but thread 400 is a dead
give-away.  If I revert the 20190703 ACPICA import then
everything is fine.  I don=E2=80=99t know yet if this is the same =
problem
on my first system, but both work fine without this revision,
and the hung usb thread is also very telling.

Please consider reverting this from HEAD while we debug it
further.

Thanks,
Scott


> On Jul 9, 2019, at 12:02 PM, Jung-uk Kim <jkim@FreeBSD.org> wrote:
>=20
> Author: jkim
> Date: Tue Jul  9 18:02:36 2019
> New Revision: 349863
> URL: https://svnweb.freebsd.org/changeset/base/349863
>=20
> Log:
>  MFV:	r349861
>=20
>  Import ACPICA 20190703.
>=20
> Modified:
>  head/sys/contrib/dev/acpica/changes.txt
>  head/sys/contrib/dev/acpica/compiler/asldefine.h
>  head/sys/contrib/dev/acpica/compiler/aslglobal.h
>  head/sys/contrib/dev/acpica/compiler/aslload.c
>  head/sys/contrib/dev/acpica/compiler/aslmessages.c
>  head/sys/contrib/dev/acpica/compiler/aslmessages.h
>  head/sys/contrib/dev/acpica/compiler/aslstubs.c
>  head/sys/contrib/dev/acpica/compiler/aslsupport.l
>  head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
>  head/sys/contrib/dev/acpica/components/events/evgpe.c
>  head/sys/contrib/dev/acpica/components/events/evgpeblk.c
>  head/sys/contrib/dev/acpica/components/events/evxface.c
>  head/sys/contrib/dev/acpica/components/events/evxfgpe.c
>  head/sys/contrib/dev/acpica/components/executer/exconfig.c
>  head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
>  head/sys/contrib/dev/acpica/components/namespace/nseval.c
>  head/sys/contrib/dev/acpica/components/namespace/nsinit.c
>  head/sys/contrib/dev/acpica/components/namespace/nsload.c
>  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
>  head/sys/contrib/dev/acpica/components/tables/tbdata.c
>  head/sys/contrib/dev/acpica/components/tables/tbxfload.c
>  head/sys/contrib/dev/acpica/components/utilities/utinit.c
>  head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
>  head/sys/contrib/dev/acpica/include/acevents.h
>  head/sys/contrib/dev/acpica/include/acglobal.h
>  head/sys/contrib/dev/acpica/include/acnamesp.h
>  head/sys/contrib/dev/acpica/include/acpixf.h
> Directory Properties:
>  head/sys/contrib/dev/acpica/   (props changed)
>=20
> Modified: head/sys/contrib/dev/acpica/changes.txt
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/changes.txt	Tue Jul  9 17:18:24 2019	=
(r349862)
> +++ head/sys/contrib/dev/acpica/changes.txt	Tue Jul  9 18:02:36 2019	=
(r349863)
> @@ -1,4 +1,53 @@
> ----------------------------------------
> +03 July 2019. Summary of changes for version 20190703:
> +
> +
> +1) ACPICA kernel-resident subsystem:
> +
> +Remove legacy module-level support code. There were still some =
remnants=20
> +of the legacy module-level code executions. Since we no longer =
support=20
> +this option, this is essentially dead code and has been removed from =
the=20
> +ACPICA source.
> +
> +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the =
root=20
> +scope. If these named objects are declared outside the root scope, =
they=20
> +will not be invoked by any host Operating System.
> +
> +Clear status of GPEs on first direct enable. ACPI GPEs (other than =
the EC=20
> +one) can be enabled in two situations. First, the GPEs with existing =
_Lxx=20
> +and _Exx methods are enabled implicitly by ACPICA during system=20
> +initialization.  Second, the GPEs without these methods (like GPEs =
listed=20
> +by _PRW objects for wakeup devices) need to be enabled directly by =
the=20
> +code that is going to use them (e.g. ACPI power management or device=20=

> +drivers).
> +
> +In the former case, if the status of a given GPE is set to start =
with,=20
> +its handler method (either _Lxx or _Exx) needs to be invoked to take =
care=20
> +of the events (possibly) signaled before the GPE was enabled. In the=20=

> +latter case, however, the first caller of AcpiEnableGpe() for a given =
GPE=20
> +should not be expected to care about any events that might be =
signaled=20
> +through it earlier.  In that case, it is better to clear the status =
of=20
> +the GPE before enabling it, to prevent stale events from triggering=20=

> +unwanted actions (like spurious system resume, for example).
> +
> +For this reason, modify AcpiEvAddGpeReference() to take an additional=20=

> +boolean argument indicating whether or not the GPE status needs to be=20=

> +cleared when its reference counter changes from zero to one and make=20=

> +AcpiEnableGpe() pass TRUE to it through that new argument.
> +
> +
> +2) iASL Compiler/Disassembler and ACPICA tools:
> +
> +The tool generation process has been migrated to MSVC 2017, and all=20=

> +project files have been upgraded. The new project files appear in the=20=

> +directory \acpica\generate\msvc2017. This change effectively =
deprecates=20
> +the older project files in \acpica\generate\msvc9.
> +
> +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the =
root=20
> +scope. If these named objects are declared outside the root scope, =
they=20
> +will not be invoked by any host Operating System
> +
> +----------------------------------------
> 09 May 2019. Summary of changes for version 20190509:
>=20
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/asldefine.h	Tue Jul  9 =
17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Tue Jul  9 =
18:02:36 2019	(r349863)
> @@ -298,4 +298,20 @@
> #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments =3D =
TRUE;
> #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments =3D =
FALSE;
>=20
> +/*
> + * Special name segments - these must only be declared at the root =
scope
> + */
> +#define NAMESEG__PTS    "_PTS"
> +#define NAMESEG__WAK    "_WAK"
> +#define NAMESEG__S0     "_S0_"
> +#define NAMESEG__S1     "_S1_"
> +#define NAMESEG__S2     "_S2_"
> +#define NAMESEG__S3     "_S3_"
> +#define NAMESEG__S4     "_S4_"
> +#define NAMESEG__S5     "_S5_"
> +#define NAMESEG__TTS    "_TTS"
> +
> +#define MAX_SPECIAL_NAMES      9
> +
> +
> #endif /* ASLDEFINE.H */
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Jul  9 =
17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Jul  9 =
18:02:36 2019	(r349863)
> @@ -223,11 +223,26 @@ const char                          =
*AslGbl_OpFlagName
>     "OP_NOT_FOUND_DURING_LOAD"
> };
>=20
> +const char                          *AslGbl_SpecialNamedObjects =
[MAX_SPECIAL_NAMES] =3D
> +{
> +    NAMESEG__PTS,
> +    NAMESEG__WAK,
> +    NAMESEG__S0,
> +    NAMESEG__S1,
> +    NAMESEG__S2,
> +    NAMESEG__S3,
> +    NAMESEG__S4,
> +    NAMESEG__S5,
> +    NAMESEG__TTS
> +};
> +
> #else
> extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
> extern UINT32                       =
AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
> extern const char                   =
*AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
> +extern const char                   =
*AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES];
> #endif
> +
>=20
>=20
> /*
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslload.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslload.c	Tue Jul  9 =
17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/compiler/aslload.c	Tue Jul  9 =
18:02:36 2019	(r349863)
> @@ -164,6 +164,7 @@
>=20
> static ACPI_STATUS
> LdLoadFieldElements (
> +    UINT32                  AmlType,
>     ACPI_PARSE_OBJECT       *Op,
>     ACPI_WALK_STATE         *WalkState);
>=20
> @@ -190,6 +191,10 @@ LdCommonNamespaceEnd (
>     UINT32                  Level,
>     void                    *Context);
>=20
> +static void
> +LdCheckSpecialNames (
> +    ACPI_NAMESPACE_NODE     *Node,
> +    ACPI_PARSE_OBJECT       *Op);
>=20
> =
/*************************************************************************=
******
>  *
> @@ -247,7 +252,8 @@ LdLoadNamespace (
>  *
>  * FUNCTION:    LdLoadFieldElements
>  *
> - * PARAMETERS:  Op              - Parent node (Field)
> + * PARAMETERS:  AmlType         - Type to search
> + *              Op              - Parent node (Field)
>  *              WalkState       - Current walk state
>  *
>  * RETURN:      Status
> @@ -259,6 +265,7 @@ LdLoadNamespace (
>=20
> static ACPI_STATUS
> LdLoadFieldElements (
> +    UINT32                  AmlType,
>     ACPI_PARSE_OBJECT       *Op,
>     ACPI_WALK_STATE         *WalkState)
> {
> @@ -274,7 +281,7 @@ LdLoadFieldElements (
>     {
>         Status =3D AcpiNsLookup (WalkState->ScopeInfo,
>             SourceRegion->Asl.Value.String,
> -            ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
> +            AmlType, ACPI_IMODE_EXECUTE,
>             ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
>         if (Status =3D=3D AE_NOT_FOUND)
>         {
> @@ -507,11 +514,15 @@ LdNamespace1Begin (
>      */
>     switch (Op->Asl.AmlOpcode)
>     {
> -    case AML_BANK_FIELD_OP:
>     case AML_INDEX_FIELD_OP:
> +
> +        Status =3D LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, =
Op, WalkState);
> +        return (Status);
> +
> +    case AML_BANK_FIELD_OP:
>     case AML_FIELD_OP:
>=20
> -        Status =3D LdLoadFieldElements (Op, WalkState);
> +        Status =3D LdLoadFieldElements (ACPI_TYPE_REGION, Op, =
WalkState);
>         return (Status);
>=20
>     case AML_INT_CONNECTION_OP:
> @@ -966,6 +977,10 @@ LdNamespace1Begin (
>         }
>     }
>=20
> +    /* Check special names like _WAK and _PTS */
> +
> +    LdCheckSpecialNames (Node, Op);
> +
>     if (ForceNewScope)
>     {
>         Status =3D AcpiDsScopeStackPush (Node, ObjectType, WalkState);
> @@ -1001,6 +1016,42 @@ FinishNode:
>     }
>=20
>     return_ACPI_STATUS (Status);
> +}
> +
> +
> =
+/************************************************************************=
*******
> + *
> + * FUNCTION:    LdCheckSpecialNames
> + *
> + * PARAMETERS:  Node        - Node that represents the named object
> + *              Op          - Named object declaring this named =
object
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Check if certain named objects are declared in the =
incorrect
> + *              scope. Special named objects are listed in
> + *              AslGbl_SpecialNamedObjects and can only be declared =
at the root
> + *              scope.
> + *
> + =
**************************************************************************=
****/
> +
> +static void
> +LdCheckSpecialNames (
> +    ACPI_NAMESPACE_NODE     *Node,
> +    ACPI_PARSE_OBJECT       *Op)
> +{
> +    UINT32                  i;
> +
> +
> +    for (i =3D 0; i < MAX_SPECIAL_NAMES; i++)
> +    {
> +        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, =
AslGbl_SpecialNamedObjects[i]) &&
> +            Node->Parent !=3D AcpiGbl_RootNode)
> +        {
> +            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, =
Op->Asl.ExternalName);
> +            return;
> +        }
> +    }
> }
>=20
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslmessages.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -365,7 +365,8 @@ const char                      *AslCompilerMsgs =
[] =3D
> /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared =
with zero length",
> /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created =
temporarily in another method and cannot be accessed",
> /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared =
external but the actual definition does not exist",
> -/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */        "Buffer field extends =
beyond end of target buffer"
> +/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends =
beyond end of target buffer",
> +/*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this =
named object outside root scope is illegal"
> };
>=20
> /* Table compiler */
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslmessages.h	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -368,6 +368,7 @@ typedef enum
>     ASL_MSG_TEMPORARY_OBJECT,
>     ASL_MSG_UNDEFINED_EXTERNAL,
>     ASL_MSG_BUFFER_FIELD_OVERFLOW,
> +    ASL_MSG_INVALID_SPECIAL_NAME,
>=20
>     /* These messages are used by the Data Table compiler only */
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslstubs.c	Tue Jul  9 =
17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/compiler/aslstubs.c	Tue Jul  9 =
18:02:36 2019	(r349863)
> @@ -166,12 +166,6 @@
>  * Things like Events, Global Lock, etc. are not used
>  * by the compiler, so they are stubbed out here.
>  */
> -void
> -AcpiNsExecModuleCodeList (
> -    void)
> -{
> -}
> -
> ACPI_STATUS
> AcpiNsInitializeObjects (
>     void)
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslsupport.l	Tue Jul  9 =
17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/compiler/aslsupport.l	Tue Jul  9 =
18:02:36 2019	(r349863)
> @@ -220,7 +220,7 @@ AslDoLineDirective (
>=20
>     while ((c =3D input()) !=3D '\n' && c !=3D EOF)
>     {
> -        *AslGbl_LineBufPtr =3D c;
> +        *AslGbl_LineBufPtr =3D (char) c;
>         AslGbl_LineBufPtr++;
>     }
>     *AslGbl_LineBufPtr =3D 0;
> @@ -498,7 +498,7 @@ AslInsertLineBuffer (
>=20
>         if (AcpiGbl_CaptureComments)
>         {
> -            CvProcessCommentState (SourceChar);
> +            CvProcessCommentState ((char) SourceChar);
>         }
>     }
> }
> @@ -601,7 +601,7 @@ loop:
>         AslInsertLineBuffer (c);
>         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>         {
> -            *StringBuffer =3D c;
> +            *StringBuffer =3D (char) c;
>             ++StringBuffer;
>         }
>         c1 =3D c;
> @@ -629,7 +629,7 @@ loop:
>     AslInsertLineBuffer (c);
>     if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>     {
> -        *StringBuffer =3D c;
> +        *StringBuffer =3D (char) c;
>         ++StringBuffer;
>     }
>=20
> @@ -720,7 +720,7 @@ AslDoCommentType2 (
>         AslInsertLineBuffer (c);
>         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>         {
> -            *StringBuffer =3D c;
> +            *StringBuffer =3D (char) c;
>             ++StringBuffer;
>         }
>     }
> @@ -878,7 +878,7 @@ DoCharacter:
>                 if (ACPI_IS_OCTAL_DIGIT (StringChar))
>                 {
>                     State =3D ASL_OCTAL_CONSTANT;
> -                    ConvertBuffer[0] =3D StringChar;
> +                    ConvertBuffer[0] =3D (char) StringChar;
>                     i =3D 1;
>                     continue;
>                 }
> @@ -934,7 +934,7 @@ DoCharacter:
>=20
>             /* Append another digit of the constant */
>=20
> -            ConvertBuffer[i] =3D StringChar;
> +            ConvertBuffer[i] =3D (char) StringChar;
>             i++;
>             continue;
>=20
> @@ -978,7 +978,7 @@ DoCharacter:
>=20
>             /* Append another digit of the constant */
>=20
> -            ConvertBuffer[i] =3D StringChar;
> +            ConvertBuffer[i] =3D (char) StringChar;
>             i++;
>             continue;
>=20
> @@ -989,7 +989,7 @@ DoCharacter:
>=20
>         /* Save the finished character */
>=20
> -        *StringBuffer =3D StringChar;
> +        *StringBuffer =3D (char) StringChar;
>         StringBuffer++;
>         if (StringBuffer >=3D EndBuffer)
>         {
>=20
> Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	=
Tue Jul  9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	=
Tue Jul  9 18:02:36 2019	(r349863)
> @@ -362,7 +362,7 @@ AcpiDsInitializeObjects (
>     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
>     {
>         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -            "\nInitializing Namespace objects:\n"));
> +            "\nACPI table initialization:\n"));
>     }
>=20
>     /* Summary of objects initialized */
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evgpe.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evgpe.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/events/evgpe.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -316,6 +316,7 @@ AcpiEvMaskGpe (
>  * FUNCTION:    AcpiEvAddGpeReference
>  *
>  * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
> + *              ClearOnEnable           - Clear GPE status before =
enabling it
>  *
>  * RETURN:      Status
>  *
> @@ -326,7 +327,8 @@ AcpiEvMaskGpe (
>=20
> ACPI_STATUS
> AcpiEvAddGpeReference (
> -    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
> +    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
> +    BOOLEAN                 ClearOnEnable)
> {
>     ACPI_STATUS             Status =3D AE_OK;
>=20
> @@ -343,6 +345,11 @@ AcpiEvAddGpeReference (
>     if (GpeEventInfo->RuntimeCount =3D=3D 1)
>     {
>         /* Enable on first reference */
> +
> +        if (ClearOnEnable)
> +        {
> +            (void) AcpiHwClearGpe (GpeEventInfo);
> +        }
>=20
>         Status =3D AcpiEvUpdateGpeEnableMask (GpeEventInfo);
>         if (ACPI_SUCCESS (Status))
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evgpeblk.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock (
>                 continue;
>             }
>=20
> -            Status =3D AcpiEvAddGpeReference (GpeEventInfo);
> +            Status =3D AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>             if (ACPI_FAILURE (Status))
>             {
>                 ACPI_EXCEPTION ((AE_INFO, Status,
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evxface.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evxface.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/events/evxface.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler (
>             ACPI_GPE_DISPATCH_NOTIFY)) &&
>         Handler->OriginallyEnabled)
>     {
> -        (void) AcpiEvAddGpeReference (GpeEventInfo);
> +        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>         if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>         {
>             /* Poll edge triggered GPEs to handle existing events */
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -267,7 +267,7 @@ AcpiEnableGpe (
>         if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=3D
>             ACPI_GPE_DISPATCH_NONE)
>         {
> -            Status =3D AcpiEvAddGpeReference (GpeEventInfo);
> +            Status =3D AcpiEvAddGpeReference (GpeEventInfo, TRUE);
>             if (ACPI_SUCCESS (Status) &&
>                 ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>             {
>=20
> Modified: head/sys/contrib/dev/acpica/components/executer/exconfig.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/executer/exconfig.c	=
Tue Jul  9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/executer/exconfig.c	=
Tue Jul  9 18:02:36 2019	(r349863)
> @@ -342,10 +342,9 @@ AcpiExLoadTableOp (
>         return_ACPI_STATUS (Status);
>     }
>=20
> -    /* Complete the initialization/resolution of package objects */
> +    /* Complete the initialization/resolution of new objects */
>=20
> -    Status =3D AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, =
ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
> +    AcpiNsInitializeObjects ();
>=20
>     /* Parameter Data (optional) */
>=20
> @@ -620,10 +619,11 @@ AcpiExLoadOp (
>         return_ACPI_STATUS (Status);
>     }
>=20
> -    /* Complete the initialization/resolution of package objects */
> +    /* Complete the initialization/resolution of new objects */
>=20
> -    Status =3D AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, =
ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
> +    AcpiExExitInterpreter ();
> +    AcpiNsInitializeObjects ();
> +    AcpiExEnterInterpreter ();
>=20
>     /* Store the DdbHandle into the Target operand */
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	=
Tue Jul  9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	=
Tue Jul  9 18:02:36 2019	(r349863)
> @@ -184,6 +184,7 @@ AcpiNsRootInitialize (
>     ACPI_STATUS                 Status;
>     const ACPI_PREDEFINED_NAMES *InitVal =3D NULL;
>     ACPI_NAMESPACE_NODE         *NewNode;
> +    ACPI_NAMESPACE_NODE         *PrevNode =3D NULL;
>     ACPI_OPERAND_OBJECT         *ObjDesc;
>     ACPI_STRING                 Val =3D NULL;
>=20
> @@ -213,13 +214,30 @@ AcpiNsRootInitialize (
>      */
>     AcpiGbl_RootNode =3D &AcpiGbl_RootNodeStruct;
>=20
> -    /* Enter the pre-defined names in the name table */
> +    /* Enter the predefined names in the name table */
>=20
>     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>         "Entering predefined entries into namespace\n"));
>=20
> +    /*
> +     * Create the initial (default) namespace.
> +     * This namespace looks like something similar to this:
> +     *
> +     *   ACPI Namespace (from Namespace Root):
> +     *    0  _GPE Scope        00203160 00
> +     *    0  _PR_ Scope        002031D0 00
> +     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
> +     *    0  _SI_ Scope        002032B0 00
> +     *    0  _TZ_ Device       00203320 00
> +     *    0  _REV Integer      00203390 00 =3D 0000000000000002
> +     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows =
NT"
> +     *    0  _GL_ Mutex        00203580 00 Object 002035F0
> +     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml =
00000000
> +     */
>     for (InitVal =3D AcpiGbl_PreDefinedNames; InitVal->Name; =
InitVal++)
>     {
> +        Status =3D AE_OK;
> +
>         /* _OSI is optional for now, will be permanent later */
>=20
>         if (!strcmp (InitVal->Name, "_OSI") && =
!AcpiGbl_CreateOsiMethod)
> @@ -227,17 +245,35 @@ AcpiNsRootInitialize (
>             continue;
>         }
>=20
> -        Status =3D AcpiNsLookup (NULL, ACPI_CAST_PTR (char, =
InitVal->Name),
> -            InitVal->Type, ACPI_IMODE_LOAD_PASS2, =
ACPI_NS_NO_UPSEARCH,
> -            NULL, &NewNode);
> -        if (ACPI_FAILURE (Status))
> +        /*
> +         * Create, init, and link the new predefined name
> +         * Note: No need to use AcpiNsLookup here because all the
> +         * predefined names are at the root level. It is much easier =
to
> +         * just create and link the new node(s) here.
> +         */
> +        NewNode =3D ACPI_ALLOCATE_ZEROED (sizeof =
(ACPI_NAMESPACE_NODE));
> +        if (!NewNode)
>         {
> -            ACPI_EXCEPTION ((AE_INFO, Status,
> -                "Could not create predefined name %s",
> -                InitVal->Name));
> -            continue;
> +            Status =3D AE_NO_MEMORY;
> +            goto UnlockAndExit;
>         }
>=20
> +        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
> +        NewNode->DescriptorType =3D ACPI_DESC_TYPE_NAMED;
> +        NewNode->Type =3D InitVal->Type;
> +
> +        if (!PrevNode)
> +        {
> +            AcpiGbl_RootNodeStruct.Child =3D NewNode;
> +        }
> +        else
> +        {
> +            PrevNode->Peer =3D NewNode;
> +        }
> +
> +        NewNode->Parent =3D &AcpiGbl_RootNodeStruct;
> +        PrevNode =3D NewNode;
> +
>         /*
>          * Name entered successfully. If entry in PreDefinedNames[] =
specifies
>          * an initial value, create the initial value.
> @@ -286,7 +322,7 @@ AcpiNsRootInitialize (
>=20
>                 NewNode->Value =3D ObjDesc->Method.ParamCount;
> #else
> -                /* Mark this as a very SPECIAL method */
> +                /* Mark this as a very SPECIAL method (_OSI) */
>=20
>                 ObjDesc->Method.InfoFlags =3D =
ACPI_METHOD_INTERNAL_ONLY;
>                 ObjDesc->Method.Dispatch.Implementation =3D =
AcpiUtOsiImplementation;
> @@ -358,7 +394,6 @@ AcpiNsRootInitialize (
>             AcpiUtRemoveReference (ObjDesc);
>         }
>     }
> -
>=20
> UnlockAndExit:
>     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nseval.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/namespace/nseval.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -160,14 +160,7 @@
> #define _COMPONENT          ACPI_NAMESPACE
>         ACPI_MODULE_NAME    ("nseval")
>=20
> -/* Local prototypes */
>=20
> -static void
> -AcpiNsExecModuleCode (
> -    ACPI_OPERAND_OBJECT     *MethodObj,
> -    ACPI_EVALUATE_INFO      *Info);
> -
> -
> =
/*************************************************************************=
******
>  *
>  * FUNCTION:    AcpiNsEvaluate
> @@ -464,207 +457,4 @@ Cleanup:
>     ACPI_FREE (Info->FullPathname);
>     Info->FullPathname =3D NULL;
>     return_ACPI_STATUS (Status);
> -}
> -
> -
> =
-/************************************************************************=
*******
> - *
> - * FUNCTION:    AcpiNsExecModuleCodeList
> - *
> - * PARAMETERS:  None
> - *
> - * RETURN:      None. Exceptions during method execution are ignored, =
since
> - *              we cannot abort a table load.
> - *
> - * DESCRIPTION: Execute all elements of the global module-level code =
list.
> - *              Each element is executed as a single control method.
> - *
> - * NOTE: With this option enabled, each block of detected executable =
AML
> - * code that is outside of any control method is wrapped with a =
temporary
> - * control method object and placed on a global list. The methods on =
this
> - * list are executed below.
> - *
> - * This function executes the module-level code for all tables only =
after
> - * all of the tables have been loaded. It is a legacy option and is
> - * not compatible with other ACPI implementations. See =
AcpiNsLoadTable.
> - *
> - * This function will be removed when the legacy option is removed.
> - *
> - =
**************************************************************************=
****/
> -
> -void
> -AcpiNsExecModuleCodeList (
> -    void)
> -{
> -    ACPI_OPERAND_OBJECT     *Prev;
> -    ACPI_OPERAND_OBJECT     *Next;
> -    ACPI_EVALUATE_INFO      *Info;
> -    UINT32                  MethodCount =3D 0;
> -
> -
> -    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
> -
> -
> -    /* Exit now if the list is empty */
> -
> -    Next =3D AcpiGbl_ModuleCodeList;
> -    if (!Next)
> -    {
> -        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> -            "Legacy MLC block list is empty\n"));
> -
> -        return_VOID;
> -    }
> -
> -    /* Allocate the evaluation information block */
> -
> -    Info =3D ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
> -    if (!Info)
> -    {
> -        return_VOID;
> -    }
> -
> -    /* Walk the list, executing each "method" */
> -
> -    while (Next)
> -    {
> -        Prev =3D Next;
> -        Next =3D Next->Method.Mutex;
> -
> -        /* Clear the link field and execute the method */
> -
> -        Prev->Method.Mutex =3D NULL;
> -        AcpiNsExecModuleCode (Prev, Info);
> -        MethodCount++;
> -
> -        /* Delete the (temporary) method object */
> -
> -        AcpiUtRemoveReference (Prev);
> -    }
> -
> -    ACPI_INFO ((
> -        "Executed %u blocks of module-level executable AML code",
> -        MethodCount));
> -
> -    ACPI_FREE (Info);
> -    AcpiGbl_ModuleCodeList =3D NULL;
> -    return_VOID;
> -}
> -
> -
> =
-/************************************************************************=
*******
> - *
> - * FUNCTION:    AcpiNsExecModuleCode
> - *
> - * PARAMETERS:  MethodObj           - Object container for the =
module-level code
> - *              Info                - Info block for method =
evaluation
> - *
> - * RETURN:      None. Exceptions during method execution are ignored, =
since
> - *              we cannot abort a table load.
> - *
> - * DESCRIPTION: Execute a control method containing a block of =
module-level
> - *              executable AML code. The control method is =
temporarily
> - *              installed to the root node, then evaluated.
> - *
> - =
**************************************************************************=
****/
> -
> -static void
> -AcpiNsExecModuleCode (
> -    ACPI_OPERAND_OBJECT     *MethodObj,
> -    ACPI_EVALUATE_INFO      *Info)
> -{
> -    ACPI_OPERAND_OBJECT     *ParentObj;
> -    ACPI_NAMESPACE_NODE     *ParentNode;
> -    ACPI_OBJECT_TYPE        Type;
> -    ACPI_STATUS             Status;
> -
> -
> -    ACPI_FUNCTION_TRACE (NsExecModuleCode);
> -
> -
> -    /*
> -     * Get the parent node. We cheat by using the NextObject field
> -     * of the method object descriptor.
> -     */
> -    ParentNode =3D ACPI_CAST_PTR (
> -        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
> -    Type =3D AcpiNsGetType (ParentNode);
> -
> -    /*
> -     * Get the region handler and save it in the method object. We =
may need
> -     * this if an operation region declaration causes a _REG method =
to be run.
> -     *
> -     * We can't do this in AcpiPsLinkModuleCode because
> -     * AcpiGbl_RootNode->Object is NULL at PASS1.
> -     */
> -    if ((Type =3D=3D ACPI_TYPE_DEVICE) && ParentNode->Object)
> -    {
> -        MethodObj->Method.Dispatch.Handler =3D
> -            ParentNode->Object->Device.Handler;
> -    }
> -
> -    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
> -
> -    MethodObj->Method.NextObject =3D NULL;
> -
> -    /* Initialize the evaluation information block */
> -
> -    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
> -    Info->PrefixNode =3D ParentNode;
> -
> -    /*
> -     * Get the currently attached parent object. Add a reference,
> -     * because the ref count will be decreased when the method object
> -     * is installed to the parent node.
> -     */
> -    ParentObj =3D AcpiNsGetAttachedObject (ParentNode);
> -    if (ParentObj)
> -    {
> -        AcpiUtAddReference (ParentObj);
> -    }
> -
> -    /* Install the method (module-level code) in the parent node */
> -
> -    Status =3D AcpiNsAttachObject (ParentNode, MethodObj, =
ACPI_TYPE_METHOD);
> -    if (ACPI_FAILURE (Status))
> -    {
> -        goto Exit;
> -    }
> -
> -    /* Execute the parent node as a control method */
> -
> -    Status =3D AcpiNsEvaluate (Info);
> -
> -    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> -        "Executed module-level code at %p\n",
> -        MethodObj->Method.AmlStart));
> -
> -    /* Delete a possible implicit return value (in slack mode) */
> -
> -    if (Info->ReturnObject)
> -    {
> -        AcpiUtRemoveReference (Info->ReturnObject);
> -    }
> -
> -    /* Detach the temporary method object */
> -
> -    AcpiNsDetachObject (ParentNode);
> -
> -    /* Restore the original parent object */
> -
> -    if (ParentObj)
> -    {
> -        Status =3D AcpiNsAttachObject (ParentNode, ParentObj, Type);
> -    }
> -    else
> -    {
> -        ParentNode->Type =3D (UINT8) Type;
> -    }
> -
> -Exit:
> -    if (ParentObj)
> -    {
> -        AcpiUtRemoveReference (ParentObj);
> -    }
> -    return_VOID;
> }
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -212,29 +212,30 @@ AcpiNsInitializeObjects (
>     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>         "**** Starting initialization of namespace objects ****\n"));
>     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "Completing Region/Field/Buffer/Package initialization:\n"));
> +        "Final data object initialization: "));
>=20
> -    /* Set all init info to zero */
> +    /* Clear the info block */
>=20
>     memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
>=20
>     /* Walk entire namespace from the supplied root */
>=20
> +    /*
> +     * TBD: will become ACPI_TYPE_PACKAGE as this type object
> +     * is now the only one that supports deferred initialization
> +     * (forward references).
> +     */
>     Status =3D AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
> -        &Info, NULL);
> +        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
>     if (ACPI_FAILURE (Status))
>     {
>         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
>     }
>=20
>     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
> -        "Buffers %u/%u Packages (%u nodes)\n",
> -        Info.OpRegionInit,  Info.OpRegionCount,
> -        Info.FieldInit,     Info.FieldCount,
> -        Info.BufferInit,    Info.BufferCount,
> -        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
> +        "Namespace contains %u (0x%X) objects\n",
> +        Info.ObjectCount,
> +        Info.ObjectCount));
>=20
>     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>         "%u Control Methods found\n%u Op Regions found\n",
> @@ -561,35 +562,19 @@ AcpiNsInitOneObject (
>     AcpiExEnterInterpreter ();
>=20
>     /*
> -     * Each of these types can contain executable AML code within the
> -     * declaration.
> +     * Only initialization of Package objects can be deferred, in =
order
> +     * to support forward references.
>      */
>     switch (Type)
>     {
> -    case ACPI_TYPE_REGION:
> +    case ACPI_TYPE_LOCAL_BANK_FIELD:
>=20
> -        Info->OpRegionInit++;
> -        Status =3D AcpiDsGetRegionArguments (ObjDesc);
> -        break;
> +        /* TBD: BankFields do not require deferred init, remove this =
code */
>=20
> -    case ACPI_TYPE_BUFFER_FIELD:
> -
>         Info->FieldInit++;
> -        Status =3D AcpiDsGetBufferFieldArguments (ObjDesc);
> -        break;
> -
> -    case ACPI_TYPE_LOCAL_BANK_FIELD:
> -
> -        Info->FieldInit++;
>         Status =3D AcpiDsGetBankFieldArguments (ObjDesc);
>         break;
>=20
> -    case ACPI_TYPE_BUFFER:
> -
> -        Info->BufferInit++;
> -        Status =3D AcpiDsGetBufferArguments (ObjDesc);
> -        break;
> -
>     case ACPI_TYPE_PACKAGE:
>=20
>         /* Complete the initialization/resolution of the package =
object */
> @@ -600,8 +585,12 @@ AcpiNsInitOneObject (
>=20
>     default:
>=20
> -        /* No other types can get here */
> +        /* No other types should get here */
>=20
> +        Status =3D AE_TYPE;
> +        ACPI_EXCEPTION ((AE_INFO, Status,
> +            "Opcode is not deferred [%4.4s] (%s)",
> +            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
>         break;
>     }
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsload.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsload.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsload.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -268,18 +268,6 @@ Unlock:
>     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>         "**** Completed Table Object Initialization\n"));
>=20
> -    /*
> -     * This case handles the legacy option that groups all =
module-level
> -     * code blocks together and defers execution until all of the =
tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the =
table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code =
that
> -     * depends upon in-order immediate execution of module-level =
code.
> -     */
> -    AcpiNsExecModuleCodeList ();
>     return_ACPI_STATUS (Status);
> }
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsutils.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsutils.c	=
Tue Jul  9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsutils.c	=
Tue Jul  9 18:02:36 2019	(r349863)
> @@ -802,23 +802,10 @@ AcpiNsTerminate (
>     void)
> {
>     ACPI_STATUS             Status;
> -    ACPI_OPERAND_OBJECT     *Prev;
> -    ACPI_OPERAND_OBJECT     *Next;
>=20
>=20
>     ACPI_FUNCTION_TRACE (NsTerminate);
>=20
> -
> -    /* Delete any module-level code blocks */
> -
> -    Next =3D AcpiGbl_ModuleCodeList;
> -    while (Next)
> -    {
> -        Prev =3D Next;
> -        Next =3D Next->Method.Mutex;
> -        Prev->Method.Mutex =3D NULL; /* Clear the Mutex (cheated) =
field */
> -        AcpiUtRemoveReference (Prev);
> -    }
>=20
>     /*
>      * Free the entire namespace -- all nodes and all objects
>=20
> Modified: head/sys/contrib/dev/acpica/components/tables/tbdata.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/tables/tbdata.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/tables/tbdata.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -1191,19 +1191,6 @@ AcpiTbLoadTable (
>     Status =3D AcpiNsLoadTable (TableIndex, ParentNode);
>=20
>     /*
> -     * This case handles the legacy option that groups all =
module-level
> -     * code blocks together and defers execution until all of the =
tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the =
table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code =
that
> -     * depends upon in-order immediate execution of module-level =
code.
> -     */
> -    AcpiNsExecModuleCodeList ();
> -
> -    /*
>      * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The =
host is
>      * responsible for discovering any new wake GPEs by running _PRW =
methods
>      * that may have been loaded by this table.
>=20
> Modified: head/sys/contrib/dev/acpica/components/tables/tbxfload.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -479,6 +479,13 @@ AcpiLoadTable (
>     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
>     Status =3D AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR =
(Table),
>         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
> +    if (ACPI_SUCCESS (Status))
> +    {
> +        /* Complete the initialization/resolution of new objects */
> +
> +        AcpiNsInitializeObjects ();
> +    }
> +
>     return_ACPI_STATUS (Status);
> }
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/utilities/utinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/utilities/utinit.c	Tue Jul  =
9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/utilities/utinit.c	Tue Jul  =
9 18:02:36 2019	(r349863)
> @@ -342,7 +342,6 @@ AcpiUtInitGlobals (
>=20
>     /* Namespace */
>=20
> -    AcpiGbl_ModuleCodeList              =3D NULL;
>     AcpiGbl_RootNode                    =3D NULL;
>     AcpiGbl_RootNodeStruct.Name.Integer =3D ACPI_ROOT_NAME;
>     AcpiGbl_RootNodeStruct.DescriptorType =3D ACPI_DESC_TYPE_NAMED;
>=20
> Modified: head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	=
Tue Jul  9 17:18:24 2019	(r349862)
> +++ head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	=
Tue Jul  9 18:02:36 2019	(r349863)
> @@ -381,24 +381,17 @@ AcpiInitializeObjects (
>     ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
>=20
>=20
> +#ifdef ACPI_OBSOLETE_BEHAVIOR
>     /*
> -     * This case handles the legacy option that groups all =
module-level
> -     * code blocks together and defers execution until all of the =
tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the =
table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code =
that
> -     * depends upon in-order immediate execution of module-level =
code.
> +     * 05/2019: Removed, initialization now happens at both object
> +     * creation and table load time
>      */
> -    AcpiNsExecModuleCodeList ();
>=20
>     /*
>      * Initialize the objects that remain uninitialized. This
>      * runs the executable AML that may be part of the
> -     * declaration of these objects:
>=20
> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
>=20


From owner-svn-src-head@freebsd.org  Thu Aug  1 14:03:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4A1DBEC33;
 Thu,  1 Aug 2019 14:03:00 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zsSh4JJzz3C5q;
 Thu,  1 Aug 2019 14:03:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 756FA1B5EC;
 Thu,  1 Aug 2019 14:03:00 +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 x71E30hL023326;
 Thu, 1 Aug 2019 14:03:00 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71E30B2023325;
 Thu, 1 Aug 2019 14:03:00 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011403.x71E30B2023325@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 14:03:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350499 - head/sys/dev/acpica
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/sys/dev/acpica
X-SVN-Commit-Revision: 350499
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zsSh4JJzz3C5q
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.18 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.303,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_SPAM_SHORT(0.12)[0.122,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:03:00 -0000

Author: emaste
Date: Thu Aug  1 14:02:59 2019
New Revision: 350499
URL: https://svnweb.freebsd.org/changeset/base/350499

Log:
  acpi_resource.c: mention ThunderX2 firmware revision with issue
  
  Presumably this will be fixed in the next version, and the workaround
  could eventually be removed.  See r330113 and r346066 details.

Modified:
  head/sys/dev/acpica/acpi_resource.c

Modified: head/sys/dev/acpica/acpi_resource.c
==============================================================================
--- head/sys/dev/acpica/acpi_resource.c	Thu Aug  1 13:46:04 2019	(r350498)
+++ head/sys/dev/acpica/acpi_resource.c	Thu Aug  1 14:02:59 2019	(r350499)
@@ -477,7 +477,10 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
     arc.dev = dev;
     arc.ignore_producer_flag = false;
 
-    /* UARTs on ThunderX2 set ResourceProducer on memory resources. */
+    /*
+     * UARTs on ThunderX2 set ResourceProducer on memory resources, with
+     * 7.2 firmware.
+     */
     if (acpi_MatchHid(handle, "ARMH0011") != ACPI_MATCHHID_NOMATCH)
 	    arc.ignore_producer_flag = true;
 

From owner-svn-src-head@freebsd.org  Thu Aug  1 14:05:04 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EE9CBECD9;
 Thu,  1 Aug 2019 14:05:04 +0000 (UTC)
 (envelope-from mavbsd@gmail.com)
Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com
 [IPv6:2607:f8b0:4864:20::b43])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zsW35yJ7z3CFW;
 Thu,  1 Aug 2019 14:05:03 +0000 (UTC)
 (envelope-from mavbsd@gmail.com)
Received: by mail-yb1-xb43.google.com with SMTP id q5so13556267ybp.1;
 Thu, 01 Aug 2019 07:05:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=FNWjkRVssfGDktSf0fc4YKIOJr9QR9lMjKVaccziIM0=;
 b=GZiRNCzvQeoU38B+suIC+wKL1fP23cpsglv6mt7k+eB1T6/pL466C4Tmk8aHdrJfXz
 8VcGBrKen2wo8R7zvtqesFC+Y8ydvYNUU1ZoxitHlovbVOOgyiygBxDlZjxrr/oWpGAW
 h93B7CuM8JDDkTGs/hBr2hKUfhTXIxZGeA8GXJufO5GgkEyQUKGZBqow60C+XrNiAZy+
 l8+vy45jJuLGNddfYOUbYFmDeTecnAbrxBItPVSq5xxQK1KarfXp1cSLl30pNWv+UViY
 9TYn58kWGbRMXYnvWu7/Q1uviMB7T0yAxZbJwXZ1XQ75j1dyOzsDlEbPlnsDbkSBOLUM
 FuYg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt
 :message-id:date:user-agent:mime-version:in-reply-to
 :content-language:content-transfer-encoding;
 bh=FNWjkRVssfGDktSf0fc4YKIOJr9QR9lMjKVaccziIM0=;
 b=mVdeceLJsRkiEFH6gji0nzgTsRyqweI9GrtrKoF+HxbFLMrAoCHKF3bjLaUuX3jvNE
 6VGauqtteczUnVAHVWOhb6cQDPmnXA978L39Ka8PQj8NIay38XeOYqvnduzheNbwCq7Y
 AvaT7UqK8RJmje9M//xv+3xFk35R+Ykia9GN+Kp14DEIM3H4g7KOYa/JM9/1/8UuNzFj
 2lgga6TdaQUvytPacff6pqutaGak5x2/AWz48rBBd/AYtnQbYOh0Hs8xpVJO5C51xVtS
 STkI7bbpiPhnRsgcmO3moq1yxd/k2TEHXyM7Fmh1kUr3oX+UDo428b8biBl/IMimC7Dm
 HQcw==
X-Gm-Message-State: APjAAAWvD2WRXJ97flnoxdq46qhOEpleNldlBNRvoaE0DEzMboe9epNl
 2dodgcL1RAT1GhBMzhYffhpEp9x5
X-Google-Smtp-Source: APXvYqw/MCvhsgvOsr1c35lPnFIF0JtvkfMyhPacQ/q6aIA5iuOg9B9gF5jb0cN2szSnYq1Y0KDkvw==
X-Received: by 2002:a25:9244:: with SMTP id e4mr72283806ybo.221.1564668301984; 
 Thu, 01 Aug 2019 07:05:01 -0700 (PDT)
Received: from mavoffice.ixsystems.com ([12.189.233.129])
 by smtp.gmail.com with ESMTPSA id 197sm16201648ywb.56.2019.08.01.07.05.01
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 01 Aug 2019 07:05:01 -0700 (PDT)
Subject: Re: svn commit: r349863 - in head/sys/contrib/dev/acpica: . compiler
 components/dispatcher components/events components/executer
 components/namespace components/tables components/utilities include
To: Jung-uk Kim <jkim@FreeBSD.org>
Cc: Scott Long <scottl@samsco.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201907091802.x69I2bWv076792@repo.freebsd.org>
 <A4437766-0565-4115-98AD-E59EF0E83C0D@samsco.org>
From: Alexander Motin <mavbsd@gmail.com>
Openpgp: preference=signencrypt
Autocrypt: addr=mavbsd@gmail.com; prefer-encrypt=mutual; keydata=
 xsBNBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g
 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne
 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP
 g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU
 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB
 AAHNIUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPsLAlwQTAQoAQQIbAwULCQgH
 AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN
 McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm
 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y
 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z
 zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6
 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ
 Yr4+raTOwE0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z
 AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv
 mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt
 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ
 R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5
 9R8AEQEAAcLAZQQYAQoADwUCU7PEDAIbDAUJBaOagAAKCRCDGMOVW6sif7FRB/4k9y/GaGqU
 fcJiXdQHRAKHCUvbKMFgeEDHOg33qx+POS2Ah85/PXVa2jYBldCZDmYc+zl48aEMd163a7s3
 0gJaB7CYElwxlKUk6c+5gwoYIJuJJzSzW0JzSD5ch7RIRxbfxrKdsiHrUW8AeduZWzlK6VaW
 RmWILgLmxfLdhEVFWxbr99GSeVFZaZwn6tl/8CvBcgYoARvJvl0V5zS1akQfEISYkwL9EfUI
 W44EOHranL5qUXkedXBYp6fRsooGrIimfwYxaC8FbXhk3FMgMjDMRiVq4POHo1iGeYETsUrL
 NM6184E25gPVtX2fb3RhM8Xh6BkwCZ6ZYbQ+AcD4F/cKwsB8BBgBCgAmAhsMFiEE6YzzxOac
 w80OV51VgxjDlVurIn8FAllgwtgFCQ0xzMwACgkQgxjDlVurIn9OqAf9FAcKWS95wTTbraXA
 qg/+bQyHgjlMtGCgkmfxLsbUGeqiFgmSIuoDrF7q6sYPs6p00CXXZRuuNZt0lX7O95re8mgz
 gxm5iJisZpdbHMVepYlw/AxT2wCHwxGCEe64Lm+A9vjlOd+3D3/6fSLwZ9WFCE6p6lQZ1CDg
 09xe+JKSgC+KDqmn0tzGKyfSCuhRAq3XkZyxL1hxBaDeP0eeKlzoy7jXodf3wVvXXc0cmpza
 B5McuRHK4EU6jIioHo30YqPM4AjPHGxV2X1N6/Aayungzj9EXNZtKCxs6dsTvjniWa5VkZ9F
 4SOdSbxEen1DZRYpeWnd7GVmO86n+5USkKCXPg==
Message-ID: <715c4e43-3d71-ea19-3035-08567d4fde77@gmail.com>
Date: Thu, 1 Aug 2019 10:05:00 -0400
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <A4437766-0565-4115-98AD-E59EF0E83C0D@samsco.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zsW35yJ7z3CFW
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=gmail.com header.s=20161025 header.b=GZiRNCzv;
 dmarc=pass (policy=none) header.from=gmail.com;
 spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates
 2607:f8b0:4864:20::b43 as permitted sender) smtp.mailfrom=mavbsd@gmail.com
X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
 TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c];
 FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_FIVE(0.00)[5];
 RCVD_COUNT_THREE(0.00)[3];
 MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com];
 DKIM_TRACE(0.00)[gmail.com:+];
 DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
 NEURAL_HAM_SHORT(-0.99)[-0.988,0]; FROM_EQ_ENVFROM(0.00)[];
 IP_SCORE(0.00)[ip: (1.31), ipnet: 2607:f8b0::/32(-3.08), asn: 15169(-2.45),
 country: US(-0.05)]; MIME_TRACE(0.00)[0:+];
 FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 MID_RHS_MATCH_FROM(0.00)[];
 DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0];
 ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0];
 R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[];
 MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[];
 TO_MATCH_ENVRCPT_SOME(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[3.4.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org
 : 127.0.5.0]; RCVD_TLS_ALL(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:05:04 -0000

I was just got the same outcome, investigating my X11DPI-NT board boot
issue, same as reported on current@ thread "Re: Boot still broken from
r349133-r349160 - Was re:(Problem with USB after r349133)".  Revert of
this commit solves the issue, otherwise boot stops and I see the same
backtraces and messages as Scott.

On 01.08.2019 09:54, Scott Long wrote:
> Hi,
> 
> I need to ask that this be backed out.  I have two systems that are failing
> to boot when this revision is present.  One I can’t debug because it causes
> USB to fail to probe, leaving me without a working console (and no network
> access for other reasons).  The other fails in a different way and livelocks
> the system:
> 
> 
> ixl1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	options=e507bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
> 	ether ac:1f:6b:0a:4a:57
> 	media: Ethernet autoselect (1000baseT <full-duplex>)
> 	status: active
> 	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> Starting devd.
> 
> Here the boot hangs.  If I hit Ctrl-C, I get this:
> 
> ^CACPI Error: AE_ERROR, Thread 100315 could not acquire Mutex [ACPI_MTX_Namespace] (0x1) (20190703/utmutex-434)
> ACPI Error: AE_ERROR, Thread 100315 could not acquire Mutex [ACPI_MTX_Namespace] (0x1) (20190703/utmutex-434)
> ACPI Error: AE_ERROR, Thread 100315 could not acquire Mutex [ACPI_MTX_Namespace] (0x1) (20190703/utmutex-434)
> 
> Breaking into DDB gives this:
> db> bt
> Tracing pid 11 tid 100012 td 0xfffff800038a85a0
> acpi_cpu_idle_mwait() at acpi_cpu_idle_mwait+0x70/frame 0xfffffe00005a4180
> acpi_cpu_idle() at acpi_cpu_idle+0x183/frame 0xfffffe00005a41d0
> cpu_idle_acpi() at cpu_idle_acpi+0x3f/frame 0xfffffe00005a41f0
> cpu_idle() at cpu_idle+0xa6/frame 0xfffffe00005a4210
> sched_idletd() at sched_idletd+0x442/frame 0xfffffe00005a42f0
> fork_exit() at fork_exit+0x83/frame 0xfffffe00005a4330
> fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00005a4330
> --- trap 0, rip = 0, rsp = 0, rbp = 0 ---
> db> ps
>   pid  ppid  pgrp   uid  state   wmesg   wchan               cmd
>   401   399    59     0  S+      piperd  0xfffff80005214000  sort
>   400   399    59     0  S+      acmtx   0xfffff80003770280  devmatch
> …
> 100247                   S       acmtx   0xfffff80003770280  [usbus0]
> ...
> db> bt 100315
> Thread 100315 not found
> db> bt 400
> Tracing pid 400 tid 100339 td 0xfffff8002a52c5a0
> sched_switch() at sched_switch+0x64a/frame 0xfffffe00b4c21d20
> mi_switch() at mi_switch+0xe2/frame 0xfffffe00b4c21d50
> sleepq_catch_signals() at sleepq_catch_signals+0x425/frame 0xfffffe00b4c21da0
> sleepq_wait_sig() at sleepq_wait_sig+0xf/frame 0xfffffe00b4c21dd0
> _sleep() at _sleep+0x1bf/frame 0xfffffe00b4c21e50
> AcpiOsAcquireMutex() at AcpiOsAcquireMutex+0xab/frame 0xfffffe00b4c21ea0
> AcpiUtAcquireMutex() at AcpiUtAcquireMutex+0x3d/frame 0xfffffe00b4c21ee0
> AcpiGetObjectInfo() at AcpiGetObjectInfo+0x51/frame 0xfffffe00b4c21f60
> acpi_child_pnpinfo_str_method() at acpi_child_pnpinfo_str_method+0x24/frame 0xfffffe00b4c21f90
> sysctl_devices() at sysctl_devices+0x215/frame 0xfffffe00b4c21fe0
> sysctl_root_handler_locked() at sysctl_root_handler_locked+0x8b/frame 0xfffffe00b4c22020
> sysctl_root() at sysctl_root+0x24d/frame 0xfffffe00b4c220a0
> userland_sysctl() at userland_sysctl+0x17a/frame 0xfffffe00b4c22150
> sys___sysctl() at sys___sysctl+0x5f/frame 0xfffffe00b4c22200
> amd64_syscall() at amd64_syscall+0x3b0/frame 0xfffffe00b4c22330
> fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe00b4c22330
> --- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80041cb2a, rsp = 0x7fffffffda78, rbp = 0x7fffffffdab0 ---
> db> bt 100247
> Tracing pid 45 tid 100247 td 0xfffff800077045a0
> sched_switch() at sched_switch+0x64a/frame 0xfffffe00a7f76dc0
> mi_switch() at mi_switch+0xe2/frame 0xfffffe00a7f76df0
> sleepq_catch_signals() at sleepq_catch_signals+0x425/frame 0xfffffe00a7f76e40
> sleepq_wait_sig() at sleepq_wait_sig+0xf/frame 0xfffffe00a7f76e70
> _sleep() at _sleep+0x1bf/frame 0xfffffe00a7f76ef0
> AcpiOsAcquireMutex() at AcpiOsAcquireMutex+0xab/frame 0xfffffe00a7f76f40
> AcpiUtAcquireMutex() at AcpiUtAcquireMutex+0x3d/frame 0xfffffe00a7f76f80
> AcpiNsGetNode() at AcpiNsGetNode+0x27/frame 0xfffffe00a7f77020
> AcpiNsEvaluate() at AcpiNsEvaluate+0x1a7/frame 0xfffffe00a7f77060
> AcpiEvaluateObject() at AcpiEvaluateObject+0x196/frame 0xfffffe00a7f770c0
> acpi_GetInteger() at acpi_GetInteger+0x3f/frame 0xfffffe00a7f77120
> acpi_get_domain() at acpi_get_domain+0x92/frame 0xfffffe00a7f77170
> device_attach() at device_attach+0x2e7/frame 0xfffffe00a7f771c0
> device_probe_and_attach() at device_probe_and_attach+0x42/frame 0xfffffe00a7f771f0
> usb_probe_and_attach() at usb_probe_and_attach+0x282/frame 0xfffffe00a7f77280
> usb_bus_attach() at usb_bus_attach+0x1b3/frame 0xfffffe00a7f772b0
> usb_process() at usb_process+0xf5/frame 0xfffffe00a7f772f0
> fork_exit() at fork_exit+0x83/frame 0xfffffe00a7f77330
> fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00a7f77330
> --- trap 0, rip = 0, rsp = 0, rbp = 0 ---
> db> 
> 
> It looks like there’s a leaked mutex inside of ACPI.  Not sure
> what’s up with thread 100315, but thread 400 is a dead
> give-away.  If I revert the 20190703 ACPICA import then
> everything is fine.  I don’t know yet if this is the same problem
> on my first system, but both work fine without this revision,
> and the hung usb thread is also very telling.
> 
> Please consider reverting this from HEAD while we debug it
> further.
> 
> Thanks,
> Scott
> 
> 
>> On Jul 9, 2019, at 12:02 PM, Jung-uk Kim <jkim@FreeBSD.org> wrote:
>>
>> Author: jkim
>> Date: Tue Jul  9 18:02:36 2019
>> New Revision: 349863
>> URL: https://svnweb.freebsd.org/changeset/base/349863
>>
>> Log:
>>  MFV:	r349861
>>
>>  Import ACPICA 20190703.
>>
>> Modified:
>>  head/sys/contrib/dev/acpica/changes.txt
>>  head/sys/contrib/dev/acpica/compiler/asldefine.h
>>  head/sys/contrib/dev/acpica/compiler/aslglobal.h
>>  head/sys/contrib/dev/acpica/compiler/aslload.c
>>  head/sys/contrib/dev/acpica/compiler/aslmessages.c
>>  head/sys/contrib/dev/acpica/compiler/aslmessages.h
>>  head/sys/contrib/dev/acpica/compiler/aslstubs.c
>>  head/sys/contrib/dev/acpica/compiler/aslsupport.l
>>  head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
>>  head/sys/contrib/dev/acpica/components/events/evgpe.c
>>  head/sys/contrib/dev/acpica/components/events/evgpeblk.c
>>  head/sys/contrib/dev/acpica/components/events/evxface.c
>>  head/sys/contrib/dev/acpica/components/events/evxfgpe.c
>>  head/sys/contrib/dev/acpica/components/executer/exconfig.c
>>  head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
>>  head/sys/contrib/dev/acpica/components/namespace/nseval.c
>>  head/sys/contrib/dev/acpica/components/namespace/nsinit.c
>>  head/sys/contrib/dev/acpica/components/namespace/nsload.c
>>  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
>>  head/sys/contrib/dev/acpica/components/tables/tbdata.c
>>  head/sys/contrib/dev/acpica/components/tables/tbxfload.c
>>  head/sys/contrib/dev/acpica/components/utilities/utinit.c
>>  head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
>>  head/sys/contrib/dev/acpica/include/acevents.h
>>  head/sys/contrib/dev/acpica/include/acglobal.h
>>  head/sys/contrib/dev/acpica/include/acnamesp.h
>>  head/sys/contrib/dev/acpica/include/acpixf.h
>> Directory Properties:
>>  head/sys/contrib/dev/acpica/   (props changed)
>>
>> Modified: head/sys/contrib/dev/acpica/changes.txt
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/changes.txt	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/changes.txt	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -1,4 +1,53 @@
>> ----------------------------------------
>> +03 July 2019. Summary of changes for version 20190703:
>> +
>> +
>> +1) ACPICA kernel-resident subsystem:
>> +
>> +Remove legacy module-level support code. There were still some remnants 
>> +of the legacy module-level code executions. Since we no longer support 
>> +this option, this is essentially dead code and has been removed from the 
>> +ACPICA source.
>> +
>> +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root 
>> +scope. If these named objects are declared outside the root scope, they 
>> +will not be invoked by any host Operating System.
>> +
>> +Clear status of GPEs on first direct enable. ACPI GPEs (other than the EC 
>> +one) can be enabled in two situations. First, the GPEs with existing _Lxx 
>> +and _Exx methods are enabled implicitly by ACPICA during system 
>> +initialization.  Second, the GPEs without these methods (like GPEs listed 
>> +by _PRW objects for wakeup devices) need to be enabled directly by the 
>> +code that is going to use them (e.g. ACPI power management or device 
>> +drivers).
>> +
>> +In the former case, if the status of a given GPE is set to start with, 
>> +its handler method (either _Lxx or _Exx) needs to be invoked to take care 
>> +of the events (possibly) signaled before the GPE was enabled. In the 
>> +latter case, however, the first caller of AcpiEnableGpe() for a given GPE 
>> +should not be expected to care about any events that might be signaled 
>> +through it earlier.  In that case, it is better to clear the status of 
>> +the GPE before enabling it, to prevent stale events from triggering 
>> +unwanted actions (like spurious system resume, for example).
>> +
>> +For this reason, modify AcpiEvAddGpeReference() to take an additional 
>> +boolean argument indicating whether or not the GPE status needs to be 
>> +cleared when its reference counter changes from zero to one and make 
>> +AcpiEnableGpe() pass TRUE to it through that new argument.
>> +
>> +
>> +2) iASL Compiler/Disassembler and ACPICA tools:
>> +
>> +The tool generation process has been migrated to MSVC 2017, and all 
>> +project files have been upgraded. The new project files appear in the 
>> +directory \acpica\generate\msvc2017. This change effectively deprecates 
>> +the older project files in \acpica\generate\msvc9.
>> +
>> +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root 
>> +scope. If these named objects are declared outside the root scope, they 
>> +will not be invoked by any host Operating System
>> +
>> +----------------------------------------
>> 09 May 2019. Summary of changes for version 20190509:
>>
>>
>>
>> Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/compiler/asldefine.h	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -298,4 +298,20 @@
>> #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
>> #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
>>
>> +/*
>> + * Special name segments - these must only be declared at the root scope
>> + */
>> +#define NAMESEG__PTS    "_PTS"
>> +#define NAMESEG__WAK    "_WAK"
>> +#define NAMESEG__S0     "_S0_"
>> +#define NAMESEG__S1     "_S1_"
>> +#define NAMESEG__S2     "_S2_"
>> +#define NAMESEG__S3     "_S3_"
>> +#define NAMESEG__S4     "_S4_"
>> +#define NAMESEG__S5     "_S5_"
>> +#define NAMESEG__TTS    "_TTS"
>> +
>> +#define MAX_SPECIAL_NAMES      9
>> +
>> +
>> #endif /* ASLDEFINE.H */
>>
>> Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -223,11 +223,26 @@ const char                          *AslGbl_OpFlagName
>>     "OP_NOT_FOUND_DURING_LOAD"
>> };
>>
>> +const char                          *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] =
>> +{
>> +    NAMESEG__PTS,
>> +    NAMESEG__WAK,
>> +    NAMESEG__S0,
>> +    NAMESEG__S1,
>> +    NAMESEG__S2,
>> +    NAMESEG__S3,
>> +    NAMESEG__S4,
>> +    NAMESEG__S5,
>> +    NAMESEG__TTS
>> +};
>> +
>> #else
>> extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
>> extern UINT32                       AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
>> extern const char                   *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
>> +extern const char                   *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES];
>> #endif
>> +
>>
>>
>> /*
>>
>> Modified: head/sys/contrib/dev/acpica/compiler/aslload.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/compiler/aslload.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/compiler/aslload.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -164,6 +164,7 @@
>>
>> static ACPI_STATUS
>> LdLoadFieldElements (
>> +    UINT32                  AmlType,
>>     ACPI_PARSE_OBJECT       *Op,
>>     ACPI_WALK_STATE         *WalkState);
>>
>> @@ -190,6 +191,10 @@ LdCommonNamespaceEnd (
>>     UINT32                  Level,
>>     void                    *Context);
>>
>> +static void
>> +LdCheckSpecialNames (
>> +    ACPI_NAMESPACE_NODE     *Node,
>> +    ACPI_PARSE_OBJECT       *Op);
>>
>> /*******************************************************************************
>>  *
>> @@ -247,7 +252,8 @@ LdLoadNamespace (
>>  *
>>  * FUNCTION:    LdLoadFieldElements
>>  *
>> - * PARAMETERS:  Op              - Parent node (Field)
>> + * PARAMETERS:  AmlType         - Type to search
>> + *              Op              - Parent node (Field)
>>  *              WalkState       - Current walk state
>>  *
>>  * RETURN:      Status
>> @@ -259,6 +265,7 @@ LdLoadNamespace (
>>
>> static ACPI_STATUS
>> LdLoadFieldElements (
>> +    UINT32                  AmlType,
>>     ACPI_PARSE_OBJECT       *Op,
>>     ACPI_WALK_STATE         *WalkState)
>> {
>> @@ -274,7 +281,7 @@ LdLoadFieldElements (
>>     {
>>         Status = AcpiNsLookup (WalkState->ScopeInfo,
>>             SourceRegion->Asl.Value.String,
>> -            ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
>> +            AmlType, ACPI_IMODE_EXECUTE,
>>             ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
>>         if (Status == AE_NOT_FOUND)
>>         {
>> @@ -507,11 +514,15 @@ LdNamespace1Begin (
>>      */
>>     switch (Op->Asl.AmlOpcode)
>>     {
>> -    case AML_BANK_FIELD_OP:
>>     case AML_INDEX_FIELD_OP:
>> +
>> +        Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState);
>> +        return (Status);
>> +
>> +    case AML_BANK_FIELD_OP:
>>     case AML_FIELD_OP:
>>
>> -        Status = LdLoadFieldElements (Op, WalkState);
>> +        Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState);
>>         return (Status);
>>
>>     case AML_INT_CONNECTION_OP:
>> @@ -966,6 +977,10 @@ LdNamespace1Begin (
>>         }
>>     }
>>
>> +    /* Check special names like _WAK and _PTS */
>> +
>> +    LdCheckSpecialNames (Node, Op);
>> +
>>     if (ForceNewScope)
>>     {
>>         Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
>> @@ -1001,6 +1016,42 @@ FinishNode:
>>     }
>>
>>     return_ACPI_STATUS (Status);
>> +}
>> +
>> +
>> +/*******************************************************************************
>> + *
>> + * FUNCTION:    LdCheckSpecialNames
>> + *
>> + * PARAMETERS:  Node        - Node that represents the named object
>> + *              Op          - Named object declaring this named object
>> + *
>> + * RETURN:      None
>> + *
>> + * DESCRIPTION: Check if certain named objects are declared in the incorrect
>> + *              scope. Special named objects are listed in
>> + *              AslGbl_SpecialNamedObjects and can only be declared at the root
>> + *              scope.
>> + *
>> + ******************************************************************************/
>> +
>> +static void
>> +LdCheckSpecialNames (
>> +    ACPI_NAMESPACE_NODE     *Node,
>> +    ACPI_PARSE_OBJECT       *Op)
>> +{
>> +    UINT32                  i;
>> +
>> +
>> +    for (i = 0; i < MAX_SPECIAL_NAMES; i++)
>> +    {
>> +        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) &&
>> +            Node->Parent != AcpiGbl_RootNode)
>> +        {
>> +            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName);
>> +            return;
>> +        }
>> +    }
>> }
>>
>>
>>
>> Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/compiler/aslmessages.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -365,7 +365,8 @@ const char                      *AslCompilerMsgs [] =
>> /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
>> /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
>> /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
>> -/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */        "Buffer field extends beyond end of target buffer"
>> +/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
>> +/*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal"
>> };
>>
>> /* Table compiler */
>>
>> Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/compiler/aslmessages.h	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -368,6 +368,7 @@ typedef enum
>>     ASL_MSG_TEMPORARY_OBJECT,
>>     ASL_MSG_UNDEFINED_EXTERNAL,
>>     ASL_MSG_BUFFER_FIELD_OVERFLOW,
>> +    ASL_MSG_INVALID_SPECIAL_NAME,
>>
>>     /* These messages are used by the Data Table compiler only */
>>
>>
>> Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/compiler/aslstubs.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/compiler/aslstubs.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -166,12 +166,6 @@
>>  * Things like Events, Global Lock, etc. are not used
>>  * by the compiler, so they are stubbed out here.
>>  */
>> -void
>> -AcpiNsExecModuleCodeList (
>> -    void)
>> -{
>> -}
>> -
>> ACPI_STATUS
>> AcpiNsInitializeObjects (
>>     void)
>>
>> Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/compiler/aslsupport.l	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/compiler/aslsupport.l	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -220,7 +220,7 @@ AslDoLineDirective (
>>
>>     while ((c = input()) != '\n' && c != EOF)
>>     {
>> -        *AslGbl_LineBufPtr = c;
>> +        *AslGbl_LineBufPtr = (char) c;
>>         AslGbl_LineBufPtr++;
>>     }
>>     *AslGbl_LineBufPtr = 0;
>> @@ -498,7 +498,7 @@ AslInsertLineBuffer (
>>
>>         if (AcpiGbl_CaptureComments)
>>         {
>> -            CvProcessCommentState (SourceChar);
>> +            CvProcessCommentState ((char) SourceChar);
>>         }
>>     }
>> }
>> @@ -601,7 +601,7 @@ loop:
>>         AslInsertLineBuffer (c);
>>         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>>         {
>> -            *StringBuffer = c;
>> +            *StringBuffer = (char) c;
>>             ++StringBuffer;
>>         }
>>         c1 = c;
>> @@ -629,7 +629,7 @@ loop:
>>     AslInsertLineBuffer (c);
>>     if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>>     {
>> -        *StringBuffer = c;
>> +        *StringBuffer = (char) c;
>>         ++StringBuffer;
>>     }
>>
>> @@ -720,7 +720,7 @@ AslDoCommentType2 (
>>         AslInsertLineBuffer (c);
>>         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>>         {
>> -            *StringBuffer = c;
>> +            *StringBuffer = (char) c;
>>             ++StringBuffer;
>>         }
>>     }
>> @@ -878,7 +878,7 @@ DoCharacter:
>>                 if (ACPI_IS_OCTAL_DIGIT (StringChar))
>>                 {
>>                     State = ASL_OCTAL_CONSTANT;
>> -                    ConvertBuffer[0] = StringChar;
>> +                    ConvertBuffer[0] = (char) StringChar;
>>                     i = 1;
>>                     continue;
>>                 }
>> @@ -934,7 +934,7 @@ DoCharacter:
>>
>>             /* Append another digit of the constant */
>>
>> -            ConvertBuffer[i] = StringChar;
>> +            ConvertBuffer[i] = (char) StringChar;
>>             i++;
>>             continue;
>>
>> @@ -978,7 +978,7 @@ DoCharacter:
>>
>>             /* Append another digit of the constant */
>>
>> -            ConvertBuffer[i] = StringChar;
>> +            ConvertBuffer[i] = (char) StringChar;
>>             i++;
>>             continue;
>>
>> @@ -989,7 +989,7 @@ DoCharacter:
>>
>>         /* Save the finished character */
>>
>> -        *StringBuffer = StringChar;
>> +        *StringBuffer = (char) StringChar;
>>         StringBuffer++;
>>         if (StringBuffer >= EndBuffer)
>>         {
>>
>> Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -362,7 +362,7 @@ AcpiDsInitializeObjects (
>>     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
>>     {
>>         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
>> -            "\nInitializing Namespace objects:\n"));
>> +            "\nACPI table initialization:\n"));
>>     }
>>
>>     /* Summary of objects initialized */
>>
>> Modified: head/sys/contrib/dev/acpica/components/events/evgpe.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/events/evgpe.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/events/evgpe.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -316,6 +316,7 @@ AcpiEvMaskGpe (
>>  * FUNCTION:    AcpiEvAddGpeReference
>>  *
>>  * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
>> + *              ClearOnEnable           - Clear GPE status before enabling it
>>  *
>>  * RETURN:      Status
>>  *
>> @@ -326,7 +327,8 @@ AcpiEvMaskGpe (
>>
>> ACPI_STATUS
>> AcpiEvAddGpeReference (
>> -    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
>> +    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
>> +    BOOLEAN                 ClearOnEnable)
>> {
>>     ACPI_STATUS             Status = AE_OK;
>>
>> @@ -343,6 +345,11 @@ AcpiEvAddGpeReference (
>>     if (GpeEventInfo->RuntimeCount == 1)
>>     {
>>         /* Enable on first reference */
>> +
>> +        if (ClearOnEnable)
>> +        {
>> +            (void) AcpiHwClearGpe (GpeEventInfo);
>> +        }
>>
>>         Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
>>         if (ACPI_SUCCESS (Status))
>>
>> Modified: head/sys/contrib/dev/acpica/components/events/evgpeblk.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock (
>>                 continue;
>>             }
>>
>> -            Status = AcpiEvAddGpeReference (GpeEventInfo);
>> +            Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>>             if (ACPI_FAILURE (Status))
>>             {
>>                 ACPI_EXCEPTION ((AE_INFO, Status,
>>
>> Modified: head/sys/contrib/dev/acpica/components/events/evxface.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/events/evxface.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/events/evxface.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler (
>>             ACPI_GPE_DISPATCH_NOTIFY)) &&
>>         Handler->OriginallyEnabled)
>>     {
>> -        (void) AcpiEvAddGpeReference (GpeEventInfo);
>> +        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>>         if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>>         {
>>             /* Poll edge triggered GPEs to handle existing events */
>>
>> Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -267,7 +267,7 @@ AcpiEnableGpe (
>>         if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
>>             ACPI_GPE_DISPATCH_NONE)
>>         {
>> -            Status = AcpiEvAddGpeReference (GpeEventInfo);
>> +            Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE);
>>             if (ACPI_SUCCESS (Status) &&
>>                 ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>>             {
>>
>> Modified: head/sys/contrib/dev/acpica/components/executer/exconfig.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/executer/exconfig.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/executer/exconfig.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -342,10 +342,9 @@ AcpiExLoadTableOp (
>>         return_ACPI_STATUS (Status);
>>     }
>>
>> -    /* Complete the initialization/resolution of package objects */
>> +    /* Complete the initialization/resolution of new objects */
>>
>> -    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
>> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
>> +    AcpiNsInitializeObjects ();
>>
>>     /* Parameter Data (optional) */
>>
>> @@ -620,10 +619,11 @@ AcpiExLoadOp (
>>         return_ACPI_STATUS (Status);
>>     }
>>
>> -    /* Complete the initialization/resolution of package objects */
>> +    /* Complete the initialization/resolution of new objects */
>>
>> -    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
>> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
>> +    AcpiExExitInterpreter ();
>> +    AcpiNsInitializeObjects ();
>> +    AcpiExEnterInterpreter ();
>>
>>     /* Store the DdbHandle into the Target operand */
>>
>>
>> Modified: head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -184,6 +184,7 @@ AcpiNsRootInitialize (
>>     ACPI_STATUS                 Status;
>>     const ACPI_PREDEFINED_NAMES *InitVal = NULL;
>>     ACPI_NAMESPACE_NODE         *NewNode;
>> +    ACPI_NAMESPACE_NODE         *PrevNode = NULL;
>>     ACPI_OPERAND_OBJECT         *ObjDesc;
>>     ACPI_STRING                 Val = NULL;
>>
>> @@ -213,13 +214,30 @@ AcpiNsRootInitialize (
>>      */
>>     AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
>>
>> -    /* Enter the pre-defined names in the name table */
>> +    /* Enter the predefined names in the name table */
>>
>>     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>>         "Entering predefined entries into namespace\n"));
>>
>> +    /*
>> +     * Create the initial (default) namespace.
>> +     * This namespace looks like something similar to this:
>> +     *
>> +     *   ACPI Namespace (from Namespace Root):
>> +     *    0  _GPE Scope        00203160 00
>> +     *    0  _PR_ Scope        002031D0 00
>> +     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
>> +     *    0  _SI_ Scope        002032B0 00
>> +     *    0  _TZ_ Device       00203320 00
>> +     *    0  _REV Integer      00203390 00 = 0000000000000002
>> +     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
>> +     *    0  _GL_ Mutex        00203580 00 Object 002035F0
>> +     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
>> +     */
>>     for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
>>     {
>> +        Status = AE_OK;
>> +
>>         /* _OSI is optional for now, will be permanent later */
>>
>>         if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
>> @@ -227,17 +245,35 @@ AcpiNsRootInitialize (
>>             continue;
>>         }
>>
>> -        Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name),
>> -            InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
>> -            NULL, &NewNode);
>> -        if (ACPI_FAILURE (Status))
>> +        /*
>> +         * Create, init, and link the new predefined name
>> +         * Note: No need to use AcpiNsLookup here because all the
>> +         * predefined names are at the root level. It is much easier to
>> +         * just create and link the new node(s) here.
>> +         */
>> +        NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE));
>> +        if (!NewNode)
>>         {
>> -            ACPI_EXCEPTION ((AE_INFO, Status,
>> -                "Could not create predefined name %s",
>> -                InitVal->Name));
>> -            continue;
>> +            Status = AE_NO_MEMORY;
>> +            goto UnlockAndExit;
>>         }
>>
>> +        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
>> +        NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED;
>> +        NewNode->Type = InitVal->Type;
>> +
>> +        if (!PrevNode)
>> +        {
>> +            AcpiGbl_RootNodeStruct.Child = NewNode;
>> +        }
>> +        else
>> +        {
>> +            PrevNode->Peer = NewNode;
>> +        }
>> +
>> +        NewNode->Parent = &AcpiGbl_RootNodeStruct;
>> +        PrevNode = NewNode;
>> +
>>         /*
>>          * Name entered successfully. If entry in PreDefinedNames[] specifies
>>          * an initial value, create the initial value.
>> @@ -286,7 +322,7 @@ AcpiNsRootInitialize (
>>
>>                 NewNode->Value = ObjDesc->Method.ParamCount;
>> #else
>> -                /* Mark this as a very SPECIAL method */
>> +                /* Mark this as a very SPECIAL method (_OSI) */
>>
>>                 ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY;
>>                 ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation;
>> @@ -358,7 +394,6 @@ AcpiNsRootInitialize (
>>             AcpiUtRemoveReference (ObjDesc);
>>         }
>>     }
>> -
>>
>> UnlockAndExit:
>>     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
>>
>> Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/namespace/nseval.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/namespace/nseval.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -160,14 +160,7 @@
>> #define _COMPONENT          ACPI_NAMESPACE
>>         ACPI_MODULE_NAME    ("nseval")
>>
>> -/* Local prototypes */
>>
>> -static void
>> -AcpiNsExecModuleCode (
>> -    ACPI_OPERAND_OBJECT     *MethodObj,
>> -    ACPI_EVALUATE_INFO      *Info);
>> -
>> -
>> /*******************************************************************************
>>  *
>>  * FUNCTION:    AcpiNsEvaluate
>> @@ -464,207 +457,4 @@ Cleanup:
>>     ACPI_FREE (Info->FullPathname);
>>     Info->FullPathname = NULL;
>>     return_ACPI_STATUS (Status);
>> -}
>> -
>> -
>> -/*******************************************************************************
>> - *
>> - * FUNCTION:    AcpiNsExecModuleCodeList
>> - *
>> - * PARAMETERS:  None
>> - *
>> - * RETURN:      None. Exceptions during method execution are ignored, since
>> - *              we cannot abort a table load.
>> - *
>> - * DESCRIPTION: Execute all elements of the global module-level code list.
>> - *              Each element is executed as a single control method.
>> - *
>> - * NOTE: With this option enabled, each block of detected executable AML
>> - * code that is outside of any control method is wrapped with a temporary
>> - * control method object and placed on a global list. The methods on this
>> - * list are executed below.
>> - *
>> - * This function executes the module-level code for all tables only after
>> - * all of the tables have been loaded. It is a legacy option and is
>> - * not compatible with other ACPI implementations. See AcpiNsLoadTable.
>> - *
>> - * This function will be removed when the legacy option is removed.
>> - *
>> - ******************************************************************************/
>> -
>> -void
>> -AcpiNsExecModuleCodeList (
>> -    void)
>> -{
>> -    ACPI_OPERAND_OBJECT     *Prev;
>> -    ACPI_OPERAND_OBJECT     *Next;
>> -    ACPI_EVALUATE_INFO      *Info;
>> -    UINT32                  MethodCount = 0;
>> -
>> -
>> -    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
>> -
>> -
>> -    /* Exit now if the list is empty */
>> -
>> -    Next = AcpiGbl_ModuleCodeList;
>> -    if (!Next)
>> -    {
>> -        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
>> -            "Legacy MLC block list is empty\n"));
>> -
>> -        return_VOID;
>> -    }
>> -
>> -    /* Allocate the evaluation information block */
>> -
>> -    Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
>> -    if (!Info)
>> -    {
>> -        return_VOID;
>> -    }
>> -
>> -    /* Walk the list, executing each "method" */
>> -
>> -    while (Next)
>> -    {
>> -        Prev = Next;
>> -        Next = Next->Method.Mutex;
>> -
>> -        /* Clear the link field and execute the method */
>> -
>> -        Prev->Method.Mutex = NULL;
>> -        AcpiNsExecModuleCode (Prev, Info);
>> -        MethodCount++;
>> -
>> -        /* Delete the (temporary) method object */
>> -
>> -        AcpiUtRemoveReference (Prev);
>> -    }
>> -
>> -    ACPI_INFO ((
>> -        "Executed %u blocks of module-level executable AML code",
>> -        MethodCount));
>> -
>> -    ACPI_FREE (Info);
>> -    AcpiGbl_ModuleCodeList = NULL;
>> -    return_VOID;
>> -}
>> -
>> -
>> -/*******************************************************************************
>> - *
>> - * FUNCTION:    AcpiNsExecModuleCode
>> - *
>> - * PARAMETERS:  MethodObj           - Object container for the module-level code
>> - *              Info                - Info block for method evaluation
>> - *
>> - * RETURN:      None. Exceptions during method execution are ignored, since
>> - *              we cannot abort a table load.
>> - *
>> - * DESCRIPTION: Execute a control method containing a block of module-level
>> - *              executable AML code. The control method is temporarily
>> - *              installed to the root node, then evaluated.
>> - *
>> - ******************************************************************************/
>> -
>> -static void
>> -AcpiNsExecModuleCode (
>> -    ACPI_OPERAND_OBJECT     *MethodObj,
>> -    ACPI_EVALUATE_INFO      *Info)
>> -{
>> -    ACPI_OPERAND_OBJECT     *ParentObj;
>> -    ACPI_NAMESPACE_NODE     *ParentNode;
>> -    ACPI_OBJECT_TYPE        Type;
>> -    ACPI_STATUS             Status;
>> -
>> -
>> -    ACPI_FUNCTION_TRACE (NsExecModuleCode);
>> -
>> -
>> -    /*
>> -     * Get the parent node. We cheat by using the NextObject field
>> -     * of the method object descriptor.
>> -     */
>> -    ParentNode = ACPI_CAST_PTR (
>> -        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
>> -    Type = AcpiNsGetType (ParentNode);
>> -
>> -    /*
>> -     * Get the region handler and save it in the method object. We may need
>> -     * this if an operation region declaration causes a _REG method to be run.
>> -     *
>> -     * We can't do this in AcpiPsLinkModuleCode because
>> -     * AcpiGbl_RootNode->Object is NULL at PASS1.
>> -     */
>> -    if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
>> -    {
>> -        MethodObj->Method.Dispatch.Handler =
>> -            ParentNode->Object->Device.Handler;
>> -    }
>> -
>> -    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
>> -
>> -    MethodObj->Method.NextObject = NULL;
>> -
>> -    /* Initialize the evaluation information block */
>> -
>> -    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
>> -    Info->PrefixNode = ParentNode;
>> -
>> -    /*
>> -     * Get the currently attached parent object. Add a reference,
>> -     * because the ref count will be decreased when the method object
>> -     * is installed to the parent node.
>> -     */
>> -    ParentObj = AcpiNsGetAttachedObject (ParentNode);
>> -    if (ParentObj)
>> -    {
>> -        AcpiUtAddReference (ParentObj);
>> -    }
>> -
>> -    /* Install the method (module-level code) in the parent node */
>> -
>> -    Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD);
>> -    if (ACPI_FAILURE (Status))
>> -    {
>> -        goto Exit;
>> -    }
>> -
>> -    /* Execute the parent node as a control method */
>> -
>> -    Status = AcpiNsEvaluate (Info);
>> -
>> -    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
>> -        "Executed module-level code at %p\n",
>> -        MethodObj->Method.AmlStart));
>> -
>> -    /* Delete a possible implicit return value (in slack mode) */
>> -
>> -    if (Info->ReturnObject)
>> -    {
>> -        AcpiUtRemoveReference (Info->ReturnObject);
>> -    }
>> -
>> -    /* Detach the temporary method object */
>> -
>> -    AcpiNsDetachObject (ParentNode);
>> -
>> -    /* Restore the original parent object */
>> -
>> -    if (ParentObj)
>> -    {
>> -        Status = AcpiNsAttachObject (ParentNode, ParentObj, Type);
>> -    }
>> -    else
>> -    {
>> -        ParentNode->Type = (UINT8) Type;
>> -    }
>> -
>> -Exit:
>> -    if (ParentObj)
>> -    {
>> -        AcpiUtRemoveReference (ParentObj);
>> -    }
>> -    return_VOID;
>> }
>>
>> Modified: head/sys/contrib/dev/acpica/components/namespace/nsinit.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -212,29 +212,30 @@ AcpiNsInitializeObjects (
>>     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>>         "**** Starting initialization of namespace objects ****\n"));
>>     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
>> -        "Completing Region/Field/Buffer/Package initialization:\n"));
>> +        "Final data object initialization: "));
>>
>> -    /* Set all init info to zero */
>> +    /* Clear the info block */
>>
>>     memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
>>
>>     /* Walk entire namespace from the supplied root */
>>
>> +    /*
>> +     * TBD: will become ACPI_TYPE_PACKAGE as this type object
>> +     * is now the only one that supports deferred initialization
>> +     * (forward references).
>> +     */
>>     Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
>> -        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
>> -        &Info, NULL);
>> +        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
>>     if (ACPI_FAILURE (Status))
>>     {
>>         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
>>     }
>>
>>     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
>> -        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
>> -        "Buffers %u/%u Packages (%u nodes)\n",
>> -        Info.OpRegionInit,  Info.OpRegionCount,
>> -        Info.FieldInit,     Info.FieldCount,
>> -        Info.BufferInit,    Info.BufferCount,
>> -        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
>> +        "Namespace contains %u (0x%X) objects\n",
>> +        Info.ObjectCount,
>> +        Info.ObjectCount));
>>
>>     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>>         "%u Control Methods found\n%u Op Regions found\n",
>> @@ -561,35 +562,19 @@ AcpiNsInitOneObject (
>>     AcpiExEnterInterpreter ();
>>
>>     /*
>> -     * Each of these types can contain executable AML code within the
>> -     * declaration.
>> +     * Only initialization of Package objects can be deferred, in order
>> +     * to support forward references.
>>      */
>>     switch (Type)
>>     {
>> -    case ACPI_TYPE_REGION:
>> +    case ACPI_TYPE_LOCAL_BANK_FIELD:
>>
>> -        Info->OpRegionInit++;
>> -        Status = AcpiDsGetRegionArguments (ObjDesc);
>> -        break;
>> +        /* TBD: BankFields do not require deferred init, remove this code */
>>
>> -    case ACPI_TYPE_BUFFER_FIELD:
>> -
>>         Info->FieldInit++;
>> -        Status = AcpiDsGetBufferFieldArguments (ObjDesc);
>> -        break;
>> -
>> -    case ACPI_TYPE_LOCAL_BANK_FIELD:
>> -
>> -        Info->FieldInit++;
>>         Status = AcpiDsGetBankFieldArguments (ObjDesc);
>>         break;
>>
>> -    case ACPI_TYPE_BUFFER:
>> -
>> -        Info->BufferInit++;
>> -        Status = AcpiDsGetBufferArguments (ObjDesc);
>> -        break;
>> -
>>     case ACPI_TYPE_PACKAGE:
>>
>>         /* Complete the initialization/resolution of the package object */
>> @@ -600,8 +585,12 @@ AcpiNsInitOneObject (
>>
>>     default:
>>
>> -        /* No other types can get here */
>> +        /* No other types should get here */
>>
>> +        Status = AE_TYPE;
>> +        ACPI_EXCEPTION ((AE_INFO, Status,
>> +            "Opcode is not deferred [%4.4s] (%s)",
>> +            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
>>         break;
>>     }
>>
>>
>> Modified: head/sys/contrib/dev/acpica/components/namespace/nsload.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/namespace/nsload.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/namespace/nsload.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -268,18 +268,6 @@ Unlock:
>>     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>>         "**** Completed Table Object Initialization\n"));
>>
>> -    /*
>> -     * This case handles the legacy option that groups all module-level
>> -     * code blocks together and defers execution until all of the tables
>> -     * are loaded. Execute all of these blocks at this time.
>> -     * Execute any module-level code that was detected during the table
>> -     * load phase.
>> -     *
>> -     * Note: this option is deprecated and will be eliminated in the
>> -     * future. Use of this option can cause problems with AML code that
>> -     * depends upon in-order immediate execution of module-level code.
>> -     */
>> -    AcpiNsExecModuleCodeList ();
>>     return_ACPI_STATUS (Status);
>> }
>>
>>
>> Modified: head/sys/contrib/dev/acpica/components/namespace/nsutils.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/namespace/nsutils.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/namespace/nsutils.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -802,23 +802,10 @@ AcpiNsTerminate (
>>     void)
>> {
>>     ACPI_STATUS             Status;
>> -    ACPI_OPERAND_OBJECT     *Prev;
>> -    ACPI_OPERAND_OBJECT     *Next;
>>
>>
>>     ACPI_FUNCTION_TRACE (NsTerminate);
>>
>> -
>> -    /* Delete any module-level code blocks */
>> -
>> -    Next = AcpiGbl_ModuleCodeList;
>> -    while (Next)
>> -    {
>> -        Prev = Next;
>> -        Next = Next->Method.Mutex;
>> -        Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
>> -        AcpiUtRemoveReference (Prev);
>> -    }
>>
>>     /*
>>      * Free the entire namespace -- all nodes and all objects
>>
>> Modified: head/sys/contrib/dev/acpica/components/tables/tbdata.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/tables/tbdata.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/tables/tbdata.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -1191,19 +1191,6 @@ AcpiTbLoadTable (
>>     Status = AcpiNsLoadTable (TableIndex, ParentNode);
>>
>>     /*
>> -     * This case handles the legacy option that groups all module-level
>> -     * code blocks together and defers execution until all of the tables
>> -     * are loaded. Execute all of these blocks at this time.
>> -     * Execute any module-level code that was detected during the table
>> -     * load phase.
>> -     *
>> -     * Note: this option is deprecated and will be eliminated in the
>> -     * future. Use of this option can cause problems with AML code that
>> -     * depends upon in-order immediate execution of module-level code.
>> -     */
>> -    AcpiNsExecModuleCodeList ();
>> -
>> -    /*
>>      * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
>>      * responsible for discovering any new wake GPEs by running _PRW methods
>>      * that may have been loaded by this table.
>>
>> Modified: head/sys/contrib/dev/acpica/components/tables/tbxfload.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -479,6 +479,13 @@ AcpiLoadTable (
>>     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
>>     Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
>>         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
>> +    if (ACPI_SUCCESS (Status))
>> +    {
>> +        /* Complete the initialization/resolution of new objects */
>> +
>> +        AcpiNsInitializeObjects ();
>> +    }
>> +
>>     return_ACPI_STATUS (Status);
>> }
>>
>>
>> Modified: head/sys/contrib/dev/acpica/components/utilities/utinit.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/utilities/utinit.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/utilities/utinit.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -342,7 +342,6 @@ AcpiUtInitGlobals (
>>
>>     /* Namespace */
>>
>> -    AcpiGbl_ModuleCodeList              = NULL;
>>     AcpiGbl_RootNode                    = NULL;
>>     AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
>>     AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
>>
>> Modified: head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
>> ==============================================================================
>> --- head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	Tue Jul  9 17:18:24 2019	(r349862)
>> +++ head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	Tue Jul  9 18:02:36 2019	(r349863)
>> @@ -381,24 +381,17 @@ AcpiInitializeObjects (
>>     ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
>>
>>
>> +#ifdef ACPI_OBSOLETE_BEHAVIOR
>>     /*
>> -     * This case handles the legacy option that groups all module-level
>> -     * code blocks together and defers execution until all of the tables
>> -     * are loaded. Execute all of these blocks at this time.
>> -     * Execute any module-level code that was detected during the table
>> -     * load phase.
>> -     *
>> -     * Note: this option is deprecated and will be eliminated in the
>> -     * future. Use of this option can cause problems with AML code that
>> -     * depends upon in-order immediate execution of module-level code.
>> +     * 05/2019: Removed, initialization now happens at both object
>> +     * creation and table load time
>>      */
>> -    AcpiNsExecModuleCodeList ();
>>
>>     /*
>>      * Initialize the objects that remain uninitialized. This
>>      * runs the executable AML that may be part of the
>> -     * declaration of these objects:
>>
>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
>>
> 
> 

-- 
Alexander Motin

From owner-svn-src-head@freebsd.org  Thu Aug  1 14:13:05 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8914CBF018;
 Thu,  1 Aug 2019 14:13:05 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zshK1yTkz3Cl9;
 Thu,  1 Aug 2019 14:13:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25EFF1B7A5;
 Thu,  1 Aug 2019 14:13:05 +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 x71ED57a029277;
 Thu, 1 Aug 2019 14:13:05 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71ED5Ma029276;
 Thu, 1 Aug 2019 14:13:05 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011413.x71ED5Ma029276@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 14:13:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350500 - head/sys/conf
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/sys/conf
X-SVN-Commit-Revision: 350500
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zshK1yTkz3Cl9
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.18 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.303,0];
 NEURAL_SPAM_SHORT(0.12)[0.122,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:13:05 -0000

Author: emaste
Date: Thu Aug  1 14:13:04 2019
New Revision: 350500
URL: https://svnweb.freebsd.org/changeset/base/350500

Log:
  newvers: append commit count to uname version string
  
  In a git world this provides a facsimile of a monotonically increasing
  version number.  This might be refined further, but this provides a
  starting point for investigation.
  
  Reviewed by:	cem
  Relnotes:	Yes
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20462

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Thu Aug  1 14:02:59 2019	(r350499)
+++ head/sys/conf/newvers.sh	Thu Aug  1 14:13:04 2019	(r350500)
@@ -291,6 +291,10 @@ if [ -n "$git_cmd" ] ; then
 			git=" ${git}"
 		fi
 	fi
+	git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null)
+	if [ -n "$git_cnt" ] ; then
+		git="${git}-c${git_cnt}"
+	fi
 	git_b=$($git_cmd rev-parse --abbrev-ref HEAD)
 	if [ -n "$git_b" ] ; then
 		git="${git}(${git_b})"

From owner-svn-src-head@freebsd.org  Thu Aug  1 14:17:34 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC456BF147;
 Thu,  1 Aug 2019 14:17:34 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zsnV5MjQz3D0G;
 Thu,  1 Aug 2019 14:17:34 +0000 (UTC) (envelope-from rrs@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 950521B7AB;
 Thu,  1 Aug 2019 14:17:34 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71EHYhj029530;
 Thu, 1 Aug 2019 14:17:34 GMT (envelope-from rrs@FreeBSD.org)
Received: (from rrs@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71EHW0j029518;
 Thu, 1 Aug 2019 14:17:32 GMT (envelope-from rrs@FreeBSD.org)
Message-Id: <201908011417.x71EHW0j029518@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org
 using -f
From: Randall Stewart <rrs@FreeBSD.org>
Date: Thu, 1 Aug 2019 14:17:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350501 - in head/sys: conf dev/cxgbe dev/mlx5/mlx5_en
 net netinet
X-SVN-Group: head
X-SVN-Commit-Author: rrs
X-SVN-Commit-Paths: in head/sys: conf dev/cxgbe dev/mlx5/mlx5_en net netinet
X-SVN-Commit-Revision: 350501
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zsnV5MjQz3D0G
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.15 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.28)[-0.277,0];
 NEURAL_SPAM_SHORT(0.13)[0.128,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:17:34 -0000

Author: rrs
Date: Thu Aug  1 14:17:31 2019
New Revision: 350501
URL: https://svnweb.freebsd.org/changeset/base/350501

Log:
  This adds the third step in getting BBR into the tree. BBR and
  an updated rack depend on having access to the new
  ratelimit api in this commit.
  
  Sponsored by:	Netflix Inc.
  Differential Revision:	https://reviews.freebsd.org/D20953

Added:
  head/sys/netinet/tcp_ratelimit.c   (contents, props changed)
  head/sys/netinet/tcp_ratelimit.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sched.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/net/if_dead.c
  head/sys/net/if_lagg.c
  head/sys/net/if_var.h
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/conf/files	Thu Aug  1 14:17:31 2019	(r350501)
@@ -4276,6 +4276,7 @@ netinet/tcp_lro.c		optional inet | inet6
 netinet/tcp_output.c		optional inet | inet6
 netinet/tcp_offload.c		optional tcp_offload inet | tcp_offload inet6
 netinet/tcp_hpts.c              optional tcphpts inet | tcphpts inet6
+netinet/tcp_ratelimit.c         optional ratelimit inet | ratelimit inet6
 netinet/tcp_pcap.c		optional inet tcppcap | inet6 tcppcap \
 	compile-with "${NORMAL_C} ${NO_WNONNULL}"
 netinet/tcp_reass.c		optional inet | inet6

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/dev/cxgbe/adapter.h	Thu Aug  1 14:17:31 2019	(r350501)
@@ -1247,6 +1247,7 @@ int cxgbe_snd_tag_modify(struct m_snd_tag *, union if_
 int cxgbe_snd_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *);
 void cxgbe_snd_tag_free(struct m_snd_tag *);
 void cxgbe_snd_tag_free_locked(struct cxgbe_snd_tag *);
+void cxgbe_ratelimit_query(struct ifnet *, struct if_ratelimit_query_results *);
 #endif
 
 /* t4_filter.c */

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/dev/cxgbe/t4_main.c	Thu Aug  1 14:17:31 2019	(r350501)
@@ -1658,6 +1658,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi)
 	ifp->if_snd_tag_modify = cxgbe_snd_tag_modify;
 	ifp->if_snd_tag_query = cxgbe_snd_tag_query;
 	ifp->if_snd_tag_free = cxgbe_snd_tag_free;
+	ifp->if_ratelimit_query = cxgbe_ratelimit_query;
 #endif
 
 	ifp->if_capabilities = T4_CAP;

Modified: head/sys/dev/cxgbe/t4_sched.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sched.c	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/dev/cxgbe/t4_sched.c	Thu Aug  1 14:17:31 2019	(r350501)
@@ -903,4 +903,35 @@ cxgbe_snd_tag_free(struct m_snd_tag *mst)
 	}
 	mtx_unlock(&cst->lock);
 }
+
+#define CXGBE_MAX_FLOWS 4000	/* Testing show so far thats all this adapter can do */
+#define CXGBE_UNIQUE_RATE_COUNT 16 /* Number of unique rates that can be setup */
+
+void
+cxgbe_ratelimit_query(struct ifnet *ifp __unused,
+     struct if_ratelimit_query_results *q)
+{
+	/*
+	 * This is a skeleton and needs future work
+	 * by the driver supporters. It should be
+	 * enhanced to look at the specific type of
+	 * interface and select approprate values
+	 * for these settings. This example goes
+	 * with an earlier card (t5), it has a maximum
+	 * number of 16 rates that the first guys in
+	 * select (thus the flags value RT_IS_SELECTABLE).
+	 * If it was a fixed table then we would setup a
+	 * const array (example mlx5). Note the card tested
+	 * can only support reasonably 4000 flows before
+	 * the adapter has issues with sending so here 
+	 * we limit the number of flows using hardware
+	 * pacing to that number, other cards may
+	 * be able to raise or eliminate this limit.
+	 */
+	q->rate_table = NULL;
+	q->flags = RT_IS_SELECTABLE;
+	q->max_flows = CXGBE_MAX_FLOWS;
+	q->number_of_rates = CXGBE_UNIQUE_RATE_COUNT;
+	q->min_segment_burst = 4;	/* Driver emits 4 in a burst */
+}
 #endif

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu Aug  1 14:17:31 2019	(r350501)
@@ -4070,7 +4070,49 @@ mlx5e_snd_tag_query(struct m_snd_tag *pmt, union if_sn
 	}
 }
 
+#define NUM_HDWR_RATES_MLX 13
+static const uint64_t adapter_rates_mlx[NUM_HDWR_RATES_MLX] = {
+	135375,			/* 1,083,000 */
+	180500,			/* 1,444,000 */
+	270750,			/* 2,166,000 */
+	361000,			/* 2,888,000 */
+	541500,			/* 4,332,000 */
+	721875,			/* 5,775,000 */
+	1082875,		/* 8,663,000 */
+	1443875,		/* 11,551,000 */
+	2165750,		/* 17,326,000 */
+	2887750,		/* 23,102,000 */
+	4331625,		/* 34,653,000 */
+	5775500,		/* 46,204,000 */
+	8663125			/* 69,305,000 */
+};
+
 static void
+mlx5e_ratelimit_query(struct ifnet *ifp __unused, struct if_ratelimit_query_results *q)
+{
+	/*
+	 * This function needs updating by the driver maintainer!
+	 * For the MLX card there are currently (ConectX-4?) 13 
+	 * pre-set rates and others i.e. ConnectX-5, 6, 7??
+	 *
+	 * This will change based on later adapters
+	 * and this code should be updated to look at ifp
+	 * and figure out the specific adapter type
+	 * settings i.e. how many rates as well
+	 * as if they are fixed (as is shown here) or
+	 * if they are dynamic (example chelsio t4). Also if there
+	 * is a maximum number of flows that the adapter
+	 * can handle that too needs to be updated in
+	 * the max_flows field.
+	 */
+	q->rate_table = adapter_rates_mlx;
+	q->flags = RT_IS_FIXED_TABLE;
+	q->max_flows = 0;	/* mlx has no limit */
+	q->number_of_rates = NUM_HDWR_RATES_MLX;
+	q->min_segment_burst = 1;
+}
+
+static void
 mlx5e_snd_tag_free(struct m_snd_tag *pmt)
 {
 	struct mlx5e_snd_tag *tag =
@@ -4155,7 +4197,9 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
 	ifp->if_snd_tag_free = mlx5e_snd_tag_free;
 	ifp->if_snd_tag_modify = mlx5e_snd_tag_modify;
 	ifp->if_snd_tag_query = mlx5e_snd_tag_query;
-
+#ifdef RATELIMIT
+	ifp->if_ratelimit_query = mlx5e_ratelimit_query;
+#endif
 	/* set TSO limits so that we don't have to drop TX packets */
 	ifp->if_hw_tsomax = MLX5E_MAX_TX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN);
 	ifp->if_hw_tsomaxsegcount = MLX5E_MAX_TX_MBUF_FRAGS - 1 /* hdr */;

Modified: head/sys/net/if_dead.c
==============================================================================
--- head/sys/net/if_dead.c	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/net/if_dead.c	Thu Aug  1 14:17:31 2019	(r350501)
@@ -126,6 +126,23 @@ ifdead_snd_tag_free(struct m_snd_tag *pmt)
 {
 }
 
+static void
+ifdead_ratelimit_query(struct ifnet *ifp __unused,
+      struct if_ratelimit_query_results *q)
+{
+	/*
+	 * This guy does not support
+	 * this interface. Not sure
+	 * why we would specify a
+	 * flag on the interface
+	 * that says we do.
+	 */
+	q->rate_table = NULL;
+	q->flags = RT_NOSUPPORT;
+	q->max_flows = 0;
+	q->number_of_rates = 0;
+}
+
 void
 if_dead(struct ifnet *ifp)
 {
@@ -142,4 +159,5 @@ if_dead(struct ifnet *ifp)
 	ifp->if_snd_tag_modify = ifdead_snd_tag_modify;
 	ifp->if_snd_tag_query = ifdead_snd_tag_query;
 	ifp->if_snd_tag_free = ifdead_snd_tag_free;
+	ifp->if_ratelimit_query = ifdead_ratelimit_query;
 }

Modified: head/sys/net/if_lagg.c
==============================================================================
--- head/sys/net/if_lagg.c	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/net/if_lagg.c	Thu Aug  1 14:17:31 2019	(r350501)
@@ -144,6 +144,8 @@ static int	lagg_snd_tag_modify(struct m_snd_tag *,
 static int	lagg_snd_tag_query(struct m_snd_tag *,
 		    union if_snd_tag_query_params *);
 static void	lagg_snd_tag_free(struct m_snd_tag *);
+static void     lagg_ratelimit_query(struct ifnet *,
+		    struct if_ratelimit_query_results *);
 #endif
 static int	lagg_setmulti(struct lagg_port *);
 static int	lagg_clrmulti(struct lagg_port *);
@@ -537,6 +539,7 @@ lagg_clone_create(struct if_clone *ifc, int unit, cadd
 	ifp->if_snd_tag_modify = lagg_snd_tag_modify;
 	ifp->if_snd_tag_query = lagg_snd_tag_query;
 	ifp->if_snd_tag_free = lagg_snd_tag_free;
+	ifp->if_ratelimit_query = lagg_ratelimit_query;
 #endif
 	ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS;
 
@@ -1670,6 +1673,20 @@ lagg_snd_tag_free(struct m_snd_tag *mst)
 	free(lst, M_LAGG);
 }
 
+static void
+lagg_ratelimit_query(struct ifnet *ifp __unused, struct if_ratelimit_query_results *q)
+{
+	/*
+	 * For lagg, we have an indirect
+	 * interface. The caller needs to
+	 * get a ratelimit tag on the actual
+	 * interface the flow will go on.
+	 */
+	q->rate_table = NULL;
+	q->flags = RT_IS_INDIRECT;
+	q->max_flows = 0;
+	q->number_of_rates = 0;
+}
 #endif
 
 static int

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/net/if_var.h	Thu Aug  1 14:17:31 2019	(r350501)
@@ -203,6 +203,8 @@ struct if_snd_tag_alloc_header {
 struct if_snd_tag_alloc_rate_limit {
 	struct if_snd_tag_alloc_header hdr;
 	uint64_t max_rate;	/* in bytes/s */
+	uint32_t flags;		/* M_NOWAIT or M_WAITOK */
+	uint32_t reserved;	/* alignment */
 };
 
 struct if_snd_tag_rate_limit_params {
@@ -210,7 +212,7 @@ struct if_snd_tag_rate_limit_params {
 	uint32_t queue_level;	/* 0 (empty) .. 65535 (full) */
 #define	IF_SND_QUEUE_LEVEL_MIN 0
 #define	IF_SND_QUEUE_LEVEL_MAX 65535
-	uint32_t reserved;	/* padding */
+	uint32_t flags;		/* M_NOWAIT or M_WAITOK */
 };
 
 union if_snd_tag_alloc_params {
@@ -229,12 +231,38 @@ union if_snd_tag_query_params {
 	struct if_snd_tag_rate_limit_params unlimited;
 };
 
+/* Query return flags */
+#define RT_NOSUPPORT	  0x00000000	/* Not supported */
+#define RT_IS_INDIRECT    0x00000001	/*
+					 * Interface like a lagg, select
+					 * the actual interface for
+					 * capabilities.
+					 */
+#define RT_IS_SELECTABLE  0x00000002	/*
+					 * No rate table, you select
+					 * rates and the first
+					 * number_of_rates are created.
+					 */
+#define RT_IS_FIXED_TABLE 0x00000004	/* A fixed table is attached */
+#define RT_IS_UNUSABLE	  0x00000008	/* It is not usable for this */
+
+struct if_ratelimit_query_results {
+	const uint64_t *rate_table;	/* Pointer to table if present */
+	uint32_t flags;			/* Flags indicating results */
+	uint32_t max_flows;		/* Max flows using, 0=unlimited */
+	uint32_t number_of_rates;	/* How many unique rates can be created */
+	uint32_t min_segment_burst;	/* The amount the adapter bursts at each send */
+};
+
 typedef int (if_snd_tag_alloc_t)(struct ifnet *, union if_snd_tag_alloc_params *,
     struct m_snd_tag **);
 typedef int (if_snd_tag_modify_t)(struct m_snd_tag *, union if_snd_tag_modify_params *);
 typedef int (if_snd_tag_query_t)(struct m_snd_tag *, union if_snd_tag_query_params *);
 typedef void (if_snd_tag_free_t)(struct m_snd_tag *);
+typedef void (if_ratelimit_query_t)(struct ifnet *,
+    struct if_ratelimit_query_results *);
 
+
 /*
  * Structure defining a network interface.
  */
@@ -374,6 +402,7 @@ struct ifnet {
 	if_snd_tag_modify_t *if_snd_tag_modify;
 	if_snd_tag_query_t *if_snd_tag_query;
 	if_snd_tag_free_t *if_snd_tag_free;
+	if_ratelimit_query_t *if_ratelimit_query;
 
 	/* Ethernet PCP */
 	uint8_t if_pcp;

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/netinet/in_pcb.c	Thu Aug  1 14:17:31 2019	(r350501)
@@ -210,6 +210,22 @@ SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomtim
 	&VNET_NAME(ipport_randomtime), 0,
 	"Minimum time to keep sequental port "
 	"allocation before switching to a random one");
+
+#ifdef RATELIMIT
+counter_u64_t rate_limit_active;
+counter_u64_t rate_limit_alloc_fail;
+counter_u64_t rate_limit_set_ok;
+
+static SYSCTL_NODE(_net_inet_ip, OID_AUTO, rl, CTLFLAG_RD, 0,
+    "IP Rate Limiting");
+SYSCTL_COUNTER_U64(_net_inet_ip_rl, OID_AUTO, active, CTLFLAG_RD,
+    &rate_limit_active, "Active rate limited connections");
+SYSCTL_COUNTER_U64(_net_inet_ip_rl, OID_AUTO, alloc_fail, CTLFLAG_RD,
+   &rate_limit_alloc_fail, "Rate limited connection failures");
+SYSCTL_COUNTER_U64(_net_inet_ip_rl, OID_AUTO, set_ok, CTLFLAG_RD,
+   &rate_limit_set_ok, "Rate limited setting succeeded");
+#endif /* RATELIMIT */
+
 #endif /* INET */
 
 /*
@@ -3170,6 +3186,7 @@ in_pcbmodify_txrtlmt(struct inpcb *inp, uint32_t max_p
 {
 	union if_snd_tag_modify_params params = {
 		.rate_limit.max_rate = max_pacing_rate,
+		.rate_limit.flags = M_NOWAIT,
 	};
 	struct m_snd_tag *mst;
 	struct ifnet *ifp;
@@ -3256,7 +3273,8 @@ in_pcbquery_txrlevel(struct inpcb *inp, uint32_t *p_tx
  */
 int
 in_pcbattach_txrtlmt(struct inpcb *inp, struct ifnet *ifp,
-    uint32_t flowtype, uint32_t flowid, uint32_t max_pacing_rate)
+    uint32_t flowtype, uint32_t flowid, uint32_t max_pacing_rate, struct m_snd_tag **st)
+
 {
 	union if_snd_tag_alloc_params params = {
 		.rate_limit.hdr.type = (max_pacing_rate == -1U) ?
@@ -3264,22 +3282,47 @@ in_pcbattach_txrtlmt(struct inpcb *inp, struct ifnet *
 		.rate_limit.hdr.flowid = flowid,
 		.rate_limit.hdr.flowtype = flowtype,
 		.rate_limit.max_rate = max_pacing_rate,
+		.rate_limit.flags = M_NOWAIT,
 	};
 	int error;
 
 	INP_WLOCK_ASSERT(inp);
 
-	if (inp->inp_snd_tag != NULL)
+	if (*st != NULL)
 		return (EINVAL);
 
 	if (ifp->if_snd_tag_alloc == NULL) {
 		error = EOPNOTSUPP;
 	} else {
 		error = ifp->if_snd_tag_alloc(ifp, &params, &inp->inp_snd_tag);
+
+		if (error == 0) {
+			counter_u64_add(rate_limit_set_ok, 1);
+			counter_u64_add(rate_limit_active, 1);
+		} else
+			counter_u64_add(rate_limit_alloc_fail, 1);
 	}
 	return (error);
 }
 
+void
+in_pcbdetach_tag(struct ifnet *ifp, struct m_snd_tag *mst)
+{
+	if (ifp == NULL)
+		return;
+
+	/*
+	 * If the device was detached while we still had reference(s)
+	 * on the ifp, we assume if_snd_tag_free() was replaced with
+	 * stubs.
+	 */
+	ifp->if_snd_tag_free(mst);
+
+	/* release reference count on network interface */
+	if_rele(ifp);
+	counter_u64_add(rate_limit_active, -1);
+}
+
 /*
  * Free an existing TX rate limit tag based on the "inp->inp_snd_tag",
  * if any:
@@ -3300,49 +3343,12 @@ in_pcbdetach_txrtlmt(struct inpcb *inp)
 	m_snd_tag_rele(mst);
 }
 
-/*
- * This function should be called when the INP_RATE_LIMIT_CHANGED flag
- * is set in the fast path and will attach/detach/modify the TX rate
- * limit send tag based on the socket's so_max_pacing_rate value.
- */
-void
-in_pcboutput_txrtlmt(struct inpcb *inp, struct ifnet *ifp, struct mbuf *mb)
+int
+in_pcboutput_txrtlmt_locked(struct inpcb *inp, struct ifnet *ifp, struct mbuf *mb, uint32_t max_pacing_rate)
 {
-	struct socket *socket;
-	uint32_t max_pacing_rate;
-	bool did_upgrade;
 	int error;
 
-	if (inp == NULL)
-		return;
-
-	socket = inp->inp_socket;
-	if (socket == NULL)
-		return;
-
-	if (!INP_WLOCKED(inp)) {
-		/*
-		 * NOTE: If the write locking fails, we need to bail
-		 * out and use the non-ratelimited ring for the
-		 * transmit until there is a new chance to get the
-		 * write lock.
-		 */
-		if (!INP_TRY_UPGRADE(inp))
-			return;
-		did_upgrade = 1;
-	} else {
-		did_upgrade = 0;
-	}
-
 	/*
-	 * NOTE: The so_max_pacing_rate value is read unlocked,
-	 * because atomic updates are not required since the variable
-	 * is checked at every mbuf we send. It is assumed that the
-	 * variable read itself will be atomic.
-	 */
-	max_pacing_rate = socket->so_max_pacing_rate;
-
-	/*
 	 * If the existing send tag is for the wrong interface due to
 	 * a route change, first drop the existing tag.  Set the
 	 * CHANGED flag so that we will keep trying to allocate a new
@@ -3376,13 +3382,61 @@ in_pcboutput_txrtlmt(struct inpcb *inp, struct ifnet *
 			error = EAGAIN;
 		} else {
 			error = in_pcbattach_txrtlmt(inp, ifp, M_HASHTYPE_GET(mb),
-			    mb->m_pkthdr.flowid, max_pacing_rate);
+			    mb->m_pkthdr.flowid, max_pacing_rate, &inp->inp_snd_tag);
 		}
 	} else {
 		error = in_pcbmodify_txrtlmt(inp, max_pacing_rate);
 	}
 	if (error == 0 || error == EOPNOTSUPP)
 		inp->inp_flags2 &= ~INP_RATE_LIMIT_CHANGED;
+
+	return (error);
+}
+
+/*
+ * This function should be called when the INP_RATE_LIMIT_CHANGED flag
+ * is set in the fast path and will attach/detach/modify the TX rate
+ * limit send tag based on the socket's so_max_pacing_rate value.
+ */
+void
+in_pcboutput_txrtlmt(struct inpcb *inp, struct ifnet *ifp, struct mbuf *mb)
+{
+	struct socket *socket;
+	uint32_t max_pacing_rate;
+	bool did_upgrade;
+	int error;
+
+	if (inp == NULL)
+		return;
+
+	socket = inp->inp_socket;
+	if (socket == NULL)
+		return;
+
+	if (!INP_WLOCKED(inp)) {
+		/*
+		 * NOTE: If the write locking fails, we need to bail
+		 * out and use the non-ratelimited ring for the
+		 * transmit until there is a new chance to get the
+		 * write lock.
+		 */
+		if (!INP_TRY_UPGRADE(inp))
+			return;
+		did_upgrade = 1;
+	} else {
+		did_upgrade = 0;
+	}
+
+	/*
+	 * NOTE: The so_max_pacing_rate value is read unlocked,
+	 * because atomic updates are not required since the variable
+	 * is checked at every mbuf we send. It is assumed that the
+	 * variable read itself will be atomic.
+	 */
+	max_pacing_rate = socket->so_max_pacing_rate;
+
+	error = in_pcboutput_txrtlmt_locked(inp, ifp, mb, max_pacing_rate);
+
 	if (did_upgrade)
 		INP_DOWNGRADE(inp);
 }
@@ -3424,4 +3478,14 @@ in_pcboutput_eagain(struct inpcb *inp)
 	if (did_upgrade)
 		INP_DOWNGRADE(inp);
 }
+
+static void
+rl_init(void *st)
+{
+	rate_limit_active = counter_u64_alloc(M_WAITOK);
+	rate_limit_alloc_fail = counter_u64_alloc(M_WAITOK);
+	rate_limit_set_ok = counter_u64_alloc(M_WAITOK);
+}
+
+SYSINIT(rl, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, rl_init, NULL);
 #endif /* RATELIMIT */

Modified: head/sys/netinet/in_pcb.h
==============================================================================
--- head/sys/netinet/in_pcb.h	Thu Aug  1 14:13:04 2019	(r350500)
+++ head/sys/netinet/in_pcb.h	Thu Aug  1 14:17:31 2019	(r350501)
@@ -883,8 +883,13 @@ struct sockaddr *
 	in_sockaddr(in_port_t port, struct in_addr *addr);
 void	in_pcbsosetlabel(struct socket *so);
 #ifdef RATELIMIT
-int	in_pcbattach_txrtlmt(struct inpcb *, struct ifnet *, uint32_t, uint32_t, uint32_t);
+int
+in_pcboutput_txrtlmt_locked(struct inpcb *, struct ifnet *,
+	    struct mbuf *, uint32_t);
+int	in_pcbattach_txrtlmt(struct inpcb *, struct ifnet *, uint32_t, uint32_t,
+	    uint32_t, struct m_snd_tag **);
 void	in_pcbdetach_txrtlmt(struct inpcb *);
+void    in_pcbdetach_tag(struct ifnet *ifp, struct m_snd_tag *mst);
 int	in_pcbmodify_txrtlmt(struct inpcb *, uint32_t);
 int	in_pcbquery_txrtlmt(struct inpcb *, uint32_t *);
 int	in_pcbquery_txrlevel(struct inpcb *, uint32_t *);

Added: head/sys/netinet/tcp_ratelimit.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netinet/tcp_ratelimit.c	Thu Aug  1 14:17:31 2019	(r350501)
@@ -0,0 +1,1234 @@
+/*-
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 2018-2019
+ *	Netflix Inc.
+ *      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+/**
+ * Author: Randall Stewart <rrs@netflix.com>
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include "opt_inet.h"
+#include "opt_inet6.h"
+#include "opt_ipsec.h"
+#include "opt_tcpdebug.h"
+#include "opt_ratelimit.h"
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#ifdef KERN_TLS
+#include <sys/sockbuf_tls.h>
+#endif
+#include <sys/sysctl.h>
+#include <sys/eventhandler.h>
+#include <sys/mutex.h>
+#include <sys/ck.h>
+#define TCPSTATES		/* for logging */
+#include <netinet/in.h>
+#include <netinet/in_pcb.h>
+#include <netinet/tcp_var.h>
+#ifdef INET6
+#include <netinet6/tcp6_var.h>
+#endif
+#include <netinet/tcp_ratelimit.h>
+#ifndef USECS_IN_SECOND
+#define USECS_IN_SECOND 1000000
+#endif
+/*
+ * For the purposes of each send, what is the size
+ * of an ethernet frame.
+ */
+#ifndef ETHERNET_SEGMENT_SIZE
+#define ETHERNET_SEGMENT_SIZE 1500
+#endif
+MALLOC_DEFINE(M_TCPPACE, "tcp_hwpace", "TCP Hardware pacing memory");
+#ifdef RATELIMIT
+
+#define COMMON_RATE 180500
+uint64_t desired_rates[] = {
+	62500,			/* 500Kbps */
+	180500,			/* 1.44Mpbs */
+	375000,			/* 3Mbps */
+	500000,			/* 4Mbps */
+	625000,			/* 5Mbps */
+	750000,			/* 6Mbps */
+	1000000,		/* 8Mbps */
+	1250000,		/* 10Mbps */
+	2500000,		/* 20Mbps */
+	3750000,		/* 30Mbps */
+	5000000,		/* 40Meg */
+	6250000,		/* 50Mbps */
+	12500000,		/* 100Mbps */
+	25000000,		/* 200Mbps */
+	50000000,		/* 400Mbps */
+	100000000,		/* 800Mbps */
+	12500,			/* 100kbps */
+	25000,			/* 200kbps */
+	875000,			/* 7Mbps */
+	1125000,		/* 9Mbps */
+	1875000,		/* 15Mbps */
+	3125000,		/* 25Mbps */
+	8125000,		/* 65Mbps */
+	10000000,		/* 80Mbps */
+	18750000,		/* 150Mbps */
+	20000000,		/* 250Mbps */
+	37500000,		/* 350Mbps */
+	62500000,		/* 500Mbps */
+	78125000,		/* 625Mbps */
+	125000000,		/* 1Gbps */
+};
+#define MAX_HDWR_RATES (sizeof(desired_rates)/sizeof(uint64_t))
+#define RS_ORDERED_COUNT 16	/*
+				 * Number that are in order
+				 * at the beginning of the table,
+				 * over this a sort is required.
+				 */
+#define RS_NEXT_ORDER_GROUP 16	/*
+				 * The point in our table where
+				 * we come fill in a second ordered
+				 * group (index wise means -1).
+				 */
+#define ALL_HARDWARE_RATES 1004 /*
+				 * 1Meg - 1Gig in 1 Meg steps
+				 * plus 100, 200k  and 500k and
+				 * 10Gig
+				 */
+
+#define RS_ONE_MEGABIT_PERSEC 1000000
+#define RS_ONE_GIGABIT_PERSEC 1000000000
+#define RS_TEN_GIGABIT_PERSEC 10000000000
+
+static struct head_tcp_rate_set int_rs;
+static struct mtx rs_mtx;
+uint32_t rs_number_alive;
+uint32_t rs_number_dead;
+
+SYSCTL_NODE(_net_inet_tcp, OID_AUTO, rl, CTLFLAG_RW, 0,
+    "TCP Ratelimit stats");
+SYSCTL_UINT(_net_inet_tcp_rl, OID_AUTO, alive, CTLFLAG_RW,
+    &rs_number_alive, 0,
+    "Number of interfaces initialized for ratelimiting");
+SYSCTL_UINT(_net_inet_tcp_rl, OID_AUTO, dead, CTLFLAG_RW,
+    &rs_number_dead, 0,
+    "Number of interfaces departing from ratelimiting");
+
+static void
+rl_add_syctl_entries(struct sysctl_oid *rl_sysctl_root, struct tcp_rate_set *rs)
+{
+	/*
+	 * Add sysctl entries for thus interface.
+	 */
+	if (rs->rs_flags & RS_INTF_NO_SUP) {
+		SYSCTL_ADD_S32(&rs->sysctl_ctx,
+		   SYSCTL_CHILDREN(rl_sysctl_root),
+		   OID_AUTO, "disable", CTLFLAG_RD,
+		   &rs->rs_disable, 0,
+		   "Disable this interface from new hdwr limiting?");
+	} else {
+		SYSCTL_ADD_S32(&rs->sysctl_ctx,
+		   SYSCTL_CHILDREN(rl_sysctl_root),
+		   OID_AUTO, "disable", CTLFLAG_RW,
+		   &rs->rs_disable, 0,
+		   "Disable this interface from new hdwr limiting?");
+	}
+	SYSCTL_ADD_S32(&rs->sysctl_ctx,
+	    SYSCTL_CHILDREN(rl_sysctl_root),
+	    OID_AUTO, "minseg", CTLFLAG_RW,
+	    &rs->rs_min_seg, 0,
+	    "What is the minimum we need to send on this interface?");
+	SYSCTL_ADD_U64(&rs->sysctl_ctx,
+	    SYSCTL_CHILDREN(rl_sysctl_root),
+	    OID_AUTO, "flow_limit", CTLFLAG_RW,
+	    &rs->rs_flow_limit, 0,
+	    "What is the limit for number of flows (0=unlimited)?");
+	SYSCTL_ADD_S32(&rs->sysctl_ctx,
+	    SYSCTL_CHILDREN(rl_sysctl_root),
+	    OID_AUTO, "highest", CTLFLAG_RD,
+	    &rs->rs_highest_valid, 0,
+	    "Highest valid rate");
+	SYSCTL_ADD_S32(&rs->sysctl_ctx,
+	    SYSCTL_CHILDREN(rl_sysctl_root),
+	    OID_AUTO, "lowest", CTLFLAG_RD,
+	    &rs->rs_lowest_valid, 0,
+	    "Lowest valid rate");
+	SYSCTL_ADD_S32(&rs->sysctl_ctx,
+	    SYSCTL_CHILDREN(rl_sysctl_root),
+	    OID_AUTO, "flags", CTLFLAG_RD,
+	    &rs->rs_flags, 0,
+	    "What lags are on the entry?");
+	SYSCTL_ADD_S32(&rs->sysctl_ctx,
+	    SYSCTL_CHILDREN(rl_sysctl_root),
+	    OID_AUTO, "numrates", CTLFLAG_RD,
+	    &rs->rs_rate_cnt, 0,
+	    "How many rates re there?");
+	SYSCTL_ADD_U64(&rs->sysctl_ctx,
+	    SYSCTL_CHILDREN(rl_sysctl_root),
+	    OID_AUTO, "flows_using", CTLFLAG_RD,
+	    &rs->rs_flows_using, 0,
+	    "How many flows are using this interface now?");
+#ifdef DETAILED_RATELIMIT_SYSCTL
+	if (rs->rs_rlt && rs->rs_rate_cnt > 0) {
+		/*  Lets display the rates */
+		int i;
+		struct sysctl_oid *rl_rates;
+		struct sysctl_oid *rl_rate_num;
+		char rate_num[16];
+		rl_rates = SYSCTL_ADD_NODE(&rs->sysctl_ctx,
+					    SYSCTL_CHILDREN(rl_sysctl_root),
+					    OID_AUTO,
+					    "rate",
+					    CTLFLAG_RW, 0,
+					    "Ratelist");
+		for( i = 0; i < rs->rs_rate_cnt; i++) {
+			sprintf(rate_num, "%d", i);
+			rl_rate_num = SYSCTL_ADD_NODE(&rs->sysctl_ctx,
+					    SYSCTL_CHILDREN(rl_rates),
+					    OID_AUTO,
+					    rate_num,
+					    CTLFLAG_RW, 0,
+					    "Individual Rate");
+			SYSCTL_ADD_U32(&rs->sysctl_ctx,
+				       SYSCTL_CHILDREN(rl_rate_num),
+				       OID_AUTO, "flags", CTLFLAG_RD,
+				       &rs->rs_rlt[i].flags, 0,
+				       "Flags on this rate");
+			SYSCTL_ADD_U32(&rs->sysctl_ctx,
+				       SYSCTL_CHILDREN(rl_rate_num),
+				       OID_AUTO, "pacetime", CTLFLAG_RD,
+				       &rs->rs_rlt[i].time_between, 0,
+				       "Time hardware inserts between 1500 byte sends");
+			SYSCTL_ADD_U64(&rs->sysctl_ctx,
+				       SYSCTL_CHILDREN(rl_rate_num),
+				       OID_AUTO, "rate", CTLFLAG_RD,
+				       &rs->rs_rlt[i].rate, 0,
+				       "Rate in bytes per second");
+		}
+	}
+#endif
+}
+
+static void
+rs_destroy(epoch_context_t ctx)
+{
+	struct tcp_rate_set *rs;
+
+	rs = __containerof(ctx, struct tcp_rate_set, rs_epoch_ctx);
+	mtx_lock(&rs_mtx);
+	rs->rs_flags &= ~RS_FUNERAL_SCHD;
+	if (rs->rs_flows_using == 0) {
+		/*
+		 * In theory its possible (but unlikely)
+		 * that while the delete was occuring
+		 * and we were applying the DEAD flag
+		 * someone slipped in and found the
+		 * interface in a lookup. While we
+		 * decided rs_flows_using were 0 and
+		 * scheduling the epoch_call, the other
+		 * thread incremented rs_flow_using. This
+		 * is because users have a pointer and
+		 * we only use the rs_flows_using in an
+		 * atomic fashion, i.e. the other entities
+		 * are not protected. To assure this did
+		 * not occur, we check rs_flows_using here
+		 * before deleteing.
+		 */
+		sysctl_ctx_free(&rs->sysctl_ctx);
+		free(rs->rs_rlt, M_TCPPACE);
+		free(rs, M_TCPPACE);
+		rs_number_dead--;
+	}
+	mtx_unlock(&rs_mtx);
+
+}
+
+extern counter_u64_t rate_limit_set_ok;
+extern counter_u64_t rate_limit_active;
+extern counter_u64_t rate_limit_alloc_fail;
+
+static int
+rl_attach_txrtlmt(struct ifnet *ifp,
+    uint32_t flowtype,
+    int flowid,
+    uint64_t cfg_rate,
+    struct m_snd_tag **tag)
+{
+	int error;
+	union if_snd_tag_alloc_params params = {
+		.rate_limit.hdr.type = IF_SND_TAG_TYPE_RATE_LIMIT,
+		.rate_limit.hdr.flowid = flowid,
+		.rate_limit.hdr.flowtype = flowtype,
+		.rate_limit.max_rate = cfg_rate,
+		.rate_limit.flags = M_NOWAIT,
+	};
+
+	if (ifp->if_snd_tag_alloc == NULL) {
+		error = EOPNOTSUPP;
+	} else {
+		error = ifp->if_snd_tag_alloc(ifp, &params, tag);
+		if (error == 0) {
+			if_ref((*tag)->ifp);
+			counter_u64_add(rate_limit_set_ok, 1);
+			counter_u64_add(rate_limit_active, 1);
+		} else
+			counter_u64_add(rate_limit_alloc_fail, 1);
+	}
+	return (error);
+}
+
+static void
+populate_canned_table(struct tcp_rate_set *rs, const uint64_t *rate_table_act)
+{
+	/*
+	 * The internal table is "special", it
+	 * is two seperate ordered tables that
+	 * must be merged. We get here when the
+	 * adapter specifies a number of rates that
+	 * covers both ranges in the table in some
+	 * form.
+	 */
+	int i, at_low, at_high;
+	uint8_t low_disabled = 0, high_disabled = 0;
+
+	for(i = 0, at_low = 0, at_high = RS_NEXT_ORDER_GROUP; i < rs->rs_rate_cnt; i++) {
+		rs->rs_rlt[i].flags = 0;
+		rs->rs_rlt[i].time_between = 0;
+		if ((low_disabled == 0) &&
+		    (high_disabled ||
+		     (rate_table_act[at_low] < rate_table_act[at_high]))) {
+			rs->rs_rlt[i].rate = rate_table_act[at_low];
+			at_low++;
+			if (at_low == RS_NEXT_ORDER_GROUP)
+				low_disabled = 1;
+		} else if (high_disabled == 0) {
+			rs->rs_rlt[i].rate = rate_table_act[at_high];
+			at_high++;
+			if (at_high == MAX_HDWR_RATES)
+				high_disabled = 1;
+		}
+	}
+}
+
+static struct tcp_rate_set *
+rt_setup_new_rs(struct ifnet *ifp, int *error)
+{
+	struct tcp_rate_set *rs;
+	const uint64_t *rate_table_act;
+	uint64_t lentim, res;
+	size_t sz;
+	uint32_t hash_type;
+	int i;
+	struct if_ratelimit_query_results rl;
+	struct sysctl_oid *rl_sysctl_root;
+	/*
+	 * We expect to enter with the 
+	 * mutex locked.
+	 */
+
+	if (ifp->if_ratelimit_query == NULL) {
+		/*
+		 * We can do nothing if we cannot
+		 * get a query back from the driver.
+		 */
+		return (NULL);
+	}
+	rs = malloc(sizeof(struct tcp_rate_set), M_TCPPACE, M_NOWAIT | M_ZERO);
+	if (rs == NULL) {
+		if (error)
+			*error = ENOMEM;
+		return (NULL);
+	}
+	rl.flags = RT_NOSUPPORT;
+	ifp->if_ratelimit_query(ifp, &rl);
+	if (rl.flags & RT_IS_UNUSABLE) {
+		/* 
+		 * The interface does not really support 
+		 * the rate-limiting.
+		 */
+		memset(rs, 0, sizeof(struct tcp_rate_set));
+		rs->rs_ifp = ifp;
+		rs->rs_if_dunit = ifp->if_dunit;
+		rs->rs_flags = RS_INTF_NO_SUP;
+		rs->rs_disable = 1;
+		rs_number_alive++;
+		sysctl_ctx_init(&rs->sysctl_ctx);
+		rl_sysctl_root = SYSCTL_ADD_NODE(&rs->sysctl_ctx,
+		    SYSCTL_STATIC_CHILDREN(_net_inet_tcp_rl),
+		    OID_AUTO,
+		    rs->rs_ifp->if_xname,
+		    CTLFLAG_RW, 0,
+		    "");
+		CK_LIST_INSERT_HEAD(&int_rs, rs, next);
+		/* Unlock to allow the sysctl stuff to allocate */
+		mtx_unlock(&rs_mtx);
+		rl_add_syctl_entries(rl_sysctl_root, rs);
+		/* re-lock for our caller */
+		mtx_lock(&rs_mtx);
+		return (rs);
+	} else if ((rl.flags & RT_IS_INDIRECT) == RT_IS_INDIRECT) {
+		memset(rs, 0, sizeof(struct tcp_rate_set));
+		rs->rs_ifp = ifp;
+		rs->rs_if_dunit = ifp->if_dunit;
+		rs->rs_flags = RS_IS_DEFF;
+		rs_number_alive++;
+		sysctl_ctx_init(&rs->sysctl_ctx);
+		rl_sysctl_root = SYSCTL_ADD_NODE(&rs->sysctl_ctx,
+		    SYSCTL_STATIC_CHILDREN(_net_inet_tcp_rl),
+		    OID_AUTO,
+		    rs->rs_ifp->if_xname,
+		    CTLFLAG_RW, 0,
+		    "");
+		CK_LIST_INSERT_HEAD(&int_rs, rs, next);
+		/* Unlock to allow the sysctl stuff to allocate */
+		mtx_unlock(&rs_mtx);
+		rl_add_syctl_entries(rl_sysctl_root, rs);
+		/* re-lock for our caller */
+		mtx_lock(&rs_mtx);
+		return (rs);
+	} else if ((rl.flags & RT_IS_FIXED_TABLE) == RT_IS_FIXED_TABLE) {
+		/* Mellanox most likely */
+		rs->rs_ifp = ifp;
+		rs->rs_if_dunit = ifp->if_dunit;
+		rs->rs_rate_cnt = rl.number_of_rates;
+		rs->rs_min_seg = rl.min_segment_burst;
+		rs->rs_highest_valid = 0;
+		rs->rs_flow_limit = rl.max_flows;
+		rs->rs_flags = RS_IS_INTF | RS_NO_PRE;
+		rs->rs_disable = 0;
+		rate_table_act = rl.rate_table;
+	} else if ((rl.flags & RT_IS_SELECTABLE) == RT_IS_SELECTABLE) {
+		/* Chelsio */
+		rs->rs_ifp = ifp;
+		rs->rs_if_dunit = ifp->if_dunit;
+		rs->rs_rate_cnt = rl.number_of_rates;
+		rs->rs_min_seg = rl.min_segment_burst;
+		rs->rs_disable = 0;
+		rs->rs_flow_limit = rl.max_flows;
+		rate_table_act = desired_rates;
+		if ((rs->rs_rate_cnt > MAX_HDWR_RATES) &&
+		    (rs->rs_rate_cnt < ALL_HARDWARE_RATES)) {
+			/*
+			 * Our desired table is not big
+			 * enough, do what we can.
+			 */
+			rs->rs_rate_cnt = MAX_HDWR_RATES;
+		 }
+		if (rs->rs_rate_cnt <= RS_ORDERED_COUNT)
+			rs->rs_flags = RS_IS_INTF;
+		else
+			rs->rs_flags = RS_IS_INTF | RS_INT_TBL;
+		if (rs->rs_rate_cnt >= ALL_HARDWARE_RATES)
+			rs->rs_rate_cnt = ALL_HARDWARE_RATES;
+	} else {
+		printf("Interface:%s unit:%d not one known to have rate-limits\n",
+		    ifp->if_dname,
+		    ifp->if_dunit);
+		free(rs, M_TCPPACE);
+		return (NULL);
+	}
+	sz = sizeof(struct tcp_hwrate_limit_table) * rs->rs_rate_cnt;
+	rs->rs_rlt = malloc(sz, M_TCPPACE, M_NOWAIT);
+	if (rs->rs_rlt == NULL) {
+		if (error)
+			*error = ENOMEM;
+bail:
+		free(rs, M_TCPPACE);
+		return (NULL);
+	}
+	if (rs->rs_rate_cnt >= ALL_HARDWARE_RATES) {
+		/*
+		 * The interface supports all
+		 * the rates we could possibly want.
+		 */
+		uint64_t rat;
+
+		rs->rs_rlt[0].rate = 12500;	/* 100k */
+		rs->rs_rlt[1].rate = 25000;	/* 200k */
+		rs->rs_rlt[2].rate = 62500;	/* 500k */
+		/* Note 125000 == 1Megabit
+		 * populate 1Meg - 1000meg.
+		 */
+		for(i = 3, rat = 125000; i< (ALL_HARDWARE_RATES-1); i++) {
+			rs->rs_rlt[i].rate = rat;
+			rat += 125000;
+		}
+		rs->rs_rlt[(ALL_HARDWARE_RATES-1)].rate = 1250000000;
+	} else if (rs->rs_flags & RS_INT_TBL) {
+		/* We populate this in a special way */
+		populate_canned_table(rs, rate_table_act);
+	} else {
+		/*

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@freebsd.org  Thu Aug  1 14:34:28 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A914CBF7A8;
 Thu,  1 Aug 2019 14:34:28 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zt9040wYz3F1Y;
 Thu,  1 Aug 2019 14:34: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C7311BB69;
 Thu,  1 Aug 2019 14:34: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 x71EYSnM041396;
 Thu, 1 Aug 2019 14:34:28 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71EYSMY041395;
 Thu, 1 Aug 2019 14:34:28 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201908011434.x71EYSMY041395@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Thu, 1 Aug 2019 14:34:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350502 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350502
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45zt9040wYz3F1Y
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.18 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.303,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_SPAM_SHORT(0.12)[0.122,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:34:28 -0000

Author: kib
Date: Thu Aug  1 14:34:27 2019
New Revision: 350502
URL: https://svnweb.freebsd.org/changeset/base/350502

Log:
  Make umtxq_check_susp() to correctly handle thread exit requests.
  
  The check for P_SINGLE_EXIT was shadowed by the (P_SHOULDSTOP || traced) check.
  
  Reported by:	bdrewery (might be)
  Reviewed by:	markj
  Tested by:	pho
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D21124

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Thu Aug  1 14:17:31 2019	(r350501)
+++ head/sys/kern/kern_umtx.c	Thu Aug  1 14:34:27 2019	(r350502)
@@ -723,13 +723,11 @@ umtxq_check_susp(struct thread *td, bool sleep)
 	error = 0;
 	p = td->td_proc;
 	PROC_LOCK(p);
-	if (P_SHOULDSTOP(p) ||
-	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) {
-		if (p->p_flag & P_SINGLE_EXIT)
-			error = EINTR;
-		else
-			error = sleep ? thread_suspend_check(0) : ERESTART;
-	}
+	if (p->p_flag & P_SINGLE_EXIT)
+		error = EINTR;
+	else if (P_SHOULDSTOP(p) ||
+	    ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND)))
+		error = sleep ? thread_suspend_check(0) : ERESTART;
 	PROC_UNLOCK(p);
 	return (error);
 }

From owner-svn-src-head@freebsd.org  Thu Aug  1 14:39:27 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D0CCBF894;
 Thu,  1 Aug 2019 14:39:27 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45ztGl0FLwz3FCb;
 Thu,  1 Aug 2019 14:39:27 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D99E61BB70;
 Thu,  1 Aug 2019 14:39:26 +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 x71EdQfB041649;
 Thu, 1 Aug 2019 14:39:26 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71EdQrK041648;
 Thu, 1 Aug 2019 14:39:26 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011439.x71EdQrK041648@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 14:39:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350503 - head/gnu/usr.bin/binutils/objdump
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/gnu/usr.bin/binutils/objdump
X-SVN-Commit-Revision: 350503
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45ztGl0FLwz3FCb
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.18 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.303,0];
 NEURAL_SPAM_SHORT(0.12)[0.122,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:39:27 -0000

Author: emaste
Date: Thu Aug  1 14:39:26 2019
New Revision: 350503
URL: https://svnweb.freebsd.org/changeset/base/350503

Log:
  objdump: move deprecation notice to indended spot in the man page
  
  r335217 added a deprecation notice to the source file for the objdump
  man page, and r335219 added it to the rendered objdump.1, but in the
  wrong spot.
  
  MFC after:	3 days

Modified:
  head/gnu/usr.bin/binutils/objdump/objdump.1

Modified: head/gnu/usr.bin/binutils/objdump/objdump.1
==============================================================================
--- head/gnu/usr.bin/binutils/objdump/objdump.1	Thu Aug  1 14:34:27 2019	(r350502)
+++ head/gnu/usr.bin/binutils/objdump/objdump.1	Thu Aug  1 14:39:26 2019	(r350503)
@@ -179,13 +179,13 @@ information is mostly useful to programmers who are wo
 compilation tools, as opposed to programmers who just want their
 program to compile and work.
 .PP
-\&\fBobjdump\fR will be removed from a future version of the
-FreeBSD base system.  Users who require \&\fBobjdump\fR are advised
-to install the binutils port or package.
-.PP
 \&\fIobjfile\fR... are the object files to be examined.  When you
 specify archives, \fBobjdump\fR shows information on each of the member
 object files.
+.PP
+\&\fBobjdump\fR will be removed from a future version of the
+FreeBSD base system.  Users who require \&\fBobjdump\fR are advised
+to install the binutils port or package.
 .SH "OPTIONS"
 .IX Header "OPTIONS"
 The long and short forms of options, shown here as alternatives, are

From owner-svn-src-head@freebsd.org  Thu Aug  1 14:40:38 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B01A7BF929;
 Thu,  1 Aug 2019 14:40:38 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45ztJ64BVJz3FMM;
 Thu,  1 Aug 2019 14:40: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 574B11BB76;
 Thu,  1 Aug 2019 14:40:38 +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 x71EecRT041783;
 Thu, 1 Aug 2019 14:40:38 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Eeb8b041781;
 Thu, 1 Aug 2019 14:40:37 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201908011440.x71Eeb8b041781@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Thu, 1 Aug 2019 14:40:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350504 - head/sys/fs/unionfs
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/fs/unionfs
X-SVN-Commit-Revision: 350504
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45ztJ64BVJz3FMM
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.17 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.30)[-0.297,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_SPAM_SHORT(0.12)[0.123,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:40:38 -0000

Author: kib
Date: Thu Aug  1 14:40:37 2019
New Revision: 350504
URL: https://svnweb.freebsd.org/changeset/base/350504

Log:
  Try to decrease the number of bugs in unionfs after the VV_TEXT flag removal.
  
  - Provide unionfs_add_writecount() which passes the writecount to the
    lower or upper vnode as appropriate.
  - In unionfs VOP_RECLAIM() implementation, annulate unionfs
    writecounts from upper or lower vnode.  It is not clear that it is
    always correct to remove the all references from either lower or
    upper vnode, but we currently do not track which vnode get how many
    refs anyway.
  
  Reported and tested by:	t_uemura@macome.co.jp
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/fs/unionfs/union_subr.c
  head/sys/fs/unionfs/union_vnops.c

Modified: head/sys/fs/unionfs/union_subr.c
==============================================================================
--- head/sys/fs/unionfs/union_subr.c	Thu Aug  1 14:39:26 2019	(r350503)
+++ head/sys/fs/unionfs/union_subr.c	Thu Aug  1 14:40:37 2019	(r350504)
@@ -349,6 +349,13 @@ unionfs_noderem(struct vnode *vp, struct thread *td)
 	vp->v_vnlock = &(vp->v_lock);
 	vp->v_data = NULL;
 	vp->v_object = NULL;
+	if (vp->v_writecount > 0) {
+		if (uvp != NULL)
+			VOP_ADD_WRITECOUNT(uvp, -vp->v_writecount);
+		else if (lvp != NULL)
+			VOP_ADD_WRITECOUNT(lvp, -vp->v_writecount);
+	} else if (vp->v_writecount < 0)
+		vp->v_writecount = 0;
 	VI_UNLOCK(vp);
 
 	if (lvp != NULLVP)

Modified: head/sys/fs/unionfs/union_vnops.c
==============================================================================
--- head/sys/fs/unionfs/union_vnops.c	Thu Aug  1 14:39:26 2019	(r350503)
+++ head/sys/fs/unionfs/union_vnops.c	Thu Aug  1 14:40:37 2019	(r350504)
@@ -2511,6 +2511,33 @@ unionfs_vptofh(struct vop_vptofh_args *ap)
 	return (EOPNOTSUPP);
 }
 
+static int
+unionfs_add_writecount(struct vop_add_writecount_args *ap)
+{
+	struct vnode *tvp, *vp;
+	struct unionfs_node *unp;
+	int error;
+
+	vp = ap->a_vp;
+	unp = VTOUNIONFS(vp);
+	tvp = unp->un_uppervp != NULL ? unp->un_uppervp : unp->un_lowervp;
+	VI_LOCK(vp);
+	/* text refs are bypassed to lowervp */
+	VNASSERT(vp->v_writecount >= 0, vp, ("wrong null writecount"));
+	VNASSERT(vp->v_writecount + ap->a_inc >= 0, vp,
+	    ("wrong writecount inc %d", ap->a_inc));
+	if (tvp != NULL)
+		error = VOP_ADD_WRITECOUNT(tvp, ap->a_inc);
+	else if (vp->v_writecount < 0)
+		error = ETXTBSY;
+	else
+		error = 0;
+	if (error == 0)
+		vp->v_writecount += ap->a_inc;
+	VI_UNLOCK(vp);
+	return (error);
+}
+
 struct vop_vector unionfs_vnodeops = {
 	.vop_default =		&default_vnodeops,
 
@@ -2559,4 +2586,5 @@ struct vop_vector unionfs_vnodeops = {
 	.vop_whiteout =		unionfs_whiteout,
 	.vop_write =		unionfs_write,
 	.vop_vptofh =		unionfs_vptofh,
+	.vop_add_writecount =	unionfs_add_writecount,
 };

From owner-svn-src-head@freebsd.org  Thu Aug  1 14:42:42 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4738DBFB24;
 Thu,  1 Aug 2019 14:42:42 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45ztLV1BNrz3FmB;
 Thu,  1 Aug 2019 14:42:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A4D31BD41;
 Thu,  1 Aug 2019 14:42:42 +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 x71Egfaa047256;
 Thu, 1 Aug 2019 14:42:41 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Egfa9047254;
 Thu, 1 Aug 2019 14:42:41 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011442.x71Egfa9047254@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 14:42:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
X-SVN-Commit-Revision: 350505
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 45ztLV1BNrz3FmB
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.66 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-0.78)[-0.782,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_SPAM_SHORT(0.12)[0.118,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 14:42:42 -0000

Author: emaste
Date: Thu Aug  1 14:42:41 2019
New Revision: 350505
URL: https://svnweb.freebsd.org/changeset/base/350505

Log:
  objdump: be explicit that GNU objdump that will be removed
  
  We may install llvm-objdump as objdump (see review D18307) or just
  provide no /usr/bin/objdump, but either way GNU objdump won't be
  installed in the future.
  
  MFC after:	3 days

Modified:
  head/contrib/binutils/binutils/doc/binutils.texi
  head/gnu/usr.bin/binutils/objdump/objdump.1

Modified: head/contrib/binutils/binutils/doc/binutils.texi
==============================================================================
--- head/contrib/binutils/binutils/doc/binutils.texi	Thu Aug  1 14:40:37 2019	(r350504)
+++ head/contrib/binutils/binutils/doc/binutils.texi	Thu Aug  1 14:42:41 2019	(r350505)
@@ -1624,8 +1624,8 @@ program to compile and work.
 specify archives, @command{objdump} shows information on each of the member
 object files.
 
-@command{objdump} will be removed from a future version of the
-FreeBSD base system.  Users who require @command{objdump} are advised
+GNU @command{objdump} will be removed from a future version of the
+FreeBSD base system.  Users who require GNU @command{objdump} are advised
 to install the binutils port or package.
 
 @c man end

Modified: head/gnu/usr.bin/binutils/objdump/objdump.1
==============================================================================
--- head/gnu/usr.bin/binutils/objdump/objdump.1	Thu Aug  1 14:40:37 2019	(r350504)
+++ head/gnu/usr.bin/binutils/objdump/objdump.1	Thu Aug  1 14:42:41 2019	(r350505)
@@ -183,8 +183,8 @@ program to compile and work.
 specify archives, \fBobjdump\fR shows information on each of the member
 object files.
 .PP
-\&\fBobjdump\fR will be removed from a future version of the
-FreeBSD base system.  Users who require \&\fBobjdump\fR are advised
+GNU \&\fBobjdump\fR will be removed from a future version of the
+FreeBSD base system.  Users who require GNU \&\fBobjdump\fR are advised
 to install the binutils port or package.
 .SH "OPTIONS"
 .IX Header "OPTIONS"

From owner-svn-src-head@freebsd.org  Thu Aug  1 16:00:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85F03C0EBE;
 Thu,  1 Aug 2019 16:00:47 +0000 (UTC)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: from gndrsh.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 45zw4Z5PlYz3K4Y;
 Thu,  1 Aug 2019 16:00:46 +0000 (UTC)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1])
 by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x71G0ika060323;
 Thu, 1 Aug 2019 09:00:44 -0700 (PDT)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: (from freebsd@localhost)
 by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x71G0hri060322;
 Thu, 1 Aug 2019 09:00:43 -0700 (PDT) (envelope-from freebsd)
From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net>
Message-Id: <201908011600.x71G0hri060322@gndrsh.dnsmgr.net>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
In-Reply-To: <201908011442.x71Egfa9047254@repo.freebsd.org>
To: Ed Maste <emaste@freebsd.org>
Date: Thu, 1 Aug 2019 09:00:43 -0700 (PDT)
CC: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Reply-To: rgrimes@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-Rspamd-Queue-Id: 45zw4Z5PlYz3K4Y
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none;
 spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF
 policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net
X-Spamd-Result: default: False [0.94 / 15.00]; ARC_NA(0.00)[];
 HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[];
 MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[];
 DMARC_NA(0.00)[dnsmgr.net]; TO_DN_SOME(0.00)[];
 REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; AUTH_NA(1.00)[];
 IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.05),
 country: US(-0.05)]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[];
 R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+];
 ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US];
 MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 16:00:47 -0000

> Author: emaste
> Date: Thu Aug  1 14:42:41 2019
> New Revision: 350505
> URL: https://svnweb.freebsd.org/changeset/base/350505
> 
> Log:
>   objdump: be explicit that GNU objdump that will be removed
>   
>   We may install llvm-objdump as objdump (see review D18307) or just
>   provide no /usr/bin/objdump, but either way GNU objdump won't be
>   installed in the future.
>   
>   MFC after:	3 days

Can we get a RELNOTES entry for this please?

> Modified:
>   head/contrib/binutils/binutils/doc/binutils.texi
>   head/gnu/usr.bin/binutils/objdump/objdump.1
> 
> Modified: head/contrib/binutils/binutils/doc/binutils.texi
> ==============================================================================
> --- head/contrib/binutils/binutils/doc/binutils.texi	Thu Aug  1 14:40:37 2019	(r350504)
> +++ head/contrib/binutils/binutils/doc/binutils.texi	Thu Aug  1 14:42:41 2019	(r350505)
> @@ -1624,8 +1624,8 @@ program to compile and work.
>  specify archives, @command{objdump} shows information on each of the member
>  object files.
>  
> -@command{objdump} will be removed from a future version of the
> -FreeBSD base system.  Users who require @command{objdump} are advised
> +GNU @command{objdump} will be removed from a future version of the
> +FreeBSD base system.  Users who require GNU @command{objdump} are advised
>  to install the binutils port or package.
>  
>  @c man end
> 
> Modified: head/gnu/usr.bin/binutils/objdump/objdump.1
> ==============================================================================
> --- head/gnu/usr.bin/binutils/objdump/objdump.1	Thu Aug  1 14:40:37 2019	(r350504)
> +++ head/gnu/usr.bin/binutils/objdump/objdump.1	Thu Aug  1 14:42:41 2019	(r350505)
> @@ -183,8 +183,8 @@ program to compile and work.
>  specify archives, \fBobjdump\fR shows information on each of the member
>  object files.
>  .PP
> -\&\fBobjdump\fR will be removed from a future version of the
> -FreeBSD base system.  Users who require \&\fBobjdump\fR are advised
> +GNU \&\fBobjdump\fR will be removed from a future version of the
> +FreeBSD base system.  Users who require GNU \&\fBobjdump\fR are advised
>  to install the binutils port or package.
>  .SH "OPTIONS"
>  .IX Header "OPTIONS"
> 
> 

-- 
Rod Grimes                                                 rgrimes@freebsd.org

From owner-svn-src-head@freebsd.org  Thu Aug  1 16:23:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7EC3C1DB9
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Thu,  1 Aug 2019 16:23:00 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com
 [IPv6:2607:f8b0:4864:20::731])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zwZD0hxpz3PMk
 for <svn-src-head@freebsd.org>; Thu,  1 Aug 2019 16:22:59 +0000 (UTC)
 (envelope-from wlosh@bsdimp.com)
Received: by mail-qk1-x731.google.com with SMTP id 201so52452495qkm.9
 for <svn-src-head@freebsd.org>; Thu, 01 Aug 2019 09:22:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=bsdimp-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=pHOZwqGD3SyFPk/nlV2jhD1BS3qtC+VncWAA9ruZBzg=;
 b=FQR5Uwsf04uosNDTRmaFEnGxKAkqWpZMW/j579W7mBds2HcprHmmxf6Fnnc1n80pcT
 jgZPSy5YiDtfnb059FKBuuB+NiAXmo1hfZnJsCOXPxB9fyIarRomeA3uqn7z3Feq/RnY
 YDC/m5FnARviVPQJnNjN1v5nAqenTo/lY1CMVQSvtgeMlA/uQqwVso1A0+N2HNo7i3DI
 5+gBCGKChE8QFq9/vDA/hK2WZjfnI2gRkrNueTTXYu8B9iaOOTP6HlWIw9dwMjW3SbwV
 V4hOPcuTDUXxvF3h/7aMesSO49MHkMTQUkFmsWOZiaWmL0F7YWsIK90aS7trdCM17s9G
 zCXw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=pHOZwqGD3SyFPk/nlV2jhD1BS3qtC+VncWAA9ruZBzg=;
 b=slZwsTize5yViCSjJQE5o2nAgibMniTvpceOXdwpxvOjShTiMTSAGU8sj4feV+7inJ
 yfgW0ciXP9TY2Ohl1Ii0Y1C6YL4vs+eIJdSDL/vo6e87cKvHWqaxqEmgSF7FWlLv5llR
 ifj6G9c0I6ELKqapDv9NQIFq2mlfRHWvt4jtJc4Z9UUZnk6M1RiuNaM/nmRPmV2H2/Ad
 1W2tExrXlngODnd9rNy/c/a6JpDxMkVDd8juC3+86UFy7JEIiKRQnyixyn03ev8KJizV
 MwGA66JzoGFr/dY8B0m2hlKA8U2DdXz17/oWcTwXgHuOa1bIzEPideTAAWYYbbeu33p5
 XYjQ==
X-Gm-Message-State: APjAAAVBnAtAnygRAAg1NBEShNe+7eETC9O81NN3cKfNiZQ28rwkQfEB
 GGW/koWyDuSEotHOHu/rqVJjKyTJe5v2PY6AF3k=
X-Google-Smtp-Source: APXvYqxbI8rAnyvdZ7mqx2CuVQ2c12hCxTgFHDiqmLXhj+0S4L730fhpOMRJiz1ZPcAJ/FprngePdvhpwz+2pIw1lhs=
X-Received: by 2002:a05:620a:1017:: with SMTP id
 z23mr88485760qkj.60.1564676578666; 
 Thu, 01 Aug 2019 09:22:58 -0700 (PDT)
MIME-Version: 1.0
References: <201908011442.x71Egfa9047254@repo.freebsd.org>
 <201908011600.x71G0hri060322@gndrsh.dnsmgr.net>
In-Reply-To: <201908011600.x71G0hri060322@gndrsh.dnsmgr.net>
From: Warner Losh <imp@bsdimp.com>
Date: Thu, 1 Aug 2019 11:22:46 -0500
Message-ID: <CANCZdfrFN61qdga6D9hKkAJO47Fae42wNPHzDTkgpLw0-Z+Qiw@mail.gmail.com>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
To: "Rodney W. Grimes" <rgrimes@freebsd.org>
Cc: Ed Maste <emaste@freebsd.org>, src-committers <src-committers@freebsd.org>,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
X-Rspamd-Queue-Id: 45zwZD0hxpz3PMk
X-Spamd-Bar: -
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623
 header.b=FQR5Uwsf; dmarc=none;
 spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when
 checking 2607:f8b0:4864:20::731) smtp.mailfrom=wlosh@bsdimp.com
X-Spamd-Result: default: False [-1.99 / 15.00]; ARC_NA(0.00)[];
 R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623];
 FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[];
 MIME_GOOD(-0.10)[multipart/alternative,text/plain];
 PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org];
 DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3];
 RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[];
 DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+];
 RCVD_IN_DNSWL_NONE(0.00)[1.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org
 : 127.0.5.0]; R_SPF_NA(0.00)[];
 FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com];
 MIME_TRACE(0.00)[0:+,1:+,2:~];
 IP_SCORE(-2.99)[ip: (-9.38), ipnet: 2607:f8b0::/32(-3.08), asn: 15169(-2.45),
 country: US(-0.05)]; 
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com];
 RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]
Content-Type: text/plain; charset="UTF-8"
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 16:23:00 -0000

On Thu, Aug 1, 2019, 11:00 AM Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net>
wrote:

> > Author: emaste
> > Date: Thu Aug  1 14:42:41 2019
> > New Revision: 350505
> > URL: https://svnweb.freebsd.org/changeset/base/350505
> >
> > Log:
> >   objdump: be explicit that GNU objdump that will be removed
> >
> >   We may install llvm-objdump as objdump (see review D18307) or just
> >   provide no /usr/bin/objdump, but either way GNU objdump won't be
> >   installed in the future.
> >
> >   MFC after:  3 days
>
> Can we get a RELNOTES entry for this please?
>

Great idea. What's the protocol the project wants here? It seems to me that
we'd want a world where either the original committer or folks shepherding
the release notes out the door when the time comes could commit entries to
the file. We should encourage the OC to do it, but have the culture that we
can be relaxed about others doing it too so we have low friction around
this file.

Warner

> Modified:
> >   head/contrib/binutils/binutils/doc/binutils.texi
> >   head/gnu/usr.bin/binutils/objdump/objdump.1
> >
> > Modified: head/contrib/binutils/binutils/doc/binutils.texi
> >
> ==============================================================================
> > --- head/contrib/binutils/binutils/doc/binutils.texi  Thu Aug  1
> 14:40:37 2019        (r350504)
> > +++ head/contrib/binutils/binutils/doc/binutils.texi  Thu Aug  1
> 14:42:41 2019        (r350505)
> > @@ -1624,8 +1624,8 @@ program to compile and work.
> >  specify archives, @command{objdump} shows information on each of the
> member
> >  object files.
> >
> > -@command{objdump} will be removed from a future version of the
> > -FreeBSD base system.  Users who require @command{objdump} are advised
> > +GNU @command{objdump} will be removed from a future version of the
> > +FreeBSD base system.  Users who require GNU @command{objdump} are
> advised
> >  to install the binutils port or package.
> >
> >  @c man end
> >
> > Modified: head/gnu/usr.bin/binutils/objdump/objdump.1
> >
> ==============================================================================
> > --- head/gnu/usr.bin/binutils/objdump/objdump.1       Thu Aug  1
> 14:40:37 2019        (r350504)
> > +++ head/gnu/usr.bin/binutils/objdump/objdump.1       Thu Aug  1
> 14:42:41 2019        (r350505)
> > @@ -183,8 +183,8 @@ program to compile and work.
> >  specify archives, \fBobjdump\fR shows information on each of the member
> >  object files.
> >  .PP
> > -\&\fBobjdump\fR will be removed from a future version of the
> > -FreeBSD base system.  Users who require \&\fBobjdump\fR are advised
> > +GNU \&\fBobjdump\fR will be removed from a future version of the
> > +FreeBSD base system.  Users who require GNU \&\fBobjdump\fR are advised
> >  to install the binutils port or package.
> >  .SH "OPTIONS"
> >  .IX Header "OPTIONS"
> >
> >
>
> --
> Rod Grimes
> rgrimes@freebsd.org
>
>

From owner-svn-src-head@freebsd.org  Thu Aug  1 16:35:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DC16C2160
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Thu,  1 Aug 2019 16:35:40 +0000 (UTC) (envelope-from ian@freebsd.org)
Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org
 [54.149.155.156])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zwrr1h5hz3Pxv
 for <svn-src-head@freebsd.org>; Thu,  1 Aug 2019 16:35:39 +0000 (UTC)
 (envelope-from ian@freebsd.org)
ARC-Seal: i=1; a=rsa-sha256; t=1564677338; cv=none;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 b=D/An1Voso0NVVybITkJTtH2rD//2HzNVFzBea0Ot6gwhEF8ZMJYICkWevRmkt3E1vYeOvy4AdosND
 VRXX/bTF313l4BFW4PKxnzV47Cradu0HcRsU09TiddjMYnpQhjuJMOP12xqZsMyTairqgkyGZHU75r
 yid3cqgdY9Jpd0fVA+628OUFva8qz7Z0YveVNn19ZMXsPYBBdl/5cMnV3DHbo/Q8/2evmEO0cfvN2S
 NKv3swln/TnxneyotH5A61cCK9TQ3tX5WDScvComYWXhoFvG/qh36pkoO5kMpuyY5vd9RYbFWEXwkY
 D72VIHP6SGU6vnaIHl06Isq4XMEYq2w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:to:from:subject:message-id:dkim-signature:from;
 bh=xhKmiIY4939u8igCvaEgtcQrAvfgyOOn5ruR6THNR5M=;
 b=Pny+PnGf/eq1WdNAr5oZ1WsJm4/Rxg+0fWscXDGasjJgUHbwTuSJB6S+1bfiUQxceFiP9CwmnXlX9
 WE3zvXESl1h74LO9irHGUlW66Tj2QPFU02eg8fr+8dJip2P/iHQHqGFq1IUnuMzex+CioWvuTgddyx
 OYy0zEfGI9kOAYHm+Fqi369J9q3Gr8LdhgkxAeytVTZtYWlBOB0eSop6jTr7TB+u4gGnSPTgLTLGxC
 UarPSrgH/aTxpczRbM3t5vdKcSl5wgOlw3ARhVstjxqxKuUKD5A4Eexi+Pp5UMfFD4zdYr68L/2Q1Z
 7McodwBlVGFbfiIsTibH9WfgKZGKVUw==
ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org;
 spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60;
 dmarc=none header.from=freebsd.org;
 arc=none header.oldest-pass=0;
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=dkim-high;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:to:from:subject:message-id:from;
 bh=xhKmiIY4939u8igCvaEgtcQrAvfgyOOn5ruR6THNR5M=;
 b=vdabHcRaPbku39N8fghSHAuQZ2O5++yyxPzeUybMXwiVnMRWH3050rD6dohEV76ZLBoi3I6cnR7fu
 JVZwbuuh2KO2M0vRGGrFd+4zUYRbmqW0b2hfQOTExsQSNS7edKj/GSUIIyBgWc/eDHqKK+wqJANRck
 fF7SYo2PMok0PhG5bGEH/820e0z/3QMi9wDx1780+9NuhjM6Ee0ktIzMhGV8XfzpsvYHAUSzXf5qVB
 v2ftcRBwEzKEdQj+I4SMCxZTbZ9h9LWl/tvnCQtp6Sfty9Q/IOGqYEj1u61bh9c9GieqD7fZbRHRLF
 58A9mvt37BDecmY5I1tmABCD0xIqmgA==
X-MHO-RoutePath: aGlwcGll
X-MHO-User: 62dcef2a-b47a-11e9-85ec-13b9aae3a1d2
X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information
X-Originating-IP: 67.177.211.60
X-Mail-Handler: DuoCircle Outbound SMTP
Received: from ilsoft.org (unknown [67.177.211.60])
 by outbound4.ore.mailhop.org (Halon) with ESMTPSA
 id 62dcef2a-b47a-11e9-85ec-13b9aae3a1d2;
 Thu, 01 Aug 2019 16:35:35 +0000 (UTC)
Received: from rev (rev [172.22.42.240])
 by ilsoft.org (8.15.2/8.15.2) with ESMTP id x71GZYZ5002041;
 Thu, 1 Aug 2019 10:35:34 -0600 (MDT) (envelope-from ian@freebsd.org)
Message-ID: <23d23900d06581050562951f5cf6a625235a059f.camel@freebsd.org>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
From: Ian Lepore <ian@freebsd.org>
To: Ed Maste <emaste@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Date: Thu, 01 Aug 2019 10:35:34 -0600
In-Reply-To: <201908011442.x71Egfa9047254@repo.freebsd.org>
References: <201908011442.x71Egfa9047254@repo.freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 45zwrr1h5hz3Pxv
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [0.00 / 15.00];
 local_wl_from(0.00)[freebsd.org];
 ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 16:35:40 -0000

On Thu, 2019-08-01 at 14:42 +0000, Ed Maste wrote:
> Author: emaste
> Date: Thu Aug  1 14:42:41 2019
> New Revision: 350505
> URL: https://svnweb.freebsd.org/changeset/base/350505
> 
> Log:
>   objdump: be explicit that GNU objdump that will be removed
>   
>   We may install llvm-objdump as objdump (see review D18307) or just
>   provide no /usr/bin/objdump, but either way GNU objdump won't be
>   installed in the future.
>   

Why would we provide no objdump?  I use it quite frequently; it seems
like an essential part of the toolchain to me.

-- Ian



From owner-svn-src-head@freebsd.org  Thu Aug  1 16:41:39 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 378B2C2262;
 Thu,  1 Aug 2019 16:41:39 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: from mail-io1-f68.google.com (mail-io1-f68.google.com
 [209.85.166.68])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zwzl0JMzz3QGq;
 Thu,  1 Aug 2019 16:41:38 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: by mail-io1-f68.google.com with SMTP id f4so145811257ioh.6;
 Thu, 01 Aug 2019 09:41:38 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=CktNowto3/UDIUDVYXuika3QWrgq5MPZ7EzfRddfLds=;
 b=Dht1AkWEICnOPciNa48PNHyrg6FzsoJ0ZOBFAg5sC+moCRi4lFie8udt/+jbjZutqs
 i4at0WcaqhRVcx/l6QyLsEU0bU2s8oEfeLX3N0bJdjNeKU/XksDNL26R9d5j52DNacxP
 bQwP4Zc/KVVrTISWMUt5KDCcYfCodL2UKMg2pPLC8SzRj3rkbxP4RWeV8vtIOajEnG4p
 sJPcD/fOL44g1v55r6FWJk7mLsTA37HBmjN6YVDAqAfIiW+0ppGNcHcR2I5bgXrDqyLw
 Vwyx5rqvoCFtPE1q6N8TqESEB9vWN/PPiB/3xkU6P9uuU+cvLSWWxf0ycrhu0rLinlqS
 W2dQ==
X-Gm-Message-State: APjAAAUejnKIoih3rKBmyTNXhQR0jmddUl6r5A1IbNddwBU4kDAmGFxZ
 WyRqAsjd/Umf3EdFUmr2pCMF1369uXyPde3ubS0n7A==
X-Google-Smtp-Source: APXvYqyOZ1Y1hLPlciKgt90SAPkA1dutqsXY2bs8CelPTaQuej8JEbaM4kObVM1MoFEjiEnsFpWqgyZT+4zks5Hxg6I=
X-Received: by 2002:a6b:5b01:: with SMTP id v1mr14511271ioh.120.1564677696512; 
 Thu, 01 Aug 2019 09:41:36 -0700 (PDT)
MIME-Version: 1.0
References: <201908011442.x71Egfa9047254@repo.freebsd.org>
 <201908011600.x71G0hri060322@gndrsh.dnsmgr.net>
In-Reply-To: <201908011600.x71G0hri060322@gndrsh.dnsmgr.net>
From: Ed Maste <emaste@freebsd.org>
Date: Wed, 31 Jul 2019 22:44:53 -0400
Message-ID: <CAPyFy2BpPbQ+XynADKzeraVnLXPuzm-ohM7uigMc-7S6Ly4YXA@mail.gmail.com>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
To: "Rodney W. Grimes" <rgrimes@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 45zwzl0JMzz3QGq
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.00 / 15.00];
	 REPLY(-4.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 16:41:39 -0000

On Thu, 1 Aug 2019 at 12:00, Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net> wrote:
>
> > Author: emaste
> > Date: Thu Aug  1 14:42:41 2019
> > New Revision: 350505
> > URL: https://svnweb.freebsd.org/changeset/base/350505
> >
> > Log:
> >   objdump: be explicit that GNU objdump that will be removed
> >
> >   We may install llvm-objdump as objdump (see review D18307) or just
> >   provide no /usr/bin/objdump, but either way GNU objdump won't be
> >   installed in the future.
> >
> >   MFC after:  3 days
>
> Can we get a RELNOTES entry for this please?

Can you suggest wording for such a note? Something like:

The deprecation notice in the GNU objdump man page was clarified to
indicate that it is GNU objdump which will be removed; an objdump from
the LLVM project may be provided in its place.

From owner-svn-src-head@freebsd.org  Thu Aug  1 16:51:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAA6BC274F;
 Thu,  1 Aug 2019 16:51:07 +0000 (UTC)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: from gndrsh.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 45zxBg46M7z3QkY;
 Thu,  1 Aug 2019 16:51:07 +0000 (UTC)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1])
 by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x71GoxTt060564;
 Thu, 1 Aug 2019 09:50:59 -0700 (PDT)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: (from freebsd@localhost)
 by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x71GoxBe060563;
 Thu, 1 Aug 2019 09:50:59 -0700 (PDT) (envelope-from freebsd)
From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net>
Message-Id: <201908011650.x71GoxBe060563@gndrsh.dnsmgr.net>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
In-Reply-To: <CAPyFy2BpPbQ+XynADKzeraVnLXPuzm-ohM7uigMc-7S6Ly4YXA@mail.gmail.com>
To: Ed Maste <emaste@freebsd.org>
Date: Thu, 1 Aug 2019 09:50:59 -0700 (PDT)
CC: "Rodney W. Grimes" <rgrimes@freebsd.org>,
 src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
Reply-To: rgrimes@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-Rspamd-Queue-Id: 45zxBg46M7z3QkY
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.00 / 15.00];
	 REPLY(-4.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 16:51:07 -0000

> On Thu, 1 Aug 2019 at 12:00, Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net> wrote:
> >
> > > Author: emaste
> > > Date: Thu Aug  1 14:42:41 2019
> > > New Revision: 350505
> > > URL: https://svnweb.freebsd.org/changeset/base/350505
> > >
> > > Log:
> > >   objdump: be explicit that GNU objdump that will be removed
> > >
> > >   We may install llvm-objdump as objdump (see review D18307) or just
> > >   provide no /usr/bin/objdump, but either way GNU objdump won't be
> > >   installed in the future.
> > >
> > >   MFC after:  3 days
> >
> > Can we get a RELNOTES entry for this please?
> 
> Can you suggest wording for such a note? Something like:
> 
> The deprecation notice in the GNU objdump man page was clarified to
> indicate that it is GNU objdump which will be removed; an objdump from
> the LLVM project may be provided in its place.

That would be fine, the important thing is that the
r350505 gets listed in the file, the people who shall
actually have to write the release notes simply need
a key to let them know they should look at this commit
and create a proper entry.

I did not set the policy or write the current RELNOTES file,
so markj and gjb have far more to say here than anything I
do.

Regards,
-- 
Rod Grimes                                                 rgrimes@freebsd.org

From owner-svn-src-head@freebsd.org  Thu Aug  1 16:55:40 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EEF8C281E;
 Thu,  1 Aug 2019 16:55:40 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: from mail-io1-f54.google.com (mail-io1-f54.google.com
 [209.85.166.54])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zxHw2pL4z3R6G;
 Thu,  1 Aug 2019 16:55:40 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: by mail-io1-f54.google.com with SMTP id j6so26069690ioa.5;
 Thu, 01 Aug 2019 09:55:40 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=+Phwogx9pvK72tf1192cxwUI0k6VieZQN7r8BSsgcd8=;
 b=BcKCcKprU3MjRuQ23THcgaKi+jpP5A9NX5AQL9XN0gyQYTE2D8yZi0VCj56issBjzL
 AMalKAZ2OfaCOQabI65fhfC3OfPkVrtSXSOK1+HawHgxvSbcYwI1dqFU9HXrM+yfrBkm
 XOYMHiPeJYaIK7//LSgmZP+Z0svau75Q5NUw9ih87RLeOAbNVuSOirFSwnLGY1e2UVqT
 tSzVODUKhn1AnSWfx6MuM0D0lr7VCBj486XXddo2UtfEduCkiuxehykJw5UGPLjE2stV
 5iFvFQ33azXT6lERMtJQIBjxVEpp3GQ4JGZTo6WC6bm5V26pQ4yDnV9ta5HwHcGYTDpz
 6YxQ==
X-Gm-Message-State: APjAAAXMgd1prrniMXYyf4/TYGpGHpMTPbRCwh1nd6MsaeqfjCCQx4Ft
 45goYqeoaKMO8v8Uq+EW6fWviUGsSjNDx7P8dkdNfytF
X-Google-Smtp-Source: APXvYqwpiYq/N0If3I7WJi3PdSkfClDHByt6kvzIT4Fa23lvOe9iykT9Tn6lghnjW6joXvGIra8qDq6NQIUEtqHx8vw=
X-Received: by 2002:a02:aa0d:: with SMTP id r13mr29393548jam.129.1564678537736; 
 Thu, 01 Aug 2019 09:55:37 -0700 (PDT)
MIME-Version: 1.0
References: <201908011442.x71Egfa9047254@repo.freebsd.org>
 <23d23900d06581050562951f5cf6a625235a059f.camel@freebsd.org>
In-Reply-To: <23d23900d06581050562951f5cf6a625235a059f.camel@freebsd.org>
From: Ed Maste <emaste@freebsd.org>
Date: Wed, 31 Jul 2019 22:58:55 -0400
Message-ID: <CAPyFy2AxES0Sn29ELRHETQ-d3UvKSnskR8up_6_pV7cY9-iJkA@mail.gmail.com>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
To: Ian Lepore <ian@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 45zxHw2pL4z3R6G
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.00 / 15.00];
	 REPLY(-4.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 16:55:40 -0000

On Thu, 1 Aug 2019 at 12:35, Ian Lepore <ian@freebsd.org> wrote:
>
> Why would we provide no objdump?  I use it quite frequently; it seems
> like an essential part of the toolchain to me.

I don't want us to provide no objdump, but providing GNU objdump
2.17.50 indefinitely is not a viable option; see PR 218387[1] for an
example of the kind of issue we have with providing obsolete software.

We have a choice of:
1. provide llvm-objdump, and no /usr/bin/objdump in the base system
2. install llvm-objdump as /usr/bin/objdump
3. require that users who want an objdump install the binutils port

/usr/bin/objdump is not required by the base system build and not
required by most ports. exp-run details with no /usr/bin/objdump can
be found in PR 212319[2], and PR 229046[3] is a tracking PR for
removing dependencies on objdump.

Option 1 (removing /usr/bin/objdump) is proposed in review D7338[4]
while option 2 is (installing llvm-objdump as objdump) is proposed in
review D18307. llvm-objdump is roughly compatible with GNU objdump
(command line and output format) but there are a large number of small
issues that will likely trip up scripted or automated objdump use.
(Scripts should probably just use readelf instead, though.) D18307 has
a list of LLVM bug reports for known issues in llvm-objdump.

Note also that we currently provide only two or three obsolete
binutils, depending on the CPU architecture:
- as
- ld
- objdump

[1] https://bugs.freebsd.org/218387
[2] https://bugs.freebsd.org/212319
[3] https://bugs.freebsd.org/229046
[4] https://reviews.freebsd.org/D7338
[5] https://reviews.freebsd.org/D18307

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:02:59 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5A89C2A2B;
 Thu,  1 Aug 2019 17:02:59 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zxSM3p34z3wj7;
 Thu,  1 Aug 2019 17:02:59 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6529F1D6E8;
 Thu,  1 Aug 2019 17:02:59 +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 x71H2xF5034371;
 Thu, 1 Aug 2019 17:02:59 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71H2xXc034370;
 Thu, 1 Aug 2019 17:02:59 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011702.x71H2xXc034370@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 17:02:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350506 - head/tools/debugscripts
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/tools/debugscripts
X-SVN-Commit-Revision: 350506
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:02:59 -0000

Author: emaste
Date: Thu Aug  1 17:02:58 2019
New Revision: 350506
URL: https://svnweb.freebsd.org/changeset/base/350506

Log:
  remove obsolete kernel debugging script
  
  For quite some time kgdb has been internally handling FreeBSD kernel
  module state; add-on scripts and tools are not needed.  asf(8) served
  a similar purpose to this script and was removed in r335222.
  
  PR:		229046
  Reported by:	jhb
  Sponsored by:	The FreeBSD Foundation

Deleted:
  head/tools/debugscripts/kld_deb.py

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:10:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4223C2C21;
 Thu,  1 Aug 2019 17:10:35 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: from mail-io1-f46.google.com (mail-io1-f46.google.com
 [209.85.166.46])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zxd75kwsz3x0x;
 Thu,  1 Aug 2019 17:10:35 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: by mail-io1-f46.google.com with SMTP id o9so42382793iom.3;
 Thu, 01 Aug 2019 10:10:35 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=1J2RpoPbGClnrRxlMTypBrxQWRWS527TQEVAF7IkHg8=;
 b=esu40u7Ty1exv1gOJ0f08l1ZL+UcFJ3dlDWqIw+aCUwN0cOQTEBa43vo2ZavsL1+bk
 AhfyFXG5eJAbFuVk/bbubjIfjcVTt8JHukQSjXKsFvC8LsnIJd/Dyt1wshDNgodWbQtg
 NU+10D13hxOMaDz9L0MDFUhNT4FXO3eE4Ygo6bzeUuaIUMkItye99GDFPBd05Rm4bLMC
 OOkMXprjurNmCt7RiM0gFVyNfUVkRB7lZpOY1bUBazhQMUaTBzVPtzFEoklSY7Lh/I1F
 fA8wHm1BMA2mknpbu14tZk4qZkKD5XoAyrX2mNri9buVH8aYj17+T3a9S4FsjUpqyD2i
 lWgg==
X-Gm-Message-State: APjAAAWtI1o+M+h/u7kJgCX5F3qDzIMRNQ+L6BK+utOvQzuf4bfbpcn1
 Bcoowl8PTdjFszZQP/8Wt3pEPtKhuO3JOyB5jyrJzw==
X-Google-Smtp-Source: APXvYqwf5WH7gHKfo17yJhPUSX11P9aczPW/s1XwmabUPhG5mZ3Ck6tT5ctg0dF8klQtClRrZs2jsEqYIrZJUwuyuE0=
X-Received: by 2002:a02:1441:: with SMTP id 62mr20190448jag.21.1564679433999; 
 Thu, 01 Aug 2019 10:10:33 -0700 (PDT)
MIME-Version: 1.0
References: <CAPyFy2BpPbQ+XynADKzeraVnLXPuzm-ohM7uigMc-7S6Ly4YXA@mail.gmail.com>
 <201908011650.x71GoxBe060563@gndrsh.dnsmgr.net>
In-Reply-To: <201908011650.x71GoxBe060563@gndrsh.dnsmgr.net>
From: Ed Maste <emaste@freebsd.org>
Date: Wed, 31 Jul 2019 23:13:51 -0400
Message-ID: <CAPyFy2Bj=2gaeXMA1AsFLX2=vmUjW2sEa9ugN00AzvAjqvZouw@mail.gmail.com>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
To: "Rodney W. Grimes" <rgrimes@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 45zxd75kwsz3x0x
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.87 / 15.00];
 NEURAL_HAM_SHORT(-0.87)[-0.874,0]; REPLY(-4.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:10:36 -0000

On Thu, 1 Aug 2019 at 12:51, Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net> wrote:
>
> That would be fine, the important thing is that the
> r350505 gets listed in the file,

I don't see any reason that r350505 specifically should be in a
release note - this is a minor clarification of an existing
deprecation notice. It seems having an overall "deprecation notices"
section in the release notes would make sense, but they should really
persist from version to version. Should we add a top-level
DEPRECATION_NOTICES file perhaps? Or tag deprecation notices with some
sort of comment in the source so they can be found with a 'grep'
during release preparation?

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:22:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACFCFC30D3;
 Thu,  1 Aug 2019 17:22:06 +0000 (UTC)
 (envelope-from markjdb@gmail.com)
Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com
 [IPv6:2607:f8b0:4864:20::d43])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zxtP5Hcmz3xm7;
 Thu,  1 Aug 2019 17:22:05 +0000 (UTC)
 (envelope-from markjdb@gmail.com)
Received: by mail-io1-xd43.google.com with SMTP id e20so13108095iob.9;
 Thu, 01 Aug 2019 10:22:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to:user-agent;
 bh=rCVdjVrSdCxlJUa2Igk5nRBJ9UUM+LndEU0TK88mF2Y=;
 b=X1M1pm8KH3hjKfe/9O5r9KZxpgn8ZsP6VJN3lLqbI+QVNwq9+skEyBRn8CwEn02hD0
 U5/3fVbPX4jytJuDH2ZZaMDl3Vo1NoROUGyKm5NX/aEOJ0Rl4WBTReXH2yTcvC9sU1N4
 4/6kCsNvwBDStFOpsq1sK2Pkou+jNiIu7XKyfmVh0iHXncqYE8L3RSc9Q3uqPWnFOLjv
 DnRmm9l8DW+9CUEv8RnYVp6qrz2YFWOm+9B49egEYmdjiNa+Dr/+cxjb6TUYqxMatPFU
 KpsyTII0audmzcomK/a3sJWRn/PNp89f2UeTZQumS9oGSdj8An6CJWo67SNViuNrkQ0q
 cPMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
 :references:mime-version:content-disposition:in-reply-to:user-agent;
 bh=rCVdjVrSdCxlJUa2Igk5nRBJ9UUM+LndEU0TK88mF2Y=;
 b=LrtBX9/NPTKGTm5vSQ/VTLwsRLDtf4sZaRYREay0TYIhGQoR5XACNlUKVB7sJ4T7l9
 2vhNr5aiMtjmrWw2ntEn9iHiDh7HuRL5pA4Zmmtyf6lGh7WBQfb1YGP0KgANeqNI/qsa
 vm3oXASs3iWGiVddgw157BLpuCsR9rrYd6hpiVsgG39U+h5eb/E1DQ75cRSY3Ge7HWs9
 qMpb30Paul0Lv5HJQwB+1zGOvj7k1ymAHKFTbJIS+XE5bZW/epO72o1tWYDrnHLTYBV5
 RCGwZ7otcZKJsRTu44RQ5uZRoUmI2sLUf+EcdQQ2qBi9b4TqktPovdzO7+p+aRb7Uenl
 0BnQ==
X-Gm-Message-State: APjAAAVRCW8DXZ3RIGWu4MTp8TEohhniMS+6MStbsbs0nB8JxwuUegGh
 OccNgaLH9uAoRFiNOISy3MU=
X-Google-Smtp-Source: APXvYqyGfEEwHd8TvRoKxcAzF3cpK6PwkVojziq7kp8exsCjMi1Dz9RtUGpQHlNyJMNQbWhFjlpdWw==
X-Received: by 2002:a6b:dc13:: with SMTP id s19mr1743703ioc.53.1564680124440; 
 Thu, 01 Aug 2019 10:22:04 -0700 (PDT)
Received: from raichu (toroon0560w-lp140-05-70-29-85-38.dsl.bell.ca.
 [70.29.85.38])
 by smtp.gmail.com with ESMTPSA id s15sm56124809ioe.88.2019.08.01.10.22.02
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Thu, 01 Aug 2019 10:22:03 -0700 (PDT)
Sender: Mark Johnston <markjdb@gmail.com>
Date: Thu, 1 Aug 2019 13:21:24 -0400
From: Mark Johnston <markj@freebsd.org>
To: Warner Losh <imp@bsdimp.com>
Cc: "Rodney W. Grimes" <rgrimes@freebsd.org>, Ed Maste <emaste@freebsd.org>,
 src-committers <src-committers@freebsd.org>,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
Message-ID: <20190801172124.GA19051@raichu>
References: <201908011442.x71Egfa9047254@repo.freebsd.org>
 <201908011600.x71G0hri060322@gndrsh.dnsmgr.net>
 <CANCZdfrFN61qdga6D9hKkAJO47Fae42wNPHzDTkgpLw0-Z+Qiw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CANCZdfrFN61qdga6D9hKkAJO47Fae42wNPHzDTkgpLw0-Z+Qiw@mail.gmail.com>
User-Agent: Mutt/1.12.1 (2019-06-15)
X-Rspamd-Queue-Id: 45zxtP5Hcmz3xm7
X-Spamd-Bar: -
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=gmail.com header.s=20161025 header.b=X1M1pm8K;
 dmarc=none;
 spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates
 2607:f8b0:4864:20::d43 as permitted sender) smtp.mailfrom=markjdb@gmail.com
X-Spamd-Result: default: False [-1.30 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[];
 TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+];
 DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[6];
 RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[];
 DKIM_TRACE(0.00)[gmail.com:+];
 NEURAL_HAM_SHORT(-0.87)[-0.872,0];
 RCVD_IN_DNSWL_NONE(0.00)[3.4.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org
 : 127.0.5.0]; 
 IP_SCORE(-0.73)[ip: (1.95), ipnet: 2607:f8b0::/32(-3.08), asn: 15169(-2.45),
 country: US(-0.05)]; 
 FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com];
 MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com];
 RCVD_TLS_ALL(0.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:22:06 -0000

On Thu, Aug 01, 2019 at 11:22:46AM -0500, Warner Losh wrote:
> On Thu, Aug 1, 2019, 11:00 AM Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net>
> wrote:
> 
> > > Author: emaste
> > > Date: Thu Aug  1 14:42:41 2019
> > > New Revision: 350505
> > > URL: https://svnweb.freebsd.org/changeset/base/350505
> > >
> > > Log:
> > >   objdump: be explicit that GNU objdump that will be removed
> > >
> > >   We may install llvm-objdump as objdump (see review D18307) or just
> > >   provide no /usr/bin/objdump, but either way GNU objdump won't be
> > >   installed in the future.
> > >
> > >   MFC after:  3 days
> >
> > Can we get a RELNOTES entry for this please?
> >
> 
> Great idea. What's the protocol the project wants here? It seems to me that
> we'd want a world where either the original committer or folks shepherding
> the release notes out the door when the time comes could commit entries to
> the file. We should encourage the OC to do it, but have the culture that we
> can be relaxed about others doing it too so we have low friction around
> this file.

This is basically how UPDATING works.  It's reasonable to reply to a
commit mail and ask the committer to consider adding a RELNOTES entry,
perhaps proposing some text.  And if the committer doesn't follow up,
there's no problem with just going ahead and committing the new entry.

That said, I would think that an actual removal of GNU objdump would
be the commit that deserves a RELNOTES entry, not this one.

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:28:37 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14E71C3284;
 Thu,  1 Aug 2019 17:28:37 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zy1w6R1Vz3y1M;
 Thu,  1 Aug 2019 17:28:36 +0000 (UTC) (envelope-from erj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB0851DA91;
 Thu,  1 Aug 2019 17:28:36 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71HSa1q046471;
 Thu, 1 Aug 2019 17:28:36 GMT (envelope-from erj@FreeBSD.org)
Received: (from erj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71HSaBb046470;
 Thu, 1 Aug 2019 17:28:36 GMT (envelope-from erj@FreeBSD.org)
Message-Id: <201908011728.x71HSaBb046470@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org
 using -f
From: Eric Joyner <erj@FreeBSD.org>
Date: Thu, 1 Aug 2019 17:28:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350507 - head/sys/net
X-SVN-Group: head
X-SVN-Commit-Author: erj
X-SVN-Commit-Paths: head/sys/net
X-SVN-Commit-Revision: 350507
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:28:37 -0000

Author: erj
Date: Thu Aug  1 17:28:36 2019
New Revision: 350507
URL: https://svnweb.freebsd.org/changeset/base/350507

Log:
  iflib: remove kobject class reference increment
  
  Commit message from Jake:
  In iflib_register, the context is initialized as a kobject using the
  device driver's "driver" kobject class. As part of this, the function
  mistakenly increments the ref counter.
  
  The ref counter is incremented twice, once in the code directly, and
  once again by kobj_class_compile. However, there is no associated
  decrement in the detach path. Because of this, the ref counter will
  never go back down to zero, and thus the kobject method table will never
  be released.
  
  Remove this unnecessary reference count increment.
  
  Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
  
  Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
  Reviewed by:	jhb@, erj@
  MFC after:	3 days
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D21125

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Thu Aug  1 17:02:58 2019	(r350506)
+++ head/sys/net/iflib.c	Thu Aug  1 17:28:36 2019	(r350507)
@@ -5342,7 +5342,6 @@ iflib_register(if_ctx_t ctx)
 	 */
 	kobj_init((kobj_t) ctx, (kobj_class_t) driver);
 	kobj_class_compile((kobj_class_t) driver);
-	driver->refs++;
 
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 	if_setsoftc(ifp, ctx);

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:36:16 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E56AC35CA;
 Thu,  1 Aug 2019 17:36:16 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zyBl6cB2z3ym2;
 Thu,  1 Aug 2019 17:36:15 +0000 (UTC)
 (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C47411DC5A;
 Thu,  1 Aug 2019 17:36:15 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71HaFqB052396;
 Thu, 1 Aug 2019 17:36:15 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71HaFWY052395;
 Thu, 1 Aug 2019 17:36:15 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201908011736.x71HaFWY052395@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Thu, 1 Aug 2019 17:36:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350508 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350508
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:36:16 -0000

Author: tuexen
Date: Thu Aug  1 17:36:15 2019
New Revision: 350508
URL: https://svnweb.freebsd.org/changeset/base/350508

Log:
  When responding with an ABORT to an INIT chunk containing a
  HOSTNAME parameter or a parameter with an illegal length, only
  include an error cause indicating why the ABORT was sent.
  This also fixes an mbuf leak which could occur.
  
  MFC after:		3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Aug  1 17:28:36 2019	(r350507)
+++ head/sys/netinet/sctp_output.c	Thu Aug  1 17:36:15 2019	(r350508)
@@ -5115,55 +5115,42 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_
 			break;
 		case SCTP_HOSTNAME_ADDRESS:
 			{
-				/* We can NOT handle HOST NAME addresses!! */
+				/* Hostname parameters are deprecated. */
+				struct sctp_gen_error_cause *cause;
 				int l_len;
 
 				SCTPDBG(SCTP_DEBUG_OUTPUT1, "Can't handle hostname addresses.. abort processing\n");
 				*abort_processing = 1;
-				if (op_err == NULL) {
-					/* Ok need to try to get a mbuf */
+				sctp_m_freem(op_err);
+				op_err = NULL;
 #ifdef INET6
-					l_len = SCTP_MIN_OVERHEAD;
+				l_len = SCTP_MIN_OVERHEAD;
 #else
-					l_len = SCTP_MIN_V4_OVERHEAD;
+				l_len = SCTP_MIN_V4_OVERHEAD;
 #endif
-					l_len += sizeof(struct sctp_chunkhdr);
-					l_len += sizeof(struct sctp_gen_error_cause);
-					op_err = sctp_get_mbuf_for_msg(l_len, 0, M_NOWAIT, 1, MT_DATA);
-					if (op_err) {
-						SCTP_BUF_LEN(op_err) = 0;
-						/*
-						 * Pre-reserve space for IP,
-						 * SCTP, and chunk header.
-						 */
+				l_len += sizeof(struct sctp_chunkhdr);
+				l_len += sizeof(struct sctp_gen_error_cause);
+				op_err = sctp_get_mbuf_for_msg(l_len, 0, M_NOWAIT, 1, MT_DATA);
+				if (op_err) {
+					/*
+					 * Pre-reserve space for IP, SCTP,
+					 * and chunk header.
+					 */
 #ifdef INET6
-						SCTP_BUF_RESV_UF(op_err, sizeof(struct ip6_hdr));
+					SCTP_BUF_RESV_UF(op_err, sizeof(struct ip6_hdr));
 #else
-						SCTP_BUF_RESV_UF(op_err, sizeof(struct ip));
+					SCTP_BUF_RESV_UF(op_err, sizeof(struct ip));
 #endif
-						SCTP_BUF_RESV_UF(op_err, sizeof(struct sctphdr));
-						SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr));
-					}
-				}
-				if (op_err) {
-					/* If we have space */
-					struct sctp_gen_error_cause cause;
-
-					if (err_at % 4) {
-						uint32_t cpthis = 0;
-
-						pad_needed = 4 - (err_at % 4);
-						m_copyback(op_err, err_at, pad_needed, (caddr_t)&cpthis);
-						err_at += pad_needed;
-					}
-					cause.code = htons(SCTP_CAUSE_UNRESOLVABLE_ADDR);
-					cause.length = htons((uint16_t)(sizeof(struct sctp_gen_error_cause) + plen));
-					m_copyback(op_err, err_at, sizeof(struct sctp_gen_error_cause), (caddr_t)&cause);
-					err_at += sizeof(struct sctp_gen_error_cause);
+					SCTP_BUF_RESV_UF(op_err, sizeof(struct sctphdr));
+					SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr));
+					SCTP_BUF_LEN(op_err) = sizeof(struct sctp_gen_error_cause);
+					cause = mtod(op_err, struct sctp_gen_error_cause *);
+					cause->code = htons(SCTP_CAUSE_UNRESOLVABLE_ADDR);
+					cause->length = htons((uint16_t)(sizeof(struct sctp_gen_error_cause) + plen));
 					SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(mat, at, plen, M_NOWAIT);
 					if (SCTP_BUF_NEXT(op_err) == NULL) {
 						sctp_m_freem(op_err);
-						return (NULL);
+						op_err = NULL;
 					}
 				}
 				return (op_err);
@@ -5250,7 +5237,10 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_
 invalid_size:
 	SCTPDBG(SCTP_DEBUG_OUTPUT1, "abort flag set\n");
 	*abort_processing = 1;
-	if ((op_err == NULL) && phdr) {
+	sctp_m_freem(op_err);
+	op_err = NULL;
+	if (phdr != NULL) {
+		struct sctp_paramhdr *param;
 		int l_len;
 #ifdef INET6
 		l_len = SCTP_MIN_OVERHEAD;
@@ -5269,24 +5259,14 @@ invalid_size:
 #endif
 			SCTP_BUF_RESV_UF(op_err, sizeof(struct sctphdr));
 			SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr));
+			SCTP_BUF_LEN(op_err) = 2 * sizeof(struct sctp_paramhdr);
+			param = mtod(op_err, struct sctp_paramhdr *);
+			param->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
+			param->param_length = htons(2 * sizeof(struct sctp_paramhdr));
+			param++;
+			param->param_type = htons(ptype);
+			param->param_length = htons(plen);
 		}
-	}
-	if ((op_err) && phdr) {
-		struct sctp_paramhdr s;
-
-		if (err_at % 4) {
-			uint32_t cpthis = 0;
-
-			pad_needed = 4 - (err_at % 4);
-			m_copyback(op_err, err_at, pad_needed, (caddr_t)&cpthis);
-			err_at += pad_needed;
-		}
-		s.param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
-		s.param_length = htons(sizeof(s) + sizeof(struct sctp_paramhdr));
-		m_copyback(op_err, err_at, sizeof(s), (caddr_t)&s);
-		err_at += sizeof(s);
-		/* Only copy back the p-hdr that caused the issue */
-		m_copyback(op_err, err_at, sizeof(struct sctp_paramhdr), (caddr_t)phdr);
 	}
 	return (op_err);
 }

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:37:25 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C93D8C3661;
 Thu,  1 Aug 2019 17:37:25 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zyD54wzhz3yv0;
 Thu,  1 Aug 2019 17:37:25 +0000 (UTC) (envelope-from erj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AF521DC5D;
 Thu,  1 Aug 2019 17:37:25 +0000 (UTC) (envelope-from erj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71HbPOV052497;
 Thu, 1 Aug 2019 17:37:25 GMT (envelope-from erj@FreeBSD.org)
Received: (from erj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71HbPOe052496;
 Thu, 1 Aug 2019 17:37:25 GMT (envelope-from erj@FreeBSD.org)
Message-Id: <201908011737.x71HbPOe052496@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org
 using -f
From: Eric Joyner <erj@FreeBSD.org>
Date: Thu, 1 Aug 2019 17:37:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350509 - head/sys/net
X-SVN-Group: head
X-SVN-Commit-Author: erj
X-SVN-Commit-Paths: head/sys/net
X-SVN-Commit-Revision: 350509
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:37:25 -0000

Author: erj
Date: Thu Aug  1 17:37:25 2019
New Revision: 350509
URL: https://svnweb.freebsd.org/changeset/base/350509

Log:
  iflib: Prevent kernel panic caused by loading driver with a specific interrupt configuration
  
  If a device has only 1 MSI-X interrupt available and does not support either
  MSI or legacy interrupts, iflib_device_register() will fail, leak memory and
  MSI resources, and the driver will not load. Worse, if another iflib-using
  driver tries to unload afterwards, a kernel panic will occur because the
  previous failed iflib driver loead did not properly call "taskqgroup_detach()"
  during it's cleanup.
  
  This patch is band-aid for this situation -- don't try allocating MSI or legacy
  interrupts if a single MSI-X interrupt was allocated, but fail to load instead.
  As well, during the cleanup, properly call taskqgroup_detach() on the admin
  task to prevent panics when other iflib drivers unload.
  
  This whole interrupt allocation process actually needs re-doing to properly
  support devices with only a single MSI-X interrupt, devices that only support
  MSI-X, non-PCI devices, and multiple non-MSIX interrupts, as well.
  
  Signed-off-by: Eric Joyner <erj@freebsd.org>
  
  Reviewed by:	marius@
  MFC after:	1 week
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D20747

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Thu Aug  1 17:36:15 2019	(r350508)
+++ head/sys/net/iflib.c	Thu Aug  1 17:37:25 2019	(r350509)
@@ -4731,7 +4731,7 @@ iflib_device_register(device_t dev, void *sc, if_share
 			    err);
 			goto fail_queues;
 		}
-	} else {
+	} else if (scctx->isc_intr != IFLIB_INTR_MSIX) {
 		rid = 0;
 		if (scctx->isc_intr == IFLIB_INTR_MSI) {
 			MPASS(msix == 1);
@@ -4741,6 +4741,11 @@ iflib_device_register(device_t dev, void *sc, if_share
 			device_printf(dev, "iflib_legacy_setup failed %d\n", err);
 			goto fail_queues;
 		}
+	} else {
+		device_printf(dev,
+		    "Cannot use iflib with only 1 MSI-X interrupt!\n");
+		err = ENODEV;
+		goto fail_intr_free;
 	}
 
 	ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac.octet);
@@ -4781,6 +4786,7 @@ fail_intr_free:
 fail_queues:
 	iflib_tx_structures_free(ctx);
 	iflib_rx_structures_free(ctx);
+	taskqgroup_detach(qgroup_if_config_tqg, &ctx->ifc_admin_task);
 	IFDI_DETACH(ctx);
 fail_unlock:
 	CTX_UNLOCK(ctx);

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:39:16 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E402BC372E;
 Thu,  1 Aug 2019 17:39:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "smtp.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zyGD5lmXz404n;
 Thu,  1 Aug 2019 17:39:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx
 [66.234.199.215])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate) (Authenticated sender: jhb)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 148BD14B96;
 Thu,  1 Aug 2019 17:39:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
To: Ed Maste <emaste@freebsd.org>, "Rodney W. Grimes" <rgrimes@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
References: <CAPyFy2BpPbQ+XynADKzeraVnLXPuzm-ohM7uigMc-7S6Ly4YXA@mail.gmail.com>
 <201908011650.x71GoxBe060563@gndrsh.dnsmgr.net>
 <CAPyFy2Bj=2gaeXMA1AsFLX2=vmUjW2sEa9ugN00AzvAjqvZouw@mail.gmail.com>
From: John Baldwin <jhb@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=jhb@FreeBSD.org; keydata=
 mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0
 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo
 /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD
 /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X
 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z
 pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1
 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k
 do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk
 d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID
 AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM
 jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3
 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj
 XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH
 YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO
 EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz
 hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX
 sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16
 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH
 aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx
 Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I
 SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf
 afMAg8QvmOWnHx3wl8WslCaXaE8=
Message-ID: <a430daff-5ef8-ef7c-24e9-3ebde76ae7e1@FreeBSD.org>
Date: Thu, 1 Aug 2019 10:39:11 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0)
 Gecko/20100101 Thunderbird/60.7.1
MIME-Version: 1.0
In-Reply-To: <CAPyFy2Bj=2gaeXMA1AsFLX2=vmUjW2sEa9ugN00AzvAjqvZouw@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:39:17 -0000

On 7/31/19 8:13 PM, Ed Maste wrote:
> On Thu, 1 Aug 2019 at 12:51, Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net> wrote:
>>
>> That would be fine, the important thing is that the
>> r350505 gets listed in the file,
> 
> I don't see any reason that r350505 specifically should be in a
> release note - this is a minor clarification of an existing
> deprecation notice. It seems having an overall "deprecation notices"
> section in the release notes would make sense, but they should really
> persist from version to version. Should we add a top-level
> DEPRECATION_NOTICES file perhaps? Or tag deprecation notices with some
> sort of comment in the source so they can be found with a 'grep'
> during release preparation?

I think it would make sense to have "sections" in RELNOTES that mimic
the sections we have in the existing release notes (e.g. kernel vs
userland).  That is effectively what GDB does with a top level NEWS
file.  This approach would hopefully make it easier to translate this
file into the real release notes.  It also means that a given "note"
can evolve over time (e.g. it might start with "XYZ is deprecated" to
"XYZ is removed" if a deprecation note is added and merged and later it
is removed) rather than only having a running journal ala UPDATING.

On the question of whether we want a dedicated section just for
deprecation notices, I'm not sure.  Probably we can just stick with the
layout of our existing release notes?

-- 
John Baldwin

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:45:48 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2300C3AF6;
 Thu,  1 Aug 2019 17:45:48 +0000 (UTC)
 (envelope-from jkim@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zyPm51g2z40kY;
 Thu,  1 Aug 2019 17:45:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DA2D1DE27;
 Thu,  1 Aug 2019 17:45:48 +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 x71HjmNX058382;
 Thu, 1 Aug 2019 17:45:48 GMT (envelope-from jkim@FreeBSD.org)
Received: (from jkim@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71HjhAC058358;
 Thu, 1 Aug 2019 17:45:43 GMT (envelope-from jkim@FreeBSD.org)
Message-Id: <201908011745.x71HjhAC058358@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jkim set sender to
 jkim@FreeBSD.org using -f
From: Jung-uk Kim <jkim@FreeBSD.org>
Date: Thu, 1 Aug 2019 17:45:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350510 - in head/sys/contrib/dev/acpica: . compiler
 components/dispatcher components/events components/executer
 components/namespace components/tables components/utilities include
X-SVN-Group: head
X-SVN-Commit-Author: jkim
X-SVN-Commit-Paths: in head/sys/contrib/dev/acpica: . compiler
 components/dispatcher components/events components/executer
 components/namespace components/tables components/utilities include
X-SVN-Commit-Revision: 350510
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:45:48 -0000

Author: jkim
Date: Thu Aug  1 17:45:43 2019
New Revision: 350510
URL: https://svnweb.freebsd.org/changeset/base/350510

Log:
  Revert r349863 (ACPICA 20190703).
  
  This commit caused boot failures on some systems.
  
  Requested by:	scottl

Modified:
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/aslload.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.h
  head/sys/contrib/dev/acpica/compiler/aslstubs.c
  head/sys/contrib/dev/acpica/compiler/aslsupport.l
  head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
  head/sys/contrib/dev/acpica/components/events/evgpe.c
  head/sys/contrib/dev/acpica/components/events/evgpeblk.c
  head/sys/contrib/dev/acpica/components/events/evxface.c
  head/sys/contrib/dev/acpica/components/events/evxfgpe.c
  head/sys/contrib/dev/acpica/components/executer/exconfig.c
  head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
  head/sys/contrib/dev/acpica/components/namespace/nseval.c
  head/sys/contrib/dev/acpica/components/namespace/nsinit.c
  head/sys/contrib/dev/acpica/components/namespace/nsload.c
  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
  head/sys/contrib/dev/acpica/components/tables/tbdata.c
  head/sys/contrib/dev/acpica/components/tables/tbxfload.c
  head/sys/contrib/dev/acpica/components/utilities/utinit.c
  head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
  head/sys/contrib/dev/acpica/include/acevents.h
  head/sys/contrib/dev/acpica/include/acglobal.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
  head/sys/contrib/dev/acpica/include/acpixf.h

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/changes.txt	Thu Aug  1 17:45:43 2019	(r350510)
@@ -1,53 +1,4 @@
 ----------------------------------------
-03 July 2019. Summary of changes for version 20190703:
-
-
-1) ACPICA kernel-resident subsystem:
-
-Remove legacy module-level support code. There were still some remnants 
-of the legacy module-level code executions. Since we no longer support 
-this option, this is essentially dead code and has been removed from the 
-ACPICA source.
-
-iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root 
-scope. If these named objects are declared outside the root scope, they 
-will not be invoked by any host Operating System.
-
-Clear status of GPEs on first direct enable. ACPI GPEs (other than the EC 
-one) can be enabled in two situations. First, the GPEs with existing _Lxx 
-and _Exx methods are enabled implicitly by ACPICA during system 
-initialization.  Second, the GPEs without these methods (like GPEs listed 
-by _PRW objects for wakeup devices) need to be enabled directly by the 
-code that is going to use them (e.g. ACPI power management or device 
-drivers).
-
-In the former case, if the status of a given GPE is set to start with, 
-its handler method (either _Lxx or _Exx) needs to be invoked to take care 
-of the events (possibly) signaled before the GPE was enabled. In the 
-latter case, however, the first caller of AcpiEnableGpe() for a given GPE 
-should not be expected to care about any events that might be signaled 
-through it earlier.  In that case, it is better to clear the status of 
-the GPE before enabling it, to prevent stale events from triggering 
-unwanted actions (like spurious system resume, for example).
-
-For this reason, modify AcpiEvAddGpeReference() to take an additional 
-boolean argument indicating whether or not the GPE status needs to be 
-cleared when its reference counter changes from zero to one and make 
-AcpiEnableGpe() pass TRUE to it through that new argument.
-
-
-2) iASL Compiler/Disassembler and ACPICA tools:
-
-The tool generation process has been migrated to MSVC 2017, and all 
-project files have been upgraded. The new project files appear in the 
-directory \acpica\generate\msvc2017. This change effectively deprecates 
-the older project files in \acpica\generate\msvc9.
-
-iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root 
-scope. If these named objects are declared outside the root scope, they 
-will not be invoked by any host Operating System
-
-----------------------------------------
 09 May 2019. Summary of changes for version 20190509:
 
 

Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asldefine.h	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Thu Aug  1 17:45:43 2019	(r350510)
@@ -298,20 +298,4 @@
 #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
 #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
 
-/*
- * Special name segments - these must only be declared at the root scope
- */
-#define NAMESEG__PTS    "_PTS"
-#define NAMESEG__WAK    "_WAK"
-#define NAMESEG__S0     "_S0_"
-#define NAMESEG__S1     "_S1_"
-#define NAMESEG__S2     "_S2_"
-#define NAMESEG__S3     "_S3_"
-#define NAMESEG__S4     "_S4_"
-#define NAMESEG__S5     "_S5_"
-#define NAMESEG__TTS    "_TTS"
-
-#define MAX_SPECIAL_NAMES      9
-
-
 #endif /* ASLDEFINE.H */

Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Thu Aug  1 17:45:43 2019	(r350510)
@@ -223,26 +223,11 @@ const char                          *AslGbl_OpFlagName
     "OP_NOT_FOUND_DURING_LOAD"
 };
 
-const char                          *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] =
-{
-    NAMESEG__PTS,
-    NAMESEG__WAK,
-    NAMESEG__S0,
-    NAMESEG__S1,
-    NAMESEG__S2,
-    NAMESEG__S3,
-    NAMESEG__S4,
-    NAMESEG__S5,
-    NAMESEG__TTS
-};
-
 #else
 extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
 extern UINT32                       AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
 extern const char                   *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
-extern const char                   *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES];
 #endif
-
 
 
 /*

Modified: head/sys/contrib/dev/acpica/compiler/aslload.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslload.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/compiler/aslload.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -164,7 +164,6 @@
 
 static ACPI_STATUS
 LdLoadFieldElements (
-    UINT32                  AmlType,
     ACPI_PARSE_OBJECT       *Op,
     ACPI_WALK_STATE         *WalkState);
 
@@ -191,10 +190,6 @@ LdCommonNamespaceEnd (
     UINT32                  Level,
     void                    *Context);
 
-static void
-LdCheckSpecialNames (
-    ACPI_NAMESPACE_NODE     *Node,
-    ACPI_PARSE_OBJECT       *Op);
 
 /*******************************************************************************
  *
@@ -252,8 +247,7 @@ LdLoadNamespace (
  *
  * FUNCTION:    LdLoadFieldElements
  *
- * PARAMETERS:  AmlType         - Type to search
- *              Op              - Parent node (Field)
+ * PARAMETERS:  Op              - Parent node (Field)
  *              WalkState       - Current walk state
  *
  * RETURN:      Status
@@ -265,7 +259,6 @@ LdLoadNamespace (
 
 static ACPI_STATUS
 LdLoadFieldElements (
-    UINT32                  AmlType,
     ACPI_PARSE_OBJECT       *Op,
     ACPI_WALK_STATE         *WalkState)
 {
@@ -281,7 +274,7 @@ LdLoadFieldElements (
     {
         Status = AcpiNsLookup (WalkState->ScopeInfo,
             SourceRegion->Asl.Value.String,
-            AmlType, ACPI_IMODE_EXECUTE,
+            ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
             ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
         if (Status == AE_NOT_FOUND)
         {
@@ -514,15 +507,11 @@ LdNamespace1Begin (
      */
     switch (Op->Asl.AmlOpcode)
     {
-    case AML_INDEX_FIELD_OP:
-
-        Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState);
-        return (Status);
-
     case AML_BANK_FIELD_OP:
+    case AML_INDEX_FIELD_OP:
     case AML_FIELD_OP:
 
-        Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState);
+        Status = LdLoadFieldElements (Op, WalkState);
         return (Status);
 
     case AML_INT_CONNECTION_OP:
@@ -977,10 +966,6 @@ LdNamespace1Begin (
         }
     }
 
-    /* Check special names like _WAK and _PTS */
-
-    LdCheckSpecialNames (Node, Op);
-
     if (ForceNewScope)
     {
         Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
@@ -1016,42 +1001,6 @@ FinishNode:
     }
 
     return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    LdCheckSpecialNames
- *
- * PARAMETERS:  Node        - Node that represents the named object
- *              Op          - Named object declaring this named object
- *
- * RETURN:      None
- *
- * DESCRIPTION: Check if certain named objects are declared in the incorrect
- *              scope. Special named objects are listed in
- *              AslGbl_SpecialNamedObjects and can only be declared at the root
- *              scope.
- *
- ******************************************************************************/
-
-static void
-LdCheckSpecialNames (
-    ACPI_NAMESPACE_NODE     *Node,
-    ACPI_PARSE_OBJECT       *Op)
-{
-    UINT32                  i;
-
-
-    for (i = 0; i < MAX_SPECIAL_NAMES; i++)
-    {
-        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) &&
-            Node->Parent != AcpiGbl_RootNode)
-        {
-            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName);
-            return;
-        }
-    }
 }
 
 

Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmessages.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/compiler/aslmessages.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -365,8 +365,7 @@ const char                      *AslCompilerMsgs [] =
 /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
 /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
 /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
-/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
-/*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal"
+/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */        "Buffer field extends beyond end of target buffer"
 };
 
 /* Table compiler */

Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmessages.h	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/compiler/aslmessages.h	Thu Aug  1 17:45:43 2019	(r350510)
@@ -368,7 +368,6 @@ typedef enum
     ASL_MSG_TEMPORARY_OBJECT,
     ASL_MSG_UNDEFINED_EXTERNAL,
     ASL_MSG_BUFFER_FIELD_OVERFLOW,
-    ASL_MSG_INVALID_SPECIAL_NAME,
 
     /* These messages are used by the Data Table compiler only */
 

Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslstubs.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/compiler/aslstubs.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -166,6 +166,12 @@
  * Things like Events, Global Lock, etc. are not used
  * by the compiler, so they are stubbed out here.
  */
+void
+AcpiNsExecModuleCodeList (
+    void)
+{
+}
+
 ACPI_STATUS
 AcpiNsInitializeObjects (
     void)

Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslsupport.l	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/compiler/aslsupport.l	Thu Aug  1 17:45:43 2019	(r350510)
@@ -220,7 +220,7 @@ AslDoLineDirective (
 
     while ((c = input()) != '\n' && c != EOF)
     {
-        *AslGbl_LineBufPtr = (char) c;
+        *AslGbl_LineBufPtr = c;
         AslGbl_LineBufPtr++;
     }
     *AslGbl_LineBufPtr = 0;
@@ -498,7 +498,7 @@ AslInsertLineBuffer (
 
         if (AcpiGbl_CaptureComments)
         {
-            CvProcessCommentState ((char) SourceChar);
+            CvProcessCommentState (SourceChar);
         }
     }
 }
@@ -601,7 +601,7 @@ loop:
         AslInsertLineBuffer (c);
         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
         {
-            *StringBuffer = (char) c;
+            *StringBuffer = c;
             ++StringBuffer;
         }
         c1 = c;
@@ -629,7 +629,7 @@ loop:
     AslInsertLineBuffer (c);
     if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
     {
-        *StringBuffer = (char) c;
+        *StringBuffer = c;
         ++StringBuffer;
     }
 
@@ -720,7 +720,7 @@ AslDoCommentType2 (
         AslInsertLineBuffer (c);
         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
         {
-            *StringBuffer = (char) c;
+            *StringBuffer = c;
             ++StringBuffer;
         }
     }
@@ -878,7 +878,7 @@ DoCharacter:
                 if (ACPI_IS_OCTAL_DIGIT (StringChar))
                 {
                     State = ASL_OCTAL_CONSTANT;
-                    ConvertBuffer[0] = (char) StringChar;
+                    ConvertBuffer[0] = StringChar;
                     i = 1;
                     continue;
                 }
@@ -934,7 +934,7 @@ DoCharacter:
 
             /* Append another digit of the constant */
 
-            ConvertBuffer[i] = (char) StringChar;
+            ConvertBuffer[i] = StringChar;
             i++;
             continue;
 
@@ -978,7 +978,7 @@ DoCharacter:
 
             /* Append another digit of the constant */
 
-            ConvertBuffer[i] = (char) StringChar;
+            ConvertBuffer[i] = StringChar;
             i++;
             continue;
 
@@ -989,7 +989,7 @@ DoCharacter:
 
         /* Save the finished character */
 
-        *StringBuffer = (char) StringChar;
+        *StringBuffer = StringChar;
         StringBuffer++;
         if (StringBuffer >= EndBuffer)
         {

Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -362,7 +362,7 @@ AcpiDsInitializeObjects (
     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
     {
         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-            "\nACPI table initialization:\n"));
+            "\nInitializing Namespace objects:\n"));
     }
 
     /* Summary of objects initialized */

Modified: head/sys/contrib/dev/acpica/components/events/evgpe.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evgpe.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/events/evgpe.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -316,7 +316,6 @@ AcpiEvMaskGpe (
  * FUNCTION:    AcpiEvAddGpeReference
  *
  * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
- *              ClearOnEnable           - Clear GPE status before enabling it
  *
  * RETURN:      Status
  *
@@ -327,8 +326,7 @@ AcpiEvMaskGpe (
 
 ACPI_STATUS
 AcpiEvAddGpeReference (
-    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
-    BOOLEAN                 ClearOnEnable)
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
 {
     ACPI_STATUS             Status = AE_OK;
 
@@ -345,11 +343,6 @@ AcpiEvAddGpeReference (
     if (GpeEventInfo->RuntimeCount == 1)
     {
         /* Enable on first reference */
-
-        if (ClearOnEnable)
-        {
-            (void) AcpiHwClearGpe (GpeEventInfo);
-        }
 
         Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
         if (ACPI_SUCCESS (Status))

Modified: head/sys/contrib/dev/acpica/components/events/evgpeblk.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock (
                 continue;
             }
 
-            Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE);
+            Status = AcpiEvAddGpeReference (GpeEventInfo);
             if (ACPI_FAILURE (Status))
             {
                 ACPI_EXCEPTION ((AE_INFO, Status,

Modified: head/sys/contrib/dev/acpica/components/events/evxface.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evxface.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/events/evxface.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler (
             ACPI_GPE_DISPATCH_NOTIFY)) &&
         Handler->OriginallyEnabled)
     {
-        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
+        (void) AcpiEvAddGpeReference (GpeEventInfo);
         if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
         {
             /* Poll edge triggered GPEs to handle existing events */

Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -267,7 +267,7 @@ AcpiEnableGpe (
         if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
             ACPI_GPE_DISPATCH_NONE)
         {
-            Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE);
+            Status = AcpiEvAddGpeReference (GpeEventInfo);
             if (ACPI_SUCCESS (Status) &&
                 ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
             {

Modified: head/sys/contrib/dev/acpica/components/executer/exconfig.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/executer/exconfig.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/executer/exconfig.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -342,9 +342,10 @@ AcpiExLoadTableOp (
         return_ACPI_STATUS (Status);
     }
 
-    /* Complete the initialization/resolution of new objects */
+    /* Complete the initialization/resolution of package objects */
 
-    AcpiNsInitializeObjects ();
+    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
+        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
 
     /* Parameter Data (optional) */
 
@@ -619,11 +620,10 @@ AcpiExLoadOp (
         return_ACPI_STATUS (Status);
     }
 
-    /* Complete the initialization/resolution of new objects */
+    /* Complete the initialization/resolution of package objects */
 
-    AcpiExExitInterpreter ();
-    AcpiNsInitializeObjects ();
-    AcpiExEnterInterpreter ();
+    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
+        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
 
     /* Store the DdbHandle into the Target operand */
 

Modified: head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -184,7 +184,6 @@ AcpiNsRootInitialize (
     ACPI_STATUS                 Status;
     const ACPI_PREDEFINED_NAMES *InitVal = NULL;
     ACPI_NAMESPACE_NODE         *NewNode;
-    ACPI_NAMESPACE_NODE         *PrevNode = NULL;
     ACPI_OPERAND_OBJECT         *ObjDesc;
     ACPI_STRING                 Val = NULL;
 
@@ -214,30 +213,13 @@ AcpiNsRootInitialize (
      */
     AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
 
-    /* Enter the predefined names in the name table */
+    /* Enter the pre-defined names in the name table */
 
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
         "Entering predefined entries into namespace\n"));
 
-    /*
-     * Create the initial (default) namespace.
-     * This namespace looks like something similar to this:
-     *
-     *   ACPI Namespace (from Namespace Root):
-     *    0  _GPE Scope        00203160 00
-     *    0  _PR_ Scope        002031D0 00
-     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
-     *    0  _SI_ Scope        002032B0 00
-     *    0  _TZ_ Device       00203320 00
-     *    0  _REV Integer      00203390 00 = 0000000000000002
-     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
-     *    0  _GL_ Mutex        00203580 00 Object 002035F0
-     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
-     */
     for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
     {
-        Status = AE_OK;
-
         /* _OSI is optional for now, will be permanent later */
 
         if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
@@ -245,35 +227,17 @@ AcpiNsRootInitialize (
             continue;
         }
 
-        /*
-         * Create, init, and link the new predefined name
-         * Note: No need to use AcpiNsLookup here because all the
-         * predefined names are at the root level. It is much easier to
-         * just create and link the new node(s) here.
-         */
-        NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE));
-        if (!NewNode)
+        Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name),
+            InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
+            NULL, &NewNode);
+        if (ACPI_FAILURE (Status))
         {
-            Status = AE_NO_MEMORY;
-            goto UnlockAndExit;
+            ACPI_EXCEPTION ((AE_INFO, Status,
+                "Could not create predefined name %s",
+                InitVal->Name));
+            continue;
         }
 
-        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
-        NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED;
-        NewNode->Type = InitVal->Type;
-
-        if (!PrevNode)
-        {
-            AcpiGbl_RootNodeStruct.Child = NewNode;
-        }
-        else
-        {
-            PrevNode->Peer = NewNode;
-        }
-
-        NewNode->Parent = &AcpiGbl_RootNodeStruct;
-        PrevNode = NewNode;
-
         /*
          * Name entered successfully. If entry in PreDefinedNames[] specifies
          * an initial value, create the initial value.
@@ -322,7 +286,7 @@ AcpiNsRootInitialize (
 
                 NewNode->Value = ObjDesc->Method.ParamCount;
 #else
-                /* Mark this as a very SPECIAL method (_OSI) */
+                /* Mark this as a very SPECIAL method */
 
                 ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY;
                 ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation;
@@ -394,6 +358,7 @@ AcpiNsRootInitialize (
             AcpiUtRemoveReference (ObjDesc);
         }
     }
+
 
 UnlockAndExit:
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);

Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nseval.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/namespace/nseval.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -160,7 +160,14 @@
 #define _COMPONENT          ACPI_NAMESPACE
         ACPI_MODULE_NAME    ("nseval")
 
+/* Local prototypes */
 
+static void
+AcpiNsExecModuleCode (
+    ACPI_OPERAND_OBJECT     *MethodObj,
+    ACPI_EVALUATE_INFO      *Info);
+
+
 /*******************************************************************************
  *
  * FUNCTION:    AcpiNsEvaluate
@@ -457,4 +464,207 @@ Cleanup:
     ACPI_FREE (Info->FullPathname);
     Info->FullPathname = NULL;
     return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsExecModuleCodeList
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None. Exceptions during method execution are ignored, since
+ *              we cannot abort a table load.
+ *
+ * DESCRIPTION: Execute all elements of the global module-level code list.
+ *              Each element is executed as a single control method.
+ *
+ * NOTE: With this option enabled, each block of detected executable AML
+ * code that is outside of any control method is wrapped with a temporary
+ * control method object and placed on a global list. The methods on this
+ * list are executed below.
+ *
+ * This function executes the module-level code for all tables only after
+ * all of the tables have been loaded. It is a legacy option and is
+ * not compatible with other ACPI implementations. See AcpiNsLoadTable.
+ *
+ * This function will be removed when the legacy option is removed.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsExecModuleCodeList (
+    void)
+{
+    ACPI_OPERAND_OBJECT     *Prev;
+    ACPI_OPERAND_OBJECT     *Next;
+    ACPI_EVALUATE_INFO      *Info;
+    UINT32                  MethodCount = 0;
+
+
+    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
+
+
+    /* Exit now if the list is empty */
+
+    Next = AcpiGbl_ModuleCodeList;
+    if (!Next)
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
+            "Legacy MLC block list is empty\n"));
+
+        return_VOID;
+    }
+
+    /* Allocate the evaluation information block */
+
+    Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
+    if (!Info)
+    {
+        return_VOID;
+    }
+
+    /* Walk the list, executing each "method" */
+
+    while (Next)
+    {
+        Prev = Next;
+        Next = Next->Method.Mutex;
+
+        /* Clear the link field and execute the method */
+
+        Prev->Method.Mutex = NULL;
+        AcpiNsExecModuleCode (Prev, Info);
+        MethodCount++;
+
+        /* Delete the (temporary) method object */
+
+        AcpiUtRemoveReference (Prev);
+    }
+
+    ACPI_INFO ((
+        "Executed %u blocks of module-level executable AML code",
+        MethodCount));
+
+    ACPI_FREE (Info);
+    AcpiGbl_ModuleCodeList = NULL;
+    return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsExecModuleCode
+ *
+ * PARAMETERS:  MethodObj           - Object container for the module-level code
+ *              Info                - Info block for method evaluation
+ *
+ * RETURN:      None. Exceptions during method execution are ignored, since
+ *              we cannot abort a table load.
+ *
+ * DESCRIPTION: Execute a control method containing a block of module-level
+ *              executable AML code. The control method is temporarily
+ *              installed to the root node, then evaluated.
+ *
+ ******************************************************************************/
+
+static void
+AcpiNsExecModuleCode (
+    ACPI_OPERAND_OBJECT     *MethodObj,
+    ACPI_EVALUATE_INFO      *Info)
+{
+    ACPI_OPERAND_OBJECT     *ParentObj;
+    ACPI_NAMESPACE_NODE     *ParentNode;
+    ACPI_OBJECT_TYPE        Type;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (NsExecModuleCode);
+
+
+    /*
+     * Get the parent node. We cheat by using the NextObject field
+     * of the method object descriptor.
+     */
+    ParentNode = ACPI_CAST_PTR (
+        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
+    Type = AcpiNsGetType (ParentNode);
+
+    /*
+     * Get the region handler and save it in the method object. We may need
+     * this if an operation region declaration causes a _REG method to be run.
+     *
+     * We can't do this in AcpiPsLinkModuleCode because
+     * AcpiGbl_RootNode->Object is NULL at PASS1.
+     */
+    if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
+    {
+        MethodObj->Method.Dispatch.Handler =
+            ParentNode->Object->Device.Handler;
+    }
+
+    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
+
+    MethodObj->Method.NextObject = NULL;
+
+    /* Initialize the evaluation information block */
+
+    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
+    Info->PrefixNode = ParentNode;
+
+    /*
+     * Get the currently attached parent object. Add a reference,
+     * because the ref count will be decreased when the method object
+     * is installed to the parent node.
+     */
+    ParentObj = AcpiNsGetAttachedObject (ParentNode);
+    if (ParentObj)
+    {
+        AcpiUtAddReference (ParentObj);
+    }
+
+    /* Install the method (module-level code) in the parent node */
+
+    Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD);
+    if (ACPI_FAILURE (Status))
+    {
+        goto Exit;
+    }
+
+    /* Execute the parent node as a control method */
+
+    Status = AcpiNsEvaluate (Info);
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
+        "Executed module-level code at %p\n",
+        MethodObj->Method.AmlStart));
+
+    /* Delete a possible implicit return value (in slack mode) */
+
+    if (Info->ReturnObject)
+    {
+        AcpiUtRemoveReference (Info->ReturnObject);
+    }
+
+    /* Detach the temporary method object */
+
+    AcpiNsDetachObject (ParentNode);
+
+    /* Restore the original parent object */
+
+    if (ParentObj)
+    {
+        Status = AcpiNsAttachObject (ParentNode, ParentObj, Type);
+    }
+    else
+    {
+        ParentNode->Type = (UINT8) Type;
+    }
+
+Exit:
+    if (ParentObj)
+    {
+        AcpiUtRemoveReference (ParentObj);
+    }
+    return_VOID;
 }

Modified: head/sys/contrib/dev/acpica/components/namespace/nsinit.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -212,30 +212,29 @@ AcpiNsInitializeObjects (
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
         "**** Starting initialization of namespace objects ****\n"));
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "Final data object initialization: "));
+        "Completing Region/Field/Buffer/Package initialization:\n"));
 
-    /* Clear the info block */
+    /* Set all init info to zero */
 
     memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
 
     /* Walk entire namespace from the supplied root */
 
-    /*
-     * TBD: will become ACPI_TYPE_PACKAGE as this type object
-     * is now the only one that supports deferred initialization
-     * (forward references).
-     */
     Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
+        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
+        &Info, NULL);
     if (ACPI_FAILURE (Status))
     {
         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
     }
 
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "Namespace contains %u (0x%X) objects\n",
-        Info.ObjectCount,
-        Info.ObjectCount));
+        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
+        "Buffers %u/%u Packages (%u nodes)\n",
+        Info.OpRegionInit,  Info.OpRegionCount,
+        Info.FieldInit,     Info.FieldCount,
+        Info.BufferInit,    Info.BufferCount,
+        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
 
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
         "%u Control Methods found\n%u Op Regions found\n",
@@ -562,19 +561,35 @@ AcpiNsInitOneObject (
     AcpiExEnterInterpreter ();
 
     /*
-     * Only initialization of Package objects can be deferred, in order
-     * to support forward references.
+     * Each of these types can contain executable AML code within the
+     * declaration.
      */
     switch (Type)
     {
-    case ACPI_TYPE_LOCAL_BANK_FIELD:
+    case ACPI_TYPE_REGION:
 
-        /* TBD: BankFields do not require deferred init, remove this code */
+        Info->OpRegionInit++;
+        Status = AcpiDsGetRegionArguments (ObjDesc);
+        break;
 
+    case ACPI_TYPE_BUFFER_FIELD:
+
         Info->FieldInit++;
+        Status = AcpiDsGetBufferFieldArguments (ObjDesc);
+        break;
+
+    case ACPI_TYPE_LOCAL_BANK_FIELD:
+
+        Info->FieldInit++;
         Status = AcpiDsGetBankFieldArguments (ObjDesc);
         break;
 
+    case ACPI_TYPE_BUFFER:
+
+        Info->BufferInit++;
+        Status = AcpiDsGetBufferArguments (ObjDesc);
+        break;
+
     case ACPI_TYPE_PACKAGE:
 
         /* Complete the initialization/resolution of the package object */
@@ -585,12 +600,8 @@ AcpiNsInitOneObject (
 
     default:
 
-        /* No other types should get here */
+        /* No other types can get here */
 
-        Status = AE_TYPE;
-        ACPI_EXCEPTION ((AE_INFO, Status,
-            "Opcode is not deferred [%4.4s] (%s)",
-            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
         break;
     }
 

Modified: head/sys/contrib/dev/acpica/components/namespace/nsload.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nsload.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/namespace/nsload.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -268,6 +268,18 @@ Unlock:
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
         "**** Completed Table Object Initialization\n"));
 
+    /*
+     * This case handles the legacy option that groups all module-level
+     * code blocks together and defers execution until all of the tables
+     * are loaded. Execute all of these blocks at this time.
+     * Execute any module-level code that was detected during the table
+     * load phase.
+     *
+     * Note: this option is deprecated and will be eliminated in the
+     * future. Use of this option can cause problems with AML code that
+     * depends upon in-order immediate execution of module-level code.
+     */
+    AcpiNsExecModuleCodeList ();
     return_ACPI_STATUS (Status);
 }
 

Modified: head/sys/contrib/dev/acpica/components/namespace/nsutils.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nsutils.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/namespace/nsutils.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -802,10 +802,23 @@ AcpiNsTerminate (
     void)
 {
     ACPI_STATUS             Status;
+    ACPI_OPERAND_OBJECT     *Prev;
+    ACPI_OPERAND_OBJECT     *Next;
 
 
     ACPI_FUNCTION_TRACE (NsTerminate);
 
+
+    /* Delete any module-level code blocks */
+
+    Next = AcpiGbl_ModuleCodeList;
+    while (Next)
+    {
+        Prev = Next;
+        Next = Next->Method.Mutex;
+        Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
+        AcpiUtRemoveReference (Prev);
+    }
 
     /*
      * Free the entire namespace -- all nodes and all objects

Modified: head/sys/contrib/dev/acpica/components/tables/tbdata.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/tables/tbdata.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/tables/tbdata.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -1191,6 +1191,19 @@ AcpiTbLoadTable (
     Status = AcpiNsLoadTable (TableIndex, ParentNode);
 
     /*
+     * This case handles the legacy option that groups all module-level
+     * code blocks together and defers execution until all of the tables
+     * are loaded. Execute all of these blocks at this time.
+     * Execute any module-level code that was detected during the table
+     * load phase.
+     *
+     * Note: this option is deprecated and will be eliminated in the
+     * future. Use of this option can cause problems with AML code that
+     * depends upon in-order immediate execution of module-level code.
+     */
+    AcpiNsExecModuleCodeList ();
+
+    /*
      * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
      * responsible for discovering any new wake GPEs by running _PRW methods
      * that may have been loaded by this table.

Modified: head/sys/contrib/dev/acpica/components/tables/tbxfload.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -479,13 +479,6 @@ AcpiLoadTable (
     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
     Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
-    if (ACPI_SUCCESS (Status))
-    {
-        /* Complete the initialization/resolution of new objects */
-
-        AcpiNsInitializeObjects ();
-    }
-
     return_ACPI_STATUS (Status);
 }
 

Modified: head/sys/contrib/dev/acpica/components/utilities/utinit.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/utilities/utinit.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/utilities/utinit.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -342,6 +342,7 @@ AcpiUtInitGlobals (
 
     /* Namespace */
 
+    AcpiGbl_ModuleCodeList              = NULL;
     AcpiGbl_RootNode                    = NULL;
     AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
     AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;

Modified: head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	Thu Aug  1 17:37:25 2019	(r350509)
+++ head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	Thu Aug  1 17:45:43 2019	(r350510)
@@ -381,17 +381,24 @@ AcpiInitializeObjects (
     ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
 
 
-#ifdef ACPI_OBSOLETE_BEHAVIOR
     /*
-     * 05/2019: Removed, initialization now happens at both object
-     * creation and table load time
+     * This case handles the legacy option that groups all module-level
+     * code blocks together and defers execution until all of the tables
+     * are loaded. Execute all of these blocks at this time.
+     * Execute any module-level code that was detected during the table
+     * load phase.
+     *
+     * Note: this option is deprecated and will be eliminated in the
+     * future. Use of this option can cause problems with AML code that
+     * depends upon in-order immediate execution of module-level code.
      */
+    AcpiNsExecModuleCodeList ();
 
     /*
      * Initialize the objects that remain uninitialized. This
      * runs the executable AML that may be part of the
-     * declaration of these objects: OperationRegions, BufferFields,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@freebsd.org  Thu Aug  1 17:57:06 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B76BBC3F0D;
 Thu,  1 Aug 2019 17:57:06 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com
 [66.111.4.29])
 (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 45zyfp585Mz41F2;
 Thu,  1 Aug 2019 17:57:06 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: from compute6.internal (compute6.nyi.internal [10.202.2.46])
 by mailout.nyi.internal (Postfix) with ESMTP id CB1BC21D25;
 Thu,  1 Aug 2019 13:57:05 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute6.internal (MEProxy); Thu, 01 Aug 2019 13:57:05 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h=
 content-type:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to; s=fm3; bh=Q
 aSzRFXG/BmaaQ7imkJ0aC2flTzI1A4kptLeIscD8Og=; b=nPX645gb/6dIKAwm5
 WTLiRZ5hm1PWzzL1BDOzb10X/CUXZDdte6jkG86zNlSCZrQxbd5GEr7rwafI3MDP
 rj4D1FSTN0KLgdGsGxSNqP7a7dLd2pZjMI7/Z8+iPmbjU8TfAuhT0Ma3dtwmvQH+
 7EQR1e/iAmpPPOw+EC7x8onahRns5WE351cDYLQRR59XJZLRxLZWFLBLX7zCRKMM
 ELe6lueY8OHpjGuhEDe8iryuIj6jlr9cYqieVOks53KQ0Snj7pnUK5t+nbVPG1EK
 RGXHQVrUnIDLpDuCVb/3fvSMGzknO4eYwC2c4/Q6dFG7QHwwSyfNNyvVx0T6+bj6
 DczJA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm3; bh=QaSzRFXG/BmaaQ7imkJ0aC2flTzI1A4kptLeIscD8
 Og=; b=TSjuUy8VcI3zEPwQtWPqxyQ4O2L+Q4+wq4wDOENpAnMIFD707yas4PwMv
 BtPCF73Wf1QyhBXTTixhPXSRleVFNP1sGd4b4jXUHWwDt8GYd6GCfwQ2B7FNsfY+
 o1YYf3pRJTCfybFMIhHnELdHQUbqT/86THiisCd1UHb9i4sUzZNVq/hgtGZflHfO
 uJ3cYabh95FhcBrkDP3HKG32XwDL10h8LGOY5Nmy0fRNbp4eDSZ2SAqJb7is2HTQ
 d8l/hk/0xNH2/5nM+kgL1uW0DaXybvgA/tpJmqYg6qH5GiYeASTqZaXeHUUN0AF7
 ABNG0T7U2pfhUJpFpfxxnosI1Baaw==
X-ME-Sender: <xms:8SdDXVD9APuUkdR-5lEGWjPOatD_i5yZuMclRtkPj_TJQWyPRYTzig>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrleejgdduudejucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht
 thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuffhomhgrihhnpe
 hfrhgvvggsshgurdhorhhgnecukfhppeduledvrdehhedrheegrdehleenucfrrghrrghm
 pehmrghilhhfrhhomhepshgtohhtthhlsehsrghmshgtohdrohhrghenucevlhhushhtvg
 hrufhiiigvpedt
X-ME-Proxy: <xmx:8SdDXXyw5kmvlUg4g5fyGDP_NgSp54bnnYTwor6IOAxFdxV3x-EHcw>
 <xmx:8SdDXbl5w7VtuTvgMHBHzy9nWbUzLuXB7cmu28gFhTHguGiBDIlNXg>
 <xmx:8SdDXUETIre7uaPxZO_M7L5qbGC2eTTxrqeWxCjdMJFz8jPWekUJaw>
 <xmx:8SdDXZTJMd3zlDE_9WI3AjDDj80ux90-UkTKxXV3NDSivfzc-2UF9w>
Received: from [10.178.24.10] (unknown [192.55.54.59])
 by mail.messagingengine.com (Postfix) with ESMTPA id ABD84380079;
 Thu,  1 Aug 2019 13:57:03 -0400 (EDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Subject: Re: svn commit: r350510 - in head/sys/contrib/dev/acpica: . compiler
 components/dispatcher components/events components/executer
 components/namespace components/tables components/utilities include
From: Scott Long <scottl@samsco.org>
In-Reply-To: <201908011745.x71HjhAC058358@repo.freebsd.org>
Date: Thu, 1 Aug 2019 11:57:02 -0600
Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <58DA75EF-AFA5-42C3-B441-7A9018C8E134@samsco.org>
References: <201908011745.x71HjhAC058358@repo.freebsd.org>
To: Jung-uk Kim <jkim@FreeBSD.org>
X-Mailer: Apple Mail (2.3445.104.11)
X-Rspamd-Queue-Id: 45zyfp585Mz41F2
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.91 / 15.00]; REPLY(-4.00)[];
 NEURAL_HAM_SHORT(-0.91)[-0.905,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:57:06 -0000

Thanks.  I=E2=80=99m working on the root cause right now, hopefully will =
have
more information soon.

Scott


> On Aug 1, 2019, at 11:45 AM, Jung-uk Kim <jkim@FreeBSD.org> wrote:
>=20
> Author: jkim
> Date: Thu Aug  1 17:45:43 2019
> New Revision: 350510
> URL: https://svnweb.freebsd.org/changeset/base/350510
>=20
> Log:
>  Revert r349863 (ACPICA 20190703).
>=20
>  This commit caused boot failures on some systems.
>=20
>  Requested by:	scottl
>=20
> Modified:
>  head/sys/contrib/dev/acpica/changes.txt
>  head/sys/contrib/dev/acpica/compiler/asldefine.h
>  head/sys/contrib/dev/acpica/compiler/aslglobal.h
>  head/sys/contrib/dev/acpica/compiler/aslload.c
>  head/sys/contrib/dev/acpica/compiler/aslmessages.c
>  head/sys/contrib/dev/acpica/compiler/aslmessages.h
>  head/sys/contrib/dev/acpica/compiler/aslstubs.c
>  head/sys/contrib/dev/acpica/compiler/aslsupport.l
>  head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
>  head/sys/contrib/dev/acpica/components/events/evgpe.c
>  head/sys/contrib/dev/acpica/components/events/evgpeblk.c
>  head/sys/contrib/dev/acpica/components/events/evxface.c
>  head/sys/contrib/dev/acpica/components/events/evxfgpe.c
>  head/sys/contrib/dev/acpica/components/executer/exconfig.c
>  head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
>  head/sys/contrib/dev/acpica/components/namespace/nseval.c
>  head/sys/contrib/dev/acpica/components/namespace/nsinit.c
>  head/sys/contrib/dev/acpica/components/namespace/nsload.c
>  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
>  head/sys/contrib/dev/acpica/components/tables/tbdata.c
>  head/sys/contrib/dev/acpica/components/tables/tbxfload.c
>  head/sys/contrib/dev/acpica/components/utilities/utinit.c
>  head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
>  head/sys/contrib/dev/acpica/include/acevents.h
>  head/sys/contrib/dev/acpica/include/acglobal.h
>  head/sys/contrib/dev/acpica/include/acnamesp.h
>  head/sys/contrib/dev/acpica/include/acpixf.h
>=20
> Modified: head/sys/contrib/dev/acpica/changes.txt
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/changes.txt	Thu Aug  1 17:37:25 2019	=
(r350509)
> +++ head/sys/contrib/dev/acpica/changes.txt	Thu Aug  1 17:45:43 2019	=
(r350510)
> @@ -1,53 +1,4 @@
> ----------------------------------------
> -03 July 2019. Summary of changes for version 20190703:
> -
> -
> -1) ACPICA kernel-resident subsystem:
> -
> -Remove legacy module-level support code. There were still some =
remnants=20
> -of the legacy module-level code executions. Since we no longer =
support=20
> -this option, this is essentially dead code and has been removed from =
the=20
> -ACPICA source.
> -
> -iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the =
root=20
> -scope. If these named objects are declared outside the root scope, =
they=20
> -will not be invoked by any host Operating System.
> -
> -Clear status of GPEs on first direct enable. ACPI GPEs (other than =
the EC=20
> -one) can be enabled in two situations. First, the GPEs with existing =
_Lxx=20
> -and _Exx methods are enabled implicitly by ACPICA during system=20
> -initialization.  Second, the GPEs without these methods (like GPEs =
listed=20
> -by _PRW objects for wakeup devices) need to be enabled directly by =
the=20
> -code that is going to use them (e.g. ACPI power management or device=20=

> -drivers).
> -
> -In the former case, if the status of a given GPE is set to start =
with,=20
> -its handler method (either _Lxx or _Exx) needs to be invoked to take =
care=20
> -of the events (possibly) signaled before the GPE was enabled. In the=20=

> -latter case, however, the first caller of AcpiEnableGpe() for a given =
GPE=20
> -should not be expected to care about any events that might be =
signaled=20
> -through it earlier.  In that case, it is better to clear the status =
of=20
> -the GPE before enabling it, to prevent stale events from triggering=20=

> -unwanted actions (like spurious system resume, for example).
> -
> -For this reason, modify AcpiEvAddGpeReference() to take an additional=20=

> -boolean argument indicating whether or not the GPE status needs to be=20=

> -cleared when its reference counter changes from zero to one and make=20=

> -AcpiEnableGpe() pass TRUE to it through that new argument.
> -
> -
> -2) iASL Compiler/Disassembler and ACPICA tools:
> -
> -The tool generation process has been migrated to MSVC 2017, and all=20=

> -project files have been upgraded. The new project files appear in the=20=

> -directory \acpica\generate\msvc2017. This change effectively =
deprecates=20
> -the older project files in \acpica\generate\msvc9.
> -
> -iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the =
root=20
> -scope. If these named objects are declared outside the root scope, =
they=20
> -will not be invoked by any host Operating System
> -
> -----------------------------------------
> 09 May 2019. Summary of changes for version 20190509:
>=20
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/asldefine.h	Thu Aug  1 =
17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Thu Aug  1 =
17:45:43 2019	(r350510)
> @@ -298,20 +298,4 @@
> #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments =3D =
TRUE;
> #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments =3D =
FALSE;
>=20
> -/*
> - * Special name segments - these must only be declared at the root =
scope
> - */
> -#define NAMESEG__PTS    "_PTS"
> -#define NAMESEG__WAK    "_WAK"
> -#define NAMESEG__S0     "_S0_"
> -#define NAMESEG__S1     "_S1_"
> -#define NAMESEG__S2     "_S2_"
> -#define NAMESEG__S3     "_S3_"
> -#define NAMESEG__S4     "_S4_"
> -#define NAMESEG__S5     "_S5_"
> -#define NAMESEG__TTS    "_TTS"
> -
> -#define MAX_SPECIAL_NAMES      9
> -
> -
> #endif /* ASLDEFINE.H */
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Thu Aug  1 =
17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Thu Aug  1 =
17:45:43 2019	(r350510)
> @@ -223,26 +223,11 @@ const char                          =
*AslGbl_OpFlagName
>     "OP_NOT_FOUND_DURING_LOAD"
> };
>=20
> -const char                          *AslGbl_SpecialNamedObjects =
[MAX_SPECIAL_NAMES] =3D
> -{
> -    NAMESEG__PTS,
> -    NAMESEG__WAK,
> -    NAMESEG__S0,
> -    NAMESEG__S1,
> -    NAMESEG__S2,
> -    NAMESEG__S3,
> -    NAMESEG__S4,
> -    NAMESEG__S5,
> -    NAMESEG__TTS
> -};
> -
> #else
> extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
> extern UINT32                       =
AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
> extern const char                   =
*AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
> -extern const char                   =
*AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES];
> #endif
> -
>=20
>=20
> /*
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslload.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslload.c	Thu Aug  1 =
17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/compiler/aslload.c	Thu Aug  1 =
17:45:43 2019	(r350510)
> @@ -164,7 +164,6 @@
>=20
> static ACPI_STATUS
> LdLoadFieldElements (
> -    UINT32                  AmlType,
>     ACPI_PARSE_OBJECT       *Op,
>     ACPI_WALK_STATE         *WalkState);
>=20
> @@ -191,10 +190,6 @@ LdCommonNamespaceEnd (
>     UINT32                  Level,
>     void                    *Context);
>=20
> -static void
> -LdCheckSpecialNames (
> -    ACPI_NAMESPACE_NODE     *Node,
> -    ACPI_PARSE_OBJECT       *Op);
>=20
> =
/*************************************************************************=
******
>  *
> @@ -252,8 +247,7 @@ LdLoadNamespace (
>  *
>  * FUNCTION:    LdLoadFieldElements
>  *
> - * PARAMETERS:  AmlType         - Type to search
> - *              Op              - Parent node (Field)
> + * PARAMETERS:  Op              - Parent node (Field)
>  *              WalkState       - Current walk state
>  *
>  * RETURN:      Status
> @@ -265,7 +259,6 @@ LdLoadNamespace (
>=20
> static ACPI_STATUS
> LdLoadFieldElements (
> -    UINT32                  AmlType,
>     ACPI_PARSE_OBJECT       *Op,
>     ACPI_WALK_STATE         *WalkState)
> {
> @@ -281,7 +274,7 @@ LdLoadFieldElements (
>     {
>         Status =3D AcpiNsLookup (WalkState->ScopeInfo,
>             SourceRegion->Asl.Value.String,
> -            AmlType, ACPI_IMODE_EXECUTE,
> +            ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
>             ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
>         if (Status =3D=3D AE_NOT_FOUND)
>         {
> @@ -514,15 +507,11 @@ LdNamespace1Begin (
>      */
>     switch (Op->Asl.AmlOpcode)
>     {
> -    case AML_INDEX_FIELD_OP:
> -
> -        Status =3D LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, =
Op, WalkState);
> -        return (Status);
> -
>     case AML_BANK_FIELD_OP:
> +    case AML_INDEX_FIELD_OP:
>     case AML_FIELD_OP:
>=20
> -        Status =3D LdLoadFieldElements (ACPI_TYPE_REGION, Op, =
WalkState);
> +        Status =3D LdLoadFieldElements (Op, WalkState);
>         return (Status);
>=20
>     case AML_INT_CONNECTION_OP:
> @@ -977,10 +966,6 @@ LdNamespace1Begin (
>         }
>     }
>=20
> -    /* Check special names like _WAK and _PTS */
> -
> -    LdCheckSpecialNames (Node, Op);
> -
>     if (ForceNewScope)
>     {
>         Status =3D AcpiDsScopeStackPush (Node, ObjectType, WalkState);
> @@ -1016,42 +1001,6 @@ FinishNode:
>     }
>=20
>     return_ACPI_STATUS (Status);
> -}
> -
> -
> =
-/************************************************************************=
*******
> - *
> - * FUNCTION:    LdCheckSpecialNames
> - *
> - * PARAMETERS:  Node        - Node that represents the named object
> - *              Op          - Named object declaring this named =
object
> - *
> - * RETURN:      None
> - *
> - * DESCRIPTION: Check if certain named objects are declared in the =
incorrect
> - *              scope. Special named objects are listed in
> - *              AslGbl_SpecialNamedObjects and can only be declared =
at the root
> - *              scope.
> - *
> - =
**************************************************************************=
****/
> -
> -static void
> -LdCheckSpecialNames (
> -    ACPI_NAMESPACE_NODE     *Node,
> -    ACPI_PARSE_OBJECT       *Op)
> -{
> -    UINT32                  i;
> -
> -
> -    for (i =3D 0; i < MAX_SPECIAL_NAMES; i++)
> -    {
> -        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, =
AslGbl_SpecialNamedObjects[i]) &&
> -            Node->Parent !=3D AcpiGbl_RootNode)
> -        {
> -            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, =
Op->Asl.ExternalName);
> -            return;
> -        }
> -    }
> }
>=20
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslmessages.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -365,8 +365,7 @@ const char                      *AslCompilerMsgs =
[] =3D
> /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared =
with zero length",
> /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created =
temporarily in another method and cannot be accessed",
> /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared =
external but the actual definition does not exist",
> -/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends =
beyond end of target buffer",
> -/*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this =
named object outside root scope is illegal"
> +/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */        "Buffer field extends =
beyond end of target buffer"
> };
>=20
> /* Table compiler */
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslmessages.h	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -368,7 +368,6 @@ typedef enum
>     ASL_MSG_TEMPORARY_OBJECT,
>     ASL_MSG_UNDEFINED_EXTERNAL,
>     ASL_MSG_BUFFER_FIELD_OVERFLOW,
> -    ASL_MSG_INVALID_SPECIAL_NAME,
>=20
>     /* These messages are used by the Data Table compiler only */
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslstubs.c	Thu Aug  1 =
17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/compiler/aslstubs.c	Thu Aug  1 =
17:45:43 2019	(r350510)
> @@ -166,6 +166,12 @@
>  * Things like Events, Global Lock, etc. are not used
>  * by the compiler, so they are stubbed out here.
>  */
> +void
> +AcpiNsExecModuleCodeList (
> +    void)
> +{
> +}
> +
> ACPI_STATUS
> AcpiNsInitializeObjects (
>     void)
>=20
> Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/compiler/aslsupport.l	Thu Aug  1 =
17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/compiler/aslsupport.l	Thu Aug  1 =
17:45:43 2019	(r350510)
> @@ -220,7 +220,7 @@ AslDoLineDirective (
>=20
>     while ((c =3D input()) !=3D '\n' && c !=3D EOF)
>     {
> -        *AslGbl_LineBufPtr =3D (char) c;
> +        *AslGbl_LineBufPtr =3D c;
>         AslGbl_LineBufPtr++;
>     }
>     *AslGbl_LineBufPtr =3D 0;
> @@ -498,7 +498,7 @@ AslInsertLineBuffer (
>=20
>         if (AcpiGbl_CaptureComments)
>         {
> -            CvProcessCommentState ((char) SourceChar);
> +            CvProcessCommentState (SourceChar);
>         }
>     }
> }
> @@ -601,7 +601,7 @@ loop:
>         AslInsertLineBuffer (c);
>         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>         {
> -            *StringBuffer =3D (char) c;
> +            *StringBuffer =3D c;
>             ++StringBuffer;
>         }
>         c1 =3D c;
> @@ -629,7 +629,7 @@ loop:
>     AslInsertLineBuffer (c);
>     if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>     {
> -        *StringBuffer =3D (char) c;
> +        *StringBuffer =3D c;
>         ++StringBuffer;
>     }
>=20
> @@ -720,7 +720,7 @@ AslDoCommentType2 (
>         AslInsertLineBuffer (c);
>         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>         {
> -            *StringBuffer =3D (char) c;
> +            *StringBuffer =3D c;
>             ++StringBuffer;
>         }
>     }
> @@ -878,7 +878,7 @@ DoCharacter:
>                 if (ACPI_IS_OCTAL_DIGIT (StringChar))
>                 {
>                     State =3D ASL_OCTAL_CONSTANT;
> -                    ConvertBuffer[0] =3D (char) StringChar;
> +                    ConvertBuffer[0] =3D StringChar;
>                     i =3D 1;
>                     continue;
>                 }
> @@ -934,7 +934,7 @@ DoCharacter:
>=20
>             /* Append another digit of the constant */
>=20
> -            ConvertBuffer[i] =3D (char) StringChar;
> +            ConvertBuffer[i] =3D StringChar;
>             i++;
>             continue;
>=20
> @@ -978,7 +978,7 @@ DoCharacter:
>=20
>             /* Append another digit of the constant */
>=20
> -            ConvertBuffer[i] =3D (char) StringChar;
> +            ConvertBuffer[i] =3D StringChar;
>             i++;
>             continue;
>=20
> @@ -989,7 +989,7 @@ DoCharacter:
>=20
>         /* Save the finished character */
>=20
> -        *StringBuffer =3D (char) StringChar;
> +        *StringBuffer =3D StringChar;
>         StringBuffer++;
>         if (StringBuffer >=3D EndBuffer)
>         {
>=20
> Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	=
Thu Aug  1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c	=
Thu Aug  1 17:45:43 2019	(r350510)
> @@ -362,7 +362,7 @@ AcpiDsInitializeObjects (
>     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
>     {
>         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -            "\nACPI table initialization:\n"));
> +            "\nInitializing Namespace objects:\n"));
>     }
>=20
>     /* Summary of objects initialized */
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evgpe.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evgpe.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/events/evgpe.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -316,7 +316,6 @@ AcpiEvMaskGpe (
>  * FUNCTION:    AcpiEvAddGpeReference
>  *
>  * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
> - *              ClearOnEnable           - Clear GPE status before =
enabling it
>  *
>  * RETURN:      Status
>  *
> @@ -327,8 +326,7 @@ AcpiEvMaskGpe (
>=20
> ACPI_STATUS
> AcpiEvAddGpeReference (
> -    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
> -    BOOLEAN                 ClearOnEnable)
> +    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
> {
>     ACPI_STATUS             Status =3D AE_OK;
>=20
> @@ -345,11 +343,6 @@ AcpiEvAddGpeReference (
>     if (GpeEventInfo->RuntimeCount =3D=3D 1)
>     {
>         /* Enable on first reference */
> -
> -        if (ClearOnEnable)
> -        {
> -            (void) AcpiHwClearGpe (GpeEventInfo);
> -        }
>=20
>         Status =3D AcpiEvUpdateGpeEnableMask (GpeEventInfo);
>         if (ACPI_SUCCESS (Status))
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evgpeblk.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/events/evgpeblk.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock (
>                 continue;
>             }
>=20
> -            Status =3D AcpiEvAddGpeReference (GpeEventInfo, FALSE);
> +            Status =3D AcpiEvAddGpeReference (GpeEventInfo);
>             if (ACPI_FAILURE (Status))
>             {
>                 ACPI_EXCEPTION ((AE_INFO, Status,
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evxface.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evxface.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/events/evxface.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler (
>             ACPI_GPE_DISPATCH_NOTIFY)) &&
>         Handler->OriginallyEnabled)
>     {
> -        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
> +        (void) AcpiEvAddGpeReference (GpeEventInfo);
>         if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>         {
>             /* Poll edge triggered GPEs to handle existing events */
>=20
> Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/events/evxfgpe.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -267,7 +267,7 @@ AcpiEnableGpe (
>         if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=3D
>             ACPI_GPE_DISPATCH_NONE)
>         {
> -            Status =3D AcpiEvAddGpeReference (GpeEventInfo, TRUE);
> +            Status =3D AcpiEvAddGpeReference (GpeEventInfo);
>             if (ACPI_SUCCESS (Status) &&
>                 ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>             {
>=20
> Modified: head/sys/contrib/dev/acpica/components/executer/exconfig.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/executer/exconfig.c	=
Thu Aug  1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/executer/exconfig.c	=
Thu Aug  1 17:45:43 2019	(r350510)
> @@ -342,9 +342,10 @@ AcpiExLoadTableOp (
>         return_ACPI_STATUS (Status);
>     }
>=20
> -    /* Complete the initialization/resolution of new objects */
> +    /* Complete the initialization/resolution of package objects */
>=20
> -    AcpiNsInitializeObjects ();
> +    Status =3D AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, =
ACPI_ROOT_OBJECT,
> +        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
>=20
>     /* Parameter Data (optional) */
>=20
> @@ -619,11 +620,10 @@ AcpiExLoadOp (
>         return_ACPI_STATUS (Status);
>     }
>=20
> -    /* Complete the initialization/resolution of new objects */
> +    /* Complete the initialization/resolution of package objects */
>=20
> -    AcpiExExitInterpreter ();
> -    AcpiNsInitializeObjects ();
> -    AcpiExEnterInterpreter ();
> +    Status =3D AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, =
ACPI_ROOT_OBJECT,
> +        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
>=20
>     /* Store the DdbHandle into the Target operand */
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	=
Thu Aug  1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsaccess.c	=
Thu Aug  1 17:45:43 2019	(r350510)
> @@ -184,7 +184,6 @@ AcpiNsRootInitialize (
>     ACPI_STATUS                 Status;
>     const ACPI_PREDEFINED_NAMES *InitVal =3D NULL;
>     ACPI_NAMESPACE_NODE         *NewNode;
> -    ACPI_NAMESPACE_NODE         *PrevNode =3D NULL;
>     ACPI_OPERAND_OBJECT         *ObjDesc;
>     ACPI_STRING                 Val =3D NULL;
>=20
> @@ -214,30 +213,13 @@ AcpiNsRootInitialize (
>      */
>     AcpiGbl_RootNode =3D &AcpiGbl_RootNodeStruct;
>=20
> -    /* Enter the predefined names in the name table */
> +    /* Enter the pre-defined names in the name table */
>=20
>     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>         "Entering predefined entries into namespace\n"));
>=20
> -    /*
> -     * Create the initial (default) namespace.
> -     * This namespace looks like something similar to this:
> -     *
> -     *   ACPI Namespace (from Namespace Root):
> -     *    0  _GPE Scope        00203160 00
> -     *    0  _PR_ Scope        002031D0 00
> -     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
> -     *    0  _SI_ Scope        002032B0 00
> -     *    0  _TZ_ Device       00203320 00
> -     *    0  _REV Integer      00203390 00 =3D 0000000000000002
> -     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows =
NT"
> -     *    0  _GL_ Mutex        00203580 00 Object 002035F0
> -     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml =
00000000
> -     */
>     for (InitVal =3D AcpiGbl_PreDefinedNames; InitVal->Name; =
InitVal++)
>     {
> -        Status =3D AE_OK;
> -
>         /* _OSI is optional for now, will be permanent later */
>=20
>         if (!strcmp (InitVal->Name, "_OSI") && =
!AcpiGbl_CreateOsiMethod)
> @@ -245,35 +227,17 @@ AcpiNsRootInitialize (
>             continue;
>         }
>=20
> -        /*
> -         * Create, init, and link the new predefined name
> -         * Note: No need to use AcpiNsLookup here because all the
> -         * predefined names are at the root level. It is much easier =
to
> -         * just create and link the new node(s) here.
> -         */
> -        NewNode =3D ACPI_ALLOCATE_ZEROED (sizeof =
(ACPI_NAMESPACE_NODE));
> -        if (!NewNode)
> +        Status =3D AcpiNsLookup (NULL, ACPI_CAST_PTR (char, =
InitVal->Name),
> +            InitVal->Type, ACPI_IMODE_LOAD_PASS2, =
ACPI_NS_NO_UPSEARCH,
> +            NULL, &NewNode);
> +        if (ACPI_FAILURE (Status))
>         {
> -            Status =3D AE_NO_MEMORY;
> -            goto UnlockAndExit;
> +            ACPI_EXCEPTION ((AE_INFO, Status,
> +                "Could not create predefined name %s",
> +                InitVal->Name));
> +            continue;
>         }
>=20
> -        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
> -        NewNode->DescriptorType =3D ACPI_DESC_TYPE_NAMED;
> -        NewNode->Type =3D InitVal->Type;
> -
> -        if (!PrevNode)
> -        {
> -            AcpiGbl_RootNodeStruct.Child =3D NewNode;
> -        }
> -        else
> -        {
> -            PrevNode->Peer =3D NewNode;
> -        }
> -
> -        NewNode->Parent =3D &AcpiGbl_RootNodeStruct;
> -        PrevNode =3D NewNode;
> -
>         /*
>          * Name entered successfully. If entry in PreDefinedNames[] =
specifies
>          * an initial value, create the initial value.
> @@ -322,7 +286,7 @@ AcpiNsRootInitialize (
>=20
>                 NewNode->Value =3D ObjDesc->Method.ParamCount;
> #else
> -                /* Mark this as a very SPECIAL method (_OSI) */
> +                /* Mark this as a very SPECIAL method */
>=20
>                 ObjDesc->Method.InfoFlags =3D =
ACPI_METHOD_INTERNAL_ONLY;
>                 ObjDesc->Method.Dispatch.Implementation =3D =
AcpiUtOsiImplementation;
> @@ -394,6 +358,7 @@ AcpiNsRootInitialize (
>             AcpiUtRemoveReference (ObjDesc);
>         }
>     }
> +
>=20
> UnlockAndExit:
>     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nseval.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/namespace/nseval.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -160,7 +160,14 @@
> #define _COMPONENT          ACPI_NAMESPACE
>         ACPI_MODULE_NAME    ("nseval")
>=20
> +/* Local prototypes */
>=20
> +static void
> +AcpiNsExecModuleCode (
> +    ACPI_OPERAND_OBJECT     *MethodObj,
> +    ACPI_EVALUATE_INFO      *Info);
> +
> +
> =
/*************************************************************************=
******
>  *
>  * FUNCTION:    AcpiNsEvaluate
> @@ -457,4 +464,207 @@ Cleanup:
>     ACPI_FREE (Info->FullPathname);
>     Info->FullPathname =3D NULL;
>     return_ACPI_STATUS (Status);
> +}
> +
> +
> =
+/************************************************************************=
*******
> + *
> + * FUNCTION:    AcpiNsExecModuleCodeList
> + *
> + * PARAMETERS:  None
> + *
> + * RETURN:      None. Exceptions during method execution are ignored, =
since
> + *              we cannot abort a table load.
> + *
> + * DESCRIPTION: Execute all elements of the global module-level code =
list.
> + *              Each element is executed as a single control method.
> + *
> + * NOTE: With this option enabled, each block of detected executable =
AML
> + * code that is outside of any control method is wrapped with a =
temporary
> + * control method object and placed on a global list. The methods on =
this
> + * list are executed below.
> + *
> + * This function executes the module-level code for all tables only =
after
> + * all of the tables have been loaded. It is a legacy option and is
> + * not compatible with other ACPI implementations. See =
AcpiNsLoadTable.
> + *
> + * This function will be removed when the legacy option is removed.
> + *
> + =
**************************************************************************=
****/
> +
> +void
> +AcpiNsExecModuleCodeList (
> +    void)
> +{
> +    ACPI_OPERAND_OBJECT     *Prev;
> +    ACPI_OPERAND_OBJECT     *Next;
> +    ACPI_EVALUATE_INFO      *Info;
> +    UINT32                  MethodCount =3D 0;
> +
> +
> +    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
> +
> +
> +    /* Exit now if the list is empty */
> +
> +    Next =3D AcpiGbl_ModuleCodeList;
> +    if (!Next)
> +    {
> +        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> +            "Legacy MLC block list is empty\n"));
> +
> +        return_VOID;
> +    }
> +
> +    /* Allocate the evaluation information block */
> +
> +    Info =3D ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
> +    if (!Info)
> +    {
> +        return_VOID;
> +    }
> +
> +    /* Walk the list, executing each "method" */
> +
> +    while (Next)
> +    {
> +        Prev =3D Next;
> +        Next =3D Next->Method.Mutex;
> +
> +        /* Clear the link field and execute the method */
> +
> +        Prev->Method.Mutex =3D NULL;
> +        AcpiNsExecModuleCode (Prev, Info);
> +        MethodCount++;
> +
> +        /* Delete the (temporary) method object */
> +
> +        AcpiUtRemoveReference (Prev);
> +    }
> +
> +    ACPI_INFO ((
> +        "Executed %u blocks of module-level executable AML code",
> +        MethodCount));
> +
> +    ACPI_FREE (Info);
> +    AcpiGbl_ModuleCodeList =3D NULL;
> +    return_VOID;
> +}
> +
> +
> =
+/************************************************************************=
*******
> + *
> + * FUNCTION:    AcpiNsExecModuleCode
> + *
> + * PARAMETERS:  MethodObj           - Object container for the =
module-level code
> + *              Info                - Info block for method =
evaluation
> + *
> + * RETURN:      None. Exceptions during method execution are ignored, =
since
> + *              we cannot abort a table load.
> + *
> + * DESCRIPTION: Execute a control method containing a block of =
module-level
> + *              executable AML code. The control method is =
temporarily
> + *              installed to the root node, then evaluated.
> + *
> + =
**************************************************************************=
****/
> +
> +static void
> +AcpiNsExecModuleCode (
> +    ACPI_OPERAND_OBJECT     *MethodObj,
> +    ACPI_EVALUATE_INFO      *Info)
> +{
> +    ACPI_OPERAND_OBJECT     *ParentObj;
> +    ACPI_NAMESPACE_NODE     *ParentNode;
> +    ACPI_OBJECT_TYPE        Type;
> +    ACPI_STATUS             Status;
> +
> +
> +    ACPI_FUNCTION_TRACE (NsExecModuleCode);
> +
> +
> +    /*
> +     * Get the parent node. We cheat by using the NextObject field
> +     * of the method object descriptor.
> +     */
> +    ParentNode =3D ACPI_CAST_PTR (
> +        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
> +    Type =3D AcpiNsGetType (ParentNode);
> +
> +    /*
> +     * Get the region handler and save it in the method object. We =
may need
> +     * this if an operation region declaration causes a _REG method =
to be run.
> +     *
> +     * We can't do this in AcpiPsLinkModuleCode because
> +     * AcpiGbl_RootNode->Object is NULL at PASS1.
> +     */
> +    if ((Type =3D=3D ACPI_TYPE_DEVICE) && ParentNode->Object)
> +    {
> +        MethodObj->Method.Dispatch.Handler =3D
> +            ParentNode->Object->Device.Handler;
> +    }
> +
> +    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
> +
> +    MethodObj->Method.NextObject =3D NULL;
> +
> +    /* Initialize the evaluation information block */
> +
> +    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
> +    Info->PrefixNode =3D ParentNode;
> +
> +    /*
> +     * Get the currently attached parent object. Add a reference,
> +     * because the ref count will be decreased when the method object
> +     * is installed to the parent node.
> +     */
> +    ParentObj =3D AcpiNsGetAttachedObject (ParentNode);
> +    if (ParentObj)
> +    {
> +        AcpiUtAddReference (ParentObj);
> +    }
> +
> +    /* Install the method (module-level code) in the parent node */
> +
> +    Status =3D AcpiNsAttachObject (ParentNode, MethodObj, =
ACPI_TYPE_METHOD);
> +    if (ACPI_FAILURE (Status))
> +    {
> +        goto Exit;
> +    }
> +
> +    /* Execute the parent node as a control method */
> +
> +    Status =3D AcpiNsEvaluate (Info);
> +
> +    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> +        "Executed module-level code at %p\n",
> +        MethodObj->Method.AmlStart));
> +
> +    /* Delete a possible implicit return value (in slack mode) */
> +
> +    if (Info->ReturnObject)
> +    {
> +        AcpiUtRemoveReference (Info->ReturnObject);
> +    }
> +
> +    /* Detach the temporary method object */
> +
> +    AcpiNsDetachObject (ParentNode);
> +
> +    /* Restore the original parent object */
> +
> +    if (ParentObj)
> +    {
> +        Status =3D AcpiNsAttachObject (ParentNode, ParentObj, Type);
> +    }
> +    else
> +    {
> +        ParentNode->Type =3D (UINT8) Type;
> +    }
> +
> +Exit:
> +    if (ParentObj)
> +    {
> +        AcpiUtRemoveReference (ParentObj);
> +    }
> +    return_VOID;
> }
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsinit.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -212,30 +212,29 @@ AcpiNsInitializeObjects (
>     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>         "**** Starting initialization of namespace objects ****\n"));
>     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "Final data object initialization: "));
> +        "Completing Region/Field/Buffer/Package initialization:\n"));
>=20
> -    /* Clear the info block */
> +    /* Set all init info to zero */
>=20
>     memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
>=20
>     /* Walk entire namespace from the supplied root */
>=20
> -    /*
> -     * TBD: will become ACPI_TYPE_PACKAGE as this type object
> -     * is now the only one that supports deferred initialization
> -     * (forward references).
> -     */
>     Status =3D AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
> +        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
> +        &Info, NULL);
>     if (ACPI_FAILURE (Status))
>     {
>         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
>     }
>=20
>     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "Namespace contains %u (0x%X) objects\n",
> -        Info.ObjectCount,
> -        Info.ObjectCount));
> +        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
> +        "Buffers %u/%u Packages (%u nodes)\n",
> +        Info.OpRegionInit,  Info.OpRegionCount,
> +        Info.FieldInit,     Info.FieldCount,
> +        Info.BufferInit,    Info.BufferCount,
> +        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
>=20
>     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>         "%u Control Methods found\n%u Op Regions found\n",
> @@ -562,19 +561,35 @@ AcpiNsInitOneObject (
>     AcpiExEnterInterpreter ();
>=20
>     /*
> -     * Only initialization of Package objects can be deferred, in =
order
> -     * to support forward references.
> +     * Each of these types can contain executable AML code within the
> +     * declaration.
>      */
>     switch (Type)
>     {
> -    case ACPI_TYPE_LOCAL_BANK_FIELD:
> +    case ACPI_TYPE_REGION:
>=20
> -        /* TBD: BankFields do not require deferred init, remove this =
code */
> +        Info->OpRegionInit++;
> +        Status =3D AcpiDsGetRegionArguments (ObjDesc);
> +        break;
>=20
> +    case ACPI_TYPE_BUFFER_FIELD:
> +
>         Info->FieldInit++;
> +        Status =3D AcpiDsGetBufferFieldArguments (ObjDesc);
> +        break;
> +
> +    case ACPI_TYPE_LOCAL_BANK_FIELD:
> +
> +        Info->FieldInit++;
>         Status =3D AcpiDsGetBankFieldArguments (ObjDesc);
>         break;
>=20
> +    case ACPI_TYPE_BUFFER:
> +
> +        Info->BufferInit++;
> +        Status =3D AcpiDsGetBufferArguments (ObjDesc);
> +        break;
> +
>     case ACPI_TYPE_PACKAGE:
>=20
>         /* Complete the initialization/resolution of the package =
object */
> @@ -585,12 +600,8 @@ AcpiNsInitOneObject (
>=20
>     default:
>=20
> -        /* No other types should get here */
> +        /* No other types can get here */
>=20
> -        Status =3D AE_TYPE;
> -        ACPI_EXCEPTION ((AE_INFO, Status,
> -            "Opcode is not deferred [%4.4s] (%s)",
> -            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
>         break;
>     }
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsload.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsload.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsload.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -268,6 +268,18 @@ Unlock:
>     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>         "**** Completed Table Object Initialization\n"));
>=20
> +    /*
> +     * This case handles the legacy option that groups all =
module-level
> +     * code blocks together and defers execution until all of the =
tables
> +     * are loaded. Execute all of these blocks at this time.
> +     * Execute any module-level code that was detected during the =
table
> +     * load phase.
> +     *
> +     * Note: this option is deprecated and will be eliminated in the
> +     * future. Use of this option can cause problems with AML code =
that
> +     * depends upon in-order immediate execution of module-level =
code.
> +     */
> +    AcpiNsExecModuleCodeList ();
>     return_ACPI_STATUS (Status);
> }
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/namespace/nsutils.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/namespace/nsutils.c	=
Thu Aug  1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/namespace/nsutils.c	=
Thu Aug  1 17:45:43 2019	(r350510)
> @@ -802,10 +802,23 @@ AcpiNsTerminate (
>     void)
> {
>     ACPI_STATUS             Status;
> +    ACPI_OPERAND_OBJECT     *Prev;
> +    ACPI_OPERAND_OBJECT     *Next;
>=20
>=20
>     ACPI_FUNCTION_TRACE (NsTerminate);
>=20
> +
> +    /* Delete any module-level code blocks */
> +
> +    Next =3D AcpiGbl_ModuleCodeList;
> +    while (Next)
> +    {
> +        Prev =3D Next;
> +        Next =3D Next->Method.Mutex;
> +        Prev->Method.Mutex =3D NULL; /* Clear the Mutex (cheated) =
field */
> +        AcpiUtRemoveReference (Prev);
> +    }
>=20
>     /*
>      * Free the entire namespace -- all nodes and all objects
>=20
> Modified: head/sys/contrib/dev/acpica/components/tables/tbdata.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/tables/tbdata.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/tables/tbdata.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -1191,6 +1191,19 @@ AcpiTbLoadTable (
>     Status =3D AcpiNsLoadTable (TableIndex, ParentNode);
>=20
>     /*
> +     * This case handles the legacy option that groups all =
module-level
> +     * code blocks together and defers execution until all of the =
tables
> +     * are loaded. Execute all of these blocks at this time.
> +     * Execute any module-level code that was detected during the =
table
> +     * load phase.
> +     *
> +     * Note: this option is deprecated and will be eliminated in the
> +     * future. Use of this option can cause problems with AML code =
that
> +     * depends upon in-order immediate execution of module-level =
code.
> +     */
> +    AcpiNsExecModuleCodeList ();
> +
> +    /*
>      * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The =
host is
>      * responsible for discovering any new wake GPEs by running _PRW =
methods
>      * that may have been loaded by this table.
>=20
> Modified: head/sys/contrib/dev/acpica/components/tables/tbxfload.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/tables/tbxfload.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -479,13 +479,6 @@ AcpiLoadTable (
>     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
>     Status =3D AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR =
(Table),
>         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
> -    if (ACPI_SUCCESS (Status))
> -    {
> -        /* Complete the initialization/resolution of new objects */
> -
> -        AcpiNsInitializeObjects ();
> -    }
> -
>     return_ACPI_STATUS (Status);
> }
>=20
>=20
> Modified: head/sys/contrib/dev/acpica/components/utilities/utinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/utilities/utinit.c	Thu Aug  =
1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/utilities/utinit.c	Thu Aug  =
1 17:45:43 2019	(r350510)
> @@ -342,6 +342,7 @@ AcpiUtInitGlobals (
>=20
>     /* Namespace */
>=20
> +    AcpiGbl_ModuleCodeList              =3D NULL;
>     AcpiGbl_RootNode                    =3D NULL;
>     AcpiGbl_RootNodeStruct.Name.Integer =3D ACPI_ROOT_NAME;
>     AcpiGbl_RootNodeStruct.DescriptorType =3D ACPI_DESC_TYPE_NAMED;
>=20
> Modified: head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	=
Thu Aug  1 17:37:25 2019	(r350509)
> +++ head/sys/contrib/dev/acpica/components/utilities/utxfinit.c	=
Thu Aug  1 17:45:43 2019	(r350510)
> @@ -381,17 +381,24 @@ AcpiInitializeObjects (
>     ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
>=20
>=20
> -#ifdef ACPI_OBSOLETE_BEHAVIOR
>     /*
> -     * 05/2019: Removed, initialization now happens at both object
> -     * creation and table load time
> +     * This case handles the legacy option that groups all =
module-level
> +     * code blocks together and defers execution until all of the =
tables
> +     * are loaded. Execute all of these blocks at this time.
> +     * Execute any module-level code that was detected during the =
table
> +     * load phase.
> +     *
> +     * Note: this option is deprecated and will be eliminated in the
> +     * future. Use of this option can cause problems with AML code =
that
> +     * depends upon in-order immediate execution of module-level =
code.
>      */
> +    AcpiNsExecModuleCodeList ();
>=20
>     /*
>      * Initialize the objects that remain uninitialized. This
>      * runs the executable AML that may be part of the
> -     * declaration of these objects: OperationRegions, BufferFields,
>=20
> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
>=20


From owner-svn-src-head@freebsd.org  Thu Aug  1 17:59:56 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED136C3F99;
 Thu,  1 Aug 2019 17:59:56 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zyk45zfZz41Nt;
 Thu,  1 Aug 2019 17:59:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE97A1E004;
 Thu,  1 Aug 2019 17:59:56 +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 x71Hxuok064280;
 Thu, 1 Aug 2019 17:59:56 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71HxuMe064279;
 Thu, 1 Aug 2019 17:59:56 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011759.x71HxuMe064279@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 17:59:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350511 - head/contrib/elftoolchain/readelf
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: head/contrib/elftoolchain/readelf
X-SVN-Commit-Revision: 350511
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 17:59:57 -0000

Author: emaste
Date: Thu Aug  1 17:59:56 2019
New Revision: 350511
URL: https://svnweb.freebsd.org/changeset/base/350511

Log:
  readelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND
  
  These bits are used for Intel CET IBT/Shadow Stack.
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20516

Modified:
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.c	Thu Aug  1 17:45:43 2019	(r350510)
+++ head/contrib/elftoolchain/readelf/readelf.c	Thu Aug  1 17:59:56 2019	(r350511)
@@ -322,11 +322,13 @@ static void dump_mips_specific_info(struct readelf *re
 static void dump_notes(struct readelf *re);
 static void dump_notes_content(struct readelf *re, const char *buf, size_t sz,
     off_t off);
-static void dump_notes_data(const char *name, uint32_t type, const char *buf,
-    size_t sz);
+static void dump_notes_data(struct readelf *re, const char *name,
+    uint32_t type, const char *buf, size_t sz);
 static void dump_svr4_hash(struct section *s);
 static void dump_svr4_hash64(struct readelf *re, struct section *s);
 static void dump_gnu_hash(struct readelf *re, struct section *s);
+static void dump_gnu_property_type_0(struct readelf *re, const char *buf,
+    size_t sz);
 static void dump_hash(struct readelf *re);
 static void dump_phdr(struct readelf *re);
 static void dump_ppc_attributes(uint8_t *p, uint8_t *pe);
@@ -3517,7 +3519,63 @@ dump_gnu_hash(struct readelf *re, struct section *s)
 	free(bl);
 }
 
+static struct flag_desc gnu_property_x86_feature_1_and_bits[] = {
+	{ GNU_PROPERTY_X86_FEATURE_1_IBT,	"IBT" },
+	{ GNU_PROPERTY_X86_FEATURE_1_SHSTK,	"SHSTK" },
+	{ 0, NULL }
+};
+
 static void
+dump_gnu_property_type_0(struct readelf *re, const char *buf, size_t sz)
+{
+	size_t i;
+	uint32_t type, prop_sz;
+
+	printf("      Properties: ");
+	while (sz > 0) {
+		if (sz < 8)
+			goto bad;
+
+		type = *(const uint32_t *)(const void *)buf;
+		prop_sz = *(const uint32_t *)(const void *)(buf + 4);
+		buf += 8;
+		sz -= 8;
+
+		if (prop_sz > sz)
+			goto bad;
+
+		if (type >= GNU_PROPERTY_LOPROC &&
+		    type <= GNU_PROPERTY_HIPROC) {
+			if (re->ehdr.e_machine != EM_X86_64) {
+				printf("machine type %x unknown\n",
+				    re->ehdr.e_machine);
+				goto unknown;
+			}
+			switch (type) {
+			case GNU_PROPERTY_X86_FEATURE_1_AND:
+				printf("x86 features:");
+				if (prop_sz != 4)
+					goto bad;
+				dump_flags(gnu_property_x86_feature_1_and_bits,
+				    *(const uint32_t *)(const void *)buf);
+				break;
+			}
+		}
+
+		buf += roundup2(prop_sz, 8);
+		sz -= roundup2(prop_sz, 8);
+	}
+	return;
+bad:
+	printf("corrupt GNU property\n");
+unknown:
+	printf("remaining description data:");
+	for (i = 0; i < sz; i++)
+		printf(" %02x", (unsigned char)buf[i]);
+	printf("\n");
+}
+
+static void
 dump_hash(struct readelf *re)
 {
 	struct section	*s;
@@ -3608,7 +3666,8 @@ static struct flag_desc note_feature_ctl_flags[] = {
 };
 
 static void
-dump_notes_data(const char *name, uint32_t type, const char *buf, size_t sz)
+dump_notes_data(struct readelf *re, const char *name, uint32_t type,
+    const char *buf, size_t sz)
 {
 	size_t i;
 	const uint32_t *ubuf;
@@ -3640,6 +3699,12 @@ dump_notes_data(const char *name, uint32_t type, const
 			dump_flags(note_feature_ctl_flags, ubuf[0]);
 			return;
 		}
+	} else if (strcmp(name, "GNU") == 0) {
+		switch (type) {
+		case NT_GNU_PROPERTY_TYPE_0:
+			dump_gnu_property_type_0(re, buf, sz);
+			return;
+		}
 	}
 unknown:
 	printf("   description data:");
@@ -3684,7 +3749,7 @@ dump_notes_content(struct readelf *re, const char *buf
 		printf("  %-13s %#010jx", name, (uintmax_t) note->n_descsz);
 		printf("      %s\n", note_type(name, re->ehdr.e_type,
 		    note->n_type));
-		dump_notes_data(name, note->n_type, buf, note->n_descsz);
+		dump_notes_data(re, name, note->n_type, buf, note->n_descsz);
 		buf += roundup2(note->n_descsz, 4);
 	}
 }

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:09:50 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5717C46AD
 for <svn-src-head@mailman.nyi.freebsd.org>;
 Thu,  1 Aug 2019 18:09:50 +0000 (UTC) (envelope-from ian@freebsd.org)
Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org
 [54.186.57.195])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zyxV0qRKz42Xx
 for <svn-src-head@freebsd.org>; Thu,  1 Aug 2019 18:09:50 +0000 (UTC)
 (envelope-from ian@freebsd.org)
ARC-Seal: i=1; a=rsa-sha256; t=1564682989; cv=none;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 b=g9ldrNijZT2fNWLoTP8CRA+JncZ3gVTmrWNhS9BHnx6cnF7UhKiXWJwRzt44lDSMIbSyt6i/Th5DN
 HqQq6O3/djqRGeNA99Frl04e0Kh9GzAc3mNc+cDSoHikx2I1vmZNsf9e6V/z4Pl6ccEU2Qr7LCCf7+
 kjzP73w6R61rfnYUnH7D8xpy7bOwLB9t0zitCde1Xfg9FYJ7L5YLv0u24rjpY2R1cS2eAOdtEx/7J9
 7HJJzGNGlv4SGAI64eSJ5Kxy6K1zZYi2zga4MfQ6hzFOd8+1AUenOLbCMsSLIUuJdMORJt2m4g9rz7
 8a/W8nNl/4tU+FrHfVi9he9UvJgND9w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=arc-outbound20181012;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:cc:to:from:subject:message-id:dkim-signature:from;
 bh=7PvE+cWyFmnLIFMAJfkyGAH8MdJsUv2iEbfgBB54qrU=;
 b=Vt40PU+dY5UOYLnj/t0KQSXOMh6Wgjzk4tZH7m40sXWq4SIV2IWKurvDzYCQpWH8Iodx2GH/9nVYr
 k0QdvdvULKFALbf1be+zaG/0tQvs8P5Ut50nd2p2X9poB8MZJGBWwpZsOe4Y60KVJAJ8yVOsPP/WP3
 /aWXHH3v6zOlvemnqoPF/HEIUT+9z9Lst3jlXpieteGzf2bZqQK3ZrV8mmQ+qtitRNSaeDfwnmh8iU
 p029ewr4Xa5HmqSHoHutXl4lvCkZL/CWkeyW1SKYJVLvhim9V8V5CrIAZjdMohj6ybheEf/yX9Txol
 RSX1nRnjALJOEDIcGg4ATFmndi/bU6A==
ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org;
 spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60;
 dmarc=none header.from=freebsd.org;
 arc=none header.oldest-pass=0;
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=outbound.mailhop.org; s=dkim-high;
 h=content-transfer-encoding:mime-version:content-type:references:in-reply-to:
 date:cc:to:from:subject:message-id:from;
 bh=7PvE+cWyFmnLIFMAJfkyGAH8MdJsUv2iEbfgBB54qrU=;
 b=myQeX2MIJJo4mykAEQ8n9+B278NeBfXpiL0kw1gh5VZOsZ98HuC7MxFF4ZVPZo5SQj9j+2cQliM7J
 Z+uMRsV/szH1Ubr7rvXyibci9dtbkxk2w10rPiczXh/nWi2Al7sNjhrpzcnT9kys5S+bCcGkoEOTda
 dtG4ipjHhmD6d1XPkSJd/dEMVra0qvFP+PTQkpHrAuhfR8fSNVLq+i631aYUMA90j7xHrCDoLLMSis
 cSovHdGZkehDncIBatYjRUK4pinTg2nsGhDA9FxHYhazXapgHyE2wU3XwOYksuqT9MQld7UTLnVZ3E
 sOZ407V90jCYEIcmc/ibdR8RZvHNPwg==
X-MHO-RoutePath: aGlwcGll
X-MHO-User: 8b80b073-b487-11e9-b679-cdd75d6ce7a8
X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information
X-Originating-IP: 67.177.211.60
X-Mail-Handler: DuoCircle Outbound SMTP
Received: from ilsoft.org (unknown [67.177.211.60])
 by outbound3.ore.mailhop.org (Halon) with ESMTPSA
 id 8b80b073-b487-11e9-b679-cdd75d6ce7a8;
 Thu, 01 Aug 2019 18:09:47 +0000 (UTC)
Received: from rev (rev [172.22.42.240])
 by ilsoft.org (8.15.2/8.15.2) with ESMTP id x71I9kCc002368;
 Thu, 1 Aug 2019 12:09:46 -0600 (MDT) (envelope-from ian@freebsd.org)
Message-ID: <d9a7b2c4ec7e673682d81d3f336b931ca99dc077.camel@freebsd.org>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
From: Ian Lepore <ian@freebsd.org>
To: John Baldwin <jhb@FreeBSD.org>, Ed Maste <emaste@freebsd.org>, "Rodney
 W. Grimes" <rgrimes@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all
 <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Date: Thu, 01 Aug 2019 12:09:46 -0600
In-Reply-To: <a430daff-5ef8-ef7c-24e9-3ebde76ae7e1@FreeBSD.org>
References: <CAPyFy2BpPbQ+XynADKzeraVnLXPuzm-ohM7uigMc-7S6Ly4YXA@mail.gmail.com>
 <201908011650.x71GoxBe060563@gndrsh.dnsmgr.net>
 <CAPyFy2Bj=2gaeXMA1AsFLX2=vmUjW2sEa9ugN00AzvAjqvZouw@mail.gmail.com>
 <a430daff-5ef8-ef7c-24e9-3ebde76ae7e1@FreeBSD.org>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 45zyxV0qRKz42Xx
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-0.79 / 15.00];
 local_wl_from(0.00)[freebsd.org];
 NEURAL_HAM_SHORT(-0.79)[-0.791,0];
 ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:09:50 -0000

On Thu, 2019-08-01 at 10:39 -0700, John Baldwin wrote:
> On 7/31/19 8:13 PM, Ed Maste wrote:
> > On Thu, 1 Aug 2019 at 12:51, Rodney W. Grimes <
> > freebsd@gndrsh.dnsmgr.net> wrote:
> > > 
> > > That would be fine, the important thing is that the
> > > r350505 gets listed in the file,
> > 
> > I don't see any reason that r350505 specifically should be in a
> > release note - this is a minor clarification of an existing
> > deprecation notice. It seems having an overall "deprecation
> > notices"
> > section in the release notes would make sense, but they should
> > really
> > persist from version to version. Should we add a top-level
> > DEPRECATION_NOTICES file perhaps? Or tag deprecation notices with
> > some
> > sort of comment in the source so they can be found with a 'grep'
> > during release preparation?
> 
> I think it would make sense to have "sections" in RELNOTES that mimic
> the sections we have in the existing release notes (e.g. kernel vs
> userland).  That is effectively what GDB does with a top level NEWS
> file.  This approach would hopefully make it easier to translate this
> file into the real release notes.  It also means that a given "note"
> can evolve over time (e.g. it might start with "XYZ is deprecated" to
> "XYZ is removed" if a deprecation note is added and merged and later
> it
> is removed) rather than only having a running journal ala UPDATING.
> 
> On the question of whether we want a dedicated section just for
> deprecation notices, I'm not sure.  Probably we can just stick with
> the
> layout of our existing release notes?
> 

I wonder why it is that this relnotes file is some kind of major
attractor for complexity?

As I understand it, the *entire* intent of this file was "if you forget
to add Relnotes: yes" to a commit, this gives you a way to flag the
commit after the fact, since commit messages are immutable.

If people realize they forgot Relnotes: yes, and the remedy for that is
that they have to spelunk around in some complex formatted file to find
the "right section" (whatever that means)... well, I think in the real
world: they won't.

-- Ian



From owner-svn-src-head@freebsd.org  Thu Aug  1 18:19:17 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B1CEC4D19;
 Thu,  1 Aug 2019 18:19:17 +0000 (UTC)
 (envelope-from lwhsu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zz8P2BKvz43Dc;
 Thu,  1 Aug 2019 18:19:17 +0000 (UTC)
 (envelope-from lwhsu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 298C01E399;
 Thu,  1 Aug 2019 18:19:17 +0000 (UTC)
 (envelope-from lwhsu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71IJGgN076400;
 Thu, 1 Aug 2019 18:19:16 GMT (envelope-from lwhsu@FreeBSD.org)
Received: (from lwhsu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71IJG0M076399;
 Thu, 1 Aug 2019 18:19:16 GMT (envelope-from lwhsu@FreeBSD.org)
Message-Id: <201908011819.x71IJG0M076399@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to
 lwhsu@FreeBSD.org using -f
From: Li-Wen Hsu <lwhsu@FreeBSD.org>
Date: Thu, 1 Aug 2019 18:19:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350512 - head/tests/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: lwhsu
X-SVN-Commit-Paths: head/tests/sys/kern
X-SVN-Commit-Revision: 350512
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:19:17 -0000

Author: lwhsu
Date: Thu Aug  1 18:19:16 2019
New Revision: 350512
URL: https://svnweb.freebsd.org/changeset/base/350512

Log:
  Only skip test cases sometimes failing in CI when they are running in CI
  
  Suggested by:	jhb
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==============================================================================
--- head/tests/sys/kern/ptrace_test.c	Thu Aug  1 17:59:56 2019	(r350511)
+++ head/tests/sys/kern/ptrace_test.c	Thu Aug  1 18:19:16 2019	(r350512)
@@ -258,7 +258,8 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug
 	int cpipe[2], dpipe[2], status;
 	char c;
 
-	atf_tc_skip("https://bugs.freebsd.org/239399");
+	if (atf_tc_get_config_var_as_bool(tc, "ci"))
+		atf_tc_skip("https://bugs.freebsd.org/239399");
 
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((child = fork()) != -1);
@@ -801,7 +802,8 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate
 	pid_t children[2], fpid, wpid;
 	int cpipe[2], status;
 
-	atf_tc_skip("https://bugs.freebsd.org/239397");
+	if (atf_tc_get_config_var_as_bool(tc, "ci"))
+		atf_tc_skip("https://bugs.freebsd.org/239397");
 
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((fpid = fork()) != -1);
@@ -871,7 +873,8 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat
 	pid_t children[2], fpid, wpid;
 	int cpipe[2], status;
 
-	atf_tc_skip("https://bugs.freebsd.org/239292");
+	if (atf_tc_get_config_var_as_bool(tc, "ci"))
+		atf_tc_skip("https://bugs.freebsd.org/239292");
 
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((fpid = fork()) != -1);
@@ -936,7 +939,8 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrela
 	pid_t children[2], fpid, wpid;
 	int cpipe[2], status;
 
-	atf_tc_skip("https://bugs.freebsd.org/239425");
+	if (atf_tc_get_config_var_as_bool(tc, "ci"))
+		atf_tc_skip("https://bugs.freebsd.org/239425");
 
 	ATF_REQUIRE(pipe(cpipe) == 0);
 	ATF_REQUIRE((fpid = fork()) != -1);
@@ -2084,7 +2088,8 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc)
 	struct ptrace_lwpinfo pl;
 	struct sched_param sched_param;
 
-	atf_tc_skip("https://bugs.freebsd.org/220841");
+	if (atf_tc_get_config_var_as_bool(tc, "ci"))
+		atf_tc_skip("https://bugs.freebsd.org/220841");
 
 	ATF_REQUIRE((fpid = fork()) != -1);
 	if (fpid == 0) {

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:51:00 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17D9AC5917;
 Thu,  1 Aug 2019 18:51:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "smtp.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zzrz6cGrz45VW;
 Thu,  1 Aug 2019 18:50:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx
 [66.234.199.215])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate) (Authenticated sender: jhb)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 4CF61153DE;
 Thu,  1 Aug 2019 18:50:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Subject: Re: svn commit: r350512 - head/tests/sys/kern
To: Li-Wen Hsu <lwhsu@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <201908011819.x71IJG0M076399@repo.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=jhb@FreeBSD.org; keydata=
 mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0
 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo
 /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD
 /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X
 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z
 pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1
 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k
 do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk
 d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID
 AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM
 jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3
 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj
 XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH
 YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO
 EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz
 hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX
 sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16
 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH
 aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx
 Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I
 SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf
 afMAg8QvmOWnHx3wl8WslCaXaE8=
Message-ID: <5aa3869a-8ccc-28d5-f95a-007784f41448@FreeBSD.org>
Date: Thu, 1 Aug 2019 11:50:57 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0)
 Gecko/20100101 Thunderbird/60.7.1
MIME-Version: 1.0
In-Reply-To: <201908011819.x71IJG0M076399@repo.freebsd.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:51:00 -0000

On 8/1/19 11:19 AM, Li-Wen Hsu wrote:
> Author: lwhsu
> Date: Thu Aug  1 18:19:16 2019
> New Revision: 350512
> URL: https://svnweb.freebsd.org/changeset/base/350512
> 
> Log:
>   Only skip test cases sometimes failing in CI when they are running in CI
>   
>   Suggested by:	jhb
>   Sponsored by:	The FreeBSD Foundation

Thanks Li-Wen!

-- 
John Baldwin

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:51:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01BF6C5A77;
 Thu,  1 Aug 2019 18:51:07 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zzs66H8Zz45d8;
 Thu,  1 Aug 2019 18:51:06 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B91191E92A;
 Thu,  1 Aug 2019 18:51:06 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71Ip6uk096660;
 Thu, 1 Aug 2019 18:51:06 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Ip6Pd096659;
 Thu, 1 Aug 2019 18:51:06 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908011851.x71Ip6Pd096659@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Thu, 1 Aug 2019 18:51:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350513 - head/lib/libc/gen
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/lib/libc/gen
X-SVN-Commit-Revision: 350513
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:51:07 -0000

Author: markj
Date: Thu Aug  1 18:51:06 2019
New Revision: 350513
URL: https://svnweb.freebsd.org/changeset/base/350513

Log:
  Fix formatting.
  
  MFC after:	3 days

Modified:
  head/lib/libc/gen/daemon.3

Modified: head/lib/libc/gen/daemon.3
==============================================================================
--- head/lib/libc/gen/daemon.3	Thu Aug  1 18:19:16 2019	(r350512)
+++ head/lib/libc/gen/daemon.3	Thu Aug  1 18:51:06 2019	(r350513)
@@ -93,7 +93,7 @@ function may fail and set
 .Va errno
 for any of the errors specified for the library functions
 .Xr fork 2
-.Xr open 2,
+.Xr open 2 ,
 and
 .Xr setsid 2 .
 .Sh SEE ALSO

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:51:19 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 019CFC5AFB;
 Thu,  1 Aug 2019 18:51:19 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zzsL5l1Mz45mX;
 Thu,  1 Aug 2019 18:51:18 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6D331E939;
 Thu,  1 Aug 2019 18:51:18 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71IpIwK097778;
 Thu, 1 Aug 2019 18:51:18 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71IpIiE097777;
 Thu, 1 Aug 2019 18:51:18 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908011851.x71IpIiE097777@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Thu, 1 Aug 2019 18:51:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350514 - head/lib/libc/gen
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/lib/libc/gen
X-SVN-Commit-Revision: 350514
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:51:19 -0000

Author: markj
Date: Thu Aug  1 18:51:18 2019
New Revision: 350514
URL: https://svnweb.freebsd.org/changeset/base/350514

Log:
  Add an MLINK for daemonfd(3).
  
  MFC after:	3 days

Modified:
  head/lib/libc/gen/Makefile.inc

Modified: head/lib/libc/gen/Makefile.inc
==============================================================================
--- head/lib/libc/gen/Makefile.inc	Thu Aug  1 18:51:06 2019	(r350513)
+++ head/lib/libc/gen/Makefile.inc	Thu Aug  1 18:51:18 2019	(r350514)
@@ -325,6 +325,7 @@ MLINKS+=arc4random.3 arc4random_buf.3 \
 	arc4random.3 arc4random_uniform.3
 MLINKS+=auxv.3 elf_aux_info.3
 MLINKS+=ctermid.3 ctermid_r.3
+MLINKS+=daemon.3 daemonfd.3
 MLINKS+=devname.3 devname_r.3
 MLINKS+=devname.3 fdevname.3
 MLINKS+=devname.3 fdevname_r.3

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:54:10 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11FCDC5D1D;
 Thu,  1 Aug 2019 18:54:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "smtp.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zzwd6lYrz46FN;
 Thu,  1 Aug 2019 18:54:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx
 [66.234.199.215])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate) (Authenticated sender: jhb)
 by smtp.freebsd.org (Postfix) with ESMTPSA id 195E315505;
 Thu,  1 Aug 2019 18:54:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
To: Ian Lepore <ian@freebsd.org>, Ed Maste <emaste@freebsd.org>,
 "Rodney W. Grimes" <rgrimes@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
References: <CAPyFy2BpPbQ+XynADKzeraVnLXPuzm-ohM7uigMc-7S6Ly4YXA@mail.gmail.com>
 <201908011650.x71GoxBe060563@gndrsh.dnsmgr.net>
 <CAPyFy2Bj=2gaeXMA1AsFLX2=vmUjW2sEa9ugN00AzvAjqvZouw@mail.gmail.com>
 <a430daff-5ef8-ef7c-24e9-3ebde76ae7e1@FreeBSD.org>
 <d9a7b2c4ec7e673682d81d3f336b931ca99dc077.camel@freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Openpgp: preference=signencrypt
Autocrypt: addr=jhb@FreeBSD.org; keydata=
 mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0
 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo
 /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD
 /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X
 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z
 pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1
 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k
 do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk
 d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID
 AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM
 jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3
 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj
 XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH
 YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO
 EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz
 hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX
 sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16
 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH
 aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx
 Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I
 SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf
 afMAg8QvmOWnHx3wl8WslCaXaE8=
Message-ID: <c899b9f4-eb69-e181-1372-28e5d14d2a4c@FreeBSD.org>
Date: Thu, 1 Aug 2019 11:54:07 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0)
 Gecko/20100101 Thunderbird/60.7.1
MIME-Version: 1.0
In-Reply-To: <d9a7b2c4ec7e673682d81d3f336b931ca99dc077.camel@freebsd.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:54:10 -0000

On 8/1/19 11:09 AM, Ian Lepore wrote:
> On Thu, 2019-08-01 at 10:39 -0700, John Baldwin wrote:
>> On 7/31/19 8:13 PM, Ed Maste wrote:
>>> On Thu, 1 Aug 2019 at 12:51, Rodney W. Grimes <
>>> freebsd@gndrsh.dnsmgr.net> wrote:
>>>>
>>>> That would be fine, the important thing is that the
>>>> r350505 gets listed in the file,
>>>
>>> I don't see any reason that r350505 specifically should be in a
>>> release note - this is a minor clarification of an existing
>>> deprecation notice. It seems having an overall "deprecation
>>> notices"
>>> section in the release notes would make sense, but they should
>>> really
>>> persist from version to version. Should we add a top-level
>>> DEPRECATION_NOTICES file perhaps? Or tag deprecation notices with
>>> some
>>> sort of comment in the source so they can be found with a 'grep'
>>> during release preparation?
>>
>> I think it would make sense to have "sections" in RELNOTES that mimic
>> the sections we have in the existing release notes (e.g. kernel vs
>> userland).  That is effectively what GDB does with a top level NEWS
>> file.  This approach would hopefully make it easier to translate this
>> file into the real release notes.  It also means that a given "note"
>> can evolve over time (e.g. it might start with "XYZ is deprecated" to
>> "XYZ is removed" if a deprecation note is added and merged and later
>> it
>> is removed) rather than only having a running journal ala UPDATING.
>>
>> On the question of whether we want a dedicated section just for
>> deprecation notices, I'm not sure.  Probably we can just stick with
>> the
>> layout of our existing release notes?
>>
> 
> I wonder why it is that this relnotes file is some kind of major
> attractor for complexity?
> 
> As I understand it, the *entire* intent of this file was "if you forget
> to add Relnotes: yes" to a commit, this gives you a way to flag the
> commit after the fact, since commit messages are immutable.
> 
> If people realize they forgot Relnotes: yes, and the remedy for that is
> that they have to spelunk around in some complex formatted file to find
> the "right section" (whatever that means)... well, I think in the real
> world: they won't.

My assumption was that relnotes would remain a simple text file.  I think
the win is that you aren't editing XML or SGML or the like, and that you
can go back and edit existing entries if needed as well as document
something when you missed relnotes: yes.  The more work we put into having
something closer to the finished product in this file, the less work re@
has to do to parse commit messages.

-- 
John Baldwin

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:56:33 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90B33C5E45;
 Thu,  1 Aug 2019 18:56:33 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 45zzzP3Mtcz46Vr;
 Thu,  1 Aug 2019 18:56:33 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5540C1EAD9;
 Thu,  1 Aug 2019 18:56:33 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71IuXxA000642;
 Thu, 1 Aug 2019 18:56:33 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71IuXLj000641;
 Thu, 1 Aug 2019 18:56:33 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908011856.x71IuXLj000641@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Thu, 1 Aug 2019 18:56:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350515 - head/contrib/elftoolchain/addr2line
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/contrib/elftoolchain/addr2line
X-SVN-Commit-Revision: 350515
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:56:33 -0000

Author: markj
Date: Thu Aug  1 18:56:32 2019
New Revision: 350515
URL: https://svnweb.freebsd.org/changeset/base/350515

Log:
  Capsicumize addr2line(1).
  
  Reviewed by:	oshogbo
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21104

Modified:
  head/contrib/elftoolchain/addr2line/addr2line.c

Modified: head/contrib/elftoolchain/addr2line/addr2line.c
==============================================================================
--- head/contrib/elftoolchain/addr2line/addr2line.c	Thu Aug  1 18:51:18 2019	(r350514)
+++ head/contrib/elftoolchain/addr2line/addr2line.c	Thu Aug  1 18:56:32 2019	(r350515)
@@ -25,6 +25,8 @@
  */
 
 #include <sys/param.h>
+
+#include <capsicum_helpers.h>
 #include <dwarf.h>
 #include <err.h>
 #include <fcntl.h>
@@ -649,6 +651,7 @@ find_section_base(const char *exe, Elf *e, const char 
 int
 main(int argc, char **argv)
 {
+	cap_rights_t rights;
 	Elf *e;
 	Dwarf_Debug dbg;
 	Dwarf_Error de;
@@ -705,6 +708,16 @@ main(int argc, char **argv)
 
 	if ((fd = open(exe, O_RDONLY)) < 0)
 		err(EXIT_FAILURE, "%s", exe);
+
+	if (caph_rights_limit(fd, cap_rights_init(&rights, CAP_FSTAT,
+	    CAP_MMAP_R)) < 0)
+		errx(EXIT_FAILURE, "caph_rights_limit");
+
+	caph_cache_catpages();
+	if (caph_limit_stdio() < 0)
+		errx(EXIT_FAILURE, "failed to limit stdio rights");
+	if (caph_enter() < 0)
+		errx(EXIT_FAILURE, "failed to enter capability mode");
 
 	if (dwarf_init(fd, DW_DLC_READ, NULL, NULL, &dbg, &de))
 		errx(EXIT_FAILURE, "dwarf_init: %s", dwarf_errmsg(de));

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:57:09 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A79A3C5ED4;
 Thu,  1 Aug 2019 18:57:09 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 46000541s2z46fT;
 Thu,  1 Aug 2019 18:57:09 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C0641EAEF;
 Thu,  1 Aug 2019 18:57:09 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71Iv9Hi000714;
 Thu, 1 Aug 2019 18:57:09 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Iv9sT000712;
 Thu, 1 Aug 2019 18:57:09 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908011857.x71Iv9sT000712@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Thu, 1 Aug 2019 18:57:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350516 - in head: contrib/elftoolchain/readelf
 usr.bin/readelf
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head: contrib/elftoolchain/readelf usr.bin/readelf
X-SVN-Commit-Revision: 350516
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:57:09 -0000

Author: markj
Date: Thu Aug  1 18:57:08 2019
New Revision: 350516
URL: https://svnweb.freebsd.org/changeset/base/350516

Log:
  Capsicumize readelf(1).
  
  Reviewed by:	oshogbo
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21108

Modified:
  head/contrib/elftoolchain/readelf/readelf.c
  head/usr.bin/readelf/Makefile

Modified: head/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.c	Thu Aug  1 18:56:32 2019	(r350515)
+++ head/contrib/elftoolchain/readelf/readelf.c	Thu Aug  1 18:57:08 2019	(r350516)
@@ -26,8 +26,10 @@
 
 #include <sys/param.h>
 #include <sys/queue.h>
+
 #include <ar.h>
 #include <assert.h>
+#include <capsicum_helpers.h>
 #include <ctype.h>
 #include <dwarf.h>
 #include <err.h>
@@ -45,6 +47,9 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <libcasper.h>
+#include <casper/cap_fileargs.h>
+
 #include "_elftc.h"
 
 ELFTC_VCSID("$Id: readelf.c 3649 2018-11-24 03:26:23Z emaste $");
@@ -7214,15 +7219,8 @@ process_members:
 }
 
 static void
-dump_object(struct readelf *re)
+dump_object(struct readelf *re, int fd)
 {
-	int fd;
-
-	if ((fd = open(re->filename, O_RDONLY)) == -1) {
-		warn("open %s failed", re->filename);
-		return;
-	}
-
 	if ((re->flags & DISPLAY_FILENAME) != 0)
 		printf("\nFile: %s\n", re->filename);
 
@@ -7589,9 +7587,11 @@ readelf_usage(int status)
 int
 main(int argc, char **argv)
 {
+	cap_rights_t	rights;
+	fileargs_t	*fa;
 	struct readelf	*re, re_storage;
 	unsigned long	 si;
-	int		 opt, i;
+	int		 fd, opt, i;
 	char		*ep;
 
 	re = &re_storage;
@@ -7714,9 +7714,28 @@ main(int argc, char **argv)
 		errx(EXIT_FAILURE, "ELF library initialization failed: %s",
 		    elf_errmsg(-1));
 
+	cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_MMAP_R, CAP_SEEK);
+	fa = fileargs_init(argc, argv, O_RDONLY, 0, &rights, FA_OPEN);
+	if (fa == NULL)
+		err(1, "Unable to initialize casper fileargs");
+
+	caph_cache_catpages();
+	if (caph_limit_stdio() < 0) {
+		fileargs_free(fa);
+		err(1, "Unable to limit stdio rights");
+	}
+	if (caph_enter_casper() < 0) {
+		fileargs_free(fa);
+		err(1, "Unable to enter capability mode");
+	}
+
 	for (i = 0; i < argc; i++) {
 		re->filename = argv[i];
-		dump_object(re);
+		fd = fileargs_open(fa, re->filename);
+		if (fd < 0)
+			warn("open %s failed", re->filename);
+		else
+			dump_object(re, fd);
 	}
 
 	exit(EXIT_SUCCESS);

Modified: head/usr.bin/readelf/Makefile
==============================================================================
--- head/usr.bin/readelf/Makefile	Thu Aug  1 18:56:32 2019	(r350515)
+++ head/usr.bin/readelf/Makefile	Thu Aug  1 18:57:08 2019	(r350516)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 ELFTCDIR=	${SRCTOP}/contrib/elftoolchain
 READELFDIR=	${ELFTCDIR}/readelf
 
@@ -9,6 +11,12 @@ PROG=	readelf
 SRCS=	readelf.c
 
 LIBADD=	dwarf elftc elf
+
+.if ${MK_CASPER} != "no"
+LIBADD+=	casper
+LIBADD+=	cap_fileargs
+CFLAGS+=	-DWITH_CASPER
+.endif
 
 CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
 

From owner-svn-src-head@freebsd.org  Thu Aug  1 18:57:38 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A669C5F36;
 Thu,  1 Aug 2019 18:57:38 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 46000f3XKzz46nb;
 Thu,  1 Aug 2019 18:57:38 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AE401EB01;
 Thu,  1 Aug 2019 18:57:38 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71IvcBp000775;
 Thu, 1 Aug 2019 18:57:38 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Ivb6U000774;
 Thu, 1 Aug 2019 18:57:37 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908011857.x71Ivb6U000774@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Thu, 1 Aug 2019 18:57:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350517 - in head: contrib/elftoolchain/size usr.bin/size
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head: contrib/elftoolchain/size usr.bin/size
X-SVN-Commit-Revision: 350517
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 18:57:38 -0000

Author: markj
Date: Thu Aug  1 18:57:37 2019
New Revision: 350517
URL: https://svnweb.freebsd.org/changeset/base/350517

Log:
  Capsicumize size(1).
  
  Reviewed by:	oshogbo
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21105

Modified:
  head/contrib/elftoolchain/size/size.c
  head/usr.bin/size/Makefile

Modified: head/contrib/elftoolchain/size/size.c
==============================================================================
--- head/contrib/elftoolchain/size/size.c	Thu Aug  1 18:57:08 2019	(r350516)
+++ head/contrib/elftoolchain/size/size.c	Thu Aug  1 18:57:37 2019	(r350517)
@@ -25,6 +25,7 @@
  */
 
 #include <assert.h>
+#include <capsicum_helpers.h>
 #include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
@@ -36,6 +37,9 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <libcasper.h>
+#include <casper/cap_fileargs.h>
+
 #include "_elftc.h"
 
 ELFTC_VCSID("$Id: size.c 3458 2016-05-09 15:01:25Z emaste $");
@@ -46,7 +50,6 @@ ELFTC_VCSID("$Id: size.c 3458 2016-05-09 15:01:25Z ema
 
 enum return_code {
 	RETURN_OK,
-	RETURN_NOINPUT,
 	RETURN_DATAERR,
 	RETURN_USAGE
 };
@@ -68,7 +71,6 @@ static int show_totals;
 static int size_option;
 static enum radix_style radix = RADIX_DECIMAL;
 static enum output_style style = STYLE_BERKELEY;
-static const char *default_args[2] = { "a.out", NULL };
 
 static struct {
 	int row;
@@ -97,7 +99,7 @@ static void	berkeley_header(void);
 static void	berkeley_totals(void);
 static int	handle_core(char const *, Elf *elf, GElf_Ehdr *);
 static void	handle_core_note(Elf *, GElf_Ehdr *, GElf_Phdr *, char **);
-static int	handle_elf(char const *);
+static int	handle_elf(int, char const *);
 static void	handle_phdr(Elf *, GElf_Ehdr *, GElf_Phdr *, uint32_t,
 		    const char *);
 static void	show_version(void);
@@ -119,8 +121,11 @@ static void	tbl_flush(void);
 int
 main(int argc, char **argv)
 {
-	int ch, r, rc;
-	const char **files, *fn;
+	cap_rights_t rights;
+	fileargs_t *fa;
+	int ch, fd, r, rc;
+	const char *fn;
+	char *defaultfn;
 
 	rc = RETURN_OK;
 
@@ -193,21 +198,45 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
-	files = (argc == 0) ? default_args : (void *) argv;
+	if (argc == 0) {
+		defaultfn = strdup("a.out");
+		if (defaultfn == NULL)
+			err(EXIT_FAILURE, "strdup");
+		argc = 1;
+		argv = &defaultfn;
+	} else {
+		defaultfn = NULL;
+	}
 
-	while ((fn = *files) != NULL) {
-		rc = handle_elf(fn);
+	cap_rights_init(&rights, CAP_FSTAT, CAP_MMAP_R);
+	fa = fileargs_init(argc, argv, O_RDONLY, 0, &rights, FA_OPEN);
+	if (fa == NULL)
+		err(EXIT_FAILURE, "failed to initialize fileargs");
+
+	caph_cache_catpages();
+	if (caph_limit_stdio() < 0)
+		err(EXIT_FAILURE, "failed to limit stdio rights");
+	if (caph_enter_casper() < 0)
+		err(EXIT_FAILURE, "failed to enter capability mode");
+
+	for (; argc > 0; argc--, argv++) {
+		fn = argv[0];
+		fd = fileargs_open(fa, fn);
+		if (fd < 0) {
+			warn("%s: Failed to open", fn);
+			continue;
+		}
+		rc = handle_elf(fd, fn);
 		if (rc != RETURN_OK)
-			warnx(rc == RETURN_NOINPUT ?
-			      "'%s': No such file" :
-			      "%s: File format not recognized", fn);
-		files++;
+			warnx("%s: File format not recognized", fn);
 	}
 	if (style == STYLE_BERKELEY) {
 		if (show_totals)
 			berkeley_totals();
 		tbl_flush();
 	}
+	fileargs_free(fa);
+	free(defaultfn);
         return (rc);
 }
 
@@ -582,7 +611,7 @@ handle_core(char const *name, Elf *elf, GElf_Ehdr *elf
  * or the size of the text, data, bss sections will be printed out.
  */
 static int
-handle_elf(char const *name)
+handle_elf(int fd, const char *name)
 {
 	GElf_Ehdr elfhdr;
 	GElf_Shdr shdr;
@@ -590,13 +619,7 @@ handle_elf(char const *name)
 	Elf_Arhdr *arhdr;
 	Elf_Scn *scn;
 	Elf_Cmd elf_cmd;
-	int exit_code, fd;
-
-	if (name == NULL)
-		return (RETURN_NOINPUT);
-
-	if ((fd = open(name, O_RDONLY, 0)) < 0)
-		return (RETURN_NOINPUT);
+	int exit_code;
 
 	elf_cmd = ELF_C_READ;
 	elf1 = elf_begin(fd, elf_cmd, NULL);

Modified: head/usr.bin/size/Makefile
==============================================================================
--- head/usr.bin/size/Makefile	Thu Aug  1 18:57:08 2019	(r350516)
+++ head/usr.bin/size/Makefile	Thu Aug  1 18:57:37 2019	(r350517)
@@ -11,6 +11,12 @@ PROG=	size
 
 LIBADD=	elftc elf
 
+.if ${MK_CASPER} != "no" && !defined(BOOTSTRAPPING) && !defined(NXB_TARGET)
+LIBADD+=	casper
+LIBADD+=	cap_fileargs
+CFLAGS+=	-DWITH_CASPER
+.endif
+
 CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
 
 .include <bsd.prog.mk>

From owner-svn-src-head@freebsd.org  Thu Aug  1 19:01:28 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E00BC60AF;
 Thu,  1 Aug 2019 19:01:28 +0000 (UTC)
 (envelope-from emaste@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4600542K9cz47DS;
 Thu,  1 Aug 2019 19:01: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31FC11EB7E;
 Thu,  1 Aug 2019 19:01: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 x71J1Sow001928;
 Thu, 1 Aug 2019 19:01:28 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71J1RAM001926;
 Thu, 1 Aug 2019 19:01:27 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201908011901.x71J1RAM001926@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste <emaste@FreeBSD.org>
Date: Thu, 1 Aug 2019 19:01:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350518 - in head: contrib/binutils/gas/doc
 gnu/usr.bin/binutils/as
X-SVN-Group: head
X-SVN-Commit-Author: emaste
X-SVN-Commit-Paths: in head: contrib/binutils/gas/doc gnu/usr.bin/binutils/as
X-SVN-Commit-Revision: 350518
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 19:01:28 -0000

Author: emaste
Date: Thu Aug  1 19:01:27 2019
New Revision: 350518
URL: https://svnweb.freebsd.org/changeset/base/350518

Log:
  as: add deprecation notice to the man page
  
  In the future FreeBSD will ship without GNU binutils 2.17.50.  Add a
  note advising users who require GNU as to install the binutils port
  or package.
  
  Note that on armv7, arm64, amd64, i386 we currently ship only two
  binutils tools (as and objdump).  A deprecation notice was added to
  objdump's man page some time ago.
  
  PR:		233611
  Discussed with:	jhb
  MFC after:	1 week
  Relnotes:	Yes
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/binutils/gas/doc/as.texinfo
  head/gnu/usr.bin/binutils/as/as.1

Modified: head/contrib/binutils/gas/doc/as.texinfo
==============================================================================
--- head/contrib/binutils/gas/doc/as.texinfo	Thu Aug  1 18:57:37 2019	(r350517)
+++ head/contrib/binutils/gas/doc/as.texinfo	Thu Aug  1 19:01:27 2019	(r350518)
@@ -1295,6 +1295,9 @@ computer-readable series of instructions.  Different v
 @section The GNU Assembler
 
 @c man begin DESCRIPTION
+@sc{gnu} @command{as} will be removed from a future version of the
+FreeBSD base system.  Users who require
+@sc{gnu} @command{as} are advised to install the binutils port or package.
 
 @sc{gnu} @command{as} is really a family of assemblers.
 @ifclear GENERIC

Modified: head/gnu/usr.bin/binutils/as/as.1
==============================================================================
--- head/gnu/usr.bin/binutils/as/as.1	Thu Aug  1 18:57:37 2019	(r350517)
+++ head/gnu/usr.bin/binutils/as/as.1	Thu Aug  1 19:01:27 2019	(r350518)
@@ -293,6 +293,10 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-\-alte
  [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR]
 .SH "DESCRIPTION"
 .IX Header "DESCRIPTION"
+\&\s-1GNU\s0 \fBas\fR will be removed from a future version of the
+FreeBSD base system.  Users who require
+\&\s-1GNU\s0 \fBas\fR are advised to install the binutils port or package.
+.PP
 \&\s-1GNU\s0 \fBas\fR is really a family of assemblers.
 If you use (or have used) the \s-1GNU\s0 assembler on one architecture, you
 should find a fairly similar environment when you use it on another

From owner-svn-src-head@freebsd.org  Thu Aug  1 19:26:17 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8207BC6E77;
 Thu,  1 Aug 2019 19:26:17 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4600dj2dNCz49QX;
 Thu,  1 Aug 2019 19:26:17 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C8351F0A4;
 Thu,  1 Aug 2019 19:26:17 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71JQH7l019344;
 Thu, 1 Aug 2019 19:26:17 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71JQH5b019342;
 Thu, 1 Aug 2019 19:26:17 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908011926.x71JQH5b019342@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Thu, 1 Aug 2019 19:26:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350519 - head/tools/build
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/tools/build
X-SVN-Commit-Revision: 350519
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 19:26:17 -0000

Author: markj
Date: Thu Aug  1 19:26:16 2019
New Revision: 350519
URL: https://svnweb.freebsd.org/changeset/base/350519

Log:
  Include caph_rights_limit() in libegacy if need be.
  
  Reported by:	jenkins
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tools/build/Makefile

Modified: head/tools/build/Makefile
==============================================================================
--- head/tools/build/Makefile	Thu Aug  1 19:01:27 2019	(r350518)
+++ head/tools/build/Makefile	Thu Aug  1 19:26:16 2019	(r350519)
@@ -51,8 +51,9 @@ SRCS+=		explicit_bzero.c
 
 .if exists(/usr/include/capsicum_helpers.h)
 _WITH_CAPH_ENTER!= grep -c caph_enter /usr/include/capsicum_helpers.h || true
+_WITH_CAPH_RIGHTS_LIMIT!= grep -c caph_rights_limit /usr/include/capsicum_helpers.h || true
 .endif
-.if !defined(_WITH_CAPH_ENTER) || ${_WITH_CAPH_ENTER} == 0
+.if !defined(_WITH_CAPH_ENTER) || ${_WITH_CAPH_ENTER} == 0 || ${_WITH_CAPH_RIGHTS_LIMIT} == 0
 .PATH: ${SRCTOP}/lib/libcapsicum
 INCS+=		capsicum_helpers.h
 .PATH: ${SRCTOP}/lib/libcasper/libcasper

From owner-svn-src-head@freebsd.org  Thu Aug  1 19:45:35 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A647C797C;
 Thu,  1 Aug 2019 19:45:35 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 46013z1HmSz4CBf;
 Thu,  1 Aug 2019 19:45:35 +0000 (UTC)
 (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F72B1F454;
 Thu,  1 Aug 2019 19:45:35 +0000 (UTC)
 (envelope-from tuexen@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71JjYHZ031464;
 Thu, 1 Aug 2019 19:45:34 GMT (envelope-from tuexen@FreeBSD.org)
Received: (from tuexen@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71JjYT4031463;
 Thu, 1 Aug 2019 19:45:34 GMT (envelope-from tuexen@FreeBSD.org)
Message-Id: <201908011945.x71JjYT4031463@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: tuexen set sender to
 tuexen@FreeBSD.org using -f
From: Michael Tuexen <tuexen@FreeBSD.org>
Date: Thu, 1 Aug 2019 19:45:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350520 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: tuexen
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350520
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 19:45:35 -0000

Author: tuexen
Date: Thu Aug  1 19:45:34 2019
New Revision: 350520
URL: https://svnweb.freebsd.org/changeset/base/350520

Log:
  Fix the reporting of multiple unknown parameters in an received INIT
  chunk. This also plugs an potential mbuf leak.
  Thanks to Felix Weinrank for reporting this issue found by fuzz-testing
  the userland stack.
  
  MFC after:		3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Aug  1 19:26:16 2019	(r350519)
+++ head/sys/netinet/sctp_output.c	Thu Aug  1 19:45:34 2019	(r350520)
@@ -4988,17 +4988,17 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_
 	 */
 	struct sctp_paramhdr *phdr, params;
 
-	struct mbuf *mat, *op_err;
+	struct mbuf *mat, *m_tmp, *op_err, *op_err_last;
 	int at, limit, pad_needed;
 	uint16_t ptype, plen, padded_size;
-	int err_at;
 
 	*abort_processing = 0;
 	mat = in_initpkt;
-	err_at = 0;
 	limit = ntohs(cp->chunk_length) - sizeof(struct sctp_init_chunk);
 	at = param_offset;
 	op_err = NULL;
+	op_err_last = NULL;
+	pad_needed = 0;
 	SCTPDBG(SCTP_DEBUG_OUTPUT1, "Check for unrecognized param's\n");
 	phdr = sctp_get_next_param(mat, at, &params, sizeof(params));
 	while ((phdr != NULL) && ((size_t)limit >= sizeof(struct sctp_paramhdr))) {
@@ -5123,6 +5123,7 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_
 				*abort_processing = 1;
 				sctp_m_freem(op_err);
 				op_err = NULL;
+				op_err_last = NULL;
 #ifdef INET6
 				l_len = SCTP_MIN_OVERHEAD;
 #else
@@ -5131,7 +5132,7 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_
 				l_len += sizeof(struct sctp_chunkhdr);
 				l_len += sizeof(struct sctp_gen_error_cause);
 				op_err = sctp_get_mbuf_for_msg(l_len, 0, M_NOWAIT, 1, MT_DATA);
-				if (op_err) {
+				if (op_err != NULL) {
 					/*
 					 * Pre-reserve space for IP, SCTP,
 					 * and chunk header.
@@ -5151,6 +5152,7 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_
 					if (SCTP_BUF_NEXT(op_err) == NULL) {
 						sctp_m_freem(op_err);
 						op_err = NULL;
+						op_err_last = NULL;
 					}
 				}
 				return (op_err);
@@ -5186,37 +5188,55 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_
 #endif
 						SCTP_BUF_RESV_UF(op_err, sizeof(struct sctphdr));
 						SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr));
+						op_err_last = op_err;
 					}
 				}
-				if (op_err) {
+				if (op_err != NULL) {
 					/* If we have space */
-					struct sctp_paramhdr s;
+					struct sctp_paramhdr *param;
 
-					if (err_at % 4) {
-						uint32_t cpthis = 0;
-
-						pad_needed = 4 - (err_at % 4);
-						m_copyback(op_err, err_at, pad_needed, (caddr_t)&cpthis);
-						err_at += pad_needed;
+					if (pad_needed > 0) {
+						op_err_last = sctp_add_pad_tombuf(op_err_last, pad_needed);
 					}
-					s.param_type = htons(SCTP_UNRECOG_PARAM);
-					s.param_length = htons((uint16_t)sizeof(struct sctp_paramhdr) + plen);
-					m_copyback(op_err, err_at, sizeof(struct sctp_paramhdr), (caddr_t)&s);
-					err_at += sizeof(struct sctp_paramhdr);
-					SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(mat, at, plen, M_NOWAIT);
-					if (SCTP_BUF_NEXT(op_err) == NULL) {
+					if (op_err_last == NULL) {
 						sctp_m_freem(op_err);
-						/*
-						 * we are out of memory but
-						 * we still need to have a
-						 * look at what to do (the
-						 * system is in trouble
-						 * though).
-						 */
 						op_err = NULL;
+						op_err_last = NULL;
 						goto more_processing;
 					}
-					err_at += plen;
+					if (M_TRAILINGSPACE(op_err_last) < (int)sizeof(struct sctp_paramhdr)) {
+						m_tmp = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_NOWAIT, 1, MT_DATA);
+						if (m_tmp == NULL) {
+							sctp_m_freem(op_err);
+							op_err = NULL;
+							op_err_last = NULL;
+							goto more_processing;
+						}
+						SCTP_BUF_LEN(m_tmp) = 0;
+						SCTP_BUF_NEXT(m_tmp) = NULL;
+						SCTP_BUF_NEXT(op_err_last) = m_tmp;
+						op_err_last = m_tmp;
+					}
+					param = (struct sctp_paramhdr *)(mtod(op_err_last, caddr_t)+SCTP_BUF_LEN(op_err_last));
+					param->param_type = htons(SCTP_UNRECOG_PARAM);
+					param->param_length = htons((uint16_t)sizeof(struct sctp_paramhdr) + plen);
+					SCTP_BUF_LEN(op_err_last) += sizeof(struct sctp_paramhdr);
+					SCTP_BUF_NEXT(op_err_last) = SCTP_M_COPYM(mat, at, plen, M_NOWAIT);
+					if (SCTP_BUF_NEXT(op_err_last) == NULL) {
+						sctp_m_freem(op_err);
+						op_err = NULL;
+						op_err_last = NULL;
+						goto more_processing;
+					} else {
+						while (SCTP_BUF_NEXT(op_err_last) != NULL) {
+							op_err_last = SCTP_BUF_NEXT(op_err_last);
+						}
+					}
+					if (plen % 4 != 0) {
+						pad_needed = 4 - (plen % 4);
+					} else {
+						pad_needed = 0;
+					}
 				}
 			}
 	more_processing:
@@ -5239,6 +5259,7 @@ invalid_size:
 	*abort_processing = 1;
 	sctp_m_freem(op_err);
 	op_err = NULL;
+	op_err_last = NULL;
 	if (phdr != NULL) {
 		struct sctp_paramhdr *param;
 		int l_len;

From owner-svn-src-head@freebsd.org  Thu Aug  1 19:51:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F3B0C7A1B;
 Thu,  1 Aug 2019 19:51:08 +0000 (UTC)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: from gndrsh.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 4601BM15wjz4CNH;
 Thu,  1 Aug 2019 19:51:05 +0000 (UTC)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1])
 by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x71Jp2wY061346;
 Thu, 1 Aug 2019 12:51:02 -0700 (PDT)
 (envelope-from freebsd@gndrsh.dnsmgr.net)
Received: (from freebsd@localhost)
 by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x71Jp2EJ061345;
 Thu, 1 Aug 2019 12:51:02 -0700 (PDT) (envelope-from freebsd)
From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net>
Message-Id: <201908011951.x71Jp2EJ061345@gndrsh.dnsmgr.net>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
In-Reply-To: <d9a7b2c4ec7e673682d81d3f336b931ca99dc077.camel@freebsd.org>
To: Ian Lepore <ian@freebsd.org>
Date: Thu, 1 Aug 2019 12:51:02 -0700 (PDT)
CC: John Baldwin <jhb@freebsd.org>, Ed Maste <emaste@freebsd.org>,
 "Rodney W. Grimes" <rgrimes@freebsd.org>,
 src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
Reply-To: rgrimes@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-Rspamd-Queue-Id: 4601BM15wjz4CNH
X-Spamd-Bar: +
Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none;
 spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF
 policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net
X-Spamd-Result: default: False [1.39 / 15.00]; ARC_NA(0.00)[];
 HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.45)[0.448,0];
 MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[];
 DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[];
 REPLYTO_DOM_NEQ_FROM_DOM(0.00)[];
 IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.05),
 country: US(-0.05)]; TO_DN_ALL(0.00)[];
 RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[];
 FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[];
 MIME_TRACE(0.00)[0:+];
 ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US];
 MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 19:51:08 -0000

> On Thu, 2019-08-01 at 10:39 -0700, John Baldwin wrote:
> > On 7/31/19 8:13 PM, Ed Maste wrote:
> > > On Thu, 1 Aug 2019 at 12:51, Rodney W. Grimes <
> > > freebsd@gndrsh.dnsmgr.net> wrote:
> > > > 
> > > > That would be fine, the important thing is that the
> > > > r350505 gets listed in the file,
> > > 
> > > I don't see any reason that r350505 specifically should be in a
> > > release note - this is a minor clarification of an existing
> > > deprecation notice. It seems having an overall "deprecation
> > > notices"
> > > section in the release notes would make sense, but they should
> > > really
> > > persist from version to version. Should we add a top-level
> > > DEPRECATION_NOTICES file perhaps? Or tag deprecation notices with
> > > some
> > > sort of comment in the source so they can be found with a 'grep'
> > > during release preparation?
> > 
> > I think it would make sense to have "sections" in RELNOTES that mimic
> > the sections we have in the existing release notes (e.g. kernel vs
> > userland).  That is effectively what GDB does with a top level NEWS
> > file.  This approach would hopefully make it easier to translate this
> > file into the real release notes.  It also means that a given "note"
> > can evolve over time (e.g. it might start with "XYZ is deprecated" to
> > "XYZ is removed" if a deprecation note is added and merged and later
> > it
> > is removed) rather than only having a running journal ala UPDATING.
> > 
> > On the question of whether we want a dedicated section just for
> > deprecation notices, I'm not sure.  Probably we can just stick with
> > the
> > layout of our existing release notes?
> > 
> 
> I wonder why it is that this relnotes file is some kind of major
> attractor for complexity?
> 
> As I understand it, the *entire* intent of this file was "if you forget
> to add Relnotes: yes" to a commit, this gives you a way to flag the
> commit after the fact, since commit messages are immutable.
> 
> If people realize they forgot Relnotes: yes, and the remedy for that is
> that they have to spelunk around in some complex formatted file to find
> the "right section" (whatever that means)... well, I think in the real
> world: they won't.

That was my original intent when "I" first proposed this,
imho that is as simple as it needs to be.  Markj then
later proposed this file here in a review, which I did
give some feedback on, and here we are now, having
discussion that probably would of better been had during
a wider review process.

Regards,
Rod
-- 
Rod Grimes                                                 rgrimes@freebsd.org

From owner-svn-src-head@freebsd.org  Thu Aug  1 20:26:28 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80561A1668;
 Thu,  1 Aug 2019 20:26:28 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4601z82cjfz4FJr;
 Thu,  1 Aug 2019 20:26:28 +0000 (UTC) (envelope-from rrs@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36F8B1FB73;
 Thu,  1 Aug 2019 20:26:28 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71KQSNb055278;
 Thu, 1 Aug 2019 20:26:28 GMT (envelope-from rrs@FreeBSD.org)
Received: (from rrs@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71KQSjT055277;
 Thu, 1 Aug 2019 20:26:28 GMT (envelope-from rrs@FreeBSD.org)
Message-Id: <201908012026.x71KQSjT055277@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org
 using -f
From: Randall Stewart <rrs@FreeBSD.org>
Date: Thu, 1 Aug 2019 20:26:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350521 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: rrs
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350521
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 20:26:28 -0000

Author: rrs
Date: Thu Aug  1 20:26:27 2019
New Revision: 350521
URL: https://svnweb.freebsd.org/changeset/base/350521

Log:
  Opps use fetchadd_u64 not long to keep old 32 bit platforms
  happy.

Modified:
  head/sys/netinet/tcp_ratelimit.c

Modified: head/sys/netinet/tcp_ratelimit.c
==============================================================================
--- head/sys/netinet/tcp_ratelimit.c	Thu Aug  1 19:45:34 2019	(r350520)
+++ head/sys/netinet/tcp_ratelimit.c	Thu Aug  1 20:26:27 2019	(r350521)
@@ -1186,7 +1186,7 @@ tcp_rel_pacing_rate(const struct tcp_hwrate_limit_tabl
 	 * in order to release our refcount.
 	 */
 	rs = __DECONST(struct tcp_rate_set *, crs);
-	pre = atomic_fetchadd_long(&rs->rs_flows_using, -1);
+	pre = atomic_fetchadd_64(&rs->rs_flows_using, -1);
 	if (pre == 1) {
 		mtx_lock(&rs_mtx);
 		/*

From owner-svn-src-head@freebsd.org  Thu Aug  1 20:36:25 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id F273FA1890;
 Thu,  1 Aug 2019 20:36:25 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4602Bd5zPRz4Fjr;
 Thu,  1 Aug 2019 20:36:25 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAE7E1FD2F;
 Thu,  1 Aug 2019 20:36:25 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71KaPDa061047;
 Thu, 1 Aug 2019 20:36:25 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71KaPla061046;
 Thu, 1 Aug 2019 20:36:25 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908012036.x71KaPla061046@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Thu, 1 Aug 2019 20:36:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350522 - head/usr.bin/netstat
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: head/usr.bin/netstat
X-SVN-Commit-Revision: 350522
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 20:36:26 -0000

Author: bz
Date: Thu Aug  1 20:36:25 2019
New Revision: 350522
URL: https://svnweb.freebsd.org/changeset/base/350522

Log:
  IPv6 cleanup: netstat
  
  Rename the variable for the in6_addr from in6p to ia6 to follow the
  convention generally used in FreeBSD.
  
  No functional changes.
  
  MFC after:		3 months
  Sponsored by:		Netflix

Modified:
  head/usr.bin/netstat/inet6.c

Modified: head/usr.bin/netstat/inet6.c
==============================================================================
--- head/usr.bin/netstat/inet6.c	Thu Aug  1 20:26:27 2019	(r350521)
+++ head/usr.bin/netstat/inet6.c	Thu Aug  1 20:36:25 2019	(r350522)
@@ -1310,7 +1310,7 @@ inet6print(const char *container, struct in6_addr *in6
  */
 
 char *
-inet6name(struct in6_addr *in6p)
+inet6name(struct in6_addr *ia6)
 {
 	struct sockaddr_in6 sin6;
 	char hbuf[NI_MAXHOST], *cp;
@@ -1319,7 +1319,7 @@ inet6name(struct in6_addr *in6p)
 	static int first = 1;
 	int flags, error;
 
-	if (IN6_IS_ADDR_UNSPECIFIED(in6p)) {
+	if (IN6_IS_ADDR_UNSPECIFIED(ia6)) {
 		strcpy(line, "*");
 		return (line);
 	}
@@ -1332,9 +1332,9 @@ inet6name(struct in6_addr *in6p)
 			domain[0] = 0;
 	}
 	memset(&sin6, 0, sizeof(sin6));
-	memcpy(&sin6.sin6_addr, in6p, sizeof(*in6p));
+	memcpy(&sin6.sin6_addr, ia6, sizeof(*ia6));
 	sin6.sin6_family = AF_INET6;
-	/* XXX: in6p.s6_addr[2] can contain scopeid. */
+	/* XXX: ia6.s6_addr[2] can contain scopeid. */
 	in6_fillscopeid(&sin6);
 	flags = (numeric_addr) ? NI_NUMERICHOST : 0;
 	error = getnameinfo((struct sockaddr *)&sin6, sizeof(sin6), hbuf,

From owner-svn-src-head@freebsd.org  Thu Aug  1 21:44:10 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDA08A2792;
 Thu,  1 Aug 2019 21:44:10 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4603hp5GHfz4J7r;
 Thu,  1 Aug 2019 21:44:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D31820988;
 Thu,  1 Aug 2019 21:44:10 +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 x71LiA4N002303;
 Thu, 1 Aug 2019 21:44:10 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Li7rN002288;
 Thu, 1 Aug 2019 21:44:07 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908012144.x71Li7rN002288@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 1 Aug 2019 21:44:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350523 - in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Commit-Revision: 350523
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 21:44:10 -0000

Author: mav
Date: Thu Aug  1 21:44:07 2019
New Revision: 350523
URL: https://svnweb.freebsd.org/changeset/base/350523

Log:
  Add IOCTL to translate nvdX into nvmeY and NSID.
  
  While very useful by itself, it also makes `nvmecontrol` not depend on
  hardcoded device names parsing, that in its turn makes simple to take
  nvdX (and potentially any other) device names as arguments.
  
  Also added IOCTL bypass from nvdX to respective nvmeYnsZ makes them
  interchangeable for management purposes.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Added:
  head/sbin/nvmecontrol/nsid.c   (contents, props changed)
Modified:
  head/sbin/nvmecontrol/Makefile
  head/sbin/nvmecontrol/devlist.c
  head/sbin/nvmecontrol/firmware.c
  head/sbin/nvmecontrol/format.c
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/identify_ext.c
  head/sbin/nvmecontrol/logpage.c
  head/sbin/nvmecontrol/ns.c
  head/sbin/nvmecontrol/nvmecontrol.8
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sbin/nvmecontrol/nvmecontrol.h
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_ns.c

Modified: head/sbin/nvmecontrol/Makefile
==============================================================================
--- head/sbin/nvmecontrol/Makefile	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/Makefile	Thu Aug  1 21:44:07 2019	(r350523)
@@ -3,7 +3,8 @@
 PACKAGE=runtime
 PROG=	nvmecontrol
 SRCS=	comnd.c nvmecontrol.c
-SRCS+=	devlist.c firmware.c format.c identify.c logpage.c ns.c perftest.c power.c reset.c
+SRCS+=	devlist.c firmware.c format.c identify.c logpage.c ns.c nsid.c
+SRCS+=	perftest.c power.c reset.c
 #SRCS+=	passthru.c
 SRCS+=	identify_ext.c nvme_util.c nc_util.c
 MAN=	nvmecontrol.8

Modified: head/sbin/nvmecontrol/devlist.c
==============================================================================
--- head/sbin/nvmecontrol/devlist.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/devlist.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -107,11 +107,11 @@ devlist(const struct cmd *f, int argc, char *argv[])
 		printf("%6s: %s\n", name, mn);
 
 		for (i = 0; i < cdata.nn; i++) {
-			sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr,
-			    NVME_NS_PREFIX, i+1);
-			read_namespace_data(fd, i+1, &nsdata);
+			read_namespace_data(fd, i + 1, &nsdata);
 			if (nsdata.nsze == 0)
 				continue;
+			sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr,
+			    NVME_NS_PREFIX, i + 1);
 			printf("  %10s (%lldMB)\n",
 				name,
 				nsdata.nsze *

Modified: head/sbin/nvmecontrol/firmware.c
==============================================================================
--- head/sbin/nvmecontrol/firmware.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/firmware.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -224,7 +224,7 @@ firmware(const struct cmd *f, int argc, char *argv[])
 	int				activate_action, reboot_required;
 	char				prompt[64];
 	void				*buf = NULL;
-	int32_t				size = 0;
+	int32_t				size = 0, nsid;
 	uint16_t			oacs_fw;
 	uint8_t				fw_slot1_ro, fw_num_slots;
 	struct nvme_controller_data	cdata;
@@ -253,10 +253,6 @@ firmware(const struct cmd *f, int argc, char *argv[])
 		arg_help(argc, argv, f);
 	}
 
-	/* Check that a controller (and not a namespace) was specified. */
-	if (strstr(opt.dev, NVME_NS_PREFIX) != NULL)
-		arg_help(argc, argv, f);
-
 	if (opt.activate && opt.fw_img == NULL && opt.slot == 0) {
 		fprintf(stderr,
 		    "Slot number to activate not specified.\n");
@@ -264,6 +260,14 @@ firmware(const struct cmd *f, int argc, char *argv[])
 	}
 
 	open_dev(opt.dev, &fd, 1, 1);
+
+	/* Check that a controller (and not a namespace) was specified. */
+	get_nsid(fd, NULL, &nsid);
+	if (nsid != 0) {
+		close(fd);
+		arg_help(argc, argv, f);
+	}
+
 	read_controller_data(fd, &cdata);
 
 	oacs_fw = (cdata.oacs >> NVME_CTRLR_DATA_OACS_FIRMWARE_SHIFT) &

Modified: head/sbin/nvmecontrol/format.c
==============================================================================
--- head/sbin/nvmecontrol/format.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/format.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -1,8 +1,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (C) 2018 Alexander Motin <mav@FreeBSD.org>
- * All rights reserved.
+ * Copyright (C) 2018-2019 Alexander Motin <mav@FreeBSD.org>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -117,7 +116,7 @@ format(const struct cmd *f, int argc, char *argv[])
 	struct nvme_controller_data	cd;
 	struct nvme_namespace_data	nsd;
 	struct nvme_pt_command		pt;
-	char				path[64];
+	char				*path;
 	const char			*target;
 	uint32_t			nsid;
 	int				lbaf, ms, pi, pil, ses, fd;
@@ -143,18 +142,9 @@ format(const struct cmd *f, int argc, char *argv[])
 	else
 		ses = opt.ses;
 
-	/*
-	 * Check if the specified device node exists before continuing.
-	 * This is a cleaner check for cases where the correct controller
-	 * is specified, but an invalid namespace on that controller.
-	 */
 	open_dev(target, &fd, 1, 1);
-
-	/*
-	 * If device node contains "ns", we consider it a namespace,
-	 * otherwise, consider it a controller.
-	 */
-	if (strstr(target, NVME_NS_PREFIX) == NULL) {
+	get_nsid(fd, &path, &nsid);
+	if (nsid == 0) {
 		nsid = NVME_GLOBAL_NAMESPACE_TAG;
 	} else {
 		/*
@@ -164,9 +154,9 @@ format(const struct cmd *f, int argc, char *argv[])
 		 * string to get the controller substring and namespace ID.
 		 */
 		close(fd);
-		parse_ns_str(target, path, &nsid);
 		open_dev(path, &fd, 1, 1);
 	}
+	free(path);
 
 	/* Check that controller can execute this command. */
 	read_controller_data(fd, &cd);

Modified: head/sbin/nvmecontrol/identify.c
==============================================================================
--- head/sbin/nvmecontrol/identify.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/identify.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
+ * Copyright (C) 2018-2019 Alexander Motin <mav@FreeBSD.org>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -44,6 +45,8 @@ __FBSDID("$FreeBSD$");
 #include "nvmecontrol.h"
 #include "nvmecontrol_ext.h"
 
+#define NONE 0xfffffffeu
+
 static struct options {
 	bool		hex;
 	bool		verbose;
@@ -53,7 +56,7 @@ static struct options {
 	.hex = false,
 	.verbose = false,
 	.dev = NULL,
-	.nsid = 0,
+	.nsid = NONE,
 };
 
 void
@@ -170,12 +173,11 @@ print_namespace(struct nvme_namespace_data *nsdata)
 }
 
 static void
-identify_ctrlr(const struct cmd *f, int argc, char *argv[])
+identify_ctrlr(int fd)
 {
 	struct nvme_controller_data	cdata;
-	int				fd, hexlength;
+	int				hexlength;
 
-	open_dev(opt.dev, &fd, 1, 1);
 	read_controller_data(fd, &cdata);
 	close(fd);
 
@@ -189,41 +191,16 @@ identify_ctrlr(const struct cmd *f, int argc, char *ar
 		exit(0);
 	}
 
-	if (opt.verbose) {
-		fprintf(stderr, "-v not currently supported without -x\n");
-		arg_help(argc, argv, f);
-	}
-
 	nvme_print_controller(&cdata);
 	exit(0);
 }
 
 static void
-identify_ns(const struct cmd *f, int argc, char *argv[])
+identify_ns(int fd, uint32_t nsid)
 {
 	struct nvme_namespace_data	nsdata;
-	char				path[64];
-	int				fd, hexlength;
-	uint32_t			nsid;
+	int				hexlength;
 
-	open_dev(opt.dev, &fd, 1, 1);
-	if (strstr(opt.dev, NVME_NS_PREFIX) != NULL) {
-		/*
-		 * Now we know that provided device name is valid, that is
-		 * good for error reporting if specified controller name is
-		 * valid, but namespace ID is not.  But we send IDENTIFY
-		 * commands to the controller, not the namespace, since it
-		 * is an admin cmd.  The namespace ID will be specified in
-		 * the IDENTIFY command itself.  So parse the namespace's
-		 * device node string to get the controller device substring
-		 * and namespace ID.
-		 */
-		close(fd);
-		parse_ns_str(opt.dev, path, &nsid);
-		open_dev(path, &fd, 1, 1);
-	} else {
-		nsid = opt.nsid;
-	}
 	read_namespace_data(fd, nsid, &nsdata);
 	close(fd);
 
@@ -237,11 +214,6 @@ identify_ns(const struct cmd *f, int argc, char *argv[
 		exit(0);
 	}
 
-	if (opt.verbose) {
-		fprintf(stderr, "-v not currently supported without -x\n");
-		arg_help(argc, argv, f);
-	}
-
 	print_namespace(&nsdata);
 	exit(0);
 }
@@ -249,16 +221,32 @@ identify_ns(const struct cmd *f, int argc, char *argv[
 static void
 identify(const struct cmd *f, int argc, char *argv[])
 {
+	char		*path;
+	int		fd;
+	uint32_t	nsid;
+
 	arg_parse(argc, argv, f);
 
-	/*
-	 * If device node contains "ns" or nsid is specified, we consider
-	 * it a namespace request, otherwise, consider it a controller.
-	 */
-	if (strstr(opt.dev, NVME_NS_PREFIX) == NULL && opt.nsid == 0)
-		identify_ctrlr(f, argc, argv);
+	open_dev(opt.dev, &fd, 1, 1);
+	get_nsid(fd, &path, &nsid);
+	if (nsid != 0) {
+		/*
+		 * We got namespace device, but we need to send IDENTIFY
+		 * commands to the controller, not the namespace, since it
+		 * is an admin cmd.  The namespace ID will be specified in
+		 * the IDENTIFY command itself.
+		 */
+		close(fd);
+		open_dev(path, &fd, 1, 1);
+	}
+	free(path);
+	if (opt.nsid != NONE)
+		nsid = opt.nsid;
+
+	if (nsid == 0)
+		identify_ctrlr(fd);
 	else
-		identify_ns(f, argc, argv);
+		identify_ns(fd, nsid);
 }
 
 static const struct opts identify_opts[] = {

Modified: head/sbin/nvmecontrol/identify_ext.c
==============================================================================
--- head/sbin/nvmecontrol/identify_ext.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/identify_ext.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
+ * Copyright (C) 2018-2019 Alexander Motin <mav@FreeBSD.org>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/sbin/nvmecontrol/logpage.c
==============================================================================
--- head/sbin/nvmecontrol/logpage.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/logpage.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -399,8 +399,7 @@ static void
 logpage(const struct cmd *f, int argc, char *argv[])
 {
 	int				fd;
-	bool				ns_specified;
-	char				cname[64];
+	char				*path;
 	uint32_t			nsid, size;
 	void				*buf;
 	const struct logpage_function	*lpf;
@@ -421,15 +420,15 @@ logpage(const struct cmd *f, int argc, char *argv[])
 		fprintf(stderr, "Missing page_id (-p).\n");
 		arg_help(argc, argv, f);
 	}
-	if (strstr(opt.dev, NVME_NS_PREFIX) != NULL) {
-		ns_specified = true;
-		parse_ns_str(opt.dev, cname, &nsid);
-		open_dev(cname, &fd, 1, 1);
-	} else {
-		ns_specified = false;
+	open_dev(opt.dev, &fd, 1, 1);
+	get_nsid(fd, &path, &nsid);
+	if (nsid == 0) {
 		nsid = NVME_GLOBAL_NAMESPACE_TAG;
-		open_dev(opt.dev, &fd, 1, 1);
+	} else {
+		close(fd);
+		open_dev(path, &fd, 1, 1);
 	}
+	free(path);
 
 	read_controller_data(fd, &cdata);
 
@@ -441,7 +440,7 @@ logpage(const struct cmd *f, int argc, char *argv[])
 	 * supports the SMART/Health information log page on a per
 	 * namespace basis.
 	 */
-	if (ns_specified) {
+	if (nsid != NVME_GLOBAL_NAMESPACE_TAG) {
 		if (opt.page != NVME_LOG_HEALTH_INFORMATION)
 			errx(1, "log page %d valid only at controller level",
 			    opt.page);

Modified: head/sbin/nvmecontrol/ns.c
==============================================================================
--- head/sbin/nvmecontrol/ns.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/ns.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2017 Netflix, Inc.
- * Copyright (C) 2018 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (C) 2018-2019 Alexander Motin <mav@FreeBSD.org>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Added: head/sbin/nvmecontrol/nsid.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sbin/nvmecontrol/nsid.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -0,0 +1,80 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (C) 2019 Alexander Motin <mav@FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "nvmecontrol.h"
+#include "comnd.h"
+
+/* Tables for command line parsing */
+
+static cmd_fn_t nsid;
+
+static struct nsid_options {
+	const char	*dev;
+} nsid_opt = {
+	.dev = NULL,
+};
+
+static const struct args nsid_args[] = {
+	{ arg_string, &nsid_opt.dev, "namespace-id" },
+	{ arg_none, NULL, NULL },
+};
+
+static struct cmd nsid_cmd = {
+	.name = "nsid",
+	.fn = nsid,
+	.descr = "Get controller and NSID for namespace",
+	.ctx_size = sizeof(nsid_opt),
+	.opts = NULL,
+	.args = nsid_args,
+};
+
+CMD_COMMAND(nsid_cmd);
+
+static void
+nsid(const struct cmd *f, int argc, char *argv[])
+{
+	char		*path;
+	int		fd;
+	uint32_t	nsid;
+
+	arg_parse(argc, argv, f);
+
+	open_dev(nsid_opt.dev, &fd, 1, 1);
+	get_nsid(fd, &path, &nsid);
+	close(fd);
+	printf("%s\t%u\n", path, nsid);
+	free(path);
+}

Modified: head/sbin/nvmecontrol/nvmecontrol.8
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.8	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/nvmecontrol.8	Thu Aug  1 21:44:07 2019	(r350523)
@@ -1,5 +1,5 @@
 .\"
-.\" Copyright (c) 2018 Alexander Motin <mav@FreeBSD.org>
+.\" Copyright (c) 2018-2019 Alexander Motin <mav@FreeBSD.org>
 .\" Copyright (c) 2012 Intel Corporation
 .\" All rights reserved.
 .\"
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 31, 2019
+.Dd August 1, 2019
 .Dt NVMECONTROL 8
 .Os
 .Sh NAME
@@ -113,6 +113,10 @@
 .Op Fl x
 .Aq Fl n Ar nsid
 .Aq device id
+.Nm
+.Ic nsid
+.Aq device id
+.Aq namespace id
 .Nm
 .Ic firmware
 .Op Fl s Ar slot

Modified: head/sbin/nvmecontrol/nvmecontrol.c
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/nvmecontrol.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -146,16 +146,6 @@ open_dev(const char *str, int *fd, int show_error, int
 {
 	char		full_path[64];
 
-	if (!strnstr(str, NVME_CTRLR_PREFIX, strlen(NVME_CTRLR_PREFIX))) {
-		if (show_error)
-			warnx("controller/namespace ids must begin with '%s'",
-			    NVME_CTRLR_PREFIX);
-		if (exit_on_error)
-			exit(1);
-		else
-			return (EINVAL);
-	}
-
 	snprintf(full_path, sizeof(full_path), _PATH_DEV"%s", str);
 	*fd = open(full_path, O_RDWR);
 	if (*fd < 0) {
@@ -171,26 +161,16 @@ open_dev(const char *str, int *fd, int show_error, int
 }
 
 void
-parse_ns_str(const char *ns_str, char *ctrlr_str, uint32_t *nsid)
+get_nsid(int fd, char **ctrlr_str, uint32_t *nsid)
 {
-	char	*nsloc;
+	struct nvme_get_nsid gnsid;
 
-	/*
-	 * Pull the namespace id from the string. +2 skips past the "ns" part
-	 *  of the string.  Don't search past 10 characters into the string,
-	 *  otherwise we know it is malformed.
-	 */
-	nsloc = strnstr(ns_str, NVME_NS_PREFIX, 10);
-	if (nsloc != NULL)
-		*nsid = strtol(nsloc + 2, NULL, 10);
-	if (nsloc == NULL || (*nsid == 0 && errno != 0))
-		errx(1, "invalid namespace ID '%s'", ns_str);
-
-	/*
-	 * The controller string will include only the nvmX part of the
-	 *  nvmeXnsY string.
-	 */
-	snprintf(ctrlr_str, nsloc - ns_str + 1, "%s", ns_str);
+	if (ioctl(fd, NVME_GET_NSID, &gnsid) < 0)
+		err(1, "NVME_GET_NSID ioctl failed");
+	if (ctrlr_str != NULL)
+		*ctrlr_str = strndup(gnsid.cdev, sizeof(gnsid.cdev));
+	if (nsid != NULL)
+		*nsid = gnsid.nsid;
 }
 
 int

Modified: head/sbin/nvmecontrol/nvmecontrol.h
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.h	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sbin/nvmecontrol/nvmecontrol.h	Thu Aug  1 21:44:07 2019	(r350523)
@@ -69,7 +69,7 @@ void logpage_register(struct logpage_function *p);
 #define NVME_NS_PREFIX		"ns"
 
 int open_dev(const char *str, int *fd, int show_error, int exit_on_error);
-void parse_ns_str(const char *ns_str, char *ctrlr_str, uint32_t *nsid);
+void get_nsid(int fd, char **ctrlr_str, uint32_t *nsid);
 void read_controller_data(int fd, struct nvme_controller_data *cdata);
 void read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdata);
 void print_hex(void *data, uint32_t length);

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sys/dev/nvme/nvme.h	Thu Aug  1 21:44:07 2019	(r350523)
@@ -40,6 +40,7 @@
 
 #define	NVME_PASSTHROUGH_CMD		_IOWR('n', 0, struct nvme_pt_command)
 #define	NVME_RESET_CONTROLLER		_IO('n', 1)
+#define	NVME_GET_NSID			_IOR('n', 2, struct nvme_get_nsid)
 
 #define	NVME_IO_TEST			_IOWR('n', 100, struct nvme_io_test)
 #define	NVME_BIO_TEST			_IOWR('n', 101, struct nvme_io_test)
@@ -1332,6 +1333,11 @@ struct nvme_pt_command {
 	struct mtx *		driver_lock;
 };
 
+struct nvme_get_nsid {
+	char		cdev[SPECNAMELEN + 1];
+	uint32_t	nsid;
+};
+
 #define nvme_completion_is_error(cpl)					\
 	(NVME_STATUS_GET_SC((cpl)->status) != 0 || NVME_STATUS_GET_SCT((cpl)->status) != 0)
 
@@ -1340,6 +1346,7 @@ void	nvme_strvis(uint8_t *dst, const uint8_t *src, int
 #ifdef _KERNEL
 
 struct bio;
+struct thread;
 
 struct nvme_namespace;
 struct nvme_controller;
@@ -1429,6 +1436,8 @@ uint32_t	nvme_ns_get_stripesize(struct nvme_namespace 
 
 int	nvme_ns_bio_process(struct nvme_namespace *ns, struct bio *bp,
 			    nvme_cb_fn_t cb_fn);
+int	nvme_ns_ioctl_process(struct nvme_namespace *ns, u_long cmd,
+    caddr_t arg, int flag, struct thread *td);
 
 /*
  * Command building helper functions -- shared with CAM

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -1126,6 +1126,14 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_
 		pt = (struct nvme_pt_command *)arg;
 		return (nvme_ctrlr_passthrough_cmd(ctrlr, pt, le32toh(pt->cmd.nsid),
 		    1 /* is_user_buffer */, 1 /* is_admin_cmd */));
+	case NVME_GET_NSID:
+	{
+		struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg;
+		strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev),
+		    sizeof(gnsid->cdev));
+		gnsid->nsid = 0;
+		break;
+	}
 	default:
 		return (ENOTTY);
 	}

Modified: head/sys/dev/nvme/nvme_ns.c
==============================================================================
--- head/sys/dev/nvme/nvme_ns.c	Thu Aug  1 20:36:25 2019	(r350522)
+++ head/sys/dev/nvme/nvme_ns.c	Thu Aug  1 21:44:07 2019	(r350523)
@@ -82,6 +82,14 @@ nvme_ns_ioctl(struct cdev *cdev, u_long cmd, caddr_t a
 		pt = (struct nvme_pt_command *)arg;
 		return (nvme_ctrlr_passthrough_cmd(ctrlr, pt, ns->id, 
 		    1 /* is_user_buffer */, 0 /* is_admin_cmd */));
+	case NVME_GET_NSID:
+	{
+		struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg;
+		strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev),
+		    sizeof(gnsid->cdev));
+		gnsid->nsid = ns->id;
+		break;
+	}
 	case DIOCGMEDIASIZE:
 		*(off_t *)arg = (off_t)nvme_ns_get_size(ns);
 		break;
@@ -481,6 +489,13 @@ nvme_ns_bio_process(struct nvme_namespace *ns, struct 
 	}
 
 	return (err);
+}
+
+int
+nvme_ns_ioctl_process(struct nvme_namespace *ns, u_long cmd, caddr_t arg,
+    int flag, struct thread *td)
+{
+	return (nvme_ns_ioctl(ns->cdev, cmd, arg, flag, td));
 }
 
 int

From owner-svn-src-head@freebsd.org  Thu Aug  1 22:22:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A7F0A2EE6;
 Thu,  1 Aug 2019 22:22:07 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4604Xb2hjCz4KXr;
 Thu,  1 Aug 2019 22:22:07 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F99D21066;
 Thu,  1 Aug 2019 22:22: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 x71MM72k023581;
 Thu, 1 Aug 2019 22:22:07 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71MM7cw023580;
 Thu, 1 Aug 2019 22:22:07 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908012222.x71MM7cw023580@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 1 Aug 2019 22:22:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350524 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350524
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 22:22:07 -0000

Author: mav
Date: Thu Aug  1 22:22:06 2019
New Revision: 350524
URL: https://svnweb.freebsd.org/changeset/base/350524

Log:
  Rename function added in r350523 to make gcc happy.
  
  MFC after:	2 weeks

Modified:
  head/sbin/nvmecontrol/nsid.c

Modified: head/sbin/nvmecontrol/nsid.c
==============================================================================
--- head/sbin/nvmecontrol/nsid.c	Thu Aug  1 21:44:07 2019	(r350523)
+++ head/sbin/nvmecontrol/nsid.c	Thu Aug  1 22:22:06 2019	(r350524)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 
 /* Tables for command line parsing */
 
-static cmd_fn_t nsid;
+static cmd_fn_t gnsid;
 
 static struct nsid_options {
 	const char	*dev;
@@ -54,7 +54,7 @@ static const struct args nsid_args[] = {
 
 static struct cmd nsid_cmd = {
 	.name = "nsid",
-	.fn = nsid,
+	.fn = gnsid,
 	.descr = "Get controller and NSID for namespace",
 	.ctx_size = sizeof(nsid_opt),
 	.opts = NULL,
@@ -64,7 +64,7 @@ static struct cmd nsid_cmd = {
 CMD_COMMAND(nsid_cmd);
 
 static void
-nsid(const struct cmd *f, int argc, char *argv[])
+gnsid(const struct cmd *f, int argc, char *argv[])
 {
 	char		*path;
 	int		fd;

From owner-svn-src-head@freebsd.org  Thu Aug  1 22:48:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F319A3677;
 Thu,  1 Aug 2019 22:48:07 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 46056Z73hmz4LV6;
 Thu,  1 Aug 2019 22:48:06 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFA0621436;
 Thu,  1 Aug 2019 22:48:06 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71Mm6t1038013;
 Thu, 1 Aug 2019 22:48:06 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71Mm641038012;
 Thu, 1 Aug 2019 22:48:06 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908012248.x71Mm641038012@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Thu, 1 Aug 2019 22:48:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350525 - in head/sys/arm64: arm64 include
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: in head/sys/arm64: arm64 include
X-SVN-Commit-Revision: 350525
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 22:48:07 -0000

Author: markj
Date: Thu Aug  1 22:48:06 2019
New Revision: 350525
URL: https://svnweb.freebsd.org/changeset/base/350525

Log:
  Use ATTR_DBM even when hardware dirty bit management is not enabled.
  
  The ARMv8 reference manual only states that the bit is reserved in
  this case; following Linux's example, use it instead of a
  software-defined bit for the purpose of indicating that a managed
  mapping is writable.
  
  Reviewed by:	alc, andrew
  MFC after:	r350004
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21121

Modified:
  head/sys/arm64/arm64/pmap.c
  head/sys/arm64/include/pte.h

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Thu Aug  1 22:22:06 2019	(r350524)
+++ head/sys/arm64/arm64/pmap.c	Thu Aug  1 22:48:06 2019	(r350525)
@@ -221,8 +221,11 @@ __FBSDID("$FreeBSD$");
  * The presence of this flag indicates that the mapping is writeable.
  * If the ATTR_AP_RO bit is also set, then the mapping is clean, otherwise it is
  * dirty.  This flag may only be set on managed mappings.
+ *
+ * The DBM bit is reserved on ARMv8.0 but it seems we can safely treat it
+ * as a software managed bit.
  */
-static pt_entry_t ATTR_SW_DBM;
+#define	ATTR_SW_DBM	ATTR_DBM
 
 struct pmap kernel_pmap_store;
 
@@ -783,15 +786,6 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_
 	vm_paddr_t start_pa, pa, min_pa;
 	uint64_t kern_delta;
 	int i;
-
-#ifdef notyet
-	/* Determine whether the hardware implements DBM management. */
-	uint64_t reg = READ_SPECIALREG(ID_AA64MMFR1_EL1);
-	ATTR_SW_DBM = ID_AA64MMFR1_HAFDBS(reg) == ID_AA64MMFR1_HAFDBS_AF_DBS ?
-	    ATTR_DBM : _ATTR_SW_DBM;
-#else
-	ATTR_SW_DBM = _ATTR_SW_DBM;
-#endif
 
 	kern_delta = KERNBASE - kernstart;
 

Modified: head/sys/arm64/include/pte.h
==============================================================================
--- head/sys/arm64/include/pte.h	Thu Aug  1 22:22:06 2019	(r350524)
+++ head/sys/arm64/include/pte.h	Thu Aug  1 22:48:06 2019	(r350525)
@@ -43,8 +43,8 @@ typedef	uint64_t	pt_entry_t;		/* page table entry */
 #define	ATTR_MASK_L	UINT64_C(0x0000000000000fff)
 #define	ATTR_MASK	(ATTR_MASK_H | ATTR_MASK_L)
 /* Bits 58:55 are reserved for software */
-#define	ATTR_SW_UNUSED	(1UL << 58)
-#define	_ATTR_SW_DBM	(1UL << 57)
+#define	ATTR_SW_UNUSED2	(1UL << 58)
+#define	ATTR_SW_UNUSED1	(1UL << 57)
 #define	ATTR_SW_MANAGED	(1UL << 56)
 #define	ATTR_SW_WIRED	(1UL << 55)
 #define	ATTR_UXN	(1UL << 54)

From owner-svn-src-head@freebsd.org  Thu Aug  1 22:54:47 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AB02A3ADC;
 Thu,  1 Aug 2019 22:54:47 +0000 (UTC)
 (envelope-from yaneurabeya@gmail.com)
Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com
 [IPv6:2607:f8b0:4864:20::429])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4605GG2Dspz4M3Q;
 Thu,  1 Aug 2019 22:54:46 +0000 (UTC)
 (envelope-from yaneurabeya@gmail.com)
Received: by mail-pf1-x429.google.com with SMTP id p184so34894350pfp.7;
 Thu, 01 Aug 2019 15:54:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=tN3Cz5aOXllZbnbB/xW+ikruxy/QErRE6gb0eBiQenw=;
 b=vZ1IHhS4bLo1UN/DDU/PbQMHaCn6fMOf0Fc2FC1FQP5keiimwjH60XuyBqDzSLKF//
 G40s42YkDOxbhbGvVf+PXXHZ+EiUJHzsQdxu0WdprmMiyOewmCQs0lNMl4QHnHTrpujN
 1xg4mhY3DfH/8gjN6VauvYYb8WVZZy6tya0TR+z7+hx3NHxZDeEDmCP5hvP3D+jGaOoy
 UvNcRnbdQxyz1ucaPE3//o5khMa2uGhIeZ4JwgZnSKDsZAonof0EhPwGjQXbkesAZdbY
 IOGGU/Pl0iNbW+mXqxtD1VrL/ho4J4sLDrPLcmDBR7mpIrmRCJzXrjX1lRcwQPGy/e1w
 fT6w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=tN3Cz5aOXllZbnbB/xW+ikruxy/QErRE6gb0eBiQenw=;
 b=f6GbEQzXAz0xBZrfoi8P0gdIDhdqPrJJev4Dyh8hINOFIthLxzRGEFukxaJduWMuAU
 kPJZwHtJ3IJ6J0U3jEavSce74YWgRNwmHpWfpYwYu6/1+7xX5xnxANSitfVJ2RZ/pnQx
 e8jLuso8ZfSsnlk4qXBWaakUeZyfgSO1eMBGxYjM4wqFzvWFI3A5qITNNp1NqIyOhc9/
 Q/R2S7kRBCTSOdxVWBBKubZ5vsELHpFPd7Lm7wUQsbDoX35CG7BeK5HB6mMIRTWWPfaA
 nz98YAj8Er2/aUZ0T5qFUHSKOGooGvOZiPYFG37qvnvFqcQipHUh2SGlWMHW7LfGuPu/
 XfRw==
X-Gm-Message-State: APjAAAWp5eLDv5yat9uHmc6q6GYn78LT1Uwh3ozv0KIKNnlvDcwCnlFU
 yi5ZRGG/1mL4auBJ1CFHuzX053a1
X-Google-Smtp-Source: APXvYqy3oDq3qrKlaME4Nd72EqkBKEba7IU1hctFdSalwIFNeoGlDCsId6c+Bnx7fc+nkUOXp2YfgA==
X-Received: by 2002:a17:90a:228b:: with SMTP id
 s11mr1117506pjc.23.1564700084349; 
 Thu, 01 Aug 2019 15:54:44 -0700 (PDT)
Received: from ?IPv6:2607:fb90:b2e9:8e70:c45f:8832:c431:b7ce?
 ([2607:fb90:b2e9:8e70:c45f:8832:c431:b7ce])
 by smtp.gmail.com with ESMTPSA id a128sm82013350pfb.185.2019.08.01.15.54.43
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 01 Aug 2019 15:54:43 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (1.0)
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
From: Enji Cooper <yaneurabeya@gmail.com>
X-Mailer: iPhone Mail (16F203)
In-Reply-To: <CAPyFy2AxES0Sn29ELRHETQ-d3UvKSnskR8up_6_pV7cY9-iJkA@mail.gmail.com>
Date: Thu, 1 Aug 2019 15:54:42 -0700
Cc: Ian Lepore <ian@freebsd.org>, src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <9A3E35C8-7CB9-4E5C-92F4-367715A9909E@gmail.com>
References: <201908011442.x71Egfa9047254@repo.freebsd.org>
 <23d23900d06581050562951f5cf6a625235a059f.camel@freebsd.org>
 <CAPyFy2AxES0Sn29ELRHETQ-d3UvKSnskR8up_6_pV7cY9-iJkA@mail.gmail.com>
To: Ed Maste <emaste@freebsd.org>
X-Rspamd-Queue-Id: 4605GG2Dspz4M3Q
X-Spamd-Bar: /
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=gmail.com header.s=20161025 header.b=vZ1IHhS4;
 dmarc=pass (policy=none) header.from=gmail.com;
 spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates
 2607:f8b0:4864:20::429 as permitted sender)
 smtp.mailfrom=yaneurabeya@gmail.com
X-Spamd-Result: default: False [-0.50 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36];
 FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_SCORE_FREEMAIL(0.00)[];
 RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3];
 IP_SCORE(0.00)[ip: (-8.05), ipnet: 2607:f8b0::/32(-3.09), asn: 15169(-2.46),
 country: US(-0.05)]; TO_DN_ALL(0.00)[];
 DKIM_TRACE(0.00)[gmail.com:+];
 DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
 RCVD_IN_DNSWL_NONE(0.00)[9.2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org
 : 127.0.5.0]; MV_CASE(0.50)[]; FROM_EQ_ENVFROM(0.00)[];
 MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
 MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[];
 DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 22:54:47 -0000


> On Jul 31, 2019, at 19:58, Ed Maste <emaste@freebsd.org> wrote:
>=20
>> On Thu, 1 Aug 2019 at 12:35, Ian Lepore <ian@freebsd.org> wrote:
>>=20
>> Why would we provide no objdump?  I use it quite frequently; it seems
>> like an essential part of the toolchain to me.
>=20
> I don't want us to provide no objdump, but providing GNU objdump
> 2.17.50 indefinitely is not a viable option; see PR 218387[1] for an
> example of the kind of issue we have with providing obsolete software.
>=20
> We have a choice of:
> 1. provide llvm-objdump, and no /usr/bin/objdump in the base system
> 2. install llvm-objdump as /usr/bin/objdump
> 3. require that users who want an objdump install the binutils port
>=20
> /usr/bin/objdump is not required by the base system build and not
> required by most ports. exp-run details with no /usr/bin/objdump can
> be found in PR 212319[2], and PR 229046[3] is a tracking PR for
> removing dependencies on objdump.
>=20
> Option 1 (removing /usr/bin/objdump) is proposed in review D7338[4]
> while option 2 is (installing llvm-objdump as objdump) is proposed in
> review D18307. llvm-objdump is roughly compatible with GNU objdump
> (command line and output format) but there are a large number of small
> issues that will likely trip up scripted or automated objdump use.
> (Scripts should probably just use readelf instead, though.) D18307 has
> a list of LLVM bug reports for known issues in llvm-objdump.
>=20
> Note also that we currently provide only two or three obsolete
> binutils, depending on the CPU architecture:
> - as
> - ld
> - objdump
>=20
> [1] https://bugs.freebsd.org/218387
> [2] https://bugs.freebsd.org/212319
> [3] https://bugs.freebsd.org/229046
> [4] https://reviews.freebsd.org/D7338
> [5] https://reviews.freebsd.org/D18307

Thought: could this be modified in an iterative manner, like =E2=80=9Cobjdum=
p=E2=80=9D -> =E2=80=9Cgobjdump=E2=80=9D / =E2=80=9Cllvm-objdump=E2=80=9D ->=
 =E2=80=9Cobjdump=E2=80=9D, etc (assuming llvm and gnu objdump are largely c=
ompatible)?
Thanks :)!
-Enji=

From owner-svn-src-head@freebsd.org  Thu Aug  1 23:08:24 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 438D0A3ECA;
 Thu,  1 Aug 2019 23:08:24 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: from mail-io1-f48.google.com (mail-io1-f48.google.com
 [209.85.166.48])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4605Yz3c3Dz4Mfb;
 Thu,  1 Aug 2019 23:08:23 +0000 (UTC)
 (envelope-from carpeddiem@gmail.com)
Received: by mail-io1-f48.google.com with SMTP id k8so148158915iot.1;
 Thu, 01 Aug 2019 16:08:23 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=kh2H+s3Zkq4HvHO6bMp5cI4Qm8JptHH3Qzwk5Sj4IXE=;
 b=mN+YOWOhKdpKRvr2ax5uqFNbVrgO0SnmM18ix2RBgPoMecSpj+zA43iOvV1Dc9+LHG
 4rRTzexvCrhVtdkZ8VPsrkLr7b1/KGJZ505Vs6YFW+QYzu1+t7V65JGnNYKgGghE4NXc
 wd2ijwgRq4G2CFZS2pnobkcvvQq1Z5KY3CUzlGMTPLYEtz2ucIP3V0NKTRtFmJhvBhd3
 PFL3mWiKK9gLh1+0AuXdhvLS3GuKZUiUQrkY7zwPYPw9rDM4NAli2Bz0LYyEHH9Lj580
 rq4MNbRoXkyre8wh9114GrrKFIB8lrKmdDg5vTWvuW/41XsTvdcFAfiQ9WpWQPZZq/Mk
 7Muw==
X-Gm-Message-State: APjAAAUEEHXVZwLwzRaXG6+tXQVvYWKisftQ85giVTYXChDLRqcjJAWS
 ficH6ZdU5VQFfNe9zbpPwYB/1SUK6c4t3Yx/Ynk=
X-Google-Smtp-Source: APXvYqxHl6hh7qGQnJzAwG5KG3SIL4FL8yfcNUhP8OT8kAbznq0ypuXp5LrBYd1v0OwLoRTifWI5B+pSLsVcJYLmPC8=
X-Received: by 2002:a6b:5b01:: with SMTP id v1mr16356725ioh.120.1564700901319; 
 Thu, 01 Aug 2019 16:08:21 -0700 (PDT)
MIME-Version: 1.0
References: <201908011442.x71Egfa9047254@repo.freebsd.org>
 <23d23900d06581050562951f5cf6a625235a059f.camel@freebsd.org>
 <CAPyFy2AxES0Sn29ELRHETQ-d3UvKSnskR8up_6_pV7cY9-iJkA@mail.gmail.com>
 <9A3E35C8-7CB9-4E5C-92F4-367715A9909E@gmail.com>
In-Reply-To: <9A3E35C8-7CB9-4E5C-92F4-367715A9909E@gmail.com>
From: Ed Maste <emaste@freebsd.org>
Date: Thu, 1 Aug 2019 05:11:36 -0400
Message-ID: <CAPyFy2DsvPdt9XFWKW=p+mGK=hfzwqQoy3PTejz=vUjGS+ouSg@mail.gmail.com>
Subject: Re: svn commit: r350505 - in head: contrib/binutils/binutils/doc
 gnu/usr.bin/binutils/objdump
To: Enji Cooper <yaneurabeya@gmail.com>
Cc: Ian Lepore <ian@freebsd.org>, src-committers <src-committers@freebsd.org>, 
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Rspamd-Queue-Id: 4605Yz3c3Dz4Mfb
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none;
 spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates
 209.85.166.48 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com
X-Spamd-Result: default: False [-2.73 / 15.00]; ARC_NA(0.00)[];
 FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
 MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+];
 DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5];
 TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[];
 RCVD_IN_DNSWL_NONE(0.00)[48.166.85.209.list.dnswl.org : 127.0.5.0];
 IP_SCORE(-2.73)[ip: (-7.74), ipnet: 209.85.128.0/17(-3.40), asn: 15169(-2.46),
 country: US(-0.05)]; 
 FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com];
 FREEMAIL_TO(0.00)[gmail.com];
 RWL_MAILSPIKE_POSSIBLE(0.00)[48.166.85.209.rep.mailspike.net : 127.0.0.17];
 R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com];
 ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
 FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com];
 RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Aug 2019 23:08:24 -0000

On Thu, 1 Aug 2019 at 18:54, Enji Cooper <yaneurabeya@gmail.com> wrote:
>
> Thought: could this be modified in an iterative manner, like =E2=80=9Cobj=
dump=E2=80=9D -> =E2=80=9Cgobjdump=E2=80=9D / =E2=80=9Cllvm-objdump=E2=80=
=9D -> =E2=80=9Cobjdump=E2=80=9D, etc (assuming llvm and gnu objdump are la=
rgely compatible)?

It could, and we have done that sort of thing in the past. But here we
should be retiring the old binutils tools well before 13.0 and I don't
think it's worth the extra complexity.

From owner-svn-src-head@freebsd.org  Fri Aug  2 03:43:25 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52517A84FB;
 Fri,  2 Aug 2019 03:43:25 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460CgK1TGfz4YgY;
 Fri,  2 Aug 2019 03:43:25 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EF2B24A27;
 Fri,  2 Aug 2019 03:43:25 +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 x723hO3h015516;
 Fri, 2 Aug 2019 03:43:24 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x723hO5q015513;
 Fri, 2 Aug 2019 03:43:24 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908020343.x723hO5q015513@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 2 Aug 2019 03:43:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350529 - in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Commit-Revision: 350529
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 03:43:25 -0000

Author: mav
Date: Fri Aug  2 03:43:24 2019
New Revision: 350529
URL: https://svnweb.freebsd.org/changeset/base/350529

Log:
  Add more new fields and values from NVMe 1.4.
  
  MFC after:	2 weeks

Modified:
  head/sbin/nvmecontrol/logpage.c
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sbin/nvmecontrol/logpage.c
==============================================================================
--- head/sbin/nvmecontrol/logpage.c	Fri Aug  2 01:59:58 2019	(r350528)
+++ head/sbin/nvmecontrol/logpage.c	Fri Aug  2 03:43:24 2019	(r350529)
@@ -243,6 +243,9 @@ print_log_error(const struct nvme_controller_data *cda
 		printf(" LBA:                  %ju\n", entry->lba);
 		printf(" Namespace ID:         %u\n", entry->nsid);
 		printf(" Vendor specific info: %u\n", entry->vendor_specific);
+		printf(" Transport type:       %u\n", entry->trtype);
+		printf(" Command specific info:%ju\n", entry->csi);
+		printf(" Transport specific:   %u\n", entry->ttsi);
 	}
 }
 
@@ -315,6 +318,10 @@ print_log_health(const struct nvme_controller_data *cd
 		printf("Temperature Sensor %d:           ", i + 1);
 		print_temp(health->temp_sensor[i]);
 	}
+	printf("Temperature 1 Transition Count: %d\n", health->tmt1tc);
+	printf("Temperature 2 Transition Count: %d\n", health->tmt2tc);
+	printf("Total Time For Temperature 1:   %d\n", health->ttftmt1);
+	printf("Total Time For Temperature 2:   %d\n", health->ttftmt2);
 }
 
 static void

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h	Fri Aug  2 01:59:58 2019	(r350528)
+++ head/sys/dev/nvme/nvme.h	Fri Aug  2 03:43:24 2019	(r350529)
@@ -600,6 +600,9 @@ enum nvme_generic_command_status_code {
 	NVME_SC_SANITIZE_IN_PROGRESS		= 0x1d,
 	NVME_SC_SGL_DATA_BLOCK_GRAN_INVALID	= 0x1e,
 	NVME_SC_NOT_SUPPORTED_IN_CMB		= 0x1f,
+	NVME_SC_NAMESPACE_IS_WRITE_PROTECTED	= 0x20,
+	NVME_SC_COMMAND_INTERRUPTED		= 0x21,
+	NVME_SC_TRANSIENT_TRANSPORT_ERROR	= 0x22,
 
 	NVME_SC_LBA_OUT_OF_RANGE		= 0x80,
 	NVME_SC_CAPACITY_EXCEEDED		= 0x81,
@@ -645,6 +648,9 @@ enum nvme_command_specific_status_code {
 	NVME_SC_INVALID_SEC_CTRLR_STATE		= 0x20,
 	NVME_SC_INVALID_NUM_OF_CTRLR_RESRC	= 0x21,
 	NVME_SC_INVALID_RESOURCE_ID		= 0x22,
+	NVME_SC_SANITIZE_PROHIBITED_WPMRE	= 0x23,
+	NVME_SC_ANA_GROUP_ID_INVALID		= 0x24,
+	NVME_SC_ANA_ATTACH_FAILED		= 0x25,
 
 	NVME_SC_CONFLICTING_ATTRIBUTES		= 0x80,
 	NVME_SC_INVALID_PROTECTION_INFO		= 0x81,
@@ -682,20 +688,27 @@ enum nvme_admin_opcode {
 	/* 0x0e-0x0f - reserved */
 	NVME_OPC_FIRMWARE_ACTIVATE		= 0x10,
 	NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD	= 0x11,
+	/* 0x12-0x13 - reserved */
 	NVME_OPC_DEVICE_SELF_TEST		= 0x14,
 	NVME_OPC_NAMESPACE_ATTACHMENT		= 0x15,
+	/* 0x16-0x17 - reserved */
 	NVME_OPC_KEEP_ALIVE			= 0x18,
 	NVME_OPC_DIRECTIVE_SEND			= 0x19,
 	NVME_OPC_DIRECTIVE_RECEIVE		= 0x1a,
+	/* 0x1b - reserved */
 	NVME_OPC_VIRTUALIZATION_MANAGEMENT	= 0x1c,
 	NVME_OPC_NVME_MI_SEND			= 0x1d,
 	NVME_OPC_NVME_MI_RECEIVE		= 0x1e,
+	/* 0x1f-0x7b - reserved */
 	NVME_OPC_DOORBELL_BUFFER_CONFIG		= 0x7c,
 
 	NVME_OPC_FORMAT_NVM			= 0x80,
 	NVME_OPC_SECURITY_SEND			= 0x81,
 	NVME_OPC_SECURITY_RECEIVE		= 0x82,
+	/* 0x83 - reserved */
 	NVME_OPC_SANITIZE			= 0x84,
+	/* 0x85 - reserved */
+	NVME_OPC_GET_LBA_STATUS			= 0x86,
 };
 
 /* nvme nvm opcodes */
@@ -706,11 +719,11 @@ enum nvme_nvm_opcode {
 	/* 0x03 - reserved */
 	NVME_OPC_WRITE_UNCORRECTABLE		= 0x04,
 	NVME_OPC_COMPARE			= 0x05,
-	/* 0x06 - reserved */
+	/* 0x06-0x07 - reserved */
 	NVME_OPC_WRITE_ZEROES			= 0x08,
-	/* 0x07 - reserved */
 	NVME_OPC_DATASET_MANAGEMENT		= 0x09,
-	/* 0x0a-0x0c - reserved */
+	/* 0x0a-0x0b - reserved */
+	NVME_OPC_VERIFY				= 0x0c,
 	NVME_OPC_RESERVATION_REGISTER		= 0x0d,
 	NVME_OPC_RESERVATION_REPORT		= 0x0e,
 	/* 0x0f-0x10 - reserved */
@@ -738,10 +751,21 @@ enum nvme_feature {
 	NVME_FEAT_KEEP_ALIVE_TIMER		= 0x0F,
 	NVME_FEAT_HOST_CONTROLLED_THERMAL_MGMT	= 0x10,
 	NVME_FEAT_NON_OP_POWER_STATE_CONFIG	= 0x11,
-	/* 0x12-0x77 - reserved */
+	NVME_FEAT_READ_RECOVERY_LEVEL_CONFIG	= 0x12,
+	NVME_FEAT_PREDICTABLE_LATENCY_MODE_CONFIG = 0x13,
+	NVME_FEAT_PREDICTABLE_LATENCY_MODE_WINDOW = 0x14,
+	NVME_FEAT_LBA_STATUS_INFORMATION_ATTRIBUTES = 0x15,
+	NVME_FEAT_HOST_BEHAVIOR_SUPPORT		= 0x16,
+	NVME_FEAT_SANITIZE_CONFIG		= 0x17,
+	NVME_FEAT_ENDURANCE_GROUP_EVENT_CONFIGURATION = 0x18,
+	/* 0x19-0x77 - reserved */
 	/* 0x78-0x7f - NVMe Management Interface */
 	NVME_FEAT_SOFTWARE_PROGRESS_MARKER	= 0x80,
-	/* 0x81-0xBF - command set specific (reserved) */
+	NVME_FEAT_HOST_IDENTIFIER		= 0x81,
+	NVME_FEAT_RESERVATION_NOTIFICATION_MASK	= 0x82,
+	NVME_FEAT_RESERVATION_PERSISTENCE	= 0x83,
+	NVME_FEAT_NAMESPACE_WRITE_PROTECTION_CONFIG = 0x84,
+	/* 0x85-0xBF - command set specific (reserved) */
 	/* 0xC0-0xFF - vendor specific */
 };
 
@@ -1154,9 +1178,21 @@ enum nvme_log_page {
 	NVME_LOG_FIRMWARE_SLOT		= 0x03,
 	NVME_LOG_CHANGED_NAMESPACE	= 0x04,
 	NVME_LOG_COMMAND_EFFECT		= 0x05,
+	NVME_LOG_DEVICE_SELF_TEST	= 0x06,
+	NVME_LOG_TELEMETRY_HOST_INITIATED = 0x07,
+	NVME_LOG_TELEMETRY_CONTROLLER_INITIATED = 0x08,
+	NVME_LOG_ENDURANCE_GROUP_INFORMATION = 0x09,
+	NVME_LOG_PREDICTABLE_LATENCY_PER_NVM_SET = 0x0a,
+	NVME_LOG_PREDICTABLE_LATENCY_EVENT_AGGREGATE = 0x0b,
+	NVME_LOG_ASYMMETRIC_NAMESPAVE_ACCESS = 0x0c,
+	NVME_LOG_PERSISTENT_EVENT_LOG	= 0x0d,
+	NVME_LOG_LBA_STATUS_INFORMATION	= 0x0e,
+	NVME_LOG_ENDURANCE_GROUP_EVENT_AGGREGATE = 0x0f,
 	/* 0x06-0x7F - reserved */
 	/* 0x80-0xBF - I/O command set specific */
 	NVME_LOG_RES_NOTIFICATION	= 0x80,
+	NVME_LOG_SANITIZE_STATUS	= 0x81,
+	/* 0x82-0xBF - reserved */
 	/* 0xC0-0xFF - vendor specific */
 
 	/*
@@ -1185,7 +1221,11 @@ struct nvme_error_information_entry {
 	uint64_t		lba;
 	uint32_t		nsid;
 	uint8_t			vendor_specific;
-	uint8_t			reserved[35];
+	uint8_t			trtype;
+	uint16_t		reserved30;
+	uint64_t		csi;
+	uint16_t		ttsi;
+	uint8_t			reserved[22];
 } __packed __aligned(4);
 
 _Static_assert(sizeof(struct nvme_error_information_entry) == 64, "bad size for nvme_error_information_entry");
@@ -1221,8 +1261,16 @@ struct nvme_health_information_page {
 	uint32_t		warning_temp_time;
 	uint32_t		error_temp_time;
 	uint16_t		temp_sensor[8];
+	/* Thermal Management Temperature 1 Transition Count */
+	uint32_t		tmt1tc;
+	/* Thermal Management Temperature 2 Transition Count */
+	uint32_t		tmt2tc;
+	/* Total Time For Thermal Management Temperature 1 */
+	uint32_t		ttftmt1;
+	/* Total Time For Thermal Management Temperature 2 */
+	uint32_t		ttftmt2;
 
-	uint8_t			reserved2[296];
+	uint8_t			reserved2[280];
 } __packed __aligned(4);
 
 _Static_assert(sizeof(struct nvme_health_information_page) == 512, "bad size for nvme_health_information_page");
@@ -1604,6 +1652,8 @@ void	nvme_error_information_entry_swapbytes(struct nvm
 	s->error_location = le16toh(s->error_location);
 	s->lba = le64toh(s->lba);
 	s->nsid = le32toh(s->nsid);
+	s->csi = le64toh(s->csi);
+	s->ttsi = le16toh(s->ttsi);
 }
 
 static inline
@@ -1644,6 +1694,10 @@ void	nvme_health_information_page_swapbytes(struct nvm
 	s->error_temp_time = le32toh(s->error_temp_time);
 	for (i = 0; i < 8; i++)
 		s->temp_sensor[i] = le16toh(s->temp_sensor[i]);
+	s->tmt1tc = le32toh(s->tmt1tc);
+	s->tmt1tc = le32toh(s->tmt2tc);
+	s->ttftmt1 = le32toh(s->ttftmt1);
+	s->ttftmt2 = le32toh(s->ttftmt2);
 }
 
 

Modified: head/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- head/sys/dev/nvme/nvme_qpair.c	Fri Aug  2 01:59:58 2019	(r350528)
+++ head/sys/dev/nvme/nvme_qpair.c	Fri Aug  2 03:43:24 2019	(r350529)
@@ -77,6 +77,7 @@ static struct nvme_opcode_string admin_opcode[] = {
 	{ NVME_OPC_SECURITY_SEND, "SECURITY SEND" },
 	{ NVME_OPC_SECURITY_RECEIVE, "SECURITY RECEIVE" },
 	{ NVME_OPC_SANITIZE, "SANITIZE" },
+	{ NVME_OPC_GET_LBA_STATUS, "GET LBA STATUS" },
 	{ 0xFFFF, "ADMIN COMMAND" }
 };
 
@@ -88,6 +89,7 @@ static struct nvme_opcode_string io_opcode[] = {
 	{ NVME_OPC_COMPARE, "COMPARE" },
 	{ NVME_OPC_WRITE_ZEROES, "WRITE ZEROES" },
 	{ NVME_OPC_DATASET_MANAGEMENT, "DATASET MANAGEMENT" },
+	{ NVME_OPC_VERIFY, "VERIFY" },
 	{ NVME_OPC_RESERVATION_REGISTER, "RESERVATION REGISTER" },
 	{ NVME_OPC_RESERVATION_REPORT, "RESERVATION REPORT" },
 	{ NVME_OPC_RESERVATION_ACQUIRE, "RESERVATION ACQUIRE" },
@@ -148,6 +150,7 @@ nvme_io_qpair_print_command(struct nvme_qpair *qpair,
 	case NVME_OPC_WRITE_UNCORRECTABLE:
 	case NVME_OPC_COMPARE:
 	case NVME_OPC_WRITE_ZEROES:
+	case NVME_OPC_VERIFY:
 		nvme_printf(qpair->ctrlr, "%s sqid:%d cid:%d nsid:%d "
 		    "lba:%llu len:%d\n",
 		    get_io_opcode_string(cmd->opc), qpair->id, cmd->cid, le32toh(cmd->nsid),
@@ -228,6 +231,9 @@ static struct nvme_status_string generic_status[] = {
 	{ NVME_SC_SANITIZE_IN_PROGRESS, "SANITIZE IN PROGRESS" },
 	{ NVME_SC_SGL_DATA_BLOCK_GRAN_INVALID, "SGL_DATA_BLOCK_GRANULARITY_INVALID" },
 	{ NVME_SC_NOT_SUPPORTED_IN_CMB, "COMMAND NOT SUPPORTED FOR QUEUE IN CMB" },
+	{ NVME_SC_NAMESPACE_IS_WRITE_PROTECTED, "NAMESPACE IS WRITE PROTECTED" },
+	{ NVME_SC_COMMAND_INTERRUPTED, "COMMAND INTERRUPTED" },
+	{ NVME_SC_TRANSIENT_TRANSPORT_ERROR, "TRANSIENT TRANSPORT ERROR" },
 
 	{ NVME_SC_LBA_OUT_OF_RANGE, "LBA OUT OF RANGE" },
 	{ NVME_SC_CAPACITY_EXCEEDED, "CAPACITY EXCEEDED" },
@@ -271,6 +277,9 @@ static struct nvme_status_string command_specific_stat
 	{ NVME_SC_INVALID_SEC_CTRLR_STATE, "INVALID SECONDARY CONTROLLER STATE" },
 	{ NVME_SC_INVALID_NUM_OF_CTRLR_RESRC, "INVALID NUMBER OF CONTROLLER RESOURCES" },
 	{ NVME_SC_INVALID_RESOURCE_ID, "INVALID RESOURCE IDENTIFIER" },
+	{ NVME_SC_SANITIZE_PROHIBITED_WPMRE, "SANITIZE PROHIBITED WRITE PERSISTENT MEMORY REGION ENABLED" },
+	{ NVME_SC_ANA_GROUP_ID_INVALID, "ANA GROUP IDENTIFIED INVALID" },
+	{ NVME_SC_ANA_ATTACH_FAILED, "ANA ATTACH FAILED" },
 
 	{ NVME_SC_CONFLICTING_ATTRIBUTES, "CONFLICTING ATTRIBUTES" },
 	{ NVME_SC_INVALID_PROTECTION_INFO, "INVALID PROTECTION INFO" },

From owner-svn-src-head@freebsd.org  Fri Aug  2 04:04:19 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8B22A89F5;
 Fri,  2 Aug 2019 04:04:19 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460D7R3z37z4ZVK;
 Fri,  2 Aug 2019 04:04: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 693D124DDB;
 Fri,  2 Aug 2019 04:04: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 x7244Jg6027255;
 Fri, 2 Aug 2019 04:04:19 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7244Jdm027254;
 Fri, 2 Aug 2019 04:04:19 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908020404.x7244Jdm027254@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 2 Aug 2019 04:04:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350530 - head/sys/dev/nvme
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sys/dev/nvme
X-SVN-Commit-Revision: 350530
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 04:04:19 -0000

Author: mav
Date: Fri Aug  2 04:04:18 2019
New Revision: 350530
URL: https://svnweb.freebsd.org/changeset/base/350530

Log:
  Fix typo in r350529.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/nvme/nvme.h

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h	Fri Aug  2 03:43:24 2019	(r350529)
+++ head/sys/dev/nvme/nvme.h	Fri Aug  2 04:04:18 2019	(r350530)
@@ -1695,7 +1695,7 @@ void	nvme_health_information_page_swapbytes(struct nvm
 	for (i = 0; i < 8; i++)
 		s->temp_sensor[i] = le16toh(s->temp_sensor[i]);
 	s->tmt1tc = le32toh(s->tmt1tc);
-	s->tmt1tc = le32toh(s->tmt2tc);
+	s->tmt2tc = le32toh(s->tmt2tc);
 	s->ttftmt1 = le32toh(s->ttftmt1);
 	s->ttftmt2 = le32toh(s->ttftmt2);
 }

From owner-svn-src-head@freebsd.org  Fri Aug  2 07:41:39 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB0DAAC729;
 Fri,  2 Aug 2019 07:41:39 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460JyC5p0Mz3H5x;
 Fri,  2 Aug 2019 07:41:39 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1F5127384;
 Fri,  2 Aug 2019 07:41:39 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x727fdhO056151;
 Fri, 2 Aug 2019 07:41:39 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x727fapn055424;
 Fri, 2 Aug 2019 07:41:36 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908020741.x727fapn055424@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Fri, 2 Aug 2019 07:41:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350531 - in head/sys: contrib/ipfilter/netinet netinet
 netinet6
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: in head/sys: contrib/ipfilter/netinet netinet netinet6
X-SVN-Commit-Revision: 350531
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 07:41:39 -0000

Author: bz
Date: Fri Aug  2 07:41:36 2019
New Revision: 350531
URL: https://svnweb.freebsd.org/changeset/base/350531

Log:
  IPv6 cleanup: kernel
  
  Finish what was started a few years ago and harmonize IPv6 and IPv4
  kernel names.  We are down to very few places now that it is feasible
  to do the change for everything remaining with causing too much disturbance.
  
  Remove "aliases" for IPv6 names which confusingly could indicate
  that we are talking about a different data structure or field or
  have two fields, one for each address family.
  Try to follow common conventions used in FreeBSD.
  
  * Rename sin6p to sin6 as that is how it is spelt in most places.
  * Remove "aliases" (#defines) for:
    - in6pcb which really is an inpcb and nothing separate
    - sotoin6pcb which is sotoinpcb (as per above)
    - in6p_sp which is inp_sp
    - in6p_flowinfo which is inp_flow
  * Try to use ia6 for in6_addr rather than in6p.
  * With all these gone  also rename the in6p variables to inp as
    that is what we call it in most of the network stack including
    parts of netinet6.
  
  The reasons behind this cleanup are that we try to further
  unify netinet and netinet6 code where possible and that people
  will less ignore one or the other protocol family when doing
  code changes as they may not have spotted places due to different
  names for the same thing.
  
  No functional changes.
  
  Discussed with:		tuexen (SCTP changes)
  MFC after:		3 months
  Sponsored by:		Netflix

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/in6_pcb.h
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/raw_ip6.c
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -964,7 +964,7 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
 	i6addr_t *inp, *inpmask;
 {
 #ifdef USE_INET6
-	struct in6_addr *inp6 = NULL;
+	struct in6_addr *ia6 = NULL;
 #endif
 	struct sockaddr *sock, *mask;
 	struct sockaddr_in *sin;
@@ -992,9 +992,9 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
 			break;
 #ifdef USE_INET6
 		if ((v == 6) && (sin->sin_family == AF_INET6)) {
-			inp6 = &((struct sockaddr_in6 *)sin)->sin6_addr;
-			if (!IN6_IS_ADDR_LINKLOCAL(inp6) &&
-			    !IN6_IS_ADDR_LOOPBACK(inp6))
+			ia6 = &((struct sockaddr_in6 *)sin)->sin6_addr;
+			if (!IN6_IS_ADDR_LINKLOCAL(ia6) &&
+			    !IN6_IS_ADDR_LOOPBACK(ia6))
 				break;
 		}
 #endif

Modified: head/sys/netinet/in_pcb.h
==============================================================================
--- head/sys/netinet/in_pcb.h	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/in_pcb.h	Fri Aug  2 07:41:36 2019	(r350531)
@@ -57,9 +57,6 @@
 #endif
 #include <sys/ck.h>
 
-#define	in6pcb		inpcb	/* for KAME src sync over BSD*'s */
-#define	in6p_sp		inp_sp	/* for KAME src sync over BSD*'s */
-
 /*
  * struct inpcb is the common protocol control block structure used in most
  * IP transport protocols.
@@ -342,7 +339,6 @@ struct inpcb {
 #define	in6p_faddr	inp_inc.inc6_faddr
 #define	in6p_laddr	inp_inc.inc6_laddr
 #define	in6p_zoneid	inp_inc.inc6_zoneid
-#define	in6p_flowinfo	inp_flow
 
 #define	inp_vnet	inp_pcbinfo->ipi_vnet
 
@@ -773,7 +769,6 @@ int	inp_so_options(const struct inpcb *inp);
 			    INPLOOKUP_WLOCKPCB)
 
 #define	sotoinpcb(so)	((struct inpcb *)(so)->so_pcb)
-#define	sotoin6pcb(so)	sotoinpcb(so) /* for KAME src sync over BSD*'s */
 
 #define	INP_SOCKAF(so) so->so_proto->pr_domain->dom_family
 

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/sctp_asconf.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -1954,12 +1954,10 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sc
 	case AF_INET:
 		{
 			struct sockaddr_in *sin;
-			struct in6pcb *inp6;
 
-			inp6 = (struct in6pcb *)&inp->ip_inp.inp;
 			/* invalid if we are a v6 only endpoint */
 			if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-			    SCTP_IPV6_V6ONLY(inp6))
+			    SCTP_IPV6_V6ONLY(&inp->ip_inp.inp))
 				return;
 
 			sin = &ifa->address.sin;
@@ -2032,11 +2030,9 @@ sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *
 		case AF_INET:
 			{
 				/* invalid if we are a v6 only endpoint */
-				struct in6pcb *inp6;
 
-				inp6 = (struct in6pcb *)&inp->ip_inp.inp;
 				if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-				    SCTP_IPV6_V6ONLY(inp6)) {
+				    SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) {
 					cnt_invalid++;
 					if (asc->cnt == cnt_invalid)
 						return (1);
@@ -2147,13 +2143,11 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru
 		case AF_INET:
 			{
 				/* invalid if we are a v6 only endpoint */
-				struct in6pcb *inp6;
 				struct sockaddr_in *sin;
 
-				inp6 = (struct in6pcb *)&inp->ip_inp.inp;
 				/* invalid if we are a v6 only endpoint */
 				if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-				    SCTP_IPV6_V6ONLY(inp6))
+				    SCTP_IPV6_V6ONLY(&inp->ip_inp.inp))
 					continue;
 
 				sin = &ifa->address.sin;
@@ -2170,7 +2164,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru
 					continue;
 				}
 				if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-				    SCTP_IPV6_V6ONLY(inp6)) {
+				    SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) {
 					cnt_invalid++;
 					if (asc->cnt == cnt_invalid)
 						return;

Modified: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/sctp_os_bsd.h	Fri Aug  2 07:41:36 2019	(r350531)
@@ -97,9 +97,6 @@ __FBSDID("$FreeBSD$");
 #include <crypto/sha1.h>
 #include <crypto/sha2/sha256.h>
 
-#ifndef in6pcb
-#define in6pcb		inpcb
-#endif
 /* Declare all the malloc names for all the various mallocs */
 MALLOC_DECLARE(SCTP_M_MAP);
 MALLOC_DECLARE(SCTP_M_STRMI);
@@ -368,7 +365,7 @@ typedef struct callout sctp_os_timer_t;
  */
 
 /* get the v6 hop limit */
-#define SCTP_GET_HLIM(inp, ro)	in6_selecthlim((struct in6pcb *)&inp->ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL)));
+#define SCTP_GET_HLIM(inp, ro)	in6_selecthlim((struct inpcb *)&inp->ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL)));
 
 /* is the endpoint v6only? */
 #define SCTP_IPV6_V6ONLY(inp)	(((struct inpcb *)inp)->inp_flags & IN6P_IPV6_V6ONLY)
@@ -431,7 +428,7 @@ typedef struct rtentry sctp_rtentry_t;
 	m_clrprotoflags(o_pak); \
 	if (local_stcb && local_stcb->sctp_ep) \
 		result = ip6_output(o_pak, \
-				    ((struct in6pcb *)(local_stcb->sctp_ep))->in6p_outputopts, \
+				    ((struct inpcb *)(local_stcb->sctp_ep))->in6p_outputopts, \
 				    (ro), 0, 0, ifp, NULL); \
 	else \
 		result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/sctp_output.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -4336,7 +4336,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
 				 * at the SCTP layer. So use the value from
 				 * the IP layer.
 				 */
-				flowlabel = ntohl(((struct in6pcb *)inp)->in6p_flowinfo);
+				flowlabel = ntohl(((struct inpcb *)inp)->inp_flow);
 			}
 			flowlabel &= 0x000fffff;
 			len = SCTP_MIN_OVERHEAD;
@@ -4391,7 +4391,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
 				 * at the SCTP layer. So use the value from
 				 * the IP layer.
 				 */
-				tos_value = (ntohl(((struct in6pcb *)inp)->in6p_flowinfo) >> 20) & 0xff;
+				tos_value = (ntohl(((struct inpcb *)inp)->inp_flow) >> 20) & 0xff;
 			}
 			tos_value &= 0xfc;
 			if (ecn_ok) {

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/sctp_pcb.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -3643,12 +3643,8 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate,
 
 
 #ifdef INET6
-	if (ip_pcb->inp_vflag & INP_IPV6) {
-		struct in6pcb *in6p;
-
-		in6p = (struct in6pcb *)inp;
-		ip6_freepcbopts(in6p->in6p_outputopts);
-	}
+	if (ip_pcb->inp_vflag & INP_IPV6)
+		ip6_freepcbopts(((struct inpcb *)inp)->in6p_outputopts);
 #endif				/* INET6 */
 	ip_pcb->inp_vflag = 0;
 	/* free up authentication fields */

Modified: head/sys/netinet/sctp_pcb.h
==============================================================================
--- head/sys/netinet/sctp_pcb.h	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/sctp_pcb.h	Fri Aug  2 07:41:36 2019	(r350531)
@@ -362,7 +362,7 @@ struct sctp_inpcb {
 	 */
 	union {
 		struct inpcb inp;
-		char align[(sizeof(struct in6pcb) + SCTP_ALIGNM1) &
+		char align[(sizeof(struct inpcb) + SCTP_ALIGNM1) &
 		    ~SCTP_ALIGNM1];
 	}     ip_inp;
 

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/sctp_usrreq.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -1412,10 +1412,8 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb
 	}
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
 	    (num_v4 > 0)) {
-		struct in6pcb *inp6;
 
-		inp6 = (struct in6pcb *)inp;
-		if (SCTP_IPV6_V6ONLY(inp6)) {
+		if (SCTP_IPV6_V6ONLY(inp)) {
 			/*
 			 * if IPV6_V6ONLY flag, ignore connections destined
 			 * to a v4 addr or v4-mapped addr
@@ -6916,14 +6914,14 @@ sctp_connect(struct socket *so, struct sockaddr *addr,
 #ifdef INET6
 	case AF_INET6:
 		{
-			struct sockaddr_in6 *sin6p;
+			struct sockaddr_in6 *sin6;
 
 			if (addr->sa_len != sizeof(struct sockaddr_in6)) {
 				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
 				return (EINVAL);
 			}
-			sin6p = (struct sockaddr_in6 *)addr;
-			if (p != NULL && (error = prison_remote_ip6(p->td_ucred, &sin6p->sin6_addr)) != 0) {
+			sin6 = (struct sockaddr_in6 *)addr;
+			if (p != NULL && (error = prison_remote_ip6(p->td_ucred, &sin6->sin6_addr)) != 0) {
 				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
 				return (error);
 			}

Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet/tcp_usrreq.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -344,17 +344,17 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
 	int error = 0;
 	struct inpcb *inp;
 	struct tcpcb *tp = NULL;
-	struct sockaddr_in6 *sin6p;
+	struct sockaddr_in6 *sin6;
 
-	sin6p = (struct sockaddr_in6 *)nam;
-	if (nam->sa_len != sizeof (*sin6p))
+	sin6 = (struct sockaddr_in6 *)nam;
+	if (nam->sa_len != sizeof (*sin6))
 		return (EINVAL);
 	/*
 	 * Must check for multicast addresses and disallow binding
 	 * to them.
 	 */
-	if (sin6p->sin6_family == AF_INET6 &&
-	    IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr))
+	if (sin6->sin6_family == AF_INET6 &&
+	    IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
 		return (EAFNOSUPPORT);
 
 	TCPDEBUG0;
@@ -372,12 +372,12 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam,
 	inp->inp_vflag |= INP_IPV6;
 #ifdef INET
 	if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
-		if (IN6_IS_ADDR_UNSPECIFIED(&sin6p->sin6_addr))
+		if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
 			inp->inp_vflag |= INP_IPV4;
-		else if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) {
+		else if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 			struct sockaddr_in sin;
 
-			in6_sin6_2_sin(&sin, sin6p);
+			in6_sin6_2_sin(&sin, sin6);
 			if (IN_MULTICAST(ntohl(sin.sin_addr.s_addr))) {
 				error = EAFNOSUPPORT;
 				INP_HASH_WUNLOCK(&V_tcbinfo);
@@ -566,18 +566,18 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
 	int error = 0;
 	struct inpcb *inp;
 	struct tcpcb *tp = NULL;
-	struct sockaddr_in6 *sin6p;
+	struct sockaddr_in6 *sin6;
 
 	TCPDEBUG0;
 
-	sin6p = (struct sockaddr_in6 *)nam;
-	if (nam->sa_len != sizeof (*sin6p))
+	sin6 = (struct sockaddr_in6 *)nam;
+	if (nam->sa_len != sizeof (*sin6))
 		return (EINVAL);
 	/*
 	 * Must disallow TCP ``connections'' to multicast addresses.
 	 */
-	if (sin6p->sin6_family == AF_INET6
-	    && IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr))
+	if (sin6->sin6_family == AF_INET6
+	    && IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
 		return (EAFNOSUPPORT);
 
 	inp = sotoinpcb(so);
@@ -599,7 +599,7 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
 	 * therefore probably require the hash lock, which isn't held here.
 	 * Is this a significant problem?
 	 */
-	if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) {
+	if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 		struct sockaddr_in sin;
 
 		if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
@@ -611,7 +611,7 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
 			goto out;
 		}
 
-		in6_sin6_2_sin(&sin, sin6p);
+		in6_sin6_2_sin(&sin, sin6);
 		if (IN_MULTICAST(ntohl(sin.sin_addr.s_addr))) {
 			error = EAFNOSUPPORT;
 			goto out;
@@ -641,7 +641,7 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
 	inp->inp_vflag &= ~INP_IPV4;
 	inp->inp_vflag |= INP_IPV6;
 	inp->inp_inc.inc_flags |= INC_ISIPV6;
-	if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0)
+	if ((error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr)) != 0)
 		goto out;
 	if ((error = tcp6_connect(tp, nam, td)) != 0)
 		goto out;
@@ -972,22 +972,22 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf
 #ifdef INET6
 		case AF_INET6:
 		{
-			struct sockaddr_in6 *sin6p;
+			struct sockaddr_in6 *sin6;
 
-			sin6p = (struct sockaddr_in6 *)nam;
-			if (sin6p->sin6_len != sizeof(struct sockaddr_in6)) {
+			sin6 = (struct sockaddr_in6 *)nam;
+			if (sin6->sin6_len != sizeof(*sin6)) {
 				if (m)
 					m_freem(m);
 				error = EINVAL;
 				goto out;
 			}
-			if (IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) {
+			if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
 				if (m)
 					m_freem(m);
 				error = EAFNOSUPPORT;
 				goto out;
 			}
-			if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) {
+			if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 #ifdef INET
 				if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
 					error = EINVAL;
@@ -1003,7 +1003,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf
 				}
 				inp->inp_vflag &= ~INP_IPV6;
 				sinp = &sin;
-				in6_sin6_2_sin(sinp, sin6p);
+				in6_sin6_2_sin(sinp, sin6);
 				if (IN_MULTICAST(
 				    ntohl(sinp->sin_addr.s_addr))) {
 					error = EAFNOSUPPORT;
@@ -1034,7 +1034,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf
 				inp->inp_vflag &= ~INP_IPV4;
 				inp->inp_inc.inc_flags |= INC_ISIPV6;
 				if ((error = prison_remote_ip6(td->td_ucred,
-				    &sin6p->sin6_addr))) {
+				    &sin6->sin6_addr))) {
 					if (m)
 						m_freem(m);
 					goto out;

Modified: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet6/icmp6.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -1894,7 +1894,7 @@ icmp6_rip6_input(struct mbuf **mp, int off)
 {
 	struct mbuf *m = *mp;
 	struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
-	struct inpcb *in6p;
+	struct inpcb *inp;
 	struct inpcb *last = NULL;
 	struct sockaddr_in6 fromsa;
 	struct icmp6_hdr *icmp6;
@@ -1926,25 +1926,25 @@ icmp6_rip6_input(struct mbuf **mp, int off)
 	}
 
 	INP_INFO_RLOCK_ET(&V_ripcbinfo, et);
-	CK_LIST_FOREACH(in6p, &V_ripcb, inp_list) {
-		if ((in6p->inp_vflag & INP_IPV6) == 0)
+	CK_LIST_FOREACH(inp, &V_ripcb, inp_list) {
+		if ((inp->inp_vflag & INP_IPV6) == 0)
 			continue;
-		if (in6p->inp_ip_p != IPPROTO_ICMPV6)
+		if (inp->inp_ip_p != IPPROTO_ICMPV6)
 			continue;
-		if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) &&
-		   !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst))
+		if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) &&
+		   !IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, &ip6->ip6_dst))
 			continue;
-		if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
-		   !IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
+		if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) &&
+		   !IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, &ip6->ip6_src))
 			continue;
-		INP_RLOCK(in6p);
-		if (__predict_false(in6p->inp_flags2 & INP_FREED)) {
-			INP_RUNLOCK(in6p);
+		INP_RLOCK(inp);
+		if (__predict_false(inp->inp_flags2 & INP_FREED)) {
+			INP_RUNLOCK(inp);
 			continue;
 		}
 		if (ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type,
-		    in6p->in6p_icmp6filt)) {
-			INP_RUNLOCK(in6p);
+		    inp->in6p_icmp6filt)) {
+			INP_RUNLOCK(inp);
 			continue;
 		}
 		if (last != NULL) {
@@ -2005,7 +2005,7 @@ icmp6_rip6_input(struct mbuf **mp, int off)
 			}
 			INP_RUNLOCK(last);
 		}
-		last = in6p;
+		last = inp;
 	}
 	INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et);
 	if (last != NULL) {

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet6/in6_mcast.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -1828,7 +1828,7 @@ ip6_getmoptions(struct inpcb *inp, struct sockopt *sop
  * Returns NULL if no ifp could be found.
  */
 static struct ifnet *
-in6p_lookup_mcast_ifp(const struct inpcb *in6p,
+in6p_lookup_mcast_ifp(const struct inpcb *inp,
     const struct sockaddr_in6 *gsin6)
 {
 	struct nhop6_basic	nh6;
@@ -1836,13 +1836,13 @@ in6p_lookup_mcast_ifp(const struct inpcb *in6p,
 	uint32_t		scopeid;
 	uint32_t		fibnum;
 
-	KASSERT(in6p->inp_vflag & INP_IPV6,
+	KASSERT(inp->inp_vflag & INP_IPV6,
 	    ("%s: not INP_IPV6 inpcb", __func__));
 	KASSERT(gsin6->sin6_family == AF_INET6,
 	    ("%s: not AF_INET6 group", __func__));
 
 	in6_splitscope(&gsin6->sin6_addr, &dst, &scopeid);
-	fibnum = in6p ? in6p->inp_inc.inc_fibnum : RT_DEFAULT_FIB;
+	fibnum = inp ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB;
 	if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, 0, &nh6) != 0)
 		return (NULL);
 

Modified: head/sys/netinet6/in6_pcb.c
==============================================================================
--- head/sys/netinet6/in6_pcb.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet6/in6_pcb.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -801,20 +801,20 @@ in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct 
 void
 in6_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp)
 {
-	struct inpcb *in6p;
+	struct inpcb *inp;
 	struct in6_multi *inm;
 	struct in6_mfilter *imf;
 	struct ip6_moptions *im6o;
 
 	INP_INFO_WLOCK(pcbinfo);
-	CK_LIST_FOREACH(in6p, pcbinfo->ipi_listhead, inp_list) {
-		INP_WLOCK(in6p);
-		if (__predict_false(in6p->inp_flags2 & INP_FREED)) {
-			INP_WUNLOCK(in6p);
+	CK_LIST_FOREACH(inp, pcbinfo->ipi_listhead, inp_list) {
+		INP_WLOCK(inp);
+		if (__predict_false(inp->inp_flags2 & INP_FREED)) {
+			INP_WUNLOCK(inp);
 			continue;
 		}
-		im6o = in6p->in6p_moptions;
-		if ((in6p->inp_vflag & INP_IPV6) && im6o != NULL) {
+		im6o = inp->in6p_moptions;
+		if ((inp->inp_vflag & INP_IPV6) && im6o != NULL) {
 			/*
 			 * Unselect the outgoing ifp for multicast if it
 			 * is being detached.
@@ -838,7 +838,7 @@ restart:
 				goto restart;
 			}
 		}
-		INP_WUNLOCK(in6p);
+		INP_WUNLOCK(inp);
 	}
 	INP_INFO_WUNLOCK(pcbinfo);
 }

Modified: head/sys/netinet6/in6_pcb.h
==============================================================================
--- head/sys/netinet6/in6_pcb.h	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet6/in6_pcb.h	Fri Aug  2 07:41:36 2019	(r350531)
@@ -113,7 +113,7 @@ int	in6_getpeeraddr(struct socket *so, struct sockaddr
 int	in6_getsockaddr(struct socket *so, struct sockaddr **nam);
 int	in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam);
 int	in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam);
-int	in6_selecthlim(struct in6pcb *, struct ifnet *);
+int	in6_selecthlim(struct inpcb *, struct ifnet *);
 int	in6_pcbsetport(struct in6_addr *, struct inpcb *, struct ucred *);
 void	init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int);
 #endif /* _KERNEL */

Modified: head/sys/netinet6/in6_src.c
==============================================================================
--- head/sys/netinet6/in6_src.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet6/in6_src.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -931,21 +931,21 @@ in6_selectroute_fib(struct sockaddr_in6 *dstsock, stru
  * 3. The system default hoplimit.
  */
 int
-in6_selecthlim(struct inpcb *in6p, struct ifnet *ifp)
+in6_selecthlim(struct inpcb *inp, struct ifnet *ifp)
 {
 
-	if (in6p && in6p->in6p_hops >= 0)
-		return (in6p->in6p_hops);
+	if (inp && inp->in6p_hops >= 0)
+		return (inp->in6p_hops);
 	else if (ifp)
 		return (ND_IFINFO(ifp)->chlim);
-	else if (in6p && !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) {
+	else if (inp && !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
 		struct nhop6_basic nh6;
 		struct in6_addr dst;
 		uint32_t fibnum, scopeid;
 		int hlim;
 
-		fibnum = in6p->inp_inc.inc_fibnum;
-		in6_splitscope(&in6p->in6p_faddr, &dst, &scopeid);
+		fibnum = inp->inp_inc.inc_fibnum;
+		in6_splitscope(&inp->in6p_faddr, &dst, &scopeid);
 		if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, 0, &nh6)==0){
 			hlim = ND_IFINFO(nh6.nh_ifp)->chlim;
 			return (hlim);

Modified: head/sys/netinet6/ip6_input.c
==============================================================================
--- head/sys/netinet6/ip6_input.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet6/ip6_input.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -1404,12 +1404,12 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, 
 }
 
 void
-ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
+ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
 {
 	struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
 	int v4only = 0;
 
-	mp = ip6_savecontrol_v4(in6p, m, mp, &v4only);
+	mp = ip6_savecontrol_v4(inp, m, mp, &v4only);
 	if (v4only)
 		return;
 
@@ -1420,7 +1420,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, st
 	 * returned to normal user.
 	 * See also RFC 2292 section 6 (or RFC 3542 section 8).
 	 */
-	if ((in6p->inp_flags & IN6P_HOPOPTS) != 0) {
+	if ((inp->inp_flags & IN6P_HOPOPTS) != 0) {
 		/*
 		 * Check if a hop-by-hop options header is contatined in the
 		 * received packet, and if so, store the options as ancillary
@@ -1462,7 +1462,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, st
 			 * Note: this constraint is removed in RFC3542
 			 */
 			*mp = sbcreatecontrol((caddr_t)hbh, hbhlen,
-			    IS2292(in6p, IPV6_2292HOPOPTS, IPV6_HOPOPTS),
+			    IS2292(inp, IPV6_2292HOPOPTS, IPV6_HOPOPTS),
 			    IPPROTO_IPV6);
 			if (*mp)
 				mp = &(*mp)->m_next;
@@ -1472,7 +1472,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, st
 		}
 	}
 
-	if ((in6p->inp_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) {
+	if ((inp->inp_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) {
 		int nxt = ip6->ip6_nxt, off = sizeof(struct ip6_hdr);
 
 		/*
@@ -1533,22 +1533,22 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, st
 
 			switch (nxt) {
 			case IPPROTO_DSTOPTS:
-				if (!(in6p->inp_flags & IN6P_DSTOPTS))
+				if (!(inp->inp_flags & IN6P_DSTOPTS))
 					break;
 
 				*mp = sbcreatecontrol((caddr_t)ip6e, elen,
-				    IS2292(in6p,
+				    IS2292(inp,
 					IPV6_2292DSTOPTS, IPV6_DSTOPTS),
 				    IPPROTO_IPV6);
 				if (*mp)
 					mp = &(*mp)->m_next;
 				break;
 			case IPPROTO_ROUTING:
-				if (!(in6p->inp_flags & IN6P_RTHDR))
+				if (!(inp->inp_flags & IN6P_RTHDR))
 					break;
 
 				*mp = sbcreatecontrol((caddr_t)ip6e, elen,
-				    IS2292(in6p, IPV6_2292RTHDR, IPV6_RTHDR),
+				    IS2292(inp, IPV6_2292RTHDR, IPV6_RTHDR),
 				    IPPROTO_IPV6);
 				if (*mp)
 					mp = &(*mp)->m_next;
@@ -1584,7 +1584,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, st
 		;
 	}
 
-	if (in6p->inp_flags2 & INP_RECVFLOWID) {
+	if (inp->inp_flags2 & INP_RECVFLOWID) {
 		uint32_t flowid, flow_type;
 
 		flowid = m->m_pkthdr.flowid;
@@ -1605,7 +1605,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, st
 	}
 
 #ifdef	RSS
-	if (in6p->inp_flags2 & INP_RECVRSSBUCKETID) {
+	if (inp->inp_flags2 & INP_RECVRSSBUCKETID) {
 		uint32_t flowid, flow_type;
 		uint32_t rss_bucketid;
 

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Fri Aug  2 04:04:18 2019	(r350530)
+++ head/sys/netinet6/ip6_output.c	Fri Aug  2 07:41:36 2019	(r350531)
@@ -1471,7 +1471,7 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
 {
 	int optdatalen, uproto;
 	void *optdata;
-	struct inpcb *in6p = sotoinpcb(so);
+	struct inpcb *inp = sotoinpcb(so);
 	int error, optval;
 	int level, op, optname;
 	int optlen;
@@ -1506,43 +1506,43 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
 		    sopt->sopt_dir == SOPT_SET) {
 			switch (sopt->sopt_name) {
 			case SO_REUSEADDR:
-				INP_WLOCK(in6p);
+				INP_WLOCK(inp);
 				if ((so->so_options & SO_REUSEADDR) != 0)
-					in6p->inp_flags2 |= INP_REUSEADDR;
+					inp->inp_flags2 |= INP_REUSEADDR;
 				else
-					in6p->inp_flags2 &= ~INP_REUSEADDR;
-				INP_WUNLOCK(in6p);
+					inp->inp_flags2 &= ~INP_REUSEADDR;
+				INP_WUNLOCK(inp);
 				error = 0;
 				break;
 			case SO_REUSEPORT:
-				INP_WLOCK(in6p);
+				INP_WLOCK(inp);
 				if ((so->so_options & SO_REUSEPORT) != 0)
-					in6p->inp_flags2 |= INP_REUSEPORT;
+					inp->inp_flags2 |= INP_REUSEPORT;
 				else
-					in6p->inp_flags2 &= ~INP_REUSEPORT;
-				INP_WUNLOCK(in6p);
+					inp->inp_flags2 &= ~INP_REUSEPORT;
+				INP_WUNLOCK(inp);
 				error = 0;
 				break;
 			case SO_REUSEPORT_LB:
-				INP_WLOCK(in6p);
+				INP_WLOCK(inp);
 				if ((so->so_options & SO_REUSEPORT_LB) != 0)
-					in6p->inp_flags2 |= INP_REUSEPORT_LB;
+					inp->inp_flags2 |= INP_REUSEPORT_LB;
 				else
-					in6p->inp_flags2 &= ~INP_REUSEPORT_LB;
-				INP_WUNLOCK(in6p);
+					inp->inp_flags2 &= ~INP_REUSEPORT_LB;
+				INP_WUNLOCK(inp);
 				error = 0;
 				break;
 			case SO_SETFIB:
-				INP_WLOCK(in6p);
-				in6p->inp_inc.inc_fibnum = so->so_fibnum;
-				INP_WUNLOCK(in6p);
+				INP_WLOCK(inp);
+				inp->inp_inc.inc_fibnum = so->so_fibnum;
+				INP_WUNLOCK(inp);
 				error = 0;
 				break;
 			case SO_MAX_PACING_RATE:
 #ifdef RATELIMIT
-				INP_WLOCK(in6p);
-				in6p->inp_flags2 |= INP_RATE_LIMIT_CHANGED;
-				INP_WUNLOCK(in6p);
+				INP_WLOCK(inp);
+				inp->inp_flags2 |= INP_RATE_LIMIT_CHANGED;
+				INP_WUNLOCK(inp);
 				error = 0;
 #else
 				error = EOPNOTSUPP;
@@ -1576,7 +1576,7 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
 				error = soopt_mcopyin(sopt, m); /* XXX */
 				if (error != 0)
 					break;
-				error = ip6_pcbopts(&in6p->in6p_outputopts,
+				error = ip6_pcbopts(&inp->in6p_outputopts,
 						    m, so, sopt);
 				m_freem(m); /* XXX */
 				break;
@@ -1647,57 +1647,57 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
 						error = EINVAL;
 					else {
 						/* -1 = kernel default */
-						in6p->in6p_hops = optval;
-						if ((in6p->inp_vflag &
+						inp->in6p_hops = optval;
+						if ((inp->inp_vflag &
 						     INP_IPV4) != 0)
-							in6p->inp_ip_ttl = optval;
+							inp->inp_ip_ttl = optval;
 					}
 					break;
 #define OPTSET(bit) \
 do { \
-	INP_WLOCK(in6p); \
+	INP_WLOCK(inp); \
 	if (optval) \
-		in6p->inp_flags |= (bit); \
+		inp->inp_flags |= (bit); \
 	else \
-		in6p->inp_flags &= ~(bit); \
-	INP_WUNLOCK(in6p); \
+		inp->inp_flags &= ~(bit); \
+	INP_WUNLOCK(inp); \
 } while (/*CONSTCOND*/ 0)
 #define OPTSET2292(bit) \
 do { \
-	INP_WLOCK(in6p); \
-	in6p->inp_flags |= IN6P_RFC2292; \
+	INP_WLOCK(inp); \
+	inp->inp_flags |= IN6P_RFC2292; \
 	if (optval) \
-		in6p->inp_flags |= (bit); \
+		inp->inp_flags |= (bit); \
 	else \
-		in6p->inp_flags &= ~(bit); \
-	INP_WUNLOCK(in6p); \
+		inp->inp_flags &= ~(bit); \
+	INP_WUNLOCK(inp); \
 } while (/*CONSTCOND*/ 0)
-#define OPTBIT(bit) (in6p->inp_flags & (bit) ? 1 : 0)
+#define OPTBIT(bit) (inp->inp_flags & (bit) ? 1 : 0)
 
 #define OPTSET2_N(bit, val) do {					\
 	if (val)							\
-		in6p->inp_flags2 |= bit;				\
+		inp->inp_flags2 |= bit;					\
 	else								\
-		in6p->inp_flags2 &= ~bit;				\
+		inp->inp_flags2 &= ~bit;				\
 } while (0)
 #define OPTSET2(bit, val) do {						\
-	INP_WLOCK(in6p);						\
+	INP_WLOCK(inp);							\
 	OPTSET2_N(bit, val);						\
-	INP_WUNLOCK(in6p);						\
+	INP_WUNLOCK(inp);						\
 } while (0)
-#define OPTBIT2(bit) (in6p->inp_flags2 & (bit) ? 1 : 0)
+#define OPTBIT2(bit) (inp->inp_flags2 & (bit) ? 1 : 0)
 #define OPTSET2292_EXCLUSIVE(bit)					\
 do {									\
-	INP_WLOCK(in6p);						\
+	INP_WLOCK(inp);							\
 	if (OPTBIT(IN6P_RFC2292)) {					\
 		error = EINVAL;						\
 	} else {							\
 		if (optval)						\
-			in6p->inp_flags |= (bit);			\
+			inp->inp_flags |= (bit);			\
 		else							\
-			in6p->inp_flags &= ~(bit);			\
+			inp->inp_flags &= ~(bit);			\
 	}								\
-	INP_WUNLOCK(in6p);						\
+	INP_WUNLOCK(inp);						\
 } while (/*CONSTCOND*/ 0)
 
 				case IPV6_RECVPKTINFO:
@@ -1713,17 +1713,17 @@ do {									\
 						error = EINVAL;
 						break;
 					}
-					INP_WLOCK(in6p);
-					if (in6p->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
-						INP_WUNLOCK(in6p);
+					INP_WLOCK(inp);
+					if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
+						INP_WUNLOCK(inp);
 						return (ECONNRESET);
 					}
-					optp = &in6p->in6p_outputopts;
+					optp = &inp->in6p_outputopts;
 					error = ip6_pcbopt(IPV6_HOPLIMIT,
 					    (u_char *)&optval, sizeof(optval),
 					    optp, (td != NULL) ? td->td_ucred :
 					    NULL, uproto);
-					INP_WUNLOCK(in6p);
+					INP_WUNLOCK(inp);
 					break;
 				}
 
@@ -1774,16 +1774,16 @@ do {									\
 					 * available only prior to bind(2).
 					 * see ipng mailing list, Jun 22 2001.
 					 */
-					if (in6p->inp_lport ||
-					    !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) {
+					if (inp->inp_lport ||
+					    !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
 						error = EINVAL;
 						break;
 					}
 					OPTSET(IN6P_IPV6_V6ONLY);
 					if (optval)
-						in6p->inp_vflag &= ~INP_IPV4;
+						inp->inp_vflag &= ~INP_IPV4;
 					else
-						in6p->inp_vflag |= INP_IPV4;
+						inp->inp_vflag |= INP_IPV4;
 					break;
 				case IPV6_RECVTCLASS:
 					/* cannot mix with RFC2292 XXX */
@@ -1807,10 +1807,10 @@ do {									\
 				case IPV6_RSS_LISTEN_BUCKET:
 					if ((optval >= 0) &&
 					    (optval < rss_getnumbuckets())) {
-						INP_WLOCK(in6p);
-						in6p->inp_rss_listen_bucket = optval;
+						INP_WLOCK(inp);
+						inp->inp_rss_listen_bucket = optval;
 						OPTSET2_N(INP_RSS_BUCKET_SET, 1);
-						INP_WUNLOCK(in6p);
+						INP_WUNLOCK(inp);
 					} else {
 						error = EINVAL;
 					}
@@ -1833,17 +1833,17 @@ do {									\
 					break;
 				{
 					struct ip6_pktopts **optp;
-					INP_WLOCK(in6p);
-					if (in6p->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
-						INP_WUNLOCK(in6p);
+					INP_WLOCK(inp);
+					if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
+						INP_WUNLOCK(inp);
 						return (ECONNRESET);
 					}
-					optp = &in6p->in6p_outputopts;
+					optp = &inp->in6p_outputopts;
 					error = ip6_pcbopt(optname,
 					    (u_char *)&optval, sizeof(optval),
 					    optp, (td != NULL) ? td->td_ucred :
 					    NULL, uproto);
-					INP_WUNLOCK(in6p);
+					INP_WUNLOCK(inp);
 					break;
 				}
 
@@ -1925,16 +1925,16 @@ do {									\
 					break;
 				optlen = sopt->sopt_valsize;
 				optbuf = optbuf_storage;
-				INP_WLOCK(in6p);
-				if (in6p->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
-					INP_WUNLOCK(in6p);
+				INP_WLOCK(inp);
+				if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
+					INP_WUNLOCK(inp);
 					return (ECONNRESET);
 				}
-				optp = &in6p->in6p_outputopts;
+				optp = &inp->in6p_outputopts;
 				error = ip6_pcbopt(optname, optbuf, optlen,
 				    optp, (td != NULL) ? td->td_ucred : NULL,
 				    uproto);
-				INP_WUNLOCK(in6p);
+				INP_WUNLOCK(inp);
 				break;
 			}
 #undef OPTSET
@@ -1951,7 +1951,7 @@ do {									\
 			case MCAST_LEAVE_GROUP:
 			case MCAST_JOIN_SOURCE_GROUP:
 			case MCAST_LEAVE_SOURCE_GROUP:
-				error = ip6_setmoptions(in6p, sopt);
+				error = ip6_setmoptions(inp, sopt);
 				break;
 
 			case IPV6_PORTRANGE:
@@ -1960,34 +1960,34 @@ do {									\
 				if (error)
 					break;
 
-				INP_WLOCK(in6p);
+				INP_WLOCK(inp);
 				switch (optval) {
 				case IPV6_PORTRANGE_DEFAULT:
-					in6p->inp_flags &= ~(INP_LOWPORT);
-					in6p->inp_flags &= ~(INP_HIGHPORT);
+					inp->inp_flags &= ~(INP_LOWPORT);
+					inp->inp_flags &= ~(INP_HIGHPORT);
 					break;
 
 				case IPV6_PORTRANGE_HIGH:
-					in6p->inp_flags &= ~(INP_LOWPORT);
-					in6p->inp_flags |= INP_HIGHPORT;
+					inp->inp_flags &= ~(INP_LOWPORT);
+					inp->inp_flags |= INP_HIGHPORT;
 					break;
 
 				case IPV6_PORTRANGE_LOW:
-					in6p->inp_flags &= ~(INP_HIGHPORT);
-					in6p->inp_flags |= INP_LOWPORT;
+					inp->inp_flags &= ~(INP_HIGHPORT);
+					inp->inp_flags |= INP_LOWPORT;
 					break;
 
 				default:
 					error = EINVAL;
 					break;
 				}
-				INP_WUNLOCK(in6p);
+				INP_WUNLOCK(inp);
 				break;
 
 #if defined(IPSEC) || defined(IPSEC_SUPPORT)
 			case IPV6_IPSEC_POLICY:
 				if (IPSEC_ENABLED(ipv6)) {
-					error = IPSEC_PCBCTL(ipv6, in6p, sopt);
+					error = IPSEC_PCBCTL(ipv6, inp, sopt);
 					break;
 				}
 				/* FALLTHROUGH */
@@ -2055,7 +2055,7 @@ do {									\
 					break;
 
 				case IPV6_UNICAST_HOPS:
-					optval = in6p->in6p_hops;
+					optval = inp->in6p_hops;
 					break;
 
 				case IPV6_RECVPKTINFO:
@@ -2081,7 +2081,7 @@ do {									\
 				case IPV6_PORTRANGE:
 				    {
 					int flags;
-					flags = in6p->inp_flags;
+					flags = inp->inp_flags;
 					if (flags & INP_HIGHPORT)
 						optval = IPV6_PORTRANGE_HIGH;
 					else if (flags & INP_LOWPORT)
@@ -2107,11 +2107,11 @@ do {									\
 					break;
 
 				case IPV6_FLOWID:
-					optval = in6p->inp_flowid;
+					optval = inp->inp_flowid;
 					break;
 
 				case IPV6_FLOWTYPE:
-					optval = in6p->inp_flowtype;
+					optval = inp->inp_flowtype;
 					break;
 
 				case IPV6_RECVFLOWID:
@@ -2120,8 +2120,8 @@ do {									\
 #ifdef	RSS
 				case IPV6_RSSBUCKETID:
 					retval =
-					    rss_hash2bucket(in6p->inp_flowid,
-					    in6p->inp_flowtype,
+					    rss_hash2bucket(inp->inp_flowid,
+					    inp->inp_flowtype,
 					    &rss_bucket);
 					if (retval == 0)
 						optval = rss_bucket;
@@ -2157,12 +2157,12 @@ do {									\
 				 * XXX: we dot not consider the case of source
 				 * routing, or optional information to specify
 				 * the outgoing interface.
-				 * Copy faddr out of in6p to avoid holding lock
+				 * Copy faddr out of inp to avoid holding lock
 				 * on inp during route lookup.
 				 */
-				INP_RLOCK(in6p);
-				bcopy(&in6p->in6p_faddr, &addr, sizeof(addr));
-				INP_RUNLOCK(in6p);
+				INP_RLOCK(inp);
+				bcopy(&inp->in6p_faddr, &addr, sizeof(addr));
+				INP_RUNLOCK(inp);
 				error = ip6_getpmtu_ctl(so->so_fibnum,
 				    &addr, &pmtu);
 				if (error)
@@ -2214,20 +2214,20 @@ do {									\
 			case IPV6_DONTFRAG:
 			case IPV6_USE_MIN_MTU:
 			case IPV6_PREFER_TEMPADDR:
-				error = ip6_getpcbopt(in6p, optname, sopt);
+				error = ip6_getpcbopt(inp, optname, sopt);
 				break;
 
 			case IPV6_MULTICAST_IF:
 			case IPV6_MULTICAST_HOPS:
 			case IPV6_MULTICAST_LOOP:
 			case IPV6_MSFILTER:
-				error = ip6_getmoptions(in6p, sopt);
+				error = ip6_getmoptions(inp, sopt);
 				break;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@freebsd.org  Fri Aug  2 10:06:54 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED21EAED04;
 Fri,  2 Aug 2019 10:06:54 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460N9p63cTz3PBP;
 Fri,  2 Aug 2019 10:06:54 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD41FE3A;
 Fri,  2 Aug 2019 10:06:54 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72A6s4K041746;
 Fri, 2 Aug 2019 10:06:54 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72A6smN041745;
 Fri, 2 Aug 2019 10:06:54 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908021006.x72A6smN041745@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Fri, 2 Aug 2019 10:06:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350532 - head/sys/netinet6
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: head/sys/netinet6
X-SVN-Commit-Revision: 350532
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 10:06:55 -0000

Author: bz
Date: Fri Aug  2 10:06:54 2019
New Revision: 350532
URL: https://svnweb.freebsd.org/changeset/base/350532

Log:
  frag6.c: sort includes
  
  Sort includes and remove duplicate kernel.h as well as the unneeded
  systm.h.
  Hide the mac framework incude behind #fidef MAC.
  
  MFC after:		3 months
  Sponsored by:		Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Fri Aug  2 07:41:36 2019	(r350531)
+++ head/sys/netinet6/frag6.c	Fri Aug  2 10:06:54 2019	(r350532)
@@ -37,18 +37,16 @@ __FBSDID("$FreeBSD$");
 #include "opt_rss.h"
 
 #include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/hash.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
 #include <sys/domain.h>
+#include <sys/errno.h>
 #include <sys/eventhandler.h>
+#include <sys/hash.h>
 #include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
 #include <sys/protosw.h>
 #include <sys/socket.h>
-#include <sys/errno.h>
 #include <sys/time.h>
-#include <sys/kernel.h>
 #include <sys/syslog.h>
 
 #include <machine/atomic.h>
@@ -67,7 +65,9 @@ __FBSDID("$FreeBSD$");
 #include <netinet/in_systm.h>	/* for ECN definitions */
 #include <netinet/ip.h>		/* for ECN definitions */
 
+#ifdef MAC
 #include <security/mac/mac_framework.h>
+#endif
 
 /*
  * Reassembly headers are stored in hash buckets.

From owner-svn-src-head@freebsd.org  Fri Aug  2 10:29:54 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82836AF399;
 Fri,  2 Aug 2019 10:29:54 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460NhL2vTQz3QLm;
 Fri,  2 Aug 2019 10:29:54 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46ABE11D2;
 Fri,  2 Aug 2019 10:29:54 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72ATsl9053304;
 Fri, 2 Aug 2019 10:29:54 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72ATrpD053301;
 Fri, 2 Aug 2019 10:29:53 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908021029.x72ATrpD053301@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Fri, 2 Aug 2019 10:29:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350533 - head/sys/netinet6
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: head/sys/netinet6
X-SVN-Commit-Revision: 350533
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 10:29:54 -0000

Author: bz
Date: Fri Aug  2 10:29:53 2019
New Revision: 350533
URL: https://svnweb.freebsd.org/changeset/base/350533

Log:
  frag6.c: move variables and sysctls into local file
  
  Move the sysctls and the related variables only used in frag6.c
  into the file and out of in6_proto.c.  That way everything belonging
  together is in one place.
  
  Sort the variables into global and per-vnet scopes and make
  them static.  No longer export the (helper) function
  frag6_set_bucketsize() now also file-local only.
  
  Should be no functional changes, only reduced public KPI/KBI surface.
  
  MFC after:		3 months
  Sponsored by:		Netflix

Modified:
  head/sys/netinet6/frag6.c
  head/sys/netinet6/in6_proto.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Fri Aug  2 10:06:54 2019	(r350532)
+++ head/sys/netinet6/frag6.c	Fri Aug  2 10:29:53 2019	(r350533)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/protosw.h>
 #include <sys/socket.h>
 #include <sys/time.h>
+#include <sys/sysctl.h>
 #include <sys/syslog.h>
 
 #include <machine/atomic.h>
@@ -90,12 +91,25 @@ struct ip6qbucket {
 	int		count;
 };
 
-VNET_DEFINE_STATIC(volatile u_int, frag6_nfragpackets);
-volatile u_int frag6_nfrags = 0;
-VNET_DEFINE_STATIC(struct ip6qbucket, ip6q[IP6REASS_NHASH]);
-VNET_DEFINE_STATIC(uint32_t, ip6q_hashseed);
+/* System wide (global) maximum and count of packets in reassembly queues. */ 
+static int ip6_maxfrags;
+static volatile u_int frag6_nfrags = 0;
 
+/* Maximum and current packets in per-VNET reassembly queue. */
+VNET_DEFINE_STATIC(int,			ip6_maxfragpackets);
+VNET_DEFINE_STATIC(volatile u_int,	frag6_nfragpackets);
+#define	V_ip6_maxfragpackets		VNET(ip6_maxfragpackets)
 #define	V_frag6_nfragpackets		VNET(frag6_nfragpackets)
+
+/* Maximum per-VNET reassembly queues per bucket and fragments per packet. */
+VNET_DEFINE_STATIC(int,			ip6_maxfragbucketsize);
+VNET_DEFINE_STATIC(int,			ip6_maxfragsperpacket);
+#define	V_ip6_maxfragbucketsize		VNET(ip6_maxfragbucketsize)
+#define	V_ip6_maxfragsperpacket		VNET(ip6_maxfragsperpacket)
+
+/* Per-VNET reassembly queue buckets. */
+VNET_DEFINE_STATIC(struct ip6qbucket,	ip6q[IP6REASS_NHASH]);
+VNET_DEFINE_STATIC(uint32_t,		ip6q_hashseed);
 #define	V_ip6q				VNET(ip6q)
 #define	V_ip6q_hashseed			VNET(ip6q_hashseed)
 
@@ -123,10 +137,13 @@ static MALLOC_DEFINE(M_FTABLE, "fragment", "fragment r
 #define	IP6_MAXFRAGS		(nmbclusters / 32)
 #define	IP6_MAXFRAGPACKETS	(imin(IP6_MAXFRAGS, IP6REASS_NHASH * 50))
 
+
 /*
- * Initialise reassembly queue and fragment identifier.
+ * Sysctls and helper function.
  */
-void
+SYSCTL_DECL(_net_inet6_ip6);
+
+static void
 frag6_set_bucketsize()
 {
 	int i;
@@ -135,6 +152,42 @@ frag6_set_bucketsize()
 		V_ip6_maxfragbucketsize = imax(i / (IP6REASS_NHASH / 2), 1);
 }
 
+SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGS, maxfrags,
+	CTLFLAG_RW, &ip6_maxfrags, 0,
+	"Maximum allowed number of outstanding IPv6 packet fragments. "
+	"A value of 0 means no fragmented packets will be accepted, while a "
+	"a value of -1 means no limit");
+
+static int
+sysctl_ip6_maxfragpackets(SYSCTL_HANDLER_ARGS)
+{
+	int error, val;
+
+	val = V_ip6_maxfragpackets;
+	error = sysctl_handle_int(oidp, &val, 0, req);
+	if (error != 0 || !req->newptr)
+		return (error);
+	V_ip6_maxfragpackets = val;
+	frag6_set_bucketsize();
+	return (0);
+}
+SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets,
+	CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW, NULL, 0,
+	sysctl_ip6_maxfragpackets, "I",
+	"Default maximum number of outstanding fragmented IPv6 packets. "
+	"A value of 0 means no fragmented packets will be accepted, while a "
+	"a value of -1 means no limit");
+SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGSPERPACKET, maxfragsperpacket,
+	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_maxfragsperpacket), 0,
+	"Maximum allowed number of fragments per packet");
+SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGBUCKETSIZE, maxfragbucketsize,
+	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_maxfragbucketsize), 0,
+	"Maximum number of reassembly queues per hash bucket");
+
+
+/*
+ * Initialise reassembly queue and fragment identifier.
+ */
 static void
 frag6_change(void *tag)
 {

Modified: head/sys/netinet6/in6_proto.c
==============================================================================
--- head/sys/netinet6/in6_proto.c	Fri Aug  2 10:06:54 2019	(r350532)
+++ head/sys/netinet6/in6_proto.c	Fri Aug  2 10:29:53 2019	(r350533)
@@ -384,10 +384,6 @@ VNET_DEFINE(int, ip6_accept_rtadv) = 0;
 VNET_DEFINE(int, ip6_no_radr) = 0;
 VNET_DEFINE(int, ip6_norbit_raif) = 0;
 VNET_DEFINE(int, ip6_rfc6204w3) = 0;
-VNET_DEFINE(int, ip6_maxfragpackets);	/* initialized in frag6.c:frag6_init() */
-int ip6_maxfrags;		/* initialized in frag6.c:frag6_init() */
-VNET_DEFINE(int, ip6_maxfragbucketsize);/* initialized in frag6.c:frag6_init() */
-VNET_DEFINE(int, ip6_maxfragsperpacket); /* initialized in frag6.c:frag6_init() */
 VNET_DEFINE(int, ip6_log_interval) = 5;
 VNET_DEFINE(int, ip6_hdrnestlimit) = 15;/* How many header options will we
 					 * process? */
@@ -474,20 +470,6 @@ sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARGS)
 	return (0);
 }
 
-static int
-sysctl_ip6_maxfragpackets(SYSCTL_HANDLER_ARGS)
-{
-	int error, val;
-
-	val = V_ip6_maxfragpackets;
-	error = sysctl_handle_int(oidp, &val, 0, req);
-	if (error != 0 || !req->newptr)
-		return (error);
-	V_ip6_maxfragpackets = val;
-	frag6_set_bucketsize();
-	return (0);
-}
-
 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_FORWARDING, forwarding,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_forwarding), 0,
 	"Enable forwarding of IPv6 packets between interfaces");
@@ -500,12 +482,6 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM, hlim,
 SYSCTL_VNET_PCPUSTAT(_net_inet6_ip6, IPV6CTL_STATS, stats, struct ip6stat,
 	ip6stat,
 	"IP6 statistics (struct ip6stat, netinet6/ip6_var.h)");
-SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets,
-	CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW, NULL, 0,
-	sysctl_ip6_maxfragpackets, "I",
-	"Default maximum number of outstanding fragmented IPv6 packets. "
-	"A value of 0 means no fragmented packets will be accepted, while a "
-	"a value of -1 means no limit");
 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV, accept_rtadv,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_accept_rtadv), 0,
 	"Default value of per-interface flag for accepting ICMPv6 RA messages");
@@ -575,17 +551,6 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, pr
 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE, use_defaultzone,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_use_defzone), 0,
 	"Use the default scope zone when none is specified");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGS, maxfrags,
-	CTLFLAG_RW, &ip6_maxfrags, 0,
-	"Maximum allowed number of outstanding IPv6 packet fragments. "
-	"A value of 0 means no fragmented packets will be accepted, while a "
-	"a value of -1 means no limit");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGBUCKETSIZE, maxfragbucketsize,
-	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_maxfragbucketsize), 0,
-	"Maximum number of reassembly queues per hash bucket");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGSPERPACKET, maxfragsperpacket,
-	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_maxfragsperpacket), 0,
-	"Maximum allowed number of fragments per packet");
 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MCAST_PMTU, mcast_pmtu,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_mcast_pmtu), 0,
 	"Enable path MTU discovery for multicast packets");

Modified: head/sys/netinet6/ip6_var.h
==============================================================================
--- head/sys/netinet6/ip6_var.h	Fri Aug  2 10:06:54 2019	(r350532)
+++ head/sys/netinet6/ip6_var.h	Fri Aug  2 10:29:53 2019	(r350533)
@@ -299,12 +299,6 @@ VNET_DECLARE(int, ip6_v6only);
 
 VNET_DECLARE(struct socket *, ip6_mrouter);	/* multicast routing daemon */
 VNET_DECLARE(int, ip6_sendredirects);	/* send IP redirects when forwarding? */
-VNET_DECLARE(int, ip6_maxfragpackets);	/* Maximum packets in reassembly
-					 * queue */
-extern int ip6_maxfrags;		/* Maximum fragments in reassembly
-					 * queue */
-VNET_DECLARE(int, ip6_maxfragbucketsize); /* Maximum reassembly queues per bucket */
-VNET_DECLARE(int, ip6_maxfragsperpacket); /* Maximum fragments per packet */
 VNET_DECLARE(int, ip6_accept_rtadv);	/* Acts as a host not a router */
 VNET_DECLARE(int, ip6_no_radr);		/* No defroute from RA */
 VNET_DECLARE(int, ip6_norbit_raif);	/* Disable R-bit in NA on RA
@@ -318,9 +312,6 @@ VNET_DECLARE(int, ip6_hdrnestlimit);	/* upper limit of
 VNET_DECLARE(int, ip6_dad_count);	/* DupAddrDetectionTransmits */
 #define	V_ip6_mrouter			VNET(ip6_mrouter)
 #define	V_ip6_sendredirects		VNET(ip6_sendredirects)
-#define	V_ip6_maxfragpackets		VNET(ip6_maxfragpackets)
-#define	V_ip6_maxfragbucketsize		VNET(ip6_maxfragbucketsize)
-#define	V_ip6_maxfragsperpacket		VNET(ip6_maxfragsperpacket)
 #define	V_ip6_accept_rtadv		VNET(ip6_accept_rtadv)
 #define	V_ip6_no_radr			VNET(ip6_no_radr)
 #define	V_ip6_norbit_raif		VNET(ip6_norbit_raif)
@@ -414,7 +405,6 @@ int	ip6_fragment(struct ifnet *, struct mbuf *, int, u
 
 int	route6_input(struct mbuf **, int *, int);
 
-void	frag6_set_bucketsize(void);
 void	frag6_init(void);
 int	frag6_input(struct mbuf **, int *, int);
 void	frag6_slowtimo(void);

From owner-svn-src-head@freebsd.org  Fri Aug  2 10:41:51 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4E98AF8DE;
 Fri,  2 Aug 2019 10:41:51 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460Ny74tDDz3R3h;
 Fri,  2 Aug 2019 10:41:51 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89382151B;
 Fri,  2 Aug 2019 10:41:51 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72AfpQs063238;
 Fri, 2 Aug 2019 10:41:51 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72AfpNw063237;
 Fri, 2 Aug 2019 10:41:51 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908021041.x72AfpNw063237@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Fri, 2 Aug 2019 10:41:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350534 - head/sys/netinet6
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: head/sys/netinet6
X-SVN-Commit-Revision: 350534
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 10:41:51 -0000

Author: bz
Date: Fri Aug  2 10:41:51 2019
New Revision: 350534
URL: https://svnweb.freebsd.org/changeset/base/350534

Log:
  frag6.c: remove dead code
  
  Remove all the #if 0 and #if notyet blocks of dead code which have been
  there for at least 18 years from what I can see.
  
  No functional changes.
  
  MFC after:		3 months
  Sponsored by:		Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Fri Aug  2 10:29:53 2019	(r350533)
+++ head/sys/netinet6/frag6.c	Fri Aug  2 10:41:51 2019	(r350534)
@@ -282,10 +282,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 	struct ip6_direct_ctx *ip6dc;
 #endif
 
-#if 0
-	char ip6buf[INET6_ADDRSTRLEN];
-#endif
-
 	ip6 = mtod(m, struct ip6_hdr *);
 #ifndef PULLDOWN_TEST
 	IP6_EXTHDR_CHECK(m, offset, sizeof(struct ip6_frag), IPPROTO_DONE);
@@ -547,43 +543,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 		if (af6->ip6af_off > ip6af->ip6af_off)
 			break;
 
-#if 0
 	/*
-	 * If there is a preceding segment, it may provide some of
-	 * our data already.  If so, drop the data from the incoming
-	 * segment.  If it provides all of our data, drop us.
-	 */
-	if (af6->ip6af_up != (struct ip6asfrag *)q6) {
-		i = af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen
-			- ip6af->ip6af_off;
-		if (i > 0) {
-			if (i >= ip6af->ip6af_frglen)
-				goto dropfrag;
-			m_adj(IP6_REASS_MBUF(ip6af), i);
-			ip6af->ip6af_off += i;
-			ip6af->ip6af_frglen -= i;
-		}
-	}
-
-	/*
-	 * While we overlap succeeding segments trim them or,
-	 * if they are completely covered, dequeue them.
-	 */
-	while (af6 != (struct ip6asfrag *)q6 &&
-	       ip6af->ip6af_off + ip6af->ip6af_frglen > af6->ip6af_off) {
-		i = (ip6af->ip6af_off + ip6af->ip6af_frglen) - af6->ip6af_off;
-		if (i < af6->ip6af_frglen) {
-			af6->ip6af_frglen -= i;
-			af6->ip6af_off += i;
-			m_adj(IP6_REASS_MBUF(af6), i);
-			break;
-		}
-		af6 = af6->ip6af_down;
-		m_freem(IP6_REASS_MBUF(af6->ip6af_up));
-		frag6_deq(af6->ip6af_up, hash);
-	}
-#else
-	/*
 	 * If the incoming framgent overlaps some existing fragments in
 	 * the reassembly queue, drop it, since it is dangerous to override
 	 * existing fragments from a security point of view.
@@ -597,11 +557,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 		i = af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen
 			- ip6af->ip6af_off;
 		if (i > 0) {
-#if 0				/* suppress the noisy log */
-			log(LOG_ERR, "%d bytes of a fragment from %s "
-			    "overlaps the previous fragment\n",
-			    i, ip6_sprintf(ip6buf, &q6->ip6q_src));
-#endif
 			free(ip6af, M_FTABLE);
 			goto dropfrag;
 		}
@@ -609,16 +564,10 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 	if (af6 != (struct ip6asfrag *)q6) {
 		i = (ip6af->ip6af_off + ip6af->ip6af_frglen) - af6->ip6af_off;
 		if (i > 0) {
-#if 0				/* suppress the noisy log */
-			log(LOG_ERR, "%d bytes of a fragment from %s "
-			    "overlaps the succeeding fragment",
-			    i, ip6_sprintf(ip6buf, &q6->ip6q_src));
-#endif
 			free(ip6af, M_FTABLE);
 			goto dropfrag;
 		}
 	}
-#endif
 
 insert:
 #ifdef MAC
@@ -636,12 +585,6 @@ insert:
 	frag6_enq(ip6af, af6->ip6af_up, hash);
 	atomic_add_int(&frag6_nfrags, 1);
 	q6->ip6q_nfrag++;
-#if 0 /* xxx */
-	if (q6 != head->ip6q_next) {
-		frag6_remque(q6, hash);
-		frag6_insque_head(q6, head, hash);
-	}
-#endif
 	next = 0;
 	for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6;
 	     af6 = af6->ip6af_down) {
@@ -700,9 +643,6 @@ insert:
 	if (q6->ip6q_ecn == IPTOS_ECN_CE)
 		ip6->ip6_flow |= htonl(IPTOS_ECN_CE << 20);
 	nxt = q6->ip6q_nxt;
-#ifdef notyet
-	*q6->ip6q_nxtp = (u_char)(nxt & 0xff);
-#endif
 
 	if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) {
 		frag6_remque(q6, hash);

From owner-svn-src-head@freebsd.org  Fri Aug  2 10:47:52 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F85EAFAE9;
 Fri,  2 Aug 2019 10:47:52 +0000 (UTC)
 (envelope-from brde@optusnet.com.au)
Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au
 [211.29.132.246])
 by mx1.freebsd.org (Postfix) with ESMTP id 460P536x20z3wfW;
 Fri,  2 Aug 2019 10:47:51 +0000 (UTC)
 (envelope-from brde@optusnet.com.au)
Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au
 [110.21.101.228])
 by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id E2E0F43E304;
 Fri,  2 Aug 2019 20:47:45 +1000 (AEST)
Date: Fri, 2 Aug 2019 20:47:44 +1000 (EST)
From: Bruce Evans <brde@optusnet.com.au>
X-X-Sender: bde@besplex.bde.org
To: "Bjoern A. Zeeb" <bz@freebsd.org>
cc: src-committers@freebsd.org, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350532 - head/sys/netinet6
In-Reply-To: <201908021006.x72A6smN041745@repo.freebsd.org>
Message-ID: <20190802203707.S1343@besplex.bde.org>
References: <201908021006.x72A6smN041745@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=D+Q3ErZj c=1 sm=1 tr=0 cx=a_idp_d
 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17
 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10
 a=YjTnG6WotgYSgN7JHBkA:9 a=CjuIK1q_8ugA:10
X-Rspamd-Queue-Id: 460P536x20z3wfW
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.87 / 15.00]; REPLY(-4.00)[];
 NEURAL_HAM_SHORT(-0.87)[-0.873,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 10:47:52 -0000

On Fri, 2 Aug 2019, Bjoern A. Zeeb wrote:

> Log:
>  frag6.c: sort includes
>
>  Sort includes and remove duplicate kernel.h as well as the unneeded
>  systm.h.

sys/systm.h is always needed, since it defines macros and functions which
might be needed in other headers.  frag6.c even uses KASSERT() directly.

> Modified: head/sys/netinet6/frag6.c
> ==============================================================================
> --- head/sys/netinet6/frag6.c	Fri Aug  2 07:41:36 2019	(r350531)
> +++ head/sys/netinet6/frag6.c	Fri Aug  2 10:06:54 2019	(r350532)
> @@ -37,18 +37,16 @@ __FBSDID("$FreeBSD$");
> #include "opt_rss.h"
>
> #include <sys/param.h>
> -#include <sys/systm.h>

This was correct.  sys/systm.h must also be included in this order.

Now the KASSERT() used in frag6.c is apparently obtained via pollution
in some other header.

> -#include <sys/hash.h>
> -#include <sys/malloc.h>
> -#include <sys/mbuf.h>
> #include <sys/domain.h>
> +#include <sys/errno.h>

sys/errno is standard pollution in sys/param.h (if _KERNEL).  It is a style
bug to not depend on this.

> #include <sys/eventhandler.h>
> +#include <sys/hash.h>
> #include <sys/kernel.h>
> +#include <sys/malloc.h>

sys/malloc.h is polluted by including sys/systm.h.

> +#include <sys/mbuf.h>

sys/mbuf.h is polluted by including sys/systm.h.

> #include <sys/protosw.h>
> #include <sys/socket.h>
> -#include <sys/errno.h>
> #include <sys/time.h>

sys/time.h is standard pollution in sys/param.h (if _KERNEL).  It is a style
bug to not depend on this.

> -#include <sys/kernel.h>
> #include <sys/syslog.h>
>
> #include <machine/atomic.h>

machine/atomic.h is standard non-pollution on sys/systm.h.  It is a style
bug to include it directly.

Bruce

From owner-svn-src-head@freebsd.org  Fri Aug  2 10:54:58 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99818AFD4A;
 Fri,  2 Aug 2019 10:54:58 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460PFG3ZsPz3x31;
 Fri,  2 Aug 2019 10:54:58 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B4AC1737;
 Fri,  2 Aug 2019 10:54:58 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72Aswfo070596;
 Fri, 2 Aug 2019 10:54:58 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72AswLg070595;
 Fri, 2 Aug 2019 10:54:58 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908021054.x72AswLg070595@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Fri, 2 Aug 2019 10:54:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350535 - head/sys/netinet6
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: head/sys/netinet6
X-SVN-Commit-Revision: 350535
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 10:54:58 -0000

Author: bz
Date: Fri Aug  2 10:54:57 2019
New Revision: 350535
URL: https://svnweb.freebsd.org/changeset/base/350535

Log:
  frag6.c: rename malloc type
  
  Rename M_FTABLE to M_FRAG6 as the former sounds very much like the former
  "flowtable" rather than anything to do with fragments and reassembly.
  
  While here, let malloc( , .. | M_ZERO) do the zeroing rather than calling
  bzero() ourselves.
  
  MFC after:		3 months
  Sponsored by:		Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Fri Aug  2 10:41:51 2019	(r350534)
+++ head/sys/netinet6/frag6.c	Fri Aug  2 10:54:57 2019	(r350535)
@@ -91,6 +91,8 @@ struct ip6qbucket {
 	int		count;
 };
 
+static MALLOC_DEFINE(M_FRAG6, "frag6", "IPv6 fragment reassembly header");
+
 /* System wide (global) maximum and count of packets in reassembly queues. */ 
 static int ip6_maxfrags;
 static volatile u_int frag6_nfrags = 0;
@@ -119,8 +121,6 @@ VNET_DEFINE_STATIC(uint32_t,		ip6q_hashseed);
 #define	IP6Q_UNLOCK(i)		mtx_unlock(&V_ip6q[(i)].lock)
 #define	IP6Q_HEAD(i)		(&V_ip6q[(i)].ip6q)
 
-static MALLOC_DEFINE(M_FTABLE, "fragment", "fragment reassembly header");
-
 /*
  * By default, limit the number of IP6 fragments across all reassembly
  * queues to  1/32 of the total number of mbuf clusters.
@@ -400,14 +400,13 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 		    (u_int)V_ip6_maxfragpackets)
 			goto dropfrag;
 		atomic_add_int(&V_frag6_nfragpackets, 1);
-		q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FTABLE,
-		    M_NOWAIT);
+		q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FRAG6,
+		    M_NOWAIT | M_ZERO);
 		if (q6 == NULL)
 			goto dropfrag;
-		bzero(q6, sizeof(*q6));
 #ifdef MAC
 		if (mac_ip6q_init(q6, M_NOWAIT) != 0) {
-			free(q6, M_FTABLE);
+			free(q6, M_FRAG6);
 			goto dropfrag;
 		}
 		mac_ip6q_create(m, q6);
@@ -479,7 +478,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 
 				/* dequeue the fragment. */
 				frag6_deq(af6, hash);
-				free(af6, M_FTABLE);
+				free(af6, M_FRAG6);
 
 				/* adjust pointer. */
 				ip6err = mtod(merr, struct ip6_hdr *);
@@ -499,11 +498,10 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 		}
 	}
 
-	ip6af = (struct ip6asfrag *)malloc(sizeof(struct ip6asfrag), M_FTABLE,
-	    M_NOWAIT);
+	ip6af = (struct ip6asfrag *)malloc(sizeof(struct ip6asfrag), M_FRAG6,
+	    M_NOWAIT | M_ZERO);
 	if (ip6af == NULL)
 		goto dropfrag;
-	bzero(ip6af, sizeof(*ip6af));
 	ip6af->ip6af_mff = ip6f->ip6f_offlg & IP6F_MORE_FRAG;
 	ip6af->ip6af_off = fragoff;
 	ip6af->ip6af_frglen = frgpartlen;
@@ -524,14 +522,14 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 	ecn0 = q6->ip6q_ecn;
 	if (ecn == IPTOS_ECN_CE) {
 		if (ecn0 == IPTOS_ECN_NOTECT) {
-			free(ip6af, M_FTABLE);
+			free(ip6af, M_FRAG6);
 			goto dropfrag;
 		}
 		if (ecn0 != IPTOS_ECN_CE)
 			q6->ip6q_ecn = IPTOS_ECN_CE;
 	}
 	if (ecn == IPTOS_ECN_NOTECT && ecn0 != IPTOS_ECN_NOTECT) {
-		free(ip6af, M_FTABLE);
+		free(ip6af, M_FRAG6);
 		goto dropfrag;
 	}
 
@@ -557,14 +555,14 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 		i = af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen
 			- ip6af->ip6af_off;
 		if (i > 0) {
-			free(ip6af, M_FTABLE);
+			free(ip6af, M_FRAG6);
 			goto dropfrag;
 		}
 	}
 	if (af6 != (struct ip6asfrag *)q6) {
 		i = (ip6af->ip6af_off + ip6af->ip6af_frglen) - af6->ip6af_off;
 		if (i > 0) {
-			free(ip6af, M_FTABLE);
+			free(ip6af, M_FRAG6);
 			goto dropfrag;
 		}
 	}
@@ -627,7 +625,7 @@ insert:
 		m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset);
 		m_demote_pkthdr(IP6_REASS_MBUF(af6));
 		m_cat(t, IP6_REASS_MBUF(af6));
-		free(af6, M_FTABLE);
+		free(af6, M_FRAG6);
 		af6 = af6dwn;
 	}
 
@@ -637,7 +635,7 @@ insert:
 
 	/* adjust offset to point where the original next header starts */
 	offset = ip6af->ip6af_offset - sizeof(struct ip6_frag);
-	free(ip6af, M_FTABLE);
+	free(ip6af, M_FRAG6);
 	ip6 = mtod(m, struct ip6_hdr *);
 	ip6->ip6_plen = htons((u_short)next + offset - sizeof(struct ip6_hdr));
 	if (q6->ip6q_ecn == IPTOS_ECN_CE)
@@ -650,7 +648,7 @@ insert:
 #ifdef MAC
 		mac_ip6q_destroy(q6);
 #endif
-		free(q6, M_FTABLE);
+		free(q6, M_FRAG6);
 		atomic_subtract_int(&V_frag6_nfragpackets, 1);
 
 		goto dropfrag;
@@ -668,7 +666,7 @@ insert:
 	mac_ip6q_reassemble(q6, m);
 	mac_ip6q_destroy(q6);
 #endif
-	free(q6, M_FTABLE);
+	free(q6, M_FRAG6);
 	atomic_subtract_int(&V_frag6_nfragpackets, 1);
 
 	if (m->m_flags & M_PKTHDR) { /* Isn't it always true? */
@@ -756,14 +754,14 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
 				    ICMP6_TIME_EXCEED_REASSEMBLY, 0);
 		} else
 			m_freem(m);
-		free(af6, M_FTABLE);
+		free(af6, M_FRAG6);
 	}
 	frag6_remque(q6, bucket);
 	atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag);
 #ifdef MAC
 	mac_ip6q_destroy(q6);
 #endif
-	free(q6, M_FTABLE);
+	free(q6, M_FRAG6);
 	atomic_subtract_int(&V_frag6_nfragpackets, 1);
 }
 

From owner-svn-src-head@freebsd.org  Fri Aug  2 11:05:01 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BE2EAFFC9;
 Fri,  2 Aug 2019 11:05:01 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460PSr6XHKz3xTV;
 Fri,  2 Aug 2019 11:05:00 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD362190E;
 Fri,  2 Aug 2019 11:05:00 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72B50I5076615;
 Fri, 2 Aug 2019 11:05:00 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72B50Eq076614;
 Fri, 2 Aug 2019 11:05:00 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908021105.x72B50Eq076614@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Fri, 2 Aug 2019 11:05:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350536 - head/sys/netinet6
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: head/sys/netinet6
X-SVN-Commit-Revision: 350536
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 11:05:01 -0000

Author: bz
Date: Fri Aug  2 11:05:00 2019
New Revision: 350536
URL: https://svnweb.freebsd.org/changeset/base/350536

Log:
  frag6.c: make compile with gcc
  
  Removing the prototype from the header and making the function static
  in r350533 makes architectures using gcc complain "function declaration
  isn't a prototype".  Add the missing void given the function has no
  arguments.
  
  Reported by:		the CI machinery
  Pointyhat to:		bz
  MFC after:		3 months
  X-MFC with:		r350533
  Sponsored by:		Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Fri Aug  2 10:54:57 2019	(r350535)
+++ head/sys/netinet6/frag6.c	Fri Aug  2 11:05:00 2019	(r350536)
@@ -144,7 +144,7 @@ VNET_DEFINE_STATIC(uint32_t,		ip6q_hashseed);
 SYSCTL_DECL(_net_inet6_ip6);
 
 static void
-frag6_set_bucketsize()
+frag6_set_bucketsize(void)
 {
 	int i;
 

From owner-svn-src-head@freebsd.org  Fri Aug  2 11:17:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03755B044C;
 Fri,  2 Aug 2019 11:17:08 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460Pkq6Cz8z3y7l;
 Fri,  2 Aug 2019 11:17:07 +0000 (UTC) (envelope-from rrs@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD7C31ADE;
 Fri,  2 Aug 2019 11:17:07 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72BH78G082758;
 Fri, 2 Aug 2019 11:17:07 GMT (envelope-from rrs@FreeBSD.org)
Received: (from rrs@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72BH7FX082757;
 Fri, 2 Aug 2019 11:17:07 GMT (envelope-from rrs@FreeBSD.org)
Message-Id: <201908021117.x72BH7FX082757@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org
 using -f
From: Randall Stewart <rrs@FreeBSD.org>
Date: Fri, 2 Aug 2019 11:17:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350537 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: rrs
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350537
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 11:17:08 -0000

Author: rrs
Date: Fri Aug  2 11:17:07 2019
New Revision: 350537
URL: https://svnweb.freebsd.org/changeset/base/350537

Log:
  Fix one more atomic for i86
  Obtained from:	mtuexen@freebsd.org

Modified:
  head/sys/netinet/tcp_ratelimit.c

Modified: head/sys/netinet/tcp_ratelimit.c
==============================================================================
--- head/sys/netinet/tcp_ratelimit.c	Fri Aug  2 11:05:00 2019	(r350536)
+++ head/sys/netinet/tcp_ratelimit.c	Fri Aug  2 11:17:07 2019	(r350537)
@@ -945,7 +945,7 @@ use_real_interface:
 		 * We use an atomic here for accounting so we don't have to
 		 * use locks when freeing.
 		 */
-		atomic_add_long(&rs->rs_flows_using, 1);
+		atomic_add_64(&rs->rs_flows_using, 1);
 	}
 	epoch_exit_preempt(net_epoch_preempt, &et);
 	return (rte);

From owner-svn-src-head@freebsd.org  Fri Aug  2 15:19:11 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B17E7B5614;
 Fri,  2 Aug 2019 15:19:11 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460W674FScz4B5g;
 Fri,  2 Aug 2019 15:19:11 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73CCF4903;
 Fri,  2 Aug 2019 15:19:11 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72FJB9x026718;
 Fri, 2 Aug 2019 15:19:11 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72FJBGw026717;
 Fri, 2 Aug 2019 15:19:11 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908021519.x72FJBGw026717@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Fri, 2 Aug 2019 15:19:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350538 - head/sys/dev/mlx5/mlx5_en
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en
X-SVN-Commit-Revision: 350538
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 15:19:11 -0000

Author: markj
Date: Fri Aug  2 15:19:11 2019
New Revision: 350538
URL: https://svnweb.freebsd.org/changeset/base/350538

Log:
  Fix warnings about unused identifiers when compiling without RATELIMIT.

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Fri Aug  2 11:17:07 2019	(r350537)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Fri Aug  2 15:19:11 2019	(r350538)
@@ -4070,6 +4070,7 @@ mlx5e_snd_tag_query(struct m_snd_tag *pmt, union if_sn
 	}
 }
 
+#ifdef RATELIMIT
 #define NUM_HDWR_RATES_MLX 13
 static const uint64_t adapter_rates_mlx[NUM_HDWR_RATES_MLX] = {
 	135375,			/* 1,083,000 */
@@ -4111,6 +4112,7 @@ mlx5e_ratelimit_query(struct ifnet *ifp __unused, stru
 	q->number_of_rates = NUM_HDWR_RATES_MLX;
 	q->min_segment_burst = 1;
 }
+#endif
 
 static void
 mlx5e_snd_tag_free(struct m_snd_tag *pmt)

From owner-svn-src-head@freebsd.org  Fri Aug  2 18:01:48 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 444DEB80F9;
 Fri,  2 Aug 2019 18:01:48 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460Zjm187Cz4JpN;
 Fri,  2 Aug 2019 18:01:48 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A89265E7;
 Fri,  2 Aug 2019 18:01:48 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72I1lbe023740;
 Fri, 2 Aug 2019 18:01:47 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72I1lLA023737;
 Fri, 2 Aug 2019 18:01:47 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908021801.x72I1lLA023737@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Fri, 2 Aug 2019 18:01:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350540 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350540
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 18:01:48 -0000

Author: markj
Date: Fri Aug  2 18:01:47 2019
New Revision: 350540
URL: https://svnweb.freebsd.org/changeset/base/350540

Log:
  Only check the blessings table for known LORs.
  
  Previously we would check for blessings before marking a given lock
  pair as reversed, so each "reversed" lock acquisition would require
  a linear scan of the table.  Instead, check the table after marking
  the pair as reversed but before generating a report.
  
  Reviewed by:	jhb
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21135

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Fri Aug  2 16:05:36 2019	(r350539)
+++ head/sys/kern/subr_witness.c	Fri Aug  2 18:01:47 2019	(r350540)
@@ -1344,14 +1344,6 @@ witness_checkorder(struct lock_object *lock, int flags
 			 * is allowed or has already been yelled about.
 			 */
 
-			/*
-			 * If the lock order is blessed, just bail.  We don't
-			 * look for other lock order violations though, which
-			 * may be a bug.
-			 */
-			if (blessed(w, w1))
-				goto out;
-
 			/* Bail if this violation is known */
 			if (w_rmatrix[w1->w_index][w->w_index] & WITNESS_REVERSAL)
 				goto out;
@@ -1361,6 +1353,14 @@ witness_checkorder(struct lock_object *lock, int flags
 			w_rmatrix[w->w_index][w1->w_index] |= WITNESS_REVERSAL;
 			w->w_reversed = w1->w_reversed = 1;
 			witness_increment_graph_generation();
+
+			/*
+			 * If the lock order is blessed, bail before logging
+			 * anything.  We don't look for other lock order
+			 * violations though, which may be a bug.
+			 */
+			if (blessed(w, w1))
+				goto out;
 			mtx_unlock_spin(&w_mtx);
 
 #ifdef WITNESS_NO_VNODE
@@ -2650,6 +2650,9 @@ restart:
 				    &tmp_data2->wlod_stack);
 			}
 			mtx_unlock_spin(&w_mtx);
+
+			if (blessed(tmp_w1, tmp_w2))
+				continue;
 
 			sbuf_printf(sb,
 	    "\nLock order reversal between \"%s\"(%s) and \"%s\"(%s)!\n",

From owner-svn-src-head@freebsd.org  Fri Aug  2 20:16:23 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 257D4BA6FC;
 Fri,  2 Aug 2019 20:16:23 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460dj30sz5z4Rvd;
 Fri,  2 Aug 2019 20:16:23 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F38007E81;
 Fri,  2 Aug 2019 20:16:22 +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 x72KGMAc005588;
 Fri, 2 Aug 2019 20:16:22 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72KGL6S005582;
 Fri, 2 Aug 2019 20:16:21 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908022016.x72KGL6S005582@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 2 Aug 2019 20:16:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350541 - in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: in head: sbin/nvmecontrol sys/dev/nvme
X-SVN-Commit-Revision: 350541
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 20:16:23 -0000

Author: mav
Date: Fri Aug  2 20:16:21 2019
New Revision: 350541
URL: https://svnweb.freebsd.org/changeset/base/350541

Log:
  Decode few more NVMe log pages.
  
  In particular: Changed Namespace List, Commands Supported and Effects,
  Reservation Notification, Sanitize Status.
  
  Add few new arguments to `nvmecontrol log` subcommand.
  
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sbin/nvmecontrol/firmware.c
  head/sbin/nvmecontrol/logpage.c
  head/sbin/nvmecontrol/nvmecontrol.8
  head/sbin/nvmecontrol/nvmecontrol.h
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sbin/nvmecontrol/firmware.c
==============================================================================
--- head/sbin/nvmecontrol/firmware.c	Fri Aug  2 18:01:47 2019	(r350540)
+++ head/sbin/nvmecontrol/firmware.c	Fri Aug  2 20:16:21 2019	(r350541)
@@ -104,7 +104,7 @@ slot_has_valid_firmware(int fd, int slot)
 	int				has_fw = false;
 
 	read_logpage(fd, NVME_LOG_FIRMWARE_SLOT,
-	    NVME_GLOBAL_NAMESPACE_TAG, &fw, sizeof(fw));
+	    NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, &fw, sizeof(fw));
 
 	if (fw.revision[slot-1] != 0LLU)
 		has_fw = true;

Modified: head/sbin/nvmecontrol/logpage.c
==============================================================================
--- head/sbin/nvmecontrol/logpage.c	Fri Aug  2 18:01:47 2019	(r350540)
+++ head/sbin/nvmecontrol/logpage.c	Fri Aug  2 20:16:21 2019	(r350541)
@@ -6,6 +6,7 @@
  *
  * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
+ * Copyright (C) 2018-2019 Alexander Motin <mav@FreeBSD.org>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -57,12 +58,18 @@ static struct options {
 	bool		binary;
 	bool		hex;
 	uint32_t	page;
+	uint8_t		lsp;
+	uint16_t	lsi;
+	bool		rae;
 	const char	*vendor;
 	const char	*dev;
 } opt = {
 	.binary = false,
 	.hex = false,
 	.page = NONE,
+	.lsp = 0,
+	.lsi = 0,
+	.rae = false,
 	.vendor = NULL,
 	.dev = NULL,
 };
@@ -75,6 +82,12 @@ static const struct opts logpage_opts[] = {
 	    "Dump the log page as hex"),
 	OPT("page", 'p', arg_uint32, opt, page,
 	    "Page to dump"),
+	OPT("lsp", 'f', arg_uint8, opt, lsp,
+	    "Log Specific Field"),
+	OPT("lsi", 'i', arg_uint16, opt, lsp,
+	    "Log Specific Identifier"),
+	OPT("rae", 'r', arg_none, opt, rae,
+	    "Retain Asynchronous Event"),
 	OPT("vendor", 'v', arg_string, opt, vendor,
 	    "Vendor specific formatting"),
 	{ NULL, 0, arg_none, NULL, NULL }
@@ -103,11 +116,38 @@ CMD_COMMAND(logpage_cmd);
 
 static SLIST_HEAD(,logpage_function) logpages;
 
+static int
+logpage_compare(struct logpage_function *a, struct logpage_function *b)
+{
+	int c;
+
+	if ((a->vendor == NULL) != (b->vendor == NULL))
+		return (a->vendor == NULL ? -1 : 1);
+	if (a->vendor != NULL) {
+		c = strcmp(a->vendor, b->vendor);
+		if (c != 0)
+			return (c);
+	}
+	return ((int)a->log_page - (int)b->log_page);
+}
+
 void
 logpage_register(struct logpage_function *p)
 {
+	struct logpage_function *l, *a;
 
-        SLIST_INSERT_HEAD(&logpages, p, link);
+	a = NULL;
+	l = SLIST_FIRST(&logpages);
+	while (l != NULL) {
+		if (logpage_compare(l, p) > 0)
+			break;
+		a = l;
+		l = SLIST_NEXT(l, link);
+	}
+	if (a == NULL)
+		SLIST_INSERT_HEAD(&logpages, p, link);
+	else
+		SLIST_INSERT_AFTER(a, p, link);
 }
 
 const char *
@@ -150,19 +190,28 @@ get_log_buffer(uint32_t size)
 }
 
 void
-read_logpage(int fd, uint8_t log_page, uint32_t nsid, void *payload,
-    uint32_t payload_size)
+read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp,
+    uint16_t lsi, uint8_t rae, void *payload, uint32_t payload_size)
 {
 	struct nvme_pt_command	pt;
 	struct nvme_error_information_entry	*err_entry;
-	int i, err_pages;
+	u_int i, err_pages, numd;
 
+	numd = payload_size / sizeof(uint32_t) - 1;
 	memset(&pt, 0, sizeof(pt));
 	pt.cmd.opc = NVME_OPC_GET_LOG_PAGE;
 	pt.cmd.nsid = htole32(nsid);
-	pt.cmd.cdw10 = ((payload_size/sizeof(uint32_t)) - 1) << 16;
-	pt.cmd.cdw10 |= log_page;
-	pt.cmd.cdw10 = htole32(pt.cmd.cdw10);
+	pt.cmd.cdw10 = htole32(
+	    (numd << 16) |			/* NUMDL */
+	    (rae << 15) |			/* RAE */
+	    (lsp << 8) |			/* LSP */
+	    log_page);				/* LID */
+	pt.cmd.cdw11 = htole32(
+	    ((uint32_t)lsi << 16) |		/* LSI */
+	    (numd >> 16));			/* NUMDU */
+	pt.cmd.cdw12 = 0;			/* LPOL */
+	pt.cmd.cdw13 = 0;			/* LPOU */
+	pt.cmd.cdw14 = 0;			/* UUID Index */
 	pt.buf = payload;
 	pt.len = payload_size;
 	pt.is_read = 1;
@@ -186,6 +235,21 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, 
 		nvme_firmware_page_swapbytes(
 		    (struct nvme_firmware_page *)payload);
 		break;
+	case NVME_LOG_CHANGED_NAMESPACE:
+		nvme_ns_list_swapbytes((struct nvme_ns_list *)payload);
+		break;
+	case NVME_LOG_COMMAND_EFFECT:
+		nvme_command_effects_page_swapbytes(
+		    (struct nvme_command_effects_page *)payload);
+		break;
+	case NVME_LOG_RES_NOTIFICATION:
+		nvme_res_notification_page_swapbytes(
+		    (struct nvme_res_notification_page *)payload);
+		break;
+	case NVME_LOG_SANITIZE_STATUS:
+		nvme_sanitize_status_page_swapbytes(
+		    (struct nvme_sanitize_status_page *)payload);
+		break;
 	case INTEL_LOG_TEMP_STATS:
 		intel_log_temp_stats_swapbytes(
 		    (struct intel_log_temp_stats *)payload);
@@ -369,6 +433,160 @@ print_log_firmware(const struct nvme_controller_data *
 	}
 }
 
+static void
+print_log_ns(const struct nvme_controller_data *cdata __unused, void *buf,
+    uint32_t size __unused)
+{
+	struct nvme_ns_list *nsl;
+	u_int i;
+
+	nsl = (struct nvme_ns_list *)buf;
+	printf("Changed Namespace List\n");
+	printf("======================\n");
+
+	for (i = 0; i < nitems(nsl->ns) && nsl->ns[i] != 0; i++) {
+		printf("%08x\n", nsl->ns[i]);
+	}
+}
+
+static void
+print_log_command_effects(const struct nvme_controller_data *cdata __unused,
+    void *buf, uint32_t size __unused)
+{
+	struct nvme_command_effects_page *ce;
+	u_int i;
+	uint32_t s;
+
+	ce = (struct nvme_command_effects_page *)buf;
+	printf("Commands Supported and Effects\n");
+	printf("==============================\n");
+	printf("  Command\tLBCC\tNCC\tNIC\tCCC\tCSE\tUUID\n");
+
+	for (i = 0; i < 255; i++) {
+		s = ce->acs[i];
+		if (((s >> NVME_CE_PAGE_CSUP_SHIFT) &
+		     NVME_CE_PAGE_CSUP_MASK) == 0)
+			continue;
+		printf("Admin\t%02x\t%s\t%s\t%s\t%s\t%u\t%s\n", i,
+		    ((s >> NVME_CE_PAGE_LBCC_SHIFT) &
+		     NVME_CE_PAGE_LBCC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_NCC_SHIFT) &
+		     NVME_CE_PAGE_NCC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_NIC_SHIFT) &
+		     NVME_CE_PAGE_NIC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_CCC_SHIFT) &
+		     NVME_CE_PAGE_CCC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_CSE_SHIFT) &
+		     NVME_CE_PAGE_CSE_MASK),
+		    ((s >> NVME_CE_PAGE_UUID_SHIFT) &
+		     NVME_CE_PAGE_UUID_MASK) ? "Yes" : "No");
+	}
+	for (i = 0; i < 255; i++) {
+		s = ce->iocs[i];
+		if (((s >> NVME_CE_PAGE_CSUP_SHIFT) &
+		     NVME_CE_PAGE_CSUP_MASK) == 0)
+			continue;
+		printf("I/O\t%02x\t%s\t%s\t%s\t%s\t%u\t%s\n", i,
+		    ((s >> NVME_CE_PAGE_LBCC_SHIFT) &
+		     NVME_CE_PAGE_LBCC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_NCC_SHIFT) &
+		     NVME_CE_PAGE_NCC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_NIC_SHIFT) &
+		     NVME_CE_PAGE_NIC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_CCC_SHIFT) &
+		     NVME_CE_PAGE_CCC_MASK) ? "Yes" : "No",
+		    ((s >> NVME_CE_PAGE_CSE_SHIFT) &
+		     NVME_CE_PAGE_CSE_MASK),
+		    ((s >> NVME_CE_PAGE_UUID_SHIFT) &
+		     NVME_CE_PAGE_UUID_MASK) ? "Yes" : "No");
+	}
+}
+
+static void
+print_log_res_notification(const struct nvme_controller_data *cdata __unused,
+    void *buf, uint32_t size __unused)
+{
+	struct nvme_res_notification_page *rn;
+
+	rn = (struct nvme_res_notification_page *)buf;
+	printf("Reservation Notification\n");
+	printf("========================\n");
+
+	printf("Log Page Count:                %ju\n", rn->log_page_count);
+	printf("Log Page Type:                 ");
+	switch (rn->log_page_type) {
+	case 0:
+		printf("Empty Log Page\n");
+		break;
+	case 1:
+		printf("Registration Preempted\n");
+		break;
+	case 2:
+		printf("Reservation Released\n");
+		break;
+	case 3:
+		printf("Reservation Preempted\n");
+		break;
+	default:
+		printf("Unknown %x\n", rn->log_page_type);
+		break;
+	};
+	printf("Number of Available Log Pages: %d\n", rn->available_log_pages);
+	printf("Namespace ID:                  0x%x\n", rn->nsid);
+}
+
+static void
+print_log_sanitize_status(const struct nvme_controller_data *cdata __unused,
+    void *buf, uint32_t size __unused)
+{
+	struct nvme_sanitize_status_page *ss;
+	u_int p;
+
+	ss = (struct nvme_sanitize_status_page *)buf;
+	printf("Sanitize Status\n");
+	printf("===============\n");
+
+	printf("Sanitize Progress:                   %u%% (%u/65535)\n",
+	    (ss->sprog * 100 + 32768) / 65536, ss->sprog);
+	printf("Sanitize Status:                     ");
+	switch ((ss->sstat >> NVME_SS_PAGE_SSTAT_STATUS_SHIFT) &
+	    NVME_SS_PAGE_SSTAT_STATUS_MASK) {
+	case NVME_SS_PAGE_SSTAT_STATUS_NEVER:
+		printf("Never sanitized");
+		break;
+	case NVME_SS_PAGE_SSTAT_STATUS_COMPLETED:
+		printf("Completed");
+		break;
+	case NVME_SS_PAGE_SSTAT_STATUS_INPROG:
+		printf("In Progress");
+		break;
+	case NVME_SS_PAGE_SSTAT_STATUS_FAILED:
+		printf("Failed");
+		break;
+	case NVME_SS_PAGE_SSTAT_STATUS_COMPLETEDWD:
+		printf("Completed with deallocation");
+		break;
+	default:
+		printf("Unknown");
+		break;
+	}
+	p = (ss->sstat & NVME_SS_PAGE_SSTAT_PASSES_SHIFT) >>
+	    NVME_SS_PAGE_SSTAT_PASSES_MASK;
+	if (p > 0)
+		printf(", %d passes", p);
+	if ((ss->sstat & NVME_SS_PAGE_SSTAT_GDE_SHIFT) >>
+	    NVME_SS_PAGE_SSTAT_GDE_MASK)
+		printf(", Global Data Erased");
+	printf("\n");
+	printf("Sanitize Command Dword 10:           0x%x\n", ss->scdw10);
+	printf("Time For Overwrite:                  %u sec\n", ss->etfo);
+	printf("Time For Block Erase:                %u sec\n", ss->etfbe);
+	printf("Time For Crypto Erase:               %u sec\n", ss->etfce);
+	printf("Time For Overwrite No-Deallocate:    %u sec\n", ss->etfownd);
+	printf("Time For Block Erase No-Deallocate:  %u sec\n", ss->etfbewnd);
+	printf("Time For Crypto Erase No-Deallocate: %u sec\n", ss->etfcewnd);
+}
+
 /*
  * Table of log page printer / sizing.
  *
@@ -384,6 +602,48 @@ NVME_LOGPAGE(health,
 NVME_LOGPAGE(fw,
     NVME_LOG_FIRMWARE_SLOT,		NULL,	"Firmware Information",
     print_log_firmware,			sizeof(struct nvme_firmware_page));
+NVME_LOGPAGE(ns,
+    NVME_LOG_CHANGED_NAMESPACE,		NULL,	"Changed Namespace List",
+    print_log_ns,			sizeof(struct nvme_ns_list));
+NVME_LOGPAGE(ce,
+    NVME_LOG_COMMAND_EFFECT,		NULL,	"Commands Supported and Effects",
+    print_log_command_effects,		sizeof(struct nvme_command_effects_page));
+NVME_LOGPAGE(dst,
+    NVME_LOG_DEVICE_SELF_TEST,		NULL,	"Device Self-test",
+    NULL,				564);
+NVME_LOGPAGE(thi,
+    NVME_LOG_TELEMETRY_HOST_INITIATED,	NULL,	"Telemetry Host-Initiated",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(tci,
+    NVME_LOG_TELEMETRY_CONTROLLER_INITIATED,	NULL,	"Telemetry Controller-Initiated",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(egi,
+    NVME_LOG_ENDURANCE_GROUP_INFORMATION,	NULL,	"Endurance Group Information",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(plpns,
+    NVME_LOG_PREDICTABLE_LATENCY_PER_NVM_SET,	NULL,	"Predictable Latency Per NVM Set",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(ple,
+    NVME_LOG_PREDICTABLE_LATENCY_EVENT_AGGREGATE,	NULL,	"Predictable Latency Event Aggregate",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(ana,
+    NVME_LOG_ASYMMETRIC_NAMESPAVE_ACCESS,	NULL,	"Asymmetric Namespace Access",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(pel,
+    NVME_LOG_PERSISTENT_EVENT_LOG,	NULL,	"Persistent Event Log",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(lbasi,
+    NVME_LOG_LBA_STATUS_INFORMATION,	NULL,	"LBA Status Information",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(egea,
+    NVME_LOG_ENDURANCE_GROUP_EVENT_AGGREGATE,	NULL,	"Endurance Group Event Aggregate",
+    NULL,				DEFAULT_SIZE);
+NVME_LOGPAGE(res_notification,
+    NVME_LOG_RES_NOTIFICATION,		NULL,	"Reservation Notification",
+    print_log_res_notification,		sizeof(struct nvme_res_notification_page));
+NVME_LOGPAGE(sanitize_status,
+    NVME_LOG_SANITIZE_STATUS,		NULL,	"Sanitize Status",
+    print_log_sanitize_status,		sizeof(struct nvme_sanitize_status_page));
 
 static void
 logpage_help(void)
@@ -475,7 +735,8 @@ logpage(const struct cmd *f, int argc, char *argv[])
 				continue;
 			if (opt.page != lpf->log_page)
 				continue;
-			print_fn = lpf->print_fn;
+			if (lpf->print_fn != NULL)
+				print_fn = lpf->print_fn;
 			size = lpf->size;
 			break;
 		}
@@ -488,7 +749,7 @@ logpage(const struct cmd *f, int argc, char *argv[])
 
 	/* Read the log page */
 	buf = get_log_buffer(size);
-	read_logpage(fd, opt.page, nsid, buf, size);
+	read_logpage(fd, opt.page, nsid, opt.lsp, opt.lsi, opt.rae, buf, size);
 	print_fn(&cdata, buf, size);
 
 	close(fd);

Modified: head/sbin/nvmecontrol/nvmecontrol.8
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.8	Fri Aug  2 18:01:47 2019	(r350540)
+++ head/sbin/nvmecontrol/nvmecontrol.8	Fri Aug  2 20:16:21 2019	(r350541)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 1, 2019
+.Dd August 2, 2019
 .Dt NVMECONTROL 8
 .Os
 .Sh NAME
@@ -66,6 +66,9 @@
 .Op Fl x
 .Op Fl v Ar vendor-string
 .Op Fl b
+.Op Fl f Ar LSP
+.Op Fl i Ar LSI
+.Op Fl r
 .Aq device id
 .Aq namespace id
 .Nm
@@ -172,6 +175,14 @@ Drive Error Log
 Health/SMART Data
 .It Dv Page 0x03
 Firmware Information
+.It Dv Page 0x04
+Changed Namespace List
+.It Dv Page 0x05
+Commands Supported and Effects
+.It Dv Page 0x80
+Reservation Notification
+.It Dv Page 0x81
+Sanitize Status
 .It Dv Page 0xc1
 Advanced SMART information (WDC/HGST)
 .It Dv Page 0xc1
@@ -185,13 +196,19 @@ Advanced SMART information (Intel)
 .El
 .Pp
 Specifying
-.Fl p
+.Fl v
 .Ic help
 will list all valid vendors and pages.
 .Fl x
 will print the page as hex.
 .Fl b
 will print the binary data for the page.
+.Fl s
+will set Log Specific Field.
+.Fl i
+will set Log Specific Identifier.
+.Fl r
+will set Retain Asynchronous Event.
 .Ss ns
 Various namespace management commands.
 If namespace management is supported by device, allow list, create and delete

Modified: head/sbin/nvmecontrol/nvmecontrol.h
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.h	Fri Aug  2 18:01:47 2019	(r350540)
+++ head/sbin/nvmecontrol/nvmecontrol.h	Fri Aug  2 20:16:21 2019	(r350541)
@@ -74,8 +74,8 @@ void read_controller_data(int fd, struct nvme_controll
 void read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdata);
 void print_hex(void *data, uint32_t length);
 void print_namespace(struct nvme_namespace_data *nsdata);
-void read_logpage(int fd, uint8_t log_page, uint32_t nsid, void *payload,
-    uint32_t payload_size);
+void read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp,
+    uint16_t lsi, uint8_t rae, void *payload, uint32_t payload_size);
 void print_temp(uint16_t t);
 void print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused);
 

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h	Fri Aug  2 18:01:47 2019	(r350540)
+++ head/sys/dev/nvme/nvme.h	Fri Aug  2 20:16:21 2019	(r350541)
@@ -445,6 +445,35 @@ enum nvme_critical_warning_state {
 #define NVME_FIRMWARE_PAGE_AFI_SLOT_SHIFT		(0)
 #define NVME_FIRMWARE_PAGE_AFI_SLOT_MASK		(0x7)
 
+/* Commands Supported and Effects */
+#define	NVME_CE_PAGE_CSUP_SHIFT				(0)
+#define	NVME_CE_PAGE_CSUP_MASK				(0x1)
+#define	NVME_CE_PAGE_LBCC_SHIFT				(1)
+#define	NVME_CE_PAGE_LBCC_MASK				(0x1)
+#define	NVME_CE_PAGE_NCC_SHIFT				(2)
+#define	NVME_CE_PAGE_NCC_MASK				(0x1)
+#define	NVME_CE_PAGE_NIC_SHIFT				(3)
+#define	NVME_CE_PAGE_NIC_MASK				(0x1)
+#define	NVME_CE_PAGE_CCC_SHIFT				(4)
+#define	NVME_CE_PAGE_CCC_MASK				(0x1)
+#define	NVME_CE_PAGE_CSE_SHIFT				(16)
+#define	NVME_CE_PAGE_CSE_MASK				(0x7)
+#define	NVME_CE_PAGE_UUID_SHIFT				(19)
+#define	NVME_CE_PAGE_UUID_MASK				(0x1)
+
+/* Sanitize Status */
+#define	NVME_SS_PAGE_SSTAT_STATUS_SHIFT			(0)
+#define	NVME_SS_PAGE_SSTAT_STATUS_MASK			(0x7)
+#define	NVME_SS_PAGE_SSTAT_STATUS_NEVER			(0)
+#define	NVME_SS_PAGE_SSTAT_STATUS_COMPLETED		(1)
+#define	NVME_SS_PAGE_SSTAT_STATUS_INPROG		(2)
+#define	NVME_SS_PAGE_SSTAT_STATUS_FAILED		(3)
+#define	NVME_SS_PAGE_SSTAT_STATUS_COMPLETEDWD		(4)
+#define	NVME_SS_PAGE_SSTAT_PASSES_SHIFT			(3)
+#define	NVME_SS_PAGE_SSTAT_PASSES_MASK			(0x1f)
+#define	NVME_SS_PAGE_SSTAT_GDE_SHIFT			(8)
+#define	NVME_SS_PAGE_SSTAT_GDE_MASK			(0x1)
+
 /* CC register SHN field values */
 enum shn_value {
 	NVME_SHN_NORMAL		= 0x1,
@@ -1291,6 +1320,43 @@ struct nvme_ns_list {
 
 _Static_assert(sizeof(struct nvme_ns_list) == 4096, "bad size for nvme_ns_list");
 
+struct nvme_command_effects_page {
+	uint32_t		acs[256];
+	uint32_t		iocs[256];
+	uint8_t			reserved[2048];
+} __packed __aligned(4);
+
+_Static_assert(sizeof(struct nvme_command_effects_page) == 4096,
+    "bad size for nvme_command_effects_page");
+
+struct nvme_res_notification_page {
+	uint64_t		log_page_count;
+	uint8_t			log_page_type;
+	uint8_t			available_log_pages;
+	uint8_t			reserved2;
+	uint32_t		nsid;
+	uint8_t			reserved[48];
+} __packed __aligned(4);
+
+_Static_assert(sizeof(struct nvme_res_notification_page) == 64,
+    "bad size for nvme_res_notification_page");
+
+struct nvme_sanitize_status_page {
+	uint16_t		sprog;
+	uint16_t		sstat;
+	uint32_t		scdw10;
+	uint32_t		etfo;
+	uint32_t		etfbe;
+	uint32_t		etfce;
+	uint32_t		etfownd;
+	uint32_t		etfbewnd;
+	uint32_t		etfcewnd;
+	uint8_t			reserved[480];
+} __packed __aligned(4);
+
+_Static_assert(sizeof(struct nvme_sanitize_status_page) == 512,
+    "bad size for nvme_sanitize_status_page");
+
 struct intel_log_temp_stats
 {
 	uint64_t	current;
@@ -1717,6 +1783,38 @@ void	nvme_ns_list_swapbytes(struct nvme_ns_list *s)
 
 	for (i = 0; i < 1024; i++)
 		s->ns[i] = le32toh(s->ns[i]);
+}
+
+static inline
+void	nvme_command_effects_page_swapbytes(struct nvme_command_effects_page *s)
+{
+	int i;
+
+	for (i = 0; i < 256; i++)
+		s->acs[i] = le32toh(s->acs[i]);
+	for (i = 0; i < 256; i++)
+		s->iocs[i] = le32toh(s->iocs[i]);
+}
+
+static inline
+void	nvme_res_notification_page_swapbytes(struct nvme_res_notification_page *s)
+{
+	s->log_page_count = le64toh(s->log_page_count);
+	s->nsid = le32toh(s->nsid);
+}
+
+static inline
+void	nvme_sanitize_status_page_swapbytes(struct nvme_sanitize_status_page *s)
+{
+	s->sprog = le16toh(s->sprog);
+	s->sstat = le16toh(s->sstat);
+	s->scdw10 = le32toh(s->scdw10);
+	s->etfo = le32toh(s->etfo);
+	s->etfbe = le32toh(s->etfbe);
+	s->etfce = le32toh(s->etfce);
+	s->etfownd = le32toh(s->etfownd);
+	s->etfbewnd = le32toh(s->etfbewnd);
+	s->etfcewnd = le32toh(s->etfcewnd);
 }
 
 static inline

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Fri Aug  2 18:01:47 2019	(r350540)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Fri Aug  2 20:16:21 2019	(r350541)
@@ -570,6 +570,9 @@ is_log_page_id_valid(uint8_t page_id)
 	case NVME_LOG_HEALTH_INFORMATION:
 	case NVME_LOG_FIRMWARE_SLOT:
 	case NVME_LOG_CHANGED_NAMESPACE:
+	case NVME_LOG_COMMAND_EFFECT:
+	case NVME_LOG_RES_NOTIFICATION:
+	case NVME_LOG_SANITIZE_STATUS:
 		return (TRUE);
 	}
 
@@ -596,6 +599,15 @@ nvme_ctrlr_get_log_page_size(struct nvme_controller *c
 	case NVME_LOG_CHANGED_NAMESPACE:
 		log_page_size = sizeof(struct nvme_ns_list);
 		break;
+	case NVME_LOG_COMMAND_EFFECT:
+		log_page_size = sizeof(struct nvme_command_effects_page);
+		break;
+	case NVME_LOG_RES_NOTIFICATION:
+		log_page_size = sizeof(struct nvme_res_notification_page);
+		break;
+	case NVME_LOG_SANITIZE_STATUS:
+		log_page_size = sizeof(struct nvme_sanitize_status_page);
+		break;
 	default:
 		log_page_size = 0;
 		break;
@@ -665,6 +677,18 @@ nvme_ctrlr_async_event_log_page_cb(void *arg, const st
 		case NVME_LOG_CHANGED_NAMESPACE:
 			nvme_ns_list_swapbytes(
 			    (struct nvme_ns_list *)aer->log_page_buffer);
+			break;
+		case NVME_LOG_COMMAND_EFFECT:
+			nvme_command_effects_page_swapbytes(
+			    (struct nvme_command_effects_page *)aer->log_page_buffer);
+			break;
+		case NVME_LOG_RES_NOTIFICATION:
+			nvme_res_notification_page_swapbytes(
+			    (struct nvme_res_notification_page *)aer->log_page_buffer);
+			break;
+		case NVME_LOG_SANITIZE_STATUS:
+			nvme_sanitize_status_page_swapbytes(
+			    (struct nvme_sanitize_status_page *)aer->log_page_buffer);
 			break;
 		case INTEL_LOG_TEMP_STATS:
 			intel_log_temp_stats_swapbytes(

From owner-svn-src-head@freebsd.org  Fri Aug  2 22:09:57 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81FC3BD09C;
 Fri,  2 Aug 2019 22:09:57 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460hD52ryHz4YfX;
 Fri,  2 Aug 2019 22:09:57 +0000 (UTC)
 (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4364291DC;
 Fri,  2 Aug 2019 22:09:57 +0000 (UTC)
 (envelope-from markj@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72M9vMT070950;
 Fri, 2 Aug 2019 22:09:57 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72M9vlg070949;
 Fri, 2 Aug 2019 22:09:57 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201908022209.x72M9vlg070949@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Fri, 2 Aug 2019 22:09:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350544 - head/usr.bin/bzip2recover
X-SVN-Group: head
X-SVN-Commit-Author: markj
X-SVN-Commit-Paths: head/usr.bin/bzip2recover
X-SVN-Commit-Revision: 350544
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 22:09:57 -0000

Author: markj
Date: Fri Aug  2 22:09:56 2019
New Revision: 350544
URL: https://svnweb.freebsd.org/changeset/base/350544

Log:
  Add bzip2recover.1.
  
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/bzip2recover/Makefile

Modified: head/usr.bin/bzip2recover/Makefile
==============================================================================
--- head/usr.bin/bzip2recover/Makefile	Fri Aug  2 20:31:02 2019	(r350543)
+++ head/usr.bin/bzip2recover/Makefile	Fri Aug  2 22:09:56 2019	(r350544)
@@ -6,6 +6,8 @@ BZ2DIR=	${SRCTOP}/contrib/bzip2
 PROG=	bzip2recover
 MAN=
 
+MLINKS+=bzip2.1 bzip2recover.1
+
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
 .include <bsd.prog.mk>

From owner-svn-src-head@freebsd.org  Fri Aug  2 22:36:43 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D16CBD998;
 Fri,  2 Aug 2019 22:36:43 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460hpz2Db1z4bCS;
 Fri,  2 Aug 2019 22:36:43 +0000 (UTC) (envelope-from alc@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FC699749;
 Fri,  2 Aug 2019 22:36:43 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72Mahw1088888;
 Fri, 2 Aug 2019 22:36:43 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72Mah3F088887;
 Fri, 2 Aug 2019 22:36:43 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201908022236.x72Mah3F088887@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox <alc@FreeBSD.org>
Date: Fri, 2 Aug 2019 22:36:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350546 - head/sys/arm64/arm64
X-SVN-Group: head
X-SVN-Commit-Author: alc
X-SVN-Commit-Paths: head/sys/arm64/arm64
X-SVN-Commit-Revision: 350546
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 22:36:43 -0000

Author: alc
Date: Fri Aug  2 22:36:42 2019
New Revision: 350546
URL: https://svnweb.freebsd.org/changeset/base/350546

Log:
  Because of AArch64's weak memory consistency model, we need to include a
  memory barrier between the stores for initializing a page table page and
  the store for adding that page to the page table.  Otherwise, a page table
  walk by another processor's MMU could see the page table page before it
  sees the initialized entries.
  
  Simplify pmap_growkernel().  In particular, eliminate an unnecessary TLB
  invalidation.
  
  Reviewed by:	andrew, markj
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D21126

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Fri Aug  2 22:33:43 2019	(r350545)
+++ head/sys/arm64/arm64/pmap.c	Fri Aug  2 22:36:42 2019	(r350546)
@@ -1525,6 +1525,16 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str
 		pmap_zero_page(m);
 
 	/*
+	 * Because of AArch64's weak memory consistency model, we must have a
+	 * barrier here to ensure that the stores for zeroing "m", whether by
+	 * pmap_zero_page() or an earlier function, are visible before adding
+	 * "m" to the page table.  Otherwise, a page table walk by another
+	 * processor's MMU could see the mapping to "m" and a stale, non-zero
+	 * PTE within "m".
+	 */
+	dmb(ishst);
+
+	/*
 	 * Map the pagetable page into the process address space, if
 	 * it isn't already there.
 	 */
@@ -1775,12 +1785,14 @@ pmap_growkernel(vm_offset_t addr)
 				panic("pmap_growkernel: no memory to grow kernel");
 			if ((nkpg->flags & PG_ZERO) == 0)
 				pmap_zero_page(nkpg);
+			/* See the dmb() in _pmap_alloc_l3(). */
+			dmb(ishst);
 			paddr = VM_PAGE_TO_PHYS(nkpg);
 			pmap_store(l1, paddr | L1_TABLE);
 			continue; /* try again */
 		}
 		l2 = pmap_l1_to_l2(l1, kernel_vm_end);
-		if ((pmap_load(l2) & ATTR_AF) != 0) {
+		if (pmap_load(l2) != 0) {
 			kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET;
 			if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) {
 				kernel_vm_end = vm_map_max(kernel_map);
@@ -1796,9 +1808,10 @@ pmap_growkernel(vm_offset_t addr)
 			panic("pmap_growkernel: no memory to grow kernel");
 		if ((nkpg->flags & PG_ZERO) == 0)
 			pmap_zero_page(nkpg);
+		/* See the dmb() in _pmap_alloc_l3(). */
+		dmb(ishst);
 		paddr = VM_PAGE_TO_PHYS(nkpg);
-		pmap_load_store(l2, paddr | L2_TABLE);
-		pmap_invalidate_page(kernel_pmap, kernel_vm_end);
+		pmap_store(l2, paddr | L2_TABLE);
 
 		kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET;
 		if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) {
@@ -5531,6 +5544,10 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_
 	/*
 	 * If the page table page is not leftover from an earlier promotion,
 	 * or the mapping attributes have changed, (re)initialize the L3 table.
+	 *
+	 * When pmap_update_entry() clears the old L2 mapping, it (indirectly)
+	 * performs a dsb().  That dsb() ensures that the stores for filling
+	 * "l3" are visible before "l3" is added to the page table.
 	 */
 	if (ml3->valid == 0 || (l3[0] & ATTR_MASK) != (newl3 & ATTR_MASK))
 		pmap_fill_l3(l3, newl3);

From owner-svn-src-head@freebsd.org  Fri Aug  2 22:43:10 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79F0DBDC5E;
 Fri,  2 Aug 2019 22:43:10 +0000 (UTC)
 (envelope-from delphij@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460hyQ2fWMz4bhs;
 Fri,  2 Aug 2019 22:43:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C8599926;
 Fri,  2 Aug 2019 22:43:10 +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 x72MhAqj094906;
 Fri, 2 Aug 2019 22:43:10 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72Mh9ZS094904;
 Fri, 2 Aug 2019 22:43:09 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201908022243.x72Mh9ZS094904@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI <delphij@FreeBSD.org>
Date: Fri, 2 Aug 2019 22:43:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350547 - head/sys/netinet
X-SVN-Group: head
X-SVN-Commit-Author: delphij
X-SVN-Commit-Paths: head/sys/netinet
X-SVN-Commit-Revision: 350547
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 22:43:10 -0000

Author: delphij
Date: Fri Aug  2 22:43:09 2019
New Revision: 350547
URL: https://svnweb.freebsd.org/changeset/base/350547

Log:
  Fix !INET build.

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet/tcp_ratelimit.c

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Fri Aug  2 22:36:42 2019	(r350546)
+++ head/sys/netinet/in_pcb.c	Fri Aug  2 22:43:09 2019	(r350547)
@@ -3296,11 +3296,13 @@ in_pcbattach_txrtlmt(struct inpcb *inp, struct ifnet *
 	} else {
 		error = ifp->if_snd_tag_alloc(ifp, &params, &inp->inp_snd_tag);
 
+#ifdef INET
 		if (error == 0) {
 			counter_u64_add(rate_limit_set_ok, 1);
 			counter_u64_add(rate_limit_active, 1);
 		} else
 			counter_u64_add(rate_limit_alloc_fail, 1);
+#endif
 	}
 	return (error);
 }
@@ -3320,7 +3322,9 @@ in_pcbdetach_tag(struct ifnet *ifp, struct m_snd_tag *
 
 	/* release reference count on network interface */
 	if_rele(ifp);
+#ifdef INET
 	counter_u64_add(rate_limit_active, -1);
+#endif
 }
 
 /*
@@ -3479,6 +3483,7 @@ in_pcboutput_eagain(struct inpcb *inp)
 		INP_DOWNGRADE(inp);
 }
 
+#ifdef INET
 static void
 rl_init(void *st)
 {
@@ -3488,4 +3493,5 @@ rl_init(void *st)
 }
 
 SYSINIT(rl, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, rl_init, NULL);
+#endif
 #endif /* RATELIMIT */

Modified: head/sys/netinet/tcp_ratelimit.c
==============================================================================
--- head/sys/netinet/tcp_ratelimit.c	Fri Aug  2 22:36:42 2019	(r350546)
+++ head/sys/netinet/tcp_ratelimit.c	Fri Aug  2 22:43:09 2019	(r350547)
@@ -270,9 +270,11 @@ rs_destroy(epoch_context_t ctx)
 
 }
 
+#ifdef INET
 extern counter_u64_t rate_limit_set_ok;
 extern counter_u64_t rate_limit_active;
 extern counter_u64_t rate_limit_alloc_fail;
+#endif
 
 static int
 rl_attach_txrtlmt(struct ifnet *ifp,
@@ -294,12 +296,14 @@ rl_attach_txrtlmt(struct ifnet *ifp,
 		error = EOPNOTSUPP;
 	} else {
 		error = ifp->if_snd_tag_alloc(ifp, &params, tag);
+#ifdef INET
 		if (error == 0) {
 			if_ref((*tag)->ifp);
 			counter_u64_add(rate_limit_set_ok, 1);
 			counter_u64_add(rate_limit_active, 1);
 		} else
 			counter_u64_add(rate_limit_alloc_fail, 1);
+#endif
 	}
 	return (error);
 }

From owner-svn-src-head@freebsd.org  Fri Aug  2 22:58:46 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E9EBBE1F3;
 Fri,  2 Aug 2019 22:58:46 +0000 (UTC) (envelope-from cy@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460jJP6zJlz4cMT;
 Fri,  2 Aug 2019 22:58:45 +0000 (UTC) (envelope-from cy@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D11529AE7;
 Fri,  2 Aug 2019 22:58:45 +0000 (UTC) (envelope-from cy@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72MwjgD001140;
 Fri, 2 Aug 2019 22:58:45 GMT (envelope-from cy@FreeBSD.org)
Received: (from cy@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72MwjjE001139;
 Fri, 2 Aug 2019 22:58:45 GMT (envelope-from cy@FreeBSD.org)
Message-Id: <201908022258.x72MwjjE001139@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org
 using -f
From: Cy Schubert <cy@FreeBSD.org>
Date: Fri, 2 Aug 2019 22:58:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350548 - head/sys/contrib/ipfilter/netinet
X-SVN-Group: head
X-SVN-Commit-Author: cy
X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet
X-SVN-Commit-Revision: 350548
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 22:58:46 -0000

Author: cy
Date: Fri Aug  2 22:58:45 2019
New Revision: 350548
URL: https://svnweb.freebsd.org/changeset/base/350548

Log:
  MFC after:	3 days

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Aug  2 22:43:09 2019	(r350547)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Aug  2 22:58:45 2019	(r350548)
@@ -30,24 +30,24 @@ static const char rcsid[] = "@(#)$Id$";
 #include <sys/errno.h>
 #include <sys/types.h>
 #include <sys/file.h>
-# include <sys/fcntl.h>
-# include <sys/filio.h>
+#include <sys/fcntl.h>
+#include <sys/filio.h>
 #include <sys/time.h>
 #include <sys/systm.h>
 # include <sys/dirent.h>
 #if defined(__FreeBSD_version)
 #include <sys/jail.h>
 #endif
-# include <sys/malloc.h>
-# include <sys/mbuf.h>
-# include <sys/sockopt.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/sockopt.h>
 #include <sys/socket.h>
-# include <sys/selinfo.h>
-# include <netinet/tcp_var.h>
+#include <sys/selinfo.h>
+#include <netinet/tcp_var.h>
 
 #include <net/if.h>
-# include <net/if_var.h>
-#  include <net/netisr.h>
+#include <net/if_var.h>
+#include <net/netisr.h>
 #include <net/route.h>
 #include <netinet/in.h>
 #include <netinet/in_fib.h>
@@ -77,7 +77,7 @@ static const char rcsid[] = "@(#)$Id$";
 #include "netinet/ip_scan.h"
 #endif
 #include "netinet/ip_pool.h"
-# include <sys/malloc.h>
+#include <sys/malloc.h>
 #include <sys/kernel.h>
 #ifdef CSUM_DATA_VALID
 #include <machine/in_cksum.h>

From owner-svn-src-head@freebsd.org  Fri Aug  2 23:07:23 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12CCBBE481;
 Fri,  2 Aug 2019 23:07:23 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "Client", Issuer "CA" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460jVL3X36z4ckw;
 Fri,  2 Aug 2019 23:07:22 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA
 id tgdrhPc29SrVctgdshZXKn; Fri, 02 Aug 2019 17:07:21 -0600
X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0
 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17
 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8
 a=nmum_63DDT74rMlhMPIA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22
 a=Ia-lj3WSrqcvXOmTRaiG:22
Received: from slippy.cwsent.com (slippy [10.1.1.91])
 by spqr.komquats.com (Postfix) with ESMTPS id 2331912E;
 Fri,  2 Aug 2019 16:07:19 -0700 (PDT)
Received: from slippy.cwsent.com (localhost [127.0.0.1])
 by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x72N7IYX010933;
 Fri, 2 Aug 2019 16:07:18 -0700 (PDT)
 (envelope-from Cy.Schubert@cschubert.com)
Received: from slippy (cy@localhost)
 by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x72N7Ib0010930;
 Fri, 2 Aug 2019 16:07:18 -0700 (PDT)
 (envelope-from Cy.Schubert@cschubert.com)
Message-Id: <201908022307.x72N7Ib0010930@slippy.cwsent.com>
X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs
X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1
Reply-to: Cy Schubert <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Cy Schubert <cy@FreeBSD.org>
cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350548 - head/sys/contrib/ipfilter/netinet
In-reply-to: <201908022258.x72MwjjE001139@repo.freebsd.org>
References: <201908022258.x72MwjjE001139@repo.freebsd.org>
Comments: In-reply-to Cy Schubert <cy@FreeBSD.org>
 message dated "Fri, 02 Aug 2019 22:58:45 -0000."
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Fri, 02 Aug 2019 16:07:18 -0700
X-CMAE-Envelope: MS4wfFp6mraKwwgzbVf8mKzF3KCvbeqnnT+nztQqR+vL8ar7IOVCnrOmJqJAQ00+MVFgCK6oMPvMhWbLxsIBgtaZLr+6+ori8mwzv0E9RKUnaZroHpbwVpUb
 wsMNZJPatPSYr58A3VTz78zF52s9Eo0DjNeb6lGkoiEzfyPhwb70XBZo6OksK5HO78GUgpE0H6Jtih9EJg8q8ekgxoD7l3YQxQKEco9l2wFNX8XeGWOqRfet
 qE4Ym5y5o3vcHqbhLZHIXarkjvEODtt9l7mW37lmyvoTGwWtYM0bF37Kr/vl9X9L
X-Rspamd-Queue-Id: 460jVL3X36z4ckw
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.85 / 15.00];
 NEURAL_HAM_SHORT(-0.85)[-0.851,0]; REPLY(-4.00)[]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 23:07:23 -0000

In message <201908022258.x72MwjjE001139@repo.freebsd.org>, Cy Schubert 
writes:
> Author: cy
> Date: Fri Aug  2 22:58:45 2019
> New Revision: 350548
> URL: https://svnweb.freebsd.org/changeset/base/350548
>
> Log:
>   MFC after:	3 days
>

This was stupid. The initial git commit had to be undone because the 
file in my tree was out of date. After git rebase -i and recommit I 
must have inadvertently deleted the commit log message, which did say 
#include whitespace cleanup.

> Modified:
>   head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
>
> Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
> =============================================================================
> =
> --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Aug  2 22:4
> 3:09 2019	(r350547)
> +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Aug  2 22:5
> 8:45 2019	(r350548)
> @@ -30,24 +30,24 @@ static const char rcsid[] = "@(#)$Id$";
>  #include <sys/errno.h>
>  #include <sys/types.h>
>  #include <sys/file.h>
> -# include <sys/fcntl.h>
> -# include <sys/filio.h>
> +#include <sys/fcntl.h>
> +#include <sys/filio.h>
>  #include <sys/time.h>
>  #include <sys/systm.h>
>  # include <sys/dirent.h>
>  #if defined(__FreeBSD_version)
>  #include <sys/jail.h>
>  #endif
> -# include <sys/malloc.h>
> -# include <sys/mbuf.h>
> -# include <sys/sockopt.h>
> +#include <sys/malloc.h>
> +#include <sys/mbuf.h>
> +#include <sys/sockopt.h>
>  #include <sys/socket.h>
> -# include <sys/selinfo.h>
> -# include <netinet/tcp_var.h>
> +#include <sys/selinfo.h>
> +#include <netinet/tcp_var.h>
>  
>  #include <net/if.h>
> -# include <net/if_var.h>
> -#  include <net/netisr.h>
> +#include <net/if_var.h>
> +#include <net/netisr.h>
>  #include <net/route.h>
>  #include <netinet/in.h>
>  #include <netinet/in_fib.h>
> @@ -77,7 +77,7 @@ static const char rcsid[] = "@(#)$Id$";
>  #include "netinet/ip_scan.h"
>  #endif
>  #include "netinet/ip_pool.h"
> -# include <sys/malloc.h>
> +#include <sys/malloc.h>
>  #include <sys/kernel.h>
>  #ifdef CSUM_DATA_VALID
>  #include <machine/in_cksum.h>


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.



From owner-svn-src-head@freebsd.org  Fri Aug  2 23:11:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 894C0BE6E6;
 Fri,  2 Aug 2019 23:11:07 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "Client", Issuer "CA" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460jZf2mXKz4cw1;
 Fri,  2 Aug 2019 23:11:05 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA
 id tghRhPdvZSrVctghThZY8P; Fri, 02 Aug 2019 17:11:04 -0600
X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0
 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17
 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8
 a=YxBL1-UpAAAA:8 a=zYlNwCn8pyCm8ZoJMUwA:9 a=CjuIK1q_8ugA:10 a=F2WFE2OsEqcA:10
 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22
Received: from slippy.cwsent.com (slippy [10.1.1.91])
 by spqr.komquats.com (Postfix) with ESMTPS id 14C67153;
 Fri,  2 Aug 2019 16:11:01 -0700 (PDT)
Received: from slippy.cwsent.com (localhost [127.0.0.1])
 by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x72NB0k1030969;
 Fri, 2 Aug 2019 16:11:00 -0700 (PDT)
 (envelope-from Cy.Schubert@cschubert.com)
Received: from slippy (cy@localhost)
 by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x72NB0d8030965;
 Fri, 2 Aug 2019 16:11:00 -0700 (PDT)
 (envelope-from Cy.Schubert@cschubert.com)
Message-Id: <201908022311.x72NB0d8030965@slippy.cwsent.com>
X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs
X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1
Reply-to: Cy Schubert <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r350548 - head/sys/contrib/ipfilter/netinet
In-reply-to: <201908022307.x72N7Ib0010930@slippy.cwsent.com>
References: <201908022258.x72MwjjE001139@repo.freebsd.org> 
 <201908022307.x72N7Ib0010930@slippy.cwsent.com>
Comments: In-reply-to Cy Schubert <Cy.Schubert@cschubert.com>
 message dated "Fri, 02 Aug 2019 16:07:18 -0700."
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Fri, 02 Aug 2019 16:11:00 -0700
X-CMAE-Envelope: MS4wfPeKdEV+GWXHSm5XSYc6W8ENQZt9WaQuJFP6YkeBYdZ0Zazan8zxJyxxyphJCr+TiXb1PfYKV27smVuL5zAzO/uvD6wGTQZvvVleijWNzwUZLzwe82MU
 b/W8xaHlSxPkRsrY9N+8oz6ULbNArKWnu70ZdOf01zd81/41Yi9VWg8fPT/9xdrXH/za+5ISzmDg8HYwc9zNYm1dCEnICb1n5/HsZX3TLWRo2JV/kDtyffxQ
 AWUoR7vvP25O39krzunqHTbru1delDeRtYVvtwH+MRg=
X-Rspamd-Queue-Id: 460jZf2mXKz4cw1
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org; dkim=none;
 spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF
 policy when checking 64.59.136.139) smtp.mailfrom=cy.schubert@cschubert.com
X-Spamd-Result: default: False [-2.90 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5];
 HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; MV_CASE(0.50)[];
 MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[];
 TO_DN_NONE(0.00)[]; REPLYTO_EQ_FROM(0.00)[];
 IP_SCORE(-2.32)[ip: (-5.81), ipnet: 64.59.128.0/20(-3.20), asn: 6327(-2.49),
 country: CA(-0.09)]; NEURAL_HAM_SHORT(-0.98)[-0.983,0];
 RCVD_IN_DNSWL_NONE(0.00)[139.136.59.64.list.dnswl.org : 127.0.5.0];
 R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[];
 MIME_TRACE(0.00)[0:+];
 ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA];
 RCVD_TLS_LAST(0.00)[];
 RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net
 : 127.0.0.11]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Aug 2019 23:11:07 -0000

In message <201908022307.x72N7Ib0010930@slippy.cwsent.com>, Cy Schubert 
writes:
> In message <201908022258.x72MwjjE001139@repo.freebsd.org>, Cy Schubert 
> writes:
> > Author: cy
> > Date: Fri Aug  2 22:58:45 2019
> > New Revision: 350548
> > URL: https://svnweb.freebsd.org/changeset/base/350548
> >
> > Log:
> >   MFC after:	3 days
> >
>
> This was stupid. The initial git commit had to be undone because the 
> file in my tree was out of date. After git rebase -i and recommit I 
> must have inadvertently deleted the commit log message, which did say 
> #include whitespace cleanup.

Best practice to avoid the initial git svn dcommit failure would be to 
git fetch && git svn rebase before git commit rather than before git 
svn dcommit, though the race still exists.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.



From owner-svn-src-head@freebsd.org  Sat Aug  3 01:02:53 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93126A1137;
 Sat,  3 Aug 2019 01:02:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460m3d3PMMz3DcZ;
 Sat,  3 Aug 2019 01:02:53 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56118B20F;
 Sat,  3 Aug 2019 01:02:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7312rEk078326;
 Sat, 3 Aug 2019 01:02:53 GMT (envelope-from jhb@FreeBSD.org)
Received: (from jhb@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7312qt3078324;
 Sat, 3 Aug 2019 01:02:52 GMT (envelope-from jhb@FreeBSD.org)
Message-Id: <201908030102.x7312qt3078324@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org
 using -f
From: John Baldwin <jhb@FreeBSD.org>
Date: Sat, 3 Aug 2019 01:02:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350549 - head/sys/kern
X-SVN-Group: head
X-SVN-Commit-Author: jhb
X-SVN-Commit-Paths: head/sys/kern
X-SVN-Commit-Revision: 350549
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 01:02:53 -0000

Author: jhb
Date: Sat Aug  3 01:02:52 2019
New Revision: 350549
URL: https://svnweb.freebsd.org/changeset/base/350549

Log:
  Set ISOPEN in namei flags when opening executable interpreters.
  
  These vnodes are explicitly opened via VOP_OPEN via
  exec_check_permissions identical to the main exectuable image.
  Setting ISOPEN allows filesystems to perform suitable checks in
  VOP_LOOKUP (e.g. close-to-open consistency in the NFS client).
  
  Reviewed by:	kib
  MFC after:	1 month
  Differential Revision:	https://reviews.freebsd.org/D21129

Modified:
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Fri Aug  2 22:58:45 2019	(r350548)
+++ head/sys/kern/imgact_elf.c	Sat Aug  3 01:02:52 2019	(r350549)
@@ -748,8 +748,8 @@ __elfN(load_file)(struct proc *p, const char *file, u_
 	imgp->object = NULL;
 	imgp->execlabel = NULL;
 
-	NDINIT(nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE, file,
-	    curthread);
+	NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF,
+	    UIO_SYSSPACE, file, curthread);
 	if ((error = namei(nd)) != 0) {
 		nd->ni_vp = NULL;
 		goto fail;

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Fri Aug  2 22:58:45 2019	(r350548)
+++ head/sys/kern/kern_exec.c	Sat Aug  3 01:02:52 2019	(r350549)
@@ -639,7 +639,7 @@ interpret:
 		free(imgp->freepath, M_TEMP);
 		imgp->freepath = NULL;
 		/* set new name to that of the interpreter */
-		NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME,
+		NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME,
 		    UIO_SYSSPACE, imgp->interpreter_name, td);
 		args->fname = imgp->interpreter_name;
 		goto interpret;

From owner-svn-src-head@freebsd.org  Sat Aug  3 01:06:18 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E307A1259;
 Sat,  3 Aug 2019 01:06:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460m7Z2qJDz3DrD;
 Sat,  3 Aug 2019 01:06:18 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42493B223;
 Sat,  3 Aug 2019 01:06:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7316IY1078530;
 Sat, 3 Aug 2019 01:06:18 GMT (envelope-from jhb@FreeBSD.org)
Received: (from jhb@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7316Ibx078529;
 Sat, 3 Aug 2019 01:06:18 GMT (envelope-from jhb@FreeBSD.org)
Message-Id: <201908030106.x7316Ibx078529@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org
 using -f
From: John Baldwin <jhb@FreeBSD.org>
Date: Sat, 3 Aug 2019 01:06:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350550 - head/share/mk
X-SVN-Group: head
X-SVN-Commit-Author: jhb
X-SVN-Commit-Paths: head/share/mk
X-SVN-Commit-Revision: 350550
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 01:06:18 -0000

Author: jhb
Date: Sat Aug  3 01:06:17 2019
New Revision: 350550
URL: https://svnweb.freebsd.org/changeset/base/350550

Log:
  Flip REPRODUCIBLE_BUILD back to off by default in head.
  
  Having the full uname output can be useful on head even with
  unmodified trees or trees that newvers.sh fails to recognize as
  modified.
  
  Reviewed by:	emaste
  Differential Revision:	https://reviews.freebsd.org/D20895

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==============================================================================
--- head/share/mk/src.opts.mk	Sat Aug  3 01:02:52 2019	(r350549)
+++ head/share/mk/src.opts.mk	Sat Aug  3 01:06:17 2019	(r350550)
@@ -162,7 +162,6 @@ __DEFAULT_YES_OPTIONS = \
     QUOTAS \
     RADIUS_SUPPORT \
     RBOOTD \
-    REPRODUCIBLE_BUILD \
     RESCUE \
     ROUTED \
     SENDMAIL \
@@ -208,6 +207,7 @@ __DEFAULT_NO_OPTIONS = \
     LOADER_VERIEXEC_PASS_MANIFEST \
     OFED_EXTRA \
     OPENLDAP \
+    REPRODUCIBLE_BUILD \
     RPCBIND_WARMSTART_SUPPORT \
     SHARED_TOOLCHAIN \
     SORT_THREADS \

From owner-svn-src-head@freebsd.org  Sat Aug  3 01:36:07 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50E8DA1EAD;
 Sat,  3 Aug 2019 01:36:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460mnz1QMJz3G6M;
 Sat,  3 Aug 2019 01:36:07 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1187FB787;
 Sat,  3 Aug 2019 01:36:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x731a6qX096241;
 Sat, 3 Aug 2019 01:36:06 GMT (envelope-from jhb@FreeBSD.org)
Received: (from jhb@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x731a6Qu096237;
 Sat, 3 Aug 2019 01:36:06 GMT (envelope-from jhb@FreeBSD.org)
Message-Id: <201908030136.x731a6Qu096237@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org
 using -f
From: John Baldwin <jhb@FreeBSD.org>
Date: Sat, 3 Aug 2019 01:36:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350551 - in head/sys: amd64/amd64 i386/i386 i386/include
X-SVN-Group: head
X-SVN-Commit-Author: jhb
X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 i386/include
X-SVN-Commit-Revision: 350551
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 01:36:07 -0000

Author: jhb
Date: Sat Aug  3 01:36:05 2019
New Revision: 350551
URL: https://svnweb.freebsd.org/changeset/base/350551

Log:
  Don't reset memory attributes when mapping physical addresses for ACPI.
  
  Previously, AcpiOsMemory was using pmap_mapbios which would always map
  the requested address Write-Back (WB).  For several AMD Ryzen laptops,
  the BIOS uses AcpiOsMemory to directly access the PCI MCFG region in
  order to access PCI config registers.  This has the side effect of
  remapping the MCFG region in the direct map as WB instead of UC
  hanging the laptops during boot.
  
  On the one laptop I examined in detail, the _PIC global method used to
  switch from 8259A PICs to I/O APICs uses a pair of PCI config space
  registers at offset 0x84 in the device at 0:0:0 to as a pair of
  address/data registers to access an indirect register in the chipset
  and clear a single bit to switch modes.
  
  To fix, alter the semantics of pmap_mapbios() such that it does not
  modify the attributes of any existing mappings and instead uses the
  existing attributes.  If a new mapping is created, this new mapping
  uses WB (the default memory attribute).
  
  Special thanks to the gentleman whose name I don't have who brought
  two affected laptops to the hacker lounge at BSDCan.  Direct access to
  the affected systems permitted finding the root cause within an hour
  or so.
  
  PR:		231760, 236899
  Reviewed by:	kib, alc
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D20327

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/i386/pmap_base.c
  head/sys/i386/include/pmap_base.h

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sat Aug  3 01:06:17 2019	(r350550)
+++ head/sys/amd64/amd64/pmap.c	Sat Aug  3 01:36:05 2019	(r350551)
@@ -1097,6 +1097,13 @@ static caddr_t crashdumpmap;
 #define	PMAP_ENTER_NORECLAIM	0x1000000	/* Don't reclaim PV entries. */
 #define	PMAP_ENTER_NOREPLACE	0x2000000	/* Don't replace mappings. */
 
+/*
+ * Internal flags for pmap_mapdev_internal() and
+ * pmap_change_attr_locked().
+ */
+#define	MAPDEV_FLUSHCACHE	0x0000001	/* Flush cache after mapping. */
+#define	MAPDEV_SETATTR		0x0000002	/* Modify existing attrs. */
+
 static void	free_pv_chunk(struct pv_chunk *pc);
 static void	free_pv_entry(pmap_t pmap, pv_entry_t pv);
 static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp);
@@ -1117,7 +1124,7 @@ static pv_entry_t pmap_pvh_remove(struct md_page *pvh,
 		    vm_offset_t va);
 
 static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode,
-    bool noflush);
+    int flags);
 static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va);
 static boolean_t pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde,
     vm_offset_t va, struct rwlock **lockp);
@@ -7711,7 +7718,7 @@ pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mas
  * NOT real memory.
  */
 static void *
-pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, int mode, bool noflush)
+pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, int mode, int flags)
 {
 	struct pmap_preinit_mapping *ppim;
 	vm_offset_t va, offset;
@@ -7745,7 +7752,8 @@ pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, in
 		for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) {
 			ppim = pmap_preinit_mapping + i;
 			if (ppim->pa == pa && ppim->sz == size &&
-			    ppim->mode == mode)
+			    (ppim->mode == mode ||
+			    (flags & MAPDEV_SETATTR) == 0))
 				return ((void *)(ppim->va + offset));
 		}
 		/*
@@ -7754,9 +7762,12 @@ pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, in
 		 */
 		if (pa < dmaplimit && pa + size <= dmaplimit) {
 			va = PHYS_TO_DMAP(pa);
-			PMAP_LOCK(kernel_pmap);
-			i = pmap_change_attr_locked(va, size, mode, noflush);
-			PMAP_UNLOCK(kernel_pmap);
+			if ((flags & MAPDEV_SETATTR) != 0) {
+				PMAP_LOCK(kernel_pmap);
+				i = pmap_change_attr_locked(va, size, mode, flags);
+				PMAP_UNLOCK(kernel_pmap);
+			} else
+				i = 0;
 			if (!i)
 				return ((void *)(va + offset));
 		}
@@ -7767,7 +7778,7 @@ pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, in
 	for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE)
 		pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode);
 	pmap_invalidate_range(kernel_pmap, va, va + tmpsize);
-	if (!noflush)
+	if ((flags & MAPDEV_FLUSHCACHE) != 0)
 		pmap_invalidate_cache_range(va, va + tmpsize);
 	return ((void *)(va + offset));
 }
@@ -7776,28 +7787,31 @@ void *
 pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode)
 {
 
-	return (pmap_mapdev_internal(pa, size, mode, false));
+	return (pmap_mapdev_internal(pa, size, mode, MAPDEV_FLUSHCACHE |
+	    MAPDEV_SETATTR));
 }
 
 void *
 pmap_mapdev(vm_paddr_t pa, vm_size_t size)
 {
 
-	return (pmap_mapdev_internal(pa, size, PAT_UNCACHEABLE, false));
+	return (pmap_mapdev_attr(pa, size, PAT_UNCACHEABLE));
 }
 
 void *
 pmap_mapdev_pciecfg(vm_paddr_t pa, vm_size_t size)
 {
 
-	return (pmap_mapdev_internal(pa, size, PAT_UNCACHEABLE, true));
+	return (pmap_mapdev_internal(pa, size, PAT_UNCACHEABLE,
+	    MAPDEV_SETATTR));
 }
 
 void *
 pmap_mapbios(vm_paddr_t pa, vm_size_t size)
 {
 
-	return (pmap_mapdev_internal(pa, size, PAT_WRITE_BACK, false));
+	return (pmap_mapdev_internal(pa, size, PAT_WRITE_BACK,
+	    MAPDEV_FLUSHCACHE));
 }
 
 void
@@ -7936,13 +7950,13 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int m
 	int error;
 
 	PMAP_LOCK(kernel_pmap);
-	error = pmap_change_attr_locked(va, size, mode, false);
+	error = pmap_change_attr_locked(va, size, mode, MAPDEV_FLUSHCACHE);
 	PMAP_UNLOCK(kernel_pmap);
 	return (error);
 }
 
 static int
-pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, bool noflush)
+pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, int flags)
 {
 	vm_offset_t base, offset, tmpva;
 	vm_paddr_t pa_start, pa_end, pa_end1;
@@ -8059,7 +8073,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
 					/* Run ended, update direct map. */
 					error = pmap_change_attr_locked(
 					    PHYS_TO_DMAP(pa_start),
-					    pa_end - pa_start, mode, noflush);
+					    pa_end - pa_start, mode, flags);
 					if (error != 0)
 						break;
 					/* Start physical address run. */
@@ -8089,7 +8103,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
 					/* Run ended, update direct map. */
 					error = pmap_change_attr_locked(
 					    PHYS_TO_DMAP(pa_start),
-					    pa_end - pa_start, mode, noflush);
+					    pa_end - pa_start, mode, flags);
 					if (error != 0)
 						break;
 					/* Start physical address run. */
@@ -8117,7 +8131,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
 					/* Run ended, update direct map. */
 					error = pmap_change_attr_locked(
 					    PHYS_TO_DMAP(pa_start),
-					    pa_end - pa_start, mode, noflush);
+					    pa_end - pa_start, mode, flags);
 					if (error != 0)
 						break;
 					/* Start physical address run. */
@@ -8132,7 +8146,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
 		pa_end1 = MIN(pa_end, dmaplimit);
 		if (pa_start != pa_end1)
 			error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start),
-			    pa_end1 - pa_start, mode, noflush);
+			    pa_end1 - pa_start, mode, flags);
 	}
 
 	/*
@@ -8141,7 +8155,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
 	 */
 	if (changed) {
 		pmap_invalidate_range(kernel_pmap, base, tmpva);
-		if (!noflush)
+		if ((flags & MAPDEV_FLUSHCACHE) != 0)
 			pmap_invalidate_cache_range(base, tmpva);
 	}
 	return (error);

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sat Aug  3 01:06:17 2019	(r350550)
+++ head/sys/i386/i386/pmap.c	Sat Aug  3 01:36:05 2019	(r350551)
@@ -5404,10 +5404,12 @@ pmap_pde_attr(pd_entry_t *pde, int cache_bits)
  * NOT real memory.
  */
 static void *
-__CONCAT(PMTYPE, mapdev_attr)(vm_paddr_t pa, vm_size_t size, int mode)
+__CONCAT(PMTYPE, mapdev_attr)(vm_paddr_t pa, vm_size_t size, int mode,
+    int flags)
 {
 	struct pmap_preinit_mapping *ppim;
 	vm_offset_t va, offset;
+	vm_page_t m;
 	vm_size_t tmpsize;
 	int i;
 
@@ -5415,9 +5417,11 @@ __CONCAT(PMTYPE, mapdev_attr)(vm_paddr_t pa, vm_size_t
 	size = round_page(offset + size);
 	pa = pa & PG_FRAME;
 
-	if (pa < PMAP_MAP_LOW && pa + size <= PMAP_MAP_LOW)
+	if (pa < PMAP_MAP_LOW && pa + size <= PMAP_MAP_LOW) {
 		va = pa + PMAP_MAP_LOW;
-	else if (!pmap_initialized) {
+		if ((flags & MAPDEV_SETATTR) == 0)
+			return ((void *)(va + offset));
+	} else if (!pmap_initialized) {
 		va = 0;
 		for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) {
 			ppim = pmap_preinit_mapping + i;
@@ -5440,15 +5444,25 @@ __CONCAT(PMTYPE, mapdev_attr)(vm_paddr_t pa, vm_size_t
 		for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) {
 			ppim = pmap_preinit_mapping + i;
 			if (ppim->pa == pa && ppim->sz == size &&
-			    ppim->mode == mode)
+			    (ppim->mode == mode ||
+			    (flags & MAPDEV_SETATTR) == 0))
 				return ((void *)(ppim->va + offset));
 		}
 		va = kva_alloc(size);
 		if (va == 0)
 			panic("%s: Couldn't allocate KVA", __func__);
 	}
-	for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE)
+	for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE) {
+		if ((flags & MAPDEV_SETATTR) == 0 && pmap_initialized) {
+			m = PHYS_TO_VM_PAGE(pa);
+			if (m != NULL && VM_PAGE_TO_PHYS(m) == pa) {
+				pmap_kenter_attr(va + tmpsize, pa + tmpsize,
+				    m->md.pat_mode);
+				continue;
+			}
+		}
 		pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode);
+	}
 	pmap_invalidate_range_int(kernel_pmap, va, va + tmpsize);
 	pmap_invalidate_cache_range(va, va + size);
 	return ((void *)(va + offset));

Modified: head/sys/i386/i386/pmap_base.c
==============================================================================
--- head/sys/i386/i386/pmap_base.c	Sat Aug  3 01:06:17 2019	(r350550)
+++ head/sys/i386/i386/pmap_base.c	Sat Aug  3 01:36:05 2019	(r350551)
@@ -776,21 +776,23 @@ void *
 pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode)
 {
 
-	return (pmap_methods_ptr->pm_mapdev_attr(pa, size, mode));
+	return (pmap_methods_ptr->pm_mapdev_attr(pa, size, mode,
+	    MAPDEV_SETATTR));
 }
 
 void *
 pmap_mapdev(vm_paddr_t pa, vm_size_t size)
 {
 
-	return (pmap_methods_ptr->pm_mapdev_attr(pa, size, PAT_UNCACHEABLE));
+	return (pmap_methods_ptr->pm_mapdev_attr(pa, size, PAT_UNCACHEABLE,
+	    MAPDEV_SETATTR));
 }
 
 void *
 pmap_mapbios(vm_paddr_t pa, vm_size_t size)
 {
 
-	return (pmap_methods_ptr->pm_mapdev_attr(pa, size, PAT_WRITE_BACK));
+	return (pmap_methods_ptr->pm_mapdev_attr(pa, size, PAT_WRITE_BACK, 0));
 }
 
 void

Modified: head/sys/i386/include/pmap_base.h
==============================================================================
--- head/sys/i386/include/pmap_base.h	Sat Aug  3 01:06:17 2019	(r350550)
+++ head/sys/i386/include/pmap_base.h	Sat Aug  3 01:36:05 2019	(r350551)
@@ -34,6 +34,9 @@
 #ifndef _MACHINE_PMAP_BASE_H_
 #define	_MACHINE_PMAP_BASE_H_
 
+/* Internal flags for pmap_mapdev_attr(). */
+#define	MAPDEV_SETATTR		0x0000001	/* Modify existing attrs. */
+
 struct pmap_methods {
 	void (*pm_ksetrw)(vm_offset_t);
 	void (*pm_remap_lower)(bool);
@@ -93,7 +96,7 @@ struct pmap_methods {
 	boolean_t (*pm_is_referenced)(vm_page_t);
 	void (*pm_remove_write)(vm_page_t);
 	int (*pm_ts_referenced)(vm_page_t);
-	void *(*pm_mapdev_attr)(vm_paddr_t, vm_size_t, int);
+	void *(*pm_mapdev_attr)(vm_paddr_t, vm_size_t, int, int);
 	void (*pm_unmapdev)(vm_offset_t, vm_size_t);
 	void (*pm_page_set_memattr)(vm_page_t, vm_memattr_t);
 	vm_paddr_t (*pm_extract)(pmap_t, vm_offset_t);

From owner-svn-src-head@freebsd.org  Sat Aug  3 01:55:51 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE3FDA2717;
 Sat,  3 Aug 2019 01:55:51 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460nDl61NPz3H1Y;
 Sat,  3 Aug 2019 01:55:51 +0000 (UTC)
 (envelope-from jhibbits@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98573BCF9;
 Sat,  3 Aug 2019 01:55:51 +0000 (UTC)
 (envelope-from jhibbits@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x731tpUP008030;
 Sat, 3 Aug 2019 01:55:51 GMT (envelope-from jhibbits@FreeBSD.org)
Received: (from jhibbits@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x731tpSt008029;
 Sat, 3 Aug 2019 01:55:51 GMT (envelope-from jhibbits@FreeBSD.org)
Message-Id: <201908030155.x731tpSt008029@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to
 jhibbits@FreeBSD.org using -f
From: Justin Hibbits <jhibbits@FreeBSD.org>
Date: Sat, 3 Aug 2019 01:55:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350552 - head/sys/powerpc/powernv
X-SVN-Group: head
X-SVN-Commit-Author: jhibbits
X-SVN-Commit-Paths: head/sys/powerpc/powernv
X-SVN-Commit-Revision: 350552
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 01:55:52 -0000

Author: jhibbits
Date: Sat Aug  3 01:55:51 2019
New Revision: 350552
URL: https://svnweb.freebsd.org/changeset/base/350552

Log:
  powerpc/powernv: Fix OPAL cfgread/cfgwrite error handling
  
  Freeze clearing needs to heppen any time OPAL reads return either an error
  (except OPAL_HARDWARE), AND any time it returns 0xff for all bytes.
  
  For cfgwrite, any error that's not OPAL_HARDWARE should be cleaned up.

Modified:
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal_pci.c
==============================================================================
--- head/sys/powerpc/powernv/opal_pci.c	Sat Aug  3 01:36:05 2019	(r350551)
+++ head/sys/powerpc/powernv/opal_pci.c	Sat Aug  3 01:55:51 2019	(r350552)
@@ -531,16 +531,16 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo
 	default:
 		error = OPAL_SUCCESS;
 		word = 0xffffffff;
+		width = 4;
 	}
 
 	/*
 	 * Poking config state for non-existant devices can make
 	 * the host bridge hang up. Clear any errors.
-	 *
-	 * XXX: Make this conditional on the existence of a freeze
 	 */
 	
-	if (error != OPAL_SUCCESS) {
+	if (error != OPAL_SUCCESS ||
+	    (word == ((1UL << (8 * width)) - 1))) {
 		if (error != OPAL_HARDWARE) {
 			opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id,
 			    OPAL_PCI_DEFAULT_PE, vtophys(&eeh_state),
@@ -550,7 +550,8 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo
 				    sc->phb_id, OPAL_PCI_DEFAULT_PE,
 				    OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
 		}
-		word = 0xffffffff;
+		if (error != OPAL_SUCCESS)
+			word = 0xffffffff;
 	}
 
 	return (word);
@@ -563,8 +564,6 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl
 	struct opalpci_softc *sc;
 	uint64_t config_addr;
 	int error = OPAL_SUCCESS;
-	uint16_t err_type;
-	uint8_t eeh_state;
 
 	sc = device_get_softc(dev);
 
@@ -591,13 +590,9 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl
 		 * the host bridge hang up. Clear any errors.
 		 */
 		if (error != OPAL_HARDWARE) {
-			opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id,
-			    OPAL_PCI_DEFAULT_PE, vtophys(&eeh_state),
-			    vtophys(&err_type), NULL);
-			if (eeh_state != OPAL_EEH_STOPPED_NOT_FROZEN)
-				opal_call(OPAL_PCI_EEH_FREEZE_CLEAR,
-				    sc->phb_id, OPAL_PCI_DEFAULT_PE,
-				    OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+			opal_call(OPAL_PCI_EEH_FREEZE_CLEAR,
+			    sc->phb_id, OPAL_PCI_DEFAULT_PE,
+			    OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
 		}
 	}
 }

From owner-svn-src-head@freebsd.org  Sat Aug  3 02:36:36 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34768A395B;
 Sat,  3 Aug 2019 02:36:36 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460p7m0cKqz3JlB;
 Sat,  3 Aug 2019 02:36:36 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAC69C45F;
 Sat,  3 Aug 2019 02:36:35 +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 x732aZZf031590;
 Sat, 3 Aug 2019 02:36:35 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x732aZmV031587;
 Sat, 3 Aug 2019 02:36:35 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908030236.x732aZmV031587@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Sat, 3 Aug 2019 02:36:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350553 - head/sys/dev/nvme
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sys/dev/nvme
X-SVN-Commit-Revision: 350553
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 02:36:36 -0000

Author: mav
Date: Sat Aug  3 02:36:35 2019
New Revision: 350553
URL: https://svnweb.freebsd.org/changeset/base/350553

Log:
  Add more random bits from NVMe 1.4.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h	Sat Aug  3 01:55:51 2019	(r350552)
+++ head/sys/dev/nvme/nvme.h	Sat Aug  3 02:36:35 2019	(r350553)
@@ -81,12 +81,20 @@
 
 #define NVME_CAP_HI_REG_DSTRD_SHIFT			(0)
 #define NVME_CAP_HI_REG_DSTRD_MASK			(0xF)
+#define NVME_CAP_HI_REG_NSSRS_SHIFT			(4)
+#define NVME_CAP_HI_REG_NSSRS_MASK			(0x1)
 #define NVME_CAP_HI_REG_CSS_NVM_SHIFT			(5)
 #define NVME_CAP_HI_REG_CSS_NVM_MASK			(0x1)
+#define NVME_CAP_HI_REG_BPS_SHIFT			(13)
+#define NVME_CAP_HI_REG_BPS_MASK			(0x1)
 #define NVME_CAP_HI_REG_MPSMIN_SHIFT			(16)
 #define NVME_CAP_HI_REG_MPSMIN_MASK			(0xF)
 #define NVME_CAP_HI_REG_MPSMAX_SHIFT			(20)
 #define NVME_CAP_HI_REG_MPSMAX_MASK			(0xF)
+#define NVME_CAP_HI_REG_PMRS_SHIFT			(24)
+#define NVME_CAP_HI_REG_PMRS_MASK			(0x1)
+#define NVME_CAP_HI_REG_CMBS_SHIFT			(25)
+#define NVME_CAP_HI_REG_CMBS_MASK			(0x1)
 #define NVME_CAP_HI_DSTRD(x) \
 	(((x) >> NVME_CAP_HI_REG_DSTRD_SHIFT) & NVME_CAP_HI_REG_DSTRD_MASK)
 #define NVME_CAP_HI_CSS_NVM(x) \
@@ -117,6 +125,10 @@
 #define NVME_CSTS_REG_CFS_MASK				(0x1)
 #define NVME_CSTS_REG_SHST_SHIFT			(2)
 #define NVME_CSTS_REG_SHST_MASK				(0x3)
+#define NVME_CSTS_REG_NVSRO_SHIFT			(4)
+#define NVME_CSTS_REG_NVSRO_MASK			(0x1)
+#define NVME_CSTS_REG_PP_SHIFT				(5)
+#define NVME_CSTS_REG_PP_MASK				(0x1)
 
 #define NVME_CSTS_GET_SHST(csts)			(((csts) >> NVME_CSTS_REG_SHST_SHIFT) & NVME_CSTS_REG_SHST_MASK)
 
@@ -136,6 +148,8 @@
 #define NVME_STATUS_SC_MASK				(0xFF)
 #define NVME_STATUS_SCT_SHIFT				(9)
 #define NVME_STATUS_SCT_MASK				(0x7)
+#define NVME_STATUS_CRD_SHIFT				(12)
+#define NVME_STATUS_CRD_MASK				(0x3)
 #define NVME_STATUS_M_SHIFT				(14)
 #define NVME_STATUS_M_MASK				(0x1)
 #define NVME_STATUS_DNR_SHIFT				(15)
@@ -489,34 +503,37 @@ enum shst_value {
 
 struct nvme_registers
 {
-	/** controller capabilities */
-	uint32_t		cap_lo;
-	uint32_t		cap_hi;
-
-	uint32_t		vs;	/* version */
-	uint32_t		intms;	/* interrupt mask set */
-	uint32_t		intmc;	/* interrupt mask clear */
-
-	/** controller configuration */
-	uint32_t		cc;
-
-	uint32_t		reserved1;
-
-	/** controller status */
-	uint32_t		csts;
-
-	uint32_t		reserved2;
-
-	/** admin queue attributes */
-	uint32_t		aqa;
-
-	uint64_t		asq;	/* admin submission queue base addr */
-	uint64_t		acq;	/* admin completion queue base addr */
-	uint32_t		reserved3[0x3f2];
-
+	uint32_t	cap_lo; /* controller capabilities */
+	uint32_t	cap_hi;
+	uint32_t	vs;	/* version */
+	uint32_t	intms;	/* interrupt mask set */
+	uint32_t	intmc;	/* interrupt mask clear */
+	uint32_t	cc;	/* controller configuration */
+	uint32_t	reserved1;
+	uint32_t	csts;	/* controller status */
+	uint32_t	nssr;	/* NVM Subsystem Reset */
+	uint32_t	aqa;	/* admin queue attributes */
+	uint64_t	asq;	/* admin submission queue base addr */
+	uint64_t	acq;	/* admin completion queue base addr */
+	uint32_t	cmbloc;	/* Controller Memory Buffer Location */
+	uint32_t	cmbsz;	/* Controller Memory Buffer Size */
+	uint32_t	bpinfo;	/* Boot Partition Information */
+	uint32_t	bprsel;	/* Boot Partition Read Select */
+	uint64_t	bpmbl;	/* Boot Partition Memory Buffer Location */
+	uint64_t	cmbmsc;	/* Controller Memory Buffer Memory Space Control */
+	uint32_t	cmbsts;	/* Controller Memory Buffer Status */
+	uint8_t		reserved3[3492]; /* 5Ch - DFFh */
+	uint32_t	pmrcap;	/* Persistent Memory Capabilities */
+	uint32_t	pmrctl;	/* Persistent Memory Region Control */
+	uint32_t	pmrsts;	/* Persistent Memory Region Status */
+	uint32_t	pmrebs;	/* Persistent Memory Region Elasticity Buffer Size */
+	uint32_t	pmrswtp; /* Persistent Memory Region Sustained Write Throughput */
+	uint32_t	pmrmsc_lo; /* Persistent Memory Region Controller Memory Space Control */
+	uint32_t	pmrmsc_hi;
+	uint8_t		reserved4[484]; /* E1Ch - FFFh */
 	struct {
-	    uint32_t		sq_tdbl; /* submission queue tail doorbell */
-	    uint32_t		cq_hdbl; /* completion queue head doorbell */
+	    uint32_t	sq_tdbl; /* submission queue tail doorbell */
+	    uint32_t	cq_hdbl; /* completion queue head doorbell */
 	} doorbell[1] __packed;
 } __packed;
 
@@ -591,6 +608,7 @@ enum nvme_status_code_type {
 	NVME_SCT_GENERIC		= 0x0,
 	NVME_SCT_COMMAND_SPECIFIC	= 0x1,
 	NVME_SCT_MEDIA_ERROR		= 0x2,
+	NVME_SCT_PATH_RELATED		= 0x3,
 	/* 0x3-0x6 - reserved */
 	NVME_SCT_VENDOR_SPECIFIC	= 0x7,
 };
@@ -696,6 +714,17 @@ enum nvme_media_error_status_code {
 	NVME_SC_COMPARE_FAILURE			= 0x85,
 	NVME_SC_ACCESS_DENIED			= 0x86,
 	NVME_SC_DEALLOCATED_OR_UNWRITTEN	= 0x87,
+};
+
+/* path related status codes */
+enum nvme_path_related_status_code {
+	NVME_SC_INTERNAL_PATH_ERROR		= 0x00,
+	NVME_SC_ASYMMETRIC_ACCESS_PERSISTENT_LOSS = 0x01,
+	NVME_SC_ASYMMETRIC_ACCESS_INACCESSIBLE	= 0x02,
+	NVME_SC_ASYMMETRIC_ACCESS_TRANSITION	= 0x03,
+	NVME_SC_CONTROLLER_PATHING_ERROR	= 0x60,
+	NVME_SC_HOST_PATHING_ERROR		= 0x70,
+	NVME_SC_COMMAND_ABOTHED_BY_HOST		= 0x71,
 };
 
 /* admin opcodes */

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Sat Aug  3 01:55:51 2019	(r350552)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Sat Aug  3 02:36:35 2019	(r350553)
@@ -759,7 +759,7 @@ nvme_ctrlr_async_event_cb(void *arg, const struct nvme
 	aer->log_page_id = (cpl->cdw0 & 0xFF0000) >> 16;
 
 	nvme_printf(aer->ctrlr, "async event occurred (type 0x%x, info 0x%02x,"
-	    " page 0x%02x)\n", (cpl->cdw0 & 0x03), (cpl->cdw0 & 0xFF00) >> 8,
+	    " page 0x%02x)\n", (cpl->cdw0 & 0x07), (cpl->cdw0 & 0xFF00) >> 8,
 	    aer->log_page_id);
 
 	if (is_log_page_id_valid(aer->log_page_id)) {

Modified: head/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- head/sys/dev/nvme/nvme_qpair.c	Sat Aug  3 01:55:51 2019	(r350552)
+++ head/sys/dev/nvme/nvme_qpair.c	Sat Aug  3 02:36:35 2019	(r350553)
@@ -299,6 +299,17 @@ static struct nvme_status_string media_error_status[] 
 	{ 0xFFFF, "MEDIA ERROR" }
 };
 
+static struct nvme_status_string path_related_status[] = {
+	{ NVME_SC_INTERNAL_PATH_ERROR, "INTERNAL PATH ERROR" },
+	{ NVME_SC_ASYMMETRIC_ACCESS_PERSISTENT_LOSS, "ASYMMETRIC ACCESS PERSISTENT LOSS" },
+	{ NVME_SC_ASYMMETRIC_ACCESS_INACCESSIBLE, "ASYMMETRIC ACCESS INACCESSIBLE" },
+	{ NVME_SC_ASYMMETRIC_ACCESS_TRANSITION, "ASYMMETRIC ACCESS TRANSITION" },
+	{ NVME_SC_CONTROLLER_PATHING_ERROR, "CONTROLLER PATHING ERROR" },
+	{ NVME_SC_HOST_PATHING_ERROR, "HOST PATHING ERROR" },
+	{ NVME_SC_COMMAND_ABOTHED_BY_HOST, "COMMAND ABOTHED BY HOST" },
+	{ 0xFFFF, "PATH RELATED" },
+};
+
 static const char *
 get_status_string(uint16_t sct, uint16_t sc)
 {
@@ -314,6 +325,9 @@ get_status_string(uint16_t sct, uint16_t sc)
 	case NVME_SCT_MEDIA_ERROR:
 		entry = media_error_status;
 		break;
+	case NVME_SCT_PATH_RELATED:
+		entry = path_related_status;
+		break;
 	case NVME_SCT_VENDOR_SPECIFIC:
 		return ("VENDOR SPECIFIC");
 	default:
@@ -385,6 +399,17 @@ nvme_completion_is_retry(const struct nvme_completion 
 		}
 	case NVME_SCT_COMMAND_SPECIFIC:
 	case NVME_SCT_MEDIA_ERROR:
+		return (0);
+	case NVME_SCT_PATH_RELATED:
+		switch (sc) {
+		case NVME_SC_INTERNAL_PATH_ERROR:
+			if (dnr)
+				return (0);
+			else
+				return (1);
+		default:
+			return (0);
+		}
 	case NVME_SCT_VENDOR_SPECIFIC:
 	default:
 		return (0);

From owner-svn-src-head@freebsd.org  Sat Aug  3 03:36:19 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4DA6A4DC0;
 Sat,  3 Aug 2019 03:36:19 +0000 (UTC)
 (envelope-from delphij@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460qSg5GX8z3MFx;
 Sat,  3 Aug 2019 03:36:19 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96539CFEF;
 Sat,  3 Aug 2019 03:36:19 +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 x733aJPT067841;
 Sat, 3 Aug 2019 03:36:19 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x733aI37067837;
 Sat, 3 Aug 2019 03:36:18 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201908030336.x733aI37067837@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI <delphij@FreeBSD.org>
Date: Sat, 3 Aug 2019 03:36:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350554 - in head: share/man/man4 sys/conf sys/dev/mxge
 sys/modules/mxge/mxge
X-SVN-Group: head
X-SVN-Commit-Author: delphij
X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/mxge
 sys/modules/mxge/mxge
X-SVN-Commit-Revision: 350554
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 03:36:19 -0000

Author: delphij
Date: Sat Aug  3 03:36:18 2019
New Revision: 350554
URL: https://svnweb.freebsd.org/changeset/base/350554

Log:
  if_mxge: update zlib version 1.0.4 to 1.2.11.
  
  PR:		229763
  Submitted by:	Yoshihiro Ota <ota j email ne jp>
  Differential Revision:	https://reviews.freebsd.org/D20272

Modified:
  head/share/man/man4/mxge.4
  head/sys/conf/files
  head/sys/dev/mxge/if_mxge.c
  head/sys/modules/mxge/mxge/Makefile

Modified: head/share/man/man4/mxge.4
==============================================================================
--- head/share/man/man4/mxge.4	Sat Aug  3 02:36:35 2019	(r350553)
+++ head/share/man/man4/mxge.4	Sat Aug  3 03:36:18 2019	(r350554)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 13, 2008
+.Dd August 2, 2019
 .Dt MXGE 4
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@ place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device firmware"
+.Cd "device zlib"
 .Cd "device mxge"
 .Ed
 .Pp

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Sat Aug  3 02:36:35 2019	(r350553)
+++ head/sys/conf/files	Sat Aug  3 03:36:18 2019	(r350554)
@@ -2442,7 +2442,8 @@ mwlboot.fw		optional mwlfw					\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"mwlboot.fw"
-dev/mxge/if_mxge.c		optional mxge pci
+dev/mxge/if_mxge.c		optional mxge pci \
+	compile-with "${ZLIB_C}"
 dev/mxge/mxge_eth_z8e.c		optional mxge pci
 dev/mxge/mxge_ethp_z8e.c	optional mxge pci
 dev/mxge/mxge_rss_eth_z8e.c	optional mxge pci

Modified: head/sys/dev/mxge/if_mxge.c
==============================================================================
--- head/sys/dev/mxge/if_mxge.c	Sat Aug  3 02:36:35 2019	(r350553)
+++ head/sys/dev/mxge/if_mxge.c	Sat Aug  3 03:36:18 2019	(r350554)
@@ -47,7 +47,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <sys/sx.h>
 #include <sys/taskqueue.h>
-#include <sys/zlib.h>
+#include <contrib/zlib/zlib.h>
+#include <dev/zlib/zcalloc.h>
 
 #include <net/if.h>
 #include <net/if_var.h>
@@ -683,22 +684,6 @@ mxge_validate_firmware(mxge_softc_t *sc, const mcp_gen
 
 }
 
-static void *
-z_alloc(void *nil, u_int items, u_int size)
-{
-	void *ptr;
-
-	ptr = malloc(items * size, M_TEMP, M_NOWAIT);
-	return ptr;
-}
-
-static void
-z_free(void *nil, void *ptr)
-{
-	free(ptr, M_TEMP);
-}
-
-
 static int
 mxge_load_firmware_helper(mxge_softc_t *sc, uint32_t *limit)
 {
@@ -723,8 +708,8 @@ mxge_load_firmware_helper(mxge_softc_t *sc, uint32_t *
 
 	/* setup zlib and decompress f/w */
 	bzero(&zs, sizeof (zs));
-	zs.zalloc = z_alloc;
-	zs.zfree = z_free;
+	zs.zalloc = zcalloc_nowait;
+	zs.zfree = zcfree;
 	status = inflateInit(&zs);
 	if (status != Z_OK) {
 		status = EIO;

Modified: head/sys/modules/mxge/mxge/Makefile
==============================================================================
--- head/sys/modules/mxge/mxge/Makefile	Sat Aug  3 02:36:35 2019	(r350553)
+++ head/sys/modules/mxge/mxge/Makefile	Sat Aug  3 03:36:18 2019	(r350554)
@@ -5,4 +5,6 @@
 KMOD=	if_mxge
 SRCS=	if_mxge.c device_if.h bus_if.h pci_if.h opt_inet.h opt_inet6.h
 
+CFLAGS.if_mxge.c+= ${ZLIB_CFLAGS}
+
 .include <bsd.kmod.mk>

From owner-svn-src-head@freebsd.org  Sat Aug  3 04:30:23 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7C6EA5CB4;
 Sat,  3 Aug 2019 04:30:23 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 460rg33nlDz3PL0;
 Sat,  3 Aug 2019 04:30:23 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64E02D99F;
 Sat,  3 Aug 2019 04:30:23 +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 x734UNf1098318;
 Sat, 3 Aug 2019 04:30:23 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x734UNLp098317;
 Sat, 3 Aug 2019 04:30:23 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908030430.x734UNLp098317@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Sat, 3 Aug 2019 04:30:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350555 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350555
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 04:30:23 -0000

Author: mav
Date: Sat Aug  3 04:30:22 2019
New Revision: 350555
URL: https://svnweb.freebsd.org/changeset/base/350555

Log:
  Fix parameter check broken at r350057.
  
  MFC after:	2 weeks

Modified:
  head/sbin/nvmecontrol/format.c

Modified: head/sbin/nvmecontrol/format.c
==============================================================================
--- head/sbin/nvmecontrol/format.c	Sat Aug  3 03:36:18 2019	(r350554)
+++ head/sbin/nvmecontrol/format.c	Sat Aug  3 04:30:22 2019	(r350555)
@@ -124,7 +124,7 @@ format(const struct cmd *f, int argc, char *argv[])
 	if (arg_parse(argc, argv, f))
 		return;
 
-	if (opt.Eflag || opt.Cflag || opt.ses != SES_NONE) {
+	if ((int)opt.Eflag + opt.Cflag + (opt.ses != SES_NONE) > 1) {
 		fprintf(stderr,
 		    "Only one of -E, -C or -s may be specified\n");
 		arg_help(argc, argv, f);

From owner-svn-src-head@freebsd.org  Sat Aug  3 13:53:15 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CE0DB20E1;
 Sat,  3 Aug 2019 13:53:15 +0000 (UTC)
 (envelope-from asomers@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 46158W15Fkz4L0S;
 Sat,  3 Aug 2019 13:53:15 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06F5A1BFF9;
 Sat,  3 Aug 2019 13:53:15 +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 x73DrFPt034303;
 Sat, 3 Aug 2019 13:53:15 GMT (envelope-from asomers@FreeBSD.org)
Received: (from asomers@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73DrE0j034302;
 Sat, 3 Aug 2019 13:53:14 GMT (envelope-from asomers@FreeBSD.org)
Message-Id: <201908031353.x73DrE0j034302@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: asomers set sender to
 asomers@FreeBSD.org using -f
From: Alan Somers <asomers@FreeBSD.org>
Date: Sat, 3 Aug 2019 13:53:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350556 - head/sbin/ping6
X-SVN-Group: head
X-SVN-Commit-Author: asomers
X-SVN-Commit-Paths: head/sbin/ping6
X-SVN-Commit-Revision: 350556
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 13:53:15 -0000

Author: asomers
Date: Sat Aug  3 13:53:14 2019
New Revision: 350556
URL: https://svnweb.freebsd.org/changeset/base/350556

Log:
  Capsicumize ping6
  
  Add capsicum support to ping6, mostly copying the strategy used for ping.
  
  Submitted by:	Ján Sučan <jansucan@gmail.com>
  Reviewed by:	markj
  MFC after:	2 weeks
  Sponsored by:	Google, inc. (Google Summer of Code 2019)
  Differential Revision:	https://reviews.freebsd.org/D21050

Modified:
  head/sbin/ping6/Makefile
  head/sbin/ping6/ping6.c

Modified: head/sbin/ping6/Makefile
==============================================================================
--- head/sbin/ping6/Makefile	Sat Aug  3 04:30:22 2019	(r350555)
+++ head/sbin/ping6/Makefile	Sat Aug  3 13:53:14 2019	(r350556)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 PACKAGE=runtime
 PROG=	ping6
 MAN=	ping6.8
@@ -11,5 +13,13 @@ BINOWN=	root
 BINMODE=4555
 
 LIBADD=	ipsec m md
+
+.if ${MK_DYNAMICROOT} == "no"
+.warning ${PROG} built without libcasper support
+.elif ${MK_CASPER} != "no" && !defined(RESCUE)
+LIBADD+=	casper
+LIBADD+=	cap_dns
+CFLAGS+=-DWITH_CASPER
+.endif
 
 .include <bsd.prog.mk>

Modified: head/sbin/ping6/ping6.c
==============================================================================
--- head/sbin/ping6/ping6.c	Sat Aug  3 04:30:22 2019	(r350555)
+++ head/sbin/ping6/ping6.c	Sat Aug  3 13:53:14 2019	(r350556)
@@ -104,6 +104,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include <sys/param.h>
+#include <sys/capsicum.h>
 #include <sys/uio.h>
 #include <sys/socket.h>
 #include <sys/time.h>
@@ -118,6 +119,10 @@ __FBSDID("$FreeBSD$");
 #include <arpa/nameser.h>
 #include <netdb.h>
 
+#include <capsicum_helpers.h>
+#include <casper/cap_dns.h>
+#include <libcasper.h>
+
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
@@ -214,7 +219,8 @@ static struct sockaddr_in6 dst;	/* who to ping6 */
 static struct sockaddr_in6 src;	/* src addr of this packet */
 static socklen_t srclen;
 static size_t datalen = DEFDATALEN;
-static int s;			/* socket file descriptor */
+static int ssend;		/* send socket file descriptor */
+static int srecv;		/* receive socket file descriptor */
 static u_char outpack[MAXPACKETLEN];
 static char BSPACE = '\b';	/* characters written for flood */
 static char BBELL = '\a';	/* characters written for AUDIBLE */
@@ -224,6 +230,7 @@ static int ident;		/* process id to identify our packe
 static u_int8_t nonce[8];	/* nonce field for node information */
 static int hoplimit = -1;	/* hoplimit */
 static u_char *packet = NULL;
+static cap_channel_t *capdns;
 
 /* counters */
 static long nmissedmax;		/* max value of ntransmitted - nreceived - 1 */
@@ -256,6 +263,7 @@ static volatile sig_atomic_t seeninfo;
 #endif
 
 int	 main(int, char *[]);
+static cap_channel_t *capdns_setup(void);
 static void	 fill(char *, char *);
 static int	 get_hoplim(struct msghdr *);
 static int	 get_pathmtu(struct msghdr *);
@@ -318,6 +326,9 @@ main(int argc, char *argv[])
 #ifdef IPV6_USE_MIN_MTU
 	int mflag = 0;
 #endif
+	cap_rights_t rights_srecv;
+	cap_rights_t rights_ssend;
+	cap_rights_t rights_stdin;
 
 	/* just to be sure */
 	memset(&smsghdr, 0, sizeof(smsghdr));
@@ -325,6 +336,7 @@ main(int argc, char *argv[])
 
 	alarmtimeout = preload = 0;
 	datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN];
+	capdns = capdns_setup();
 #ifndef IPSEC
 #define ADDOPTS
 #else
@@ -503,7 +515,7 @@ main(int argc, char *argv[])
 			hints.ai_socktype = SOCK_RAW;
 			hints.ai_protocol = IPPROTO_ICMPV6;
 
-			error = getaddrinfo(optarg, NULL, &hints, &res);
+			error = cap_getaddrinfo(capdns, optarg, NULL, &hints, &res);
 			if (error) {
 				errx(1, "invalid source address: %s",
 				     gai_strerror(error));
@@ -619,14 +631,14 @@ main(int argc, char *argv[])
 	} else
 		target = argv[argc - 1];
 
-	/* getaddrinfo */
+	/* cap_getaddrinfo */
 	memset(&hints, 0, sizeof(struct addrinfo));
 	hints.ai_flags = AI_CANONNAME;
 	hints.ai_family = AF_INET6;
 	hints.ai_socktype = SOCK_RAW;
 	hints.ai_protocol = IPPROTO_ICMPV6;
 
-	error = getaddrinfo(target, NULL, &hints, &res);
+	error = cap_getaddrinfo(capdns, target, NULL, &hints, &res);
 	if (error)
 		errx(1, "%s", gai_strerror(error));
 	if (res->ai_canonname)
@@ -635,13 +647,16 @@ main(int argc, char *argv[])
 		hostname = target;
 
 	if (!res->ai_addr)
-		errx(1, "getaddrinfo failed");
+		errx(1, "cap_getaddrinfo failed");
 
 	(void)memcpy(&dst, res->ai_addr, res->ai_addrlen);
 
-	if ((s = socket(res->ai_family, res->ai_socktype,
+	if ((ssend = socket(res->ai_family, res->ai_socktype,
 	    res->ai_protocol)) < 0)
-		err(1, "socket");
+		err(1, "socket ssend");
+	if ((srecv = socket(res->ai_family, res->ai_socktype,
+	    res->ai_protocol)) < 0)
+		err(1, "socket srecv");
 	freeaddrinfo(res);
 
 	/* set the source address if specified. */
@@ -656,7 +671,7 @@ main(int argc, char *argv[])
 			if (dst.sin6_scope_id == 0)
 				dst.sin6_scope_id = src.sin6_scope_id;
 		}
-		if (bind(s, (struct sockaddr *)&src, srclen) != 0)
+		if (bind(ssend, (struct sockaddr *)&src, srclen) != 0)
 			err(1, "bind");
 	}
 	/* set the gateway (next hop) if specified */
@@ -666,15 +681,15 @@ main(int argc, char *argv[])
 		hints.ai_socktype = SOCK_RAW;
 		hints.ai_protocol = IPPROTO_ICMPV6;
 
-		error = getaddrinfo(gateway, NULL, &hints, &res);
+		error = cap_getaddrinfo(capdns, gateway, NULL, &hints, &res);
 		if (error) {
-			errx(1, "getaddrinfo for the gateway %s: %s",
+			errx(1, "cap_getaddrinfo for the gateway %s: %s",
 			     gateway, gai_strerror(error));
 		}
 		if (res->ai_next && (options & F_VERBOSE))
 			warnx("gateway resolves to multiple addresses");
 
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_NEXTHOP,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_NEXTHOP,
 		    res->ai_addr, res->ai_addrlen)) {
 			err(1, "setsockopt(IPV6_NEXTHOP)");
 		}
@@ -690,25 +705,25 @@ main(int argc, char *argv[])
 		int opton = 1;
 
 #ifdef IPV6_RECVHOPOPTS
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &opton,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &opton,
 		    sizeof(opton)))
 			err(1, "setsockopt(IPV6_RECVHOPOPTS)");
 #else  /* old adv. API */
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPOPTS, &opton,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_HOPOPTS, &opton,
 		    sizeof(opton)))
 			err(1, "setsockopt(IPV6_HOPOPTS)");
 #endif
 #ifdef IPV6_RECVDSTOPTS
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVDSTOPTS, &opton,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVDSTOPTS, &opton,
 		    sizeof(opton)))
 			err(1, "setsockopt(IPV6_RECVDSTOPTS)");
 #else  /* old adv. API */
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_DSTOPTS, &opton,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_DSTOPTS, &opton,
 		    sizeof(opton)))
 			err(1, "setsockopt(IPV6_DSTOPTS)");
 #endif
 #ifdef IPV6_RECVRTHDRDSTOPTS
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDRDSTOPTS, &opton,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVRTHDRDSTOPTS, &opton,
 		    sizeof(opton)))
 			err(1, "setsockopt(IPV6_RECVRTHDRDSTOPTS)");
 #endif
@@ -751,31 +766,34 @@ main(int argc, char *argv[])
 	arc4random_buf(nonce, sizeof(nonce));
 	optval = 1;
 	if (options & F_DONTFRAG)
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_DONTFRAG,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_DONTFRAG,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "IPV6_DONTFRAG");
 	hold = 1;
 
-	if (options & F_SO_DEBUG)
-		(void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&hold,
+	if (options & F_SO_DEBUG) {
+		(void)setsockopt(ssend, SOL_SOCKET, SO_DEBUG, (char *)&hold,
 		    sizeof(hold));
+		(void)setsockopt(srecv, SOL_SOCKET, SO_DEBUG, (char *)&hold,
+		    sizeof(hold));
+	}
 	optval = IPV6_DEFHLIM;
 	if (IN6_IS_ADDR_MULTICAST(&dst.sin6_addr))
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "IPV6_MULTICAST_HOPS");
 #ifdef IPV6_USE_MIN_MTU
 	if (mflag != 1) {
 		optval = mflag > 1 ? 0 : 1;
 
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "setsockopt(IPV6_USE_MIN_MTU)");
 	}
 #ifdef IPV6_RECVPATHMTU
 	else {
 		optval = 1;
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPATHMTU,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVPATHMTU,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "setsockopt(IPV6_RECVPATHMTU)");
 	}
@@ -785,29 +803,38 @@ main(int argc, char *argv[])
 #ifdef IPSEC
 #ifdef IPSEC_POLICY_IPSEC
 	if (options & F_POLICY) {
-		if (setpolicy(s, policy_in) < 0)
+		if (setpolicy(srecv, policy_in) < 0)
 			errx(1, "%s", ipsec_strerror());
-		if (setpolicy(s, policy_out) < 0)
+		if (setpolicy(ssend, policy_out) < 0)
 			errx(1, "%s", ipsec_strerror());
 	}
 #else
 	if (options & F_AUTHHDR) {
 		optval = IPSEC_LEVEL_REQUIRE;
 #ifdef IPV6_AUTH_TRANS_LEVEL
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "setsockopt(IPV6_AUTH_TRANS_LEVEL)");
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL,
+		     &optval, sizeof(optval)) == -1)
+			err(1, "setsockopt(IPV6_AUTH_TRANS_LEVEL)");
 #else /* old def */
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_AUTH_LEVEL,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_AUTH_LEVEL,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "setsockopt(IPV6_AUTH_LEVEL)");
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_AUTH_LEVEL,
+		    &optval, sizeof(optval)) == -1)
+			err(1, "setsockopt(IPV6_AUTH_LEVEL)");
 #endif
 	}
 	if (options & F_ENCRYPT) {
 		optval = IPSEC_LEVEL_REQUIRE;
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "setsockopt(IPV6_ESP_TRANS_LEVEL)");
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL,
+		    &optval, sizeof(optval)) == -1)
+			err(1, "setsockopt(IPV6_ESP_TRANS_LEVEL)");
 	}
 #endif /*IPSEC_POLICY_IPSEC*/
 #endif
@@ -825,7 +852,7 @@ main(int argc, char *argv[])
 	} else {
 		ICMP6_FILTER_SETPASSALL(&filt);
 	}
-	if (setsockopt(s, IPPROTO_ICMPV6, ICMP6_FILTER, &filt,
+	if (setsockopt(srecv, IPPROTO_ICMPV6, ICMP6_FILTER, &filt,
 	    sizeof(filt)) < 0)
 		err(1, "setsockopt(ICMP6_FILTER)");
     }
@@ -836,11 +863,11 @@ main(int argc, char *argv[])
 		int opton = 1;
 
 #ifdef IPV6_RECVRTHDR
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDR, &opton,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVRTHDR, &opton,
 		    sizeof(opton)))
 			err(1, "setsockopt(IPV6_RECVRTHDR)");
 #else  /* old adv. API */
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_RTHDR, &opton,
+		if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RTHDR, &opton,
 		    sizeof(opton)))
 			err(1, "setsockopt(IPV6_RTHDR)");
 #endif
@@ -849,7 +876,7 @@ main(int argc, char *argv[])
 /*
 	optval = 1;
 	if (IN6_IS_ADDR_MULTICAST(&dst.sin6_addr))
-		if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
+		if (setsockopt(ssend, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
 		    &optval, sizeof(optval)) == -1)
 			err(1, "IPV6_MULTICAST_LOOP");
 */
@@ -916,7 +943,7 @@ main(int argc, char *argv[])
 			memset(&hints, 0, sizeof(hints));
 			hints.ai_family = AF_INET6;
 
-			if ((error = getaddrinfo(argv[hops], NULL, &hints,
+			if ((error = cap_getaddrinfo(capdns, argv[hops], NULL, &hints,
 			    &res)))
 				errx(1, "%s", gai_strerror(error));
 			if (res->ai_addr->sa_family != AF_INET6)
@@ -931,6 +958,15 @@ main(int argc, char *argv[])
 		scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
 	}
 
+	/* From now on we will use only reverse DNS lookups. */
+	if (capdns != NULL) {
+		const char *types[1];
+
+		types[0] = "ADDR2NAME";
+		if (cap_dns_type_limit(capdns, types, nitems(types)) < 0)
+			err(1, "unable to limit access to system.dns service");
+	}
+
 	if (!(options & F_SRCADDR)) {
 		/*
 		 * get the source address. XXX since we revoked the root
@@ -976,14 +1012,36 @@ main(int argc, char *argv[])
 		close(dummy);
 	}
 
+	if (connect(ssend, (struct sockaddr *)&dst, sizeof(dst)) != 0)
+		err(1, "connect() ssend");
+
+	caph_cache_catpages();
+	if (caph_enter_casper() < 0)
+		err(1, "caph_enter_casper");
+
+	cap_rights_init(&rights_stdin);
+	if (cap_rights_limit(STDIN_FILENO, &rights_stdin) < 0)
+		err(1, "cap_rights_limit stdin");
+	if (caph_limit_stdout() < 0)
+		err(1, "caph_limit_stdout");
+	if (caph_limit_stderr() < 0)
+		err(1, "caph_limit_stderr");
+
+	cap_rights_init(&rights_srecv, CAP_RECV, CAP_EVENT, CAP_SETSOCKOPT);
+	if (caph_rights_limit(srecv, &rights_srecv) < 0)
+		err(1, "cap_rights_limit srecv");
+	cap_rights_init(&rights_ssend, CAP_SEND, CAP_SETSOCKOPT);
+	if (caph_rights_limit(ssend, &rights_ssend) < 0)
+		err(1, "cap_rights_limit ssend");
+
 #if defined(SO_SNDBUF) && defined(SO_RCVBUF)
 	if (sockbufsize) {
 		if (datalen > (size_t)sockbufsize)
 			warnx("you need -b to increase socket buffer size");
-		if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sockbufsize,
+		if (setsockopt(ssend, SOL_SOCKET, SO_SNDBUF, &sockbufsize,
 		    sizeof(sockbufsize)) < 0)
 			err(1, "setsockopt(SO_SNDBUF)");
-		if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &sockbufsize,
+		if (setsockopt(srecv, SOL_SOCKET, SO_RCVBUF, &sockbufsize,
 		    sizeof(sockbufsize)) < 0)
 			err(1, "setsockopt(SO_RCVBUF)");
 	}
@@ -997,7 +1055,7 @@ main(int argc, char *argv[])
 		 * to get some stuff for /etc/ethers.
 		 */
 		hold = 48 * 1024;
-		setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&hold,
+		setsockopt(srecv, SOL_SOCKET, SO_RCVBUF, (char *)&hold,
 		    sizeof(hold));
 	}
 #endif
@@ -1005,25 +1063,32 @@ main(int argc, char *argv[])
 	optval = 1;
 #ifndef USE_SIN6_SCOPE_ID
 #ifdef IPV6_RECVPKTINFO
-	if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &optval,
+	if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVPKTINFO, &optval,
 	    sizeof(optval)) < 0)
 		warn("setsockopt(IPV6_RECVPKTINFO)"); /* XXX err? */
 #else  /* old adv. API */
-	if (setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, &optval,
+	if (setsockopt(srecv, IPPROTO_IPV6, IPV6_PKTINFO, &optval,
 	    sizeof(optval)) < 0)
 		warn("setsockopt(IPV6_PKTINFO)"); /* XXX err? */
 #endif
 #endif /* USE_SIN6_SCOPE_ID */
 #ifdef IPV6_RECVHOPLIMIT
-	if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &optval,
+	if (setsockopt(srecv, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &optval,
 	    sizeof(optval)) < 0)
 		warn("setsockopt(IPV6_RECVHOPLIMIT)"); /* XXX err? */
 #else  /* old adv. API */
-	if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
+	if (setsockopt(srecv, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
 	    sizeof(optval)) < 0)
 		warn("setsockopt(IPV6_HOPLIMIT)"); /* XXX err? */
 #endif
 
+	cap_rights_clear(&rights_srecv, CAP_SETSOCKOPT);
+	if (caph_rights_limit(srecv, &rights_srecv) < 0)
+		err(1, "cap_rights_limit srecv setsockopt");
+	cap_rights_clear(&rights_ssend, CAP_SETSOCKOPT);
+	if (caph_rights_limit(ssend, &rights_ssend) < 0)
+		err(1, "cap_rights_limit ssend setsockopt");
+
 	printf("PING6(%lu=40+8+%lu bytes) ", (unsigned long)(40 + pingerlen()),
 	    (unsigned long)(pingerlen() - 8));
 	printf("%s --> ", pr_addr((struct sockaddr *)&src, sizeof(src)));
@@ -1081,7 +1146,7 @@ main(int argc, char *argv[])
 		}
 #endif
 		FD_ZERO(&rfds);
-		FD_SET(s, &rfds);
+		FD_SET(srecv, &rfds);
 		gettimeofday(&now, NULL);
 		timeout.tv_sec = last.tv_sec + intvl.tv_sec - now.tv_sec;
 		timeout.tv_usec = last.tv_usec + intvl.tv_usec - now.tv_usec;
@@ -1096,7 +1161,7 @@ main(int argc, char *argv[])
 		if (timeout.tv_sec < 0)
 			timeout.tv_sec = timeout.tv_usec = 0;
 
-		n = select(s + 1, &rfds, NULL, NULL, &timeout);
+		n = select(srecv + 1, &rfds, NULL, NULL, &timeout);
 		if (n < 0)
 			continue;	/* EINTR */
 		if (n == 1) {
@@ -1111,7 +1176,7 @@ main(int argc, char *argv[])
 			m.msg_control = (void *)cm;
 			m.msg_controllen = CONTROLLEN;
 
-			cc = recvmsg(s, &m, 0);
+			cc = recvmsg(srecv, &m, 0);
 			if (cc < 0) {
 				if (errno != EINTR) {
 					warn("recvmsg");
@@ -1325,15 +1390,13 @@ pinger(void)
 		errx(1, "internal error; length mismatch");
 #endif
 
-	smsghdr.msg_name = (caddr_t)&dst;
-	smsghdr.msg_namelen = sizeof(dst);
 	memset(&iov, 0, sizeof(iov));
 	iov[0].iov_base = (caddr_t)outpack;
 	iov[0].iov_len = cc;
 	smsghdr.msg_iov = iov;
 	smsghdr.msg_iovlen = 1;
 
-	i = sendmsg(s, &smsghdr, 0);
+	i = sendmsg(ssend, &smsghdr, 0);
 
 	if (i < 0 || i != cc)  {
 		if (i < 0)
@@ -2497,7 +2560,8 @@ pr_addr(struct sockaddr *addr, int addrlen)
 	if ((options & F_HOSTNAME) == 0)
 		flag |= NI_NUMERICHOST;
 
-	if (getnameinfo(addr, addrlen, buf, sizeof(buf), NULL, 0, flag) == 0)
+	if (cap_getnameinfo(capdns, addr, addrlen, buf, sizeof(buf), NULL, 0,
+		flag) == 0)
 		return (buf);
 	else
 		return "?";
@@ -2631,7 +2695,7 @@ setpolicy(int so __unused, char *policy)
 	buf = ipsec_set_policy(policy, strlen(policy));
 	if (buf == NULL)
 		errx(1, "%s", ipsec_strerror());
-	if (setsockopt(s, IPPROTO_IPV6, IPV6_IPSEC_POLICY, buf,
+	if (setsockopt(ssend, IPPROTO_IPV6, IPV6_IPSEC_POLICY, buf,
 	    ipsec_get_policylen(buf)) < 0)
 		warnx("Unable to set IPsec policy");
 	free(buf);
@@ -2727,4 +2791,30 @@ usage(void)
 	    "[-x waittime]\n"
 	    "             [-X timeout] [hops ...] host\n");
 	exit(1);
+}
+
+static cap_channel_t *
+capdns_setup(void)
+{
+	cap_channel_t *capcas, *capdnsloc;
+	const char *types[2];
+	int families[1];
+
+	capcas = cap_init();
+	if (capcas == NULL)
+		err(1, "unable to create casper process");
+	capdnsloc = cap_service_open(capcas, "system.dns");
+	/* Casper capability no longer needed. */
+	cap_close(capcas);
+	if (capdnsloc == NULL)
+		err(1, "unable to open system.dns service");
+	types[0] = "NAME2ADDR";
+	types[1] = "ADDR2NAME";
+	if (cap_dns_type_limit(capdnsloc, types, nitems(types)) < 0)
+		err(1, "unable to limit access to system.dns service");
+	families[0] = AF_INET6;
+	if (cap_dns_family_limit(capdnsloc, families, nitems(families)) < 0)
+		err(1, "unable to limit access to system.dns service");
+
+	return (capdnsloc);
 }

From owner-svn-src-head@freebsd.org  Sat Aug  3 14:42:08 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51CF9B2EF7;
 Sat,  3 Aug 2019 14:42:08 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4616Dw1VQ6z4Mr0;
 Sat,  3 Aug 2019 14:42:08 +0000 (UTC) (envelope-from gnn@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1596E1C8BD;
 Sat,  3 Aug 2019 14:42:08 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x73Eg7id063659;
 Sat, 3 Aug 2019 14:42:07 GMT (envelope-from gnn@FreeBSD.org)
Received: (from gnn@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73Eg7wA063658;
 Sat, 3 Aug 2019 14:42:07 GMT (envelope-from gnn@FreeBSD.org)
Message-Id: <201908031442.x73Eg7wA063658@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org
 using -f
From: "George V. Neville-Neil" <gnn@FreeBSD.org>
Date: Sat, 3 Aug 2019 14:42:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350557 - head/sys/net
X-SVN-Group: head
X-SVN-Commit-Author: gnn
X-SVN-Commit-Paths: head/sys/net
X-SVN-Commit-Revision: 350557
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 14:42:08 -0000

Author: gnn
Date: Sat Aug  3 14:42:07 2019
New Revision: 350557
URL: https://svnweb.freebsd.org/changeset/base/350557

Log:
  Properly validte arguments for route deletion
  
  Reported by: Liang Zhuo brightiup.zhuo@gmail.com
  MFC after:	1 week

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Sat Aug  3 13:53:14 2019	(r350556)
+++ head/sys/net/route.c	Sat Aug  3 14:42:07 2019	(r350557)
@@ -1590,6 +1590,8 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru
 	switch (req) {
 	case RTM_DELETE:
 		if (netmask) {
+			if (dst->sa_len > sizeof(mdst))
+				return (EINVAL);
 			rt_maskedcopy(dst, (struct sockaddr *)&mdst, netmask);
 			dst = (struct sockaddr *)&mdst;
 		}

From owner-svn-src-head@freebsd.org  Sat Aug  3 16:13:44 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B820FB4A4B;
 Sat,  3 Aug 2019 16:13:44 +0000 (UTC)
 (envelope-from takawata@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4618Gc4Rvtz4Qyw;
 Sat,  3 Aug 2019 16:13:44 +0000 (UTC)
 (envelope-from takawata@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B5951D92C;
 Sat,  3 Aug 2019 16:13:44 +0000 (UTC)
 (envelope-from takawata@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x73GDiHN016472;
 Sat, 3 Aug 2019 16:13:44 GMT (envelope-from takawata@FreeBSD.org)
Received: (from takawata@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73GDiSj016471;
 Sat, 3 Aug 2019 16:13:44 GMT (envelope-from takawata@FreeBSD.org)
Message-Id: <201908031613.x73GDiSj016471@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: takawata set sender to
 takawata@FreeBSD.org using -f
From: Takanori Watanabe <takawata@FreeBSD.org>
Date: Sat, 3 Aug 2019 16:13:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350558 - head/sys/dev/usb
X-SVN-Group: head
X-SVN-Commit-Author: takawata
X-SVN-Commit-Paths: head/sys/dev/usb
X-SVN-Commit-Revision: 350558
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 16:13:44 -0000

Author: takawata
Date: Sat Aug  3 16:13:44 2019
New Revision: 350558
URL: https://svnweb.freebsd.org/changeset/base/350558

Log:
  Add per hub sysctl to expose port information for phyisical form etc.
  
  Reviewed by:hselasky
  Differential Revision:	https://reviews.freebsd.org/D20865

Modified:
  head/sys/dev/usb/usb_hub_acpi.c

Modified: head/sys/dev/usb/usb_hub_acpi.c
==============================================================================
--- head/sys/dev/usb/usb_hub_acpi.c	Sat Aug  3 14:42:07 2019	(r350557)
+++ head/sys/dev/usb/usb_hub_acpi.c	Sat Aug  3 16:13:44 2019	(r350558)
@@ -79,11 +79,22 @@
 #include <contrib/dev/acpica/include/acpi.h>
 #include <contrib/dev/acpica/include/accommon.h>
 #include <dev/acpica/acpivar.h>
+#include <sys/sbuf.h>
 
+#define ACPI_PLD_SIZE 20
+struct acpi_uhub_port {
+	ACPI_HANDLE handle;
+#define    ACPI_UPC_CONNECTABLE 0x80000000
+#define    ACPI_UPC_PORTTYPE(x) ((x)&0xff)
+	uint32_t upc;
+	uint8_t	pld[ACPI_PLD_SIZE];
+};
+
 struct acpi_uhub_softc {
 	struct uhub_softc usc;
 	uint8_t	nports;
-	ACPI_HANDLE *porthandle;
+	ACPI_HANDLE ah;
+	struct acpi_uhub_port *port;
 };
 
 static UINT32
@@ -107,51 +118,157 @@ acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *
 	return (ret);
 }
 
+static const char *
+acpi_uhub_upc_type(uint8_t type)
+{
+	const char *typelist[] = {"TypeA", "MiniAB", "Express",
+				  "USB3-A", "USB3-B", "USB-MicroB",
+				  "USB3-MicroAB", "USB3-PowerB",
+				  "TypeC-USB2", "TypeC-Switch",
+				  "TypeC-nonSwitch"};
+	const int last = sizeof(typelist) / sizeof(typelist[0]);
+
+	if (type == 0xff) {
+		return "Proprietary";
+	}
+
+	return (type < last) ? typelist[type] : "Unknown";
+}
+
 static int
-acpi_uhub_parse_upc(device_t dev, unsigned int port, ACPI_HANDLE ah)
+acpi_uhub_parse_upc(device_t dev, unsigned int p, ACPI_HANDLE ah, struct sysctl_oid_list *poid)
 {
 	ACPI_BUFFER buf;
+	struct acpi_uhub_softc *sc = device_get_softc(dev);
+	struct acpi_uhub_port *port = &sc->port[p - 1];
 
 	buf.Pointer = NULL;
 	buf.Length = ACPI_ALLOCATE_BUFFER;
 
 	if (AcpiEvaluateObject(ah, "_UPC", NULL, &buf) == AE_OK) {
-		UINT64 porttypenum, conn;
-		const char *connectable;
-		const char *typelist[] = {
-			"TypeA", "MiniAB", "Express",
-			"USB3-A", "USB3-B", "USB-MicroB",
-			"USB3-MicroAB", "USB3-PowerB",
-			"TypeC-USB2", "TypeC-Switch",
-			"TypeC-nonSwitch"
-		};
-		const char *porttype;
-		const int last = sizeof(typelist) / sizeof(typelist[0]);
 		ACPI_OBJECT *obj = buf.Pointer;
+		UINT64 porttypenum, conn;
+		uint8_t *connectable;
 
 		acpi_PkgInt(obj, 0, &conn);
 		acpi_PkgInt(obj, 1, &porttypenum);
 		connectable = conn ? "" : "non";
-		if (porttypenum == 0xff)
-			porttype = "Proprietary";
-		else if (porttypenum < last) {
-			porttype = typelist[porttypenum];
-		} else {
-			porttype = "Unknown";
-		}
+
+		port->upc = porttypenum;
+		port->upc |= (conn) ? (ACPI_UPC_CONNECTABLE) : 0;
+
 		if (usb_debug)
 			device_printf(dev, "Port %u %sconnectable %s\n",
-			    port, connectable, porttype);
+			    p, connectable,
+			    acpi_uhub_upc_type(porttypenum));
+
+		SYSCTL_ADD_U32(
+		    device_get_sysctl_ctx(dev),
+		    poid, OID_AUTO,
+		    "upc",
+		    CTLFLAG_RD | CTLFLAG_MPSAFE,
+		    SYSCTL_NULL_U32_PTR, port->upc,
+		    "UPC value. MSB is visible flag");
 	}
 	AcpiOsFree(buf.Pointer);
 
 	return (0);
 }
+static int
+acpi_uhub_port_sysctl(SYSCTL_HANDLER_ARGS)
+{
+	struct acpi_uhub_port *port = oidp->oid_arg1;
+	struct sbuf sb;
+	int error;
 
+	sbuf_new_for_sysctl(&sb, NULL, 256, req);
+	sbuf_printf(&sb, "Handle %s\n", acpi_name(port->handle));
+	if (port->upc == 0xffffffff) {
+		sbuf_printf(&sb, "\tNo information\n");
+		goto end;
+	}
+	sbuf_printf(&sb, "\t");
+	if (port->upc & ACPI_UPC_CONNECTABLE) {
+		sbuf_printf(&sb, "Connectable ");
+	}
+	sbuf_printf(&sb, "%s port\n", acpi_uhub_upc_type(port->upc & 0xff));
+
+	if ((port->pld[0] & 0x80) == 0) {
+		sbuf_printf(&sb,
+		    "\tColor:#%02x%02x%02x\n",
+		    port->pld[1], port->pld[2],
+		    port->pld[3]);
+	}
+	sbuf_printf(&sb, "\tWidth %d mm Height %d mm\n",
+	    port->pld[4] | (port->pld[5] << 8),
+	    port->pld[6] | (port->pld[7] << 8));
+	if (port->pld[8] & 1) {
+		sbuf_printf(&sb, "\tVisible\n");
+	}
+	if (port->pld[8] & 2) {
+		sbuf_printf(&sb, "\tDock\n");
+	}
+	if (port->pld[8] & 4) {
+		sbuf_printf(&sb, "\tLid\n");
+	} {
+		int panelpos = (port->pld[8] >> 3) & 7;
+		const char *panposstr[] = {"Top", "Bottom", "Left",
+					   "Right", "Front", "Back",
+					   "Unknown", "Invalid"};
+		const char *shapestr[] = {
+			"Round", "Oval", "Square", "VRect", "HRect",
+			"VTrape", "HTrape", "Unknown", "Chamferd",
+			"Rsvd", "Rsvd", "Rsvd", "Rsvd",
+			"Rsvd", "Rsvd", "Rsvd", "Rsvd"};
+
+		sbuf_printf(&sb, "\tPanelPosition: %s\n", panposstr[panelpos]);
+		if (panelpos < 6) {
+			const char *posstr[] = {"Upper", "Center",
+			"Lower", "Invalid"};
+
+			sbuf_printf(&sb, "\tVertPosition: %s\n",
+			    posstr[(port->pld[8] >> 6) & 3]);
+			sbuf_printf(&sb, "\tHorizPosition: %s\n",
+			    posstr[(port->pld[9]) & 3]);
+
+
+		}
+		sbuf_printf(&sb, "\tShape: %s\n",
+		    shapestr[(port->pld[9] >> 2) & 0xf]);
+		sbuf_printf(&sb, "\tGroup Orientation %s\n",
+		    ((port->pld[9] >> 6) & 1) ? "Vertical" :
+		    "Horizontal");
+		sbuf_printf(&sb, "\tGroupToken %x\n",
+		    ((port->pld[9] >> 7)
+		    | (port->pld[10] << 1)) & 0xff);
+		sbuf_printf(&sb, "\tGroupPosition %x\n",
+		    ((port->pld[10] >> 7)
+		    | (port->pld[11] << 1)) & 0xff);
+		sbuf_printf(&sb, "\t%s %s %s\n",
+		    (port->pld[11] & 0x80) ?
+		    "Bay" : "",
+		    (port->pld[12] & 1) ? "Eject" : "",
+		    (port->pld[12] & 2) ? "OSPM" : ""
+		    );
+	}
+	if ((port->pld[0] & 0x7f) >= 2) {
+		sbuf_printf(&sb, "\tVOFF%d mm HOFF %dmm",
+		    port->pld[16] | (port->pld[17] << 8),
+		    port->pld[18] | (port->pld[19] << 8));
+	}
+
+end:
+	error = sbuf_finish(&sb);
+	sbuf_delete(&sb);
+	return (error);
+}
+
 static int
-acpi_uhub_parse_pld(device_t dev, unsigned int port, ACPI_HANDLE ah)
+acpi_uhub_parse_pld(device_t dev, unsigned int p, ACPI_HANDLE ah, struct sysctl_oid_list *tree)
 {
 	ACPI_BUFFER buf;
+	struct acpi_uhub_softc *sc = device_get_softc(dev);
+	struct acpi_uhub_port *port = &sc->port[p - 1];
 
 	buf.Pointer = NULL;
 	buf.Length = ACPI_ALLOCATE_BUFFER;
@@ -176,6 +293,13 @@ acpi_uhub_parse_pld(device_t dev, unsigned int port, A
 		} else {
 			goto skip;
 		}
+		len = (len < ACPI_PLD_SIZE) ? len : ACPI_PLD_SIZE;
+		memcpy(port->pld, resbuf, len);
+		SYSCTL_ADD_OPAQUE(
+		    device_get_sysctl_ctx(dev), tree, OID_AUTO,
+		    "pldraw", CTLFLAG_RD | CTLFLAG_MPSAFE,
+		    port->pld, len, "A", "Raw PLD value");
+
 		if (usb_debug) {
 			device_printf(dev, "Revision:%d\n",
 			    resbuf[0] & 0x7f);
@@ -252,9 +376,28 @@ acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, 
 		if ((devinfo->Valid & ACPI_VALID_ADR) &&
 		    (devinfo->Address > 0) &&
 		    (devinfo->Address <= (uint64_t)sc->nports)) {
-			sc->porthandle[devinfo->Address - 1] = ah;
-			acpi_uhub_parse_upc(dev, devinfo->Address, ah);
-			acpi_uhub_parse_pld(dev, devinfo->Address, ah);
+			char buf[] = "portXXX";
+			struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
+			struct sysctl_oid *oid;
+			struct sysctl_oid_list *tree;
+			
+			snprintf(buf, sizeof(buf), "port%lu", devinfo->Address);
+			oid = SYSCTL_ADD_NODE(ctx,
+					      SYSCTL_CHILDREN(
+						      device_get_sysctl_tree(dev)),
+					      OID_AUTO, buf, CTLFLAG_RD,
+					      NULL, "port nodes");
+			tree = SYSCTL_CHILDREN(oid);
+			sc->port[devinfo->Address - 1].handle = ah;
+			sc->port[devinfo->Address - 1].upc = 0xffffffff;
+			acpi_uhub_parse_upc(dev, devinfo->Address, ah, tree);
+			acpi_uhub_parse_pld(dev, devinfo->Address, ah, tree);
+			SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+					tree, OID_AUTO, "info",
+					CTLTYPE_STRING | CTLFLAG_RD,
+					&sc->port[devinfo->Address - 1], 0,
+					acpi_uhub_port_sysctl,
+					"A", "Port information");
 		}
 		AcpiOsFree(devinfo);
 	}
@@ -306,53 +449,76 @@ acpi_uhub_probe(device_t dev)
 	}
 	return (ENXIO);
 }
-
 static int
-acpi_uhub_root_attach(device_t dev)
+acpi_uhub_attach_common(device_t dev)
 {
+	struct usb_hub *uh;
 	struct acpi_uhub_softc *sc = device_get_softc(dev);
 	ACPI_STATUS status;
-	ACPI_HANDLE ah;
-	int ret;
+	int ret = ENXIO;
 
-	ret = uhub_attach(dev);
-	if (ret != 0)
-		goto done;
+	uh = sc->usc.sc_udev->hub;
+	sc->nports = uh->nports;
+	sc->port = malloc(sizeof(struct acpi_uhub_port) * uh->nports,
+	    M_USBDEV, M_WAITOK | M_ZERO);
+	status = acpi_usb_hub_port_probe(dev, sc->ah);
 
-	status = acpi_uhub_find_rh(dev, &ah);
-	if (ACPI_SUCCESS(status) && ah != NULL) {
-		struct usb_hub *uh = sc->usc.sc_udev->hub;
+	if (ACPI_SUCCESS(status)){
+		ret = 0;
+	} 
 
-		sc->nports = uh->nports;
-		sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports,
-		    M_USBDEV, M_WAITOK | M_ZERO);
-		acpi_usb_hub_port_probe(dev, ah);
-	}
-done:
 	return (ret);
 }
 
 static int
-acpi_uhub_attach(device_t dev)
+acpi_uhub_detach(device_t dev)
 {
 	struct acpi_uhub_softc *sc = device_get_softc(dev);
-	ACPI_HANDLE ah;
+
+	free(sc->port, M_USBDEV);
+
+	return (uhub_detach(dev));
+}
+
+static int
+acpi_uhub_root_attach(device_t dev)
+{
 	int ret;
+	struct acpi_uhub_softc *sc = device_get_softc(dev);
 
-	ret = uhub_attach(dev);
-	if (ret != 0)
-		goto done;
+	if (ACPI_FAILURE(acpi_uhub_find_rh(dev, &sc->ah)) ||
+	    (sc->ah == NULL)) {
+		return (ENXIO);
+	}
+	if ((ret = uhub_attach(dev)) != 0) {
+		return (ret);
+	}
+	
+	if ((ret = acpi_uhub_attach_common(dev)) != 0) {
+		acpi_uhub_detach(dev);
+	}
+	return ret;
+}
 
-	ah = acpi_get_handle(dev);
-	if (ah != NULL) {
-		struct usb_hub *uh = sc->usc.sc_udev->hub;
+static int
+acpi_uhub_attach(device_t dev)
+{
+	int ret;
+	struct acpi_uhub_softc *sc = device_get_softc(dev);
 
-		sc->nports = uh->nports;
-		sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports,
-		    M_USBDEV, M_WAITOK | M_ZERO);
-		acpi_usb_hub_port_probe(dev, ah);
+	sc->ah = acpi_get_handle(dev);
+
+	if (sc->ah == NULL) {
+		return (ENXIO);
 	}
-done:
+	if ((ret = uhub_attach(dev)) != 0) {
+		return (ret);
+	}
+
+	if ((ret = acpi_uhub_attach_common(dev)) != 0) {
+		acpi_uhub_detach(dev);
+	}
+
 	return (ret);
 }
 
@@ -370,7 +536,7 @@ acpi_uhub_read_ivar(device_t dev, device_t child, int 
 	if ((idx == ACPI_IVAR_HANDLE) &&
 	    (hres.portno > 0) &&
 	    (hres.portno <= sc->nports) &&
-	    (ah = sc->porthandle[hres.portno - 1])) {
+	    (ah = sc->port[hres.portno - 1].handle)) {
 		*res = (uintptr_t)ah;
 		return (0);
 	}
@@ -393,15 +559,6 @@ acpi_uhub_child_location_string(device_t parent, devic
 	return (0);
 }
 
-static int
-acpi_uhub_detach(device_t dev)
-{
-	struct acpi_uhub_softc *sc = device_get_softc(dev);
-
-	free(sc->porthandle, M_USBDEV);
-
-	return (uhub_detach(dev));
-}
 
 static device_method_t acpi_uhub_methods[] = {
 	DEVMETHOD(device_probe, acpi_uhub_probe),

From owner-svn-src-head@freebsd.org  Sat Aug  3 16:57:15 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7917AB5297;
 Sat,  3 Aug 2019 16:57:15 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4619Dq2Qs6z4SJy;
 Sat,  3 Aug 2019 16:57:15 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3509E1E053;
 Sat,  3 Aug 2019 16:57:15 +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 x73GvFPZ039798;
 Sat, 3 Aug 2019 16:57:15 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73GvFEU039797;
 Sat, 3 Aug 2019 16:57:15 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201908031657.x73GvFEU039797@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sat, 3 Aug 2019 16:57:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350560 - head/sys/amd64/vmm/io
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/amd64/vmm/io
X-SVN-Commit-Revision: 350560
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 16:57:15 -0000

Author: kib
Date: Sat Aug  3 16:57:14 2019
New Revision: 350560
URL: https://svnweb.freebsd.org/changeset/base/350560

Log:
  bhyve: Ignore MSI/MSI-X interrupts sent to non-active vCPUs in
  physical destination mode.
  
  This is mostly a nop, because the vmm initializes all vCPUs up to
  vm_maxcpus, so even if the target CPU is not active, lapic/vlapic code
  still has the valid data to use.  As John notes, dropping such
  interrupts more closely matches the real harware, which ignores all
  interrupts for not started APs.
  
  Reviewed by:	jhb
  admbugs:	837
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/amd64/vmm/io/vlapic.c

Modified: head/sys/amd64/vmm/io/vlapic.c
==============================================================================
--- head/sys/amd64/vmm/io/vlapic.c	Sat Aug  3 16:56:44 2019	(r350559)
+++ head/sys/amd64/vmm/io/vlapic.c	Sat Aug  3 16:57:14 2019	(r350560)
@@ -838,7 +838,8 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32
 		 */
 		CPU_ZERO(dmask);
 		vcpuid = vm_apicid2vcpuid(vm, dest);
-		if (vcpuid < vm_get_maxcpus(vm))
+		amask = vm_active_cpus(vm);
+		if (vcpuid < vm_get_maxcpus(vm) && CPU_ISSET(vcpuid, &amask))
 			CPU_SET(vcpuid, dmask);
 	} else {
 		/*

From owner-svn-src-head@freebsd.org  Sat Aug  3 16:56:45 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DA7EB528A;
 Sat,  3 Aug 2019 16:56:45 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4619DF3gdVz4SDn;
 Sat,  3 Aug 2019 16:56:45 +0000 (UTC) (envelope-from bz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FBC41E052;
 Sat,  3 Aug 2019 16:56:45 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x73GujVU039725;
 Sat, 3 Aug 2019 16:56:45 GMT (envelope-from bz@FreeBSD.org)
Received: (from bz@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73GujW2039724;
 Sat, 3 Aug 2019 16:56:45 GMT (envelope-from bz@FreeBSD.org)
Message-Id: <201908031656.x73GujW2039724@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org
 using -f
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sat, 3 Aug 2019 16:56:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350559 - head/sys/netinet6
X-SVN-Group: head
X-SVN-Commit-Author: bz
X-SVN-Commit-Paths: head/sys/netinet6
X-SVN-Commit-Revision: 350559
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 16:56:45 -0000

Author: bz
Date: Sat Aug  3 16:56:44 2019
New Revision: 350559
URL: https://svnweb.freebsd.org/changeset/base/350559

Log:
  frag6.c: fix includes
  
  Bring back systm.h after r350532 and banish errno.h, time.h, and
  machine/atomic.h.
  
  Reported by:	bde (Thank you!)
  Pointyhat to:	bz
  MFC after:	12 weeks
  X-MFC:		with r350532
  Sponsored by:	Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Sat Aug  3 16:13:44 2019	(r350558)
+++ head/sys/netinet6/frag6.c	Sat Aug  3 16:56:44 2019	(r350559)
@@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$");
 #include "opt_rss.h"
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/domain.h>
-#include <sys/errno.h>
 #include <sys/eventhandler.h>
 #include <sys/hash.h>
 #include <sys/kernel.h>
@@ -46,11 +46,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/mbuf.h>
 #include <sys/protosw.h>
 #include <sys/socket.h>
-#include <sys/time.h>
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
-
-#include <machine/atomic.h>
 
 #include <net/if.h>
 #include <net/if_var.h>

From owner-svn-src-head@freebsd.org  Sat Aug  3 17:07:05 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE5E4B57FB;
 Sat,  3 Aug 2019 17:07:05 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4619S95WkSz4Sqr;
 Sat,  3 Aug 2019 17:07:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B8911E21A;
 Sat,  3 Aug 2019 17:07: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 x73H75wI045857;
 Sat, 3 Aug 2019 17:07:05 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73H75b3045855;
 Sat, 3 Aug 2019 17:07:05 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201908031707.x73H75b3045855@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sat, 3 Aug 2019 17:07:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350561 - in head/sys/amd64: amd64 include
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: in head/sys/amd64: amd64 include
X-SVN-Commit-Revision: 350561
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 17:07:05 -0000

Author: kib
Date: Sat Aug  3 17:07:04 2019
New Revision: 350561
URL: https://svnweb.freebsd.org/changeset/base/350561

Log:
  amd64: Streamline exceptions and interrupts handlers.
  
  PTI-mode entry points were coded to set up the environment identical
  to non-PTI entry and then fall-through to non-PTI handlers, mostly.
  This has the drawback of requiring two more SWAPGS, first to access
  PCPU, and then to return to the state expected by the non-PTI entry
  point.
  
  Eliminate the duplication by doing more in entry stubs both for PTI
  and non-PTI, and adjusting the common code to expect that SWAPGS and
  some minimal registers saving is done by entries.
  
  Some less often used entries, in particular, #GP, #NP, and #SS, which
  can fault on doreti, are left as is because there are basically four
  variants of entrance, and they are not performance-critical,
  esp. comparing with e.g. #PF or interrupts.
  
  Reviewed by:	markj (previous version)
  Tested by:	pho (previous version)
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/amd64/amd64/exception.S
  head/sys/amd64/include/asmacros.h

Modified: head/sys/amd64/amd64/exception.S
==============================================================================
--- head/sys/amd64/amd64/exception.S	Sat Aug  3 16:57:14 2019	(r350560)
+++ head/sys/amd64/amd64/exception.S	Sat Aug  3 17:07:04 2019	(r350561)
@@ -105,14 +105,31 @@ MCOUNT_LABEL(btrap)
 
 /* Traps that we leave interrupts disabled for. */
 	.macro	TRAP_NOEN	l, trapno
-	PTI_ENTRY	\l,X\l
+	PTI_ENTRY	\l,\l\()_pti_k,\l\()_pti_u
+\l\()_pti_k:
+	subq	$TF_RIP,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	movq	$0,TF_ERR(%rsp)
+	jmp	alltraps_noen_k
+\l\()_pti_u:
+	subq	$TF_RIP,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	movq	$0,TF_ERR(%rsp)
+	jmp	alltraps_noen_u
+	
 	.globl	X\l
 	.type	X\l,@function
-X\l:	subq $TF_RIP,%rsp
-	movl $\trapno,TF_TRAPNO(%rsp)
-	movq $0,TF_ADDR(%rsp)
-	movq $0,TF_ERR(%rsp)
-	jmp alltraps_noen
+X\l:
+	subq	$TF_RIP,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	movq	$0,TF_ERR(%rsp)
+	testb	$SEL_RPL_MASK,TF_CS(%rsp)
+	jz	alltraps_noen_k
+	swapgs
+	jmp	alltraps_noen_u
 	.endm
 
 	TRAP_NOEN	bpt, T_BPTFLT
@@ -122,15 +139,31 @@ X\l:	subq $TF_RIP,%rsp
 
 /* Regular traps; The cpu does not supply tf_err for these. */
 	.macro	TRAP	l, trapno
-	PTI_ENTRY	\l,X\l
+	PTI_ENTRY	\l,\l\()_pti_k,\l\()_pti_u
+\l\()_pti_k:
+	subq	$TF_RIP,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	movq	$0,TF_ERR(%rsp)
+	jmp	alltraps_k
+\l\()_pti_u:
+	subq	$TF_RIP,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	movq	$0,TF_ERR(%rsp)
+	jmp	alltraps_u
+
 	.globl	X\l
 	.type	X\l,@function
 X\l:
-	subq $TF_RIP,%rsp
-	movl $\trapno,TF_TRAPNO(%rsp)
-	movq $0,TF_ADDR(%rsp)
-	movq $0,TF_ERR(%rsp)
-	jmp alltraps
+	subq	$TF_RIP,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	movq	$0,TF_ERR(%rsp)
+	testb	$SEL_RPL_MASK,TF_CS(%rsp)
+	jz	alltraps_k
+	swapgs
+	jmp	alltraps_u
 	.endm
 
 	TRAP	div, T_DIVIDE
@@ -145,42 +178,62 @@ X\l:
 
 /* This group of traps have tf_err already pushed by the cpu. */
 	.macro	TRAP_ERR	l, trapno
-	PTI_ENTRY	\l,X\l,has_err=1
+	PTI_ENTRY	\l,\l\()_pti_k,\l\()_pti_u,has_err=1
+\l\()_pti_k:
+	subq	$TF_ERR,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	jmp	alltraps_k
+\l\()_pti_u:
+	subq	$TF_ERR,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	jmp	alltraps_u
 	.globl	X\l
 	.type	X\l,@function
 X\l:
-	subq $TF_ERR,%rsp
-	movl $\trapno,TF_TRAPNO(%rsp)
-	movq $0,TF_ADDR(%rsp)
-	jmp alltraps
+	subq	$TF_ERR,%rsp
+	movl	$\trapno,TF_TRAPNO(%rsp)
+	movq	$0,TF_ADDR(%rsp)
+	testb	$SEL_RPL_MASK,TF_CS(%rsp)
+	jz	alltraps_k
+	swapgs
+	jmp	alltraps_u
 	.endm
 
 	TRAP_ERR	tss, T_TSSFLT
 	TRAP_ERR	align, T_ALIGNFLT
 
 	/*
-	 * alltraps entry point.  Use swapgs if this is the first time in the
-	 * kernel from userland.  Reenable interrupts if they were enabled
-	 * before the trap.  This approximates SDT_SYS386TGT on the i386 port.
+	 * alltraps_u/k entry points.
+	 * SWAPGS must be already performed by prologue,
+	 * if this is the first time in the kernel from userland.
+	 * Reenable interrupts if they were enabled before the trap.
+	 * This approximates SDT_SYS386TGT on the i386 port.
 	 */
 	SUPERALIGN_TEXT
-	.globl	alltraps
-	.type	alltraps,@function
-alltraps:
+	.globl	alltraps_u
+	.type	alltraps_u,@function
+alltraps_u:
 	movq	%rdi,TF_RDI(%rsp)
-	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
-	jz	1f		/* already running with kernel GS.base */
-	swapgs
+	movq	%rdx,TF_RDX(%rsp)
+	movq	%rax,TF_RAX(%rsp)
+	movq	%rcx,TF_RCX(%rsp)
 	movq	PCPU(CURPCB),%rdi
 	andl	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
-1:	SAVE_SEGS
+	call	handle_ibrs_entry
+	jmp	alltraps_save_segs
+	SUPERALIGN_TEXT
+	.globl	alltraps_k
+	.type	alltraps_k,@function
+alltraps_k:
+	movq	%rdi,TF_RDI(%rsp)
 	movq	%rdx,TF_RDX(%rsp)
 	movq	%rax,TF_RAX(%rsp)
 	movq	%rcx,TF_RCX(%rsp)
-	testb	$SEL_RPL_MASK,TF_CS(%rsp)
-	jz	2f
-	call	handle_ibrs_entry
-2:	testl	$PSL_I,TF_RFLAGS(%rsp)
+alltraps_save_segs:
+	SAVE_SEGS
+	testl	$PSL_I,TF_RFLAGS(%rsp)
 	jz	alltraps_pushregs_no_rax
 	sti
 alltraps_pushregs_no_rax:
@@ -234,21 +287,26 @@ calltrap:
 	jmp	doreti			/* Handle any pending ASTs */
 
 	/*
-	 * alltraps_noen entry point.  Unlike alltraps above, we want to
-	 * leave the interrupts disabled.  This corresponds to
-	 * SDT_SYS386IGT on the i386 port.
+	 * alltraps_noen_u/k entry points.
+	 * Again, SWAPGS must be already performed by prologue, if needed.
+	 * Unlike alltraps above, we want to leave the interrupts disabled.
+	 * This corresponds to SDT_SYS386IGT on the i386 port.
 	 */
 	SUPERALIGN_TEXT
-	.globl	alltraps_noen
-	.type	alltraps_noen,@function
-alltraps_noen:
+	.globl	alltraps_noen_u
+	.type	alltraps_noen_u,@function
+alltraps_noen_u:
 	movq	%rdi,TF_RDI(%rsp)
-	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
-	jz	1f /* already running with kernel GS.base */
-	swapgs
 	movq	PCPU(CURPCB),%rdi
 	andl	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
-1:	SAVE_SEGS
+	jmp	alltraps_noen_save_segs
+	SUPERALIGN_TEXT
+	.globl	alltraps_noen_k
+	.type	alltraps_noen_k,@function
+alltraps_noen_k:
+	movq	%rdi,TF_RDI(%rsp)
+alltraps_noen_save_segs:
+	SAVE_SEGS
 	movq	%rdx,TF_RDX(%rsp)
 	movq	%rax,TF_RAX(%rsp)
 	movq	%rcx,TF_RCX(%rsp)
@@ -297,8 +355,8 @@ IDTVEC(dblfault)
 
 	ALIGN_TEXT
 IDTVEC(page_pti)
-	testb	$SEL_RPL_MASK,PTI_CS-2*8(%rsp)
-	jz	Xpage
+	testb	$SEL_RPL_MASK,PTI_CS-PTI_ERR(%rsp)
+	jz	page_k
 	swapgs
 	pushq	%rax
 	movq	%cr3,%rax
@@ -306,25 +364,31 @@ IDTVEC(page_pti)
 	cmpq	$~0,PCPU(UCR3)
 	jne	1f
 	popq	%rax
-	jmp	2f
+	jmp	page_u
 1:	pushq	%rdx
 	PTI_UUENTRY has_err=1
-2:	subq	$TF_ERR,%rsp
-	movq	%rdi,TF_RDI(%rsp)
-	movq	%rax,TF_RAX(%rsp)
-	movq	%rdx,TF_RDX(%rsp)
-	movq	%rcx,TF_RCX(%rsp)
 	jmp	page_u
+	ALIGN_TEXT
 IDTVEC(page)
+	testb	$SEL_RPL_MASK,TF_CS-TF_ERR(%rsp) /* Did we come from kernel? */
+	jnz	page_u_swapgs		/* already running with kernel GS.base */
+page_k:
 	subq	$TF_ERR,%rsp
 	movq	%rdi,TF_RDI(%rsp)	/* free up GP registers */
 	movq	%rax,TF_RAX(%rsp)
 	movq	%rdx,TF_RDX(%rsp)
 	movq	%rcx,TF_RCX(%rsp)
-	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
-	jz	page_cr2		/* already running with kernel GS.base */
+	jmp	page_cr2
+	ALIGN_TEXT
+page_u_swapgs:
 	swapgs
-page_u:	movq	PCPU(CURPCB),%rdi
+page_u:
+	subq	$TF_ERR,%rsp
+	movq	%rdi,TF_RDI(%rsp)
+	movq	%rax,TF_RAX(%rsp)
+	movq	%rdx,TF_RDX(%rsp)
+	movq	%rcx,TF_RCX(%rsp)
+	movq	PCPU(CURPCB),%rdi
 	andl	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
 	movq	PCPU(SAVED_UCR3),%rax
 	movq	%rax,PCB_SAVED_UCR3(%rdi)

Modified: head/sys/amd64/include/asmacros.h
==============================================================================
--- head/sys/amd64/include/asmacros.h	Sat Aug  3 16:57:14 2019	(r350560)
+++ head/sys/amd64/include/asmacros.h	Sat Aug  3 17:07:04 2019	(r350561)
@@ -204,17 +204,16 @@
 1:
 	.endm
 
-	.macro	PTI_ENTRY name, cont, has_err=0
+	.macro	PTI_ENTRY name, contk, contu, has_err=0
 	ALIGN_TEXT
 	.globl	X\name\()_pti
 	.type	X\name\()_pti,@function
 X\name\()_pti:
-	/* %rax, %rdx and possibly err not yet pushed */
-	testb	$SEL_RPL_MASK,PTI_CS-(2+1-\has_err)*8(%rsp)
-	jz	\cont
+	/* %rax, %rdx, and possibly err are not yet pushed */
+	testb	$SEL_RPL_MASK,PTI_CS-PTI_ERR-((1-\has_err)*8)(%rsp)
+	jz	\contk
 	PTI_UENTRY \has_err
-	swapgs
-	jmp	\cont
+	jmp	\contu
 	.endm
 
 	.macro	PTI_INTRENTRY vec_name

From owner-svn-src-head@freebsd.org  Sat Aug  3 18:26:17 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 966ADB71AD;
 Sat,  3 Aug 2019 18:26:17 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 461CCY3Gh3z4Wwb;
 Sat,  3 Aug 2019 18:26:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52EDD1F08E;
 Sat,  3 Aug 2019 18:26:17 +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 x73IQH2N092847;
 Sat, 3 Aug 2019 18:26:17 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73IQHEL092846;
 Sat, 3 Aug 2019 18:26:17 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201908031826.x73IQHEL092846@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sat, 3 Aug 2019 18:26:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350562 - head/sys/dev/usb
X-SVN-Group: head
X-SVN-Commit-Author: kib
X-SVN-Commit-Paths: head/sys/dev/usb
X-SVN-Commit-Revision: 350562
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 18:26:17 -0000

Author: kib
Date: Sat Aug  3 18:26:16 2019
New Revision: 350562
URL: https://svnweb.freebsd.org/changeset/base/350562

Log:
  Fix format spec for ILP32.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/usb/usb_hub_acpi.c

Modified: head/sys/dev/usb/usb_hub_acpi.c
==============================================================================
--- head/sys/dev/usb/usb_hub_acpi.c	Sat Aug  3 17:07:04 2019	(r350561)
+++ head/sys/dev/usb/usb_hub_acpi.c	Sat Aug  3 18:26:16 2019	(r350562)
@@ -381,7 +381,8 @@ acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, 
 			struct sysctl_oid *oid;
 			struct sysctl_oid_list *tree;
 			
-			snprintf(buf, sizeof(buf), "port%lu", devinfo->Address);
+			snprintf(buf, sizeof(buf), "port%ju",
+			    (uintmax_t)devinfo->Address);
 			oid = SYSCTL_ADD_NODE(ctx,
 					      SYSCTL_CHILDREN(
 						      device_get_sysctl_tree(dev)),

From owner-svn-src-head@freebsd.org  Sat Aug  3 19:24:58 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2306FB8748;
 Sat,  3 Aug 2019 19:24:58 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 461DWG0C2qz4Zxs;
 Sat,  3 Aug 2019 19:24:58 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC55E1FB5C;
 Sat,  3 Aug 2019 19:24:57 +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 x73JOvQg029519;
 Sat, 3 Aug 2019 19:24:57 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x73JOvRI029515;
 Sat, 3 Aug 2019 19:24:57 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201908031924.x73JOvRI029515@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Sat, 3 Aug 2019 19:24:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r350563 - head/sbin/nvmecontrol
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sbin/nvmecontrol
X-SVN-Commit-Revision: 350563
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Aug 2019 19:24:58 -0000

Author: mav
Date: Sat Aug  3 19:24:56 2019
New Revision: 350563
URL: https://svnweb.freebsd.org/changeset/base/350563

Log:
  Add `nvmecontrol sanitize` command.
  
  It allows to delete all user data from NVM subsystem in one of 3 methods.
  It is a close equivalent of SCSI SANITIZE command of `camcontrol sanitize`,
  so I tried to keep arguments as close as possible.
  
  While there, fix supported sanitize methods reporting in `identify`.
  
  MFC after:	2 weeks
  Relnotes:	yes
  Sponsored by:	iXsystems, Inc.

Added:
  head/sbin/nvmecontrol/sanitize.c   (contents, props changed)
Modified:
  head/sbin/nvmecontrol/Makefile
  head/sbin/nvmecontrol/identify_ext.c
  head/sbin/nvmecontrol/nvmecontrol.8

Modified: head/sbin/nvmecontrol/Makefile
==============================================================================
--- head/sbin/nvmecontrol/Makefile	Sat Aug  3 18:26:16 2019	(r350562)
+++ head/sbin/nvmecontrol/Makefile	Sat Aug  3 19:24:56 2019	(r350563)
@@ -4,7 +4,7 @@ PACKAGE=runtime
 PROG=	nvmecontrol
 SRCS=	comnd.c nvmecontrol.c
 SRCS+=	devlist.c firmware.c format.c identify.c logpage.c ns.c nsid.c
-SRCS+=	perftest.c power.c reset.c
+SRCS+=	perftest.c power.c reset.c sanitize.c
 #SRCS+=	passthru.c
 SRCS+=	identify_ext.c nvme_util.c nc_util.c
 MAN=	nvmecontrol.8

Modified: head/sbin/nvmecontrol/identify_ext.c
==============================================================================
--- head/sbin/nvmecontrol/identify_ext.c	Sat Aug  3 18:26:16 2019	(r350562)
+++ head/sbin/nvmecontrol/identify_ext.c	Sat Aug  3 19:24:56 2019	(r350563)
@@ -160,11 +160,11 @@ nvme_print_controller(struct nvme_controller_data *cda
 	if (cdata->sanicap != 0) {
 		printf("%s%s%s\n",
 		    ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_CES_SHIFT) &
-		     NVME_CTRLR_DATA_SANICAP_CES_SHIFT) ? "crypto, " : "",
+		     NVME_CTRLR_DATA_SANICAP_CES_MASK) ? "crypto, " : "",
 		    ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) &
-		     NVME_CTRLR_DATA_SANICAP_BES_SHIFT) ? "block, " : "",
+		     NVME_CTRLR_DATA_SANICAP_BES_MASK) ? "block, " : "",
 		    ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) &
-		     NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) ? "overwrite" : "");
+		     NVME_CTRLR_DATA_SANICAP_OWS_MASK) ? "overwrite" : "");
 	} else {
 		printf("Not Supported\n");
 	}

Modified: head/sbin/nvmecontrol/nvmecontrol.8
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.8	Sat Aug  3 18:26:16 2019	(r350562)
+++ head/sbin/nvmecontrol/nvmecontrol.8	Sat Aug  3 19:24:56 2019	(r350563)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 2, 2019
+.Dd August 3, 2019
 .Dt NVMECONTROL 8
 .Os
 .Sh NAME
@@ -137,6 +137,16 @@
 .Aq device id
 .Aq namespace id
 .Nm
+.Ic sanitize
+.Aq Fl a Ar sanact
+.Op Fl c Ar owpass
+.Op Fl p Ar ovrpat
+.Op Fl r
+.Op Fl D
+.Op Fl I
+.Op Fl U
+.Aq device id
+.Nm
 .Ic power
 .Op Fl l
 .Op Fl p power_state
@@ -234,6 +244,65 @@ enables User Data Erase during format.
 Option
 .Fl C
 enables Cryptographic Erase during format.
+.Ss sanitize
+Sanitize NVM subsystem of specified controller,
+using specified parameters:
+.Bl -tag -width 6n
+.It Fl a Ar operation
+Specify the sanitize operation to perform.
+.Bl -tag -width 16n
+.It overwrite
+Perform an overwrite operation by writing a user supplied
+data pattern to the device one or more times.
+The pattern is given by the
+.Fl p
+argument.
+The number of times is given by the
+.Fl c
+argument.
+.It block
+Perform a block erase operation.
+All the device's blocks are set to a vendor defined
+value, typically zero.
+.It crypto
+Perform a cryptographic erase operation.
+The encryption keys are changed to prevent the decryption
+of the data.
+.It exitfailure
+Exits a previously failed sanitize operation.
+A failed sanitize operation can only be exited if it was
+run in the unrestricted completion mode, as provided by the
+.Fl U
+argument.
+.El
+.It Fl c Ar passes
+The number of passes when performing an
+.Sq overwrite
+operation.
+Valid values are between 1 and 16.
+The default is 1.
+.It Fl D
+No Deallocate After Sanitize.
+.It Fl I
+When performing an
+.Sq overwrite
+operation, the pattern is inverted between consecutive passes.
+.It Fl p Ar pattern
+32 bits of pattern to use when performing an
+.Sq overwrite
+operation.
+The pattern is repeated as needed to fill each block.
+.It Fl U
+Perform the sanitize in the unrestricted completion mode.
+If the operation fails, it can later be exited with the
+.Sq exitfailure
+operation.
+.It Fl r
+Run in
+.Dq report only
+mode.
+This will report status on a sanitize that is already running on the drive.
+.El
 .Ss wdc
 The various wdc command retrieve log data from the wdc/hgst drives.
 The

Added: head/sbin/nvmecontrol/sanitize.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sbin/nvmecontrol/sanitize.c	Sat Aug  3 19:24:56 2019	(r350563)
@@ -0,0 +1,222 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (C) 2019 Alexander Motin <mav@FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/ioccom.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "nvmecontrol.h"
+
+/* Tables for command line parsing */
+
+static cmd_fn_t sanitize;
+
+static struct options {
+	bool		ause;
+	bool		ndas;
+	bool		oipbp;
+	bool		reportonly;
+	uint8_t		owpass;
+	uint32_t	ovrpat;
+	const char	*sanact;
+	const char	*dev;
+} opt = {
+	.ause = false,
+	.ndas = false,
+	.oipbp = false,
+	.reportonly = false,
+	.owpass = 1,
+	.ovrpat = 0,
+	.sanact = NULL,
+	.dev = NULL,
+};
+
+static const struct opts sanitize_opts[] = {
+#define OPT(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc }
+	OPT("ause", 'U', arg_none, opt, ause,
+	    "Allow Unrestricted Sanitize Exit"),
+	OPT("ndas", 'D', arg_none, opt, ndas,
+	    "No Deallocate After Sanitize"),
+	OPT("oipbp", 'I', arg_none, opt, oipbp,
+	    "Overwrite Invert Pattern Between Passes"),
+	OPT("reportonly", 'r', arg_none, opt, reportonly,
+	    "Report previous sanitize status"),
+	OPT("owpass", 'c', arg_uint8, opt, owpass,
+	    "Overwrite Pass Count"),
+	OPT("ovrpat", 'p', arg_uint32, opt, ovrpat,
+	    "Overwrite Pattern"),
+	OPT("sanact", 'a', arg_string, opt, sanact,
+	    "Sanitize Action (block, overwrite, crypto)"),
+	{ NULL, 0, arg_none, NULL, NULL }
+};
+#undef OPT
+
+static const struct args sanitize_args[] = {
+	{ arg_string, &opt.dev, "controller-id" },
+	{ arg_none, NULL, NULL },
+};
+
+static struct cmd sanitize_cmd = {
+	.name = "sanitize",
+	.fn = sanitize,
+	.descr = "Sanitize NVM subsystem",
+	.ctx_size = sizeof(opt),
+	.opts = sanitize_opts,
+	.args = sanitize_args,
+};
+
+CMD_COMMAND(sanitize_cmd);
+
+/* End of tables for command line parsing */
+
+static void
+sanitize(const struct cmd *f, int argc, char *argv[])
+{
+	struct nvme_controller_data	cd;
+	struct nvme_pt_command		pt;
+	struct nvme_sanitize_status_page ss;
+	char				*path;
+	uint32_t			nsid;
+	int				sanact = 0, fd, delay = 1;
+
+	if (arg_parse(argc, argv, f))
+		return;
+
+	if (opt.sanact == NULL) {
+		if (!opt.reportonly) {
+			fprintf(stderr, "Sanitize Action is not specified\n");
+			arg_help(argc, argv, f);
+		}
+	} else {
+		if (strcmp(opt.sanact, "exitfailure") == 0)
+			sanact = 1;
+		else if (strcmp(opt.sanact, "block") == 0)
+			sanact = 2;
+		else if (strcmp(opt.sanact, "overwrite") == 0)
+			sanact = 3;
+		else if (strcmp(opt.sanact, "crypto") == 0)
+			sanact = 4;
+		else {
+			fprintf(stderr, "Incorrect Sanitize Action value\n");
+			arg_help(argc, argv, f);
+		}
+	}
+	if (opt.owpass == 0 || opt.owpass > 16) {
+		fprintf(stderr, "Incorrect Overwrite Pass Count value\n");
+		arg_help(argc, argv, f);
+	}
+
+	open_dev(opt.dev, &fd, 1, 1);
+	get_nsid(fd, &path, &nsid);
+	if (nsid != 0) {
+		close(fd);
+		open_dev(path, &fd, 1, 1);
+	}
+	free(path);
+
+	if (opt.reportonly)
+		goto wait;
+
+	/* Check that controller can execute this command. */
+	read_controller_data(fd, &cd);
+	if (((cd.sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) &
+	     NVME_CTRLR_DATA_SANICAP_BES_MASK) == 0 && sanact == 2)
+		errx(1, "controller does not support Block Erase");
+	if (((cd.sanicap >> NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) &
+	     NVME_CTRLR_DATA_SANICAP_OWS_MASK) == 0 && sanact == 3)
+		errx(1, "controller does not support Overwrite");
+	if (((cd.sanicap >> NVME_CTRLR_DATA_SANICAP_CES_SHIFT) &
+	     NVME_CTRLR_DATA_SANICAP_CES_MASK) == 0 && sanact == 4)
+		errx(1, "controller does not support Crypto Erase");
+
+	/*
+	 * If controller supports only one namespace, we may sanitize it.
+	 * If there can be more, make user explicit in his commands.
+	 */
+	if (nsid != 0 && cd.nn > 1)
+		errx(1, "can't sanitize one of namespaces, specify controller");
+
+	memset(&pt, 0, sizeof(pt));
+	pt.cmd.opc = NVME_OPC_SANITIZE;
+	pt.cmd.cdw10 = htole32((opt.ndas << 9) | (opt.oipbp << 8) |
+	    ((opt.owpass & 0xf) << 4) | (opt.ause << 3) | sanact);
+	pt.cmd.cdw11 = htole32(opt.ovrpat);
+
+	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
+		err(1, "sanitize request failed");
+
+	if (nvme_completion_is_error(&pt.cpl))
+		errx(1, "sanitize request returned error");
+
+wait:
+	read_logpage(fd, NVME_LOG_SANITIZE_STATUS,
+	    NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, &ss, sizeof(ss));
+	switch ((ss.sstat >> NVME_SS_PAGE_SSTAT_STATUS_SHIFT) &
+	    NVME_SS_PAGE_SSTAT_STATUS_MASK) {
+	case NVME_SS_PAGE_SSTAT_STATUS_NEVER:
+		printf("Never sanitized");
+		break;
+	case NVME_SS_PAGE_SSTAT_STATUS_COMPLETED:
+		printf("Sanitize completed");
+		break;
+	case NVME_SS_PAGE_SSTAT_STATUS_INPROG:
+		printf("Sanitize in progress: %u%% (%u/65535)\r",
+		    (ss.sprog * 100 + 32768) / 65536, ss.sprog);
+		fflush(stdout);
+		if (delay < 16)
+			delay++;
+		sleep(delay);
+		goto wait;
+	case NVME_SS_PAGE_SSTAT_STATUS_FAILED:
+		printf("Sanitize failed");
+		break;
+	case NVME_SS_PAGE_SSTAT_STATUS_COMPLETEDWD:
+		printf("Sanitize completed with deallocation");
+		break;
+	default:
+		printf("Sanitize status unknown");
+		break;
+	}
+	if (delay > 1)
+		printf("                       ");
+	printf("\n");
+
+	close(fd);
+	exit(0);
+}